{"id":"CVE-2026-118775","aliases":["GHSA-4642-5mcj-2rqw"],"title":"Forge: ASN.1 OID first arc truncation in asn1.oidToDer","titleSource":"GitHub_M","descriptionSource":"OSV","declaredSeverity":"LOW","description":"### Summary\n\n`asn1.oidToDer()` did not range-check the first two arcs of an OID string, so an OID such as `0.42.840.113549.1.1.1` or `4294977127.18.840.113549.1.1.1` was encoded as the DER of a different OID (here rsaEncryption, `1.2.840.113549.1.1.1`). This is an incomplete fix of CVE-2025-66030. Fixed in node-forge 1.4.1.\n\n### Details\n\nX.690 section 8.19 encodes the first two arcs of an OID as one subidentifier, `40 * arc1 + arc2`, where the first arc is 0, 1 or 2 and the second arc is at most 39 when the first is 0 or 1. `asn1.oidToDer()` in `lib/asn1.js` computed that value with no range check and wrote it with `putByte()`, which keeps only the low 16 bits. Out-of-range first arcs therefore produced the encoding of a different OID: `0.42.840.113549.1.1.1` gives `40 * 0 + 42 = 42` and `4294977127.18.840.113549.1.1.1` wraps to 42, both the first byte of rsaEncryption. The fix for CVE-2025-66030 (GHSA-65ch-62r8-g69g, node-forge 1.3.2) added a 32-bit check for the later arcs only.\n\nA related encoding bug made valid OIDs with a first subidentifier above 127 (`2.48` and higher, e.g. `2.999`) encode and decode incorrectly, because the first subidentifier was always written and read as a single byte.\n\nThe fix rejects out-of-range first arcs and encodes and decodes the first subidentifier in base 128 like the others (the latter from public PR #1148).\n\n### Patches\nFixed in node-forge 1.4.1. `asn1.oidToDer()` throws for OIDs with out-of-range first arcs, and the first subidentifier is encoded and decoded correctly.\n\n### Workarounds\nValidate OID strings from untrusted input before passing them to node-forge: the first arc must be 0, 1 or 2, and the second arc at most 39 when the first arc is 0 or 1.\n\n### Credits\nReported by wzc. The first subidentifier encoding fix is from PR #1148 by @spokodev.\n\n### Proof of concept\n\n    var forge = require('node-forge');\n    var der = forge.asn1.oidToDer('0.42.840.113549.1.1.1');\n    console.log(der.toHex()); // 2a864886f70d010101\n    console.log(forge.asn1.derToOid(der)); // 1.2.840.113549.1.1.1\n\nOn 1.4.0 the out-of-range OID string encodes to exactly the DER of rsaEncryption (the same happens with `4294977127.18.840.113549.1.1.1`). On 1.4.1 `oidToDer()` throws \"Invalid OID; the first two arcs are out of range.\".\n\nRegression tests are in tests/unit/asn1.js (\"should reject OIDs with out of range first arcs\").\n\n### Impact\n\nApplications that accept OID strings from untrusted input, check or authorize them as strings, and then encode them with node-forge (for example when building certificates, CSRs or other ASN.1 structures from user-supplied extension or attribute OIDs) can be made to emit a different, trusted OID than the one that was checked. Parsing DER is not affected. There is no confidentiality or availability impact.","severity":"low","score":3.7,"published":"2026-10-29T18:35:33.776Z","modified":"2026-10-30T23:15:04.474Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"npm","name":"node-forge","sources":[{"name":"OSV · GHSA-4642-5mcj-2rqw","url":"https://osv.dev/vulnerability/GHSA-4642-5mcj-2rqw"}],"ranges":[{"events":[{"introduced":"0"},{"fixed":"1.4.1"}],"type":"SEMVER"}],"versions":[],"fixed":["1.4.1"]}],"sourceAffected":[],"references":["https://github.com/digitalbazaar/forge/security/advisories/GHSA-4642-5mcj-2rqw","https://github.com/digitalbazaar/forge/commit/e56a3dde8e4e63bae566bb32546eeaf92f515e1e","https://github.com/digitalbazaar/forge/releases/tag/v1.4.1","https://nvd.nist.gov/vuln/detail/CVE-2026-118775","https://github.com/digitalbazaar/forge"],"sources":[{"name":"CVE","id":"CVE-2026-118775","modified":"2026-10-29T20:22:06.327Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-118775"},{"name":"OSV","id":"GHSA-4642-5mcj-2rqw","modified":"2026-10-30T23:15:04.474856550Z","url":"https://osv.dev/vulnerability/GHSA-4642-5mcj-2rqw"}],"assessments":[{"source":"GitHub_M","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N","score":3.7},{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N","score":3.7}],"cve":{"records":[{"id":"CVE-2026-118775","source":"GitHub_M","state":"PUBLISHED","reasons":[],"replacements":[],"disputed":false,"unsupportedWhenAssigned":false,"reserved":"2026-10-28T19:20:05.018Z","published":"2026-10-29T18:35:33.776Z","modified":"2026-10-29T20:22:06.327Z"}],"publishers":[{"name":"GitHub_M","role":"CNA","organizationId":"a0819718-46f1-4df5-94e2-005712e83aaa","modified":"2026-10-29T18:35:33.776Z"},{"name":"CISA-ADP","role":"ADP","organizationId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","modified":"2026-10-29T20:22:06.327Z"}],"references":[{"url":"https://github.com/digitalbazaar/forge/security/advisories/GHSA-4642-5mcj-2rqw","tags":["x_refsource_CONFIRM"],"source":"GitHub_M"},{"url":"https://github.com/digitalbazaar/forge/commit/e56a3dde8e4e63bae566bb32546eeaf92f515e1e","tags":["x_refsource_MISC"],"source":"GitHub_M"},{"url":"https://github.com/digitalbazaar/forge/releases/tag/v1.4.1","tags":["x_refsource_MISC"],"source":"GitHub_M"},{"url":"https://github.com/digitalbazaar/forge/security/advisories/GHSA-4642-5mcj-2rqw","tags":["exploit"],"source":"CISA-ADP"}],"weaknesses":[{"id":"CWE-190","description":"CWE-190: Integer Overflow or Wraparound","source":"GitHub_M"}],"applicability":[],"prioritization":[{"source":"CISA-ADP","type":"SSVC","role":"CISA Coordinator","timestamp":"2026-10-29T20:21:35.966507Z","decisions":[{"name":"Exploitation","value":"poc"},{"name":"Automatable","value":"no"},{"name":"Technical Impact","value":"partial"}]}]},"products":[{"vendor":"digitalbazaar","name":"forge","platforms":[],"versions":[{"version":"< 1.4.1","status":"affected"}],"cpes":[],"source":"GitHub_M","url":"https://www.cve.org/CVERecord?id=CVE-2026-118775"}],"remediation":[],"observedAt":"2026-10-30T23:33:20.450Z","kev":{"status":"not-listed","checkedAt":"2026-10-31T09:10:30.844Z"},"coverage":[{"source":"NVD","status":"no-result","checkedAt":"2026-10-29T19:05:33.068Z","attemptedAt":"2026-10-29T19:05:33.068Z"},{"source":"GHSA","status":"no-result","checkedAt":"2026-10-29T19:05:33.068Z","attemptedAt":"2026-10-29T19:05:33.068Z"},{"source":"EUVD","status":"available","checkedAt":"2026-10-29T19:05:33.068Z","attemptedAt":"2026-10-29T19:05:33.068Z"},{"source":"EPSS","status":"no-result","checkedAt":"2026-10-29T19:05:33.068Z","attemptedAt":"2026-10-29T19:05:33.068Z"}],"evidence":[{"source":"ENISA EUVD","id":"EUVD-2026-113332","url":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-113332","modified":"Oct 29, 2026, 6:35:33 PM","score":3.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N","checkedAt":"2026-10-29T19:05:33.068Z"}],"aiSummary":null}