Fortinet Discovers PCRE Library Heap Overflow Vulnerability I


Fortinet's FortiGuard Labs has discovered a heap overflow vulnerability in the PCRE (Perl Compatible Regular Expressions) library.
The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl programming language. The PCRE library is free. It is incorporated into a number of popular applications, such as MongoDB, MariaDB, PHP.
The PCRE library is prone to a heap overflow vulnerability which could be triggered by a crafted regular expression. Due to insufficient bounds checking inside the function compile_branch(), the heap memory could be overflowed by a crafted regular expression.


Upgrade to the PCRE Library 8.37 or above.

Additional Information

A pattern, which has a group containing a forward reference repeated a large number of times within a repeated outer group that has a zero minimum quantifier, causes incorrect code to be compiled.
Carefully crafted regular expression may allow attackers to control the EIP and other heap variables, which could result in code execution.


This vulnerability was discovered by Kai Lu of Fortinet's FortiGuard Labs.

IPS Subscription

Fortinet customers who subscribe to Fortinet's intrusion prevention (IPS) service should be protected against this vulnerability with the appropriate configuration parameters in place. Fortinet's IPS service is one component of FortiGuard Subscription Services, which also offer comprehensive solutions such as antivirus, Web content filtering and antispam capabilities. These services enable protection against threats on both application and network layers. FortiGuard Services are continuously updated by FortiGuard Labs, which enables Fortinet to deliver a combination of multi-layered security intelligence and true zero-day protection from new and emerging threats. These updates are delivered to all FortiGate, FortiMail and FortiClient products. Fortinet strictly follows responsible disclosure guidelines to ensure optimum protection during a threat's lifecycle.