{"id":"CVE-2026-125333","aliases":["CVE-2026-125333","GHSA-6cv4-p8m7-4r25"],"related":[],"kind":"vulnerability","state":"published","title":"Forge: ReDoS in forge.http response header and cookie trimming","summary":"Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. From 0.1.2 until 1.4.3, forge.http uses _trimString() in lib/http.js to remove trailing whitespace from response header values and cookie names and values with a regular expression that can take quadratic time. A malicious server or on-path attacker can supply a long whitespace run followed by a non-whitespace character in a response header, causing response.readHeader() or response.getCookies() to repeatedly scan the input and block the Node.js event loop or browser tab for minutes. Applications are affected only when they use forge.http with a socket pool to communicate with an untrusted server; forge.http is not loaded by require('node-forge'), and the issue has no confidentiality or integrity impact. This issue is fixed in version 1.4.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. From 0.1.2 until 1.4.3, forge.http uses _trimString() in lib/http.js to remove trailing whitespace from response header values and cookie names and values with a regular expression that can take quadratic time. A malicious server or on-path attacker can supply a long whitespace run followed by a non-whitespace character in a response header, causing response.readHeader() or response.getCookies() to repeatedly scan the input and block the Node.js event loop or browser tab for minutes. Applications are affected only when they use forge.http with a socket pool to communicate with an untrusted server; forge.http is not loaded by require('node-forge'), and the issue has no confidentiality or integrity impact. This issue is fixed in version 1.4.3.","source":"cvelist"},{"lang":"en","text":"`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.\n\n### Details\n`_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.\n\nWith 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.\n\n`forge.http` is not loaded by `require('node-forge')`. It is part of the `forge.all` bundle and needs a socket pool provided by the application (historically Flash sockets via `forge.xhr`), so few applications use it.\n\nThe fix trims trailing whitespace with a loop, as `lib/pem.js` has done since 1.4.1. The trimmed result is unchanged.\n\n#### Patches\nFixed in node-forge 1.4.3.\n\n#### Workarounds\nLimit the size of HTTP response headers before passing them to `forge.http`, for example in the socket pool's data handler.\n\n#### Resources\n- Related: GHSA-7wch-p9px-956x (ReDoS in PEM decoding, fixed in 1.4.1): https://github.com/digitalbazaar/forge/security/advisories/GHSA-7wch-p9px-956x\n\n#### Severity\nCVSS 3.1: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H (5.9, Moderate)\nCVSS 4.0 (informational): CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N (8.2)\nCVSS 4.0 has no counterpart to 3.1's AC:H beyond AT:P and scores this higher; the severity rating follows CVSS 3.1.\n\n#### Credits\nReported by @manus-pi.\n\n### Proof of concept\n    var response = forge.http.createResponse();\n    var ws = new Array(40001).join('\\t ');\n    response.readHeader(forge.util.createBuffer(\n      'HTTP/1.1 200 OK\\r\\nX-A: a' + ws + 'X\\r\\n\\r\\n'));\n    // <= 1.4.2: about 4 seconds (quadratic in the whitespace length)\n    // 1.4.3: about 1 ms\n\nRegression tests are in tests/security/ghsa-6cv4-p8m7-4r25.js.\n\n### Impact\nApplications that use `forge.http` to talk to servers they don't control are affected. The server, or an on-path attacker, can send a response header that blocks the client's event loop for minutes, denying service to everything else in the process. There is no confidentiality or integrity impact.","format":"markdown","source":"ghsa"}],"published":"2026-11-10T18:48:26.003Z","modified":"2026-11-16T15:46:52.607Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"version":">= 0.1.2, < 1.4.3","status":"affected"}],"vendor":"digitalbazaar","product":"forge","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.1.2","status":"affected","fixed":"1.4.3"}],"ecosystem":"npm","package":"node-forge","purl":"pkg:npm/node-forge","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"0.1.2","fixed":"1.4.3"}],"vendor":"digitalbazaar","product":"forge","cpe":"cpe:2.3:a:digitalbazaar:forge:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/digitalbazaar/forge/security/advisories/GHSA-6cv4-p8m7-4r25","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/digitalbazaar/forge/pull/1169","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/digitalbazaar/forge/commit/326a4d0903ee46358bc849a5c3fd96d9c21489bd","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/digitalbazaar/forge/releases/tag/v1.4.3","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/digitalbazaar/forge","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-11-10T21:00:54.706Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-125333","url":"https://www.cve.org/CVERecord?id=CVE-2026-125333","licence":"CVE Terms of Use","modified":"2026-11-10T21:01:27.532Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6cv4-p8m7-4r25","url":"https://github.com/advisories/GHSA-6cv4-p8m7-4r25","licence":"CC-BY-4.0","modified":"2026-11-10T21:30:03.999Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-125333","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-125333","licence":"Public domain","modified":"2026-11-16T15:46:52.607Z"}],"updatedAt":"2026-11-25T22:59:50.087Z","epss":{"score":0.00556,"percentile":0.47766,"date":"2026-12-01T12:00:22.000Z"}}