Skip to content
Account takeover Write-up Beginner

Bcrypt — Account TakeOver Due To Weak Encryption — #HR51KDB

The login response for the OTP login feature included the one-time password in its body, stored only as a bcrypt hash. Because the OTP was short and numeric, the hash could be cracked offline and the attacker could then log in as the victim.

darklotus Follow

Published on medium.com

Hey Fellas! I hope you all are doing good and safe.

DarkLotus, 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.

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

Likely the server returned the OTP value in the login response instead of keeping it server-side, relying on bcrypt hashing to protect a low-entropy numeric code.

Impact

An attacker who can see the login response could recover the OTP and take over the victim's account.

What the attacker needed

Access to the OTP login response; victim's account identifier known

The fix

The OTP should never be included in the response body; it should be sent only to the registered mobile number and verified server-side.

How it was found

  1. Intercept the OTP login request in a proxy.
  2. Observe the OTP returned in the response body as a bcrypt value.
  3. Copy the bcrypt value into a cracking tool.
  4. Recover the five-digit OTP.
  5. Use the OTP to 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 write-up has not been written yet. The Original tab links to the source.

When you log in with a one-time code, the server should never send that code back to your browser. Here it did, but scrambled with a hashing function called bcrypt, which is meant to be hard to reverse. The code was only five digits, so trying every possibility was quick, and the attacker could then sign in as the victim.

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 darklotus

View all

2 more disclosed reports, best first.

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.