Every CVE Search/ Get API key

CVE-2026-118779

Forge: Regular expression denial of service in PEM decoding (pem.decode)

7.5 HighFix available

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

0.56%Unchanged since Oct 30, 2026
90%50%10%1%

What each source reports

CVE List Score used 7.5

Forge: Regular expression denial of service in PEM decoding (pem.decode)

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
CVE-2026-118779
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400, CWE-1333
Updated
2026-11-02
EUVDEUVD-2026-113337 7.5

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
EUVD-2026-113337
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-7wch-p9px-956x 7.5

Forge: Regular expression denial of service in PEM decoding (pem.decode)

Summary

pem.decode(), which every node-forge API that parses PEM input uses, split messages with a regular expression that takes polynomial time on input without a matching END line, and parsed encapsulated headers with regular expressions that take quadratic time on long header lines. A remote attacker can block the Node.js event loop for seconds to minutes with a crafted input of a few tens of kilobytes. Fixed in node-forge 1.4.1.

Details

pem.decode() in lib/pem.js found PEM messages with this regular expression:

/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g

The optional headers group and the body group are adjacent, lazy, and share characters (whitespace and the base64 alphabet), and the match must end with an END line whose label equals the BEGIN label (\1). When no such END line follows, the engine tries every split of the text between the two groups, for every label split and at every BEGIN line in the input. The work grows polynomially with the input length (roughly cubic for repeated BEGIN/END lines with mismatched labels, quadratic for a BEGIN line followed by many newlines).

The encapsulated header parsing in the same function had two smaller quadratic cases: trimming each header line with /\s+$/, and an unanchored header regex ([\x21-\x7e]+):... that retries at every position of a long line without a colon. These are reachable when a message does match.

All PEM entry points call pem.decode(), including pki.certificateFromPem(), pki.privateKeyFromPem(), pki.publicKeyFromPem(), pki.certificationRequestFromPem(), pki.encryptedPrivateKeyFromPem(), pki.decryptRsaPrivateKey() and pkcs7.messageFromPem().

The fix replaces the message regular expression with a scanner that indexes the END lines once and matches each BEGIN line in linear time, finding the same messages as before. The one difference: a label containing ----- (-----BEGIN A-----B-----) was matched as A-----B if possible; now only the shortest label, A, is used. RFC 7468 labels can't contain --. Header parsing now trims lines with a loop and only starts a header match at the beginning of a run of printable characters, which gives the same result.

Patches

Fixed in node-forge 1.4.1. PEM messages and encapsulated headers are now parsed in linear time.

Workarounds

Rejecting untrusted PEM input larger than a few kilobytes before passing it to node-forge limits the delay but doesn't remove it: on 1.4.0, about 7 KB of crafted input blocked for 0.4 s, and 29 KB for 24 s.

Credits

Reported by Ahmed Mokhtari (@AhmedMokhtari), @mwlik and @imenyoo2, and independently by @offset, @bibu123456 (coordinated by @Kayiz-PT), and @Mucahic.

Proof of concept

var forge = require('node-forge');
var pem = ' -----BEGIN I-----G-----END B'.repeat(1000) + '\x00'; // 29 KB
try {
  forge.pki.certificateFromPem(pem);
} catch(e) {}

On 1.4.0 (Node.js 24) this call blocks for about 24 seconds before throwing "Invalid PEM formatted message."; 14 KB takes about 3 seconds. A BEGIN line followed by 32 KB of newlines and no END line takes about 1.5 seconds, and the time grows quadratically from there. On 1.4.1 each of these inputs is rejected in a few milliseconds, and 1 MB inputs of any of these shapes take under 100 ms.

The PoC is in tests/pocs/ghsa-7wch-p9px-956x.js. Regression tests are in tests/unit/pem.js ("GHSA-7wch-p9px-956x ReDoS checks").

Impact

Any application that passes untrusted PEM text to node-forge is affected: for example, services that accept uploaded certificates, keys or certificate signing requests, or that parse certificates from configuration, SAML metadata or other user-supplied documents. A remote, unauthenticated attacker can send a small crafted input that blocks the Node.js event loop for seconds to minutes per request, so the process stops serving other requests. Repeated requests keep it unavailable.…

Record
GHSA-7wch-p9px-956x
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400, CWE-1333
Updated
2026-11-02
GitHub AdvisoriesGHSA-gf8q-jrpm-jvxq No score

URL parsing in node-forge could lead to undesired behavior.

Impact

The regex used for the forge.util.parseUrl API would not properly parse certain inputs resulting in a parsed data structure that could lead to undesired behavior.

Patches

forge.util.parseUrl and other very old related URL APIs were removed in 1.0.0 in favor of letting applications use the more modern WHATWG URL Standard API.

Workarounds

Ensure code does not directly or indirectly call forge.util.parseUrl with untrusted input.

References

For more information

If you have any questions or comments about this advisory:

Record
GHSA-gf8q-jrpm-jvxq
Weakness
CWE-601
Updated
2026-11-02
NVD 7.5

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
CVE-2026-118779
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400, CWE-1333
Updated
2026-11-02
OSV 7.5

Forge: Regular expression denial of service in PEM decoding (pem.decode)

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
CVE-2026-118779
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333, CWE-400
Updated
2026-11-02
Show 10 moreShow less
OSVGHSA-7wch-p9px-956x 7.5

Forge: Regular expression denial of service in PEM decoding (pem.decode)

Summary

pem.decode(), which every node-forge API that parses PEM input uses, split messages with a regular expression that takes polynomial time on input without a matching END line, and parsed encapsulated headers with regular expressions that take quadratic time on long header lines. A remote attacker can block the Node.js event loop for seconds to minutes with a crafted input of a few tens of kilobytes. Fixed in node-forge 1.4.1.

Details

pem.decode() in lib/pem.js found PEM messages with this regular expression:

/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g

The optional headers group and the body group are adjacent, lazy, and share characters (whitespace and the base64 alphabet), and the match must end with an END line whose label equals the BEGIN label (\1). When no such END line follows, the engine tries every split of the text between the two groups, for every label split and at every BEGIN line in the input. The work grows polynomially with the input length (roughly cubic for repeated BEGIN/END lines with mismatched labels, quadratic for a BEGIN line followed by many newlines).

The encapsulated header parsing in the same function had two smaller quadratic cases: trimming each header line with /\s+$/, and an unanchored header regex ([\x21-\x7e]+):... that retries at every position of a long line without a colon. These are reachable when a message does match.

All PEM entry points call pem.decode(), including pki.certificateFromPem(), pki.privateKeyFromPem(), pki.publicKeyFromPem(), pki.certificationRequestFromPem(), pki.encryptedPrivateKeyFromPem(), pki.decryptRsaPrivateKey() and pkcs7.messageFromPem().

The fix replaces the message regular expression with a scanner that indexes the END lines once and matches each BEGIN line in linear time, finding the same messages as before. The one difference: a label containing ----- (-----BEGIN A-----B-----) was matched as A-----B if possible; now only the shortest label, A, is used. RFC 7468 labels can't contain --. Header parsing now trims lines with a loop and only starts a header match at the beginning of a run of printable characters, which gives the same result.

Patches

Fixed in node-forge 1.4.1. PEM messages and encapsulated headers are now parsed in linear time.

Workarounds

Rejecting untrusted PEM input larger than a few kilobytes before passing it to node-forge limits the delay but doesn't remove it: on 1.4.0, about 7 KB of crafted input blocked for 0.4 s, and 29 KB for 24 s.

Credits

Reported by Ahmed Mokhtari (@AhmedMokhtari), @mwlik and @imenyoo2, and independently by @offset, @bibu123456 (coordinated by @Kayiz-PT), and @Mucahic.

Proof of concept

var forge = require('node-forge');
var pem = ' -----BEGIN I-----G-----END B'.repeat(1000) + '\x00'; // 29 KB
try {
  forge.pki.certificateFromPem(pem);
} catch(e) {}

On 1.4.0 (Node.js 24) this call blocks for about 24 seconds before throwing "Invalid PEM formatted message."; 14 KB takes about 3 seconds. A BEGIN line followed by 32 KB of newlines and no END line takes about 1.5 seconds, and the time grows quadratically from there. On 1.4.1 each of these inputs is rejected in a few milliseconds, and 1 MB inputs of any of these shapes take under 100 ms.

The PoC is in tests/pocs/ghsa-7wch-p9px-956x.js. Regression tests are in tests/unit/pem.js ("GHSA-7wch-p9px-956x ReDoS checks").

Impact

Any application that passes untrusted PEM text to node-forge is affected: for example, services that accept uploaded certificates, keys or certificate signing requests, or that parse certificates from configuration, SAML metadata or other user-supplied documents. A remote, unauthenticated attacker can send a small crafted input that blocks the Node.js event loop for seconds to minutes per request, so the process stops serving other requests. Repeated requests keep it unavailable.…

Record
GHSA-7wch-p9px-956x
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-1333, CWE-400
Updated
2026-11-02
OSVROOT-APP-NPM-CVE-2026-118779 7.5

CVE-2026-118779 in node-forge - Patched by Root

Root has patched CVE-2026-118779 in the node-forge package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-CVE-2026-118779
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-06
OSVUBUNTU-CVE-2026-118779 7.5

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
UBUNTU-CVE-2026-118779
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-05
OSVAZL-112469 No score

CVE-2026-118779 affecting package python-tensorboard 2.16.2-6

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used pem.decode(), lib/pem.js, missing END line to process the relevant input or security decision. node-forge used polynomial-time regular expressions in pem.decode(), including when searching for a matching END line and parsing encapsulated headers. An unauthenticated attacker able to supply PEM input to any high-level parser could consume excessive CPU with a long malformed message and cause denial of service. This issue is fixed in version 1.4.1.

Record
AZL-112469
Updated
2026-11-05
OSVCLSA-2026-1793790288 No score

TuxCare security update for node-forge (10 CVEs)

TuxCare rebuilt node-forge to address 10 CVEs. Fixed in 1.3.3-tuxcare.3.

Record
CLSA-2026-1793790288
Updated
2026-11-04
OSVCLSA-2026-1793801784 No score

TuxCare security update for node-forge (6 CVEs)

TuxCare rebuilt node-forge to address 6 CVEs. Fixed in 1.3.1-tuxcare.2.

Record
CLSA-2026-1793801784
Updated
2026-11-04
OSVCLSA-2026-1793808759 No score

TuxCare security update for node-forge (6 CVEs)

TuxCare rebuilt node-forge to address 6 CVEs. Fixed in 0.10.0-tuxcare.8.

Record
CLSA-2026-1793808759
Updated
2026-11-04
OSVCLSA-2026-1793814373 No score

TuxCare security update for node-forge (8 CVEs)

TuxCare rebuilt node-forge to address 8 CVEs. Fixed in 0.9.0-tuxcare.1.

Record
CLSA-2026-1793814373
Updated
2026-11-05
OSVGHSA-gf8q-jrpm-jvxq No score

URL parsing in node-forge could lead to undesired behavior.

Impact

The regex used for the forge.util.parseUrl API would not properly parse certain inputs resulting in a parsed data structure that could lead to undesired behavior.

Patches

forge.util.parseUrl and other very old related URL APIs were removed in 1.0.0 in favor of letting applications use the more modern WHATWG URL Standard API.

Workarounds

Ensure code does not directly or indirectly call forge.util.parseUrl with untrusted input.

References

For more information

If you have any questions or comments about this advisory:

Record
GHSA-gf8q-jrpm-jvxq
Weakness
CWE-601
Updated
2026-11-02
OSVROOT-APP-NPM-GHSA-gf8q-jrpm-jvxq No score

GHSA-gf8q-jrpm-jvxq in node-forge - Patched by Root

Root has patched GHSA-gf8q-jrpm-jvxq in the node-forge package for Root:npm. Multiple fixed versions available.

Record
ROOT-APP-NPM-GHSA-gf8q-jrpm-jvxq
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
node-forge
npm
through 1.4.0
1.4.1
node-forge
npm
before 1.0.0
1.0.0
python-tensorboard
Azure Linux:3
through 2.16.2-6 None known
node-forge
TuxCare:npm
From an advisory covering 10 CVEs
1.3.3-tuxcare.0 up to 1.3.3-tuxcare.3, plus listed versions
1.3.31.3.3-tuxcare.11.3.3-tuxcare.2
1.3.3-tuxcare.3
node-forge
TuxCare:npm
From an advisory covering 6 CVEs
1.3.1-tuxcare.0 up to 1.3.1-tuxcare.2, plus listed versions
1.3.11.3.1-tuxcare.1
1.3.1-tuxcare.2
node-forge
TuxCare:npm
From an advisory covering 6 CVEs
0.10.0-tuxcare.0 up to 0.10.0-tuxcare.8, plus listed versions
0.10.00.10.0-tuxcare.10.10.0-tuxcare.20.10.0-tuxcare.30.10.0-tuxcare.40.10.0-tuxcare.50.10.0-tuxcare.60.10.0-tuxcare.7
0.10.0-tuxcare.8
node-forge
TuxCare:npm
From an advisory covering 7 CVEs
0.9.0-tuxcare.0 up to 0.9.0-tuxcare.1, plus listed versions
0.9.0
0.9.0-tuxcare.1
node-forge
npm
before 1.4.1
1.4.1
node-forge
Root:npm
before 1.4.0-aikido.4
1.4.0-aikido.41.4.0-aikido.51.3.3-aikido.6
@rootio/node-forge
Root:npm
before 1.4.0-root.io.4
1.4.0-root.io.41.4.0-root.io.51.3.3-root.io.6
Show 4 moreShow less
Affected packages
PackageAffectedFixed
node-forge
Root:npm
before 1.0.0-aikido.1
1.0.0-aikido.1
@rootio/node-forge
Root:npm
before 1.0.0-root.io.1
1.0.0-root.io.1
node-node-forge
Ubuntu:20.04:LTS
All versions, plus listed versions
0.8.5~dfsg-20.9.1~dfsg-1
None known
node-node-forge
Ubuntu:22.04:LTS
All versions, plus listed versions
0.10.0~dfsg-31.2.1~dfsg-2
None known

History

History
RecordedChangedSources
affected
affectedOSV
affected, aliases, cwes, published, referencesOSV
affected, aliasesOSV
affected, aliases, factsOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-118779 is a high vulnerability (CVSS 7.5) in Digitalbazaar Forge, published January 8, 2022. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.56%, the 46th percentile. Fixed in node-forge 1.4.1.

References

Show 7 moreShow less
This page doesn't list everything

Left out here: the rest of 2 source descriptions. The JSON record has them.

MoveEnter Open