Cyber Services / All lessons / CEH — Ethical Hacking / Wireshark Notes

Wireshark Notes

Module 53 of 130 · 5 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Unlock Advanced Network Analysis for Ethical Hacking Professionals

Core IP Address Filters

Mastering IP address filters is fundamental for isolating network traffic. These filters are highly versatile and form the basis for more complex analysis.

  • ip.addr == 192.168.1.100: Show all packets where the source or destination IP address is exactly 192.168.1.100. Useful for monitoring a specific host.
  • ip.src == 192.168.1.0/24: Show all traffic originating from the 192.168.1.0/24 subnet. Monitor all outgoing traffic from a local network.
  • ip.dst == 10.0.0.0/16: Show all traffic destined for the 10.0.0.0/16 subnet. Analyze incoming traffic to a server farm.
  • !(ip.addr == 172.217.160.142): Exclude all traffic involving IP address 172.217.160.142 (e.g., Google's primary IP). Remove noise from common external services.
  • ip.addr in {192.168.1.100..192.168.1.110}: Show traffic to/from a range of IP addresses. Useful for focusing on a group of test machines.

Best Practice: Always start with broad IP filters and refine as needed to minimize performance impact.

Advanced Protocol Analysis Filters

These filters go beyond basic protocol identification and allow for deep inspection of protocol-specific fields and flags.

  • tcp: Show all TCP traffic. This is a broad filter but essential for initiating TCP-based investigations.
  • udp: Show all UDP traffic. Important for identifying DNS queries, VoIP, and streaming protocols.
  • icmp.type == 0 && icmp.code == 0: Show only ICMP Echo Reply packets (ping responses). Essential for diagnosing network reachability.
  • tcp.port == 443 && tls: Show TLS encrypted TCP traffic. Use with caution; decryption requires advanced setup.
  • dns.flags.response == 1: Show only DNS response packets. Analyze DNS server behavior.
  • http.request: Shows only HTTP request packets.
  • http.response: Shows only HTTP response packets.

TCP Stream Analysis

TCP stream analysis is crucial for understanding the full context of a TCP conversation. Use these filters to identify and examine individual streams.

  • tcp.flags.syn == 1 && tcp.flags.ack == 0: Show TCP SYN packets (connection initiation). Identify new TCP connection attempts.
  • tcp.flags.fin == 1: Show TCP FIN packets (connection termination). Identify gracefully closed connections.
  • tcp.flags.rst == 1: Show TCP RST packets (abrupt connection reset). Diagnose connection failures.
  • tcp.analysis.retransmission: Identify retransmitted TCP segments, indicating potential network issues or data loss. Analyze network reliability.
  • tcp.analysis.duplicate_ack: Show duplicate ACK packets, suggesting potential performance problems.
  • tcp.stream eq 7: Show all packets belonging to TCP stream number 7. After identifying a suspicious stream, use "Follow TCP Stream" for deeper inspection.

HTTP Header Analysis

These filters allow for examining specific HTTP headers, providing insights into web application behavior.

  • http.request.method == "POST": Show only HTTP POST requests (data submission). Capture form data submissions.
  • http.response.code >= 400 && http.response.code < 500: Show HTTP 4xx Client Error responses (e.g., 404 Not Found, 403 Forbidden). Identify broken links or unauthorized access attempts.
  • http.host contains "malicious": Show HTTP traffic to hosts containing the substring "malicious". Be careful, as this might catch benign sites, too.Identify potentially compromised websites.
  • http.user_agent contains "custom-bot": Identify traffic from custom-built bots by inspecting the User-Agent header. Monitor bot activity.
  • http.cookie contains "admin": Show HTTP cookies containing "admin" (potential session hijacking risk - ethical use only!). Demonstrate cookie security vulnerabilities.

Remember that HTTPS encrypts HTTP headers, making these filters ineffective unless TLS decryption is enabled (not recommended for live traffic analysis).

DNS Query and Response Analysis

DNS is critical for network resolution. Use these filters to analyze DNS queries and responses.

  • dns.qry.name == "example.com": Show DNS queries specifically for "example.com". Monitor DNS lookups for a specific domain.
  • dns.resp.addr == 1.2.3.4: Show DNS responses that resolve to the IP address 1.2.3.4. Find domains associated with a known malicious IP.
  • dns.flags.rcode != 0: Show DNS responses with a non-zero response code, indicating an error (e.g., NXDOMAIN - Non-Existent Domain). Identify failed DNS lookups.
  • dns.resp.type == 1: Show DNS responses with a type A (Address) record.
  • dns.resp.type == 28: Show DNS responses with a type AAAA (IPv6 Address) record.
  • dns.an == 1: show DNS responses that have 1 answer

TLS (SSL) Analysis

Understanding TLS handshakes and related information is crucial for network security analysis.

  • tls.handshake.type == 1: Show Client Hello packets during a TLS handshake. This packet contains the requested server name (SNI).
  • tls.handshake.extensions_server_name: Show the Server Name Indication (SNI) extension in the TLS handshake. This reveals the hostname being requested even within an encrypted TLS connection.
  • tls.alert_message.desc == 112: show TLS fatal alert

Frame Analysis

Frame analysis allows you to inspect the underlying Ethernet frames, useful for low-level investigations.

  • eth.src == 00:1A:2B:3C:4D:5E: Show packets originating from the specified MAC address. Track down a specific device on the network.
  • eth.dst == FF:FF:FF:FF:FF:FF: Show broadcast packets (destined for all devices on the network). Monitor ARP requests and other broadcast traffic.
  • frame.len > 1500: Show Ethernet frames larger than 1500 bytes (potential jumbo frames).
  • vlan.id == 10: Show packets associated with VLAN ID 10.

Mastering Logical Operators

Combine filters using logical operators (&& for AND, || for OR, ! for NOT) to create highly specific queries.

  • (ip.src == 192.168.1.100 || ip.dst == 192.168.1.100) && tcp.port == 80: Show all HTTP traffic to or from 192.168.1.100.
  • http.request && !(http.content_type contains "image"): Show all HTTP requests, excluding those with Content-Type headers containing "image".
  • tcp.port == 443 && !tls.handshake: Show encrypted TLS traffic but exclude the initial handshake packets.
  • frame contains "password": **Use with EXTREME CAUTION and only in controlled, ethical environments!** Show any frame containing the word "password" (highly risky). This is a demonstration of what *not* to do in most situations!

Always be mindful of privacy and security when analyzing network traffic. Avoid capturing or analyzing sensitive data unless you have explicit permission and a legitimate ethical purpose.

Optimized Wireshark Workflow for Large PCAP Datasets

Efficiently analyzing large capture files requires a strategic approach to filtering and analysis.

  • Initial Filtering: Start with very broad filters like tcp, udp, or http to get a general overview.
  • Endpoint Identification: Use "Statistics -> Endpoints" to identify the most active IP addresses.
  • Conversation Analysis: Use "Statistics -> Conversations" to determine the primary communication pairs.
  • Focused Filtering: Based on endpoint and conversation analysis, apply more specific filters like ip.addr == x.x.x.x && tcp.port == 443.
  • Time-Based Analysis: Use the time display format (View -> Time Display Format) to correlate network events with system logs.
  • Follow TCP Stream: Use Follow TCP Stream to reconstruct the communication.
  • Display Filter Expressions: Wireshark allows you to create complex display filters.
Modules (130) ← CEH — Ethical Hacking