/* Detect: - phpencode.org - http://www.pipsomania.com/best_php_obfuscator.do - http://atomiku.com/online-php-code-obfuscator/ - http://www.webtoolsvn.com/en-decode/ - http://obfuscator.uk/example/ - http://w3webtools.com/encode-php-online/ - http://www.joeswebtools.com/security/php-obfuscator/ - https://github.com/epinna/weevely3 - http://cipherdesign.co.uk/service/php-obfuscator - http://sysadmin.cyklodev.com/online-php-obfuscator/ - http://mohssen.org/SpinObf.php - https://code.google.com/p/carbylamine/ */ private rule IsPhp { strings: $php = " 5 or $weevely3 or $danone) } private rule base64 { strings: $eval = "ZXZhbCg" $system = "c3lzdGVt" $preg_replace = "cHJlZ19yZXBsYWNl" $exec = "ZXhlYyg" condition: any of them } private rule hex { strings: $eval = "\\x65\\x76\\x61\\x6C\\x28" nocase $exec = "\\x65\\x78\\x65\\x63" nocase $system = "\\x73\\x79\\x73\\x74\\x65\\x6d" nocase $preg_replace = "\\x70\\x72\\x65\\x67\\x5f\\x72\\x65\\x70\\x6c\\x61\\x63\\x65" nocase condition: any of them } rule SuspiciousEncoding { condition: IsPhp and (base64 or hex) } rule DodgyPhp { strings: $execution = /(eval|passthru|exec|system|win_shell_execute)\((base64_decode|php:\/\/input|str_rot13|gz(inflate|uncompress)|getenv|\\?\$_(GET|REQUEST|POST))/ $double_encoding = /(base64_decode\s*\(\s*){2}/ $basedir_bypass = /(curl_init\([\"']file:[\"']|file:file:\/\/)/ $safemode_bypass = /\x00\/\.\.\/|LD_PRELOAD/ $shellshock = /putenv\(["']PHP_[^=]=\(\) { [^}] };/ $restore_bypass = /ini_restore\(['"](safe_mode|open_basedir)['"]\)/ $various = "