Bug 1700392 (CVE-2017-16231)

Summary: CVE-2017-16231 pcre: self-recursive call in match() in pcre_exec.c leads to denial of service
Product: [Other] Security Response Reporter: msiddiqu
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: adam.stokes, andrew, bmaxwell, cdewolf, chazlett, csutherl, darran.lofthouse, databases-maint, dimitris, dosoudil, erack, erik-fedora, fgavrilo, gecko-bugs-nobody, gzaronik, hhorak, jawilson, jclere, jdoyle, jgrulich, jhorak, jondruse, jorton, kasal, lgao, lkundrak, mbabacek, mmuzila, mschorm, mturk, myarboro, pgier, pjurak, ppalaga, ppisar, psakar, pslavice, rcollet, rh-spice-bugs, rnetuka, rstancel, rsvoboda, stransky, thoger, twalsh, vtunka, walters, webstack-team, weli
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-21 19:45:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1700393, 1700394, 1700395    
Bug Blocks: 1700399    

Description msiddiqu 2019-04-16 12:53:08 UTC
** DISPUTED ** In PCRE 8.41, after compiling, a pcretest load test PoC produces a crash overflow in the function match() in pcre_exec.c because of a self-recursive call. NOTE: third parties dispute the relevance of this report, noting that there are options that can be used to limit the amount of stack that is used.

References: 

http://www.openwall.com/lists/oss-security/2017/11/01/11 
http://www.openwall.com/lists/oss-security/2017/11/01/3 
http://www.openwall.com/lists/oss-security/2017/11/01/7 
http://www.openwall.com/lists/oss-security/2017/11/01/8
https://seclists.org/oss-sec/2017/q4/164
https://seclists.org/fulldisclosure/2018/Dec/33
https://bugs.exim.org/show_bug.cgi?id=2047

POC:

https://github.com/followboy1999/poc/tree/master/CVE-2017-16231
https://packetstormsecurity.com/files/150897/PCRE-8.41-Buffer-Overflow.html

Comment 1 msiddiqu 2019-04-16 12:53:30 UTC
Created mingw-pcre tracking bugs for this issue:

Affects: epel-7 [bug 1700395]
Affects: fedora-28 [bug 1700393]
Affects: fedora-29 [bug 1700394]

Comment 2 Petr Pisar 2019-04-16 14:04:50 UTC
This is a known feature of any recursive algorithm that process an untrusted input. A user can limit a recursion limit or increase a stack size. Upstream always rejects these stack-exhausted bugs as this is a limitation of the architecture.

Comment 4 Joshua Padman 2019-05-15 23:04:49 UTC
This vulnerability is out of security support scope for the following products:
 * Red Hat Enterprise Application Platform 6
 * Red Hat Enterprise Application Platform 5

Please refer to https://access.redhat.com/support/policy/updates/jboss_notes for more details.

Comment 8 Marco Benatto 2019-05-21 19:40:17 UTC
Analyzing the pcre code it's possible to notice it have a few ways to control and limit the recursion
depth on match() function:

1) The caller from pcre_exec() can limit its stack usage via rlimit related calls;
2) There's a default built-in max recursion depth on pcre;
3) The caller can set the max recursion depth via pcre configuration calls from its API;

Although the default built-in max depth may not be enough to avoid stack overflow there's still other
two ways to avoid it.

Given the information above it doesn't seems a security issue on pcre.

Comment 9 Doran Moppert 2020-02-11 00:31:47 UTC
Statement:

Red Hat Product Security determined that this flaw was not a security vulnerability. See the Bugzilla link for more details.