The Lookups That Smuggled a Spreadsheet: Reading Data Hidden in DNS

Network & Infrastructure Level 3/4 ~5 min November 20, 2026

The challenge

Odd DNS lookups leave Larkfield via DC01. Decode the data packed into the subdomains. Name the infected machine behind them.

What you'll learn

  • Explain how data leaves a network inside DNS lookups to a domain the attacker controls
  • Recognise hex in subdomain labels and why exfiltration tools prefer it to base64
  • Extract the data labels from raw query names with a regular expression
  • Chain From Hex and From Base64 to read an implant's message
  • Explain why a forwarding DNS server hides the real client in perimeter logs
  • Name the logs and egress rules that detect and stop DNS exfiltration

Skills tested

Encoding analysisRegular expressionsNetwork forensicsThreat hunting

Prerequisites

  • What a DNS lookup and a subdomain are
  • What hex and base64 look like

How it works

Every DNS lookup is a question sent toward whoever runs the name server for that domain. An attacker who owns edgestat-cdn.example receives every lookup of anything.edgestat-cdn.example, through any resolver on the way, so the subdomain itself becomes the message. A label holds at most 63 characters and a full name 253, so data is cut into chunks, each sent with a sequence number and a session id: <data>.<seq>.c41e.edgestat-cdn.example.

The chunks are hex (or base32) because DNS names are case-insensitive and some resolvers randomize case to resist spoofing. Base64 would not survive that, so here the implant's base64 messages are wrapped in hex for the trip.

Inside a company, laptops rarely ask the internet directly: they ask the domain controller, which forwards the question. A firewall or upstream log therefore shows the DC as the source of every lookup. The real client is either in the DC's own DNS logs or, as malware tends to report where it runs, in the data itself.

Common mistakes

  • Answering DC01. It forwards every client's queries, so it is the source of everything in the firewall log. It is the messenger, not the infected machine.
  • Answering FS02. \\FS02\Finance$ is the network share the file was read from. The share holds the data; the implant ran on the laptop that opened it.
  • Pressing From Hex on the raw log. Times, dots and the domain name are not hex, so the step fails. Pull the data labels out first.
  • Grabbing every hex-looking run. A loose pattern like [0-9a-f]+ also catches the time, the IP, the sequence number and c41e. One extra digit shifts every byte after it by half a byte, so From Hex returns garbage and From Base64 fails. Anchor on what follows the label: ([0-9a-f]+)\.\d+\.c41e, or match exactly 60 hex characters.
  • Keeping the dots. A match that ends in .0 or includes the domain stops From Hex: use a capture group around the label alone.
  • Pressing From Base64 first. 0-9 and a-f are valid base64 characters too, so it "works" and returns noise. Lowercase digits and a-f only means hex.
  • Stopping after From Hex. The output is still base64: mixed-case letters and digits in one long run. One more layer.
  • Answering the user or the domain. a.moreau is the account the implant runs as and edgestat-cdn.example is the attacker's; the question is which machine to isolate.

How to defend against it

  • Log DNS where clients ask: enable DNS server analytic or debug logging on the domain controllers, or Sysmon event 22 on endpoints, so a lookup can be traced to the machine that made it.
  • Only let your resolvers send DNS (port 53, and DNS over HTTPS to known providers) to the internet; block it from everything else.
  • Alert on long, high-entropy labels, many unique subdomains under one domain, and young or rarely seen domains; a protective DNS service or response policy zone can block them.
  • Watch bulk reads of sensitive shares such as Finance$ from a single workstation.

Full solution

Pro and Max members unlock the complete step-by-step walkthrough.

Go Pro

Community stats

110 completions
70% success rate
M2F14M3 First blood

Related Daily Hacks

Contributors

Credited contributors

These hackers reported issues, improved content, and helped harden this page.

40,000+ Hackers Real labs Free
Start Hacking Free or solve today's hack, no account needed