Bug 1052207 - (CVE-2017-12418) VUL-2: CVE-2017-12418: GraphicsMagick, ImageMagick: memory leaks in the parse8BIMW and format8BIM functions
(CVE-2017-12418)
VUL-2: CVE-2017-12418: GraphicsMagick, ImageMagick: memory leaks in the parse...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Minor
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/189588/
CVSSv2:SUSE:CVE-2017-12418:2.6:(AV:N/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-04 08:03 UTC by Alexander Bergmann
Modified: 2020-06-11 20:31 UTC (History)
3 users (show)

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


Attachments
reproducer (2.00 KB, application/octet-stream)
2017-08-04 08:07 UTC, Alexander Bergmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Bergmann 2017-08-04 08:03:06 UTC
CVE-2017-12418

ImageMagick 7.0.6-5 has memory leaks in the parse8BIMW and format8BIM functions
in coders/meta.c, related to the WriteImage function in MagickCore/constitute.c.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-12418
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-12418
https://github.com/ImageMagick/ImageMagick/issues/643
Comment 1 Alexander Bergmann 2017-08-04 08:07:06 UTC
Created attachment 735242 [details]
reproducer

I was not able to reproduce the problem.

#> valgrind --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 output.fpx
...
==570== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

The SLE-12 has some of the modified/fixed code areas. Not sure if a backport works directly.
Comment 2 Marcus Meissner 2017-08-21 14:24:35 UTC
valgrind --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 output.fpx
==24486== Memcheck, a memory error detector
==24486== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==24486== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==24486== Command: convert Memory-Leak-1_output_fpx_1501588084.95 output.fpx
==24486== 
MemoryAllocationFailed==24486== 
==24486== HEAP SUMMARY:
==24486==     in use at exit: 4,432 bytes in 11 blocks
==24486==   total heap usage: 3,352 allocs, 3,341 frees, 1,023,089 bytes allocated
==24486== 
==24486== 4,096 bytes in 1 blocks are definitely lost in loss record 11 of 11
==24486==    at 0x4C29160: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24486==    by 0x843A3A4: ???
==24486==    by 0x843AFC6: ???
==24486==    by 0x4EC085C: WriteImage (constitute.c:1237)
==24486==    by 0x4EC1141: WriteImages (constitute.c:1394)
==24486==    by 0x531B943: ConvertImageCommand (convert.c:3154)
==24486==    by 0x5385C72: MagickCommandGenesis (mogrify.c:166)
==24486==    by 0x400906: ConvertMain (convert.c:81)
==24486==    by 0x400906: main (convert.c:92)
==24486== 
==24486== LEAK SUMMARY:
==24486==    definitely lost: 4,096 bytes in 1 blocks
==24486==    indirectly lost: 0 bytes in 0 blocks
==24486==      possibly lost: 0 bytes in 0 blocks
==24486==    still reachable: 336 bytes in 10 blocks
==24486==         suppressed: 0 bytes in 0 blocks
==24486== Reachable blocks (those to which a pointer was found) are not shown.
==24486== To see them, rerun with: --leak-check=full --show-leak-kinds=all
Comment 3 Marcus Meissner 2017-08-21 14:26:58 UTC
It is a minor leak at best.
Comment 4 Petr Gajdos 2018-01-31 10:27:05 UTC
BEFORE

12/ImageMagick

$ valgrind -q --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 /dev/null
MemoryAllocationFailed==826== 4,096 bytes in 1 blocks are definitely lost in loss record 10 of 10
==826==    at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==826==    by 0x8419384: ???
==826==    by 0x8419FD6: ???
==826==    by 0x4EC13BC: WriteImage (constitute.c:1237)
==826==    by 0x4EC1CA1: WriteImages (constitute.c:1394)
==826==    by 0x531B923: ConvertImageCommand (convert.c:3154)
==826==    by 0x5385C52: MagickCommandGenesis (mogrify.c:166)
==826==    by 0x400836: ConvertMain (convert.c:81)
==826==    by 0x400836: main (convert.c:92)
==826==
$

11/ImageMagick

$ valgrind -q --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 /dev/null
MemoryAllocationFailed==839==
==839== 2,128 bytes in 7 blocks are possibly lost in loss record 3 of 4
==839==    at 0x4C23484: calloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==839==    by 0x4010AEE: _dl_allocate_tls (in /lib64/ld-2.9.so)
==839==    by 0x6B7774A: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.9.so)
==839==    by 0x696CF35: (within /usr/lib64/libgomp.so.1.0.0)
==839==    by 0x4F0E3E1: SetImageBackgroundColor (image.c:342)
==839==    by 0x9F0B887: ???
==839==    by 0x4E94D87: ReadImage (constitute.c:441)
==839==    by 0x5292BC3: ConvertImageCommand (convert.c:565)
==839==    by 0x400F73: main (convert.c:122)
==839==
==839==
==839== 4,096 bytes in 1 blocks are definitely lost in loss record 4 of 4
==839==    at 0x4C256AE: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==839==    by 0x9F09AC7: ???
==839==    by 0x9F0A480: ???
==839==    by 0x4E94145: WriteImage (constitute.c:955)
==839==    by 0x4E9490A: WriteImages (constitute.c:1126)
==839==    by 0x529339C: ConvertImageCommand (convert.c:2711)
==839==    by 0x400F73: main (convert.c:122)
$

11/GraphicsMagick

$ valgrind -q --leak-check=full gm convert Memory-Leak-1_output_fpx_1501588084.95 /dev/null
MemoryAllocationFailed$
[no issues observed]

42.3/GraphicsMagick

$ valgrind -q --leak-check=full gm convert Memory-Leak-1_output_fpx_1501588084.95
gm convert: Request did not return an image.
$
[no issues observed]

PATCH

https://github.com/ImageMagick/ImageMagick/commit/bfd93888beccf2eff49cc9abfa6b5167c9c9109d

GraphicsMagick: does not have the code


AFTER

12/ImageMagick

$ valgrind -q --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 /dev/null
MemoryAllocationFailed$
[leak vanished]

11/ImageMagick

$ valgrind -q --leak-check=full convert Memory-Leak-1_output_fpx_1501588084.95 /dev/null
MemoryAllocationFailed==25364== 
==25364== 2,128 bytes in 7 blocks are possibly lost in loss record 3 of 3
==25364==    at 0x4C23484: calloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==25364==    by 0x4010AEE: _dl_allocate_tls (in /lib64/ld-2.9.so)
==25364==    by 0x6B7774A: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.9.so)
==25364==    by 0x696CF35: (within /usr/lib64/libgomp.so.1.0.0)
==25364==    by 0x4F0E3E1: SetImageBackgroundColor (image.c:342)
==25364==    by 0x9F0B8B7: ???
==25364==    by 0x4E94D87: ReadImage (constitute.c:441)
==25364==    by 0x5292BC3: ConvertImageCommand (convert.c:565)
==25364==    by 0x400F73: main (convert.c:122)
$
[relevant leak vanished]
Comment 5 Petr Gajdos 2018-01-31 10:27:30 UTC
Will submit for: 12/ImageMagick and 11/ImageMagick
Comment 6 Petr Gajdos 2018-02-02 09:30:56 UTC
I believe all fixed.
Comment 8 Swamp Workflow Management 2018-02-20 14:08:58 UTC
SUSE-SU-2018:0486-1: An update that fixes 24 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042824,1048110,1049374,1049375,1050048,1050617,1050669,1052207,1052248,1052251,1052254,1052472,1052688,1052711,1052747,1052750,1052761,1055069,1055229,1058009,1074119,1076182,1078433
CVE References: CVE-2017-11166,CVE-2017-11448,CVE-2017-11450,CVE-2017-11537,CVE-2017-11637,CVE-2017-11638,CVE-2017-11642,CVE-2017-12418,CVE-2017-12427,CVE-2017-12429,CVE-2017-12432,CVE-2017-12566,CVE-2017-12654,CVE-2017-12664,CVE-2017-12665,CVE-2017-12668,CVE-2017-12674,CVE-2017-13058,CVE-2017-13131,CVE-2017-14224,CVE-2017-17885,CVE-2017-18028,CVE-2017-9407,CVE-2018-6405
Sources used:
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.34.1
SUSE Linux Enterprise Server 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.34.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.34.1
Comment 9 Swamp Workflow Management 2018-03-01 20:16:22 UTC
SUSE-SU-2018:0581-1: An update that fixes 35 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042824,1042911,1048110,1048272,1049374,1049375,1050048,1050119,1050122,1050126,1050132,1050617,1052207,1052248,1052251,1052254,1052472,1052688,1052711,1052747,1052750,1052754,1052761,1055069,1055229,1056768,1057163,1058009,1072898,1074119,1074170,1075821,1076182,1078433
CVE References: CVE-2017-11166,CVE-2017-11170,CVE-2017-11448,CVE-2017-11450,CVE-2017-11528,CVE-2017-11530,CVE-2017-11531,CVE-2017-11533,CVE-2017-11537,CVE-2017-11638,CVE-2017-11642,CVE-2017-12418,CVE-2017-12427,CVE-2017-12429,CVE-2017-12432,CVE-2017-12566,CVE-2017-12654,CVE-2017-12663,CVE-2017-12664,CVE-2017-12665,CVE-2017-12668,CVE-2017-12674,CVE-2017-13058,CVE-2017-13131,CVE-2017-14060,CVE-2017-14139,CVE-2017-14224,CVE-2017-17682,CVE-2017-17885,CVE-2017-17934,CVE-2017-18028,CVE-2017-9405,CVE-2017-9407,CVE-2018-5357,CVE-2018-6405
Sources used:
SUSE Linux Enterprise Workstation Extension 12-SP3 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Workstation Extension 12-SP2 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Software Development Kit 12-SP3 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Software Development Kit 12-SP2 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Server 12-SP3 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Server 12-SP2 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Desktop 12-SP3 (src):    ImageMagick-6.8.8.1-71.42.1
SUSE Linux Enterprise Desktop 12-SP2 (src):    ImageMagick-6.8.8.1-71.42.1
Comment 10 Swamp Workflow Management 2018-03-06 23:15:07 UTC
openSUSE-SU-2018:0621-1: An update that fixes 35 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042824,1042911,1048110,1048272,1049374,1049375,1050048,1050119,1050122,1050126,1050132,1050617,1052207,1052248,1052251,1052254,1052472,1052688,1052711,1052747,1052750,1052754,1052761,1055069,1055229,1056768,1057163,1058009,1072898,1074119,1074170,1075821,1076182,1078433
CVE References: CVE-2017-11166,CVE-2017-11170,CVE-2017-11448,CVE-2017-11450,CVE-2017-11528,CVE-2017-11530,CVE-2017-11531,CVE-2017-11533,CVE-2017-11537,CVE-2017-11638,CVE-2017-11642,CVE-2017-12418,CVE-2017-12427,CVE-2017-12429,CVE-2017-12432,CVE-2017-12566,CVE-2017-12654,CVE-2017-12663,CVE-2017-12664,CVE-2017-12665,CVE-2017-12668,CVE-2017-12674,CVE-2017-13058,CVE-2017-13131,CVE-2017-14060,CVE-2017-14139,CVE-2017-14224,CVE-2017-17682,CVE-2017-17885,CVE-2017-17934,CVE-2017-18028,CVE-2017-9405,CVE-2017-9407,CVE-2018-5357,CVE-2018-6405
Sources used:
openSUSE Leap 42.3 (src):    ImageMagick-6.8.8.1-55.1
Comment 11 Marcus Meissner 2018-03-07 06:57:54 UTC
released