BREACH Attack
What is BREACH Attack?
BREACH AttackA 2013 side-channel attack that recovers HTTPS-protected secrets by exploiting HTTP-level compression and observing response sizes across attacker-influenced requests.
BREACH (Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext) was disclosed at Black Hat USA 2013 by Yoel Gluck, Neal Harris, and Angelo Prado. It targets web applications that gzip-compress HTTP responses containing both attacker-controlled input and a secret such as a CSRF token. By injecting guess strings and measuring the length of the encrypted responses, the attacker runs a byte-by-byte compression-ratio oracle: a guess that overlaps the secret compresses slightly better, shrinking the response. The attack works even when TLS itself is sound, because the leak is in the plaintext length that compression exposes, not in the cipher.
Crucially, BREACH attacks HTTP body compression, so the CRIME-era fix of disabling TLS-level compression does not help. BREACH descends from CRIME (2012) and the TIME variant; in 2016 the HEIST attack by Mathy Vanhoef and Tom Van Goethem (Black Hat USA, CVE-2016-7152) removed BREACH's biggest practical constraint — the need for a man-in-the-middle — by measuring response sizes purely in the browser via the Fetch API and TCP-window timing, so any malicious ad or script could mount it, and HTTP/2's parallel requests made it faster still.
Defences: keep secrets out of compressed bodies, mask or XOR CSRF tokens per request so their length-signal randomizes each time, add random-length padding, rate-limit and monitor for the thousands of near-identical requests an oracle needs, and — against HEIST specifically — block third-party cookies and use SameSite.
flowchart TD
A[Attacker controls part of request] --> R[Server reflects input + secret in one response]
R --> C[Response gzip-compressed, then TLS-encrypted]
C --> O[Attacker measures encrypted response length]
O --> G{Guess byte overlaps secret?}
G -->|Yes: better compression, shorter response| K[Byte confirmed, extend guess]
G -->|No: longer response| A
K --> D{Secret complete?}
D -->|No| A
D -->|Yes| S[CSRF token / secret recovered]● Examples
- 01
Extracting an anti-CSRF token from a Gmail-style page that reflects user input alongside the token.
- 02
Recovering OAuth state values from a compressed HTTPS response.
● Frequently asked questions
What is BREACH Attack?
A 2013 side-channel attack that recovers HTTPS-protected secrets by exploiting HTTP-level compression and observing response sizes across attacker-influenced requests. It belongs to the Attacks & Threats category of cybersecurity.
What does BREACH Attack mean?
A 2013 side-channel attack that recovers HTTPS-protected secrets by exploiting HTTP-level compression and observing response sizes across attacker-influenced requests.
How do you defend against BREACH Attack?
Defences for BREACH Attack typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for BREACH Attack?
Common alternative names include: BREACH, HTTP compression side channel.