Exiftool Priv Esc
* * * * * root bash /opt/image-exif.sh
cat /opt/image-exif.sh
#! /bin/bash
#07/06/18 A BASH script to collect EXIF metadata
echo -ne "\\n metadata directory cleaned! \\n\\n"
IMAGES='/var/www/html/subrion/uploads'
META='/opt/metadata'
FILE=`openssl rand -hex 5`
LOGFILE="$META/$FILE"
echo -ne "\\n Processing EXIF metadata now... \\n\\n"
ls $IMAGES | grep "jpg" | while read filename;
do
exiftool "$IMAGES/$filename" >> $LOGFILE
done
echo -ne "\\n\\n Processing is finished! \\n\\n\\n"
The script extracts exif data from all the jpegs in the upload directory of subrion. If we can inject some metadata that allow us to remotely execute commands, we could execute commands as root since the script is runnign as root.
Execute the following commands to generate exif data that makes bash runable by normal users as root.
We upload this malicious exploit.jpg to the Subrion CMS again and after like 10-15 seconds our /bin/bash had SUID bit.
Last updated


