Regular Expression Denial of Service (ReDoS)

Affecting tough-cookie package, versions <=2.2.2 >=0.9.7

high severity

Overview

tough-cookie Hawk is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial HTTP request cryptographic verification. Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach edge cases that causes them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a Regex string and cause the service to hang for a large periods of time.

An attacker can provide a cookie, which nearly matches the pattern being matched. This will cause the regular expression matching to take a long time, all the while occupying the event loop and preventing it from processing other requests and making the server unavailable (a Denial of Service attack).

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade tough-cookie to at version 2.3.0 or greater.

References

Snyk patch available for versions:

Credit
David Kirchner
CWE
CWE-400
Snyk ID
npm:tough-cookie:20160722
Disclosed
22 Jul, 2016
Published
22 Jul, 2016

Do your applications use this vulnerable package?