summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien (jvoisin) Voisin2016-03-01 13:34:27 +0100
committerJulien (jvoisin) Voisin2016-03-01 13:34:27 +0100
commit6fe1ff710b5e543384b2c78eeee35c999b444364 (patch)
tree71b3fbc0d6914f220360acfb40b9943a0161cc39
parentf976f363cd94738ab1812991f9b45d50c5b8fbbb (diff)
Add a rule to catch fancy .htaccess tricks
-rw-r--r--php-malware-finder/malwares.yara1
-rw-r--r--php-malware-finder/samples/artificial/dodgy.php2
-rwxr-xr-xphp-malware-finder/tests.sh1
3 files changed, 3 insertions, 1 deletions
diff --git a/php-malware-finder/malwares.yara b/php-malware-finder/malwares.yara
index b47dce3..edb1ffb 100644
--- a/php-malware-finder/malwares.yara
+++ b/php-malware-finder/malwares.yara
@@ -188,6 +188,7 @@ rule DodgyStrings
188{ 188{
189 strings: 189 strings:
190 $ = ".bash_history" 190 $ = ".bash_history"
191 $ = /AddType\s+application\/x-httpd-php\s+\.htaccess/
191 $ = ".mysql_history" 192 $ = ".mysql_history"
192 $ = ".ssh/authorized_keys" 193 $ = ".ssh/authorized_keys"
193 $ = "/(.*)/e" // preg_replace code execution 194 $ = "/(.*)/e" // preg_replace code execution
diff --git a/php-malware-finder/samples/artificial/dodgy.php b/php-malware-finder/samples/artificial/dodgy.php
index 1c85f39..3aac254 100644
--- a/php-malware-finder/samples/artificial/dodgy.php
+++ b/php-malware-finder/samples/artificial/dodgy.php
@@ -15,4 +15,4 @@ $c = "env x='() { :;}; echo vulnerable' bash -c 'echo this is a test'";
15fsockopen ( 'udp://'); 15fsockopen ( 'udp://');
16call_user_func('LOL'); 16call_user_func('LOL');
17$d = "<!--#exec cmd="; 17$d = "<!--#exec cmd=";
18 18$c = "AddType application/x-httpd-php .htaccess"
diff --git a/php-malware-finder/tests.sh b/php-malware-finder/tests.sh
index 7566e89..fe9141a 100755
--- a/php-malware-finder/tests.sh
+++ b/php-malware-finder/tests.sh
@@ -73,6 +73,7 @@ run_test artificial/dodgy.php '0x18d:$shellshock: () { :;};'
73run_test artificial/dodgy.php '0x169:$pr: preg_replace ("/\*/e' 73run_test artificial/dodgy.php '0x169:$pr: preg_replace ("/\*/e'
74run_test artificial/dodgy.php '0x1e0:$user_function: call_user_func' 74run_test artificial/dodgy.php '0x1e0:$user_function: call_user_func'
75run_test artificial/dodgy.php '0x1fd:$various: <!--#exec cmd=' 75run_test artificial/dodgy.php '0x1fd:$various: <!--#exec cmd='
76run_test artificial/dodgy.php '0x214:$: AddType application/x-httpd-php .htaccess'
76 77
77run_test artificial/bypasses.php 'DodgyPhp' 78run_test artificial/bypasses.php 'DodgyPhp'
78run_test artificial/bypasses.php '0x6d:$execution: call_user_func_array($_POST' 79run_test artificial/bypasses.php '0x6d:$execution: call_user_func_array($_POST'