Non-Constant Time String Comparison

Affecting csrf-lite package, versions <=0.1.1

Do your applications use this vulnerable package? Test your applications

Overview

csrf-lite is a CSRF protection utility for framework-free node sites. Affected versions of the package are vulnerable to a timing attack.

While the CSRF protection itself works well and increases security, the library uses 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 CSRF token 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

Update to version 0.1.2 or higher.

References

CVSS Score

4.3
medium severity
  • Attack Vector
    Network
  • Attack Complexity
    Low
  • Privileges Required
    Low
  • User Interaction
    None
  • Scope
    Unchanged
  • Confidentiality
    Low
  • Integrity
    None
  • Availability
    None
CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
Credit
Todd Wolfson
CVE
CVE-2016-10535
CWE
CWE-208
Snyk ID
npm:csrf-lite:20160423
Disclosed
23 Apr, 2016
Published
22 Jun, 2016