[Snort-users] Snortsam / Portscanning Detection

Frank Knobbe frank at ...9761...
Mon Dec 29 14:29:02 EST 2003

On Mon, 2003-12-29 at 13:45, Tuomas Groves wrote:
> I was going to try to get our PIX firewall setup with snort / snortsam 
> and I had a question. We are interested in having the firewall block the 
> offending IP address when we receive a portscan, but I could not figure 
> out where we should place the "fwsam: src, 5 minutes;" entry. Because in 
> snort 2.1.0, I do not know about previous versions, the portscanning 
> detection is a preprocessor.


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
alert ucp any any -> $UNUSED any (msg:"UCP port scan"; fwsam: src, 20
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
alert tcp any any -> $HOME_NET 26:79 (msg:"TCP port scan"; fwsam: src,
20 min;)
alert tcp any any -> $HOME_NET 81:1024 (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.

Hope this helps,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
URL: <https://lists.snort.org/pipermail/snort-users/attachments/20031229/f8b568d1/attachment.sig>

More information about the Snort-users mailing list