The easiest way I used to bypass an admin panel
The admin panel was protected by an OAuth proxy that required Google login, but sending a request without a User-Agent header bypassed the proxy and exposed the normal login page. An attacker could then log in with their own user credentials and act as an administrator, modifying the entire website.
Published on medium.com
In this story I’m explaining a vulnerability that I reported to a program in Hackerone, my english is not perfect and its not my mother language so please never mind if I have some problems with the grammar, all I need is you to understand what Im talking about exactly.
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.
Context
A few months before writing this up, a friend recommended that the author learn HTTP request smuggling. The author normally avoids classic vulnerability classes because so many people hunt them, but started studying it anyway and tested it against a main target: a private HackerOne program, so nothing about the program itself can be disclosed.
The target has an admin panel protected by an OAuth proxy panel. The author does not know exactly how that proxy works, but for a non-authenticated user, visiting https://admin.target.com/ shows a page where the proxy recognises the unauthenticated user and requires a login with Google. The reasoning was simple: the proxy panel is what stands between an unauthenticated visitor and the admin panel, so if the page that requires the Google login can be bypassed, you may find yourself logged in.
Setup
- A private HackerOne program with an admin panel at
admin.target.com. - The admin panel sits behind an OAuth proxy that redirects unauthenticated users to a Google login.
- The author's own account on
www.target.com, created with normal user credentials. - The request shown in the report was originally HTTP/2, converted to HTTP/1.1 for the proof of concept.
- No special tooling is described beyond sending crafted requests to the admin endpoint.
Finding it
The author tested the newly learned request smuggling technique on the admin endpoint. The first request sent was this:
GET /test?a=a% HTTP/1.1Host: admin.target.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36GET /admin/login HTTP/1.1Host: admin.target.com
As the author describes it, this request sends multiple HTTP requests in one, and the HTTP response contains two responses in one. That in itself is normal HTTP behaviour. The part that mattered was the second request, which carried no User-Agent header.
The author is candid that the request looks poor, especially to anyone who knows the correct way to exploit HTTP request smuggling. But the response was a surprise: the panel that required the Google login disappeared, and a different login panel appeared, the same one normal users see.
Exploitation
Step 1: Send the combined request to the admin endpoint
The request above was sent to admin.target.com. The first line targets /test?a=a% with a User-Agent header, and a second request for /admin/login follows with only a Host header. The response returned the normal website login page at the admin login endpoint instead of the Google-backed proxy login page.
Step 2: Report it and read the program policy
The vulnerability was reported to the program. The program policy said:
If you reach a normal login panel please let us know on the admin panel
That is exactly what had happened, so the report was submitted with the title HTTP request smuggling leads to bypass admin panel proxy panel. The report was triaged in less than 10 minutes and the severity was updated to critical. The author was shocked that it was critical.
Step 3: Understand the real impact from the triager
A program triager explained that if the author logged in to the normal admin panel login with the normal user credentials created on www.target.com for their own account, they could act as admin by logging in to the admin panel, and could modify everything for the website. That is why the severity was raised to critical.
Step 4: Learn the actual trigger
Minutes later the triagers corrected the diagnosis: the admin panel was not bypassed because of the junk request. It was bypassed because no User-Agent header was used, and the proof of concept was a totally different thing. The attacker can bypass the proxy panel by only removing the User-Agent header. The minimal request is:
GET /admin/login HTTP/1.1Host: admin.target.com
With that request, the normal website login page appears at the admin login endpoint, and the proxy login page that requires logging in with Google is removed.
Root cause
The bypass happened when the User-Agent header was removed from the request to the admin login endpoint. A request without that header was not treated as a request that needed the Google login, so it was passed through to the admin login endpoint. The triagers said the admin panel was not bypassed by the junk request; the bypass is removing the User-Agent header.
Impact
Under the conditions described, an unauthenticated attacker who reaches the admin login endpoint without a User-Agent header sees the normal login panel instead of the Google-backed proxy login. If the attacker then logs in with ordinary user credentials created on www.target.com, they can act as admin in the admin panel and modify everything for the website. The triagers classified this as critical for that reason. The report does not give further detail on which administrative functions were reachable or what data was exposed.
Fix
The program awarded a 4 digit bounty, and the whole process from report to resolution took only 1 hour.
Variants to test
- Omit the
User-Agentheader on requests to admin or internal endpoints behind an authentication proxy. A positive result is the protected login page being replaced by the application's own login page. - Try other headers a proxy might key on, such as
Referer,X-Forwarded-FororAccept, by removing them one at a time. A positive result is a change in which login page is served. - Send a request with an empty
User-Agent:value. A positive result is the same bypass as removing the header entirely. - Combine the header omission with a second request in the same connection, as in the original proof of concept. A positive result is the second request reaching the admin login endpoint without the proxy login.
- After reaching the normal login panel, log in with a low-privileged account from the main site. A positive result is that account being granted administrative access in the admin panel.
The author's closing point is worth keeping in mind: you may be looking for one gate and not find it, but find another gate by looking for the first one. The vulnerability was not HTTP request smuggling, but it was found while testing for it.
What happened, in plain words
A security researcher learned about a class of bug called HTTP request smuggling, tested it on a private bug bounty program, and accidentally found something else: a way to get past the login screen that protected the program's admin panel. The trick turned out to be as simple as leaving one standard header out of a request. The program fixed it, paid a four digit bounty, and the whole thing from report to fix took about an hour.
This article walks through the story slowly, explaining every term as it comes up, so you can follow it even if you have never sent a crafted web request before.
Background: what the pieces are
Before the story makes sense, here are the building blocks, explained from zero.
A website and its admin panel
Most websites have two faces. One is the public face that anyone can visit, for example www.target.com. The other is an admin panel, a private area where the people who run the site can change things: edit content, manage users, adjust settings. Because it is powerful, an admin panel is normally locked away so that only trusted staff can reach it.
A simple comparison: a shop has a public sales floor and a back office. The back office has the safe, the stock records and the keys. You do not want random visitors wandering in there.
A proxy and an OAuth login
A proxy is a piece of software that sits in front of a website and checks every visitor before letting them through. Think of a receptionist in front of the back office door: you do not talk to the office directly, you talk to the receptionist, and the receptionist decides whether to let you in.
OAuth is a standard way for a website to let you log in using an account you already have somewhere else, for example your Google account. Instead of the site storing your password, it sends you to Google, Google confirms who you are, and you come back. The proxy in this story used OAuth with Google: if you were not logged in, it sent you to a Google login page.
So the setup was: visitor arrives at https://admin.target.com/, the proxy sees they are not logged in, and shows them a Google login page. Only after logging in with Google would the visitor reach the actual admin panel.
HTTP requests and headers
When your browser loads a page, it sends an HTTP request to the server. A request has a few parts:
- A method and path, for example
GET /admin/login, meaning "give me the page at this address". - A Host header, which tells the server which site name you are asking for. One server can host many sites, so this matters.
- Other headers, which are extra labelled lines of information. A common one is
User-Agent, which tells the server what browser and operating system you are using.
A header looks like Name: value. The User-Agent header, for example, might say you are using Chrome on Windows. Servers often use it to decide what kind of page to send back, or to log who visited.
HTTP/1.1 and HTTP/2
These are versions of the language browsers and servers use to talk. HTTP/1.1 is the older, text-based version, where requests look like plain lines of text. HTTP/2 is newer and more efficient. The researcher's original request was HTTP/2 but was converted to HTTP/1.1 for the proof of concept, because HTTP/1.1 is easier to read and to show to other people.
HTTP request smuggling
HTTP request smuggling is a bug class where an attacker crafts a request so that two systems in a chain (for example a proxy and the server behind it) disagree about where one request ends and the next begins. The attacker can then "smuggle" a second request past the first system, hidden inside the first.
A comparison: imagine handing a receptionist an envelope that says "one letter inside", but the back office opens it and finds two letters, the second one addressed to someone the receptionist would never have let through. The two systems disagreed about the contents, and the second letter got in.
A bug bounty program
A bug bounty program is a scheme run by an organisation that invites security researchers to look for bugs in its systems and report them. In return, the organisation pays a reward, called a bounty, and fixes the problem. HackerOne is a platform where many such programs are hosted. Some programs are private, meaning only invited researchers can see the details, and the researcher is not allowed to disclose information about the target.
Triage and severity
When a report arrives, the program triages it: someone reviews it, confirms whether the bug is real, and assigns a severity rating, usually from low to critical. Critical means the bug could cause serious harm, such as full control of the site.
The setup
Here is what the researcher had to work with:
- A private HackerOne program with an admin panel at
admin.target.com. - The admin panel sat behind an OAuth proxy that sent unauthenticated visitors to a Google login.
- The researcher had their own ordinary account on
www.target.com, created with normal user credentials. - The request shown in the report was originally HTTP/2, converted to HTTP/1.1 for the proof of concept.
- No special tooling is described beyond sending crafted requests to the admin endpoint.
The researcher did not know exactly how the proxy worked, but reasoned simply: the proxy is the thing standing between an unauthenticated visitor and the admin panel. If the page that demands the Google login can be bypassed, you might find yourself inside.
Finding it
A friend had recommended learning HTTP request smuggling. The researcher normally avoids classic vulnerability classes because so many people hunt them, but started studying it anyway and tested it against a main target, a site they use for practising anything new they learn.
The first request sent to the admin endpoint was this:
GET /test?a=a% HTTP/1.1Host: admin.target.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36GET /admin/login HTTP/1.1Host: admin.target.com
Line by line, in plain words:
GET /test?a=a% HTTP/1.1asks for a page called/testwith a query stringa=a%, using HTTP/1.1. The trailing%is an incomplete percent-encoding, which is part of why the request looks odd.Host: admin.target.comsays which site the request is for.User-Agent: Mozilla/5.0 ... Chrome/104.0.5112.102 ...is a normal browser identification string, claiming to be Chrome on Windows.- Then, without a blank line separating them, a second request begins:
GET /admin/login HTTP/1.1with its ownHost: admin.target.com.
As the researcher describes it, this request sends multiple HTTP requests in one, and the HTTP response contains two responses in one. That in itself is normal HTTP behaviour. The part that mattered was the second request, which carried no User-Agent header.
The researcher is candid that the request looks poor, especially to anyone who knows the correct way to exploit HTTP request smuggling. But the response was a surprise: the panel that required the Google login disappeared, and a different login panel appeared, the same one normal users see.
Why send this at all? The idea was to test whether the proxy could be confused into letting a second request through without the Google check.
Exploitation
Step 1: Send the combined request to the admin endpoint
The request above was sent to admin.target.com. The first line targets /test?a=a% with a User-Agent header, and a second request for /admin/login follows with only a Host header. The response returned the normal website login page at the admin login endpoint instead of the Google-backed proxy login page.
In other words: the researcher asked for the admin login page, and instead of being bounced to Google, they got the ordinary login form that regular users of the site see. That was the first sign something was wrong with the proxy.
Step 2: Report it and read the program policy
The vulnerability was reported to the program. The program policy said:
If you reach a normal login panel please let us know on the admin panel
A program policy is the set of rules and instructions a bug bounty program publishes for researchers: what is in scope, what to avoid, and what the program especially wants to hear about. This policy line told researchers that reaching a normal login panel on the admin panel was itself worth reporting.
That is exactly what had happened, so the report was submitted with the title HTTP request smuggling leads to bypass admin panel proxy panel. The report was triaged in less than 10 minutes and the severity was updated to critical. The researcher was shocked that it was critical.
Step 3: Understand the real impact from the triager
A triager is the person at the program who reviews incoming reports. This triager explained that if the researcher logged in to the normal admin panel login with the normal user credentials created on www.target.com for their own account, they could act as admin by logging in to the admin panel, and could modify everything for the website. That is why the severity was raised to critical.
Put simply: the login form that appeared was not just any login form. It accepted ordinary user accounts, and once logged in there, an ordinary user had administrator powers over the site. That turns a curiosity into a serious problem.
Step 4: Learn the actual trigger
Minutes later the triagers corrected the diagnosis: the admin panel was not bypassed because of the junk request. It was bypassed because no User-Agent header was used, and the proof of concept was a totally different thing. The attacker can bypass the proxy panel by only removing the User-Agent header. The minimal request is:
GET /admin/login HTTP/1.1Host: admin.target.com
Line by line:
GET /admin/login HTTP/1.1asks for the admin login page using HTTP/1.1.- That is all. There is no
User-Agentline.
With that request, the normal website login page appears at the admin login endpoint, and the proxy login page that requires logging in with Google is removed.
Why does this matter? A request without a User-Agent header is unusual, and removing it bypassed the proxy login. The triagers corrected the diagnosis: the bypass was the missing User-Agent header, not the smuggling request.
Root cause
The bypass happened when the User-Agent header was removed from the request to the admin login endpoint. A request without that header was not treated as a request that needed the Google login, so it was passed through to the admin login endpoint. The triagers said the admin panel was not bypassed by the junk request; the bypass is removing the User-Agent header.
Impact
Under the conditions described, an unauthenticated attacker who reaches the admin login endpoint without a User-Agent header sees the normal login panel instead of the Google-backed proxy login. If the attacker then logs in with ordinary user credentials created on www.target.com, they can act as admin in the admin panel and modify everything for the website. The triagers classified this as critical for that reason.
The report does not give further detail on which administrative functions were reachable or what data was exposed.
Fix
The vulnerability was resolved. The report does not describe the change that was made. The program awarded a 4 digit bounty, and the whole process from report to resolution took only 1 hour.
Variants to test
If you ever find yourself in a similar situation, here are things worth trying. Each one is a small experiment, and each has a clear sign of success.
- Omit the
User-Agentheader on requests to admin or internal endpoints behind an authentication proxy. A positive result is the protected login page being replaced by the application's own login page. - Try other headers a proxy might key on, such as
Referer,X-Forwarded-FororAccept, by removing them one at a time. A positive result is a change in which login page is served. - Send a request with an empty
User-Agent:value. A positive result is the same bypass as removing the header entirely. - Combine the header omission with a second request in the same connection, as in the original proof of concept. A positive result is the second request reaching the admin login endpoint without the proxy login.
- After reaching the normal login panel, log in with a low-privileged account from the main site. A positive result is that account being granted administrative access in the admin panel.
The researcher's closing point is worth keeping in mind: you may be looking for one gate and not find it, but find another gate by looking for the first one. The vulnerability was not HTTP request smuggling, but it was found while testing for it.
Glossary
- Admin panel: a private area of a website where staff manage content, users and settings.
- Authentication: the process of proving who you are, usually by logging in.
- Bounty: a reward paid by a bug bounty program for a valid security report.
- Bug bounty program: a scheme where an organisation invites researchers to find and report bugs in exchange for rewards.
- Critical: the highest severity rating, meaning the bug could cause serious harm such as full control of a site.
- Header: an extra labelled line of information in an HTTP request or response, such as
User-AgentorHost. - Host header: the header that tells the server which site name the request is for.
- HTTP: the language browsers and servers use to exchange requests and responses.
- HTTP/1.1: the older, text-based version of HTTP, where requests look like plain lines of text.
- HTTP/2: a newer, more efficient version of HTTP.
- HTTP request: a message a browser or tool sends to a server asking for something, such as a page.
- HTTP request smuggling: a bug class where two systems in a chain disagree about where one request ends and the next begins, letting an attacker hide a second request inside the first.
- OAuth: a standard way to log in using an account you already have elsewhere, such as a Google account.
- Policy (program policy): the published rules of a bug bounty program, saying what is in scope and what to report.
- Proof of concept (PoC): a request or set of steps that demonstrates a bug in practice.
- Proxy: software that sits in front of a website and checks or forwards visitors before they reach it.
- Severity: a rating of how serious a bug is, usually from low to critical.
- Triage: the review of a report to confirm the bug and assign a severity.
- Triager: the person at a program who reviews incoming reports.
- Unauthenticated: not logged in, so the system does not know who you are.
- User-Agent header: a header that tells the server what browser and operating system the client is using.