The rules you provided do not work on my setup: I don't get any alert.
Maybe it's interesting to note that when I change "uricontent" to
"content" in the third and fourth rule and subsequently restart Snort
and go to
mysite.com/test.php, the fourth rule generates an alert, but
the third does not. The only difference between the third and the fourth
rule is that the third rule contains "flow:to server,established;",
which apparently can also not be checked by my system. So all three
"uricontent", adding "http_uri;" after the content specification and
"flow:to server,established;" do not work here. I'm really eager to
solve the problem, so if you know any step I could take, please let me
know! I could also provide additional data if you need it.
Thanks!
Y M schreef op 5/8/2014 8:14 PM:
>> Also I see no reason why replacing "content" with "uricontent" should not work, because as the official Snort documentation says: "This is equivalent to using the http_uri modifier to a content keyword." (refer to
http://manual.snort.org/node385.html).
> Re-reading your email and my reply I realize I got this one completely backwards :), sorry about that.
>> I agree that this is a preferable addition in order to fine-tune the rule, but adding this makes no difference when I have 'content:"/test.php"; http_uri;' in my rule, i.e. it still does not trigger an alert. This also seems logical because it only applies an additional filter.
> Flow direction matters since Snort keeps track of the session, and should reflect the direction you are trying to match. I forgot to mention that you also need to define the state of your flow (established, stateless, etc). Without a packet capture and your configuration it is difficult for me to see what you are trying to accomplish. That said, I setup a quick web server and tested the following rules, they all worked:
> alert tcp any any -> $HOME_NET $HTTP_PORTS (msg:"test"; flow:to_server,established; content:"/test.php"; http_uri; classtype:unknown; sid:99000001; rev:1;)alert tcp any any -> $HOME_NET $HTTP_PORTS (msg:"test"; flow:to_server; content:"/test.php"; http_uri; classtype:unknown; sid:99000002; rev:1;)alert tcp any any -> $HOME_NET $HTTP_PORTS (msg:"test"; flow:to_server,established; uricontent:"/test.php"; classtype:unknown; sid:99000003; rev:1;)alert tcp any any -> $HOME_NET $HTTP_PORTS (msg:"test"; uricontent:"/test.php"; classtype:unknown; sid:99000004; rev:1;)
> YM