An introduction to Suricata IDS given during CLUSIS Campus 2015 in Geneva
©2014 KUDELSKI GROUP / All rights reserved.SURICATA IDSJulien Bachmann
View Slide
2 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONIDS or IPS ?Intrusion Detection SystemIntrusion Prevention SystemBased on signaturesVulnerability centric
3 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONVulnerability centricPrevention and detection basedAssume you know all possible threatsSignature based detectionSome behavioral approach but not so commonNo feedbackOpposite to threat centric approach
4 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONThreat centricSuppose prevention will fail…Based on attackers TTPsTools, Tactics and ProceduresUses bad experiences as feedback to improve
5 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONSuricataOpen Source projectRun by the Open Information Security FoundationInitiative by DHS in 2008…… but now supported by group of vendors
6 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONAlso an IPSNetFilter on Linuxipfw on BSDModeBridge
7 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONSetup on Linux# iptables –I FORWARD –j NFQUEUE# suricata –c … -q 0…# iptables –FRulesdrop keyword
8 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONWhy not SNORT ?Only solution for quite some timeWhich has an aging core (ok, v3 is out…)Support multi-threadingSupport for capture cardsor PF_RING on commodity hardware10Gb/s on Xeon with 8 coresGPU acceleration for regexp matching!who doesn’t have a GPU in their IDS nowadays?
9 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONPF_RING
10 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONSignaturesSupport for SNORT onesexcept SO rulesEmergingThreatsCustomsincluding LUA scripts for detection with some logic
11 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONDeploymentPackages or easily self-compiledConfigurationsuricata.yamlRules managementoinkmaster
12 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONFor testing purposesThe Security OnionStamus Networks SELKS
13 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONWhy would I use this ?Complimentary to commercial solutionWrite your custom rulesnewly published vulnerabilitymalware infectionongoing incident responsecapitalize on previous attacksThreat centric approach
14 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTIONDeployment strategiesImportant rule: Know your networkIngress / Egress pointsInternet access proxiesVPNPartnersCopy traffic using port mirroring
15 ©2014 KUDELSKI GROUP / All rights reserved.INTRODUCTION
16 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONBasic ideaLook everywhere in the packetNot very fine-grainedalert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"looking everywhere foroverflow"; flow:established; content:"|41 41 41 41|"; content:"|42 42|";distance:0; classtype:shellcode-detect; sid:1; rev:1;)
17 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONNext ideaSpecify portsWhat if $ADMIN changed default ports?alert tcp $EXTERNAL_NET any -> $HOME_NET [80, 8080] (msg:"looking for webrequests"; flow:established; content:"GET /"; nocase; classtype:not-suspicious;sid:1; rev:1;)
18 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONBetter ideaSpecify protocolLet the engine detect it for youalert http $EXTERNAL_NET any -> $HOME_NET any (msg:"looking for web requests";flow:established; content:"GET"; http_method; nocase; classtype:not-suspicious;sid:1; rev:1;)
19 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONBetter ideaWhat about the next one?alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"looking for web requests";flow:established; content:“GET"; content:“POST"; http_method; nocase;classtype:not-suspicious; sid:1; rev:1;)
20 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | DEMOAnalyze malware communicationsMalware.pcap
21 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | DEMO• Analyze malware communications– alert tcp any any -> $HOME_NET any (msg:"CyberEye RAT session";content:"ANABILGI|" sid:1; rev:1;)
22 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONSeveral implementedHTTPDNSSMBSSHFTPTLSJabber…Allows to match specific fields
23 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONWait, TLS and SSH? Isn’t it encrypted?Not so fast, no TLS decryption on the flyMainly allows to extract informationFingerprintIssuerDN…
24 ©2014 KUDELSKI GROUP / All rights reserved.RULES 101 | PROTOCOL DETECTIONUse caseRemember Comodo story?Log proactively
25 ©2014 KUDELSKI GROUP / All rights reserved.RULES ADVANCED | FILESNo need to dig the PCAPs manuallyPossible to extract files matching rulesEnable file-store in suricata.yaml
26 ©2014 KUDELSKI GROUP / All rights reserved.RULES ADVANCED | FILESStore all PDF filesalert http $EXTERNAL_NET any -> $HOME_NET any (msg:"PDF downloaded";fileext:"pdf"; filestore; sid:1; rev:1;)alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"PDF downloaded";filemagic:"PDF document"; filestore; sid:1; rev:1;)
27 ©2014 KUDELSKI GROUP / All rights reserved.RULES ADVANCED | FILESDetect suspicious files uploadalert http $EXTERNAL_NET any -> $DMZ any (msg:"possible webshell upload attempt";fileext:"png"; filemagic:!"PNG"; filestore; sid:1; rev:1;)
28 ©2014 KUDELSKI GROUP / All rights reserved.RULES ADVANCED | FILESWhitelisting uploaded filesalert http $HOME_NET any -> $EXTERNAL_NET any (msg:"file upload"; fileext:"exe";filemd5:!know_good.txt; filestore; sid:1; rev:1;)
29 ©2014 KUDELSKI GROUP / All rights reserved.MONITORING | TOOLSHow do I review the events?syslog: not that practicalGraphical tools$COMMERCIAL_PRODUCTSnorbyOSSIMSguilELK
30 ©2014 KUDELSKI GROUP / All rights reserved.MONITORING | ELKElasticSearch Logstash KibanaNot really in that orderLogstash : read logs and forward and/or transformElasticSearch : indexed storageKibana : web interface to ES
31 ©2014 KUDELSKI GROUP / All rights reserved.MONITORING | ELKConfiguration in Suricata1. Enable EVE output2. Configure Logstash to read from EVE file3. Profit
32 ©2014 KUDELSKI GROUP / All rights reserved.MONITORING | DEMOSELKUsing Stamus Network SELK
33 ©2014 KUDELSKI GROUP / All rights reserved.CONCLUSION | FINAL WORDSThings I did not discussSensor hardeningLUA scripting engineRules sets comparison
34 ©2014 KUDELSKI GROUP / All rights reserved.CONCLUSION | FINAL WORDSThings to keep in mindThere are alternative to commercial toolsPreconfigured distributionsIncident response can benefit custom rulesELK stack becoming more and more used in DFIR