Non-Constant Time String Comparison Affecting csrf-lite package, versions <=0.1.1


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    EPSS
    0.15% (52nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID npm:csrf-lite:20160423
  • published 22 Jun 2016
  • disclosed 23 Apr 2016
  • credit Todd Wolfson

How to fix?

Update to version 0.1.2 or higher.

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/

CVSS Scores

version 3.1
Expand this section

Snyk

4.3 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    Low
  • Integrity (I)
    None
  • Availability (A)
    None