Simple Login Brute Force / Current Password Requirement Bypass
The username and email update endpoints verified any valid username/password pair rather than the logged-in user's current password, so an attacker with temporary access could change the victim's email and take over the account. The same flaw allowed brute-forcing the victim's password from the attacker's own session.
Published on medium.com
In this blog post , I’ll be giving you a scenario that you can add up your bug bounty checklist.
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
While testing a private website during bug bounty work, I came across a username and email update mechanism. The feature lets a logged-in user change the username or the email address associated with their account. To prevent unauthorised changes, the application required the user to enter their current password before either entity could be updated.
The same hunting session turned up a number of straightforward IDORs, XSS and CSRF issues, but this one instance was slightly different and was the first time I had encountered it.
Setup
The report does not describe the accounts, roles or tooling used; the only precondition is an authenticated session on the target application, plus knowledge of any valid credential pair (for example, the attacker's own). The relevant precondition is simply an authenticated session on the target application, plus knowledge of any valid credential pair (for example, the attacker's own).
Finding it
The update form required the current password, which is the expected defence against an attacker who has temporary access to an account but does not know the password. Looking at the request that the form generated, one detail stood out: the old username was sent as a hidden parameter that was not present in the visible form.
That hidden parameter, old_username, is sent alongside the password, and the back end verifies the pair as valid credentials. The visible form only asks for the new value and the password, so the hidden field is easy to overlook and easy to tamper with.
Exploitation
Step 1: Capture the update request
Submitting the username update form produced the following request:
A similar request existed for updating the email address. The body carries four parameters: the CSRF token, the hidden old_username, the new_username and the password. The csrfmiddlewaretoken name and the X-Requested-With: XMLHttpRequest header indicate a Django-style form submitted over AJAX, but the report does not state the framework explicitly.
Step 2: Tamper with the hidden parameter
After some tampering I found that supplying a valid combination of old_username and password, using any valid credentials such as the attacker's own, allowed the username to be changed to any value without entering the current password of the account being modified.
The back end was only checking that the credential pair was valid, irrespective of who was logged in.
Step 3: Account takeover with temporary access
In simple terms, a person with temporary access to an account can update the email address and take over the account without knowing the current password. The session is enough to reach the endpoint, and the attacker's own credentials satisfy the password check.
Step 4: Brute force the victim's password from the attacker's account
Because only the credential pair is verified at the back end, irrespective of who is logged in, the same endpoint can be used to brute force a password. Put the victim's username or email in the old_username (or old email) field and brute force the password field.
On a successful brute force, the response says that the username or email has been updated, meaning the attacker's email or username is now set on the victim's account. That request contains the valid credentials of the victim. In other words, you are brute forcing the victim's account from the attacker's account.
A low blow, but an effective bug.
Root cause
The back end verifies the old_username and password pair as a standalone credential check and does not tie that check to the account identified by the current session.
The CSRF token protects against cross-site submission but does nothing here, because the attacker submits the request themselves from an authenticated session. The current-password requirement is bypassed because the back end only checks that the credential pair is valid.
Impact
Two distinct impacts follow from the same flaw:
- Anyone with temporary access to an account, for example through a shared or borrowed session, can change the email address and take over the account without knowing the current password.
- The endpoint can be used to brute force a victim's password: an attacker logged into their own account places the victim's username or email in the
old_usernamefield, and a successful guess returns a response that the username or email is updated.
Fix
A change that would address the root cause is to verify the supplied password against the account identified by the authenticated session, and to ignore or reject any client-supplied identity field such as old_username for that purpose.
Variants to test
- Hidden identity fields in profile, email or password change forms: look for parameters such as
old_username,old_email,user_idoraccountthat are not in the visible form. A positive result is that changing the hidden value while keeping your own password still updates the target account. - Password verification endpoints that accept a username alongside the password: try your own credentials with a different username in the identity field. A positive result is a success response for the other account.
- Brute force through authenticated endpoints: submit guesses for another user's password from your own session and watch for a distinct success response. A positive result is a confirmed guess.
- Email change flows: repeat the same tampering on the email update request, which the report says was similar to the username one. A positive result is the victim's email replaced with the attacker's address.

What happened, in plain words
A security researcher was testing a private website as part of a bug bounty programme. Bug bounties are rewards that companies pay to people who find and report security problems in their systems. During that testing, the researcher found several common issues: IDORs (where a website lets you access another user's data by changing an identifier in a request), XSS (cross-site scripting, where an attacker can inject code into a page that other users see), and CSRF (cross-site request forgery, where a malicious site tricks your browser into sending a request you did not intend). Those were straightforward. But one issue was different and new to the researcher.
The website had a feature that let a logged-in user change their username or email address. To stop someone who had temporary access to your account from changing these details without your knowledge, the site asked for your current password before making the change. That is a sensible safeguard: if you borrow a friend's laptop and they are still logged in, you should not be able to change their email without knowing their password.
However, the researcher discovered that the website was not actually checking the password against the account that was logged in. Instead, it was checking a hidden field called old_username together with the password. By putting any valid username and password pair (for example, the attacker's own) into those fields, the attacker could change the username or email of the account that was currently logged in, without knowing that account's password. This bypasses the current-password requirement entirely.
The same flaw also allowed a different attack: password brute forcing. Brute forcing means trying many passwords until one works. Because the website only checked that the username and password pair was valid, an attacker could put the victim's username in the old_username field and try many passwords in the password field. When the correct password was guessed, the website would respond that the username or email was updated, confirming the guess. In effect, the attacker could brute force the victim's password from their own account, without needing to be logged in as the victim.
This post explains the finding step by step, with the actual request and an explanation of each part, so you can add this scenario to your own bug bounty checklist.

Setting the scene
The researcher was testing a private website. The report does not describe the accounts, roles or tools used. An intercepting proxy is software that sits between your browser and the website, letting you see and modify the requests and responses. The only precondition is that you are logged in to the target application and you know at least one valid username and password pair (for example, your own).
Finding the issue
The update form asked for the current password. That is the expected defence against someone who has temporary access to an account but does not know the password. When the researcher looked at the request that the form generated, one detail stood out: the old username was sent as a hidden parameter that was not visible in the form on the page.
That hidden parameter, old_username, is sent alongside the password, and the back end checks the pair as valid credentials. The visible form only asks for the new value and the password, so the hidden field is easy to overlook and easy to tamper with. Tampering means changing the request before it reaches the server, for example with an intercepting proxy.
Exploitation
Step 1: Capture the update request
Submitting the username update form produced the following request:
A similar request existed for updating the email address. The body carries four parameters: the CSRF token, the hidden old_username, the new_username and the password. The csrfmiddlewaretoken name and the X-Requested-With: XMLHttpRequest header indicate a Django-style form submitted over AJAX, but the report does not state the framework explicitly.
Let us go through this request line by line.
POST /my/update/username HTTP/1.1is the request line.POSTis the method used to send data to the server to create or update something./my/update/usernameis the path on the server that handles username updates.HTTP/1.1is the version of the HTTP protocol being used.Host: redact.comtells the server which website the request is for. The actual domain has been replaced withredact.comto protect the target.Connection: closeasks the server to close the network connection after this request, rather than keeping it open for further requests.Content-Length: 110says how many bytes the body of the request contains. The server uses this to know when it has received the whole body.Accept: application/json, text/javascript, */*; q=0.01tells the server what types of response the browser is willing to accept. Here it prefers JSON (a data format) and JavaScript, but will accept anything.Origin: https://www.redact.comindicates the origin (scheme, host and port) of the page that made the request. It is a security header used by browsers to help prevent cross-site attacks.X-Requested-With: XMLHttpRequestis a non-standard header that many JavaScript libraries add to requests made by AJAX (asynchronous JavaScript and XML), which is a way for a web page to send and receive data from a server without reloading the page. Its presence often tells the server that the request came from JavaScript rather than a normal form submission.User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36identifies the browser and operating system making the request. Here it is Chrome 67 on Windows.Content-Type: application/x-www-form-urlencoded; charset=UTF-8says that the body is formatted like a URL query string: key=value pairs separated by&, with special characters percent-encoded. The charset is UTF-8.- The blank line separates the headers from the body.
- The body is
csrfmiddlewaretoken=[redacted]&old_username=OldUsername&new_username=NewUser&[redacted] This is a series of parameters.csrfmiddlewaretokenis a CSRF token: a random value that the server includes in forms to ensure the request comes from the legitimate site and not from a malicious one.old_usernameis the hidden field containing the current username.new_usernameis the desired new username.password` is the current password entered by the user.
Step 2: Tamper with the hidden parameter
After some tampering, the researcher found that supplying a valid combination of old_username and password, using any valid credentials such as the attacker's own, allowed the username to be changed to any value without entering the current password of the account being modified.
The back end was only checking that the credential pair was valid, irrespective of who was logged in. A session cookie is a small piece of data stored by your browser and sent with every request to a site, so the server can recognise you as logged in.
Step 3: Account takeover with temporary access
In simple terms, a person with temporary access to an account can update the email address and take over the account without knowing the current password. The session is enough to reach the endpoint, and the attacker's own credentials satisfy the password check. Account takeover means gaining control of someone else's account, often by changing the email to one the attacker controls, then using password reset to lock the original owner out.
Step 4: Brute force the victim's password from the attacker's account
Because only the credential pair is verified at the back end, irrespective of who is logged in, the same endpoint can be used to brute force a password. Put the victim's username or email in the old_username (or old email) field and brute force the password field.
On a successful brute force, the response says that the username or email has been updated, meaning the attacker's email or username is now set on the victim's account. That request contains the valid credentials of the victim. In other words, you are brute forcing the victim's account from the attacker's account.
A low blow, but an effective bug.
Root cause
The back end verifies the old_username and password pair as a standalone credential check and does not tie that check to the account identified by the current session.
The CSRF token protects against cross-site submission but does nothing here, because the attacker submits the request themselves from an authenticated session. The current-password requirement is bypassed because the back end only checks that the credential pair is valid.
Impact
Two distinct impacts follow from the same flaw:
- Anyone with temporary access to an account, for example through a shared or borrowed session, can change the email address and take over the account without knowing the current password.
- The endpoint can be used to brute force a victim's password: an attacker logged into their own account places the victim's username or email in the
old_usernamefield, and a successful guess returns a response that the username or email is updated.
Fix
A change that would address the root cause is to verify the supplied password against the account identified by the authenticated session, and to ignore or reject any client-supplied identity field such as old_username for that purpose.
Variants to test
- Hidden identity fields in profile, email or password change forms: look for parameters such as
old_username,old_email,user_idoraccountthat are not in the visible form. A positive result is that changing the hidden value while keeping your own password still updates the target account. - Password verification endpoints that accept a username alongside the password: try your own credentials with a different username in the identity field. A positive result is a success response for the other account.
- Brute force through authenticated endpoints: submit guesses for another user's password from your own session and watch for a distinct success response. A positive result is a confirmed guess.
- Email change flows: repeat the same tampering on the email update request, which the report says was similar to the username one. A positive result is the victim's email replaced with the attacker's address.
Glossary
- Bug bounty: A programme where organisations reward people for finding and reporting security vulnerabilities in their systems.
- IDOR: Insecure Direct Object Reference; a vulnerability where a website allows access to objects (like files or database records) by reference without proper authorisation checks.
- XSS: Cross-Site Scripting; a vulnerability that allows an attacker to inject malicious scripts into web pages viewed by other users.
- CSRF: Cross-Site Request Forgery; an attack that tricks a user's browser into sending an unwanted request to a website where the user is authenticated.
- Brute force: An attack that tries many passwords or keys until the correct one is found.
- Intercepting proxy: Software that sits between a browser and a server, allowing the user to view and modify the traffic.
- Hidden parameter: A field in a web form or request that is not visible to the user in the normal interface but is still sent to the server.
- Back end: The server-side part of a web application that processes requests and manages data.
- Session cookie: A small piece of data stored by the browser and sent with requests to identify the user's session.
- CSRF token: A random value included in forms to prevent CSRF attacks by ensuring the request originates from the legitimate site.
- AJAX: Asynchronous JavaScript and XML; a technique for web pages to communicate with the server without reloading the page.
- HTTP: Hypertext Transfer Protocol; the protocol used for communication between web browsers and servers.
- POST: An HTTP method used to send data to the server to create or update a resource.
- Header: Part of an HTTP request or response that carries metadata, such as the content type or user agent.
- User-Agent: A header that identifies the browser and operating system making the request.
- Content-Type: A header that indicates the format of the data in the request or response body.
- Content-Length: A header that indicates the size of the request or response body in bytes.
- Origin: A header that indicates the origin (scheme, host, port) of the page that initiated the request.
- Endpoint: A specific URL or URI where a web service can be accessed.
- Account takeover: A type of attack where an attacker gains unauthorised access to a user's account.
- Password oracle: A system or endpoint that reveals whether a password guess is correct through its responses.
- Rate limiting: A technique to limit the number of requests a client can make in a given time period.
- Lockout: A security measure that temporarily or permanently blocks an account after a certain number of failed login attempts.
- CVSS: Common Vulnerability Scoring System; a standard for rating the severity of security vulnerabilities.