#BugBounty — “Let me reset your password and login into your account “-How I was able to Compromise any User Account via Reset Password Functionality
The password reset link contained a token that was just the base64-encoded email address and a timestamp, with no secret. An attacker could change the token to any victim's email, brute-force the numeric user ID, and reset the victim's password to take over the account.
Published on medium.com
{{media:0}}
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
Avinash Jain (@logicbomb_1) found this issue in one of the mobile wallet companies of India. The feature involved is the standard password reset flow: a user who has forgotten their password enters their registered email address, receives a mail with a reset link, and uses that link to set a new password. The report describes a logical flaw in how that link is built and validated, which allowed the researcher to reset the password of any user and log in as them.
Setup
The researcher worked with a test account registered as [redacted] and, later, a victim account found through user enumeration. No specific tools or versions are named in the report. The report does not describe how the link is generated; the id parameter is a six digit code that could be brute forced.
Finding it
The researcher requested a password reset for [redacted]. The mail said "To reset the password , please click on the below link-" and contained a URL of this shape:
http://www._________.com/account/resetpassword? id=296417&[redacted]&vit=MjAxNi8xMC8yNQ==
Looking at the parameters, the researcher decoded them:
idis the identification number associated with the user account.tokenis the base64 encoding of the registered mail ID, here[redacted].vitis the base64 encoding of a time stamp, here2016/10/25.

Further research showed that the vit timestamp is the expiry date of the reset password link, and in this case it was two days ahead of the moment the user clicked the reset password option. So the link carries the identity of the account and its own expiry date, both in a trivially reversible encoding.
Exploitation
Step 1: enumerate a valid account
By user enumeration on the same page, the researcher found one valid user account. The victim mail ID used in the report is [redacted].
Step 2: generate a reset link for that account
The researcher generated a forgot password link for the victim account and then began the task of finding the right reset password link. The mail ID of the user was replaced and encoded to base64, and the timestamp value was kept two days ahead of the current date:
Victim mail id — [redacted]
Base64 encoded value (Parameter = token) — dmFydW4wOTgxMUBnbWFpbC5jb20=
Timestamp value (Parameter = vit) — MjAxNi8xMC8yNQ==
Step 3: brute force the id
The remaining part is finding the id associated with that particular user mail ID. Since it is a six digit code, the researcher tried brute forcing it. Fortunately no rate limiting was set, and after a while the right id associated with the victim mail ID was found: id=254346. The report notes that this is time consuming.
Step 4: build the tampered URL
The tampered URL looks like this:
http://www._________.com/account/resetpassword/?id=254346&[redacted]&vit=MjAxNi8xMC8yNQ==
Step 5: set a new password and log in
The researcher loaded the link in the browser and was presented with a "Set new password" page.
After resetting the victim's password, the researcher was able to log in to the victim's account successfully, with complete access: using the wallet money, changing the registered mobile number, and everything else.
Root cause
The reset link is trusted entirely on the basis of values the requester supplies: the account identity (token, a base64 encoding of the email address), the expiry (vit, a base64 encoding of a date) and the account number (id). Because the email address and the expiry are only encoded, not signed, anyone who knows a victim's email address can produce a valid-looking token and vit. The only unknown left is the id, and a six digit numeric identifier with no rate limiting can be brute forced. The report does not describe the server-side validation logic.
Impact
An attacker who can enumerate a valid account and brute force its id can reset that user's password and log in as them. In this mobile wallet product, that means full access to the account: spending the wallet money, changing the registered mobile number and anything else the account allows. The attack requires a valid victim email address and the ability to send many requests to find the id, which the absence of rate limiting made practical.
Fix
The report says the vulnerability was reported to the concerned enterprise and patched within two days. A robust fix would be to stop deriving the reset link from client-visible, reversible values: generate a random, single-use token server side, store it against the account with a server-side expiry, and validate it on submission, so that neither the email address nor the expiry can be supplied by the requester. Rate limiting on the reset endpoint and on any identifier lookup would also remove the brute force path.
Variants to test
- Decode every parameter in a reset link. If any of them is base64 of an email address, a user id or a date, try changing it and see whether the server accepts the modified link. A positive result is a "Set new password" page for an account you do not control.
- Check whether the expiry parameter is client supplied. Set it far in the future and see whether an old link still works. A positive result is a link that remains valid past its intended lifetime.
- Look for numeric identifiers in reset links and test whether they can be enumerated. A positive result is a sequence of ids that map to different accounts without any throttling.
- Compare the reset link sent to two of your own accounts. If the only differences are the email address and the id, the link is probably not signed, and the same tampering may work.
- Test whether the reset endpoint checks that the token was issued for the same account as the id. A positive result is a link that combines one account's token with another account's id and is still accepted.
What happened, in plain words
A security researcher found a flaw in the password reset feature of a mobile wallet company in India. A mobile wallet is an app or website where you keep money and pay people from your phone, a bit like a digital purse. To use it you have an account, and like most accounts it is protected by an email address and a password.
When you forget your password, most websites offer a "reset password" button. You type your email address, the site sends you an email with a special link, and clicking that link lets you choose a new password. The idea is that only the person who can read that email can change the password.
In this case the special link could be forged by anyone who knew the victim's email address and could find the account number. The link contained the user's email address and an expiry date, both only lightly disguised (encoded, not protected), plus a number that identified the account. The researcher worked out how the link was put together, changed the email address and date to point at a victim, guessed the victim's account number, and opened the forged link. The site showed a "Set new password" page, and the researcher set a new password and logged in as the victim. From there the whole account was open: the wallet money, the registered mobile number, everything.
The company fixed it within two days.
The feature being attacked
Before the details, it helps to understand what a password reset link actually is.
When you click "forgot password", the website needs to know two things later, when you click the link in your email:
- Which account is asking to be reset.
- Whether the request is still valid, usually meaning it has not expired.
A well-built site does this by creating a long random string on its own server, storing it next to your account, and putting only that random string in the link. When you click, the server looks the string up in its records. If it finds it, and it has not expired, you may set a new password. Nobody can guess the random string, and nobody can change it to point at someone else, because the server holds the real copy.
This site did something different. It put the account identity and the expiry date directly into the link, in a form the user can read and change. That is the whole weakness.
Step 1: request a reset and look at the link
The researcher started with a test account of their own, registered as [redacted]. They clicked the reset password option for that account. The email arrived saying "To reset the password , please click on the below link-" and contained this URL:
http://www._________.com/account/resetpassword? id=296417&[redacted]&vit=MjAxNi8xMC8yNQ==
Line by line, in plain words:
http://www._________.com/account/resetpasswordis the address of the page that handles password resets. The underscores stand for the company's domain name, which the report hides.?marks the start of the parameters: extra pieces of information sent along with the address. Think of the address as a form and the parameters as the answers written in the boxes.id=296417is the first parameter. The report saysidis the identification number associated with the user account. Every account has a number, like a customer number in a shop.- `[redacted] is the second parameter. The report says this is the registered email address, written in base64.
vit=MjAxNi8xMC8yNQ==is the third parameter. The report says this is a time stamp, also in base64, whose value here is2016/10/25.
Base64 is a way of writing data using only letters, digits and a couple of symbols. It is not encryption and it is not a secret code: anyone can convert it back in a second, and there are free tools online that do it. It is more like writing a word in a different alphabet. It changes how the data looks, not who can read it.
So the link already told the researcher three things: the account number, the account's email address, and a date. All three were visible to anyone who received or intercepted the link, and all three could be edited before the link was opened.
Step 2: decode the parameters
The researcher decoded the two base64 values and confirmed what they were:
tokendecodes to[redacted], the registered email address.vitdecodes to2016/10/25, a date.

The image shows the decoded values next to the parameters, making clear that the token is simply the email address and the vit is simply a date.
This matters because it means the link carries no secret. A secret would be something only the server knows, such as a long random string. Here the link carries facts about the account that the researcher could already guess or find out.
Step 3: work out what the date means
Digging further, the researcher found that the vit timestamp is the expiry date of the reset link. In this case it was two days ahead of the moment the user clicked the reset password option.
An expiry date is the point after which a link should stop working. It exists so that an old email sitting in an inbox cannot be used months later. Here the expiry was not stored on the server; it was written into the link itself. The expiry date was written into the link itself rather than stored on the server.
Step 4: find a victim account
The researcher then needed a real account to target. By user enumeration on the same page, they found one valid user account. User enumeration means testing whether an account exists, usually by noticing that the site answers differently for a real email address than for a made-up one. For example, a site might say "we have sent you an email" for a real address and "no such account" for a fake one. That difference lets an attacker build a list of real users.
The victim email address used in the report is [redacted].
Step 5: build the forged values
Next the researcher generated a forgot password link for the victim account, and then set about finding the right reset password link for that victim. The plan was to take the structure of their own link and swap in the victim's details. They replaced the email address with the victim's and encoded it to base64, and kept the timestamp value two days ahead of the current date:
Victim mail id — [redacted]
Base64 encoded value (Parameter = token) — dmFydW4wOTgxMUBnbWFpbC5jb20=
Timestamp value (Parameter = vit) — MjAxNi8xMC8yNQ==
Line by line:
Victim mail id — [redacted]is the address the researcher wants to take over.Base64 encoded value (Parameter = token) — dmFydW4wOTgxMUBnbWFpbC5jb20=is that same address converted to base64. This is what will be placed in thetokenparameter. Because base64 is reversible and needs no key, the researcher could produce this value themselves without any help from the server.Timestamp value (Parameter = vit) — MjAxNi8xMC8yNQ==is the base64 of the date2016/10/25, the same value seen in the original link. It is placed in thevitparameter so the link appears to be within its expiry window.
At this point two of the three parameters were under the researcher's control. The link still needed the victim's account number.
Step 6: brute force the account number
The remaining piece was the id associated with the victim's email address. The report says id is a six digit code, so the researcher tried brute forcing it. Brute forcing means trying many possibilities one after another until the right one is found, like working through every combination on a bicycle lock. With six digits there are a million possible numbers, which is a lot, but a computer can send requests far faster than a person can type.
The report notes that no rate limiting was set. Rate limiting is a cap on how many requests a site will accept from one source in a given time, for example 10 per minute. Without it, a script can send thousands of guesses and the site answers every one. With it, guessing a million values becomes impractical.
After a while the researcher found the right id for the victim's email address: id=254346. The report is honest that this part is time consuming.
Step 7: put the forged link together
The tampered URL looks like this:
http://www._________.com/account/resetpassword/?id=254346&[redacted]&vit=MjAxNi8xMC8yNQ==
Line by line:
http://www._________.com/account/resetpassword/is the same reset page as before.id=254346is the victim's account number, found by brute force.- `[redacted] is the victim's email address in base64, made by the researcher.
vit=MjAxNi8xMC8yNQ==is the expiry date in base64, also made by the researcher.
Every value in this link was either known, guessed or generated by the attacker. The report does not describe what the server checked.
Step 8: open the link and take over the account
The researcher loaded the link in the browser and was presented with a "Set new password" page.
The image shows the page where a new password can be entered, which is the normal page a legitimate user would see after clicking their reset link. Seeing it for an account the researcher did not own was the proof that the forgery worked.
The researcher reset the victim's password and was then able to log in to the victim's account. They had complete access: they could use the wallet money, change the registered mobile number, and do everything else the account allowed.
Why it worked
The reset link was trusted entirely on the basis of values the requester supplies. The account identity (token, a base64 encoding of the email address), the expiry (vit, a base64 encoding of a date) and the account number (id) all came from the link itself. Because the email address and the expiry were only encoded, not signed, anyone who knows a victim's email address can produce a valid-looking token and vit.
Signing means attaching a value computed with a secret key that only the server holds, so that any change to the data makes the signature invalid. It is like a wax seal on a letter: if the letter is altered, the seal no longer matches. Base64 is not a seal; it is just a different way of writing the same words.
The only unknown left was the id, and a six digit numeric identifier with no rate limiting can be brute forced. The report does not describe the server-side validation logic.
What the impact was
An attacker who can enumerate a valid account and brute force its id can reset that user's password and log in as them. In a mobile wallet product, that means full access to the account: spending the wallet money, changing the registered mobile number and anything else the account allows. The attack needs a valid victim email address and the ability to send many requests to find the id, which the absence of rate limiting made practical.
How it was fixed
The report says the vulnerability was reported to the concerned enterprise and patched within two days. A robust fix would be to stop deriving the reset link from client-visible, reversible values: generate a random, single-use token on the server, store it against the account with a server-side expiry, and validate it when the link is submitted, so that neither the email address nor the expiry can be supplied by the requester. Rate limiting on the reset endpoint and on any identifier lookup would also remove the brute force path.
How to test for the same thing
These are checks you can try on systems you are allowed to test, such as your own accounts on a bug bounty programme that permits it. Never test on a site without permission.
- Decode every parameter in a reset link. If any of them is base64 of an email address, a user id or a date, try changing it and see whether the server accepts the modified link. A positive result is a "Set new password" page for an account you do not control.
- Check whether the expiry parameter is client supplied. Set it far in the future and see whether an old link still works. A positive result is a link that remains valid past its intended lifetime.
- Look for numeric identifiers in reset links and test whether they can be enumerated. A positive result is a sequence of ids that map to different accounts without any throttling.
- Compare the reset link sent to two of your own accounts. If the only differences are the email address and the id, the link is probably not signed, and the same tampering may work.
- Test whether the reset endpoint checks that the token was issued for the same account as the id. A positive result is a link that combines one account's token with another account's id and is still accepted.
Glossary
- Account takeover: gaining control of someone else's account, usually by obtaining their login credentials or resetting their password.
- Base64: a way of writing data using letters, digits and a few symbols. It is reversible by anyone and is not encryption.
- Brute force: trying many possible values one after another until the correct one is found.
- Bug bounty: a programme where a company pays researchers for reporting security flaws responsibly.
- Client: the browser or app on the user's side, as opposed to the server.
- Encode: to convert data into another format, such as base64, without hiding it.
- Expiry date: the time after which a link or token should stop being accepted.
- Forgot password / reset password flow: the feature that lets a user who has lost their password set a new one, usually via an emailed link.
- Identifier (id): a number or string that uniquely names a record, such as a user account.
- Logical flaw: a weakness in how a feature is designed or how its steps are checked, rather than a bug in a single line of code.
- Mobile wallet: an app or service that holds money and lets you pay from your phone.
- Parameter: a named value attached to a URL after the
?, such asid=254346. - Patch: a change made to software to fix a flaw.
- Rate limiting: a cap on how many requests a server will accept in a period of time, used to slow down guessing.
- Root cause: the underlying reason a flaw exists, as opposed to its visible symptom.
- Server: the computer that runs the website and holds the real records, as opposed to the user's browser.
- Signature (signing): a value computed with a secret key so that any change to the data can be detected.
- Time stamp: a recorded date and time.
- Token: in this report, a value in the reset link that stands for the user's identity. In general, a piece of data used to prove or carry identity.
- User enumeration: discovering which accounts exist by observing differences in how a site responds.
- Vulnerability: a weakness that an attacker can use to do something the system should not allow.