The syntax for a Snort rule is:
action proto source_ip source_port direction destination_ip destination_port (options)
So you cannot specify tcp
and udp
in the same rule; you would have to make two separate rules. You also won't be able to use ip
because it ignores the ports when you do.
For IP or port ranges, you can use brackets and/or colons, such as [443,447]
or [443:447]
.
So rules would be:
alert tcp any any -> any [443,447] (msg:"Sample rule"; sid:1; rev:1)
alert udp any any -> any [443,447] (msg:"Sample rule"; sid:2; rev:1)
A note about SIDs
The Cisco Talos rules are all under 100,000. If you run those rules in conjunction with custom rules, it is recommended that you begin numbering your custom rules at 1,000,000 and up.
However, if not, you can number them whatever you would like, as long as they do not collide with one another. A common mistake is having multiple rules with the same SID (due to copy/pasting) and forgetting to change the SID and then wondering why only one rule fires: because if you specify a rule with the same SID as another, it's overwritten.