From 3724a206fcfaf3578945acfb5fbcb4a85ef33441 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 21 Feb 2018 11:34:54 +0100 Subject: Major cleanup of useless files --- php-malware-finder/asp.yar | 46 ------ php-malware-finder/php.yar | 219 ++++++++++++++++++++++++-- php-malware-finder/phpmalwarefinder | 153 +++--------------- php-malware-finder/samples/classic/cmdasp.asp | 55 ------- php-malware-finder/tests.sh | 3 - 5 files changed, 226 insertions(+), 250 deletions(-) delete mode 100644 php-malware-finder/asp.yar delete mode 100644 php-malware-finder/samples/classic/cmdasp.asp diff --git a/php-malware-finder/asp.yar b/php-malware-finder/asp.yar deleted file mode 100644 index 6af74fb..0000000 --- a/php-malware-finder/asp.yar +++ /dev/null @@ -1,46 +0,0 @@ -import "hash" -include "whitelist.yar" -include "common.yar" - -global private rule IsAsp -{ - strings: - $asp = /<%|@{}/ - $cs = /using .{4,25};/ - - condition: - ($asp or $cs) and filesize < 5MB -} - -rule ObfuscatedAsp -{ - strings: - $ = /LANGUAGE\s*=\s*VBScript.Encode/ nocase - $ = /(".{1,5}"&){5,}/ // "e"&"v"&"a"&"l" - $ = /(chr\s*\(\s*\d{1,3}\s*\)[+\)\s]*){5,}/ nocase // chr(114)+chr(101)+chr(113)+chr(117)+chr(101) - $stunnix = /execute\("dIm [a-z]*"\):[a-z]* = unescape/ nocase // http://stunnix.com/ - - condition: - any of them and not IsWhitelisted -} - -rule ObfuscatedEncodingAsp -{ - strings: - $unicode = /\\u[a-f0-9]/ nocase - $html_encode = /&#([0-9]{3}|x[a-f0-9]{2});/ nocase - - condition: - (#unicode >= 10 or #html_encode >= 10) and not IsWhitelisted -} - -rule DangerousAsp -{ - strings: - $ = /createobject\s*\(\s*"(WScript\.Shell|WScript\.Network|Shell\.Application|Scripting\.FileSystemObject|ScriptControl)/ nocase - $ = /eval\s*\({0,1}\s*request/ nocase - - condition: - 2 of them and not IsWhitelisted -} - diff --git a/php-malware-finder/php.yar b/php-malware-finder/php.yar index 57d6e27..06713d5 100644 --- a/php-malware-finder/php.yar +++ b/php-malware-finder/php.yar @@ -1,6 +1,5 @@ import "hash" include "whitelist.yar" -include "common.yar" /* Detect: @@ -35,15 +34,15 @@ global private rule IsPhp rule NonPrintableChars { - strings: - /* - Searching only for non-printable characters completely kills the perf, - so we have to use atoms (https://gist.github.com/Neo23x0/e3d4e316d7441d9143c7) - to get an acceptable speed. - */ - $non_printables = /(function|return|base64_decode).{,256}[^\x09-\x0d\x20-\x7E]{3}/ + strings: + /* + Searching only for non-printable characters completely kills the perf, + so we have to use atoms (https://gist.github.com/Neo23x0/e3d4e316d7441d9143c7) + to get an acceptable speed. + */ + $non_printables = /(function|return|base64_decode).{,256}[^\x09-\x0d\x20-\x7E]{3}/ - condition: + condition: (any of them) and not IsWhitelisted } @@ -98,8 +97,8 @@ rule DodgyPhp $various = " diff --git a/php-malware-finder/tests.sh b/php-malware-finder/tests.sh index c6a380a..3443cc0 100755 --- a/php-malware-finder/tests.sh +++ b/php-malware-finder/tests.sh @@ -97,7 +97,4 @@ run_test real/awvjtnz.php '$reversed:' run_test undetected/smart.php '0x6:$extract:' -# Asp files -run_test_asp classic/cmdasp.asp 'DodgyStrings' - echo "[+] Congratz, the $CPT tests succeeded!" -- cgit v1.3