Skip to content
Account takeover Write-up Intermediate

Insecure Authentication Tokens leading to Account Takeover

The mobile application used a custom authentication token that was AES-256-CBC encrypted with a hardcoded passphrase and IV, and the token contained a predictable hash of the user's email and company name. An attacker who knows the application name and a victim's email address could forge a valid token and impersonate any user, including administrators.

Thomas Delfino Follow

Published on vaadata.com

Most applications have a critical feature for identifying users. The aim is to guarantee the confidentiality and integrity of their data.

nicolas, on vaadata.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.

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

How it worked

Root cause

The application relied on client-side security: it embedded the encryption key and IV in the mobile app and used a predictable hash (of email and company name) as the authentication secret, allowing anyone with the app to forge tokens.

Impact

An attacker could forge a valid token for any user, including administrators, and because the token never expired, a leaked token could be reused indefinitely; the same passphrase and IV were used across all tenants, so compromising one organisation could affect others.

What the attacker needed

Knowledge of the application name; a valid email address of the target user; access to the mobile application (for source code)

The fix

The application should rely on server-side authentication, such as a properly implemented JWT, instead of embedding secrets in the client and using predictable values.

How it was found

  1. Capture the login request and observe the TOKEN header.
  2. Decompile the mobile application to recover the source code.
  3. Search the decompiled code for 'token' to find how the token is generated.
  4. Identify the AES-256-CBC encryption and extract the hardcoded passphrase and IV.
  5. Decrypt a token to see its contents and learn the hash formula (sha512 of email#company).
  6. Forge a token for the target email by computing the hash, encrypting it, and sending it in the TOKEN header.

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 write-up has not been written yet. The Original tab links to the source.

The app created a login token by encrypting some user details with a secret key that was hidden inside the app itself. Because the key was in the app, anyone who downloaded the app could find it and make their own tokens. The token also used a simple, guessable value (a hash of the email and company name) instead of a real password check, so an attacker could pretend to be any user, even an admin.

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.

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.