Bug 922560 - VUL-1: clamav, clamav-nodb: uses regular expressions (regex) library contains a heap overflow vulnerability
VUL-1: clamav, clamav-nodb: uses regular expressions (regex) library contains...
Status: RESOLVED DUPLICATE of bug 929192
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Normal
: ---
Assigned To: Reinhard Max
Security Team bot
https://guidovranken.wordpress.com/20...
. CVSSv2:NVD:CVE-2015-2170:5.0:(AV:N/...
:
Depends on:
Blocks: CVE-2015-2305
  Show dependency treegraph
 
Reported: 2015-03-16 15:33 UTC by Andreas Stieger
Modified: 2019-08-16 17:03 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Stieger 2015-03-16 15:33:43 UTC
+++ This bug was initially created as a clone of Bug #921950 +++

Guido Vranken reported that regular expressions (regex) originally written by Henry Spencer contains a heap overflow vulnerability.

CWE-122: Heap-based Buffer Overflow

https://guidovranken.wordpress.com/2015/02/04/full-disclosure-heap-overflow-in-h-spencers-regex-library-on-32-bit-systems/
http://www.kb.cert.org/vuls/id/695940

The variable len that holds the length of a regular expression string is "enlarged to such an extent that, in the process of enlarging (multiplication and addition), causes the 32 bit register/variable to overflow." It may be possible for an attacker to use this overflow to change data in memory.

Vulnerable function:
> int /* 0 success, otherwise REG_something */
> regcomp(preg, pattern, cflags)
> regex_t *preg;
> const char *pattern;
> int cflags;
> {

Vulnerable code:
> len = strlen((char *)pattern);
> [...]
> p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
> p->strip = (sop *)malloc(p->ssize * sizeof(sop));

32-bit systems are affected. It is highly unlikely that 64-bit operating systems would allow such an overflow. (Read: not impossible.)

The library is known to be contained in many different upstream source projects. The code may not be active or used on our platform, e.g. only be used as fallback code.


Found in clamav on SLE 11 (and SLE12) in libclamav/regex/regcomp.c

Upstream patch is in attachment 627001 [details] of parent bug 921950
From https://github.com/garyhouston/regex/commit/70bc2965604b6b8aaf260049e64c708dddf85334
Comment 1 Swamp Workflow Management 2015-03-16 23:02:31 UTC
bugbot adjusting priority
Comment 2 Andreas Stieger 2015-03-25 12:46:46 UTC
Checked the build log, regcomp.c is built.
Comment 3 Reinhard Max 2015-04-30 08:08:06 UTC
This will be fixed by upgrading to version 0.98.7.

*** This bug has been marked as a duplicate of bug 929192 ***
Comment 4 Swamp Workflow Management 2015-04-30 08:18:06 UTC
An update workflow for this issue was started.
This issue was rated as moderate.
Please submit fixed packages until 2015-05-14.
When done, reassign the bug to security-team@suse.de.
https://swamp.suse.de/webswamp/wf/61644