Hi
I’ve been playing with Suricata and have written a couple of rules. They work fine when running Suricata live on a network interface. However, if I capture the traffic and run Suricata against the pcap then no alerts are generated.
For example this rule:
alert dns $HOME_NET any -> any any (msg:"Facebook not allowed"; dns_query; content: "facebook.com"; nocase; endswith; classtype: policy-violation; sid: 42;)
Works perfectly when capturing on a nic, but not when reading a pcap. I also tried using ‘any any -> any any’ but that didn’t work either.
I run Suricata like this:
suricata -vvv -r /facebook.pcap -S /myrules.rules
...
Loading rule file: /myrules.rules
1 rule files processed. 3 rules successfully loaded, 0 rules failed
...
Starting file run for /facebook.pcap
pcap file /facebook.pcap end of file reached (pcap err code 0)
...
3 flows processed
Pcap-file module read 1 files, 6 packets, 503 bytes
Alerts: 0
...
The pcap contains this:
$ tshark -r facebook.pcap
1 0.000000 192.168.1.103 → 8.8.8.8 DNS 72 Standard query 0xc3a7 A facebook.com
2 0.017943 8.8.8.8 → 192.168.1.103 DNS 88 Standard query response 0xc3a7 A facebook.com A 157.240.200.35
3 0.018770 192.168.1.103 → 8.8.8.8 DNS 72 Standard query 0x1334 AAAA facebook.com
4 0.037370 8.8.8.8 → 192.168.1.103 DNS 100 Standard query response 0x1334 AAAA facebook.com AAAA 2a03:2880:f153:82:face:b00c:0:25de
5 0.037711 192.168.1.103 → 8.8.8.8 DNS 72 Standard query 0x9961 MX facebook.com
6 0.054699 8.8.8.8 → 192.168.1.103 DNS 99 Standard query response 0x9961 MX facebook.com MX 10 smtpin.vvv.facebook.com
Why no alerts?
I also tried having a lua rule. I simply return 1 from the match function and also print a message.
The message is printed when running suricata but still, no alerts.
What am I doing wrong?