Timing Attack on SQL Queries Through Lobste.rs Password Reset
The password reset token was compared in a SQL WHERE clause using a non-constant-time string comparison, allowing an attacker to leak the token via timing differences and take over a targeted account. The author estimates the attack is practical but slow, requiring many requests over the 24-hour token lifetime.
If you’re reading this blog post wondering if your Lobste.rs account is at risk, good news: I didn’t publish it until after the vulnerability was mitigated, so you’re safe. You don’t need to change your passwords or anything.
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
Impact
An attacker could take over a targeted account, but the attack is slow and resource-intensive, and rate-limiting was applied as a stopgap.
What the attacker needed
Target user account; ability to send many requests; knowledge of server time
The fix
The vulnerability was mitigated by rate-limiting password reset attempts and then fully fixed by using split tokens with a constant-time hash comparison.
How it was found
- Request a password reset for the target user and note the exact time to learn the timestamp part of the token.
- Send guesses for the first character after the timestamp and hyphen, measuring response times to find the slowest (correct) one.
- Continue guessing in chunks of the token, using statistical analysis to identify the correct bytes.
- Once enough of the token is known, complete the remaining characters and use the token to set a new password for the target account.
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 type a wrong password, the server checks it against the stored one. If that check takes slightly longer when the first few characters are correct, an attacker can measure the delay to guess the secret one piece at a time. Here, the password reset token was checked in a database query that leaks such timing information.
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.