CVE-2015-2326 in PCREinfo

Summary

by MITRE • 01/25/2023

The pcre_compile2 function in PCRE before 8.37 allows context-dependent attackers to compile incorrect code and cause a denial of service (out-of-bounds read) via regular expression with a group containing both a forward referencing subroutine call and a recursive back reference, as demonstrated by "((?+1)(\1))/".

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 04/28/2025

The vulnerability identified as CVE-2015-2326 represents a critical denial of service flaw within the Perl Compatible Regular Expressions library version 8.36 and earlier. This issue affects the pcre_compile2 function which is responsible for compiling regular expression patterns into internal bytecode for execution. The flaw manifests when processing specific combinations of regex constructs that create ambiguous parsing conditions within the compilation phase, leading to improper memory handling and subsequent out-of-bounds read conditions.

The technical root cause stems from how PCRE handles forward referencing subroutine calls combined with recursive back references within grouped patterns. When the parser encounters a construct such as "((?+1)(\1))" where a forward reference (?+1) points to a subsequent group while simultaneously maintaining a recursive back reference (\1), the compilation algorithm enters an inconsistent state. The parser fails to properly track the relative positions and memory offsets of these interconnected elements, resulting in memory access violations when attempting to resolve the references during pattern compilation. This behavior maps directly to CWE-125, Out-of-Bounds Read, and CWE-787, Out-of-bounds Write, as the flawed memory management creates conditions where the parser attempts to access memory locations beyond the allocated bounds.

The operational impact of this vulnerability extends beyond simple denial of service as it can be exploited in various contexts where regular expressions are processed. Web applications, security tools, and any system relying on PCRE for pattern matching become vulnerable to this attack vector. An attacker could craft malicious regular expressions that, when processed by vulnerable applications, would cause the target system to crash or become unresponsive. This vulnerability is particularly concerning in environments where user input is processed through regular expressions, as it could enable remote attackers to disrupt service availability without requiring elevated privileges. The attack requires only the ability to submit regular expressions to a vulnerable system, making it a low-barrier, high-impact threat that aligns with ATT&CK technique T1499.004, Network Denial of Service, and T1595.001, Network Scanning.

Mitigation strategies for CVE-2015-2326 primarily involve upgrading to PCRE version 8.37 or later, where the compilation logic has been corrected to properly handle forward references and recursive back references. Administrators should also implement input validation and sanitization measures to reduce the attack surface, ensuring that regular expression processing limits the complexity and length of patterns. Additionally, deploying intrusion detection systems that can identify suspicious regex patterns and implementing proper resource limits on regex processing can help prevent exploitation. The fix implemented in PCRE 8.37 specifically addresses the parser's handling of recursive references by improving the tracking of group positions and ensuring proper memory allocation during compilation, thereby eliminating the out-of-bounds read conditions that previously occurred.

Reservation

03/18/2015

Disclosure

01/25/2023

Moderation

accepted

CPE

ready

Exploit

Download

EPSS

0.00569

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!