Knowledge Base · general

DNS Exfiltration

generaltechnique notetechniquedns-exfiltration

Encoding stolen data in DNS queries to an attacker-controlled authoritative server (a DNS tunnel).

How it works

  • Data is chunked into subdomain labels and sent as A/AAAA/TXT queries; ordering is encoded in a sequence prefix.
  • Decode each label (often base32) and reassemble by sequence number.
  • Beaconing domains and unusually long/entropic labels are the tell.

Detection & defence

  • Monitor query volume, label length and entropy; block unknown recursive resolvers.
  • Restrict DNS egress to internal resolvers and log all queries.