Bug 1159861 - (CVE-2019-19948) VUL-0: CVE-2019-19948: ImageMagick: heap-based buffer overflow in the function WriteSGIImage
(CVE-2019-19948)
VUL-0: CVE-2019-19948: ImageMagick: heap-based buffer overflow in the functio...
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/249754/
CVSSv2:NVD:CVE-2019-19948:7.5:(AV:N/A...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-12-27 15:58 UTC by Alexandros Toptsoglou
Modified: 2020-05-12 18:45 UTC (History)
1 user (show)

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


Attachments
POC (1.62 KB, image/bmp)
2019-12-27 16:01 UTC, Alexandros Toptsoglou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandros Toptsoglou 2019-12-27 15:58:08 UTC
CVE-2019-19948

In ImageMagick 7.0.8-43 Q16, there is a heap-based buffer overflow in the
function WriteSGIImage of coders/sgi.c.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-19948
https://github.com/ImageMagick/ImageMagick/issues/1562
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19948
Comment 1 Alexandros Toptsoglou 2019-12-27 16:00:54 UTC
Tracked all codestreams as affected since the patch can be applied to all. However, I could not reproduce with valgrind in Leap 15.1. 

According to [1] to reproduce run: 

convert $POC test.sgi
Comment 2 Alexandros Toptsoglou 2019-12-27 16:01:10 UTC
Created attachment 826762 [details]
POC
Comment 3 Alexandros Toptsoglou 2019-12-27 16:01:25 UTC
[1] https://github.com/ImageMagick/ImageMagick/issues/1562
Comment 4 Petr Gajdos 2020-01-03 09:21:19 UTC
BEFORE

I am not able to reproduce with 15,12/ImageMagick built with asan either:

$ convert heap-buffer-overflow_WriteSGIImage.bmp test.sgi
convert: length and filesize do not match `heap-buffer-overflow_WriteSGIImage.bmp' @ warning/bmp.c/ReadBMPImage/830.
convert: insufficient image data in file `heap-buffer-overflow_WriteSGIImage.bmp' @ error/bmp.c/ReadBMPImage/958.
convert: no images defined `test.sgi' @ error/convert.c/ConvertImageCommand/3275.
$

Nor with 11/ImageMagick run with valgrind.

No luck with 15.1,15.2/GraphicsMagick as well:

$ gm convert heap-buffer-overflow_WriteSGIImage.bmp test.sgi
gm convert: Compression not valid (heap-buffer-overflow_WriteSGIImage.bmp).
$

PATCH

https://github.com/ImageMagick/ImageMagick/commit/6ae32a9038e360b3491969d5d03d490884f02b4c
https://github.com/ImageMagick/ImageMagick6/commit/9e7db22f8c374301db3f968757f0d08070fd4e54

GraphicsMagick: I think it is not affected as do-while block is run just once

AFTER

$ convert heap-buffer-overflow_WriteSGIImage.bmp ./test.sgi
convert: length and filesize do not match `heap-buffer-overflow_WriteSGIImage.bmp' @ warning/bmp.c/ReadBMPImage/830.
convert: insufficient image data in file `heap-buffer-overflow_WriteSGIImage.bmp' @ error/bmp.c/ReadBMPImage/958.
convert: no images defined `./test.sgi' @ error/convert.c/ConvertImageCommand/3275.
$
[no change]
Comment 5 Petr Gajdos 2020-01-03 09:21:36 UTC
Will submit for 15,12,11/ImageMagick.
Comment 6 Petr Gajdos 2020-01-03 13:12:32 UTC
Packages submitted. I believe all fixed.
Comment 11 Swamp Workflow Management 2020-01-30 20:12:20 UTC
SUSE-SU-2020:0275-1: An update that solves two vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 1159861,1160369,1161194
CVE References: CVE-2019-19948,CVE-2019-19949
Sources used:
SUSE Linux Enterprise Module for Open Buildservice Development Tools 15-SP1 (src):    ImageMagick-7.0.7.34-3.79.1
SUSE Linux Enterprise Module for Open Buildservice Development Tools 15 (src):    ImageMagick-7.0.7.34-3.79.1
SUSE Linux Enterprise Module for Development Tools 15-SP1 (src):    ImageMagick-7.0.7.34-3.79.1
SUSE Linux Enterprise Module for Development Tools 15 (src):    ImageMagick-7.0.7.34-3.79.1
SUSE Linux Enterprise Module for Desktop Applications 15-SP1 (src):    ImageMagick-7.0.7.34-3.79.1
SUSE Linux Enterprise Module for Desktop Applications 15 (src):    ImageMagick-7.0.7.34-3.79.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 12 Swamp Workflow Management 2020-02-05 17:12:17 UTC
openSUSE-SU-2020:0170-1: An update that solves two vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 1159861,1160369,1161194
CVE References: CVE-2019-19948,CVE-2019-19949
Sources used:
openSUSE Leap 15.1 (src):    ImageMagick-7.0.7.34-lp151.7.15.1
Comment 13 Swamp Workflow Management 2020-02-19 14:16:34 UTC
SUSE-SU-2020:0411-1: An update that solves two vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 1159861,1160369,1161194
CVE References: CVE-2019-19948,CVE-2019-19949
Sources used:
SUSE Linux Enterprise Workstation Extension 12-SP5 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Workstation Extension 12-SP4 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Software Development Kit 12-SP5 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Software Development Kit 12-SP4 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Server 12-SP5 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Server 12-SP4 (src):    ImageMagick-6.8.8.1-71.141.1
SUSE Linux Enterprise Desktop 12-SP4 (src):    ImageMagick-6.8.8.1-71.141.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 14 Alexandros Toptsoglou 2020-04-29 13:38:59 UTC
Done