Skip to content
Account takeover Write-up Intermediate

Predicting the Unpredictable: How a Weak Random Number Generator

Password reset tokens were generated using a non-cryptographic, timestamp-seeded pseudorandom function, making them predictable. An attacker who can trigger or observe the timing of a victim's reset request could compute candidate tokens and complete a password reset without access to the victim's email, achieving account takeover.

T4nv1 Follow

Published on medium.com

Every password reset flow makes the same implicit promise: the link in your inbox is the only way in, because the token inside it could not plausibly be guessed by anyone else. That promise rests entirely on one unglamorous piece of infrastructure — whatever function actually generates the token — and almost nobody…

T4nv1, 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

The password reset token generator derived its output from the server's millisecond-precision timestamp processed through a fast, non-cryptographic pseudorandom algorithm instead of a cryptographically secure random source.

Impact

Any attacker able to trigger or observe the timing of a victim's password reset request could forge a valid reset token without accessing the victim's email, achieving full account takeover.

What the attacker needed

Ability to trigger or observe reset timing; victim has an account on the platform; attacker can submit reset-completion requests

The fix

The platform replaced the token generator with a cryptographically secure implementation and rotated all outstanding tokens.

How it was found

  1. Request several password resets in quick succession against controlled test accounts and log each token from the reset link.
  2. Observe that consecutive tokens share a long common prefix, indicating a time-based seed rather than genuine entropy.
  3. Request a larger batch of tokens while recording the precise server response timestamp for each.
  4. Reproduce the non-cryptographic pseudorandom function locally using the timestamp as seed and confirm candidate tokens match the real ones.
  5. Trigger a reset for a second controlled account, note the request time, compute the candidate token range, and submit each candidate to the reset-completion endpoint.
  6. One candidate succeeds, completing the password reset without access to the email.

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.

A password reset token is a secret code sent by email that proves you own the account. This platform created those codes using a method that is fast but predictable, based on the current time, so someone who knows roughly when the reset happened can guess the code. That let the researcher reset a password without ever seeing the email.

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 T4nv1

View all

113 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.