Executive brief
cookie-signature is a Node.js library used to sign and verify HTTP cookies in web applications. A timing attack vulnerability in its comparison logic allows an attacker to guess the signing secret much faster than intended, potentially leading to session hijacking or cookie forgery if the secret is compromised.
Technical details
cookie-signature uses a fail-early string comparison instead of constant-time comparison when verifying cookie signatures. This vulnerability (CWE-362) allows attackers to exploit timing differences in the comparison to perform a timing attack, reducing the effective entropy of the secret. Instead of requiring charset^length guesses, an attacker can succeed in charset*length guesses under favorable network conditions. The vulnerability affects all versions before 1.0.4, which introduced constant-time comparison. The attack requires network access but no authentication or special privileges.
Affected products
- TJ Holowaychuk cookie-signature before 1.0.4
Timeline
- 2020-01-06: disclosed: Advisory published
- 2014-06-25: patched: Version 1.0.4 released with fix