Skip to content
Account takeover Disclosed report Beginner

Bruteforcing password reset tokens, could lead to account takeover

The password reset endpoint accepted unlimited attempts and returned a distinct error when a reset token was wrong, so an attacker could repeatedly guess tokens. If a token were guessed, the attacker could set a new password and take over the account.

003random Follow

Originally disclosed on HackerOne

Bounty$50 Medium View original
  • Fixed in 8 hours
  • Paid in 8 hours
  • Disclosed after 42 days

Hey Instacart security team,

###Description When resetting a new password on https://shoppers.instacart.com/password you will receive an email with a reset link. when clicking on this link. you go to this page: https://shoppers.instacart.com/password/edit?reset_password_token=Your_Token

when entering a new password in the 2 input boxes on the page and clicking on "change my password" a post will be send to https://shoppers.instacart.com/password. if the token is correct, the password will be changed. but if the token is incorrect, the response will contain "Reset password token is invalid".

Because there is no rate limit in place, this token can easily be brute forced.

###poc this is the request that is used:

POST /password HTTP/1.1 Host: shoppers.instacart.com User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Content-Type: application/x-www-form-urlencoded Content-Length: 274 Referer: https://shoppers.instacart.com/password/edit?reset_password_token=The_Reset_Token Cookie: My_cookies DNT: 1 Connection: close Upgrade-Insecure-Requests: 1

utf8=%E2%9C%93&_method=put&authenticity_token=fSk65PV8vJ0RddbWWQsRP5VrbNIVqHjT%2Fgx6b8BlrOKIQirOlPSZ%2BnnbPUtPR8dB3hkMTLcky0J0P01qoysScQ%3D%3D&driver%5Breset_password_token%5D=The_Reset_Token&driver%5Bpassword%5D=New_password&driver%5Bpassword_confirmation%5D=New_password&commit=Change+my+password

###fix to fix this issue, you could implement an timeout after a number of requests in a period of time. just like it is implemented here: https://www.instacart.com/accounts/password this returns "429 Too Many Requests" when making multiple requests in a short period of time.

also making the token more random by giving it a random number of characters instead of 20 characters will also help. there is also an option to include the email as parameter.

If you have questions, please don't hesitate to ask them. i will be happy to answer them ;)

The original report as published on HackerOne, by 003random. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Instacart runs a separate web application for its shoppers at https://shoppers.instacart.com. That application has a password reset flow. A shopper who has forgotten their password requests a reset and receives an email containing a reset link. Following the link opens a page where a new password can be entered:

Text
https://shoppers.instacart.com/password/edit?reset_password_token=Your_Token

The page contains two input boxes, one for the new password and one for its confirmation, and a button labelled "change my password". Submitting the form sends the new password together with the reset token to the server, and if the token is valid the password is changed.

Setup

The report describes the flow from the point of view of a user who has requested a password reset and holds a reset link. The proof of concept is a captured HTTP request that can be replayed with a modified token. No special accounts, roles or software versions are mentioned beyond the browser identified in the request's User-Agent header.

Finding it

The researcher looked at what happens when the reset form is submitted. The form posts to https://shoppers.instacart.com/password. The server's behaviour distinguishes the two outcomes clearly: if the token is correct the password is changed, and if the token is incorrect the response contains the string Reset password token is invalid.

That difference is what makes guessing practical. Each attempt produces an unambiguous signal about whether the guessed token was right, and the researcher observed that there is no rate limit in place on this endpoint. Without a limit on how many submissions are accepted in a period of time, the token space can be walked through at whatever speed the server will answer.

Exploitation

Step 1: Capture the reset submission

Request a password reset, follow the emailed link, fill in the two password fields and submit the form through an intercepting proxy. The captured request looks like this:

HTTP
POST /password HTTP/1.1
Host: shoppers.instacart.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 274
Referer: https://shoppers.instacart.com/password/edit?reset_password_token=The_Reset_Token
Cookie: My_cookies
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1

utf8=%E2%9C%93&_method=put&authenticity_token=[redacted]%2Fgx6b8BlrOKIQirOlPSZ%[redacted]%3D%3D&driver%5Breset_password_token%5D=The_Reset_Token&driver%5Bpassword%5D=New_password&driver%5Bpassword_confirmation%5D=New_password&commit=Change+my+password

The body is a form submission. The parts that matter for the attack are:

  • _method=put, which overrides the HTTP verb so the request is treated as an update.
  • authenticity_token, the CSRF token tied to the session identified by the Cookie header.
  • driver[reset_password_token], the value being guessed.
  • driver[password] and driver[password_confirmation], the new password to set if the guess is correct.
  • commit=Change+my+password, the submit button value.

Step 2: Replay with a guessed token

Keep the session cookie and the CSRF token from the captured request, replace driver[reset_password_token] with a guess, and send the request again. The researcher's description of the two possible outcomes is:

  • Correct token: the password is changed to the value supplied in driver[password].
  • Incorrect token: the response contains Reset password token is invalid.

Because the invalid case is reported explicitly in the response body, a script can tell a miss from a hit without any ambiguity, and can keep going until it sees something other than the invalid message.

Step 3: Repeat without throttling

The researcher states that no rate limit is in place on this endpoint, so the replay in step 2 can be repeated as many times as needed. The report does not give a measured request rate, a number of attempts, or a time to exhaust the token space; the claim is simply that the absence of a limit makes brute forcing feasible.

Root cause

The reset submission endpoint accepts an unlimited number of attempts and answers each one with a response that reveals whether the token was valid. The token is the only secret protecting the reset, so the security of the flow rests entirely on the token being hard to guess and on attempts being limited. The report notes that the token is 20 characters long and suggests making it more random by giving it a random number of characters instead.

The CSRF token does not defend against this. It is bound to the attacker's own session and can be carried over from the captured request, so it only proves that the request came from a browser holding that session, not that the person sending it owns the account being reset.

Impact

If a reset token can be guessed within the lifetime of the token, an attacker can set a new password on the targeted account and take it over. The report frames this as "could lead to account takeover". The report does not state the token's lifetime or the size of the token space beyond the 20-character length, so the practical work factor is not quantified.

Fix

The researcher proposed three measures:

  1. Implement a timeout after a number of requests in a period of time, the same way it is already implemented on https://www.instacart.com/accounts/password, which returns 429 Too Many Requests when multiple requests are made in a short period of time.
  2. Make the token more random by giving it a random number of characters instead of 20 characters.
  3. Optionally include the email as a parameter.

Variants to test

  • Password reset submission endpoints on other subdomains or applications of the same organisation. A positive result is that repeated submissions with wrong tokens are all processed and each returns a distinguishable invalid-token message, with no 429 and no lockout.
  • Account confirmation, email change and invitation acceptance flows that carry a token in a form field or URL. A positive result is the same pattern: an explicit invalid-token response and no limit on attempts.
  • Flows where the token is submitted in the URL rather than the body. A positive result is that the token can be varied in the query string while the rest of the request stays fixed, and the response still tells you whether it was right.
  • Comparing the reset endpoint against other authentication endpoints on the same target. A positive result is that login or another reset path returns 429 Too Many Requests under rapid requests while the reset submission endpoint does not, which shows the protection exists elsewhere but was not applied here.
  • Token length and alphabet. A positive result is a token that is short, drawn from a small character set, or has a predictable structure, which reduces the number of guesses needed.

Hunting notes

This kind of bug hides in the less prominent authentication flows: password reset, password change, email confirmation, account unlock and invitation acceptance. They are often implemented on separate hostnames from the main product, as here with shoppers.instacart.com, and the protections added to the main login page are not always carried across.

During recon, the useful signals are separate authentication hostnames, Rails-style forms with _method and authenticity_token fields, and reset links that carry a token as a query parameter or hidden field. Once a reset request is captured, the two things to check are whether the response distinguishes a valid token from an invalid one, and whether repeated submissions are throttled. A 429 on one endpoint and its absence on a sibling endpoint is a strong indication that the gap is real.

The report showed the exact request that can be replayed, the exact string that marks a failed guess, and the absence of any limit, which together argue that the token can be brute forced.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

Instacart runs a separate website for the people who shop and deliver orders, at https://shoppers.instacart.com. That website has a "forgot my password" feature. You ask for a reset, an email arrives with a link, you click the link, type a new password twice, press a button, and your password is changed.

To make sure only the real account owner can do this, the link carries a secret code called a reset token. The server checks the code before changing anything. The researcher found that the server will answer an unlimited number of guesses at that code, and that it clearly says when a guess is wrong. That combination means someone could sit there guessing codes until one works, then set a new password on the victim's account and take it over. The report calls this "could lead to account takeover".

The product and the feature

Instacart is a grocery delivery service. Its shoppers are the people who pick and deliver orders, and they use their own web application, separate from the customer-facing site. That application has its own login and its own password reset flow.

A password reset flow works like this in general: you prove you control the email address on the account by receiving a message there, and the message contains a one-time secret. Whoever holds that secret is allowed to set a new password. The secret is the token. If somebody else can guess the token, the email step stops protecting anything.

The reset link in this report looks like this:

Text
https://shoppers.instacart.com/password/edit?reset_password_token=Your_Token

Everything before the ? is the address of the page. Everything after it is a query string, a list of name and value pairs the browser sends along with the page request. Here the name is reset_password_token and the value is Your_Token, the secret. The page shows two input boxes, one for the new password and one to type it again for confirmation, plus a button labelled "change my password".

What the researcher needed before starting

That is the whole point: the token is supposed to stand in for the email check, so if the token can be guessed the email check is bypassed.

A proxy is a program that sits between your browser and the website and lets you look at, pause and edit the requests going out and the responses coming back. Think of it as a mail intercept desk: the letter still gets delivered, but you get to read it and rewrite it first. The report mentions no special accounts, roles or software versions beyond the browser named in the request's User-Agent header, which is simply the line where a browser introduces itself to the server.

Finding it

The researcher watched what the browser sends when the reset form is submitted. The form posts to https://shoppers.instacart.com/password. "Posts" means the browser sends the form contents to the server as the body of an HTTP request, rather than just asking for a page.

The important observation is that the server answers the two possible cases differently. If the token is correct, the password is changed. If the token is incorrect, the response contains the text Reset password token is invalid. That sentence is a signal: it tells the sender, unambiguously, that the guess was wrong. A wrong guess that produces a clear "wrong" message is what makes guessing practical, because a script can tell a miss from a hit without having to interpret anything.

The second observation is that there is no rate limit on this endpoint. A rate limit is a cap on how many requests a server will accept from one source in a period of time. Without one, the guesses can be sent as fast as the server will answer them.

Step 1: Capture the reset submission

The researcher requested a password reset, followed the emailed link, filled in the two password fields and submitted the form through the proxy. The captured request looks like this:

HTTP
POST /password HTTP/1.1
Host: shoppers.instacart.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 274
Referer: https://shoppers.instacart.com/password/edit?reset_password_token=The_Reset_Token
Cookie: My_cookies
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1

utf8=%E2%9C%93&_method=put&authenticity_token=[redacted]%2Fgx6b8BlrOKIQirOlPSZ%[redacted]%3D%3D&driver%5Breset_password_token%5D=The_Reset_Token&driver%5Bpassword%5D=New_password&driver%5Bpassword_confirmation%5D=New_password&commit=Change+my+password

Line by line, in plain words:

  • POST /password HTTP/1.1 is the first line of the request. POST is the method, the verb that says "I am sending data for you to act on". /password is the path on the server being addressed. HTTP/1.1 is the version of the protocol being spoken.
  • Host: shoppers.instacart.com names the website the request is for. One server can host many sites, so the request has to say which one.
  • User-Agent: ... identifies the browser and operating system that made the request. Here it says Firefox 55 on 64-bit Windows.
  • Accept: ... lists the kinds of response the browser is willing to receive, in order of preference: HTML pages, XHTML, XML, then anything else.
  • Accept-Language: en-US,en;q=0.5 says the browser prefers US English, with a lower preference for generic English.
  • Content-Type: application/x-www-form-urlencoded says how the body is formatted. This is the classic web form format: name equals value pairs joined by &, with special characters percent-encoded.
  • Content-Length: 274 is the size of the body in bytes, so the server knows where the body ends.
  • Referer: https://shoppers.instacart.com/password/edit?reset_password_token=The_Reset_Token tells the server which page the request came from. Here it is the reset page, with the token in the address.
  • Cookie: My_cookies carries the browser's cookies. A cookie is a small piece of data a site stores in your browser and gets back on every request, which is how a site recognises that the requests belong to the same logged-in session. The value is shown as a placeholder.
  • DNT: 1 is the Do Not Track preference, a request not to be tracked.
  • Connection: close asks the server to close the network connection after this response instead of keeping it open for reuse.
  • Upgrade-Insecure-Requests: 1 tells the server the browser would prefer an encrypted HTTPS version of the page if one exists.
  • A blank line separates the headers from the body. Everything after it is the body.

The body is one long line of form fields joined by &. Decoded, the fields are:

  • utf8=%E2%9C%93, which is the percent-encoded form of a checkmark character, a marker some web frameworks add to say the form was submitted as UTF-8 text.
  • _method=put, which overrides the HTTP verb. The request physically arrives as a POST, but the application is told to treat it as a PUT, the verb normally used for updating an existing thing. Browsers can only send GET and POST from a plain form, so frameworks use this hidden field to express other verbs.
  • authenticity_token=..., a long random-looking value. This is a CSRF token. CSRF stands for cross-site request forgery, an attack where another website quietly makes your browser send a request to a site you are logged into. The token is a value the server gave to your session and expects back, so a request forged by another site, which does not know the value, is rejected. It is tied to the session identified by the Cookie header.
  • driver%5Breset_password_token%5D=The_Reset_Token. The %5B and %5D are percent-encoded square brackets, so the field name is really driver[reset_password_token]. The brackets are a naming convention used by web frameworks to group fields under one object, here an object called driver. This is the value being guessed.
  • driver%5Bpassword%5D=New_password is the new password to set if the guess is correct.
  • driver%5Bpassword_confirmation%5D=New_password repeats it, so a typo in the first box does not lock the user out.
  • commit=Change+my+password is the value of the submit button. In this format a + stands for a space, so it reads "Change my password".

Step 2: Send it again with a guessed token

The next step is to keep the session cookie and the CSRF token from the captured request, replace driver[reset_password_token] with a guess, and send the request again. The researcher describes two possible outcomes:

  • If the token is correct, the password is changed to the value supplied in driver[password].
  • If the token is incorrect, the response contains Reset password token is invalid.

Because the failure case is stated explicitly in the response, a script can tell a miss from a hit without any ambiguity, and can keep going until it sees something other than the invalid message. This is the core of the bug: the server is answering the question "is this the right token?" as many times as anyone cares to ask.

Step 3: Repeat it, with nothing slowing it down

The researcher states that no rate limit is in place on this endpoint, so the replay can be repeated as many times as needed. The report gives no measured request rate, no number of attempts and no time to work through the possible tokens. The claim is simply that the absence of a limit makes brute forcing feasible. Brute forcing means trying possibilities one after another until one works, like working through every combination on a padlock instead of picking it.

Why it works

The reset submission endpoint accepts an unlimited number of attempts and answers each one in a way that reveals whether the token was valid. The token is the only secret protecting the reset, so the safety of the whole flow rests on two things: the token being hard to guess, and attempts being limited. The report notes that the token is 20 characters long and suggests making it more random by giving it a random number of characters instead. Making the token more random, for example by giving it a random number of characters rather than a fixed 20, would help.

The CSRF token does not defend against this. It is bound to the attacker's own session and can be carried over from the captured request, so it only proves the request came from a browser holding that session. It says nothing about whether the person sending it owns the account being reset. Think of it as a ticket that proves you entered the building, not a ticket that proves you own the flat you are trying to open.

Impact

If a reset token can be guessed while it is still valid, an attacker can set a new password on the targeted account and take it over. The report frames this as "could lead to account takeover". The report does not state how long a token lives or how large the space of possible tokens is beyond the 20-character length, so the practical effort is not quantified.

The fix the researcher proposed

The researcher proposed three measures:

  1. Implement a timeout after a number of requests in a period of time, the same way it is already implemented on https://www.instacart.com/accounts/password, which returns 429 Too Many Requests when multiple requests are made in a short period of time. 429 Too Many Requests is a standard HTTP status code meaning "you are sending too much, slow down".
  2. Make the token more random by giving it a random number of characters instead of 20 characters.
  3. Optionally include the email as a parameter.

The report does not say which of these, if any, was applied.

Other places to look for the same pattern

  • Password reset submission endpoints on other subdomains or applications of the same organisation. A positive result is that repeated submissions with wrong tokens are all processed and each returns a distinguishable invalid-token message, with no 429 and no lockout.
  • Account confirmation, email change and invitation acceptance flows that carry a token in a form field or URL. A positive result is the same pattern: an explicit invalid-token response and no limit on attempts.
  • Flows where the token is submitted in the URL rather than the body. A positive result is that the token can be varied in the query string while the rest of the request stays fixed, and the response still tells you whether it was right.
  • Comparing the reset endpoint against other authentication endpoints on the same target. A positive result is that login or another reset path returns 429 Too Many Requests under rapid requests while the reset submission endpoint does not, which shows the protection exists elsewhere but was not applied here.
  • Token length and alphabet. A positive result is a token that is short, drawn from a small character set, or has a predictable structure, which reduces the number of guesses needed.

Notes for anyone hunting this kind of bug

This kind of bug hides in the less prominent authentication flows: password reset, password change, email confirmation, account unlock and invitation acceptance. They are often implemented on separate hostnames from the main product, as here with shoppers.instacart.com, and the protections added to the main login page are not always carried across.

During recon, the useful signals are separate authentication hostnames, Rails-style forms with _method and authenticity_token fields, and reset links that carry a token as a query parameter or hidden field. Once a reset request is captured, the two things to check are whether the response distinguishes a valid token from an invalid one, and whether repeated submissions are throttled. A 429 on one endpoint and its absence on a sibling endpoint is a strong indication that the gap is real.

The report showed the exact request, the exact string that marks a failed guess, and the absence of any limit. Together those argue that the token can be brute forced.

Glossary

  • Account takeover: gaining control of someone else's account, usually by changing its password or login details.
  • Authentication: proving who you are, for example by logging in with a password.
  • Brute forcing: trying possibilities one after another until one works, instead of finding a cleverer way in.
  • Cookie: a small piece of data a site stores in your browser and receives back on each request, used to recognise your session.
  • CSRF (cross-site request forgery): an attack where another website makes your browser send a request to a site you are logged into.
  • CSRF token / authenticity_token: a random value the server gives your session and expects back, so requests forged by other sites are rejected.
  • Endpoint: a specific address on a server that accepts requests and does something, such as /password.
  • Form / form submission: the input boxes and button on a page, and the act of sending their contents to the server.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • HTTP method (verb): the word at the start of a request saying what kind of action it is, such as GET to fetch or POST to send data.
  • Header: a name and value line at the top of a request or response carrying information about it.
  • Host: the website name a request is addressed to.
  • Percent-encoding: writing special characters as % followed by a code, so they can travel safely inside a URL or form body.
  • POST: the HTTP method used to send data to the server, typically form contents.
  • Proxy (intercepting proxy): a program between your browser and a website that lets you view, pause and edit requests and responses.
  • Query string: the part of a URL after the ?, made of name and value pairs.
  • Rate limit: a cap on how many requests a server accepts from one source in a period of time.
  • Recon: the information-gathering phase of security testing, looking at what a target exposes before trying anything.
  • Reset token: the secret code in a password reset link that proves the holder is allowed to set a new password.
  • Response body: the content of a server's reply, as opposed to its headers.
  • Session: the server's record of your ongoing interaction, usually tied to a cookie, so it knows successive requests are yours.
  • Status code: a three-digit number in a response saying broadly what happened, such as 429 Too Many Requests.
  • Subdomain: a named part of a larger domain, such as shoppers.instacart.com under instacart.com.
  • Token: a value that stands in for a secret or a permission, hard to guess and checked by the server.
  • User-Agent: the header in which a browser identifies itself and its operating system.
  • UTF-8: a way of encoding text characters as bytes, used for most web content.
  • Vulnerability class: a category of security weakness, here improper restriction of authentication attempts, meaning too many tries are allowed.

More by 003random

View all

3 more disclosed reports, best first.

More from Instacart

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.