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.
- 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.
- It split the result into chunks because each label in a DNS name can be at most 63 characters long.
- It queried one name per chunk, such as
0001.mzxw6ytboi4tqmzs.attacker.example or 0002.nfxgq4tfmrxw4zlr.attacker.example. The initial number gave the sequence.
- 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.
A project by Eniun