Wireshark Tutorial for Detecting Advanced Cybersecurity Threats

Wireshark is a network protocol analyzer that is essential for network administrators, security professionals, and forensic analysts. It allows users to capture and interactively browse the traffic running on a computer network, providing detailed insights into network communication.

Wireshark’s capabilities extend beyond simple packet capturing. It can dissect hundreds of different protocols, allowing for deep inspection of traffic. This makes it an invaluable tool for troubleshooting network issues, analyzing traffic patterns, and detecting malicious activities that can be cybersecurity threats.

Setting Up Wireshark

  1. Download and Install:

    • Download Wireshark from the official website Wireshark (wireshark.org).
    • Follow the installation instructions specific to your operating system.
  2. Capture Interfaces:

    • Open Wireshark and select the network interface you want to capture traffic on.
    • Click on the “Start” button to begin capturing packets.

Basic Usage

  1. Capturing Traffic:

    • Once you start capturing, Wireshark will display packets in real-time.
    • To stop capturing, click the “Stop” button.
  2. Filtering Traffic:

    • Use display filters to narrow down the captured data. For example, to filter HTTP traffic, use http.
    • Some common filters include:
      • ip.src == 192.168.1.1 - Filters packets from a specific source IP.
      • tcp.port == 80 - Filters packets on a specific port.
  3. Analyzing Packets:

    • Click on any packet to see its detailed breakdown in the packet details pane.
    • The three-pane layout includes the packet list, packet details, and packet bytes.

Detecting Advanced Threats

Example: Detecting DNS Tunneling

DNS tunnelling is a method used by attackers to exfiltrate data or communicate with a compromised system through DNS queries. This is a stealthy way to bypass firewalls and monitoring systems.

  1. Understand the Attack:

    • DNS tunnelling works by encoding the payload of the attack into the domain name queries and responses.
    • It can be used for command and control (C2) communications. [1]
  2. Capture DNS Traffic:

    • Start Wireshark and set a capture filter for DNS traffic: udp.port == 53.
    • This will capture only the DNS queries and responses.
  3. Analyze the Traffic:

    • Look for an unusually high number of DNS requests to domains that are not typically accessed.
    • Examine the domain names for patterns or base64-like encoded data.
    • Use display filters such as dns.qry.name contains "example" to look for specific patterns.
  4. Identify Suspicious Patterns:

    • Check for long domain names with random or suspicious-looking substrings.
    • Compare with known legitimate traffic to differentiate between normal and anomalous behaviour.

Example Detection

  1. Capture Filter:

    udp.port == 53
    
  2. Display Filter:

    dns.qry.name matches "^[a-zA-Z0-9]+$"
    

    This filter matches DNS query names containing alphanumeric characters, often used in tunnelling.

  3. Packet Analysis:

    • Look for queries like subdomain.randomdata.domain.com.
    • Check if the length of the subdomains is consistently long.

Supporting Tools

  1. nfdump:

    • A tool to collect and process netflow data.
    • Can be used alongside Wireshark to identify suspicious flow patterns.
    • You can also use tcpdump for network analysis.
  2. Suricata:

    • An IDS/IPS engine that can detect and alert various types of traffic, including DNS tunnelling.
    • Use Suricata to generate alerts that can be correlated with Wireshark captures.
  3. dnstwist:

    • A tool to identify potential DNS-based exfiltration by generating permutations of a domain name.
    • Helps to identify suspicious domains similar to legitimate ones.

Best Practices

  1. Regular Monitoring:

    • Continuously monitor DNS traffic as part of your network security strategy.
    • Automate the analysis using scripts and integrate it with SIEM tools.
  2. Baseline Traffic Analysis:

    • Establish a baseline of normal DNS traffic to identify deviations.
    • Compare current traffic patterns against the baseline for anomalies.
  3. Update Threat Intelligence:

    • Keep threat intelligence feeds updated to recognize known bad domains.
    • Integrate these feeds into your monitoring tools.
  4. Incident Response Plan:

    • Have a plan in place to respond to detected threats.
    • Ensure it includes steps for containment, eradication, and recovery.

Using Wireshark for detecting advanced threats like DNS tunnelling requires a good understanding of normal network behaviour, familiarity with Wireshark’s features, and the integration of supporting tools. Regular practice and staying updated with new attack vectors will enhance your ability to detect and mitigate advanced cybersecurity threats.

For more tutorials, visit the “Learn” page of the Wireshark website.


  1. Command and control (C2) communications refer to the methods attackers use to maintain control over compromised systems. In the context of DNS tunnelling, attackers can use DNS queries and responses to communicate with compromised systems, enabling them to download malware, exfiltrate data, or receive further instructions. (Explanation by AI) ↩︎

4 Likes