Bug 1340814 (CVE-2016-5118)

Summary: CVE-2016-5118 ImageMagick: Remote code execution via filename
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: abhgupta, andreas, dmcphers, ethan, jhorak, jialiu, jokerman, lmeyer, mmccomas, nmurray, pahan, rdieter, sardella, slawomir, tiwillia, yozone
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
It was discovered that ImageMagick did not properly sanitize certain input before using it to invoke processes. A remote attacker could create a specially crafted image that, when processed by an application using ImageMagick or an unsuspecting user using the ImageMagick utilities, would lead to arbitrary execution of shell commands with the privileges of the user running the application.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:53:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1340815, 1340816, 1340817, 1341777, 1341778, 1341779, 1341780    
Bug Blocks: 1333419    

Description Andrej Nemec 2016-05-30 10:53:02 UTC
All existing releases of GraphicsMagick and ImageMagick support a file open syntax where if the first character of the file specification is a '|', then the remainder of the filename is passed to the shell for execution using the POSIX popen(3C) function.  File opening is handled by an OpenBlob() function in the source file blob.c. Unlike the vulnerability described by CVE-2016-3714, this functionality is supported by the core file opening function rather than a delegates subsystem usually used to execute external programs.

References:

http://seclists.org/oss-sec/2016/q2/432

Comment 1 Andrej Nemec 2016-05-30 10:54:01 UTC
Created GraphicsMagick tracking bugs for this issue:

Affects: fedora-all [bug 1340816]
Affects: epel-all [bug 1340817]

Comment 2 Andrej Nemec 2016-05-30 10:54:11 UTC
Created ImageMagick tracking bugs for this issue:

Affects: fedora-all [bug 1340815]

Comment 5 Tomas Hoger 2016-06-15 11:57:05 UTC
Patch attached to the oss-security post linked in comment 0 only disabled popen support.  This GraphicsMagick upstream patch removes popen support completely:

http://hg.code.sf.net/p/graphicsmagick/code/rev/ae3928faa858

Comment 6 errata-xmlrpc 2016-06-16 22:48:07 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6
  Red Hat Enterprise Linux 7

Via RHSA-2016:1237 https://access.redhat.com/errata/RHSA-2016:1237

Comment 7 Fedora Update System 2016-06-17 18:17:06 UTC
GraphicsMagick-1.3.24-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2016-06-17 22:47:01 UTC
GraphicsMagick-1.3.24-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2016-06-18 15:47:44 UTC
GraphicsMagick-1.3.24-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2016-06-18 18:53:16 UTC
GraphicsMagick-1.3.24-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2016-06-19 07:19:04 UTC
GraphicsMagick-1.3.24-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2016-06-19 07:26:52 UTC
GraphicsMagick-1.3.24-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Pavel Alexeev 2016-11-20 18:06:46 UTC
Does it reported to ImageMagick upstream?