🔏
RootGuard
HomeSOC OperationsIncident ResponseWindows ForensicsLinux ForensicsKQL Investigations
  • Welcome
    • RootGuard
      • Who Am I?
        • Professional Profile
  • Resources Hub
    • Blogs
      • Articles
        • Safeguarding SMEs: The Strategic Importance of a Security Operations Center (SOC)
      • Posts
        • Roadmap to Becoming a Cybersecurity Specialist
        • Starting a Career in Cybersecurity
        • A Guide to Landing Your First Cybersecurity Analyst Role
        • Moving from Intermediate to Expert Incident Responder
  • SOC Operations
    • Introduction
      • Development Resources
        • SOC Analysts Roadmap
        • Becoming A SOC Analyst
        • SOC Analysts Prep Interview Questions
    • Essential Skills
      • Critical Windows EventIDs to Monitor
    • Junior Analyst Skills
      • Splunk Use Cases
      • KQL Use Cases
        • Reconnaissance (TA0043)
        • Initial Access (TA0001)
        • Execution (TA0002)
        • Persistence (TA0003)
        • Privilege Escalation (TA0004)
        • Defence Evasion (TA0005)
        • Credential Access (TA0006)
        • Discovery (TA0007)
        • Lateral Movement (TA0008)
        • Collection (TA0009)
        • Command and Control (TA0011)
        • Exfiltration (TA0010)
        • Impact (TA0040)
      • Investigating Common Attacks
        • Domain Dominance Attacks - Detection & Analysis
        • Investigating a Suspected AD FS Distributed Key Management (DKM) Attack
        • Authentication From Suspicious DeviceName
        • Identifying Interactive or RemoteInteractive Session From Service Account
        • Identifying Split or Part Archive File Transfers
        • Detect Potential Cleartext Credentials in Command Line
        • Detecting Command Line Interpreters Launched via Scheduled Tasks
        • Detecting Files Containing Potentially Sensitive Data
        • Detecting DeviceNetworkEvents From Windows Processes and Domains by TLD
        • Detecting Silent cmd.exe Execution With Redirected STDERR & STDOUT
        • Detecting Low Prevalence DLL Loaded From Process In User Downloads Directory
        • Detecting Virtual Drive Mounted From Archive
        • Identify Execution of Script From User's Downloads Folder
        • Identify Potential RDP Tunneled Sessions
        • Identify Instances of PowerShell Invoke-WebRequest, IWR or Net.WebClient
        • Identify Processes Launched by PowerShell Remoting (WSMProvHost.exe)
        • Detect DeviceNetworkEvents for LOLBAS with Download or Upload Functions
        • Detect Execution of PSEXESVC via Remote Systems
        • Identify Suspicious String in Service Creation ImagePath
        • Identify File with Double Extensions
        • Detect Potential Cleartext Credentials in Commandline
        • Detect When Large Number of Files Downloaded From OneDrive or SharePoint
        • Identify and Investigate Phishing Attacks with KQL
      • PowerShell for SecOps
        • Powershell Remoting
        • Reconnaissance Discovery
        • Initial Access Discovery
        • Execution Discovery
        • Persistence Discovery
        • Privilege Escalation Discovery
        • Defence Evasion Discovery
        • Credential Access Discovery
        • Discovery
        • Lateral Movement Discovery
        • Collection Discovery
        • Command & Control (C2) Discovery
        • Exfiltration Discovery
        • Impact Discovery
      • Packet Analysis (pcap)
        • Tcpdump
        • Tcpdump (Intermediate)
        • Tshark
        • Ngrep
      • Investigating Suspicious Emails Using KQL
    • Intermediate and Advanced Skills
      • Investigate Using MITRE ATT&CK Methodology
        • Reconnaissance (TA0043) Techniques
        • Resource Development (TA0042) Techniques
        • Initial Access (TA0001) Techniques
        • Command Execution (TA0002) Techniques
        • Persistence (TA0003) Techniques
        • Privilege Escalation (TA0004) Techniques
        • Defence Evasion (TA0005) Techniques
        • Credential Access (TA0006) Techniques
        • Discovery (TA0007) Techniques
        • Lateral Movement (TA0008) Techniques
        • Collection (TA0009) Techniques
        • Command and Control (C2) (TA0011) Techniques
        • Exfiltration (TA0010) Techniques
        • Impact (TA0040) Techniques
    • Vulnerability Management
    • Malware Analysis
  • DFIR
    • Incident Response
      • Incident Triage
        • Triage Types and Processes
        • PowerShell for Detection and Analysis
          • Malware or Compromise Investigation
          • Lateral Movement Discovery
        • Registry Analysis
        • Sysinternals Intrusion Analysis
        • PowerShell Intrusion Analysis
        • Velociraptor Intrusion Analysis
        • Zimmerman Tools Intrusion Analysis
      • KAPE Artifacts Analysis
      • Velociraptor Artifacts Analysis
      • Using The Unified Kill Chain Model to Analyse Individual Cyber Attacks
        • Phase 1 - Gaining an Initial Foothold
          • Gaining Access to the Network
          • Establishing a Foothold
          • Network Discovery
      • Response Strategies
        • Privilege Escalation Assessment
        • Command and Control Assessment
        • Command Execution Assessment
        • Defence Evasion Assessment
        • Detection Assessment
        • Discovery Assessment
        • Exfiltration Assessment
        • Initial Access Assessment
        • Initial Impact Assessment Techniques
        • Lateral Movement Assessment
        • Persistence Assessment
    • Windows Forensics
      • Evidence of Execution
      • Window Artifact Analysis
        • Account Usage
        • User Activity Tracking (Event Logs)
        • Program Execution
        • File and Folder Opening
        • File Download
        • Browser Usage
        • Deleted File or File Knowledge
        • External Device & USB Usage
    • Linux Forensics
      • Linux Commandline Basics
      • Host Compromise Assessment
    • KQL for Defender & Sentinel
      • MDO (Office)
      • MDI (Identity)
      • MDE (Endpoint)
    • Memory Forensics
      • Memory Forensics (Volatility 3)
    • Playbooks
      • First Responder DFIR Playbook
        • Device Isolation
        • Evidence Collection
          • Acquire Triage Image Using KAPE
          • Acquire Triage Data Using Velociraptor
          • Acquire Triage Data Using Powershell
          • Acquire Triage Memory Image
          • Acquire Image Using FTK
          • AXIOM Cyber Data Collection
        • Windows Forensic Artefacts
          • Application Execution
          • File & Folder Knowledge
          • External Device Usage
          • Network Activity
          • Windows Event Logs
        • Initial Analysis
          • Memory Analysis (Vol 3)
          • Axiom Cyber Examiner
  • Detection Engineering
    • AD Attack Detections & Mitigations
      • Kerberoasting
      • Authentication Server Response (AS-REP) Roasting
      • Password Spraying
      • MachineAccountQuota Compromise
      • Unconstrained Delegation
      • Password in Group Policy Preferences (GPP) Compromise
      • Active Directory Certificate Services (AD CS) Compromise
      • Golden Certificate
      • DCSync
      • Dumping ntds.dit
      • Golden Ticket
      • Silver Ticket
      • Golden Security Assertion Markup Language (SAML)
      • Microsoft Entra Connect Compromise
      • One-way Domain Trust Bypass
      • Security Identifier (SID) History Compromise
      • Skeleton Key
      • Active Directory Security Controls
      • Active Directory Events for Detecting Compromise
    • Attack Triage Playbooks (KQL Triage)
      • Windows Malware Detection Playbook
      • Linux Host Intrusion Detection Playbook (CLI)
      • Linux Intrusion Detection Playbook
      • Large-Scale Compromise Detection Playbook
      • Ransomware Detection Playbook
      • Phishing Email Compromise Detection Playbook
      • Scam Detection Playbook
      • Customer Phishing Detection Playbook
      • Insider Abuse Detection Playbook
      • Information Leakage Detection Playbook
      • Social Engineering Detection Playbook
      • Malicious Network Behaviour Detection Playbook
      • Windows Intrusion Detection Playbook
      • Vulnerability Detection Playbook
      • Business Email Compromise Detection Playbook
    • Process Execution (KQL Triage)
    • Threat Hunting
      • Hunting Ransomware Indicators
      • Hunting With KQL
        • Detecting Malware Infection (MITRE ATT&CK: T1566, T1059)
        • Discovery Activities (MITRE ATT&CK: T1016, T1083, T1046)
        • Credential Theft (MITRE ATT&CK: T1003, T1078)
        • Lateral Movement (MITRE ATT&CK: T1076, T1021)
        • Data Theft (MITRE ATT&CK: T1041, T1071)
        • Detecting CommandLine Executions (MITRE ATT&CK: T1059)
        • Windows Security Logs (Identity and Logon Activities)
      • Hunting With Splunk
Powered by GitBook
On this page
  • The Importance of Having Access to PCAP Data in an Investigation
  • 1. Detect Suspicious SMB Traffic
  • 2. Identify Large Outbound Traffic (Potential Data Exfiltration)
  • 4. Find Encrypted Traffic with Unusual Destinations
  • 5. Detect Abnormal File Transfers (FTP/SMB)
  • 6. Look for Brute Force or Credential Theft
  • 7. Detect Port Scanning or Lateral Movement
  • 8. Identify Ransomware Network Beaconing
  • 9. Monitor for Abnormal DNS Queries
  • 10. Detect Rapidly Generated Outbound Connections
  • 11. Monitor for Tor Traffic
  • 12. Capture Malicious HTTP Requests
  • 13. Detect Suspicious Use of ICMP (Ping Tunnels)
  • 14. Identify Outbound Traffic to Known Malicious IPs
  • 15. Track Ransomware Encryption Activity
  • 16. Extract Packets with Suspicious Payload Sizes
  • 17. Detect Traffic to Unusual Regions
Edit on GitHub
  1. SOC Operations
  2. Junior Analyst Skills
  3. Packet Analysis (pcap)

Tcpdump (Intermediate)

The Importance of Having Access to PCAP Data in an Investigation

Packet Capture (PCAP) data is a critical resource in network security investigations, providing a detailed, timestamped record of all network traffic. By preserving the raw packets exchanged across a network, PCAP data allows investigators to analyse every communication byte for forensic purposes. Its importance can be summarised as follows:

  1. Comprehensive Visibility:

    • PCAP data captures every network interaction, enabling analysts to reconstruct events accurately. It provides insights into application-level protocols (HTTP, DNS, SMB), network-layer details (IP addresses, ports), and transport-layer interactions (TCP/UDP flags).

  2. Incident Reconstruction:

    • In the aftermath of a security incident, PCAP data helps recreate the sequence of events, such as how an attacker gained access, what they did, and whether data was exfiltrated. This level of detail is invaluable for understanding the scope and impact of an attack.

  3. Threat Hunting:

    • PCAP allows for the detection of hidden or subtle malicious activities, such as command-and-control communications, data exfiltration, lateral movement, or abnormal traffic patterns that log-based tools might miss.

  4. Evidence Collection:

    • In legal or compliance scenarios, PCAP data serves as concrete evidence of malicious activities or policy violations. It ensures integrity and supports attribution efforts in cases requiring accountability.

  5. Validation of Security Controls:

    • PCAP data can be used to assess the effectiveness of firewalls, intrusion detection/prevention systems (IDS/IPS), and other security controls by identifying what traffic was allowed or blocked during an incident.

  6. Anomaly Detection:

    • Detailed packet analysis enables the identification of unusual behaviours, such as large file transfers, DNS tunnelling, or encrypted traffic to unknown external IPs—often indicative of advanced threats like ransomware or data theft.

  7. Training and Research:

    • Forensic analysts can use PCAP files for simulations, training, or developing new detection mechanisms. It provides real-world traffic data to refine defensive strategies.

Access to PCAP data allows investigators to perform deep-dive analysis, validate hypotheses, and extract actionable intelligence, making it a cornerstone of modern cybersecurity and network forensics.

The following Tcpdump queries are designed to identify malicious activities. They focus on abnormal behaviours, specific protocols, and known malicious indicators.


1. Detect Suspicious SMB Traffic

tcpdump -r sample.pcap port 445
  • Explanation: Monitors SMB traffic, often used in ransomware attacks for lateral movement or encrypting shared files. Look for unusual file operations or an increase in SMB requests.


2. Identify Large Outbound Traffic (Potential Data Exfiltration)

tcpdump -r sample.pcap src net 192.168.1.0/24 and dst net not 192.168.1.0/24 and greater 1500
  • Explanation: Detects large packets originating from the internal network (192.168.1.0/24) to external networks. Ransomware may exfiltrate data before encryption.


3. Detect Command-and-Control (C2) Communication

  • Over HTTPS (Port 443):

    tcpdump -r sample.pcap port 443 and src net 192.168.1.0/24 and dst net not 192.168.1.0/24
  • DNS Tunneling (Port 53):

    tcpdump -r sample.pcap port 53 and src net 192.168.1.0/24 and dst net not 192.168.1.0/24 and greater 300
  • Explanation: Identifies external communication to untrusted destinations, which may indicate ransomware contacting its C2 server for encryption keys or instructions.


4. Find Encrypted Traffic with Unusual Destinations

tcpdump -r sample.pcap port 443 and not dst net 8.8.8.0/24
  • Explanation: Extracts encrypted traffic to uncommon or suspicious IP ranges, which may indicate ransomware communication.


5. Detect Abnormal File Transfers (FTP/SMB)

  • FTP (Port 21):

    tcpdump -r sample.pcap port 21 and src net 192.168.1.0/24
  • SMB:

    tcpdump -r file.pcap port 445 and tcp[tcpflags] & tcp-push != 0
  • Explanation: Filters FTP and SMB traffic, focusing on unusual file transfers or commands that could signal data staging or ransomware encrypting files.


6. Look for Brute Force or Credential Theft

tcpdump -r sample.pcap port 3389 or port 22
  • Explanation: Monitors RDP (3389) and SSH (22) traffic for potential brute force attempts or unauthorised access, which are common precursors to ransomware deployment.


7. Detect Port Scanning or Lateral Movement

tcpdump -r sample.pcap 'tcp[tcpflags] & tcp-syn != 0'
  • Explanation: Detects SYN packets, often used during port scans to identify vulnerable systems for lateral movement.


8. Identify Ransomware Network Beaconing

tcpdump -r sample.pcap 'udp[8:2] = 0x5353 or udp[8:2] = 0x5354'
  • Explanation: Look for suspicious UDP beacons often used in ransomware to communicate with C2 servers.


9. Monitor for Abnormal DNS Queries

tcpdump -r sample.pcap port 53 and 'udp[10] & 0x80 = 0'
  • Explanation: Captures DNS queries, excluding responses. Look for unusually long domains, random subdomains, or queries resolving to known malicious IPs.


10. Detect Rapidly Generated Outbound Connections

tcpdump -r sample.pcap src net 192.168.1.0/24 and dst net not 192.168.1.0/24 and tcp[tcpflags] & tcp-syn != 0
  • Explanation: Identifies a large number of SYN packets from internal hosts to external networks, which could indicate malware attempting to spread or communicate with multiple servers.


11. Monitor for Tor Traffic

tcpdump -r sample.pcap dst port 9001 or dst port 9030
  • Explanation: Captures traffic to Tor entry nodes, often used by ransomware for anonymous communication.


12. Capture Malicious HTTP Requests

tcpdump -r sample.pcap port 80 and 'tcp[32:4] = 0x47455420 or tcp[32:4] = 0x504f5354'
  • Explanation: Filters HTTP traffic containing GET or POST requests, which could be used for C2 communication or exfiltration.


13. Detect Suspicious Use of ICMP (Ping Tunnels)

tcpdump -r sample.pcap icmp and greater 100
  • Explanation: Extracts ICMP packets larger than normal (e.g., over 100 bytes), which could indicate covert data exfiltration or tunnelling.


14. Identify Outbound Traffic to Known Malicious IPs

tcpdump -r sample.pcap dst net 198.51.100.0/24
  • Explanation: Filters traffic to a known malicious network (replace 198.51.100.0/24 with specific indicators of compromise). Useful for threat hunting.


15. Track Ransomware Encryption Activity

tcpdump -r sample.pcap port 445 and 'tcp[tcpflags] & (tcp-syn|tcp-ack|tcp-push) != 0'
  • Explanation: Focuses on SMB traffic with specific flags, which may indicate file encryption attempts over the network.


16. Extract Packets with Suspicious Payload Sizes

tcpdump -r sample.pcap 'greater 1200'
  • Explanation: Captures large packets that could indicate file transfers or data exfiltration before ransomware encryption.


17. Detect Traffic to Unusual Regions

tcpdump -r sample.pcap dst net not 192.168.0.0/16 and dst net not 10.0.0.0/8
  • Explanation: Identifies traffic leaving the local network to unknown or external IPs, which may suggest ransomware communication or exfiltration.


Thesetcpdump queries are tailored to identify malicious activities and behaviours to look out for during investigations. To enhance detection, cross-reference the results with threat intelligence feeds and known IoCs (Indicators of Compromise).

PreviousTcpdumpNextTshark

Last updated 4 months ago

Page cover image