Comprised of packet decoder, pre processor, detection engine, logging and alerting, output and plugins
snort -c <config> -T
| Parameter | Description | +-----------+-------------+ | -v | Verbose. Display the TCP/IP output in the console.| | -d | Display the packet data (payload).| | -e | Display the link-layer (TCP/IP/UDP/ICMP) headers. | | -X | Display the full packet details in HEX.| | -i | Liste on interface |
tcp port 80
tcpdump -r <logfile>
| Parameter | Description | |-----------|-------------| | -l | Logger mode, target log and alert output directory. Default output folder is tcpdump to /var/log/snort.| | -K ASCII | Log packets in ASCII format | | -r | Filter dumped logs in Snort | | -n | Specify the number of packets that will be read |
| Parameter | Description | |-----------|-------------| | -c | Defining the configuration file | | -T | Testing the configuration file | | -N | Disable logging | | -D | Background mode | | -A | Alert modes; full: all possible info about alerts, default mode; fast : alert message, timestamp, source and destination IP, port numbers. console: Provides fast style alerts on the console screen. cmg: CMG style, basic header details with payload in hex and text format. none: Disabling alerting |
/etc/snort/rules/local.rules
alert icmp any any <> any any (msg: "ICMP Packet Found"; sid: 100001; rev:1;)
snort -c <configfile> -r file.pcap -A console -n <number of packets>
snort -c <configfile> --pcap-list="file1.pcap file2.pcap" -A console -l .
snort -c /etc/snort/rules/local.rules -A console
snort -c /etc/snort/rules/local.rules -A full
General, payload and non payload rules
Direction of the packet
->
to destination <>
bidirectionalIDS -> alert
reject
<action> <protocol> <ip.src> <src.port> <> <ip.dst> <dst.port>(msg: "<msg>; <reference>; <ruleID>;<revision info>
Actions
alert
log
drop
reject
SID rule IDs
= 1,000,000 user rules
Reference may be a CVE
Revisions are versionings of the rule
Filter address range via CIDR
alert icmp 192.168.1.0/24 any <> any any (msg: "ICMP Packet Found"; sid: 100001; rev:1;)
alert icmp [192.168.1.0/24, 10.1.1.0/24] any <> any any (msg: "ICMP Packet Found"; sid: 100001; rev:1;)
!10.10.0.1
alert icmp any 4711,8080: <> any any (msg: "TCP Packet Found"; sid: 100001; rev:1;)
/etc/snort/rules/local.rules
ASCII mode - alert tcp any any -> any 8080 (msg: "GET Request Found"; content:"GET";content: "/foo"; sid: 100001; rev:1;)
alert tcp any any -> any 8080 (msg: "GET Request Found"; content:"|47 45 54|"; sid: 100001; rev:1;)
alert tcp any any -> any 8080 (msg: "GET Request Found"; content:"GET"; nocase; sid: 100001; rev:1;)
alert tcp any any <> any 80 (msg: "GET Request Found"; content:"GET"; fast_pattern; content:"www"; sid:100001; rev:1;)
flags: F,S,A,R,P,U
dsize:min<>max
alert ip any any <> any any (msg: "SAME-IP TEST"; sameip; sid: 100001; rev:1;)
id: 4711
Social_engineering