Skip to content
Account takeover Write-up Beginner

Tokopedia Account Takeover Bug Worth 8 Million IDR

The password reset flow accepted a fixed OTP code of 000000 appended to the reset URL, allowing an attacker to reset any account's password without knowing the real one-time code. An attacker could take over a victim's Tokopedia account by supplying a new password.

Mukul Lohar Follow

Published on medium.com

#### Mukul Lohar

Mukul Lohar, on medium.com

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.

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. 4 min read.

Context

Tokopedia ran a bug bounty programme, and this write-up covers an account takeover found in its password reset flow in October 2018. The feature involved is the self-service password reset at accounts.tokopedia.com, which normally works like this: the user enters the email address of the account, chooses email as the verification method, and the application sends a one-time code to that address. The user then supplies the code together with a new password, and the reset completes.

The researcher is Mukul Lohar (@ironfisto). The report was published on 24 December 2018.

Setup

The researcher found the programme through Google dorks and landed on the Tokopedia bug bounty policy on GitHub:

Text
https://github.com/tokopedia/Bug-Bounty

He read the terms and conditions and started hunting. No special tooling, role or privileged access is described: the only precondition is an email address that belongs to a Tokopedia account, which in the report is a disposable mailbox used as the victim account.

Finding it

The researcher states that he found the account takeover within an hour of starting. The report does not describe the reasoning that led him to the reset flow; what it documents is the behaviour of the flow once he walked through it, specifically the URL the browser lands on after choosing email verification.

Exploitation

Step 1: open the reset page

HTTP
https://accounts.tokopedia.com/reset-password

This is the entry point of the password reset flow.

Step 2: submit the victim email and choose email verification

The victim account email used in the report is [redacted]. The researcher typed it into the form, clicked continue, and then selected email as the verification method. The report does not show the request or response for this step.

Step 3: copy the URL from the address bar

After selecting the verification method, the address bar holds a URL of this shape:

The important part is the ld parameter. Its value is the password reset URL. and the email address is carried inside it as the base64 value [redacted] in the e parameter.

Step 4: isolate the password reset URL

The reset URL that starts after ld is:

HTTP
https://accounts.tokopedia.com/resetpassword?e=[redacted]

This is the page that accepts the new password, and it carries the email address in the e parameter.

Step 5: append an OTP code

The researcher added &otpcode=000000 to the end of that URL:

HTTP
https://accounts.tokopedia.com/resetpassword?e=[redacted]&otpcode=000000

Step 6: set a new password

He navigated to the modified URL, entered a password of his choice, and the victim's Tokopedia account was taken over.

A video proof of concept is referenced in the report but is not reproduced here.

Root cause

Adding an otpcode parameter to the reset URL allowed the password change to complete without a code that was issued for the account. The OTP check that should gate the password change did not stop a code that was never issued for the account, here 000000. The reset URL carries the email address in the e parameter, which the attacker can read from the ld value in the OTP page URL.

Impact

An attacker who knows a victim's email address can complete a password reset without access to that mailbox and set a new password, taking over the account. The report demonstrates this against one account and does not discuss what the attacker could then do inside the account, nor whether any additional condition, such as an existing session or a prior OTP request, is required. Tokopedia rated it a valid security bug with Critical Severity.

Fix

Tokopedia fixed the bug on 17 October 2018, two days after the response. What the fix needs to ensure is that the password change endpoint verifies a genuine, unexpired OTP issued for that specific account and ties it to the reset flow, rather than trusting an otpcode value supplied in the URL.

Timeline

Date Event
14 Oct 2018 Reported
15 Oct 2018 Response received: report verified as a valid security bug with Critical Severity, fix in progress
17 Oct 2018 Fixed
17 Oct 2018 8 Million IDR reward granted
6 Dec 2018 Bounty received

Variants to test

  1. Add an OTP parameter to any endpoint that follows a verification step, for example &otpcode=000000, &otp=000000 or &code=000000, and see whether the step is skipped. A positive result is a password change or other privileged action completing without a code that was actually issued.
  2. Look for redirect or ld-style parameters that carry the next URL in the reset flow, and check whether the account identifier inside them can be swapped for another account's. A positive result is the flow acting on the swapped account.
  3. Try submitting the reset form with the OTP field empty, missing or set to a fixed value, and compare the response with a correct code. A positive result is the same success response in both cases.
  4. Check whether the OTP is bound to the session or to the account: request a code for one account and use it, or the reset URL, against another. A positive result is a reset completing on the second account.
  5. Test whether the reset URL remains valid after the code has been used or has expired. A positive result is a second password change from the same URL.

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. 11 min read.

What happened, in plain words

Tokopedia is an online shopping site. Like most sites with user accounts, it has a "forgot my password" feature: if you cannot log in, you type your email address, the site sends a short numeric code to that email, you type the code back, and then you are allowed to choose a new password.

That code is the whole point of the feature. It proves you can read the email inbox, which is something only the real owner of the account should be able to do. If a site lets you change the password without a code that was really sent to that inbox, then anyone who knows your email address can take over your account.

In October 2018 a security researcher, Mukul Lohar (@ironfisto), found exactly that on Tokopedia. He could walk through the reset flow, copy the address from the address bar, add a made-up code to the end of it, and set a new password on someone else's account. Tokopedia confirmed the bug, rated it Critical Severity, fixed it, and paid a reward of 8 Million IDR. The write-up was published on 24 December 2018.

This article walks through the same steps for someone who has never done security testing before. Every term is explained as it comes up, and the addresses and parameters are shown exactly as they appeared in the report.

Background: what a password reset flow is

When you use a website, the site needs a way to know that the person clicking around is really you. The usual answer is a login: you give an email address (who you are) and a password (a secret only you should know). The site stores a record for your account, and the password is the key to it.

A password reset flow exists because people forget passwords. The site cannot simply let anyone set a new password, because then anyone could take over any account. So it asks for proof that you control something tied to the account. The most common proof is access to the email inbox: the site sends a short code, called a one-time password or OTP, to the address on file. Only someone who can open that inbox can read the code and type it back.

A typical flow has three parts:

  1. You enter the email address of the account.
  2. The site sends a code to that address and shows you a page where you can type it.
  3. If the code matches, the site shows you a page where you choose a new password.

The security of the whole thing rests on part 3 only being reachable after part 2 has genuinely succeeded. If part 3 can be reached directly, or if it accepts any code at all, the email inbox stops mattering and the feature becomes a way for strangers to take accounts.

Background: URLs, parameters and what they carry

A web address (URL) is not only a place to go. It can also carry small pieces of data, called parameters, written after a question mark. For example:

Here colour and size are parameter names, and blue and large are their values. The & symbol separates one parameter from the next. When you press Enter, the browser sends this whole address to the server, and the server's program reads the parameters to decide what to show or do.

This matters because parameters in the address bar are fully under the control of whoever is using the browser. You can edit them by hand before pressing Enter. If a server trusts a parameter to mean "this person has already proved who they are", then anyone can type that parameter themselves. That is the shape of the bug in this report.

You will also see %40 in the addresses below. That is simply how an @ sign is written inside a URL, because a bare @ has a special meaning there. So ezgcmmfgc%40champmails.com is the same as [redacted].

Background: base64

One value in this report looks like random letters: [redacted]. That is base64, a way of writing data using only letters, digits and a couple of symbols. It is not encryption and it is not a secret: anyone can decode it. It is used when a system needs to carry a value through places that only accept plain text characters, such as a URL.

If you decode that string, you get back the email address used in the report. The important lesson is that a value being unreadable at a glance does not make it protected. If an attacker can see it, they can decode it.

Background: what an account takeover is

An account takeover means someone else gains control of your account: they can log in as you, read your data, change your settings, and lock you out by changing the password. In a shopping site that can mean access to order history, saved addresses, and anything else tied to the account. The bug class here is a broken authentication or password reset flaw: the site has a check, but the check can be bypassed.

Finding the programme

The researcher was looking for bug bounty programmes, which are schemes where a company invites outside people to test its systems and pays for genuine security problems reported responsibly. He found Tokopedia's policy on GitHub:

Text
https://github.com/tokopedia/Bug-Bounty

This is a public page describing the rules: which systems are in scope, what is not allowed, and how reports are handled. Reading the terms first is the normal starting point, because it tells you what you are permitted to test and how to report what you find. He read the terms and started testing, and the report says he found the account takeover within an hour.

The report does not explain what made him look at the password reset feature in particular. What it does show is what happened once he walked through that feature.

The steps, one at a time

Step 1: open the reset page

HTTP
https://accounts.tokopedia.com/reset-password

This is the page where the password reset begins. accounts.tokopedia.com is the part of Tokopedia's site that handles login and account settings, separate from the shopping pages. Opening this address is the same as clicking "forgot password" on the login screen.

Step 2: enter the victim's email and choose email verification

The report uses a disposable mailbox, [redacted], as the victim account. A disposable mailbox is a temporary email address you can create without giving personal details, which makes it convenient for testing.

He typed that address into the form, clicked continue, and then chose email as the way he wanted to receive the verification code. The report does not show the request or the response for this step, so there is nothing more to describe about it.

Why this step matters: the site now believes a reset is in progress for that address, and it prepares to send a code there. The researcher does not need to receive that code. He only needs to see what the site does next.

Step 3: copy the address from the address bar

After choosing email verification, the browser lands on a page whose address looks like this:

Line by line, in plain words:

  • https://accounts.tokopedia.com/otp/c/page is the page where you would normally type the code. otp stands for one-time password.
  • ? starts the list of parameters.
  • otp_type=132 tells the server which kind of verification is being used.
  • &email=ezgcmmfgc%40champmails.com carries the account's email address, with %40 standing for @.
  • &ld= is the interesting one. Its value is another full web address, the password reset page.
  • That inner address, https://accounts.tokopedia.com/resetpassword?e=[redacted], is the page where the new password is chosen. Its e parameter holds the base64-encoded email address.

Why this step matters: the browser is showing, in plain sight, the address of the page that changes the password. That page is supposed to be reachable only after a correct code. The researcher now has its address without ever receiving a code.

Step 4: isolate the password reset address

The part that starts after ld is:

HTTP
https://accounts.tokopedia.com/resetpassword?e=[redacted]

This is the page that accepts a new password, and its e parameter is just the email address in base64. Anyone who can read this address can also write it.

Step 5: add a made-up code to the address

The researcher appended &otpcode=000000 to the end of that address:

HTTP
https://accounts.tokopedia.com/resetpassword?e=[redacted]&otpcode=000000

In plain words: he added one more parameter, named otpcode, with the value 000000. Six zeros is not a code that was sent to anyone. It is simply a guess typed by hand. The & joins it to the existing parameter, exactly as in the earlier example with colour and size.

Why this step matters: adding the parameter to the address was enough for the password change to complete. By putting the parameter in the address himself, the researcher is supplying the answer to a question the server should have been asking its own records, not the visitor.

Step 6: set a new password

He opened the modified address, typed a password of his choosing, and the victim's Tokopedia account was taken over. The report says the takeover succeeded at this point.

The report also refers to a video proof of concept, which is not reproduced here.

Why the bug worked

The page at /resetpassword accepted an otpcode value supplied directly in the address, and the password change completed. The check that should stand between a visitor and a password change did not stop a code that was never issued for the account, 000000.

The reset address carries the email address in the e parameter, and that value is visible in the ld parameter of the earlier page. What it needs to be is a missing or ineffective check that the code belongs to this account and this reset attempt before the new password is saved.

A useful everyday comparison: imagine a bank counter where the clerk asks for your signature, then accepts a blank piece of paper with the word "signed" written on it. The ritual is there, but the check behind it is not.

Impact

Anyone who knows a victim's email address could complete a password reset without access to that mailbox and set a new password, taking over the account. The report demonstrates this against one account. Tokopedia rated it a valid security bug with Critical Severity.

The fix

Tokopedia fixed the bug on 17 October 2018, two days after the response. What any fix needs to guarantee is that the password change page verifies a genuine, unexpired code that was issued for that specific account and tied to that reset attempt, instead of trusting an otpcode value typed into the address bar.

Timeline

Date Event
14 Oct 2018 Reported
15 Oct 2018 Response received: report verified as a valid security bug with Critical Severity, fix in progress
17 Oct 2018 Fixed
17 Oct 2018 8 Million IDR reward granted
6 Dec 2018 Bounty received

Things to try on your own

These are general ideas for testing similar flows, written for a beginner. Only test systems that invite testing, such as a bug bounty programme whose rules you have read, and never test accounts that are not yours or a test account you created.

  1. Add a code parameter to any page that comes after a verification step, for example &otpcode=000000, &otp=000000 or &code=000000, and see whether the step is skipped. A positive result is a password change or other privileged action completing without a code that was actually issued.
  2. Look for redirect-style parameters such as ld that carry the next address in the flow, and check whether the account identifier inside them can be swapped for another account's. A positive result is the flow acting on the swapped account.
  3. Submit the reset form with the code field empty, missing or set to a fixed value, and compare the response with a correct code. A positive result is the same success response in both cases.
  4. Check whether the code is tied to the session or to the account: request a code for one account and use it, or use the reset address, against another. A positive result is a reset completing on the second account.
  5. Test whether the reset address still works after the code has been used or has expired. A positive result is a second password change from the same address.

Glossary

  • Account takeover: a situation where someone other than the owner gains control of an account, for example by setting a new password.
  • Authentication: the process of proving who you are, usually with a password or a code.
  • Base64: a way of writing data using letters, digits and a few symbols so it can travel through text-only places such as a URL. It is encoding, not encryption, and anyone can decode it.
  • Bug bounty programme: a scheme where a company invites outside researchers to test its systems and pays for genuine security problems reported responsibly.
  • Cookie: a small piece of data a site stores in your browser so it can recognise you between requests.
  • Critical Severity: the highest level in a company's rating scale for security bugs, meaning the problem is serious and should be fixed urgently.
  • Disposable mailbox: a temporary email address that can be created without personal details, often used for testing.
  • Endpoint: a specific address on a server that performs a specific action, such as the page that accepts a new password.
  • Google dorks: search queries that use advanced search operators to find specific pages, such as public bug bounty policies.
  • IDR: Indonesian rupiah, the currency of Indonesia.
  • OTP (one-time password): a short code that is valid for a single use, often sent by email or text message, used to prove you control that inbox or phone.
  • Parameter: a named value attached to a URL after a question mark, such as email=..., used to pass data to the server.
  • Password reset flow: the series of pages a site shows so a user who forgot their password can prove ownership and choose a new one.
  • Proof of concept (POC): a demonstration that a bug really works, often a video or a set of steps.
  • Root cause: the underlying mistake that makes a bug possible, as opposed to its visible symptom.
  • Session: a period during which a site remembers that you are logged in, usually by giving your browser an identifier.
  • Token: a value a site gives your browser to represent your logged-in state or a one-time permission. It should be random and secret; a value that anyone can read or guess is not a real token.
  • URL: a web address, which can include parameters that the server reads.
  • Verification method: the way a site proves you own an account, for example by sending a code to the account's email address.

More by Mukul Lohar

View all

1 more disclosed report, best first.

More from Tokopedia

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.