Network Traffic Analysis With - Inl.gov

Transcription

Network Traffic Analysis withSeth Grover, Malcolm developer Cybersecurity R&D Idaho National Lab

Intrusion Detection Systems HIDS: Host Intrusion Detection Systems Agents run on individual hosts or devices on a networkNot what we’re talking about todayNIDS: Network Intrusion Detection Systems Monitor and analyze network traffic for anomalies:suspicious activity, policy violations, etc.Generally passive/out-of-band; otherwise it’s anIntrusion Prevention SystemDetection methods Signature-based detection (e.g., Suricata)Statistical anomaly-based detection (e.g., Random Cut Forest)Stateful protocol analysis detection (e.g., Zeek)comparitech.com2

IDS: Types of Attacks Scanning Attack Determine network topology IDS highlights connections from one hostto many other hosts in the network, or connectionattempts to sequential IP addresses and/or portsDenial of Service Attack Interrupt service by flooding requests or flaws in protocol implementations IDS identifies large volume of traffic from or to a particular host or invalid connectionstates (e.g., TCP SYN/ACK with no ACK)Penetration Attack Gain access to system resources by exploiting a software or configuration flaw Trickier, but IDS may detect vulnerable software versions or simply alert on unusualoperations (e.g., a “write” operation in an already-configured environment with mostly “read” operations)3

Extensible, open-source passive network analysisframework More than just an Intrusion Detection System: Packet capture (like) Traffic inspection (like) Intrusion detection (like) Log recording (like NetFlow and syslog) Scripting framework (like) 4

Strengths Analyzes both link-layer andapplication-layer behavior Content extraction Behavioral analysis Session correlation Can add support for uncommonprotocols through scripts/plugins Weaknesses Session metadata only (not fullpayload) Setup and configuration can becomplicated Produces flat textual log fileswhich can be unwieldy for indepth analysis 5

Zeek Log FilesNetworkProtocols Files Detection NetworkObservations corelight.com6

Network Protocols conn – Network session tracking Identified by session 4-tuple (originating IP:port, respondingIP:port) One session (line in a log file) for every IP connection Unique identifier (UID) ties lines from other logs to a sessionhttp , modbus , ftp , dns, etc. Protocol-specific log files created as traffic is seen Contain application-layer metadata about network activities7

Files files – File analysis results Each transferred file identified with FUID Associated with connection UID(s) over which file was transferred File name, mime type, file size, etc. provided when available pe – Analysis of Portable Executable (PE) files Target platform, architecture, OS, etc. for executables transferredacross the network x509 – Analysis of X.509 public key certificates8

Detection notice – Zeek concept of “alarms,” notices draw extraattention to an event Conn::Content Gap, DNS::External Name,FTP::Bruteforcing, Heartbleed::SSL Heartbeat Attack,HTTP::SQL Injection Attacker, Scan::Address Scan,Scan::Port Scan, Software::Vulnerable Version,SSH::Password Guessing, SSL::Certificate Expired,Weird::Activity, tml9

Detection (cont.) weird – Unexpected network-level activity 150 weirdness indicators across many protocols works/notice/weird.zeek.html#id1 signatures – Signature matches, including hits fromenabled carved file scanners like ClamAV, YARA and capa10

Network Observations Periodic dump of entities seen over the last day known certs – SSL certificates known devices – MAC addresses known hosts – Hosts with TCP handshakes known modbus – Modbus masters and slaves known services – Services (TCP “servers”) software – Software being used on the network (e.g., Apache,OpenSSH, etc.) Could be used for identifying vulnerable versions of software or firmware11

Strengths Large scale index packet captureand search tool Packet analysis engine withsupport for many common ITprotocols Web interface for browsing,searching, analysis and PCAPcarving for exporting PCAP payloads (not just sessionheader/metadata) are viewableand searchable Weaknesses No OT protocol support Adding new protocol parsersrequires C programming 12

A powerful open-source network traffic analysis tool ed deployment Suitable for field use (hunt or incident response) or SOC deployment. Runs in Docker on Linux,macOS and Windows platforms. Provides easy-to-use web-based user interfaces.Industry-standard tools Uses Arkime and Zeek for network traffic capture, Logstash for parsing and enrichment,OpenSearch for indexing and Dashboards and Arkime Viewer for visualization. Alsoleverages OpenSearch Anomaly Detection, Suricata IDS, YARA, capa, ClamAV, CyberChefand other proven tools for analysis of traffic and artifacts.Expanding control systems visibility Analyzes more protocols used in operational technology (OT) networks than otheropen-source or paid solutions. Ongoing development is focused on increasing thequantity and quality of industrial control systems (ICS) traffic.Dedicated sensor appliance Includes Hedgehog Linux, a hardened Linux distribution for capturing network traffic andforwarding its metadata to Malcolm.

ponentsCapture &AnalysisFile ScanningForwarding inPayloadAnalysisCyberChefArkimesession PCAPexport toFramework

olm/#ProtocolsInternet layerBorder Gateway Protocol (BGP)Building Automation and Control (BACnet)Bristol Standard Asynchronous Protocol (BSAP)Distributed Computing Environment / Remote Procedure Calls(DCE/RPC)Dynamic Host Configuration Protocol (DHCP)Distributed Network Protocol 3 (DNP3)Domain Name System (DNS)EtherCATEtherNet/IP / Common Industrial Protocol (CIP)FTP (File Transfer Protocol)GENISYSGoogle Quick UDP Internet Connections (gQUIC)Hypertext Transfer Protocol (HTTP)IPsecInternet Relay Chat (IRC)Lightweight Directory Access Protocol (LDAP)KerberosModbusMQ Telemetry Transport (MQTT)MySQLNT Lan Manager (NTLM)Network Time Protocol (NTP)OracleOpen Platform Communications Unified Architecture(OPC UA) BinaryOpen Shortest Path First (OSPF)OpenVPNPostgreSQLProcess Field Net (PROFINET)Remote Authentication Dial-In User Service (RADIUS)Remote Desktop Protocol (RDP)Remote Framebuffer / Virtual Network Computing (RFB/VNC)S7comm / Connection Oriented Transport Protocol (COTP)Secure Shell (SSH)Secure Sockets Layer (SSL) / Transport Layer Security (TLS)Session Initiation Protocol (SIP)Server Message Block (SMB) / Common Internet File System (CIFS)Simple Mail Transfer Protocol (SMTP)Simple Network Management Protocol (SNMP)SOCKSSTUN (Session Traversal Utilities for NAT)SyslogTabular Data Stream (TDS)Telnet / remote shell (rsh) / remote login (rlogin)TFTP (Trivial File Transfer Protocol)WireGuardvarious tunnel protocols (e.g., GTP, GRE, Teredo, AYIYA, IP-in-IP, etc.)* Industrial control systems protocols indicated with bold

ved File ScanOpenSearchDashboardshash- or stPCAPSuricataArkimeViewerArkimecapture16

ffic iscollectedpassively by theHedgehogsensor device Zeek, Arkime Captureand Suricata generatemetadata aboutnetworkcommunications Full PCAP may bestored locally on thesensor Files transfers aredetected and the filesscanned for threats PCAP may also beuploaded to orcaptured by Malcolmwithout requiring adedicated sensorMetadata issecurelyforwarded toMalcolm All communicationsbetween the sensorand aggregator areTLS-encrypted Sensor data includingresource utilization,syslog, audit logs,temperatures andmore may also beforwardedLogs areenriched andstored inOpenSearch Lookups areperformed for GeoIP,ASN, MAC-to-vendor,community ID, domainname entropy, etc. Network eventsnormalized acrossprotocols and datasources Best-guess techniquesapplied for identifyingobscure ICS traffic Enriched metadatamay be forwarded tohigher-tiered omaliesAlerts are sentover email,webhooks,Slack orAmazon Chime Default detectors areprovided for actionand result, flow sizeand types oftransferred files Custom detectors maybe created for anyaspect of anysupported protocol Alerts may betriggered by exceededthresholds, anomaliesdetected, customqueries, etc.Traffic isvisualized inOpenSearchDashboardsand ArkimeViewer Dozens of customdashboards areprovided for allsupported protocols PCAP payloads areretrieved from sensorautomatically ondemand Custom visualizationsmay be created viadrag-and-dropinterface Malcolm canauthenticate usersfrom its own list or viaActive Directory /LDAP

Configuring and Running Malcolm Runs natively in Docker orin a Virtual Machine 16 GB RAM, 4 cores,“enough” disk for PCAP andlogs suggested Documentation and sourcecode on GitHub:github.com/idaholab/Malcolm Walkthroughs on YouTube:search “Malcolm NetworkTraffic Analysis”18

Identifying Network Hosts and Subnets Assign custom names tonetwork hosts and subnetsprior to PCAP import Allows identification ofcross-segment traffic andname-based search and filter Define in text file(s) or viaweb interface https://localhost/name-map-ui19

Importing TrafficCaptures for Analysis Specify tags for searchand filter Enable Suricata and/or Zeekanalysis and file extraction Or configure as globaldefaults Upload PCAP files orarchived Zeek logs pcapng not supported yet https://localhost/upload20

Data Tagging and Enrichment Logstash enriches Zeek andSuricata log metadata MAC addresses to hardwarevendor GeoIP and ASN lookups Internal/external traffic basedon IP ranges Reverse DNS lookups DNS query and hostnameentropy analysis Connection fingerprinting (JA3 forTLS, HASSH for SSH, Community IDfor flows) tags field Populated for Arkime sessions,Zeek logs and Arkime alerts withtags provided on upload and wordsextracted from PCAP filenames internal source,internal destination,external source,external destination,cross segment21

Dashboards Front end for Zeek logs andSuricata alerts Prebuilt visualizations for allprotocols Malcolm parses WYSIWYG editors to createcustom visualizations anddashboards Drill down from high-leveltrends to specific items ofinterest https://localhost/dashboards22

Dashboards Filters and Search Time filter: definesearch time frame Query bar: write queriesin Lucene syntax or DQL(Dashboards QueryLanguage) Filter bar: define filtersusing a UI Pin filters as you moveacross dashboards Save queries and filtersfor reuse23

OverviewDashboards High-level view of trends,sessions and events Populated from logs across allprotocols Good jumping-off place forinvestigation24

Zeek Notices Zeek notices are thingsthat are odd orpotentially bad In addition to Zeek’sdefaults, Malcolmraises notices forrecent criticalvulnerabilities andattack techniques25

Suricata Alerts Protocol-awareSuricata signaturesgenerate alerts forsuspect traffic Use the defaultEmerging ThreatsOpen ruleset orcustom signaturesfrom other sources26

Security & ICS/IoT Security Overviews27

Actions andResults Malcolm normalizes“action” (e.g., write,read, create file, logon,logoff, etc.) and “result”(e.g., success, failure,access denied, notfound) across protocols28

Protocol DashboardsHighlight application-specific fields ofinterest Grouped by common IT protocols andICS/IoT protocols ICS protocols A BinaryPROFINETS7comm29

Discover Field-level details of logs matching filter criteria Create and view saved searches and column configurations View other events just before and after an event30

Custom Visualizations Create new visualizations from scratch orbased on existing charts or dashboards31

Search Syntax ComparisonArkimeDashboards (Lucene)Dashboards (DQL)event.dataset EXISTS!exists :event.datasetevent.dataset:*event.dataset ! EXISTS!NOTexists :event.datasetNOT event.dataset:*port.dst 22destination.port:22destination.port:22Field does not matcha valueport.dst ! 22NOT destination.port:22NOT destination.port:22Field matches at leastone of a list of valuestags [external source,external destination]tags:(external source ORexternal destination)tags:(external source orexternal destination)Field range (inclusive)http.statuscode 200&& http.statuscode 300http.statuscode:[200 TO300]http.statuscode 200and http.statuscode 300Field existsField does not existField matches a value34

Search Syntax Comparison (cont.)ArkimeDashboards (Lucene)Dashboards (DQL)Field range(exclusive)http.statuscode 200 &&http.statuscode 300http.statuscode:{200 TO300}http.statuscode 200and http.statuscode 300Field range (mixedexclusivity)http.statuscode 200 &&http.statuscode 300http.statuscode:[200 TO300}http.statuscode 200 andhttp.statuscode 300Match all searchterms (AND)(tags [external source,external destination]) &&(http.statuscode 401)tags:(external source ORexternal destination) ANDhttp.statuscode:401tags:(external sourceorexternal destination)andhttp.statuscode:401Match any searchterms (OR)(zeek ftp.password EXISTS!) (zeek http.password EXISTS!) (zeek.user "anonymous")exists :zeek ftp.passwordORexists :zeek http.passwordOR zeek.user:"anonymous"zeek ftp.password:*orzeek http.password:*orzeek.user:"anonymous"35

Search Syntax Comparison (cont.)ArkimeDashboards (Lucene)Dashboards (DQL)all Arkime search expressionsare field-basedmicrosoftmicrosofthost.dns "*micro?oft*"(? for single character, * fordns.host:*micro?oft*(? for single character, * forhost.http /.*www\.f.*k\.com.*/zeek http.host:/.*www\.f.*k\.com.*/Dashboards QueryLanguage does notcurrently support regexIPv4 valuesip 0.0.0.0/0source.ip:"0.0.0.0/0" ORdestination.ip:"0.0.0.0/0"source.ip:"0.0.0.0/0" ORdestination.ip:"0.0.0.0/0"IPv6 values(ip.src EXISTS! ip.dst EXISTS!) &&(ip ! 0.0.0.0/0)( exists :source.ip AND NOTsource.ip:"0.0.0.0/0") OR( exists :destination.ip AND NOTdestination.ip:"0.0.0.0/0")(source.ip:* and notsource.ip:"0.0.0.0/0") or(destination.ip:* and notdestination.ip:"0.0.0.0/0")Global stringsearch (anywherein the document)WildcardsRegexany characters)any characters)dns.host:*micro*ft*(* for any characters)36

Search Syntax Comparison (cont.)ArkimeDashboards (Lucene)Dashboards (DQL)country EXISTS!exists :destination.geo ORexists :source.geodestination.geo:* orsource.geo:*event.dataset rc 72.16.0.0/12"Search time frameUse Arkime timebounding controls underthe search barUse Dashboards time rangecontrols in the upperright-hand cornerUse Dashboards timerange controls in theupper right-hand cornerGeoIP informationavailablecountry EXISTS!exists :destination.geo ORexists :source.geodestination.geo:* orsource.geo:*GeoIP informationavailableLog typeIP CIDR Subnets37

Front end for both enriched Zeek logs, Suricata alerts and Arkimesessions Malcolm’s custom Arkime Zeek data source adds full support for Zeek logs toArkime, including ICS protocols Filter by data source (Zeek, Suricata or Arkime); or, view together “Wireshark at scale”: full PCAP availability for viewing packet payload exporting filtered and joined PCAP sessions running deep-packet searches https://localhost38

Arkime Filters and Search Time filter: define search time frame Map filter: restrict results to geolocation Query bar: write queries in Arkime syntax Views: overlay previously-specified filters on current search39

Sessions Field-level details of sessions/logsmatching filters Similar to Dashboards’ Discover40

Packet Payloads Displayed for Arkime sessions with full PCAP (i.e., not Zeek logs) File carving on the fly Download session PCAP Examine payload with CyberChef41

Export PCAP Creates a new PCAP file from filtered sessions Include open, visible or all matching sessions Apply “Arkime Sessions” view to sessions first Narrow as much as possible prior to exporting (huge PCAP files are a pain)42

SPIView Explore “top n” and field cardinalityfor all fields of both Arkime sessionsand Zeek logs Apply filters or pivot to Sessions orSPIGraph view for field values ofinterest Limit search to 1week before using(it runs many queries)43

SPIGraph View “top n” field values chronologically and geographically Identify trends and patterns in network traffic44

Connections Visualize logicalrelationshipbetween hosts Use anycombination offields for source anddestination nodes Compare current vs.previous (baseline)traffic45

Packet Search (“Hunt”) Deep-packet search (“PCAP grep”) of session payloads Search for ASCII, hex codes or regular expression matches Apply “Arkime Sessions” view to sessions first46

Data Source Correlation Search syntax is different between Arkime and Dashboards(and in some cases, so are field names) See search syntax comparison table, Malcolm and Arkime docs Despite considerable overlap, there aredifferences in protocol parser supportamong Zeek, Suricata and Arkime Learning the strengths of each will helpyou more effectively find the good stuff48

Correlate Zeek or Suricata Logs and Packet Payloads Correlate Zeek or Suricata logs and Arkime sessions using common fields communityId fingerprints flows to bridge data sources rootId/event.id filters logs for the same session Filter community ID OR’ed with event.id to see all Arkime sessions andZeek or Suricata logs for the same trafficcommunityId "1:r7tGG//fXP1P0 BXH3zXETCtEFI " event.id "CQcoro2z6adgtGlk42"49

File Analysis Zeek can “carve” file transfers from common protocols Malcolm can examine carved files and flag hits ClamAV – open source antivirus engineYARA – pattern matching swiss army knifeCapa – portable executable capabilities analyzerVirusTotal – online database of file hashes requires API token and internet connection Triggering files can be saved tozeek-logs/extract files under Malcolmdirectory for further analysis Be careful! Carved files may contain live malware!51

Signatures Signatures dashboard inDashboards shows scanned filehits Use zeek.fuid field inSignatures – Logs table to pivotto connection UID (zeek.uid)and other logs with pertinentsession details52

Search Tips Always check your search time frame “Zoom in” (apply filters) for a particular field value, pivot to anotherfield then “zoom out” (remove filters) Most UI controls can work with any data field (2000 ) Filter on event.dataset (e.g., conn to see conn.log) Filter on protocol regardless of data source (e.g., protocol:http inDashboards and protocols http in Arkime) Use tags53

Thank you!Visit Malcolm on GitHub to readthe docs, make suggestions,report issues and st r to showyour support!Malcolm is Copyright 2022 Battelle Energy Alliance, LLC, and is developed andreleased as open-source software through the cooperation of the Cybersecurity andInfrastructure Security Agency of the US Department of Homeland Security.

IDS: Types of Attacks Scanning Attack Determine network topology IDS highlights connections from one host to many other hosts in the network, or connection attempts to sequential IP addresses and/or ports Denial of Service Attack Interrupt service by flooding requests or flaws in protocol implementations IDS identifies large volume of traffic from or to a particular host or invalid connection