Timing Attack Side-Channel on API Token Verification
The API token verification code compares tokens using the strict equality operator, which may leak timing information. An attacker could potentially use this timing side-channel to guess tokens character by character.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 13 days
- Disclosed after 13 days
https://github.com/joola/joola/blob/develop/lib/dispatch/users.js#L514
Because tokens are compared with the === operator, this may be susceptible to timing attacks. More info: http://codahale.com/a-lesson-in-timing-attacks/
This is probably not the lowest hanging fruit for an attacker, but it's something you might want to fix. :)
Replacement utility: https://github.com/cryptocat/cryptocat/blob/32fd02f8d899e219a004281eb0ce364cb52dd62a/src/core/js/lib/otr.js#L145-L152
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could potentially recover valid API tokens through repeated timing measurements, though the report notes this is probably not the easiest attack path.
What the attacker needed
Ability to measure response timing
The fix
The token comparison should be replaced with a constant-time comparison utility so that the time taken does not depend on the input.
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 report has not been written yet. The Original tab links to the source.
When a program checks if two strings are equal, it often stops at the first character that differs. That means a string that matches for longer takes slightly more time to reject. An attacker who can measure those tiny time differences might learn the correct characters one by one, like guessing a password by seeing which first letter makes the check take longer.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.