Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 37 ยท Security Analysis

Analyzing Suspicious Traffic: Beaconing and DNS Anomalies

Learn how defenders spot compromised hosts in captures: periodic beaconing, odd DNS, unusual user agents and data exfiltration, with safe sample-data detectors.

When a computer is infected, it usually has to talk to its operator. That communication, called command and control (C2), is often hidden inside ordinary-looking traffic, but it has habits that normal software does not. Analysts look for those habits in captures to find compromised machines.

This lesson is defensive. You will learn indicators and how to measure them on sample data. It contains no malware and no instructions to build any. If you analyze real malware captures, do it in an isolated lab, never on a production machine, and never open downloaded payloads.

Start from behavior, not signatures

Signatures catch known threats. Behavior catches new ones. These are the questions to ask of a host you suspect:

Behavior clues

Regular timing Connects every N seconds.
Odd destinations Rare or newly seen servers.
1 / 2

Beaconing: the heartbeat

Many implants "phone home" at fixed intervals, with a bit of random jitter, to ask for instructions. In a capture, connections from one host to one destination show a very regular rhythm, around the clock, even when nobody is using the computer.

How to look:

  1. Statistics, then Conversations, sorted by packets: find a host pair with many short connections.
  2. Filter that pair: ip.addr == 10.0.0.42 && ip.addr == 203.0.113.80.
  3. Look at the time between connections (frame.time_delta_displayed) or draw an I/O Graph. Evenly spaced spikes suggest automation.

Real people produce irregular timing. A weather widget or update checker is also regular, so beaconing is a lead, not a verdict: confirm the destination, the process on the host, and what the traffic contains.

Python Measure how regular a connection pattern is

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Jitter makes malware harder to spot: a 60-second beacon with +/- 20 percent noise gives a variation near 0.12. Analysts compare against known-good regular traffic and use more robust statistics than one threshold, so treat 0.1 as a teaching value only.

DNS as a signal

DNS is allowed through almost every firewall, so it is a common hiding place. See DNS and DHCP Problems for the basics. Suspicious patterns:

  • Domain generation algorithms (DGA): many lookups for random-looking names (xk3jq9vz.example), almost all NXDOMAIN, because malware tries many generated names until one is registered.
  • DNS tunneling: very long labels or unusually many TXT queries to one domain, carrying encoded data. Data leaves as query names and returns in answers.
  • Fast flux: one name with many IP addresses and a very short TTL.

Filters: dns.flags.rcode == 3 (NXDOMAIN), dns.qry.name.len > 50, dns.qry.type == 16 (TXT).

Python Score domain names for randomness

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Entropy is a rough tool: content delivery hostnames and some legitimate services also look random. Combine it with the NXDOMAIN rate, the number of distinct names per host, and the age and reputation of the domain.

HTTP and TLS clues

  • User-Agent that is empty, ancient, or unlike any browser on your network.
  • Direct IP address in the Host header instead of a name.
  • POST requests of regular size to unusual paths.
  • Self-signed or very new certificates, and TLS client fingerprints (JA3/JA4 values in the Client Hello) that match known tools. Wireshark shows tls.handshake.extensions_server_name (SNI) even when the rest is encrypted, which names the server the host contacted.

Exfiltration: more out than in

Normal clients download far more than they upload. A host that sends gigabytes out to one outside address at night is suspicious. Check Statistics, then Conversations, then the "Bytes A to B" versus "Bytes B to A" columns.

Python Find hosts with unusual upload ratios

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Backups and video calls also upload a lot, so context decides.

A safe analysis routine

  1. Work on a copy of the capture, in a lab or virtual machine.
  2. Triage with Conversations, Endpoints and Protocol Hierarchy.
  3. Look for rhythm, rare destinations, and odd DNS.
  4. Extract indicators (IPs, domains, hashes of objects) and check them against threat-intelligence sources.
  5. Report: timeline, evidence packets, affected hosts, recommended containment.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is beaconing?

    Implants check in regularly, which produces an unnaturally even connection rhythm.
  2. 2. Many NXDOMAIN answers for random-looking names from one host suggest:

    DGA malware tries many generated names until one resolves, so most lookups fail.
  3. 3. Why is beaconing only a lead, not proof?

    Regular timing is common to benign automation, so you must confirm destination, process and content.
  4. 4. Which field reveals the server name in a TLS handshake even without decryption?

    SNI is sent in the Client Hello, in the clear in most deployments.

Summary

  • Look for behavior: regular timing, rare destinations, strange DNS, heavy uploads.
  • Each indicator is weak alone; combine them and confirm on the host.
  • Entropy, NXDOMAIN rate, and byte ratios are cheap statistics you can script.
  • Analyze malware captures only in isolated labs on copies, never on live systems.

Next: TLS and Cleartext Exposure