The data that left without a file transfer

A company suspected that someone was stealing data from a computer. Investigators found no emails with attachments, file transfers or cloud uploads.

Inspecting the network traffic, the technician found hundreds of small requests, even when nobody was using the computer.

How was the information getting out?

How to solve the cases
A laptop showing a query log with several unusually long lines

Hints

Reveal them one at a time, only when you need them.

Solution

Malware hid the information in the names it looked up through DNS. Each query carried a piece of data to the attacker’s DNS server, which put the pieces back together.

What happened?

DNS (Domain Name System) translates names such as www.example.com into IP addresses. To resolve an unknown name, the company’s resolver queries the server responsible for that domain. An attacker who controls the domain can run that server and receive the full queried names.

The company’s DNS server resolved any external domain, so these queries left like ordinary browsing traffic. That is why they did not show up as emails, file transfers or uploads: they were none of those.

  1. The malware took a file such as a customer list and encoded it with Base32 or hexadecimal to produce letters and digits suitable for a DNS name.
  2. It split the result into chunks because each label in a DNS name can be at most 63 characters long.
  3. It queried one name per chunk, such as 0001.mzxw6ytboi4tqmzs.attacker.example or 0002.nfxgq4tfmrxw4zlr.attacker.example. The initial number gave the sequence.
  4. The attacker’s DNS server logged the names, ordered the chunks and reconstructed the file.

The company saw hundreds of unusual queries to one domain. This technique is known as DNS data exfiltration.

How could it be stopped and prevented?

To stop it, isolate the computer, identify the process issuing queries, remove the malware and determine what data left the network. Block the attacker’s domain on the company resolver.

To prevent it from recurring, combine several measures:

  • Centralise DNS resolution. Require the internal DNS server, block outbound port 53 queries to other servers and control unauthorised encrypted DNS over HTTPS or TLS.
  • Log and inspect queries. Alert on unusually long or random-looking names and unusually high traffic to one domain. Zeek or a SIEM (security information and event management) system can help analyse these patterns.
  • Filter domains. Use reputation lists or protective DNS to block malicious or newly registered domains.

Further reading

Encoding data in subdomains under an attacker-controlled domain is described in MITRE ATT&CK — Exfiltration Over Unencrypted Non-C2 Protocol (T1048.003).

Using DNS as a covert channel and how to detect it is covered in DNS Tunneling: how DNS can be (ab)used by malicious actors, by Unit 42 (Palo Alto Networks).

DNS resolution and name length limits are specified in RFC 1035 — Domain Names: Implementation and Specification.

Have a story worth investigating?

Suggest a case

A project by Eniun

How do you solve the cases?

Each case presents a mystery that seems to defy explanation.

A moderator who knows the solution reads the mystery to the group. The group works out what happened by asking questions, discussing hypotheses and using what they know.

You can project the case on a screen so everyone can read it and refer back to it during the discussion.

The moderator can guide the discussion without giving away the answer. If the group gets stuck, each case offers three graded hints under “Hints”, which can be revealed one at a time.

Once the moderator confirms that the group has found the answer, select “Show answer” to open the solution.

You can also solve the cases on your own: read the story, try to come up with an explanation and use the hints only when you need them.