Exploiting HTTP Parsers Inconsistencies
The research found that different HTTP parsers (Nginx, Node.js, Flask, Spring Boot, PHP, AWS WAF, S3, cache servers) handle pathnames and headers inconsistently, allowing attackers to bypass access control rules, WAF filters, and trigger SSRF or cache poisoning. An attacker could access restricted endpoints, fetch internal metadata, or poison cached content.
Published on rafa.hashnode.dev
The HTTP protocol plays a vital role in the seamless functioning of web applications, however, the implementation of HTTP parsers across different technologies can introduce subtle discrepancies, leading to potential security loopholes.
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
Likely inconsistent HTTP parsing between components, such as different trim() implementations or header folding rules, leading to discrepancies in path or header interpretation.
Impact
Attackers could bypass access controls to reach protected endpoints, evade WAF rules to deliver SQL injection payloads, perform SSRF to access cloud metadata, or poison caches with arbitrary content; some issues were limited to specific server versions or configurations.
What the attacker needed
Nginx with exact-match ACL rules; Backend using trim() on path; Attacker can send crafted HTTP requests
The fix
Use regex-based location rules (e.g., `~* ^/admin`) instead of exact matches, ensure full URLs with trailing slashes when concatenating user input, and deploy a reverse proxy that normalises HTTP requests; AWS fixed the WAF bypass in 2022.
How it was found
- Set up an Nginx reverse proxy with an ACL rule denying access to /admin.
- Configure a backend server (e.g., Node.js, Flask, Spring Boot) that trims certain characters from the pathname.
- Send a request to /admin followed by a character that the backend trims but Nginx does not (e.g., \xa0 for Node.js).
- Nginx does not match the ACL rule and forwards the request to the backend.
- The backend trims the character and serves the /admin endpoint.
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.
Web servers and proxies often clean up URLs and headers in slightly different ways. If a front-end proxy (like Nginx) and a back-end server (like Node.js) disagree on what a URL means, an attacker can craft a request that the proxy thinks is harmless but the back-end treats as a protected path. This can let them reach admin pages or make the server fetch internal resources.
What is Smuggling / CRLF?
A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.