All vulnerabilities

npm

CVE-2026-125333

Forge: ReDoS in forge.http response header and cookie trimming

Severity
Medium 5.9
Published
10 Nov 2026
Last changed
10 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.4.3
Exploit chance
0.6% in the next 30 daysHigher than 47% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Regular expression denial of service (ReDoS) (CWE-1333)
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Take it down
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Also known as
GHSA-6cv4-p8m7-4r25
Sources
OSV.dev and GitHub

Description

forge.http trims response header and Set-Cookie values with the regular expression /\s*$/, which takes quadratic time on a long run of whitespace followed by another character. A server or on-path attacker can block a forge.http client for minutes with one large response header. Fixed in node-forge 1.4.3.

_trimString() in lib/http.js removes trailing whitespace with str.replace(/\s*$/, ''). On a string of n whitespace characters followed by a non-whitespace character, the regular expression engine tries a match at each of the n positions and scans the rest of the run each time, so the work is O(n^2). forge.http calls _trimString() on every response header value read by response.readHeader(), and again on cookie names and values in response.getCookies(). There is no limit on header size.

With Node.js 24, an 80 KB header value takes about 4 seconds to parse, and 1 MB about 10 minutes, during which the event loop (or browser tab) is blocked.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

Limit the size of HTTP response headers before passing them to forge.http, for example in the socket pool's data handler.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
node-forgenpm · osv:npm:node-forge
  • From 0.1.2 before 1.4.3

About node-forge

Weekly downloads (npm)
55,543,907npm, 23 Nov 2026

References