$12,000 for Listening to How Long ‘No’ Takes: A Timing Attack That Recovered a Secret API Key
The webhook signature verification endpoint used a non-constant-time string comparison, leaking timing information that correlated with the number of matching leading characters. An attacker could exploit this to extract the full secret key character by character through repeated timing measurements.
Most authentication bypasses I’ve found involve getting a system to accept something it shouldn’t. This one never bypassed anything in that sense — every single guess I sent was correctly rejected, every time, with the application behaving exactly as its developers intended at every step.
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 comparison function exits early on the first mismatched character, making the time taken depend on how many leading characters match, which leaks information about the secret.
Impact
An attacker with sufficient network access and patience could fully extract any account’s webhook signing secret, allowing them to forge validly-signed webhook payloads.
What the attacker needed
Access to the signature verification endpoint; ability to generate a test webhook secret; network access to measure response times
The fix
The comparison function was replaced with a constant-time equivalent and rate limiting was added to the verification endpoint.
How it was found
- Send two wrong signature guesses and measure response times to check for constant-time behaviour.
- Vary only the first character across all hex values and measure average response time for each.
- Identify the slowest-responding character as the correct first character.
- For each subsequent position, fix already-found characters, vary the current position, and measure average response time.
- Repeat until the full secret is extracted.
- Confirm the extracted secret by using it to generate a valid signature and submitting it to the verification endpoint.
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 a server checks if two strings are equal, it often stops at the first difference. If one string is a secret, an attacker can measure how long the check takes: a guess that matches more characters takes slightly longer. By repeating many times and averaging, the attacker can guess the secret one character at a time.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.