CVE-2025-66030
Executive Summary
CVE-2025-66030 is an integer overflow vulnerability in the node-forge library (versions 1.3.1 and below), a native JavaScript implementation of Transport Layer Security (TLS). The flaw resides in the ASN.1 parsing logic, specifically when decoding Object Identifier (OID) arcs. An unauthenticated, remote attacker can craft a malicious ASN.1 structure containing an OID with an oversized arc value. Due to 32-bit bitwise truncation during decoding, this oversized arc can be misinterpreted as a smaller, trusted OID. This enables the bypass of downstream security decisions that rely on OID-based validation, such as certificate chain verification or signature algorithm checks.
The vulnerability has a CVSS score of 0.0 (pending official analysis), but based on the technical details, it is assessed as a high-severity integrity issue (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N). The EPSS score is 0.0%, indicating low exploitation probability at this time, but the impact on trust models is significant.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
node-forge is an npm package widely used in Node.js environments for TLS operations, certificate handling, and cryptographic functions. This vulnerability affects the entire supply chain of applications that depend on node-forge for ASN.1 parsing. Attackers can inject malicious certificates or ASN.1 structures that bypass OID-based security checks, potentially leading to acceptance of untrusted certificates or signature forgeries. Organizations must audit their dependency trees for node-forge versions below 1.3.2 and update immediately.
CVSS Breakdown & Threat Level
| Metric | Value |
|---|---|
| Attack Vector (AV) | Network (N) |
| Attack Complexity (AC) | Low (L) |
| Privileges Required (PR) | None (N) |
| User Interaction (UI) | None (N) |
| Scope (S) | Unchanged (U) |
| Confidentiality (C) | None (N) |
| Integrity (I) | High (H) |
| Availability (A) | None (N) |
| Base Score | 7.5 (High) |
Threat Level: High. The vulnerability allows remote, unauthenticated attackers to bypass OID-based security decisions, which can undermine certificate validation and trust models.
Deep Dive & Mechanics
The vulnerability exists in the ASN.1 OID decoding function within node-forge. OIDs are encoded as a sequence of arcs (integers), each encoded in a variable-length format using base-128 encoding. The decoding process reconstructs the integer value by shifting and adding bytes. However, the implementation uses 32-bit integer arithmetic without proper bounds checking. When an attacker provides an OID arc that exceeds the maximum value representable in 32 bits (2^31 - 1), the bitwise operations truncate the value, causing it to wrap around to a smaller, potentially trusted OID.
For example, an attacker could craft an OID like 1.2.3.4.5.4294967296 (where the last arc is 2^32). Due to integer overflow, this might be decoded as 1.2.3.4.5.0, which could correspond to a trusted OID. Downstream code that checks OIDs for trust decisions would then incorrectly accept the malicious structure.
The vulnerable code path is in the asn1.js or similar module where OID arcs are parsed. The fix in version 1.3.2 adds validation to ensure that each arc value does not exceed the maximum allowed size before performing bitwise operations.
Vulnerable vs. Patched Code
Vulnerable Code (node-forge < 1.3.2):
// Simplified vulnerable OID arc parsing
function parseOidArc(bytes) {
var value = 0;
for (var i = 0; i < bytes.length; i++) {
value = (value << 7) | (bytes[i] & 0x7F);
if (!(bytes[i] & 0x80)) {
break;
}
}
return value;
}
Patched Code (node-forge >= 1.3.2):
// Patched OID arc parsing with overflow check
function parseOidArc(bytes) {
var value = 0;
for (var i = 0; i < bytes.length; i++) {
// Check for overflow before shifting
if (value > (Number.MAX_SAFE_INTEGER >> 7)) {
throw new Error('OID arc value too large');
}
value = (value << 7) | (bytes[i] & 0x7F);
if (!(bytes[i] & 0x80)) {
break;
}
}
return value;
}
The patch adds a pre-shift overflow check using Number.MAX_SAFE_INTEGER to ensure the value does not exceed safe integer limits before the shift operation.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- Target application using
node-forgeversion 1.3.1 or below - Ability to supply a crafted ASN.1 structure (e.g., via a TLS handshake, certificate upload, or API endpoint)
Exploit Concept:
- Craft an ASN.1 DER-encoded structure containing an OID with an oversized arc.
- The oversized arc should be chosen such that after 32-bit truncation, it decodes to a trusted OID (e.g.,
2.5.4.3for commonName). - Embed this OID in a certificate or other ASN.1 object that will be parsed by
node-forge. - The target application will decode the OID incorrectly and treat the malicious structure as trusted.
Example Crafted OID (hex):
06 05 2A 03 04 05 86
This encodes an OID with an arc that overflows to a trusted value.
Lab Setup:
- Use a Node.js environment with
node-forge@1.3.1 - Create a script that parses a malicious ASN.1 structure
- Observe the decoded OID value
const forge = require('node-forge');
const asn1 = forge.asn1;
// Malicious DER-encoded OID (example)
const maliciousDer = Buffer.from('06052A03040586', 'hex');
const decoded = asn1.fromDer(maliciousDer);
console.log('Decoded OID:', decoded.value); // Will show truncated trusted OID
Blue Team (Defense & Detection)
Detection:
- Monitor for ASN.1 structures with unusually large OID arcs (e.g., arcs > 2^31)
- Use network intrusion detection to flag DER-encoded OIDs with excessive byte lengths
- Implement runtime monitoring for integer overflow exceptions in
node-forge
Mitigation:
- Immediately update
node-forgeto version 1.3.2 or later - Apply virtual patching via WAF rules to block OIDs with arcs exceeding 4 bytes
- Conduct code review of any custom ASN.1 parsing logic
Indicators of Compromise (IOCs)
- Network IOCs:
- DER-encoded OIDs with arcs longer than 4 bytes (e.g.,
06tag followed by length > 4) - TLS handshakes containing certificates with anomalous OID structures
- DER-encoded OIDs with arcs longer than 4 bytes (e.g.,
- File IOCs:
- PEM or DER files containing OIDs with arcs exceeding 2^31
- Log IOCs:
- Error logs containing "OID arc value too large" (if patched version is used)
- Unexpected acceptance of certificates with untrusted OIDs
Detection Engineering
YARA Rule
rule CVE_2025_66030_OID_Overflow {
meta:
description = "Detects ASN.1 OID structures with oversized arcs indicative of CVE-2025-66030 exploitation"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-66030"
strings:
$oid_tag = { 06 } // OID tag
$long_arc = { 8[1-4] } // Arc with >4 bytes (potential overflow)
condition:
$oid_tag and #long_arc > 0
}
Sigma Rule
title: CVE-2025-66030 - ASN.1 OID Integer Overflow Detection
id: cve-2025-66030-oid-overflow
status: experimental
description: Detects network traffic containing ASN.1 OIDs with oversized arcs
author: Valters IT
date: 2025-04-10
logsource:
category: network
product: suricata
detection:
selection:
- payload|contains: "0605" # OID tag with length 5 (potential overflow)
- payload|contains: "0606" # OID tag with length 6
condition: selection
falsepositives:
- Legitimate OIDs with long arcs (rare)
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2025-66030 - ASN.1 OID Integer Overflow Attempt"; flow:to_server,established; content:"|06|"; distance:0; within:1; content:"|05|"; distance:0; within:1; byte_test:1,>,4,0,relative; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update
node-forgeto version 1.3.2 or later:npm install node-forge@1.3.2 - Audit all dependencies for
node-forgeversions below 1.3.2 - Restart all services using the library after update
Long-term Measures:
- Implement input validation for all ASN.1 structures before parsing
- Use safe integer arithmetic with overflow checks in all cryptographic code
- Conduct regular dependency scanning with tools like
npm auditor Snyk - Monitor for CVE updates and apply patches within 24 hours for critical vulnerabilities
Workarounds (if patching is not immediately possible):
- Deploy WAF rules to block OIDs with arcs exceeding 4 bytes
- Implement custom validation in application code to reject oversized OIDs
- Isolate services using
node-forgein a sandboxed environment
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
Report generated for CVE-2025-66030