summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2015-07-09 11:53:51 +0200
committerjvoisin2015-07-09 11:53:51 +0200
commit0fdae3a7ac0d99624626ae42ae7966689b1b989a (patch)
treeb2dff4cdc684745171b8002ca704e0b96b953050
parent294182b8d5703c2aacd7e2cd5bcd5bf63296007f (diff)
Add a whitelist system
-rw-r--r--malwares.yara16
1 files changed, 13 insertions, 3 deletions
diff --git a/malwares.yara b/malwares.yara
index 0df037b..b3f5e78 100644
--- a/malwares.yara
+++ b/malwares.yara
@@ -1,3 +1,4 @@
1import "hash"
1/* 2/*
2 Detect: 3 Detect:
3 - phpencode.org 4 - phpencode.org
@@ -14,6 +15,15 @@
14 - https://code.google.com/p/carbylamine/ 15 - https://code.google.com/p/carbylamine/
15*/ 16*/
16 17
18private rule IsWhitelisted
19{
20 condition:
21 /* Prestashop 1.6.1.0 */
22 hash.sha1(0, filesize) == "544cd822e2195ac162c9f0387031709042a72cfd" or // tools/htmlpurifier/HTMLPurifier.standalone.php
23 hash.sha1(0, filesize) == "bb8c0d735809b9412265729906016329f3e681ff" or // classes/webservice/WebserviceOutputJSON.php
24 hash.sha1(0, filesize) == "15da986fccdc7104f9d4e8c344f332db5ae9a32b" // classes/Tools.php
25}
26
17private rule IsPhp 27private rule IsPhp
18{ 28{
19 strings: 29 strings:
@@ -62,7 +72,7 @@ rule ObfuscatedPhp
62 $danone = /\$s20=strtoupper\((\$[0-9A-Za-z]{1,4}\[\d+\]\.){2,9}[^\)]*\);if/ 72 $danone = /\$s20=strtoupper\((\$[0-9A-Za-z]{1,4}\[\d+\]\.){2,9}[^\)]*\);if/
63 $strange_arg = /\${\$[0-9a-zA-z]+}/ 73 $strange_arg = /\${\$[0-9a-zA-z]+}/
64 condition: 74 condition:
65 IsPhp and any of them 75 IsPhp and any of them and not IsWhitelisted
66} 76}
67 77
68private rule base64 78private rule base64
@@ -111,7 +121,7 @@ rule DodgyPhp
111 $udp_dos = /sockopen\s*\(['"]udp:\/\// 121 $udp_dos = /sockopen\s*\(['"]udp:\/\//
112 122
113 condition: 123 condition:
114 IsPhp and (any of them or CloudFlareBypass) 124 IsPhp and (any of them or CloudFlareBypass) and not IsWhitelisted
115} 125}
116 126
117rule DangerousPhp 127rule DangerousPhp
@@ -148,7 +158,7 @@ rule DangerousPhp
148 $whitelist = /escapeshellcmd|escapeshellarg/ 158 $whitelist = /escapeshellcmd|escapeshellarg/
149 159
150 condition: 160 condition:
151 IsPhp and not $whitelist and (5 of them or #system > 250) 161 IsPhp and not $whitelist and (5 of them or #system > 250) and not IsWhitelisted
152} 162}
153 163
154rule DodgyStrings 164rule DodgyStrings