Multiple Host Header Attacks after bypassing protection with… a Header Attack
The API returned 200 responses instead of 403 when the Host header was changed, allowing directory enumeration and access to robots.txt. Some directories with 301 responses redirected to any website supplied in the Host header, enabling open redirects.
I was searching for bug bounty programmes by using google dorks, when I came across one by a company, let’s say, Example Inc. They had a relatively big scope and I thought I’d give that a try.
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 the application trusted the Host header for access control and for building redirect URLs, instead of using a fixed, validated hostname.
Impact
An attacker could bypass API key checks to enumerate directories and read robots.txt, and could use the 301 endpoints to redirect users to arbitrary websites.
What the attacker needed
None
How it was found
- Send a request to the API without a valid X-API-KEY header and observe a 403 response.
- Change the Host header to a different value and observe a 200 response.
- Access robots.txt and enumerate directories that were previously inaccessible.
- Use ffuf to find directories that return 301 responses.
- Change the Host header on those 301 directories to redirect to an arbitrary website.
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 Host header tells a web server which website name the browser asked for. Here, changing that name made the server skip its normal access check and also let an attacker choose where some redirects sent people.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.