Imagemagick popen() shell vulnerability via filename
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Imagemagick popen() shell vulnerability via filename
Code: Select all
convert '|echo Hello > hello.txt;' null:
snibgo's IM pages: im.snibgo.com
Re: Imagemagick popen() shell vulnerability via filename
snibgo wrote:Vulnerability confirmed on IM v6.9.2-5, pre-built binary, on Windows 8.1.Code: Select all
convert '|echo Hello > hello.txt;' null:
Vulnerability also persists even in latest version ImageMagick 7.0.1-2
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Imagemagick popen() shell vulnerability via filename
The current v7 is v7.0.1-7. If the developers weren't aware of this problem, I imagine it is pervasive through many versions,
snibgo's IM pages: im.snibgo.com
Re: Imagemagick popen() shell vulnerability via filename
Download ImageMagick 6.9.4-5 or 7.0.1-7 and add
- <policy domain="path" rights="none" pattern="|*" />
- # convert '|echo Hello > hello.txt;' null:
convert: not authorized `|echo Hello > hello.txt;' @ error/blob.c/OpenBlob/2451.
convert: no decode delegate for this image format `TXT;' @ error/constitute.c/ReadImage/508.
convert: no images defined `null:' @ error/convert.c/ConvertImageCommand/3235.
- #define MAGICKCORE_HAVE_POPEN 1
Re: Imagemagick popen() shell vulnerability via filename
So just to confirm the vulnerability is if the filename starts with a | e.g. |input.jpg
I assume the problem is if there is then code between the | and the filename that will be run before the file extension is reached. |echo Hello > hello.txt;
There is no problem if the filename is changed before it reaches IM?
I assume the problem is if there is then code between the | and the filename that will be run before the file extension is reached. |echo Hello > hello.txt;
There is no problem if the filename is changed before it reaches IM?