Skip to content

Commit ccac16e

Browse files
w0rk3rgithub-actions[bot]
authored andcommitted
[Rule Tuning] PowerShell Rules (#3903)
Removed changes from: - rules/windows/defense_evasion_posh_assembly_load.toml - rules/windows/defense_evasion_posh_compressed.toml - rules/windows/discovery_posh_suspicious_api_functions.toml - rules/windows/execution_posh_psreflect.toml - rules_building_block/collection_posh_compression.toml - rules_building_block/defense_evasion_powershell_clear_logs_script.toml (selectively cherry picked from commit 6bc1913)
1 parent 213660f commit ccac16e

8 files changed

+37
-25
lines changed

rules/windows/collection_posh_keylogger.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/10/15"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -57,7 +57,7 @@ references = [
5757
"https://github.com/EmpireProject/Empire/blob/master/data/module_source/collection/Get-Keystrokes.ps1",
5858
"https://github.com/MojtabaTajik/FunnyKeylogger/blob/master/FunnyLogger.ps1",
5959
]
60-
risk_score = 47
60+
risk_score = 73
6161
rule_id = "bd2c86a0-8b61-4457-ab38-96943984e889"
6262
setup = """## Setup
6363
@@ -77,7 +77,7 @@ Steps to implement the logging policy via registry:
7777
reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1
7878
```
7979
"""
80-
severity = "medium"
80+
severity = "high"
8181
tags = [
8282
"Domain: Endpoint",
8383
"OS: Windows",

rules/windows/credential_access_posh_invoke_ninjacopy.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/01/23"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -50,9 +50,9 @@ Invoke-NinjaCopy is a PowerShell script capable of reading SYSTEM files that wer
5050
references = [
5151
"https://github.com/BC-SECURITY/Empire/blob/main/empire/server/data/module_source/collection/Invoke-NinjaCopy.ps1",
5252
]
53-
risk_score = 47
53+
risk_score = 73
5454
rule_id = "b8386923-b02c-4b94-986a-d223d9b01f88"
55-
severity = "medium"
55+
severity = "high"
5656
tags = [
5757
"Domain: Endpoint",
5858
"OS: Windows",

rules/windows/credential_access_posh_kerb_ticket_dump.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/07/26"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -61,7 +61,7 @@ This rule indicates the use of scripts that contain code capable of dumping Kerb
6161
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
6262
"""
6363
references = ["https://github.com/MzHmO/PowershellKerberos/blob/main/dumper.ps1"]
64-
risk_score = 47
64+
risk_score = 73
6565
rule_id = "fddff193-48a3-484d-8d35-90bb3d323a56"
6666
setup = """## Setup
6767
@@ -81,7 +81,7 @@ Steps to implement the logging policy via registry:
8181
reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1
8282
```
8383
"""
84-
severity = "medium"
84+
severity = "high"
8585
tags = [
8686
"Domain: Endpoint",
8787
"OS: Windows",

rules/windows/credential_access_posh_relay_tools.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/03/27"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -22,7 +22,7 @@ references = [
2222
"https://github.com/nettitude/PoshC2/blob/master/resources/modules/Invoke-Tater.ps1",
2323
"https://github.com/Kevin-Robertson/Inveigh/blob/master/Inveigh.ps1",
2424
]
25-
risk_score = 47
25+
risk_score = 73
2626
rule_id = "951779c2-82ad-4a6c-82b8-296c1f691449"
2727
setup = """## Setup
2828
@@ -42,7 +42,7 @@ Steps to implement the logging policy via registry:
4242
reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1
4343
```
4444
"""
45-
severity = "medium"
45+
severity = "high"
4646
tags = [
4747
"Domain: Endpoint",
4848
"OS: Windows",
@@ -63,7 +63,8 @@ event.category:process and host.os.type:windows and
6363
"0x4e,0x54,0x20,0x4c,0x4d" or
6464
"0x53,0x4d,0x42,0x20,0x32" or
6565
"0x81,0xbb,0x7a,0x36,0x44,0x98,0xf1,0x35,0xad,0x32,0x98,0xf0,0x38"
66-
)
66+
) and
67+
not file.directory : "C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Downloads"
6768
'''
6869

6970

rules/windows/defense_evasion_posh_encryption.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/01/23"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -81,7 +81,12 @@ event.category:process and host.os.type:windows and
8181
".CreateEncryptor" or
8282
".CreateDecryptor"
8383
)
84-
) and not user.id : "S-1-5-18"
84+
) and
85+
not user.id : "S-1-5-18" and
86+
not (
87+
file.name : "Bootstrap.Octopus.FunctionAppenderContext.ps1" and
88+
powershell.file.script_block_text : ("function Decrypt-Variables" or "github.com/OctopusDeploy")
89+
)
8590
'''
8691

8792

rules/windows/defense_evasion_posh_process_injection.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/10/14"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -60,7 +60,7 @@ references = [
6060
"https://github.com/BC-SECURITY/Empire/blob/master/empire/server/data/module_source/credentials/Invoke-Mimikatz.ps1",
6161
"https://www.elastic.co/security-labs/detect-credential-access",
6262
]
63-
risk_score = 47
63+
risk_score = 73
6464
rule_id = "2e29e96a-b67c-455a-afe4-de6183431d0d"
6565
setup = """## Setup
6666
@@ -80,7 +80,7 @@ Steps to implement the logging policy via registry:
8080
reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1
8181
```
8282
"""
83-
severity = "medium"
83+
severity = "high"
8484
tags = [
8585
"Domain: Endpoint",
8686
"OS: Windows",
@@ -101,8 +101,10 @@ event.category:process and host.os.type:windows and
101101
(WriteProcessMemory or CreateRemoteThread or NtCreateThreadEx or CreateThread or QueueUserAPC or
102102
SuspendThread or ResumeThread or GetDelegateForFunctionPointer)
103103
) and not
104-
(user.id:("S-1-5-18" or "S-1-5-19") and
105-
file.directory: "C:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\SenseCM")
104+
file.directory: (
105+
"C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\SenseCM" or
106+
"C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Downloads"
107+
)
106108
'''
107109

108110

rules/windows/execution_posh_hacktool_authors.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/05/08"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -73,9 +73,9 @@ host.os.type:windows and event.category:process and
7373
"itm4n" or "nurfed1" or
7474
"cfalta" or "Scott Sutherland" or
7575
"_nullbind" or "_tmenochet" or
76-
"Boe Prox" or "jaredcatkinson" or
77-
"ChrisTruncer" or "monoxgas" or
78-
"TheRealWover" or "splinter_code"
76+
"jaredcatkinson" or "ChrisTruncer" or
77+
"monoxgas" or "TheRealWover" or
78+
"splinter_code"
7979
)
8080
'''
8181

rules/windows/privilege_escalation_posh_token_impersonation.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2022/08/17"
33
integration = ["windows"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/07/17"
66

77
[transform]
88
[[transform.osquery]]
@@ -168,6 +168,10 @@ event.category:process and host.os.type:windows and
168168
) and
169169
not powershell.file.script_block_text : (
170170
"sentinelbreakpoints" and "Set-PSBreakpoint" and "PowerSploitIndicators"
171+
) and
172+
not (
173+
powershell.file.script_block_text : "New-HPPrivateToastNotificationLogo" and
174+
file.path : "C:\Program Files\HPConnect\hp-cmsl-wl\modules\HP.Notifications\HP.Notifications.psm1"
171175
)
172176
'''
173177

0 commit comments

Comments
 (0)