Meerkats *Suricata suricatta* are known for their sentinel behavior, patiently and alertly standing watch over their class. Sentries who stand guard gain trust through their experience and reputation, not through their age or social rank. Suricata is an open source intrusion detection and prevention engine.
|
• Easy to deploy in just a few steps
|
|
• Purpose built to do 1 thing well
|
|
• Installs easily on your favorite platform
|
|
• Configurable to your network architecture
|
|
• Write/Tune/Update/Delete your rules
|
|
• Export/forward data to a SIEM (e.g., Splunk)
|
|
$ tar xzvf suricata-6.0.0.tar.gz
|
|
$ cd suricata-6.0.0
|
|
$ ./configure
|
|
$ make && sudo make install
|
|
$ sudo add-apt-repository ppa:oisf/suricata-stable
|
|
$ sudo apt update
|
|
$ sudo apt install suricata jq
|
|
$ sudo suricata --build-info
|
|
$ sudo systemctl status suricata
|
|
$ sudo vim /etc/suricata/suricata.yaml
|
|
$ sudo systemctl restart suricata
|
|
$ suricata --build-info|grep -A 3 '\-\-prefix'
|
|
$ suricata --dump-config
|
|
$ suricata --list-app-layer-protos
|
|
$ sudo vim /etc/suricata/suricata.yaml
|
|
#LISTENMODE=af-packet #IDS1
|
|
#LISTENMODE=nfqueue #IPS1
|
|
/etc/suricata/classification.config #classtypes
|
|
/etc/suricata/rules #files end in .rules
|
|
/etc/suricata/rules/custom.rules #local rules
|
|
/etc/suricata/suricata.yaml #config file
|
|
/etc/suricata/threshold.config #limit firing
|
|
/etc/suricata/variables.config #local defined
|
|
$ tail -f /var/log/suricata/fast.log (alerts)
|
|
$ tail -f /var/log/suricata/http.log (http requests)
|
|
$ tail -f /var/log/suricata/suricata.log (changes)
|
|
$ tail -f /var/log/suricata/stats.log (counters)
|
|
$ jq 'select(.event_type=="alert")' /var/log/suricata/eve.json #watch all alerts fire
|
|
$ jq 'select(.alert .signature_id==2100498)' /var/log/suricata/eve.json #specific alert fire
|
|
$ jq 'select(.event_type=="stats")' /var/log/suricata/eve.json #monitor statistics
|
|
$ jq 'select(.event_type=="stats")|.stats.capture.kernel_packets' /var/log/suricata/eve.json #kernel stats
|
|
$ sudo suricata -c /etc/suricata/suricata.yaml -T -vvv #check config/look for <Notice> - Configuration provided was successfully loaded. Exiting. in the output
|
|
$ sudo systemctl restart suricata #restart
|
|
$ sudo systemctl status -l suricata #status
|
|
$ grep -Ril <SID#> #get flagged SID in rules
|
|
[ERRCODE: SC_ERR_CONF_YAML_ERROR(242)] - App-Layer protocol sip enable status not set (Enable in suricata.yaml app-layer stanza)
|
|
• Target the vulnerability, not the exploit
|
|
• Target activity outside normal hours
|
|
• Target to eliminate traffic of no interest
|
|
• Target IP ranges based on your network
|
|
• Target unusual conns, ports/protocols
|
|
• Test, tune, and validate!
|
|
icmp
|
ip1
|
|
tcp
|
udp
|
|
dcerpc
|
dhcp
|
dnp31
|
dns
|
|
enip1
|
ftp
|
http
|
http2
|
|
ikev2
|
imap
|
krb5
|
modbus*
|
|
nfs
|
ntp
|
rfb
|
rdp
|
|
sip
|
smb
|
smtp
|
snmp
|
|
ssh
|
tftp
|
tls (incl ssl)
|
|
|
• action (what happens on a rule match)
|
|
• header (protocol, address, port, direction)
|
|
• options (specifics of the rule)
|
|
• Alert generates an alert for later analysis
|
|
• Pass stops scanning, allows packet to pass, no alert
|
|
• Drop (IPS) stops processing/creates alert
|
|
• Reject (IPS) rst sent, matching packet dropped
|
|
• Rejectsrc same as just reject
|
|
• Rejectdst send RST/ICMP error packet to receiver of the matching packet
|
|
• Rejectboth send RST/ICMP error packets to both sides of the conversation
|
|
<proto><src_ip><port> -> <dst_ip><port>
|
|
• ip any any -> any any
|
|
• tcp $EXTERNAL_NET any -> 10.200.0.0/24 80
|
|
• ssh any any -> 203.0.113.0/24 !2
|
|
• tcp $EXTERNAL_NET any -> $HOME_NET 80
|
|
• source -> destination
|
|
• source <> destination (both directions)
|
|
• categorizes traffic: config classification:shortname,short description,priority
|
|
• 3 fields (machine readable name, description, priority): config classification: bad-unknown,Potentially Bad Traffic, 2
|
|
• implicit priority assigned by classtype in /etc/suricata/classification.config
|
|
• to override classtype default priority add the priority:n option to a signature (where n is 1 to 255)
|
|
• find more info/links (Do NOT put http:// into reference string, assumed with url)
|
|
• use to tag CVE reference:cve,2014-0160; or MITRE T-Codes reference:tcode,1194;
|
|
• 1000000-1999999 Custom
|
|
• 2000000-2099999 Emerging Threats (ET)
|
|
• 2100000-2103999 Forked Snort GPL
|
|
• 2200000-2200999 Decoder events
|
|
• 2210000-2210999 Stream events
|
|
• 2220000-2299999 Reserved
|
|
• 2800000-2899999 ET Pro (subscrip. only)
|
|
• 2400000-2528999 Dynamically updated
|
|
$ sudo systemctl restart suricata
|
|
$ sudo kill -USR1 $(pidof suricata)1
|
|
$ sudo suricatasc -c reload-rules2
|
|
• Limit to 1 alert every 60 seconds for sid #2404000: threshold gen_id 1, sig_id 2404000, type threshold, track by_dst, count 1, seconds 60
|
|
• Limit to 10 alerts every 60 seconds for each source host: threshold gen_id 0, sig_id 0, type threshold, track by_src, count 10, seconds 60
|
|
• suppress to ensure no alerts are generated (suppression only considered post-matching): suppress gen_id 0, sig_id 0, track by_src, ip 1.2.3.4
|
|
• Read pcap files just like network traffic
|
|
$ sudo suricata -c /etc/suricata/suricata.yaml -r <pcap_location> -l <where to log results>^1
|
|
$ tail -f /var/log/suricata/fast.log
|
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.