(Possible) staff account takeover via reset token bruteforce at helpdesk.bistudio.com
The password reset flow for staff accounts used a six-digit SMS token that could be brute-forced because the verification endpoint had no rate limiting. An attacker who knew a staff username could potentially reset that account's password and take it over.
- Triaged in 22 hours
- Fixed in 40 hours
- Paid in 23 hours
- Disclosed after 6 months
As stated in a brief exchange with @rvn in my other report ##312433, I might have found a logic flaw in the way https://helpdesk.bistudio.com handles the reset flow and tokens. I've asked if it was possible to obtain a test account, but I fully understand that it's something that cannot be done; as such I'll submit a "blind" report based on my black-box analysis and wait for your team to verify it. Also note that this flaw seems to also be present in the "Set out of office email response" flow, albeit less critical.
Flow
The SYSTEM PASSWORD RESET flow is a 3-steps process:
- the staff member requests a SMS TOKEN using the first form
- the 6-digits SMS TOKEN is used in the second form
- the staff member can now set a new SYSTEM PASSWORD in the third form
Analysis and logic
I was able to go through the process even after providing non-existing usernames and tokens by intercepting the response in BurpSuite and changing the status code from 400 Bad Request to 200 OK and the body from "status":"error" to "status":"ok", allowing the AngularJS applet to follow through.
I then noticed that the API endpoint for verifying the SMS TOKEN and changing the password where open and free of rate-limiting measures, allowing for a quick bruteforce of the 000000-999999 space.
It should be therefore possible to perform an account takeover on any staff member, provided the SMS TOKEN really is a 6-digits code
Theoretical POC
- adversary starts the SYSTEM PASSWORD RESET process for the target victim using a POST request to
/api/system/verification-codes(ie:{"username":"admin"}). The backend generates a SMS TOKEN and sends it to the victim's phone. Meanwhile, - adversary obtains the securityCode value for the victim by bruteforcing
/api/system/verification-codes/[0-9]{6}before the victim can cancel the flow (threat scenario places the attack durin night time) - adversary can now reset the SYSTEM PASSWORD by sending the complete POST request to
/api/system/email-account/password(ie:{"password":"<NEW PASSWORD>","code":"<BRUTEFORCED SMS TOKEN>","securityCode":"<RETRIEVED SECURITY CODE>"})
Step #1 offers a ReCAPTCHA anti-CSRF token but it's not used anywhere in the flow, making the attack possible
Step #2 is really a matter of resources. Being free of rate-limiting, the API endpoint will be quickly queried for all the possible token combinations in a matter of minutes using a multithreaded approach (ie: using BurpSuite's Intruder).
Albeit theoretical, the logic behind the threat scenario seems plausible. It might be worth investigating.
Recommended actions
Properly implement the ReCAPTCHA and a strict ratelimiting on the API endpoints
Impact
An adversary might be able to takeover staff accounts, or set their "out of office" email replies.
Context
Bohemia Interactive runs a helpdesk at https://helpdesk.bistudio.com. The report concerns the staff-facing password reset flow on that host, and a second, related flow for setting an "out of office" email response. The researcher describes the password reset as a three-step process:
- the staff member requests an SMS TOKEN using the first form;
- the 6-digit SMS TOKEN is used in the second form;
- the staff member can now set a new SYSTEM PASSWORD in the third form.
The front end is an AngularJS applet that talks to a JSON API. The report was filed blind: the researcher had no test account and asked whether one could be provided, acknowledging that it could not. The analysis is therefore black-box, and the researcher explicitly asks the team to verify it.
Setup
The only tool named in the report is Burp Suite, used both to intercept responses and, in the theoretical attack, to run a multithreaded brute force with Intruder. No account, role, version or credential is described, because none was available to the researcher. The precondition for the attack is simply that a target staff member exists on the helpdesk and that the SMS TOKEN really is a 6-digit code, a point the researcher hedges on.
Finding it
The researcher had already discussed the reset flow with @rvn in a separate report, ##312433, and suspected a logic flaw in how the helpdesk handles the reset flow and its tokens. The same flaw appeared to be present in the "Set out of office email response" flow, which the researcher rates as less critical.
The first observation was that the client-side flow could be walked through with non-existing usernames and tokens. By intercepting the response in Burp Suite and changing the status code from 400 Bad Request to 200 OK, and the body from "status":"error" to "status":"ok", the AngularJS applet would follow through to the next step. In other words, editing the response let the AngularJS applet continue to the next step.
The second observation was that the API endpoints for verifying the SMS TOKEN and changing the password were open and free of rate-limiting measures. That makes a brute force of the 000000-999999 space practical, and, if the token really is a 6-digit code, an account takeover on any staff member becomes possible.
Exploitation
The report gives a theoretical proof of concept in three steps. The threat scenario places the attack during night time, before the victim can cancel the flow.
Step 1: start the reset for the victim
The adversary starts the SYSTEM PASSWORD RESET process for the target victim with a POST request to /api/system/verification-codes:
The backend generates an SMS TOKEN and sends it to the victim's phone. The first form offers a ReCAPTCHA anti-CSRF token, but according to the report it is not used anywhere in the flow, so it does not prevent the adversary from driving this request.
Step 2: brute force the security code
While the victim's phone receives the SMS, the adversary brute forces /api/system/verification-codes/[0-9]{6} to obtain the securityCode value for the victim. The endpoint is free of rate limiting, so the whole space can be queried quickly with a multithreaded approach, for example Burp Suite's Intruder. The researcher frames this step as a matter of resources: the endpoint will be queried for all possible token combinations in a matter of minutes.
Step 3: reset the password
With the security code in hand, the adversary resets the SYSTEM PASSWORD by sending the complete POST request to /api/system/email-account/password:
The body carries the new password, the brute-forced SMS TOKEN and the retrieved security code. The researcher notes that the logic behind the threat scenario seems plausible, while calling the proof of concept theoretical, and suggests it is worth investigating.
Root cause
The report points at two design mistakes. First, flipping 400 Bad Request to 200 OK and "status":"error" to "status":"ok" in the intercepted response lets the AngularJS applet continue. Second, the endpoints that verify the SMS TOKEN and change the password have no rate limiting, so a 6-digit space is small enough to exhaust. The ReCAPTCHA offered on the first form is, per the report, not used anywhere in the flow, so it provides no protection. Whether the server would accept a correct token for a session that never legitimately passed the earlier steps is not established in the report; the researcher asks the team to verify the whole chain.
Impact
If the assumptions hold, an adversary might be able to take over staff accounts, or set their "out of office" email replies. The report hedges throughout: the attack is theoretical, it depends on the SMS TOKEN really being a 6-digit code, and it depends on the victim not cancelling the flow before the brute force finishes, which is why the scenario is placed at night. The out of office variant is described as less critical than the password reset.
Fix
The recommended actions are to properly implement the ReCAPTCHA and to apply strict rate limiting on the API endpoints. The report does not describe any fix that was actually deployed.
Variants to test
- Client-trusted status codes. Intercept responses on any multi-step flow (password reset, MFA enrolment, email change) and flip an error status and body to a success one. A positive result is the client advancing to the next step and the server accepting the final request without the earlier step having genuinely succeeded.
- Unthrottled verification endpoints. Send a few hundred requests to the token verification endpoint and watch for any lockout, delay or CAPTCHA. A positive result is a steady response rate across the whole code space.
- Unused anti-CSRF tokens. Submit the first form without the ReCAPTCHA token, or with a stale one, and see whether the backend still generates and sends the code. A positive result is a code being issued regardless.
- Short numeric tokens. Where a flow uses a 6-digit code, estimate the request rate the endpoint tolerates and compare it with the size of the space. A positive result is the space being exhaustible within the lifetime of the token.
- Parallel flows. Check whether the same verification endpoint backs other features, such as out of office replies, and whether those inherit the same lack of rate limiting.
What happened, in plain words
Bohemia Interactive runs a helpdesk website at https://helpdesk.bistudio.com. Staff members use it to manage their accounts and their email settings. One of the things they can do there is reset their password when they forget it.
A security researcher looked at how that password reset works and found two problems. First, the web page that walks the staff member through the reset decides whether each step succeeded by reading a message from the server, and that message can be edited in transit. Second, the server endpoints that check the short code sent by SMS and that set the new password had no limit on how many times they could be called. A short code made of six digits has only one million possible values, and a computer can try a million things quickly. Put together, the researcher argued that an attacker could reset a staff member's password without ever seeing the SMS.
The researcher had no test account, so the whole report is a reasoned analysis rather than a demonstrated attack. The researcher says so openly and asks the Bohemia team to verify it. The same weakness appeared to affect a second feature, the "Set out of office email response" flow, which the researcher rates as less serious.
Background you need first
A few everyday ideas make the rest of this report easy to follow.
A website is two programs talking. Your browser shows you pages and forms. Behind it, a server does the real work: checking passwords, storing data, sending SMS messages. The browser asks, the server answers. The conversation happens over the network, and the messages are called requests (browser to server) and responses (server to browser).
An API is the server's serving hatch. Think of a restaurant. You do not walk into the kitchen; you order through a hatch, and the kitchen hands you a plate. An API (Application Programming Interface) is that hatch for software: a fixed set of addresses where the browser can send requests and get structured answers back. Each address is called an endpoint. In this report the endpoints look like paths such as /api/system/verification-codes. The answer is usually in JSON, a simple text format that looks like {"name":"value"}, easy for a program to read.
A token is a temporary pass. Think of a cloakroom ticket: you hand in your coat, you get a numbered ticket, and the ticket proves you may collect the coat. It is not your identity, it is just proof for that one transaction, and it is meant to be hard to guess. In this report there are two kinds of token. The SMS TOKEN is the six-digit code sent to the staff member's phone. The securityCode is a value the server hands back during the reset process, which the final step needs.
Brute force means trying everything. If a lock has a million combinations and nothing stops you from turning the dial as fast as you like, you can simply try them all. That is a brute force attack. It only works when the number of possibilities is small and the system lets you try quickly. Six digits means one million possibilities, from 000000 to 999999.
Rate limiting is a bouncer counting attempts. A site applies rate limiting when it refuses to answer more than a certain number of requests from the same place in a given time, or when it starts adding delays or lockouts. Without it, an attacker can hammer an endpoint as fast as the network allows.
Burp Suite is a tool that sits in the middle. Normally your browser talks straight to the server. Burp Suite is a program you can configure your browser to go through, so every request and every response passes through it and can be read, paused and edited before it continues. It also has a component called Intruder that sends the same request many times with different values filled in, which is exactly what a brute force needs.
AngularJS is a framework for building web pages. It is a library of JavaScript code that helps developers build interactive pages in the browser. The important point here is that the page's behaviour, including moving from one step of a form to the next, is decided by code running in your browser, using the data the server sends back.
ReCAPTCHA is a test meant to prove you are human. You have seen it: tick a box, pick the traffic lights. It is also sometimes used as an anti-CSRF measure. CSRF (Cross-Site Request Forgery) is when a malicious site tricks your browser into sending a request to another site where you are logged in. A token tied to the form is supposed to make such forged requests fail. If the token is issued but never checked, it protects nothing.
Account takeover is exactly what it sounds like: someone else gains control of your account, here by setting a new password so that the real owner is locked out.
The feature under examination
The report concerns the staff-facing password reset on the helpdesk host, plus a related flow for setting an "out of office" email reply. The password reset is described as a three-step process:
- the staff member requests an SMS TOKEN using the first form;
- the 6-digit SMS TOKEN is used in the second form;
- the staff member can now set a new SYSTEM PASSWORD in the third form.
In plain terms: you say who you are, the site texts you a code, you type the code in, and then you choose a new password. Each step is a separate request to the server, and the browser page moves you from one to the next.
How the researcher worked
The only tool named in the report is Burp Suite, used in two ways: to intercept responses and edit them, and, in the theoretical attack, to run a multithreaded brute force with Intruder. "Multithreaded" means sending many requests at the same time rather than one after another, which makes trying a large number of combinations much faster.
No account, role, software version or credential is described, because the researcher had none. The researcher had asked whether a test account could be provided and understood that it could not, so the analysis is black-box: it is based only on what can be observed from outside, without seeing the server's code. The precondition for the attack is simply that a target staff member exists on the helpdesk and that the SMS TOKEN really is a 6-digit code. The researcher hedges on that last point rather than asserting it.
Finding it
The researcher had already discussed the reset flow with @rvn in a separate report, ##312433, and suspected a logic flaw in how the helpdesk handles the reset flow and its tokens. A logic flaw means the individual pieces work as programmed, but the way they are put together lets someone use them in an order or manner the designer did not intend. The same flaw appeared to be present in the "Set out of office email response" flow, which the researcher rates as less critical.
Observation one: the page believes whatever the server says
The first observation was that the browser-side flow could be walked through even with non-existing usernames and tokens. The researcher intercepted the response in Burp Suite and changed the status code from 400 Bad Request to 200 OK, and the body from "status":"error" to "status":"ok". With those edits in place, the AngularJS applet would follow through to the next step.
Two pieces of vocabulary make this clear. A status code is a three-digit number at the start of every response that summarises what happened: 200 OK means "done, here is your answer", and 400 Bad Request means "I could not accept what you sent". The body is the rest of the response, the actual content, here a small JSON object with a status field.
The point is that the page decided whether a step had succeeded by reading the server's answer, and that answer could be rewritten in transit. The page happily moved on once the response was edited.
Observation two: nothing stops repeated guessing
The second observation was that the API endpoints for verifying the SMS TOKEN and changing the password were open and free of rate-limiting measures. That makes a brute force of the 000000-999999 space practical. If the token really is a 6-digit code, an account takeover on any staff member becomes possible.
The theoretical attack, step by step
The report gives a theoretical proof of concept in three steps. The threat scenario places the attack during night time, before the victim can cancel the flow. That timing matters: the whole attack depends on finishing the guessing before the real staff member notices the SMS and stops the process.
Step 1: start the reset for the victim
The adversary starts the SYSTEM PASSWORD RESET process for the target victim with a POST request to /api/system/verification-codes:
Line by line:
POSTis the type of request. A GET request asks the server to show you something; a POST request asks the server to do something, usually to create or change data. Starting a reset changes state on the server, so it is a POST./api/system/verification-codesis the endpoint, the address of the serving hatch for this action.- The blank line separates the request line from the body.
{"username":"admin"}is the body, in JSON. It says which account the reset is for.adminis the example username used in the report.
Why this step: the adversary needs the server to generate an SMS TOKEN and send it to the victim's phone. The adversary never sees that SMS, but the server now has a valid token in play, and that is what the next step attacks. The first form offers a ReCAPTCHA anti-CSRF token, but according to the report it is not used anywhere in the flow, so it does not prevent the adversary from driving this request.
Step 2: brute force the security code
While the victim's phone receives the SMS, the adversary brute forces /api/system/verification-codes/[0-9]{6} to obtain the securityCode value for the victim.
The notation [0-9]{6} is a pattern, not a literal address. [0-9] means any single digit from 0 to 9, and {6} means exactly six of them. So the endpoint is being called with every six-digit number appended, from 000000 through 999999, one request per possibility.
The endpoint is free of rate limiting, so the whole space can be queried quickly with a multithreaded approach, for example Burp Suite's Intruder. The researcher frames this step as a matter of resources: the endpoint will be queried for all possible token combinations in a matter of minutes. In other words, the only thing standing between the attacker and the code is how many requests they can send, and the answer is "enough".
Why this step: the final step needs the securityCode, and the only way to get it without the victim's phone is to guess it. Because the space is small and nothing slows the guessing down, guessing all of it is feasible.
Step 3: reset the password
With the security code in hand, the adversary resets the SYSTEM PASSWORD by sending the complete POST request to /api/system/email-account/password:
Line by line:
POSTagain, because this request changes the account's password./api/system/email-account/passwordis the endpoint that performs the change.- The body is JSON with three fields.
passwordis the new password the adversary wants to set.codeis the SMS TOKEN that was guessed in step 2.securityCodeis the value retrieved from the server during the guessing. - The angle-bracket placeholders such as
<NEW PASSWORD>are not literal values; they mark where the attacker's own values go.
Why this step: this is the payoff. If the server accepts the request, the account's password is now one the adversary chose, and the real owner can no longer log in.
The researcher notes that the logic behind the threat scenario seems plausible, while calling the proof of concept theoretical, and suggests it is worth investigating.
Why it works
The report points at two design mistakes.
First, the reset flow's success is decided by a response the client can rewrite. Flipping 400 Bad Request to 200 OK and "status":"error" to "status":"ok" lets the AngularJS applet continue, which means the server does not independently bind the steps together. The page relied on the response it received, and that response could be edited.
Second, the endpoints that verify the SMS TOKEN and change the password have no rate limiting, so a 6-digit space is small enough to exhaust. The ReCAPTCHA offered on the first form is, per the report, not used anywhere in the flow, so it provides no protection.
One thing the report does not establish: whether the server would accept a correct token for a session that never legitimately passed the earlier steps. The researcher asks the team to verify the whole chain rather than claiming it was proven.
What an attacker could do with it
If the assumptions hold, an adversary might be able to take over staff accounts, or set their "out of office" email replies. The report hedges throughout: the attack is theoretical, it depends on the SMS TOKEN really being a 6-digit code, and it depends on the victim not cancelling the flow before the brute force finishes, which is why the scenario is placed at night. The out of office variant is described as less critical than the password reset.
The fix
The recommended actions are to properly implement the ReCAPTCHA and to apply strict rate limiting on the API endpoints. In plain terms: actually check the anti-automation token on the server, and put a bouncer on the guessing endpoints so that a million attempts is not possible. The report does not describe any fix that was actually deployed.
Things worth testing elsewhere
These are patterns to look for in other multi-step flows, not claims about this one.
- Client-trusted status codes. Intercept responses on any multi-step flow (password reset, MFA enrolment, email change) and flip an error status and body to a success one. A positive result is the client advancing to the next step and the server accepting the final request without the earlier step having genuinely succeeded.
- Unthrottled verification endpoints. Send a few hundred requests to the token verification endpoint and watch for any lockout, delay or CAPTCHA. A positive result is a steady response rate across the whole code space.
- Unused anti-CSRF tokens. Submit the first form without the ReCAPTCHA token, or with a stale one, and see whether the backend still generates and sends the code. A positive result is a code being issued regardless.
- Short numeric tokens. Where a flow uses a 6-digit code, estimate the request rate the endpoint tolerates and compare it with the size of the space. A positive result is the space being exhaustible within the lifetime of the token.
- Parallel flows. Check whether the same verification endpoint backs other features, such as out of office replies, and whether those inherit the same lack of rate limiting.
Glossary
- Account takeover: an attacker gains control of someone else's account, here by setting a new password so the real owner is locked out.
- AngularJS: a JavaScript framework for building interactive web pages; the page's behaviour, including moving between form steps, runs in the browser.
- API (Application Programming Interface): a fixed set of addresses where software can send requests and receive structured answers, like a serving hatch for programs.
- Black-box analysis: testing a system only from the outside, without seeing its source code or internal design.
- Body: the content of a request or response, as opposed to its status code and headers; here a small JSON object.
- Brute force: trying every possible value of a secret until the right one is found.
- Burp Suite: a tool that sits between browser and server so requests and responses can be read, paused and edited; its Intruder component sends many variations of a request automatically.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into sending a request to another site; anti-CSRF tokens are meant to prevent it.
- Endpoint: a specific address on a server that accepts a particular kind of request, such as
/api/system/verification-codes. - GET: a request type that asks the server to show something, without changing data.
- Intruder: the part of Burp Suite that repeats one request many times with different values filled in, used for brute forcing.
- JSON: a simple text format for structured data, written as
{"name":"value"}pairs, easy for programs to read. - Logic flaw: a weakness in how the pieces of a feature are put together, rather than in a single piece of code; each part works as programmed but the combination can be abused.
- Multithreaded: sending many requests at the same time instead of one after another, which makes large numbers of attempts much faster.
- Out of office email response: an automatic reply set on an email account for when the owner is away.
- POST: a request type that asks the server to do something, usually creating or changing data.
- Proof of concept (POC): a description or demonstration showing that an attack is possible; here it is theoretical, not carried out.
- Rate limiting: restricting how many requests a client may make in a given time, often with delays or lockouts, to stop automated guessing.
- ReCAPTCHA: a test meant to prove a human is present, sometimes also used as an anti-CSRF measure; it only helps if the server actually checks it.
- Request: a message from the browser to the server asking it to do something.
- Response: the server's reply to a request, made of a status code, headers and a body.
- securityCode: in this report, a value the server hands back during the reset process that the final step needs.
- SMS TOKEN: the six-digit code sent to the staff member's phone during the reset.
- Status code: a three-digit number at the start of a response summarising the outcome, such as
200 OK(success) or400 Bad Request(the request could not be accepted). - SYSTEM PASSWORD: the password for the staff member's account on the helpdesk system.
- Token: a temporary value that proves something for one transaction, like a cloakroom ticket; it is meant to be hard to guess.
- Username: the name that identifies an account, such as
adminin the example.