snort rules:
alert tcp any any -> any 22 ( msg:"SSH Brute Force Attempt";
flow:established,to_server; content:"SSH"; nocase; ffset:0; depth:4;
detection_filter:track by_src, count 2, seconds 1; sid:1000001; rev:1;)
首先標明了action為alert,並指定是來自任何ip送到本機的22 port,接著檢視其payload的前四個byte是否吻合"SSH",並加入一個filter篩出嘗試rate高於設定的數值,這裡設定是若一秒收到了兩次以上就會爆alert。
snort rule:
log icmp any any -> any any
簡單的將使用icmp協定、來自任何地方的packet都log起來。
sudo nmap -sT 192.168.69.13
使用tcp模式掃描目標。
alert tcp any nay -> 192.168.69.13 any (msg: "TCP Scan Alert";sid:10000005;rev:2;)
對每個tcp連線發起alert,因為nmap會大量掃port,我們可以在alert看是否有逐個port被嘗試連線的情況,輔助判斷是否為nmap掃描的情況。
我們可以看到,192.168.69.15對本機的所有port都在短時間進行了tcp連線嘗試,極有可能為nmap的行為。
alert tcp any any -> any 80 (msg:"b07901142:Malicious File donwload!";content:"GET /nota.php HTTP/1.1";sid:10000001;)
alert tcp any any -> any 80 (msg:"b07901142:Malicious File donwload!";content:"GET /6E%2028%205B";sid:10000002;)
alert tcp any any -> any 80 (msg:"b07901142:Malicious File donwload!";content:"GET /IM-qArGWggJ";sid:10000003;)
alert tcp any any -> any 80 (msg:"b07901142:Malicious File donwload!";content:"POST /novidades/inspecionando.php";sid:10000004;)
以content濾掉包含這些字串的http request。
alert tcp any any -> any 502 (msg:"b07901142 TCP Scan Alert";content:"|05|"; offset:7; depth:1;sid:1000005;)
篩通往502 port的封包,當中要注意text"05"這一個byte有沒有出現在第七個位置。