CVE-2025-9019
Executive Summary
CVE-2025-9019 is a heap-based buffer overflow vulnerability in the mask_cidr6 function within the cidr.c file of the tcpprep component of tcpreplay version 4.5.1. The vulnerability allows a remote attacker to trigger a heap-based buffer overflow by sending a specially crafted packet. The attack complexity is high, and exploitation is considered difficult. The vulnerability has been publicly disclosed, and a proof-of-concept exists. The issue has been patched in version 4.5.2.
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 affects the tcpreplay package, which is commonly distributed via package managers (e.g., apt, yum, brew) and source code repositories. Users are advised to update to version 4.5.2 or later. The package is not an NPM, PyPI, Go, or Ruby package, but it is a critical network tool used in security testing and network analysis.
CVSS Breakdown & Threat Level
- CVSS Score: 3.1 (Low)
- Attack Vector (AV): Network (N)
- Attack Complexity (AC): High (H)
- Privileges Required (PR): None (N)
- User Interaction (UI): None (N)
- Scope (S): Unchanged (U)
- Confidentiality (C): None (N)
- Integrity (I): None (N)
- Availability (A): Low (L)
The low CVSS score reflects the high attack complexity and limited impact (availability only). However, the public disclosure of the exploit increases the risk.
Deep Dive & Mechanics
The vulnerability resides in the mask_cidr6 function in cidr.c. This function is responsible for processing IPv6 CIDR (Classless Inter-Domain Routing) masks. The heap-based buffer overflow occurs due to improper bounds checking when handling a crafted IPv6 CIDR mask. An attacker can send a specially crafted packet that, when processed by tcpprep, causes the function to write beyond the allocated heap buffer.
The attack is initiated remotely, meaning an attacker can send a malicious packet over the network to a system running tcpreplay (specifically tcpprep). The high attack complexity suggests that the attacker needs to craft a specific packet that bypasses initial validation checks.
The maintainer confirmed that this issue was a duplicate of a previously fixed bug in version 4.5.2-beta1, and the fix is included in the official 4.5.2 release.
Vulnerable vs. Patched Code
The vulnerable code is in the mask_cidr6 function in cidr.c. The patched code (in version 4.5.2) includes proper bounds checking to prevent the heap buffer overflow.
Vulnerable Code (4.5.1):
// Simplified vulnerable code
void mask_cidr6(struct cidr *cidr, int mask) {
// No bounds check on mask value
for (int i = 0; i < mask; i++) {
// Write to heap buffer without checking size
cidr->addr6[i] = ...;
}
}
Patched Code (4.5.2):
// Simplified patched code
void mask_cidr6(struct cidr *cidr, int mask) {
// Added bounds check
if (mask > MAX_MASK_LENGTH) {
// Handle error
return;
}
for (int i = 0; i < mask; i++) {
// Safe write
cidr->addr6[i] = ...;
}
}
Exploitation & Lab Setup
Red Team
The exploit for CVE-2025-9019 involves crafting a malicious IPv6 packet with a specially crafted CIDR mask. The attacker sends this packet to a system running tcpreplay (specifically tcpprep). The exploit is publicly available and can be used to cause a denial of service (heap-based buffer overflow).
Lab Setup:
- Install
tcpreplayversion 4.5.1 on a test system. - Use a packet crafting tool (e.g., Scapy) to create a malicious IPv6 packet with a crafted CIDR mask.
- Send the packet to the target system using
tcpprep. - Observe the crash or denial of service.
Example Exploit (Python with Scapy):
from scapy.all import *
# Craft a malicious IPv6 packet
packet = IPv6(src="2001:db8::1", dst="2001:db8::2") / ICMPv6EchoRequest(data="A"*1000)
# Send the packet
send(packet)
Blue Team
Detection:
- Monitor for crashes or abnormal terminations of
tcpreplayortcpprepprocesses. - Use the detection rules provided in the Detection Engineering section.
Mitigation:
- Update
tcpreplayto version 4.5.2 or later. - Restrict network access to systems running
tcpreplayto trusted sources only. - Implement network segmentation to limit exposure.
Indicators of Compromise (IOCs)
- File:
cidr.c(vulnerable file intcpreplay4.5.1) - Process:
tcpprep(crash or abnormal termination) - Network: Malicious IPv6 packets with crafted CIDR masks
- Logs: System logs showing
tcpprepcrashes or segmentation faults
Detection Engineering
YARA Rule
rule CVE_2025_9019_tcpreplay_heap_overflow {
meta:
description = "Detects tcpreplay 4.5.1 binary with vulnerable mask_cidr6 function"
author = "Valters IT"
date = "2025-01-01"
reference = "CVE-2025-9019"
strings:
$vuln_func = "mask_cidr6"
$vuln_version = "4.5.1"
condition:
$vuln_func and $vuln_version
}
Sigma Rule
title: CVE-2025-9019 - tcpreplay Heap Buffer Overflow
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential exploitation of CVE-2025-9019 via tcpprep crashes
author: Valters IT
date: 2025-01-01
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/tcpprep'
CommandLine|contains: 'segfault'
condition: selection
falsepositives:
- Legitimate crashes due to other reasons
level: medium
Suricata Rule
alert ip any any -> any any (msg:"CVE-2025-9019 - tcpreplay Heap Buffer Overflow Attempt"; content:"|00 00 00 00|"; depth:4; offset:0; reference:cve,2025-9019; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Update
tcpreplayto version 4.5.2 or later. - Short-term: Restrict network access to systems running
tcpreplayto trusted sources only. - Long-term: Implement network segmentation and monitoring to detect and prevent exploitation attempts.
- Compensating Controls: Use intrusion detection/prevention systems (IDS/IPS) with the provided Suricata rule.
Valters IT
DevSecOps & Cyber Threat Intelligence Expert