Skip to content
Account takeover Disclosed report Intermediate

Two-factor authentication bypass on Grab Android App

The profile edit endpoint accepted a four-digit SMS verification code without any rate limiting or code expiry, so an attacker could try every possible code until the right one was found. This let an attacker bypass the SMS second factor and take over a victim's account, including changing their email and phone number.

sp1d3rs Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 15 hours
  • Fixed in 8 days
  • Paid in 8 days
  • Disclosed after 7 months

Summary by the researcher

I found a two-factor authentication bypass on the endpoint, used by Grab Android App. The team was very responsible and fixed the issue fast. Thanks to the Grab team for the great experience and the bounty!

I escalated similar issue to the any user account takeover by unauthenticated attacker in #205000 report (disclosure will be requested after clearing the private info). In this report i mentioned, that "Login with mobile number" endpoint is secure, and not vulnerable, but later i challenged myself, and discovered a way to bypass OTP code (not 2FA like in this report) there too.

I will disclose #205000 as soon as sensitive info there will be redacted.

P.S. the POC tool did not check the codes, which was starting from 0*** (my bad) - fortunately, it did not affect triage process. The attached tool also can be rewritten for the any other case. Yeah, it's probably the time to learn Python:)

###Used tools and apps:

  1. Nox App Player (android emulator), proxied through web debugging proxy.
  2. Tested application - https://play.google.com/store/apps/details?id=com.grabtaxi.passenger (app allows registration from any country)
  3. Custom C# code bruteforcer, attached below in the report.

The report

Description

I found the endpoint using android app https://p.grabtaxi.com/api/passenger/v2/profiles/edit which allow me to bypass 2FA (sms code) due to lack of rate limiting\code expiration after unsuccessful attempts. The root cause of the problem it that facts: no rate limiting+ no code expiration. Since code has 4 digits, attacker just need to count all possible combinations from 1000 to 9999. What happens if we do the wrong request to https://p.grabtaxi.com/api/passenger/v2/profiles/edit endpoint? Let's take a look:

PUT /api/passenger/v2/profiles/edit HTTP/1.1
Content-Type: application/x-www-form-urlencoded
x-mts-ssid: [current session id, its too long so i removed it for report space economy]
x-request-id: 3b609418-0e40-4f86-8ff6-4f23dfac420f
Host: p.grabtaxi.com
Content-Length: 26
Accept-Encoding: gzip
Connection: Keep-Alive

profileActivationCode=3122

Response (bad request):

HTTP/1.1 400 Bad Request
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Tue, 31 Jan 2017 17:45:43 GMT
X-Api-Source: grabapi
X-Request-Id: 01800ddb-fb58-4b53-aecc-97473225f732
Content-Length: 47
Connection: keep-alive

{"status":400,"code":4000}

And what when code will be correct? Response (correct request):

HTTP/1.1 204 No Content
Content-Type: application/json; charset=utf-8
Date: Tue, 31 Jan 2017 17:45:43 GMT
X-Api-Source: grabapi
X-Request-Id: 9d0eae1a-9c16-4aa5-8b40-01105a7cb994
Connection: keep-alive

I looked to it, and wrote a simple C# tool which sends all possible codes combinations, until it finds a correct code. Source code and POC tool included to the report (it requires at least Windows 7 and NET 4.0 to run).

Impact

The attacker can bypass 2FA authentication on Grab android app. Attacker can succeed in the account takeover, changing email, phone number of the victim who use Google Auth on the app etc.

Steps To Reproduce:

  1. Login to your Grab Android app using Google with valid phone number (2FA on the phone login option is correctly implemented, and not vulnerable).
  2. Edit your profile name and press Save.
  3. The 4-digit sms code will be send to your phone. Dont look to it now:)
  4. Use my POC tool (written on C#, requires .NET 4.0). You need a one header from the any app web request (x-mts-ssid) for proper testing. You can extract it from the any request from Android app, using some Web Proxy.

If you have troubles with extracting x-mts-ssid session header from the web request - let me know. It can be tricky thing (i used android emulator, connected to Charles Web Proxy, for request monitoring). Open the program, paste the x-mts-ssid in the text field and press "Start". Wait till process will ends (correct code will be found). 5. Compare code from the tool, and code that you received on the phone earlier - they must be equal. Also i wrote a POC video (https://drive.google.com/file/d/0B8dmpoHKDZsZSFI5WXY2RzRYT00/view?usp=sharing).

Mitigation/Remediation Steps:

I suggest you implement a rate-limiting on this endpoint, or force 2FA code expiring after, for example, 5 wrong attempts (or both of this for better security).

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The endpoint had no rate limiting and the SMS code never expired, so all 10,000 four-digit values could be tried.

Impact

An attacker could bypass the SMS second factor and take over the account, changing the victim's email or phone number; the report notes the phone-login 2FA option itself was correctly implemented and not vulnerable.

What the attacker needed

A Grab account with a phone number; ability to capture the session header; a brute-force tool

The fix

The report recommends rate limiting and code expiry after a few wrong attempts; the team says the issue was fixed.

How it was found

  1. Log in to the Grab Android app with Google using a valid phone number.
  2. Edit the profile name and save, which triggers a four-digit SMS code.
  3. Capture the session header from an app request using a web proxy.
  4. Run the brute-force tool with that header and wait for it to find the correct code.
  5. Compare the found code with the one received on the phone to confirm they match.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you log in, a site may send a short code to your phone to prove it is really you. This endpoint let someone guess that code as many times as they liked, and the code never stopped working, so a script could simply try every four-digit number until one worked. That gave the attacker control of the account.

What is Account takeover?

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

More by sp1d3rs

View all

62 more disclosed reports, best first.

More from Grab

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.