🔏
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
  • Importance of Having Access to PCAP Data in an Investigation
  • Basic Tcpdump Queries
  • 1. Read Basic Packet Information
  • 2. Filter by IP Address
  • 3. Extract Packets for a Specific Protocol
  • 4. Filter by Port
  • 5. Identify Suspicious DNS Queries
  • 6. Filter Traffic Between Two Specific IPs
  • 7. Capture Only HTTP GET or POST Requests
  • 8. Extract Traffic by Time Range
  • 9. Extract Credentials or Sensitive Data
  • 10. Export Specific Packets to a New PCAP
  • 11. Detect Potential Malware Communication
  • 12. Analyse Large Packet Flows (Possible Data Exfiltration)
  • 13. Filter for SYN or SYN-ACK Packets (Port Scanning)
  • 14. Detect Potential ARP Spoofing
  • 15. Analyse Suspicious Command-and-Control (C2) Activity
Edit on GitHub
  1. SOC Operations
  2. Junior Analyst Skills
  3. Packet Analysis (pcap)

Tcpdump

Importance of Having Access to PCAP Data in an Investigation

PCAP (Packet Capture) data is a critical resource in cybersecurity investigations, providing a complete, raw record of network traffic at the packet level. Having access to PCAP data allows investigators to analyse both the content and behaviour of network communications, enabling the following key capabilities:

  1. Comprehensive Visibility:

    • PCAP data offers an unfiltered view of network activity, capturing every packet exchanged between hosts. This is invaluable for identifying anomalous behaviour, malicious communications, and policy violations.

  2. Attack Reconstruction:

    • Investigators can use PCAP data to recreate the sequence of events during an attack, such as lateral movement, command-and-control (C2) communication, or data exfiltration. This helps determine the scope and timeline of the incident.

  3. Payload Inspection:

    • Unlike log files, PCAP captures the full content of network packets. This allows for deep payload inspection, helping detect malware delivery, ransomware encryption protocols, or exfiltrated sensitive data.

  4. Detection of Anomalies and IoCs:

    • By analysing PCAP data, investigators can identify Indicators of Compromise (IoCs), such as suspicious IPs, domains, or unusual traffic patterns and correlate these with known attack vectors.

  5. Validation and Proof:

    • PCAP data is a reliable and detailed record that validates findings, supports forensic conclusions, and provides evidence in legal or compliance investigations.

  6. Threat Intelligence Correlation:

    • PCAP data can be cross-referenced with threat intelligence feeds to detect known malware signatures, malicious domains, or rogue IP addresses.

  7. Proactive Security Improvements:

    • Post-incident analysis of PCAP data provides insights into vulnerabilities exploited during the attack, guiding the implementation of preventive measures to improve network defences.

In summary, PCAP data is essential for effective and accurate network forensic investigations, offering unparalleled detail and insight into the network-level activities underpinning modern cyberattacks.

Basic Tcpdump Queries

The following are basic Tcpdump queries tailored for network forensics investigations involving a .pcap file. These queries are structured to extract critical information; however, they are basic queries intended for those with limited experience analysing pcap data.


1. Read Basic Packet Information

tcpdump -r sample.pcap
  • Explanation: Reads the packets from the .pcap file and displays a summary of each packet. Useful as an initial step to get a high-level overview of the captured traffic.


2. Filter by IP Address

tcpdump -r sample.pcap host 192.168.1.10
  • Explanation: Displays all packets involving a specific IP address (192.168.1.10). Helps identify activity related to a specific host.


3. Extract Packets for a Specific Protocol

  • TCP:

    tcpdump -r sample.pcap tcp
  • UDP:

    tcpdump -r sample.pcap udp
  • ICMP:

    tcpdump -r sample.pcap icmp
  • Explanation: This filtering function filters packets by protocol. It is useful for analysing specific protocol activities such as TCP connections, UDP communication, or ICMP pings.


4. Filter by Port

  • Example: HTTP (Port 80):

    tcpdump -r sample.pcap port 80
  • Explanation: Extracts packets involving traffic on a specific port (e.g., HTTP). Replace 80 with other port numbers (e.g., 443 for HTTPS, 53 for DNS).


5. Identify Suspicious DNS Queries

tcpdump -r sample.pcap port 53
  • Explanation: This technique focuses on DNS traffic to detect abnormal or suspicious domain lookups, such as those resolving to external IPs or unusual subdomains.


6. Filter Traffic Between Two Specific IPs

tcpdump -r sample.pcap src 192.168.1.10 and dst 8.8.8.8
  • Explanation: Displays packets where the source is 192.168.1.10 and the destination is 8.8.8.8. Helps in isolating communication between specific endpoints.


7. Capture Only HTTP GET or POST Requests

tcpdump -r sample.pcap -A -s 0 port 80 | grep "GET\|POST"
  • Explanation: Extracts and displays HTTP GET and POST requests in ASCII format, making identifying potential data exfiltration or suspicious web requests easier.


8. Extract Traffic by Time Range

tcpdump -r sample.pcap -ttt
  • Explanation: Displays relative timestamps for packets, allowing forensic analysts to correlate events by time.


9. Extract Credentials or Sensitive Data

tcpdump -r sample.pcap -A -s 0 port 21
  • Explanation: Reads FTP traffic to identify potential plaintext credentials. Replace 21 with other ports like 110 (POP3) or 143 (IMAP) for email credentials.


10. Export Specific Packets to a New PCAP

tcpdump -r sample.pcap -w filtered.pcap host 192.168.1.10 and port 80
  • Explanation: Saves filtered packets into a new .pcap file for further analysis with tools like Wireshark.


11. Detect Potential Malware Communication

tcpdump -r sample.pcap port 443 and dst net 185.0.0.0/8
  • Explanation: Focuses on HTTPS traffic directed to a specific suspicious network range (e.g., external or untrusted subnets). Replace 185.0.0.0/8 with known malicious ranges.


12. Analyse Large Packet Flows (Possible Data Exfiltration)

tcpdump -r sample.pcap greater 1000
  • Explanation: Displays packets larger than 1000 bytes. This can help identify file transfers or data exfiltration attempts.


13. Filter for SYN or SYN-ACK Packets (Port Scanning)

tcpdump -r sample.pcap 'tcp[tcpflags] & (tcp-syn|tcp-ack) != 0'
  • Explanation: Identifies SYN or SYN-ACK packets to detect port scanning activities or abnormal connection attempts.


14. Detect Potential ARP Spoofing

tcpdump -r sample.pcap arp
  • Explanation: Analyses ARP traffic to detect unusual patterns such as multiple ARP replies from a single IP or mismatched MAC addresses.


15. Analyse Suspicious Command-and-Control (C2) Activity

tcpdump -r sample.pcap dst port 443 or dst port 80
  • Explanation: Isolates traffic destined for web-based ports to look for anomalies or patterns indicative of communication with a C2 server.


These tcpdump commands provide a starting point for investigating .pcap files in network forensics. They can be adapted based on the specific incident, suspected threat, or network environment under analysis.

PreviousPacket Analysis (pcap)NextTcpdump (Intermediate)

Last updated 4 months ago

Page cover image