How I managed to Escalate privilege as admin
The login page revealed valid usernames through different error messages, and the rate limiting could be bypassed by changing the User-Agent header every ten requests. This allowed brute-forcing the admin password, leading to admin panel access and a potential PUT method upload.
Published on medium.com
i was participating on one of the big well known company's bug Bounty program which has very wide scope i will not mention the name of the company but lets focus on the vulnerability part
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
This write-up describes a chain of low-severity issues that together gave administrative access to a web application. The researcher was taking part in a bug bounty programme run by a large, well-known company with a very wide scope; the company is not named, and the host in the report is written as wechat.example.cn. The asset is a subdomain that had been down for a long time and came back up during the researcher's reconnaissance.
The feature at the centre of the report is the site's admin login panel. It sits behind a directory that redirects (302) to a login page, and it authenticates an administrator with a username and password before granting access to the admin area.
Setup
The researcher worked with a standard recon workflow: enumerating the company's assets, then opening every resolved domain in Chrome to see which ones were live. Burp Suite was used as the intercepting proxy, with Burp Intruder for the brute-force attempts, and Firefox in a private tab was configured to send traffic through Burp. No specific versions, accounts or roles are given in the report.
Finding it
While checking the assets, the researcher noticed that wechat.example.cn, previously down, was now up. Looking for an admin directory on the host turned up one, but requesting it returned a 302 redirect to the login page. Direct requests to common admin endpoints such as index.php did not get past the redirect either, so the next step was to look at the login form itself.
A first attempt with the common pair Admin:admin failed, but the error message said the password was wrong. That wording implies the username admin exists and only the password was incorrect, which is username enumeration through a security misconfiguration. On its own the researcher judged this unlikely to be treated as more than an accepted risk or out of scope, so the plan was to chain it with something else.
Username enumeration, as the report defines it, is the activity of retrieving valid usernames from a web application. Login pages, registration forms and password reset pages are the usual places where applications leak this.
Exploitation
Step 1: brute force the known username
With a confirmed username, the researcher ran a brute-force attempt against the login form using Burp Intruder and a list of common credentials, probably the top 100 common passwords. After about 10 requests the server blocked further requests, so the attempt stopped there.
Step 2: work out what the block actually was
To understand the block, the researcher opened the site in a Firefox private tab configured with Burp and tried to log in: blocked again. Opening the same site in Chrome and logging in worked fine. The conclusion was that rate limiting was not configured properly, which the researcher classed as another low-severity issue.
Rate limiting, as the report describes it, controls the amount of incoming and outgoing traffic to or from a network. If a service allows, for example, 100 requests per minute and that limit is exceeded, an error is triggered.
Step 3: rotate the User-Agent to stay under the limit
The idea was to keep brute forcing the admin credential but change the User-Agent header every 10 requests, so the rate limit would not be hit. The word list was the top 100 passwords, with a different User-Agent used for each block of 10 requests.
The method worked. The first 10 requests returned a 302 redirect to the login page. In the next 10 requests a credential was found that returned a 302 redirect to an /admin/xxxxx endpoint, and logging in with that credential got the researcher past the login.
Step 4: look at the admin panel
Inside the panel the researcher visited the page's endpoints. In the logs file there were many log entries, and on one of them the admin was seen using a PUT request, which the researcher took to mean a shell could potentially be uploaded to the server.
Root cause
The report lists four vulnerabilities found during this process:
- Username enumeration. The login form returns a different error when the username exists but the password is wrong, so valid usernames can be confirmed one at a time.
- Rate limit bypass. Changing the User-Agent every 10 requests avoided the block that had stopped the first brute-force attempt. The report does not describe the server-side implementation, so the exact key is not stated.
- Weak credential. A password from a top-100 common list was in use on the admin account.
- PUT method exposure. The admin logs showed PUT requests being used, which the researcher read as a possible route to uploading a shell. The report does not show a successful upload.
Impact
An attacker who can reach the login page can confirm valid usernames, then brute force the password while rotating the User-Agent to stay under the rate limit. With a weak password on the admin account, this leads to full administrative access to the panel. From there, the researcher notes the possibility of using the PUT method to exploit the server, but this is stated as a potential rather than a demonstrated result.
Fix
Variants to test
- Differential login errors. Submit a known-bad username and a known-good username with a wrong password. A positive result is any difference in message, status code, response length or timing that reveals which usernames exist.
- Rate-limit key discovery. Send requests with a fixed account and vary one header at a time (User-Agent,
X-Forwarded-For, cookies). A positive result is the block lifting when only that header changes. - Lockout scope. Check whether the block follows the account, the session or the source address by switching browsers and networks. A positive result is the same account staying attackable from a fresh client.
- Common password lists. Run a short top-100 list against confirmed usernames. A positive result is a 302 to an authenticated area instead of back to the login page.
- Method handling on admin endpoints. Send OPTIONS and PUT to admin paths and inspect the logs. A positive result is a PUT being accepted or logged as used by legitimate administrators, which is worth reporting even before a shell is demonstrated.
Take away
The researcher's summary is that little drops make a mighty ocean, and that chaining low-level issues can add impact on the target.
What happened, in plain words
A security researcher was taking part in a bug bounty programme. A bug bounty programme is an offer from a company: if you find a security problem in our systems and report it responsibly, we may reward you. This particular programme belonged to a large, well-known company with a very wide scope, meaning many of its websites and services were fair game. The company is not named in the report, and the site involved is written as wechat.example.cn.
The researcher found a login page for the site's admin area. An admin area is the private control room of a website, where staff manage content, users and settings. Three small weaknesses stacked on top of each other: the login page revealed which usernames existed, the protection against guessing passwords too quickly could be sidestepped, and the admin account used a very common password. Together they let the researcher log in as an administrator. That is what "escalating privilege" means: starting with no access and ending up with the highest level of access.
This is a beginner's walkthrough of the same story. Every tool and term is explained where it first appears, and nothing is assumed beyond being able to use a browser.
The setup: what the researcher used
The researcher began with reconnaissance, usually shortened to recon. Recon is the information-gathering phase: finding out which websites and services a company owns before testing any of them. The workflow was to list the company's assets, then open every domain that resolved in the Chrome browser to see which ones were alive. A domain "resolves" when its name can be translated into the address of a server that answers, much like a phone book turning a name into a number.
Two tools did the heavy lifting:
- Burp Suite, an intercepting proxy. A proxy sits between your browser and the website. Instead of your browser talking directly to the server, it talks to the proxy, and the proxy forwards the conversation. That lets you read and edit every request before it leaves and every response before it arrives. Think of a postal worker who opens each letter, lets you rewrite it, then seals it and delivers it.
- Burp Intruder, the part of Burp Suite that sends the same request many times with one piece changed each time. It is the standard tool for trying a list of passwords against a login form.
Firefox in a private tab was set up to send its traffic through Burp. A private tab is a browser window that does not keep history or share cookies with your normal windows. The report gives no versions, accounts or roles, so there is nothing more specific to say about the setup.
Finding the admin panel
During recon the researcher noticed that wechat.example.cn, a subdomain that had been down for a long time, was now up. A subdomain is a name that sits under a company's main domain, like a branch office under a head office name.
Looking for an admin directory on that host turned one up. A directory is simply a folder on the web server, and an admin directory is the folder that holds the admin pages. Requesting it returned a 302 redirect to the login page. A 302 is the web's way of saying "not here, go there instead": the server answers with a pointer to another address, and the browser follows it automatically. So the admin pages were not open, but they were reachable through a login form.
Direct requests to common admin entry points such as index.php did not get past the redirect either. index.php is the conventional name for the first page a PHP web application serves from a folder, so it is an obvious guess when probing an admin directory. The next step was therefore to study the login form itself.
The first clue: the error message
The researcher tried the classic pair Admin:admin, a username and password combination that lazy setups sometimes keep. It failed, but the error message said the password was wrong. That wording is the whole trick. If the username did not exist, a careful site would say something neutral like "invalid username or password". Saying specifically that the password is wrong tells the visitor that the username admin is real and only the password was incorrect.
This is username enumeration through a security misconfiguration. Username enumeration is the activity of retrieving valid usernames from a web application, as the report defines it. Login pages, registration forms and password reset pages are the usual places where applications leak this information. The everyday comparison: a receptionist who answers "there is no such employee" for one name and "that employee's passcode is wrong" for another has just told you who works there.
On its own the researcher judged this unlikely to be treated as more than an accepted risk or out of scope. Accepted risk means the company knows about the issue and chooses to live with it; out of scope means the programme's rules say that kind of finding does not count. So the plan was to chain it with something else. Chaining means combining several small issues so that together they produce a bigger result than any one of them alone.
Step 1: brute force the known username
With a confirmed username, the researcher ran a brute-force attempt against the login form. Brute forcing means trying many candidate passwords automatically, one after another, until one works. It is like trying every key on a large keyring in a door lock, except a computer can try thousands per minute.
Burp Intruder sent the requests, using a list of common credentials, probably the top 100 common passwords. A word list like that is a file of the passwords people use most often, such as password, 123456 or a name. The report does not reproduce the list.
After about 10 requests the server blocked further requests, so the attempt stopped there. Something on the server was counting requests and refusing more once a threshold was crossed.
Step 2: work out what the block actually was
To understand the block, the researcher opened the site in a Firefox private tab configured with Burp and tried to log in: blocked again. Then the same site was opened in Chrome and logging in worked fine.
That difference is the clue. Opening the site in Chrome and logging in worked fine, which the researcher took to mean the protection was not configured properly. The researcher classed this as another low-severity issue.
Rate limiting, as the report describes it, controls the amount of incoming and outgoing traffic to or from a network. If a service allows, for example, 100 requests per minute and that limit is exceeded, an error is triggered. The everyday comparison is a bouncer who lets in ten people per minute: the eleventh person in that minute is turned away, but the queue can try again next minute.
Step 3: rotate the User-Agent to stay under the limit
The idea was to keep brute forcing the admin credential but change the User-Agent header every 10 requests, so the rate limit would not be hit. A header is a small labelled line of extra information that travels with every web request, alongside the address you are asking for. The User-Agent header is the line where the browser introduces itself, roughly "I am Chrome on Windows" or "I am Firefox on Linux". Websites use it to decide which version of a page to send.
Changing the User-Agent every 10 requests avoided the block, though the report does not say how the server counted requests. The word list was the top 100 passwords, with a different User-Agent used for each block of 10 requests.
The method worked. The first 10 requests returned a 302 redirect to the login page, meaning those guesses failed and the site sent the browser back to the form. In the next 10 requests a credential was found that returned a 302 redirect to an /admin/xxxxx endpoint, and logging in with that credential got the researcher past the login. An endpoint is a specific address on a server that does a particular job, like a counter in a building: you go to the right counter for the service you want. A redirect to an admin endpoint instead of back to the login page is the sign that the login succeeded.
Step 4: look at the admin panel
Inside the panel the researcher visited the page's endpoints. In the logs file there were many log entries. A log is the running diary a server keeps of what happened: who requested what, when, and with which method. On one entry the admin was seen using a PUT request.
HTTP methods are the verbs of the web. GET asks for a page, POST submits a form, and PUT asks the server to store something at a given address. Seeing PUT used in the admin area, the researcher took it to mean a shell could potentially be uploaded to the server. A shell is a small program that, once running on a server, lets an attacker send it commands. The report presents this as a possibility, not something that was carried out.
The weaknesses, one by one
The report lists four vulnerabilities found during this process:
- Username enumeration. The login form returns a different error when the username exists but the password is wrong, so valid usernames can be confirmed one at a time.
- Rate limit bypass. Changing the User-Agent every 10 requests avoided the block that had stopped the first brute-force attempt. The report does not describe the server-side implementation, so the exact key is not stated.
- Weak credential. A password from a top-100 common list was in use on the admin account. A weak password is short, common, a system default, or something that could be rapidly guessed by executing a brute force attack using a subset of all possible passwords, such as words in the dictionary, proper names, words based on the user name or common variations on these themes.
- PUT method exposure. The admin logs showed PUT requests being used, which the researcher read as a possible route to uploading a shell.
What an attacker could do with this
Someone who can reach the login page can confirm valid usernames, then brute force the password while rotating the User-Agent to stay under the rate limit. With a weak password on the admin account, this leads to full administrative access to the panel. From there, the researcher notes the possibility of using the PUT method to exploit the server, but this is stated as a potential rather than a demonstrated result.
How to fix it
Variants to test
If you want to look for the same pattern on a site you are allowed to test, these are checks worth trying:
- Differential login errors. Submit a known-bad username and a known-good username with a wrong password. A positive result is any difference in message, status code, response length or timing that reveals which usernames exist.
- Rate-limit key discovery. Send requests with a fixed account and vary one header at a time (User-Agent,
X-Forwarded-For, cookies). A positive result is the block lifting when only that header changes.X-Forwarded-Foris a header that proxies use to record the original address of a request; cookies are small pieces of data a site stores in your browser to remember who you are between requests. - Lockout scope. Check whether the block follows the account, the session or the source address by switching browsers and networks. A positive result is the same account staying attackable from a fresh client.
- Common password lists. Run a short top-100 list against confirmed usernames. A positive result is a 302 to an authenticated area instead of back to the login page.
- Method handling on admin endpoints. Send OPTIONS and PUT to admin paths and inspect the logs. OPTIONS is a method that asks a server which methods it accepts at an address. A positive result is a PUT being accepted or logged as used by legitimate administrators, which is worth reporting even before a shell is demonstrated.
Take away
The researcher's summary is that little drops make a mighty ocean, and that chaining low-level issues can add impact on the target. None of the individual findings was dramatic on its own, but together they opened the admin panel.
Glossary
- 302 redirect: a server response that points the browser to a different address, which the browser then follows automatically.
- Accepted risk: a known issue the company decides to live with rather than fix.
- Admin area / admin panel: the private part of a website where staff manage content, users and settings.
- Asset: any website, service or system a company owns and a bug bounty programme covers.
- Brute force: trying many candidate passwords automatically until one works.
- Bug bounty programme: a scheme where a company invites researchers to report security problems, sometimes for a reward.
- Burp Intruder: the part of Burp Suite that repeats a request many times with one piece changed each time.
- Burp Suite: an intercepting proxy used to read and edit web traffic between a browser and a server.
- Chaining: combining several small issues so that together they produce a bigger result.
- Cookie: a small piece of data a site stores in your browser to remember who you are between requests.
- Directory: a folder on a web server.
- Domain: a name that identifies a website, such as example.com.
- Endpoint: a specific address on a server that performs a particular job.
- GET: the HTTP method used to ask for a page.
- Header: a small labelled line of extra information sent with every web request or response.
- HTTP method: the verb of a web request, such as GET, POST, PUT or OPTIONS.
- Intercepting proxy: a tool that sits between browser and server so traffic can be read and edited.
- Log: the running diary a server keeps of requests and events.
- OPTIONS: an HTTP method that asks a server which methods it accepts at an address.
- Out of scope: outside the rules of a bug bounty programme, so findings there do not count.
- POST: the HTTP method used to submit a form.
- Private tab: a browser window that does not keep history or share cookies with normal windows.
- PUT: an HTTP method that asks the server to store something at a given address.
- Rate limiting: a control on how much traffic a service accepts in a period of time, triggering an error when the limit is exceeded.
- Recon (reconnaissance): the information-gathering phase of finding out which systems a company owns.
- Resolves: when a domain name can be translated into the address of a server that answers.
- Scope: the set of systems a bug bounty programme allows you to test.
- Security misconfiguration: a setting left in an unsafe state, such as a login form that reveals which usernames exist.
- Shell: a small program that, once running on a server, lets an attacker send it commands.
- Subdomain: a name that sits under a company's main domain, like a branch office under a head office name.
- User-Agent: the header where a browser introduces itself, roughly "I am Chrome on Windows".
- Username enumeration: retrieving valid usernames from a web application, typically through differences in error messages.
- Weak password: a password that is short, common, a system default, or easily guessed by brute force.
- Word list: a file of candidate passwords, such as the most commonly used ones.
- X-Forwarded-For: a header proxies use to record the original address of a request.