VulnWatch by ve1ve2
high 8.7 EPSS 0.78%

GHSA-ppp5-5v6c-4jwp: Forge has signature forgery in RSA-PKCS due to ASN.1 extra field

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
node-forge

https://osv.dev/vulnerability/GHSA-ppp5-5v6c-4jwp ↗

osvnpmfix-available

Forge has signature forgery in RSA-PKCS due to ASN.1 extra field ## 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](https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE/). This issue is similar to [CVE-2022-24771](https://github.com/digitalbazaar/forge/security/advisories/GHSA-cfm4-qjh2-4765), 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](https://datatracker.ietf.org/doc/html/rfc2313#section-8), providing attackers additional space to construct Bleichenbacher forgeries. ## Impacted Deployments **Tested commit:** `8e1d527fe8ec2670499068db783172d4fb9012e5` **Affected versions:** tested on v1.3.3 (latest release) and recent prior versions. **Configuration assumptions:** - Invoke key.verify with defaults (default `scheme` uses 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 compares `capture.digest` to the provided digest. Two issues are present with this logic: 1. Strict DER byte-consumption (`_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. 2. `_decodePkcs1_v1_5` comments mention that PS < 8 bytes should be rejected, but does not implement this logic. ## Reproduction Steps 1. Use Node.js (tested with `v24.9.0`) and clone `digitalbazaar/forge` at commit `8e1d527fe8ec2670499068db783172d4fb9012e5`. 4. Place and run the PoC script (`repro_min.js`) with `node repro_min.js` in the same level as the `forge` folder. 5. The script generates a fresh RSA keypair (`4096` bits, `e=3`), creates a normal control signature, then computes a forged candidate using cube-root interval construction. 6. The script verifies both signatures with: - forge verify (`_parseAllDigestBytes: true`), and - Node/OpenSSL verify (`crypto.verify` with `RSA_PKCS1_PADDING`). 7. Confirm output includes: - `control-forge-strict: true` - `control-node: true` - `forgery (forge library, strict): true` - `forgery (node/OpenSSL): false` ## Proof of Concept **Overview:** - Demonstrates a valid control signature and a forged signature in one run. - Uses strict forge parsing mode explicitly (`_parseAllDigestBytes: true`, also forge default). - Uses Node/OpenSSL as an differential verification baseline. - Observed output on tested commit: ```text control-fo Affected: npm:node-forge Fixed in: 1.4.0 References: https://github.com/digitalbazaar/forge/security/advisories/GHSA-cfm4-qjh2-4765 https://github.com/digitalbazaar/forge/security/advisories/GHSA-ppp5-5v6c-4jwp https://nvd.nist.gov/vuln/detail/CVE-2026-33894 https://datatracker.ietf.org/doc/html/rfc2313#section-8 https://github.com/digitalbazaar/forge https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE https://www.rfc-editor.org/rfc/rfc8017.html

Linked vulnerabilities (6)

CVE-2026-85393 high 8.7 EPSS 0.26% (p18) NVDCVE.orgGHSAGHSAGHSAGHSA
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

node-forge through 1.4.0 fails to validate element count in nested DigestAlgorithm sequences during RSA PKCS#1 v1.5 signature verification. Attackers can embed garbage bytes inside the DigestAlgorithm sequence to forge valid signatures for arbitrary messages using low-exponent RSA keys. This is an incomplete fix for CVE-2026-33894.

CWE: CWE-347, CWE-20Aliases: CVE-2026-33894, GHSA-ppp5-5v6c-4jwp, GHSA-2g46-22mc-6gwp, GHSA-86w9-cpqp-85rv, CVE-2022-24771, GHSA-cfm4-qjh2-4765NVD: Deferred
CVE-2026-33894 high 7.5 EPSS 0.51% (p45) NVDCVE.orgGHSAGHSAGHSA
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Forge has signature forgery in RSA-PKCS due to ASN.1 extra field

CWE: CWE-20, CWE-347Aliases: GHSA-ppp5-5v6c-4jwp, CVE-2026-85393, GHSA-86w9-cpqp-85rv, CVE-2022-24771, GHSA-cfm4-qjh2-4765
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Forge has signature forgery in RSA-PKCS due to ASN.1 extra field

CWE: CWE-20, CWE-347Aliases: CVE-2026-33894, CVE-2026-85393, GHSA-86w9-cpqp-85rv, CVE-2022-24771, GHSA-cfm4-qjh2-4765
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Forge has signature forgery in RSA-PKCS due to ASN.1 extra field

CWE: CWE-20, CWE-347Aliases: GHSA-ppp5-5v6c-4jwp, CVE-2026-33894, CVE-2026-85393, CVE-2022-24771, GHSA-cfm4-qjh2-4765
CVE-2022-24771 high 7.5 EPSS 0.78% (p57) NVDCVE.org
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Forge (also called `node-forge`) is a native implementation of Transport Layer Security in JavaScript. Prior to version 1.3.0, 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. The issue has been addressed in `node-forge` version 1.3.0. There are currently no known workarounds.

CWE: CWE-347NVD: Modified