CVE-2025-66865
Executive Summary
CVE-2025-66865 is a denial-of-service (DoS) vulnerability in the GNU Binutils library, specifically within the d_print_comp_inner function in the cp-demangle.c file. The flaw is triggered when processing a crafted Portable Executable (PE) file, leading to a crash or hang. The vulnerability affects Binutils version 2.26. No official patch has been released, and no public proof-of-concept (PoC) or exploit code is available at this time. The EPSS score is 0.0%, indicating a very low probability of exploitation in the wild. This is a memory safety issue (likely a NULL pointer dereference or infinite recursion) that can be used by an attacker to disrupt services that rely on Binutils for PE file processing.
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
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0, which is likely a placeholder. Based on the description and CWE-476 (NULL Pointer Dereference), a reasonable CVSS v3.1 vector would be:
- Attack Vector (AV): Local (L) – requires the attacker to provide a crafted PE file.
- Attack Complexity (AC): Low (L) – no special conditions.
- Privileges Required (PR): None (N) – no authentication needed.
- User Interaction (UI): Required (R) – victim must process the file.
- Scope (S): Unchanged (U) – only the vulnerable component is affected.
- Confidentiality (C): None (N) – no data leak.
- Integrity (I): None (N) – no data modification.
- Availability (A): High (H) – service crash or hang.
Estimated CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
Estimated Base Score: 5.5 (Medium)
Threat Level: Medium. The vulnerability requires local access and user interaction, but can cause a denial of service. No active exploitation has been observed.
Deep Dive & Mechanics
The vulnerability resides in the d_print_comp_inner function within cp-demangle.c. This function is part of the C++ name demangling routine used by Binutils tools (e.g., objdump, nm, size) when processing object files, including PE files. The function recursively traverses a tree structure representing a mangled name. A crafted PE file can cause the function to enter an infinite recursion or dereference a NULL pointer, leading to a stack overflow or segmentation fault.
Root Cause: The function does not properly validate the depth or structure of the demangling tree. An attacker can craft a PE file with a deeply nested or malformed mangled name that causes the recursive function to exceed stack limits or access invalid memory.
Attack Vector: An attacker delivers a malicious PE file to a victim. When the victim uses a Binutils tool (e.g., objdump -d malicious.exe) to analyze the file, the vulnerable code path is triggered, causing the tool to crash or hang.
Impact: Denial of service. The tool becomes unavailable for legitimate use. In automated environments (e.g., malware analysis sandboxes), this can disrupt operations.
Vulnerable vs. Patched Code
Vulnerable Code (Binutils 2.26, cp-demangle.c):
The d_print_comp_inner function lacks depth or recursion guards. A simplified representation:
static void d_print_comp_inner (struct d_print_info *dpi, int options, struct demangle_component *dc) {
if (dc == NULL) return;
switch (dc->type) {
case DEMANGLE_COMPONENT_NAME:
// ... print name
break;
case DEMANGLE_COMPONENT_QUAL_NAME:
d_print_comp_inner(dpi, options, dc->u.s_binary.left);
d_print_comp_inner(dpi, options, dc->u.s_binary.right);
break;
// ... many other cases
}
}
Patched Code (Hypothetical): A patch would add a recursion depth counter and a maximum depth limit:
#define MAX_DEMANGLE_DEPTH 1024
static void d_print_comp_inner (struct d_print_info *dpi, int options, struct demangle_component *dc, unsigned int depth) {
if (dc == NULL) return;
if (depth > MAX_DEMANGLE_DEPTH) {
// Error handling: abort or return
return;
}
switch (dc->type) {
case DEMANGLE_COMPONENT_QUAL_NAME:
d_print_comp_inner(dpi, options, dc->u.s_binary.left, depth + 1);
d_print_comp_inner(dpi, options, dc->u.s_binary.right, depth + 1);
break;
// ...
}
}
Note: No official patch has been released. The above is a recommended fix.
Exploitation & Lab Setup
Red Team
Objective: Cause a denial of service on a system running Binutils 2.26.
Lab Setup:
- Environment: Ubuntu 16.04 or any Linux distribution with Binutils 2.26 installed.
- Tool:
objdump(part of Binutils). - Crafted PE File: Create a PE file with a deeply nested mangled C++ symbol. This can be done by:
- Compiling a C++ program with a deeply nested namespace/class structure.
- Manually editing the PE file's symbol table to include a malformed mangled name.
- Using a fuzzer (e.g., AFL) to generate a crashing input.
Exploitation Steps:
- Transfer the crafted PE file to the target system.
- Execute:
objdump -d crafted_pe_file.exe - Observe the tool crash (segmentation fault) or hang indefinitely.
Expected Outcome: The objdump process terminates unexpectedly, causing a denial of service for that specific analysis task.
Blue Team
Detection:
- Monitor for crashes of Binutils tools (
objdump,nm,size,strings). - Use process monitoring to detect abnormal termination signals (SIGSEGV, SIGABRT).
- Analyze core dumps to identify the crash location in
cp-demangle.c.
Prevention:
- Upgrade to a patched version of Binutils (when available).
- Use a sandboxed environment for processing untrusted PE files.
- Implement resource limits (e.g.,
ulimit -sto limit stack size) to mitigate stack overflow.
Hunting:
- Search for PE files with unusually long or deeply nested symbol names.
- Correlate crashes of Binutils tools with recent file processing events.
Indicators of Compromise (IOCs)
- File Hashes (SHA256): (No known samples yet)
- Process Names:
objdump,nm,size,strings(crashing) - Error Logs: Segmentation fault in
d_print_comp_inneratcp-demangle.c - Network: None (local vulnerability)
- Registry: None
Detection Engineering
YARA Rule
rule CVE_2025_66865_Binutils_PE_Demangle_DoS {
meta:
description = "Detects crafted PE files targeting CVE-2025-66865 in Binutils"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-66865"
hash = "unknown"
strings:
$mangled_pattern = /_Z[A-Za-z0-9_]+/ // Simplified mangled name pattern
$deep_nesting = /_Z[^ ]{1024,}/ // Very long mangled name (potential trigger)
condition:
uint16(0) == 0x5A4D and // MZ header
$deep_nesting
}
Sigma Rule
title: Binutils Tool Crash Due to Crafted PE File
id: 7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e
status: experimental
description: Detects crashes of Binutils tools (objdump, nm, size) likely caused by CVE-2025-66865
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith:
- '/objdump'
- '/nm'
- '/size'
- '/strings'
ExitCode: -11 # SIGSEGV
condition: selection
falsepositives:
- Legitimate crashes due to other bugs
level: medium
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-66865 Potential Binutils DoS via PE File Transfer"; flow:to_server; file_data; content:"MZ"; within:2; content:"|00 00 00 00|"; distance:0; pcre:"/_Z[^ ]{1024,}/"; classtype:attempted-dos; sid:1000001; rev:1;)
Note: The Suricata rule is a heuristic detection for PE files with very long mangled names being transferred over the network. It may generate false positives.
Remediation & Mitigation
Immediate Actions:
- Isolate: Do not process untrusted PE files with Binutils 2.26.
- Monitor: Watch for crashes of Binutils tools and investigate the triggering files.
- Workaround: Use alternative tools (e.g.,
readelf,llvm-objdump) for PE file analysis.
Long-Term Fix:
- Apply a patch from the Binutils maintainers when available.
- If patching is not possible, apply the code fix described in the "Vulnerable vs. Patched Code" section (add recursion depth limit).
- Upgrade to a newer version of Binutils (e.g., 2.27 or later) that may have addressed this issue.
Detection:
- Deploy the YARA, Sigma, and Suricata rules provided in the Detection Engineering section.
- Enable core dumps and analyze them for crashes in
d_print_comp_inner.
Valters IT
DevSecOps & Cyber Threat Intelligence