QR Codes from the Past: How an Archive Broke Two-Factor Auth
A login reset API endpoint returned a QR code containing a TOTP secret, and this response was captured by a public web archive. An attacker could decode the QR code to obtain the secret and generate valid two-factor authentication codes for the affected account.
medium.com
Published on medium.com
It was a quiet Tuesday evening, the kind of stillness that lets you hear the hum of your own machine.
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 API endpoint that delivered the TOTP setup QR code did not prevent its response from being cached or indexed by public web archives.
Impact
An attacker could generate valid 2FA codes for affected accounts, and combined with a compromised or guessed password, this could lead to account takeover; the text does not state whether the issue was fixed.
What the attacker needed
Access to a public web archive; knowledge of the target domain; a valid username and password (compromised or guessed)
The fix
The endpoint returning TOTP setup QR codes or secrets should be made non-cacheable and non-indexable, and historical snapshots should be purged from the archiving service.
How it was found
- Search a public web archive for the login domain using a wildcard.
- Search within archived URLs for the keyword 'reset'.
- Open the archived API endpoint with a login_reset path and request_id parameter.
- Copy the Base64-encoded image from the JSON response and view it as a QR code.
- Decode the QR code to extract the TOTP URI and secret.
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.
Two-factor authentication (2FA) adds a second step to logging in, often a six-digit code from an app. That code is generated from a secret key, usually shared by scanning a QR code. Here, the QR code containing the secret was saved in a public archive, so anyone could find it and use it to generate the same codes.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.