Bug 1052754 - (CVE-2017-12663) VUL-1: CVE-2017-12663: GraphicsMagick, ImageMagick: Memory leak in WriteMAPImage in coders/map.c
(CVE-2017-12663)
VUL-1: CVE-2017-12663: GraphicsMagick, ImageMagick: Memory leak in WriteMAPIm...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P4 - Low : Normal
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/189771/
CVSSv3:SUSE:CVE-2017-12663:5.3:(AV:N/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-08 11:38 UTC by Johannes Segitz
Modified: 2019-01-03 23:36 UTC (History)
2 users (show)

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


Attachments
Reproducer (11 bytes, application/octet-stream)
2017-08-08 11:38 UTC, Johannes Segitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Segitz 2017-08-08 11:38:37 UTC
Created attachment 735687 [details]
Reproducer

CVE-2017-12663

ImageMagick 7.0.6-2 has a memory leak vulnerability in WriteMAPImage in
coders/map.c.

valgrind convert leak-WriteMAPImage out.map
don't see the leak but other warnings. Code is affected

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-12663
https://github.com/ImageMagick/ImageMagick/commit/6233ef75bb973745ab1092b59aea8fe316f09074
https://github.com/ImageMagick/ImageMagick/issues/573
Comment 1 Petr Gajdos 2018-02-20 20:35:23 UTC
BEFORE

12/ImageMagick

$ valgrind -q --leak-check=full convert leak-WriteMAPImage out.map
convert: unexpected end-of-file `leak-WriteMAPImage' @ error/pwp.c/ReadPWPImage/198.
convert: no images defined `out.map' @ error/convert.c/ConvertImageCommand/3149.
$
[no issue observed]

11/ImageMagick

$ valgrind -q --leak-check=full convert leak-WriteMAPImage out.map
convert: Unexpected end-of-file `leak-WriteMAPImage': No such file or directory.
==6423== 
==6423== 2,128 bytes in 7 blocks are possibly lost in loss record 3 of 3
==6423==    at 0x4C23484: calloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6423==    by 0x4010AEE: _dl_allocate_tls (in /lib64/ld-2.9.so)
==6423==    by 0x6B7774A: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.9.so)
==6423==    by 0x696CF35: (within /usr/lib64/libgomp.so.1.0.0)
==6423==    by 0x4F0EDC3: AcquireImageColormap (image.c:342)
==6423==    by 0x4F3D051: QuantizeImage (quantize.c:2966)
==6423==    by 0x4F0CAD9: SetImageType (image.c:4018)
==6423==    by 0xA10C213: ???
==6423==    by 0x4E94145: WriteImage (constitute.c:955)
==6423==    by 0x4E9490A: WriteImages (constitute.c:1126)
==6423==    by 0x529339C: ConvertImageCommand (convert.c:2711)
==6423==    by 0x400F73: main (convert.c:122)
$
[unrelated leak]

11/GraphicsMagick

$ valgrind -q --leak-check=full gm convert leak-WriteMAPImage out.map
==6436== Use of uninitialised value of size 8
==6436==    at 0x4F23A28: LocaleNCompare (utility.c:3356)
==6436==    by 0x822A3CB: ReadPWPImage (pwp.c:177)
==6436==    by 0x4EA01CC: ReadImage (constitute.c:6000)
==6436==    by 0x4E8CBCF: ConvertImageCommand (command.c:3171)
==6436==    by 0x4E73683: MagickCommand (command.c:7657)
==6436==    by 0x4E737FE: GMCommand (command.c:15277)
==6436==    by 0x76E2585: (below main) (in /lib64/libc-2.9.so)
gm convert: Request did not return an image.
$
[no leak]

42.3/GraphicsMagick

$ valgrind -q --leak-check=full gm convert leak-WriteMAPImage out.map
==6442== Use of uninitialised value of size 8
==6442==    at 0x4F3DC1E: LocaleNCompare (utility.c:3520)
==6442==    by 0x7BCD2E8: ReadPWPImage (pwp.c:177)
==6442==    by 0x4EBEB77: ReadImage (constitute.c:1607)
==6442==    by 0x4E9F037: ConvertImageCommand (command.c:4348)
==6442==    by 0x4E8F884: MagickCommand (command.c:8868)
==6442==    by 0x4E9099D: GMCommandSingle (command.c:17376)
==6442==    by 0x4EB1D2D: GMCommand (command.c:17429)
==6442==    by 0x54406E4: (below main) (in /lib64/libc-2.22.so)
==6442== 
gm convert: Request did not return an image.
$
[no leak]

PATCH

in comment 0

No relevant leak observed, but potential leak is surely there:

12/ImageMagick: patch needed
11/ImageMagick: patch needed
11/GraphicsMagick: patch needed
42.3,HG/GraphicsMagick: solved via ThrowMAPWriterException macro


AFTER

12/ImageMagick

$ valgrind -q --leak-check=full convert leak-WriteMAPImage out.map
convert: unexpected end-of-file `leak-WriteMAPImage' @ error/pwp.c/ReadPWPImage/198.
convert: no images defined `out.map' @ error/convert.c/ConvertImageCommand/3149.
$
[no change]

11/ImageMagick

$ valgrind -q --leak-check=full convert leak-WriteMAPImage out.map
convert: Unexpected end-of-file `leak-WriteMAPImage': No such file or directory.
==7744== 
==7744== 2,128 bytes in 7 blocks are possibly lost in loss record 3 of 3
==7744==    at 0x4C23484: calloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7744==    by 0x4010AEE: _dl_allocate_tls (in /lib64/ld-2.9.so)
==7744==    by 0x6B7774A: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.9.so)
==7744==    by 0x696CF35: (within /usr/lib64/libgomp.so.1.0.0)
==7744==    by 0x4F0EDC3: AcquireImageColormap (image.c:342)
==7744==    by 0x4F3D051: QuantizeImage (quantize.c:2966)
==7744==    by 0x4F0CAD9: SetImageType (image.c:4018)
==7744==    by 0xA10C213: ???
==7744==    by 0x4E94145: WriteImage (constitute.c:955)
==7744==    by 0x4E9490A: WriteImages (constitute.c:1126)
==7744==    by 0x529339C: ConvertImageCommand (convert.c:2711)
==7744==    by 0x400F73: main (convert.c:122)
$
[no change]

11/GraphicsMagick

$ valgrind -q --leak-check=full gm convert leak-WriteMAPImage out.map
==11498== Use of uninitialised value of size 8
==11498==    at 0x4F23A28: LocaleNCompare (utility.c:3356)
==11498==    by 0x822A3CB: ReadPWPImage (pwp.c:177)
==11498==    by 0x4EA01CC: ReadImage (constitute.c:6000)
==11498==    by 0x4E8CBCF: ConvertImageCommand (command.c:3171)
==11498==    by 0x4E73683: MagickCommand (command.c:7657)
==11498==    by 0x4E737FE: GMCommand (command.c:15277)
==11498==    by 0x76E2585: (below main) (in /lib64/libc-2.9.so)
gm convert: Request did not return an image.
$
[no change]
Comment 2 Petr Gajdos 2018-02-20 20:35:45 UTC
Will submit for: 12/ImageMagick, 11/ImageMagick and 11/GraphicsMagick.
Comment 3 Petr Gajdos 2018-02-21 13:39:55 UTC
I believe all fixed.
Comment 5 Swamp Workflow Management 2018-03-01 20:17:38 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 6 Swamp Workflow Management 2018-03-06 23:16:17 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 7 Swamp Workflow Management 2018-03-14 20:08:59 UTC
SUSE-SU-2018:0672-1: An update that fixes 6 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042911,1050119,1050132,1052754,1072898,1077737
CVE References: CVE-2017-11528,CVE-2017-11533,CVE-2017-12663,CVE-2017-17500,CVE-2017-17682,CVE-2017-9405
Sources used:
SUSE Studio Onsite 1.3 (src):    GraphicsMagick-1.2.5-4.78.41.1
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    GraphicsMagick-1.2.5-4.78.41.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    GraphicsMagick-1.2.5-4.78.41.1
Comment 8 Swamp Workflow Management 2018-03-22 11:10:48 UTC
SUSE-SU-2018:0770-1: An update that fixes 6 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042911,1050119,1050122,1050132,1052754,1072898
CVE References: CVE-2017-11528,CVE-2017-11530,CVE-2017-11533,CVE-2017-12663,CVE-2017-17682,CVE-2017-9405
Sources used:
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.37.1
SUSE Linux Enterprise Server 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.37.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    ImageMagick-6.4.3.6-7.78.37.1
Comment 9 Marcus Meissner 2018-05-18 15:37:12 UTC
released
Comment 10 Petr Gajdos 2018-10-31 15:19:52 UTC
I discovered a regression due fix for 11/ImageMagick, package resubmitted.
Comment 11 Petr Gajdos 2018-10-31 15:26:28 UTC
(In reply to Petr Gajdos from comment #10)
> I discovered a regression due fix for 11/ImageMagick, package resubmitted.

11/GraphicsMagick, actually.
Comment 12 Swamp Workflow Management 2019-01-03 20:09:07 UTC
SUSE-SU-2019:13923-1: An update that fixes 8 vulnerabilities is now available.

Category: security (moderate)
Bug References: 1042911,1052754,1078433,1112392,1112399,1113064,1119822,1119823
CVE References: CVE-2017-10794,CVE-2017-12663,CVE-2017-14997,CVE-2017-9405,CVE-2018-18544,CVE-2018-20184,CVE-2018-20185,CVE-2018-6405
Sources used:
SUSE Studio Onsite 1.3 (src):    GraphicsMagick-1.2.5-78.78.1
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    GraphicsMagick-1.2.5-78.78.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    GraphicsMagick-1.2.5-78.78.1