Non-Constant Time String Comparison

Affecting cookie-signature package, versions <1.0.4

Do your applications use this vulnerable package? Test your applications

Overview

'cookie-signature' is a library for signing cookies.

Versions before 1.0.4 of the library use the built-in string comparison mechanism, ===, and not a time constant string comparison. As a result, the comparison will fail faster when the first characters in the token are incorrect. An attacker can use this difference to perform a timing attack, essentially allowing them to guess the secret one character at a time.

You can read more about timing attacks in Node.js on the Snyk blog: https://snyk.io/blog/node-js-timing-attack-ccc-ctf/

Remediation

Upgrade to 1.0.4 or greater.

References

CVSS Score

6.3
medium severity
  • Attack Vector
    Network
  • Attack Complexity
    High
  • Privileges Required
    Low
  • User Interaction
    None
  • Scope
    Changed
  • Confidentiality
    High
  • Integrity
    None
  • Availability
    None
CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N
CWE
CWE-208
Snyk ID
npm:cookie-signature:20160804
Disclosed
28 Jan, 2014
Published
29 Aug, 2016