Bug 1056993 - (CVE-2017-6362) VUL-0: CVE-2017-6362: gd: Double-free in gdImagePngPtr()
(CVE-2017-6362)
VUL-0: CVE-2017-6362: gd: Double-free in gdImagePngPtr()
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Normal
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/191392/
CVSSv3:SUSE:CVE-2017-6362:7.8:(AV:L/A...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-04 06:15 UTC by Marcus Meissner
Modified: 2018-02-19 16:18 UTC (History)
1 user (show)

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


Attachments
xx.c (228 bytes, text/plain)
2017-09-04 06:17 UTC, Marcus Meissner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2017-09-04 06:15:20 UTC
CVE-2017-6362

https://github.com/libgd/libgd/issues/381
https://github.com/libgd/libgd/commit/56ce6ef068b954ad28379e83cca04feefc51320c

The problem is that gdImagePngPtr() calls gdImangePngCtxEx(), but the latter bails out because there are no colors in the palette. However, gdImagePngCtxEx() doesn't provide a meaningful return value, so gdImagePngPtr() can't check whether the operation succeeded.

It seems that we need a fix analogous to commt a49feea. Other image output functions might be affected as well.


References:
http://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-6362.html
Comment 1 Marcus Meissner 2017-09-04 06:15:48 UTC
the function is not called in the php embedded copy, so php* not affected.
Comment 2 Marcus Meissner 2017-09-04 06:17:34 UTC
Created attachment 739254 [details]
xx.c

QA REPRODUCER:

gcc -O2 -Wall -g xx.c -o xx -lgd
./xx

should not abort with memory corruption
GD Warning: gd-png error: no colors in palette
*** Error in `./xx': free(): invalid pointer: 0x000000d7d15f9c50 ***
Aborted (core dumped)
Comment 3 Marcus Meissner 2017-09-04 06:21:35 UTC
not clear how reachable this is via data.
Comment 4 Petr Gajdos 2017-09-05 13:58:29 UTC
For Tumbleweed, solved by version update.
Comment 5 Petr Gajdos 2017-09-05 14:12:07 UTC
12/gd:

$ ./xx
GD Warning: gd-png error: no colors in palette
*** Error in `./xx': free(): invalid pointer: 0x000000000164ac50 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7271f)[0x7ff5b63de71f]
/lib64/libc.so.6(+0x77fc6)[0x7ff5b63e3fc6]
./xx[0x400704]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7ff5b638dac5]
./xx[0x40073d]
======= Memory map: ========
Aborted (core dumped)
$

As far as can be tested with the provided testcase, 11/gd and 10sp3/gd is not affected:

$ ./xx
gd-png:  fatal libpng error: Invalid number of colors in palette
gd-png error: setjmp returns error condition
$
Comment 6 Petr Gajdos 2017-09-06 14:40:56 UTC
Indeed, 11/gd and 10sp3/gd seem not to be affected.
Comment 8 Swamp Workflow Management 2018-01-18 17:11:20 UTC
SUSE-SU-2018:0135-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1056993
CVE References: CVE-2017-6362
Sources used:
SUSE Linux Enterprise Workstation Extension 12-SP3 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Workstation Extension 12-SP2 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Software Development Kit 12-SP3 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Software Development Kit 12-SP2 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Server 12-SP3 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Server 12-SP2 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Desktop 12-SP3 (src):    gd-2.1.0-24.3.4
SUSE Linux Enterprise Desktop 12-SP2 (src):    gd-2.1.0-24.3.4
Comment 9 Swamp Workflow Management 2018-01-20 17:10:34 UTC
openSUSE-SU-2018:0151-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1056993
CVE References: CVE-2017-6362
Sources used:
openSUSE Leap 42.3 (src):    gd-2.1.0-21.1
openSUSE Leap 42.2 (src):    gd-2.1.0-18.3.1
Comment 10 Marcus Meissner 2018-02-19 16:18:33 UTC
released