Skip to content

Commit 9bccbeb

Browse files
committed
2 parents acf8d73 + 246b83a commit 9bccbeb

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

yara/expl_proxyshell.yar

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
rule EXPL_Exchange_ProxyShell_Failed_Aug21_1 : SCRIPT {
1+
rule EXPL_Exchange_ProxyShell_Failed_Aug21_1: SCRIPT {
32
meta:
43
description = "Detects ProxyShell exploitation attempts in log files"
54
author = "Florian Roth (Nextron Systems)"
@@ -15,7 +14,7 @@ rule EXPL_Exchange_ProxyShell_Failed_Aug21_1 : SCRIPT {
1514
1 of them
1615
}
1716

18-
rule EXPL_Exchange_ProxyShell_Successful_Aug21_1 : SCRIPT {
17+
rule EXPL_Exchange_ProxyShell_Successful_Aug21_1: SCRIPT {
1918
meta:
2019
description = "Detects successful ProxyShell exploitation attempts in log files"
2120
author = "Florian Roth (Nextron Systems)"
@@ -26,7 +25,7 @@ rule EXPL_Exchange_ProxyShell_Successful_Aug21_1 : SCRIPT {
2625
id = "8c11cd1a-6d3f-5f29-af61-17179b01ca8b"
2726
strings:
2827
$xr1a = / \/autodiscover\/autodiscover\.json[^\n]{1,300}\/(powershell|X-Rps-CAT)/ nocase ascii
29-
$xr1b = / \/autodiscover\/autodiscover\.json[^\n]{1,300}\/(mapi\/nspi|EWS\/)[^\n]{1,400}(200|302) 0 0/
28+
$xr1b = / \/autodiscover\/autodiscover\.json[^\n]{1,300}\/(mapi\/nspi|EWS\/)[^\n]{1,400}(200|302) 0 0/
3029
$xr2 = /autodiscover\/autodiscover\.json[^\n]{1,60}&X-Rps-CAT=/ nocase ascii
3130
$xr3 = /Email=autodiscover\/autodiscover\.json[^\n]{1,400}200 0 0/ nocase ascii
3231
condition:
@@ -43,7 +42,7 @@ rule WEBSHELL_ASPX_ProxyShell_Aug21_2 {
4342
strings:
4443
$s1 = "Page Language=" ascii nocase
4544
condition:
46-
uint32(0) == 0x4e444221 /* PST header: !BDN */
45+
uint32(0) == 0x4e444221 /* PST header: !BDN */
4746
and filesize < 2MB
4847
and $s1
4948
}
@@ -59,12 +58,12 @@ rule WEBSHELL_ASPX_ProxyShell_Aug21_3 {
5958
strings:
6059
$s1 = "Page Language=" ascii nocase
6160
condition:
62-
uint16(0) == 0x8230 /* DER start */
61+
uint16(0) == 0x8230 /* DER start */
6362
and filesize < 10KB
6463
and $s1
6564
}
6665

67-
rule WEBSHELL_ASPX_ProxyShell_Sep21_1 {
66+
rule WEBSHELL_ASPX_ProxyShell_Sep21_1 {
6867
meta:
6968
description = "Detects webshells dropped by ProxyShell exploitation based on their file header (must be PST) and base64 decoded request"
7069
author = "Tobias Michalski"
@@ -89,7 +88,7 @@ rule APT_IIS_Config_ProxyShell_Artifacts {
8988
score = 90
9089
id = "21888fc0-82c6-555a-9320-9cbb8332a843"
9190
strings:
92-
$a1 = "<site name=" ascii /* marker used to select IIS configs */
91+
$a1 = "<site name=" ascii /* marker used to select IIS configs */
9392
$a2 = "<sectionGroup name=\"system.webServer\">" ascii
9493
9594
$sa1 = " physicalPath=\"C:\\ProgramData\\COM" ascii
@@ -125,6 +124,7 @@ rule WEBSHELL_ASPX_ProxyShell_Aug15 {
125124
author = "Moritz Oettle"
126125
reference = "https://github.com/hvs-consulting/ioc_signatures/tree/main/Proxyshell"
127126
date = "2021-09-04"
127+
modified = "2025-09-04"
128128
score = 75
129129
id = "b1e6c0f3-787f-59b8-8123-4045522047ca"
130130
strings:
@@ -137,12 +137,12 @@ rule WEBSHELL_ASPX_ProxyShell_Aug15 {
137137
$g7 = "Request[" ascii
138138
$g8 = "eval/*" ascii
139139
140-
$s1 = "AppcacheVer" ascii /* HTTP Request Parameter */
141-
$s2 = "clientCode" ascii /* HTTP Request Parameter */
140+
$s1 = "AppcacheVer" ascii /* HTTP Request Parameter */
141+
//$s2 = "clientCode" ascii /* HTTP Request Parameter */
142142
$s3 = "LaTkWfI64XeDAXZS6pU1KrsvLAcGH7AZOQXjrFkT816RnFYJQR" ascii
143143
condition:
144144
filesize < 1KB and
145-
( 1 of ($s*) or 4 of ($g*) )
145+
(1 of ($s*) or 4 of ($g*))
146146
}
147147

148148
rule WEBSHELL_Mailbox_Export_PST_ProxyShell_Aug26 {
@@ -154,7 +154,7 @@ rule WEBSHELL_Mailbox_Export_PST_ProxyShell_Aug26 {
154154
score = 85
155155
id = "6aea414f-d27c-5202-84f8-b8620782fc90"
156156
strings:
157-
$x1 = "!BDN" /* PST file header */
157+
$x1 = "!BDN" /* PST file header */
158158
159159
$g1 = "Page language=" ascii
160160
$g2 = "<%@ Page" ascii
@@ -164,16 +164,15 @@ rule WEBSHELL_Mailbox_Export_PST_ProxyShell_Aug26 {
164164
$g6 = "script language=" ascii
165165
$g7 = "Request[" ascii
166166
167-
$s1 = "gold8899" ascii /* HTTP Request Parameter */
168-
$s2 = "exec_code" ascii /* HTTP Request Parameter */
169-
$s3 = "orangenb" ascii /* HTTP Request Parameter */
167+
$s1 = "gold8899" ascii /* HTTP Request Parameter */
168+
$s2 = "exec_code" ascii /* HTTP Request Parameter */
169+
$s3 = "orangenb" ascii /* HTTP Request Parameter */
170170
condition:
171171
filesize < 500KB and
172172
$x1 at 0 and
173-
( 1 of ($s*) or 3 of ($g*) )
173+
(1 of ($s*) or 3 of ($g*))
174174
}
175175

176-
177176
/*
178177
Hunting Rules
179178
*/
@@ -187,7 +186,7 @@ rule SUSP_IIS_Config_ProxyShell_Artifacts {
187186
score = 70
188187
id = "bde65d9e-b17d-5746-8d29-8419363d0511"
189188
strings:
190-
$a1 = "<site name=" ascii /* marker used to select IIS configs */
189+
$a1 = "<site name=" ascii /* marker used to select IIS configs */
191190
$a2 = "<sectionGroup name=\"system.webServer\">" ascii
192191
193192
$s1 = " physicalPath=\"C:\\ProgramData\\" ascii
@@ -205,7 +204,7 @@ rule SUSP_IIS_Config_VirtualDir {
205204
score = 60
206205
id = "cfe5ca5e-a0cc-5f60-84d2-1b0538e999c7"
207206
strings:
208-
$a1 = "<site name=" ascii /* marker used to select IIS configs */
207+
$a1 = "<site name=" ascii /* marker used to select IIS configs */
209208
$a2 = "<sectionGroup name=\"system.webServer\">" ascii
210209
211210
$s2 = " physicalPath=\"C:\\Users\\" ascii
@@ -231,21 +230,21 @@ rule SUSP_ASPX_PossibleDropperArtifact_Aug21 {
231230
$fp1 = "Page Language=\"java\"" ascii nocase
232231
condition:
233232
filesize < 500KB
234-
and not uint16(0) == 0x4B50 and not uint16(0) == 0x6152 and not uint16(0) == 0x8b1f // Exclude ZIP / RAR / GZIP files (can cause FPs when uncompressed)
235-
and not uint16(0) == 0x5A4D // PE
236-
and not uint16(0) == 0xCFD0 // OLE
237-
and not uint16(0) == 0xC3D4 // PCAP
238-
and not uint16(0) == 0x534D // CAB
233+
and not uint16(0) == 0x4B50 and not uint16(0) == 0x6152 and not uint16(0) == 0x8b1f // Exclude ZIP / RAR / GZIP files (can cause FPs when uncompressed)
234+
and not uint16(0) == 0x5A4D // PE
235+
and not uint16(0) == 0xCFD0 // OLE
236+
and not uint16(0) == 0xC3D4 // PCAP
237+
and not uint16(0) == 0x534D // CAB
239238
and all of ($s*) and not 1 of ($fp*) and
240239
(
241-
((uint8(0) < 0x20 or uint8(0) > 0x7E /*non-ASCII*/ ) and uint8(0) != 0x9 /* tab */ and uint8(0) != 0x0D /* carriage return */ and uint8(0) != 0x0A /* new line */ and uint8(0) != 0xEF /* BOM UTF-8 */)
242-
or ((uint8(1) < 0x20 or uint8(1) > 0x7E /*non-ASCII*/ ) and uint8(1) != 0x9 /* tab */ and uint8(1) != 0x0D /* carriage return */ and uint8(1) != 0x0A /* new line */ and uint8(1) != 0xBB /* BOM UTF-8 */)
243-
or ((uint8(2) < 0x20 or uint8(2) > 0x7E /*non-ASCII*/ ) and uint8(2) != 0x9 /* tab */ and uint8(2) != 0x0D /* carriage return */ and uint8(2) != 0x0A /* new line */ and uint8(2) != 0xBF /* BOM UTF-8 */)
244-
or ((uint8(3) < 0x20 or uint8(3) > 0x7E /*non-ASCII*/ ) and uint8(3) != 0x9 /* tab */ and uint8(3) != 0x0D /* carriage return */ and uint8(3) != 0x0A /* new line */)
245-
or ((uint8(4) < 0x20 or uint8(4) > 0x7E /*non-ASCII*/ ) and uint8(4) != 0x9 /* tab */ and uint8(4) != 0x0D /* carriage return */ and uint8(4) != 0x0A /* new line */)
246-
or ((uint8(5) < 0x20 or uint8(5) > 0x7E /*non-ASCII*/ ) and uint8(5) != 0x9 /* tab */ and uint8(5) != 0x0D /* carriage return */ and uint8(5) != 0x0A /* new line */)
247-
or ((uint8(6) < 0x20 or uint8(6) > 0x7E /*non-ASCII*/ ) and uint8(6) != 0x9 /* tab */ and uint8(6) != 0x0D /* carriage return */ and uint8(6) != 0x0A /* new line */)
248-
or ((uint8(7) < 0x20 or uint8(7) > 0x7E /*non-ASCII*/ ) and uint8(7) != 0x9 /* tab */ and uint8(7) != 0x0D /* carriage return */ and uint8(7) != 0x0A /* new line */)
240+
((uint8(0) < 0x20 or uint8(0) > 0x7E /*non-ASCII*/) and uint8(0) != 0x9 /* tab */and uint8(0) != 0x0D /* carriage return */and uint8(0) != 0x0A /* new line */and uint8(0) != 0xEF /* BOM UTF-8 */)
241+
or ((uint8(1) < 0x20 or uint8(1) > 0x7E /*non-ASCII*/) and uint8(1) != 0x9 /* tab */and uint8(1) != 0x0D /* carriage return */and uint8(1) != 0x0A /* new line */and uint8(1) != 0xBB /* BOM UTF-8 */)
242+
or ((uint8(2) < 0x20 or uint8(2) > 0x7E /*non-ASCII*/) and uint8(2) != 0x9 /* tab */and uint8(2) != 0x0D /* carriage return */and uint8(2) != 0x0A /* new line */and uint8(2) != 0xBF /* BOM UTF-8 */)
243+
or ((uint8(3) < 0x20 or uint8(3) > 0x7E /*non-ASCII*/) and uint8(3) != 0x9 /* tab */and uint8(3) != 0x0D /* carriage return */and uint8(3) != 0x0A /* new line */)
244+
or ((uint8(4) < 0x20 or uint8(4) > 0x7E /*non-ASCII*/) and uint8(4) != 0x9 /* tab */and uint8(4) != 0x0D /* carriage return */and uint8(4) != 0x0A /* new line */)
245+
or ((uint8(5) < 0x20 or uint8(5) > 0x7E /*non-ASCII*/) and uint8(5) != 0x9 /* tab */and uint8(5) != 0x0D /* carriage return */and uint8(5) != 0x0A /* new line */)
246+
or ((uint8(6) < 0x20 or uint8(6) > 0x7E /*non-ASCII*/) and uint8(6) != 0x9 /* tab */and uint8(6) != 0x0D /* carriage return */and uint8(6) != 0x0A /* new line */)
247+
or ((uint8(7) < 0x20 or uint8(7) > 0x7E /*non-ASCII*/) and uint8(7) != 0x9 /* tab */and uint8(7) != 0x0D /* carriage return */and uint8(7) != 0x0A /* new line */)
249248
)
250249
}
251250

0 commit comments

Comments
 (0)