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.
SolutionsUpgrade to the PCRE Library 8.37 or above.
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.