V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
通过以下 Referral 链接购买 DigitalOcean 主机,你将可以帮助 V2EX 持续发展
DigitalOcean - SSD Cloud Servers
hector
V2EX  ›  VPS

vps 正在发大量的垃圾邮件

  •  
  •   hector · May 3, 2016 · 701 views
    This topic created in 3656 days ago, the information mentioned may be changed or developed.

    突然发现磁盘满了,查询之下, maillog 以及 mqueue 目录巨大,先删除,重启之后仍然在发

    maillog:

    May 2 16:21:28 web01 sendmail[4005]: u42GLSIA004005: [email protected], ctladdr=rosemary_curry@there_is_my_domain.com (501/501), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=36494, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

    看了下 iptables , 25 端口应该没开,last 登陆没有奇怪的用户名, ip 比较多,我自己的 ip 也不是特别固定。

    求教应该怎么查找原因,解决问题,防范再次发生。

    Supplement 1  ·  May 3, 2016
    ps 查看 sendmail 进程,是 www 用户发的,可能是 WordPress 被注入了, vps 里面装了好几个不常用的 wp ,怎么查找问题出在哪儿呢?
    Supplement 2  ·  May 3, 2016
    搜了下 wp 的代码,发现好多主题注入的代码,先睡了,明天再看
    1 replies    2016-05-03 19:14:05 +08:00
    usernametoolong
        1
    usernametoolong  
       May 3, 2016
    哈哈哈,今天在 hostloc 看到个说 wordpress 默认主题有坑的帖子。
    先把端口封了 慢慢排查吧,最好是备份好数据删除所有的 php 下新的 wordpress 恢复数据库和附件,删掉不信任的主题。

    iptables -A INPUT -p tcp -m multiport --dport 25,110,465:587,993:995,3076:3077,6881:6889 -j DROP
    iptables -A INPUT -p udp -m multiport --dport 25,110,465:587,993:995,3076:3077,6881:6889 -j DROP
    iptables -A OUTPUT -p tcp -m multiport --dport 25,110,465:587,993:995,3076:3077,6881:6889 -j DROP
    iptables -A OUTPUT -p udp -m multiport --dport 25,110,465:587,993:995,3076:3077,6881:6889 -j DROP
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4154 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 10:18 · PVG 18:18 · LAX 03:18 · JFK 06:18
    ♥ Do have faith in what you're doing.