chore(deps): update dependency node-forge to v1 [security]#81
Open
sc-renovate[bot] wants to merge 1 commit intomasterfrom
Open
chore(deps): update dependency node-forge to v1 [security]#81sc-renovate[bot] wants to merge 1 commit intomasterfrom
sc-renovate[bot] wants to merge 1 commit intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.10.0→^1.0.0GitHub Vulnerability Alerts
GHSA-5rrq-pxf6-6jx5
Impact
The
forge.debugAPI had a potential prototype pollution issue if called with untrusted input. The API was only used for internal debug purposes in a safe way and never documented or advertised. It is suspected that uses of this API, if any exist, would likely not have used untrusted inputs in a vulnerable way.Patches
The
forge.debugAPI and related functions were removed in 1.0.0.Workarounds
Don't use the
forge.debugAPI directly or indirectly with untrusted input.References
For more information
If you have any questions or comments about this advisory:
GHSA-gf8q-jrpm-jvxq
Impact
The regex used for the
forge.util.parseUrlAPI would not properly parse certain inputs resulting in a parsed data structure that could lead to undesired behavior.Patches
forge.util.parseUrland 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.parseUrlwith untrusted input.References
For more information
If you have any questions or comments about this advisory:
CVE-2022-0122
parseUrl functionality in node-forge mishandles certain uses of backslash such as
https:/\/\/\and interprets the URI as a relative path.CVE-2022-24772
Impact
RSA PKCS#1 v1.5 signature verification code does not check for tailing garbage bytes after decoding a
DigestInfoASN.1 structure. This can allow padding bytes to be removed and garbage data added to forge a signature when a low public exponent is being used.Patches
The issue has been addressed in
node-forge1.3.0.References
For more information, please see
"Bleichenbacher's RSA signature forgery based on implementation error"
by Hal Finney.
For more information
If you have any questions or comments about this advisory:
CVE-2022-24773
Impact
RSA PKCS#1 v1.5 signature verification code is not properly checking
DigestInfofor a proper ASN.1 structure. This can lead to successful verification with signatures that contain invalid structures but a valid digest.Patches
The issue has been addressed in
node-forge1.3.0.For more information
If you have any questions or comments about this advisory:
CVE-2022-24771
Impact
RSA PKCS#1 v1.5 signature verification code is lenient in checking the digest algorithm structure. This can allow a crafted structure that steals padding bytes and uses unchecked portion of the PKCS#1 encoded message to forge a signature when a low public exponent is being used.
Patches
The issue has been addressed in
node-forge1.3.0.References
For more information, please see
"Bleichenbacher's RSA signature forgery based on implementation error"
by Hal Finney.
For more information
If you have any questions or comments about this advisory:
CVE-2025-66031
Summary
An Uncontrolled Recursion (CWE-674) vulnerability in node-forge versions 1.3.1 and below enables remote, unauthenticated attackers to craft deep ASN.1 structures that trigger unbounded recursive parsing. This leads to a Denial-of-Service (DoS) via stack exhaustion when parsing untrusted DER inputs.
Details
An ASN.1 Denial of Service (Dos) vulnerability exists in the node-forge
asn1.fromDerfunction withinforge/lib/asn1.js. The ASN.1 DER parser implementation (_fromDer) recurses for every constructed ASN.1 value (SEQUENCE, SET, etc.) and lacks a guard limiting recursion depth. An attacker can craft a small DER blob containing a very large nesting depth of constructed TLVs which causes the Node.js V8 engine to exhaust its call stack and throwRangeError: Maximum call stack size exceeded, crashing or incapacitating the process handling the parse. This is a remote, low-cost Denial-of-Service against applications that parse untrusted ASN.1 objects.Impact
This vulnerability enables an unauthenticated attacker to reliably crash a server or client using node-forge for TLS connections or certificate parsing.
This vulnerability impacts the ans1.fromDer function in
node-forgebefore patched version1.3.2.Any downstream application using this component is impacted. These components may be leveraged by downstream applications in ways that enable full compromise of availability.
CVE-2025-66030
Summary
MITRE-Formatted CVE Description
An Integer Overflow (CWE-190) vulnerability in node-forge versions 1.3.1 and below enables remote, unauthenticated attackers to craft ASN.1 structures containing OIDs with oversized arcs. These arcs may be decoded as smaller, trusted OIDs due to 32-bit bitwise truncation, enabling the bypass of downstream OID-based security decisions.
Description
An ASN.1 OID Integer Truncation vulnerability exists in the node-forge$2^{31}-1$ , the value silently overflows and wraps around rather than throwing an error.
asn1.derToOidfunction withinforge/lib/asn1.js. OID components are decoded using JavaScript's bitwise left-shift operator (<<), which forcibly casts values to 32-bit signed integers. Consequently, if an attacker provides a mathematically unique, very large OID arc integer exceedingImpact
This vulnerability allows a specially crafted ASN.1 object to spoof an OID, where a malicious certificate with a massive, invalid OID is misinterpreted by the library as a trusted, standard OID, potentially bypassing security controls.
This vulnerability impacts the
asn1.derToOidfunction innode-forgebefore patched version1.3.2.Any downstream application using this component is impacted. This component may be leveraged by downstream applications in ways that enables partial compromise of integrity, leading to potential availability and confidentiality compromises.
CVE-2025-12816
Summary
CVE-2025-12816 has been reserved by CERT/CC
Description
An Interpretation Conflict (CWE-436) vulnerability in node-forge versions 1.3.1 and below enables remote, unauthenticated attackers to craft ASN.1 structures to desynchronize schema validations, yielding a semantic divergence that may bypass downstream cryptographic verifications and security decisions.
Details
A critical ASN.1 validation bypass vulnerability exists in the node-forge asn1.validate function within
forge/lib/asn1.js. ASN.1 is a schema language that defines data structures, like the typed record schemas used in X.509, PKCS#7, PKCS#12, etc. DER (Distinguished Encoding Rules), a strict binary encoding of ASN.1, is what cryptographic code expects when verifying signatures, and the exact bytes and structure must match the schema used to compute and verify the signature. After deserializing DER, Forge uses static ASN.1 validation schemas to locate the signed data or public key, compute digests over the exact bytes required, and feed digest and signature fields into cryptographic primitives.This vulnerability allows a specially crafted ASN.1 object to desynchronize the validator on optional boundaries, causing a malformed optional field to be semantically reinterpreted as the subsequent mandatory structure. This manifests as logic bypasses in cryptographic algorithms and protocols with optional security features (such as PKCS#12, where MACs are treated as absent) and semantic interpretation conflicts in strict protocols (such as X.509, where fields are read as the wrong type).
Impact
This flaw allows an attacker to desynchronize the validator, allowing critical components like digital signatures or integrity checks to be skipped or validated against attacker-controlled data.
This vulnerability impacts the
ans1.validatefunction innode-forgebefore patched version1.3.2.https://github.com/digitalbazaar/forge/blob/main/lib/asn1.js.
The following components in
node-forgeare impacted.lib/asn1.js
lib/x509.js
lib/pkcs12.js
lib/pkcs7.js
lib/rsa.js
lib/pbe.js
lib/ed25519.js
Any downstream application using these components is impacted.
These components may be leveraged by downstream applications in ways that enable full compromise of integrity, leading to potential availability and confidentiality compromises.
CVE-2026-33895
Summary
Ed25519 signature verification accepts forged non-canonical signatures where the scalar S is not reduced modulo the group order (
S >= L). A valid signature and itsS + Lvariant both verify in forge, while Node.jscrypto.verify(OpenSSL-backed) rejects theS + Lvariant, as defined by the specification. This class of signature malleability has been exploited in practice to bypass authentication and authorization logic (see CVE-2026-25793, CVE-2022-35961). Applications relying on signature uniqueness (i.e., dedup by signature bytes, replay tracking, signed-object canonicalization checks) may be bypassed.Impacted Deployments
Tested commit:
8e1d527fe8ec2670499068db783172d4fb9012e5Affected versions: tested on v1.3.3 (latest release) and all versions since Ed25519 was implemented.
Configuration assumptions:
ed25519.verify(...)).Root Cause
In
lib/ed25519.js,crypto_sign_open(...)uses the signature's last 32 bytes (S) directly in scalar multiplication:There is no prior check enforcing
S < L(Ed25519 group order). As a result, equivalent scalar classes can pass verification, including a modified signature whereS := S + L (mod 2^256)when that value remains non-canonical. The PoC demonstrates this by mutating only the S half of a valid 64-byte signature.Reproduction Steps
v24.9.0) and clonedigitalbazaar/forgeat commit8e1d527fe8ec2670499068db783172d4fb9012e5.poc.js) withnode poc.jsin the same level as theforgefolder.crypto.verify).{ "forge": { "original_valid": true, "tweaked_valid": true }, "crypto": { "original_valid": true, "tweaked_valid": false } }Proof of Concept
Overview:
poc.js
Suggested Patch
Add strict canonical scalar validation in Ed25519 verify path before scalar multiplication. (Parse S as little-endian 32-byte integer and reject if
S >= L).Here is a patch we tested on our end to resolve the issue, though please verify it on your end:
Resources
Credit
This vulnerability was discovered as part of a U.C. Berkeley security research project by: Austin Chu, Sohee Kim, and Corban Villa.
CVE-2026-33891
Summary
A Denial of Service (DoS) vulnerability exists in the node-forge library due to an infinite loop in the BigInteger.modInverse() function (inherited from the bundled jsbn library). When modInverse() is called with a zero value as input, the internal Extended Euclidean Algorithm enters an unreachable exit condition, causing the process to hang indefinitely and consume 100% CPU.
Affected Package
Package name: node-forge (npm: node-forge)
Repository: https://github.com/digitalbazaar/forge
Affected versions: All versions (including latest)
Affected file: lib/jsbn.js, function bnModInverse()
Root cause component: Bundled copy of the jsbn (JavaScript Big Number) library
Vulnerability Details
Type: Denial of Service (DoS)
CWE: CWE-835 (Loop with Unreachable Exit Condition)
Attack vector: Network (if the application processes untrusted input that reaches modInverse)
Privileges required: None
User interaction: None
Impact: Availability (process hangs indefinitely)
Suggested CVSS v3.1 score: 5.3–7.5 (depending on the context of usage)
Root Cause Analysis
The BigInteger.prototype.modInverse(m) function in lib/jsbn.js implements the Extended Euclidean Algorithm to compute the modular multiplicative inverse of this modulo m.
Mathematically, the modular inverse of 0 does not exist — gcd(0, m) = m ≠ 1 for any m > 1. However, the implementation does not check whether the input value is zero before entering the algorithm's main loop. When this equals 0, the algorithm's loop condition is never satisfied for termination, resulting in an infinite loop.
The relevant code path in lib/jsbn.js:
Attack Scenario
Any application using node-forge that passes attacker-controlled or untrusted input to a code path involving modInverse() is vulnerable. Potential attack surfaces include:
DSA/ECDSA signature verification — A crafted signature with s = 0 would trigger s.modInverse(q), causing the verifier to hang.
Custom RSA or Diffie-Hellman implementations — Applications performing modular arithmetic with user-supplied parameters.
Any cryptographic protocol where an attacker can influence a value that is subsequently passed to modInverse().
A single malicious request can cause the Node.js event loop to block indefinitely, rendering the entire application unresponsive.
Proof of Concept
Environment Setup
Reproduction (poc.js)
A single script that safely detects the vulnerability using a child process with timeout. The parent process is never at risk of hanging.
Expected Output
node-forge v1.3.1 (latest at time of writing)
Node.js v18.x / v20.x / v22.x
macOS / Linux / Windows
Impact
Availability: An attacker can cause a complete Denial of Service by sending a single crafted input that reaches the modInverse() code path. The Node.js process will hang indefinitely, blocking the event loop and making the application unresponsive to all subsequent requests.
Scope: node-forge is a widely used cryptographic library with millions of weekly downloads on npm. Any application that processes untrusted cryptographic parameters through node-forge may be affected.
Suggested Fix
Add a zero-value check at the entry of bnModInverse() in lib/jsbn.js:
Alternatively, return BigInteger.ZERO if that behavior is preferred, though throwing an error is more mathematically correct and consistent with other BigInteger implementations (e.g., Java's BigInteger.modInverse() throws ArithmeticException).
CVE-2026-33894
Summary
RSASSA PKCS#1 v1.5 signature verification accepts forged signatures for low public exponent keys (e=3). Attackers can forge signatures by stuffing “garbage” bytes within the ASN structure in order to construct a signature that passes verification, enabling Bleichenbacher style forgery. This issue is similar to CVE-2022-24771, but adds bytes in an addition field within the ASN structure, rather than outside of it.
Additionally, forge does not validate that signatures include a minimum of 8 bytes of padding as defined by the specification, providing attackers additional space to construct Bleichenbacher forgeries.
Impacted Deployments
Tested commit:
8e1d527fe8ec2670499068db783172d4fb9012e5Affected versions: tested on v1.3.3 (latest release) and recent prior versions.
Configuration assumptions:
schemeuses RSASSA-PKCS1-v1_5)._parseAllDigestBytes: true(default setting).Root Cause
In
lib/rsa.js,key.verify(...), forge decrypts the signature block, decodes PKCS#1 v1.5 padding (_decodePkcs1_v1_5), parses ASN.1, and comparescapture.digestto the provided digest.Two issues are present with this logic:
_parseAllDigestBytes) only guarantees all bytes are parsed, not that the parsed structure is the canonical minimal DigestInfo shape expected by RFC 8017 verification semantics. A forged EM with attacker-controlled additional ASN.1 content inside the parsed container can still pass forge verification while OpenSSL rejects it._decodePkcs1_v1_5comments mention that PS < 8 bytes should be rejected, but does not implement this logic.Reproduction Steps
v24.9.0) and clonedigitalbazaar/forgeat commit8e1d527fe8ec2670499068db783172d4fb9012e5.repro_min.js) withnode repro_min.jsin the same level as theforgefolder.4096bits,e=3), creates a normal control signature, then computes a forged candidate using cube-root interval construction._parseAllDigestBytes: true), andcrypto.verifywithRSA_PKCS1_PADDING).control-forge-strict: truecontrol-node: trueforgery (forge library, strict): trueforgery (node/OpenSSL): falseProof of Concept
Overview:
_parseAllDigestBytes: true, also forge default).repro_min.js
Suggested Patch
PS >= 8) in_decodePkcs1_v1_5before accepting the block.Here is a Forge-tested patch to resolve the issue, though it should be verified for consumer projects:
Resources
lib/rsa.jskey.verify(...)at lines ~1139-1223.lib/rsa.js_decodePkcs1_v1_5(...)at lines ~1632-1695.Credit
This vulnerability was discovered as part of a U.C. Berkeley security research project by: Austin Chu, Sohee Kim, and Corban Villa.
CVE-2026-33896
Summary
pki.verifyCertificateChain()does not enforce RFC 5280 basicConstraints requirements when an intermediate certificate lacks both thebasicConstraintsandkeyUsageextensions. This allows any leaf certificate (without these extensions) to act as a CA and sign other certificates, which node-forge will accept as valid.Technical Details
In
lib/x509.js, theverifyCertificateChain()function (around lines 3147-3199) has two conditional checks for CA authorization:keyUsagecheck (which includes a sub-check requiringbasicConstraintsto be present) is gated onkeyUsageExt !== nullbasicConstraints.cAcheck is gated onbcExt !== nullWhen a certificate has neither extension, both checks are skipped entirely. The certificate passes all CA validation and is accepted as a valid intermediate CA.
RFC 5280 Section 6.1.4 step (k) requires:
The absence of
basicConstraintsshould result in rejection, not acceptance.Proof of Concept
Results:
basicConstraints.cA=false: correctly rejectedkeyUsage(nokeyCertSign): correctly rejectedAttack Scenario
An attacker who obtains any valid leaf certificate (e.g., a regular TLS certificate for
attacker.com) that lacksbasicConstraintsandkeyUsageextensions can use it to sign certificates for ANY domain. Any application using node-forge'sverifyCertificateChain()will accept the forged chain.This affects applications using node-forge for:
CVE Precedent
This is the same vulnerability class as:
Not a Duplicate
This is distinct from:
Suggested Fix
Add an explicit check for absent
basicConstraintson non-leaf certificates:Disclosure Timeline
Credits
Discovered and reported by Doruk Tan Ozturk (@peaktwilight) — doruk.ch
Release Notes
digitalbazaar/forge (node-forge)
v1.4.0Compare Source
Security
BigInteger.modInverse()the
BigInteger.modInverse()function (inherited from the bundled jsbnlibrary). When
modInverse()is called with a zero value as input, theinternal Extended Euclidean Algorithm enters an unreachable exit condition,
causing the process to hang indefinitely and consume 100% CPU.
public exponent keys (e=3). Attackers can forge signatures by stuffing
"garbage" bytes within the ASN.1 structure in order to construct a
signature that passes verification, enabling Bleichenbacher style forgery.
This issue is similar to CVE-2022-24771, but adds bytes in an addition
field within the ASN.1 structure, rather than outside of it.
8 bytes of padding as defined by the specification, providing attackers
additional space to construct Bleichenbacher forgeries.
Ed25519due to missing S < L check.Ed25519signature verification accepts forged non-canonical signatureswhere the scalar S is not reduced modulo the group order (S >= L). A valid
signature and its S + L variant both verify in forge, while Node.js
crypto.verify (OpenSSL-backed) rejects the S + L variant, as defined by the
specification. This class of signature malleability has been exploited in
practice to bypass authentication and authorization logic (see
CVE-2026-25793, CVE-2022-35961). Applications relying on signature
uniqueness (i.e., dedup by signature bytes, replay tracking, signed-object
canonicalization checks) may be bypassed.
basicConstraintsbypass in certificate chain verification.pki.verifyCertificateChain()does not enforce RFC 5280basicConstraintsrequirements when an intermediate certificate lacks both the
basicConstraintsandkeyUsageextensions. This allows any leafcertificate (without these extensions) to act as a CA and sign other
certificates, which node-forge will accept as valid.
Added
2.5.4.65/pseudonymChanged
jsbn1.4. Sync partly back to original style for easierupdates every decade or so.
Fixed
BigInteger.modInverseto avoid an infinite loop and exit earlywith zero when the target object value is <= 0. Zero may not be strictly
mathematically correct but aligns with current
jsbnbehavior returning zeroin other situations. The alternate of a
RangeErrorwould diverge from therest of the API.
required to be eight octets for block types 1 and 2.
ed25519] Add canonical signature scaler check for S < L.basicConstraintson non-leafcertificates.
v1.3.3Compare Source
Fixed
introduced in 1.3.2.
v1.3.2Compare Source
Security
1.3.1 and below enables remote, unauthenticated attackers to craft ASN.1
structures to desynchronize schema validations, yielding a semantic
divergence that may bypass downstream cryptographic verifications and
security decisions.
1.3.1 and below enables remote, unauthenticated attackers to craft deep
ASN.1 structures that trigger unbounded recursive parsing. This leads to a
Denial-of-Service (DoS) via stack exhaustion when parsing untrusted DER
inputs.
and below enables remote, unauthenticated attackers to craft ASN.1
structures containing OIDs with oversized arcs. These arcs may be decoded
as smaller, trusted OIDs due to 32-bit bitwise truncation, enabling the
bypass of downstream OID-based security decisions.
Fixed
verification bypass due to missing macData enforcement and improper
asn1.validate routine.
fromDer()max recursion depth check.asn1.maxDepthglobal configurable maximum depth of 256.asn1.fromDer()per-callmaxDepthoption.data. If this assumption is false then this could be a breaking change.
Please file an issue if there are use cases that need a higher maximum.
maxDepthparameter has not been exposed up throughall of the API stack due to the complexities involved. Please file an issue
if there are use cases that require this instead of changing the default
maximum.
2**32 - 1.2**53 - 1.v1.3.1Compare Source
Security
1.3.1 and below enables remote, unauthenticated attackers to craft ASN.1
structures to desynchronize schema validations, yielding a semantic
divergence that may bypass downstream cryptographic verifications and
security decisions.
1.3.1 and below enables remote, unauthenticated attackers to craft deep
ASN.1 structures that trigger unbounded recursive parsing. This leads to a
Denial-of-Service (DoS) via stack exhaustion when parsing untrusted DER
inputs.
and below enables remote, unauthenticated attackers to craft ASN.1
structures containing OIDs with oversized arcs. These arcs may be decoded
as smaller, trusted OIDs due to 32-bit bitwise truncation, enabling the
bypass of downstream OID-based security decisions.
Fixed
verification bypass due to missing macData enforcement and improper
asn1.validate routine.
fromDer()max recursion depth check.asn1.maxDepthglobal configurable maximum depth of 256.asn1.fromDer()per-callmaxDepthoption.data. If this assumption is false then this could be a breaking change.
Please file an issue if there are use cases that need a higher maximum.
maxDepthparameter has not been exposed up throughall of the API stack due to the complexities involved. Please file an issue
if there are use cases that require this instead of changing the default
maximum.
2**32 - 1.2**53 - 1.v1.3.0Compare Source
Security
Yahyazadeh (moosa-yahyazadeh@uiowa.edu).
digestAlgorithmstructure can lead tosignature forgery.
allow a crafted structure that steals padding bytes and uses unchecked
portion of the PKCS#1 encoded message to forge a signature when a low
public exponent is being used. For more information, please see
"Bleichenbacher's RSA signature forgery based on implementation
error"
by Hal Finney.
forgery.
DigestInfoASN.1 structure. This can allow padding bytes to be removedand garbage data added to forge a signature when a low public exponent is
being used. For more information, please see "Bleichenbacher's RSA
signature forgery based on implementation
error"
by Hal Finney.
DigestInfois not properly checked for proper ASN.1 structure. This canlead to successful verification with signatures that contain invalid
structures but a valid digest.
Fixed
fromDeris now more strict and will default to ensuring all inputbytes are parsed or throw an error. A new option
parseAllBytescan disablethis behavior.
security issues with crafted inputs. It is possible that code doing custom
DER parsing may need to adapt to this new behavior and optional flag.
RSASSA-PKCS-v1_5DigestInfodata. Additionally check that the hashalgorithm identifier is a known value from RFC 8017
PKCS1-v1-5DigestAlgorithms. An invalidDigestInfoor algorithm identifierwill now throw an error.
since it could lead to security issues with crafted inputs. It is possible
th
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.