GHSA-6CV4-P8M7-4R25

Vulnerability from github – Published: 2026-11-10 21:16 – Updated: 2026-11-10 21:16
VLAI
Summary
Forge: ReDoS in forge.http response header and cookie trimming
Details

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.

Details

_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.

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.

The fix trims trailing whitespace with a loop, as lib/pem.js has done since 1.4.1. The trimmed result is unchanged.

Patches

Fixed in node-forge 1.4.3.

Workarounds

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

Resources

  • 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

Severity

CVSS 3.1: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H (5.9, Moderate) CVSS 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) CVSS 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.

Credits

Reported by @manus-pi.

Proof of concept

var response = forge.http.createResponse();
var ws = new Array(40001).join('\t ');
response.readHeader(forge.util.createBuffer(
  'HTTP/1.1 200 OK\r\nX-A: a' + ws + 'X\r\n\r\n'));
// <= 1.4.2: about 4 seconds (quadratic in the whitespace length)
// 1.4.3: about 1 ms

Regression tests are in tests/security/ghsa-6cv4-p8m7-4r25.js.

Impact

Applications 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.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 1.4.2"
      },
      "package": {
        "ecosystem": "npm",
        "name": "node-forge"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.1.2"
            },
            {
              "fixed": "1.4.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-125333"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-10T21:16:22Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
  },
  "details": "`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*$/, \u0027\u0027)`. 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(\u0027node-forge\u0027)`. 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\u0027s 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\u0027s 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(\u0027\\t \u0027);\n    response.readHeader(forge.util.createBuffer(\n      \u0027HTTP/1.1 200 OK\\r\\nX-A: a\u0027 + ws + \u0027X\\r\\n\\r\\n\u0027));\n    // \u003c= 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\u0027t control are affected. The server, or an on-path attacker, can send a response header that blocks the client\u0027s event loop for minutes, denying service to everything else in the process. There is no confidentiality or integrity impact.",
  "id": "GHSA-6cv4-p8m7-4r25",
  "modified": "2026-11-10T21:16:22Z",
  "published": "2026-11-10T21:16:22Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/digitalbazaar/forge/security/advisories/GHSA-6cv4-p8m7-4r25"
    },
    {
      "type": "WEB",
      "url": "https://github.com/digitalbazaar/forge/pull/1169"
    },
    {
      "type": "WEB",
      "url": "https://github.com/digitalbazaar/forge/commit/326a4d0903ee46358bc849a5c3fd96d9c21489bd"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/digitalbazaar/forge"
    },
    {
      "type": "WEB",
      "url": "https://github.com/digitalbazaar/forge/releases/tag/v1.4.3"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Forge: ReDoS in forge.http response header and cookie trimming"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…