How Relying on HTTP Referer Headers for API Protection Led to Goo
Two backend proxy endpoints for Google Places API accepted requests without any session or token authentication, relying solely on the HTTP Referer header for access control. An attacker could spoof the Referer header to use the proxy as a free, unrestricted gateway, potentially exhausting the organisation's paid API quota and causing financial loss.
Published on medium.com
Hello, Bug Hunter! In this writeup, I’ll walk you through a common architectural oversight I discovered during a recent security assessment.
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
The backend treated the client-controlled Referer header as a trusted authentication token instead of requiring a server-verified session or signed token.
Impact
An attacker could automate requests through the proxy to exhaust the organisation's paid Google Places quota, causing financial loss (Denial of Wallet) and service degradation for legitimate users.
What the attacker needed
No account needed; Ability to send custom HTTP headers
The fix
The proxy endpoints should require a valid server-verified user session or a short-lived signed token, and should also apply strict rate limiting and request only minimal data fields.
How it was found
- Send a POST request to the autocomplete endpoint without an Authorization header but with a Referer header set to the official site.
- Observe that the server returns HTTP 200 with live Google Places predictions.
- Send a similar unauthenticated request to the place details endpoint with the same spoofed Referer and observe a successful response.
- Change the Referer header to an external domain and observe a 403 error, confirming the header is the only access control.
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 website can ask a server to fetch data from another service, like Google Maps, using a secret key. To hide that key, the site uses its own server as a middleman, called a proxy. The bug is that this middleman only checked a header called Referer, which is just a text label the client sends. Anyone can fake that label, so outsiders could use the middleman for free and run up the company's bill.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.