{"vuln_id":"CVE-2022-24771","aliases":[],"description":"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.","published_at":"2022-03-18T14:15:10.280000Z","modified_at":"2026-06-17T04:32:29.013000Z","first_seen_at":"2026-11-21T19:15:56.718577Z","severity":"high","severity_source":"nvd","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","cwe":["CWE-347"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00779,"epss_percentile":0.56837,"nvd_status":"Modified","enriched_at":"2026-11-22T10:13:38.767582Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2022-24771"},"matched_alias":null,"items":[{"id":10873,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-ppp5-5v6c-4jwp: Forge has signature forgery in RSA-PKCS due to ASN.1 extra field","summary":"Forge has signature forgery in RSA-PKCS due to ASN.1 extra field\n\n## Summary\nRSASSA 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. \n\nAdditionally, 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. \n\n## Impacted Deployments\n**Tested commit:** `8e1d527fe8ec2670499068db783172d4fb9012e5`\n**Affected versions:** tested on v1.3.3 (latest release) and recent prior versions.\n\n**Configuration assumptions:**\n- Invoke key.verify with defaults (default `scheme` uses RSASSA-PKCS1-v1_5).\n- `_parseAllDigestBytes: true` (default setting).\n\n## Root Cause\n\nIn `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.\n\nTwo issues are present with this logic:\n\n1. 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.\n2. `_decodePkcs1_v1_5` comments mention that PS < 8 bytes should be rejected, but does not implement this logic.\n\n## Reproduction Steps\n1. Use Node.js (tested with `v24.9.0`) and clone `digitalbazaar/forge` at commit `8e1d527fe8ec2670499068db783172d4fb9012e5`.\n4. Place and run the PoC script (`repro_min.js`) with `node repro_min.js` in the same level as the `forge` folder.\n5. 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.\n6. The script verifies both signatures with:\n  - forge verify (`_parseAllDigestBytes: true`), and\n  - Node/OpenSSL verify (`crypto.verify` with `RSA_PKCS1_PADDING`).\n7. Confirm output includes:\n  - `control-forge-strict: true`\n  - `control-node: true`\n  - `forgery (forge library, strict): true`\n  - `forgery (node/OpenSSL): false`\n\n## Proof of Concept\n\n**Overview:**\n- Demonstrates a valid control signature and a forged signature in one run.\n- Uses strict forge parsing mode explicitly (`_parseAllDigestBytes: true`, also forge default).\n- Uses Node/OpenSSL as an differential verification baseline.\n- Observed output on tested commit:\n\n```text\ncontrol-fo\n\nAffected: npm:node-forge\n\nFixed in: 1.4.0\n\nReferences:\nhttps://github.com/digitalbazaar/forge/security/advisories/GHSA-cfm4-qjh2-4765\nhttps://github.com/digitalbazaar/forge/security/advisories/GHSA-ppp5-5v6c-4jwp\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-33894\nhttps://datatracker.ietf.org/doc/html/rfc2313#section-8\nhttps://github.com/digitalbazaar/forge\nhttps://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE\nhttps://www.rfc-editor.org/rfc/rfc8017.html","url":"https://osv.dev/vulnerability/GHSA-ppp5-5v6c-4jwp","published_at":"2026-03-26T22:02:35Z","updated_at":"2026-11-21T20:10:57.942510Z","fetched_at":"2026-11-21T19:15:55.946236Z","severity":"high","cvss_score":8.7,"epss":0.00779,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"node-forge","vuln_id":"CVE-2026-33894","vuln_ids":["CVE-2022-24771","CVE-2026-33894","CVE-2026-85393","GHSA-2G46-22MC-6GWP","GHSA-86W9-CPQP-85RV","GHSA-CFM4-QJH2-4765","GHSA-PPP5-5V6C-4JWP"],"tags":["osv","npm","fix-available"],"cluster_id":3743,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10873","html":"https://vulnwatch.ve1ve2.com/item/10873"}}]}