Snortsam and Portscanning Detection
This Post Originally From Snort-users by Frank
Q
: How can i use the snort portscan2 preprocessor with snortsam?
A
:it doesn't matter what version of Snort you are using, 1.9.x, 2.0.x, or 2.1.x. Alerts from the portscan preprocessor (or any other preprocessor such as ARP spoof) are not recognized by Snortsam. It only reacts to alerts generated by packets detected with rules.
That said, port scans can be detected. However, you will have to create your own rules for that. There are two ways (and a combined way) of doing this.
a) Create rules that fire when you can packets going to unused IP
addresses. For example:
var UNUSED [x.x.x.x, y.y.y.y, etc] alert tcp any any -> $UNUSED any (msg:"TCP port scan"; fwsam: src, 20 min alert ucp any any -> $UNUSED any (msg:"UCP port scan"; fwsam: src, 20 min alert icmp any any -> $UNUSED any (msg:"ICMP scan"; fwsam: src, 20 min
b) If you only have one IP address, create rules that monitor the ports
around used ports. For example, if you have a server for web and email
on the same IP, use:
alert tcp any any -> $HOME_NET 1:24 (msg:"TCP port scan"; fwsam: src, 20 min
Note how you watch the ports from 1 through 24, not 25 since that's used
for mail, and then 26 through 79, etc.
Repeat the same with unused UDP ports.
Detecting port scans using those rules is much more efficient since you can detect scans by a single packet.