11# OPNsense's Suricata IDS/IPS Detection Rules Against NMAP Scans
2- # v. 2.02 / May 24th 2024 by Aleksi Bovellan
2+ # v. 2.1 / May 26th 2024 by Aleksi Bovellan
33# https://github.com/aleksibovellan/opnsense-suricata-nmaps
44
55
88
99# SYN SCAN -sS (speeds T1-T5)
1010
11- alert tcp any any -> any [21,22,23,25,53,80,88,110,135,137,138,139,161,389,443,445,465,514,587,636,853,993,995,1433,1720,1194, 3306,3389,8443, 8080,11211,27017,51820] (msg:"POSSBL PORT SCAN (NMAP -sS)"; flow:to_server,stateless; flags:S; window:1024; tcp.mss:1460; threshold:type threshold, track by_src, count 20, seconds 70; classtype:attempted-recon; sid:3400001; priority:2; rev:1;)
11+ alert tcp any any -> any [21,22,23,25,53,80,88,110,135,137,138,139,143, 161,389,443,445,465,514,587,636,853,993,995,1194, 1433,1720,3306,3389,8080,8443 ,11211,27017,51820] (msg:"POSSBL PORT SCAN (NMAP -sS)"; flow:to_server,stateless; flags:S; window:1024; tcp.mss:1460; threshold:type threshold, track by_src, count 20, seconds 70; classtype:attempted-recon; sid:3400001; priority:2; rev:1;)
1212
13- alert tcp any any -> any ![21,22,23,25,53,80,88,110,135,137,138,139,161,389,443,445,465,514,587,636,853,993,995,1433,1720,1194, 3306,3389,8443, 8080,11211,27017,51820] (msg:"POSSBL PORT SCAN (NMAP -sS)"; flow:to_server,stateless; flags:S; window:1024; tcp.mss:1460; threshold:type threshold, track by_src, count 7, seconds 135; classtype:attempted-recon; sid:3400002; priority:2; rev:2;)
13+ alert tcp any any -> any ![21,22,23,25,53,80,88,110,135,137,138,139,143, 161,389,443,445,465,514,587,636,853,993,995,1194, 1433,1720,3306,3389,8080,8443 ,11211,27017,51820] (msg:"POSSBL PORT SCAN (NMAP -sS)"; flow:to_server,stateless; flags:S; window:1024; tcp.mss:1460; threshold:type threshold, track by_src, count 7, seconds 135; classtype:attempted-recon; sid:3400002; priority:2; rev:2;)
1414
1515
16- # SYN-ACK 3-WAY SCAN -sT (speeds T3 -T5)
16+ # SYN-ACK 3-WAY SCAN -sT (speeds T2 -T5)
1717
18- alert tcp any ![22,53,80,88,443,853,1194,8080,51820] -> any ![22,53,80,88,443,853,1194,8080,51820] (msg:"POSSBL PORT SCAN (NMAP -sT)"; flow:to_server; flags:S; threshold:type threshold, track by_src, count 350 , seconds 60 ; classtype:attempted-recon; sid:3400003; rev:3;)
18+ alert tcp any ![22,25, 53,80,88,143, 443,445,465,587, 853,993, 1194,8080,51820] -> any ![22,25, 53,80,88,143, 443,445,465,587, 853,993, 1194,8080,51820] (msg:"POSSBL PORT SCAN (NMAP -sT)"; flow:to_server; window:32120; flags:S; threshold:type threshold, track by_src, count 20 , seconds 70 ; classtype:attempted-recon; sid:3400003; rev:3;)
1919
2020
2121# ACK SCAN -sA (speeds T2-T5)
2222
23- alert tcp any ![22,53,80,88,443,853,1194,8080,51820] -> any ![22,53,80,88,443,853,1194,8080,51820] (msg:"POSSBL PORT SCAN (NMAP -sA)"; flags:A; flow:stateless; window:1024; threshold:type threshold, track by_dst, count 20, seconds 70; classtype:attempted-recon; sid:3400004; priority:2; rev:5;)
23+ alert tcp any ![22,25, 53,80,88,143, 443,445,465,587, 853,993, 1194,8080,51820] -> any ![22,25, 53,80,88,143, 443,445,465,587, 853,993 ,1194,8080,51820] (msg:"POSSBL PORT SCAN (NMAP -sA)"; flags:A; flow:stateless; window:1024; threshold:type threshold, track by_dst, count 20, seconds 70; classtype:attempted-recon; sid:3400004; priority:2; rev:5;)
2424
2525
2626# CHRISTMAS TREE SCAN -sX (speeds T1-T5)
@@ -43,7 +43,7 @@ alert udp any any -> any ![53,67,68,69,123,161,162,389,520,1026,1027,1028,1029,1
4343# For all usages of destination port 4444:
4444
4545# TCP destination port: 4444
46- alert tcp any ![21,22,23,25,53,80,88,110,143,443,445,465,587,853,993,995,1194,8080,51820] -> any 4444 (msg:"POSSBL SCAN SHELL M-SPLOIT TCP"; classtype:trojan-activity; sid:3400020; priority:1; rev:2;)
46+ alert tcp any ![21,22,23,25,53,80,88,110,135,137,138,139, 143,161,389, 443,445,465,514, 587,636, 853,993,995,1194,1433,1720,3306,3389, 8080,8443,11211,27017 ,51820] -> any 4444 (msg:"POSSBL SCAN SHELL M-SPLOIT TCP"; classtype:trojan-activity; sid:3400020; priority:1; rev:2;)
4747
4848# UDP destination port: 4444
4949alert udp any ![53,67,68,69,123,161,162,389,520,1026,1027,1028,1029,1194,1434,1900,11211,12345,27017,51820] -> any 4444 (msg:"POSSBL SCAN SHELL M-SPLOIT UDP"; classtype:trojan-activity; sid:3400021; priority:1; rev:2;)
0 commit comments