Bug 1052747 - (CVE-2017-12665) VUL-2: CVE-2017-12665: GraphicsMagick, ImageMagick: Memory leak vulnerability in WritePICTImage in coders/pict.c
(CVE-2017-12665)
VUL-2: CVE-2017-12665: GraphicsMagick, ImageMagick: Memory leak vulnerability...
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/189773/
CVSSv2:SUSE:CVE-2017-12665:5.0:(AV:N/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-08 10:56 UTC by Johannes Segitz
Modified: 2020-06-11 20:32 UTC (History)
1 user (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 10:56 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 10:56:13 UTC
Created attachment 735678 [details]
Reproducer

CVE-2017-12665

ImageMagick 7.0.6-2 has a memory leak vulnerability in WritePICTImage in
coders/pict.c.

valgrind convert leak-WritePICTImage out.pict

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-12665
https://github.com/ImageMagick/ImageMagick/commit/859084b4fd966ac007965c3d85caabccd8aee9b4
https://github.com/ImageMagick/ImageMagick/issues/577
Comment 1 Marcus Meissner 2017-09-27 12:02:59 UTC
minor leak (scanline sized byte leak). bug defered.
Comment 2 Petr Gajdos 2018-01-30 13:04:28 UTC
BEFORE

12/ImageMagick

$ valgrind -q --leak-check=full convert leak-WritePICTImage out.pict
convert: unexpected end-of-file `leak-WritePICTImage' @ error/pwp.c/ReadPWPImage/198.
convert: no images defined `out.pict' @ error/convert.c/ConvertImageCommand/3149.
$
[note the exception is different from that one patched]

11/ImageMagick

$ valgrind -q --leak-check=full convert leak-WritePICTImage /dev/null
convert: Unexpected end-of-file `leak-WritePICTImage': No such file or directory.
$
[note the exception is different from that one patched]

11/GraphicsMagick

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

42.3/GraphicsMagick

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

No leak observed.

PATCH

see comment 0
12/ImageMagick, 11/ImageMagick: code is there, affected
11,42.3,HG/GraphicsMagick: solved via ThrowPICTWriterException(), not affected

AFTER

12/ImageMagick

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

11/ImageMagick

$ valgrind -q --leak-check=full convert leak-WritePICTImage /dev/null
convert: Unexpected end-of-file `leak-WritePICTImage': No such file or directory.
$
[no change]
Comment 3 Petr Gajdos 2018-01-30 13:04:47 UTC
Will submit for: 12/ImageMagick and 11/ImageMagick.
Comment 4 Petr Gajdos 2018-02-02 09:31:28 UTC
I believe all fixed.
Comment 5 Swamp Workflow Management 2018-02-20 14:10:02 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 6 Swamp Workflow Management 2018-03-01 20:17:21 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 7 Swamp Workflow Management 2018-03-06 23:16:03 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 8 Marcus Meissner 2018-05-18 15:36:50 UTC
released