From 4a9899a9c1b5d675599379ed42b08dd802713866 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 26 Jul 2017 20:47:31 +0200 Subject: Add some detections --- php-malware-finder/common.yar | 2 +- php-malware-finder/php.yar | 6 ++++-- php-malware-finder/samples/artificial/dodgy.php | 4 ++-- php-malware-finder/tests.sh | 14 +++++++------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/php-malware-finder/common.yar b/php-malware-finder/common.yar index 3559b79..f9d4573 100644 --- a/php-malware-finder/common.yar +++ b/php-malware-finder/common.yar @@ -139,7 +139,7 @@ rule DodgyStrings $ = "ps -aux" fullword $ = "rootkit" fullword nocase $ = "slowloris" fullword nocase - $ = "suhosin.executor.func.blacklist" + $ = "suhosin" fullword $ = "sun-tzu" fullword nocase // Because quotes from the Art of War is mandatory for any cool webshell. $ = /trojan (payload)?/ $ = "uname -a" fullword diff --git a/php-malware-finder/php.yar b/php-malware-finder/php.yar index 644419c..4af8116 100644 --- a/php-malware-finder/php.yar +++ b/php-malware-finder/php.yar @@ -89,11 +89,11 @@ rule DodgyPhp $htaccess = "SetHandler application/x-httpd-php" $iis_com = /IIS:\/\/localhost\/w3svc/ $include = /include\s*\(\s*[^\.]+\.(png|jpg|gif|bmp)/ // Clever includes - $ini_get = /ini_(get|set|restore)\s*\(\s*['"](safe_mode|open_basedir|disable_function|safe_mode_exec_dir|safe_mode_include_dir|register_globals|allow_url_include)/ nocase + $ini_get = /ini_(get|set|restore)\s*\(\s*['"](safe_mode|open_basedir|disable_(function|classe)s|safe_mode_exec_dir|safe_mode_include_dir|register_globals|allow_url_include)/ nocase $pr = /(preg_replace(_callback)?|mb_ereg_replace|preg_filter)\s*\(.+(\/|\\x2f)(e|\\x65)['"]/ nocase // http://php.net/manual/en/function.preg-replace.php $register_function = /register_[a-z]+_function\s*\(\s*['"]\s*(eval|assert|passthru|exec|include|system|shell_execute|`)/ // https://github.com/nbs-system/php-malware-finder/issues/41 $safemode_bypass = /\x00\/\.\.\/|LD_PRELOAD/ - $shellshock = /\(\)\s*{\s*:\s*;\s*}\s*;/ + $shellshock = /\(\)\s*{\s*[a-z:]\s*;\s*}\s*;/ $udp_dos = /fsockopen\s*\(\s*['"]udp:\/\// nocase $various = "