Piercing the Cloud Armor: Exploiting the 8KB Bypass in Google Cloud Platform WAF
Cloud Armor only inspects the first 8 KB of HTTP POST request bodies, so an attacker can place a malicious payload after that limit to bypass the WAF. The text also notes that PUT and PATCH request bodies are not inspected at all, allowing a bypass without padding.
By Akash Mahajan · February 23, 2022 · 5 min read · advanced
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Cloud Armor has a non-configurable 8 KB limit on the portion of HTTP POST request bodies it inspects, and it does not inspect PUT or PATCH bodies at all.
Impact
An attacker could bypass Cloud Armor's WAF rules and exploit vulnerabilities in the underlying application, potentially achieving remote code execution, but only if the target endpoint accepts POST (or PUT/PATCH) requests and is itself vulnerable.
What the attacker needed
Target endpoint accepts POST requests; underlying application is vulnerable; attacker can send large request bodies
The fix
Customers should add a custom Cloud Armor rule that blocks requests whose Content-Length is 8192 or greater, fine-tuning it for legitimate large requests.
How it was found
- Craft an HTTP POST request whose body is larger than 8 KB.
- Place the malicious payload after the 8192nd byte or character in the body.
- Send the request to an endpoint that accepts and processes POST requests in a way that could trigger a vulnerability.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A web application firewall (WAF) is a filter that checks incoming requests for attack patterns before they reach the application. Cloud Armor, Google's WAF, only looks at the first 8 KB of a POST request body, so anything after that is invisible to it. An attacker can hide an attack in the later part of the body and the WAF will not block it.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.