Skip to content

Commit c89d362

Browse files
committed
Update YARA definitions
1 parent 2e0deb9 commit c89d362

File tree

1 file changed

+74
-42
lines changed

1 file changed

+74
-42
lines changed

yara.yar

Lines changed: 74 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,30 @@ rule EXPL_JNDI_Exploit_Patterns_Dec21_1 {
2020
date = "2021-12-12"
2121
score = 60
2222
strings:
23-
$ = "/Basic/Command/Base64/"
24-
$ = "/Basic/ReverseShell/"
25-
$ = "/Basic/TomcatMemshell"
26-
$ = "/Basic/JettyMemshell"
27-
$ = "/Basic/WeblogicMemshell"
28-
$ = "/Basic/JBossMemshell"
29-
$ = "/Basic/WebsphereMemshell"
30-
$ = "/Basic/SpringMemshell"
31-
$ = "/Deserialization/URLDNS/"
32-
$ = "/Deserialization/CommonsCollections1/Dnslog/"
33-
$ = "/Deserialization/CommonsCollections2/Command/Base64/"
34-
$ = "/Deserialization/CommonsBeanutils1/ReverseShell/"
35-
$ = "/Deserialization/Jre8u20/TomcatMemshell"
36-
$ = "/TomcatBypass/Dnslog/"
37-
$ = "/TomcatBypass/Command/"
38-
$ = "/TomcatBypass/ReverseShell/"
39-
$ = "/TomcatBypass/TomcatMemshell"
40-
$ = "/TomcatBypass/SpringMemshell"
41-
$ = "/GroovyBypass/Command/"
42-
$ = "/WebsphereBypass/Upload/"
23+
$x01 = "/Basic/Command/Base64/"
24+
$x02 = "/Basic/ReverseShell/"
25+
$x03 = "/Basic/TomcatMemshell"
26+
$x04 = "/Basic/JettyMemshell"
27+
$x05 = "/Basic/WeblogicMemshell"
28+
$x06 = "/Basic/JBossMemshell"
29+
$x07 = "/Basic/WebsphereMemshell"
30+
$x08 = "/Basic/SpringMemshell"
31+
$x09 = "/Deserialization/URLDNS/"
32+
$x10 = "/Deserialization/CommonsCollections1/Dnslog/"
33+
$x11 = "/Deserialization/CommonsCollections2/Command/Base64/"
34+
$x12 = "/Deserialization/CommonsBeanutils1/ReverseShell/"
35+
$x13 = "/Deserialization/Jre8u20/TomcatMemshell"
36+
$x14 = "/TomcatBypass/Dnslog/"
37+
$x15 = "/TomcatBypass/Command/"
38+
$x16 = "/TomcatBypass/ReverseShell/"
39+
$x17 = "/TomcatBypass/TomcatMemshell"
40+
$x18 = "/TomcatBypass/SpringMemshell"
41+
$x19 = "/GroovyBypass/Command/"
42+
$x20 = "/WebsphereBypass/Upload/"
43+
44+
$fp1 = "<html"
4345
condition:
44-
1 of them
46+
1 of ($x*) and not 1 of ($fp*)
4547
}
4648

4749
rule EXPL_Log4j_CVE_2021_44228_JAVA_Exception_Dec21_1 {
@@ -66,20 +68,24 @@ rule EXPL_Log4j_CVE_2021_44228_Dec21_Soft {
6668
author = "Florian Roth"
6769
reference = "https://twitter.com/h113sdx/status/1469010902183661568?s=20"
6870
date = "2021-12-10"
69-
modified = "2021-12-12"
71+
modified = "2021-12-20"
7072
score = 60
73+
type = "file"
7174
strings:
72-
$ = "${jndi:ldap:/"
73-
$ = "${jndi:rmi:/"
74-
$ = "${jndi:ldaps:/"
75-
$ = "${jndi:dns:/"
76-
$ = "${jndi:iiop:/"
77-
$ = "${jndi:http:/"
78-
$ = "${jndi:nis:/"
79-
$ = "${jndi:nds:/"
80-
$ = "${jndi:corba:/"
75+
$x01 = "${jndi:ldap:/"
76+
$x02 = "${jndi:rmi:/"
77+
$x03 = "${jndi:ldaps:/"
78+
$x04 = "${jndi:dns:/"
79+
$x05 = "${jndi:iiop:/"
80+
$x06 = "${jndi:http:/"
81+
$x07 = "${jndi:nis:/"
82+
$x08 = "${jndi:nds:/"
83+
$x09 = "${jndi:corba:/"
84+
85+
$fp1 = "<html"
86+
$fp2 = "/nessus}"
8187
condition:
82-
1 of them
88+
1 of ($x*) and not 1 of ($fp*)
8389
}
8490

8591
rule EXPL_Log4j_CVE_2021_44228_Dec21_OBFUSC {
@@ -88,6 +94,7 @@ rule EXPL_Log4j_CVE_2021_44228_Dec21_OBFUSC {
8894
author = "Florian Roth"
8995
reference = "https://twitter.com/h113sdx/status/1469010902183661568?s=20"
9096
date = "2021-12-12"
97+
modified = "2021-12-13"
9198
score = 60
9299
strings:
93100
$x1 = "$%7Bjndi:"
@@ -98,8 +105,10 @@ rule EXPL_Log4j_CVE_2021_44228_Dec21_OBFUSC {
98105
$x6 = "${${env:BARFOO:-j}"
99106
$x7 = "${::-l}${::-d}${::-a}${::-p}"
100107
$x8 = "${base64:JHtqbmRp"
108+
109+
$fp1 = "<html"
101110
condition:
102-
1 of them
111+
1 of ($x*) and not 1 of ($fp*)
103112
}
104113

105114
rule EXPL_Log4j_CVE_2021_44228_Dec21_Hard {
@@ -112,9 +121,10 @@ rule EXPL_Log4j_CVE_2021_44228_Dec21_Hard {
112121
score = 80
113122
strings:
114123
$x1 = /\$\{jndi:(ldap|ldaps|rmi|dns|iiop|http|nis|nds|corba):\/[\/]?[a-z-\.0-9]{3,120}:[0-9]{2,5}\/[a-zA-Z\.]{1,32}\}/
124+
$x2 = "Reference Class Name: foo"
115125
$fp1r = /(ldap|rmi|ldaps|dns):\/[\/]?(127\.0\.0\.1|192\.168\.|172\.[1-3][0-9]\.|10\.)/
116126
condition:
117-
$x1 and not 1 of ($fp*)
127+
1 of ($x*) and not 1 of ($fp*)
118128
}
119129

120130
rule SUSP_Base64_Encoded_Exploit_Indicators_Dec21 {
@@ -123,6 +133,7 @@ rule SUSP_Base64_Encoded_Exploit_Indicators_Dec21 {
123133
author = "Florian Roth"
124134
reference = "https://twitter.com/Reelix/status/1469327487243071493"
125135
date = "2021-12-10"
136+
modified = "2021-12-13"
126137
score = 70
127138
strings:
128139
/* curl -s */
@@ -133,8 +144,11 @@ rule SUSP_Base64_Encoded_Exploit_Indicators_Dec21 {
133144
$sb1 = "fHdnZXQgLXEgLU8tI"
134145
$sb2 = "x3Z2V0IC1xIC1PLS"
135146
$sb3 = "8d2dldCAtcSAtTy0g"
147+
148+
$fp1 = "<html"
136149
condition:
137150
1 of ($sa*) and 1 of ($sb*)
151+
and not 1 of ($fp*)
138152
}
139153

140154
rule SUSP_JDNIExploit_Indicators_Dec21 {
@@ -160,16 +174,34 @@ rule SUSP_EXPL_OBFUSC_Dec21_1{
160174
score = 60
161175
strings:
162176
/* ${lower:X} - single character match */
163-
$ = { 24 7B 6C 6F 77 65 72 3A ?? 7D }
177+
$x1 = { 24 7B 6C 6F 77 65 72 3A ?? 7D }
164178
/* ${upper:X} - single character match */
165-
$ = { 24 7B 75 70 70 65 72 3A ?? 7D }
179+
$x2 = { 24 7B 75 70 70 65 72 3A ?? 7D }
166180
/* URL encoded lower - obfuscation in URL */
167-
$ = "$%7blower:"
168-
$ = "$%7bupper:"
169-
$ = "%24%7bjndi:"
170-
$ = "$%7Blower:"
171-
$ = "$%7Bupper:"
172-
$ = "%24%7Bjndi:"
181+
$x3 = "$%7blower:"
182+
$x4 = "$%7bupper:"
183+
$x5 = "%24%7bjndi:"
184+
$x6 = "$%7Blower:"
185+
$x7 = "$%7Bupper:"
186+
$x8 = "%24%7Bjndi:"
187+
188+
$fp1 = "<html"
189+
condition:
190+
1 of ($x*) and not 1 of ($fp*)
191+
}
192+
193+
rule SUSP_JDNIExploit_Error_Indicators_Dec21_1 {
194+
meta:
195+
description = "Detects error messages related to JDNI usage in log files that can indicate a Log4Shell / Log4j exploitation"
196+
author = "Florian Roth"
197+
reference = "https://twitter.com/marcioalm/status/1470361495405875200?s=20"
198+
date = "2021-12-10"
199+
modified = "2021-12-17"
200+
score = 70
201+
strings:
202+
$x1 = "FATAL log4j - Message: BadAttributeValueException: "
203+
$x2 = "Error looking up JNDI resource"
173204
condition:
174205
1 of them
175206
}
207+

0 commit comments

Comments
 (0)