-
Notifications
You must be signed in to change notification settings - Fork 587
[New Rules] Potential PowerShell Pass-the-Hash/Relay Script #3543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0629eba
9be404a
db55528
a9dd301
fab7227
efc80e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
[metadata] | ||
creation_date = "2024/03/27" | ||
integration = ["windows"] | ||
maturity = "production" | ||
min_stack_comments = "New fields added: required_fields, related_integrations, setup" | ||
min_stack_version = "8.3.0" | ||
updated_date = "2024/03/27" | ||
|
||
[rule] | ||
author = ["Elastic"] | ||
description = """ | ||
Detects PowerShell scripts that can execute pass-the-hash (PtH) attacks, intercept and relay NTLM challenges, and carry | ||
out other man-in-the-middle (MitM) attacks. | ||
""" | ||
from = "now-9m" | ||
index = ["winlogbeat-*", "logs-windows.powershell*"] | ||
language = "kuery" | ||
license = "Elastic License v2" | ||
name = "Potential PowerShell Pass-the-Hash/Relay Script" | ||
references = [ | ||
"https://github.com/Kevin-Robertson/Invoke-TheHash/blob/master/Invoke-WMIExec.ps1", | ||
"https://github.com/Kevin-Robertson/Invoke-TheHash/blob/master/Invoke-SMBExec.ps1", | ||
"https://github.com/dafthack/Check-LocalAdminHash/blob/master/Check-LocalAdminHash.ps1", | ||
"https://github.com/nettitude/PoshC2/blob/master/resources/modules/Invoke-Tater.ps1", | ||
"https://github.com/Kevin-Robertson/Inveigh/blob/master/Inveigh.ps1" | ||
] | ||
risk_score = 47 | ||
rule_id = "951779c2-82ad-4a6c-82b8-296c1f691449" | ||
setup = """## Setup | ||
The 'PowerShell Script Block Logging' logging policy must be enabled. | ||
Steps to implement the logging policy with Advanced Audit Configuration: | ||
``` | ||
Computer Configuration > | ||
Administrative Templates > | ||
Windows PowerShell > | ||
Turn on PowerShell Script Block Logging (Enable) | ||
``` | ||
Steps to implement the logging policy via registry: | ||
``` | ||
reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1 | ||
``` | ||
""" | ||
severity = "medium" | ||
tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Credential Access", "Resources: Investigation Guide", "Data Source: PowerShell Logs"] | ||
timestamp_override = "event.ingested" | ||
type = "query" | ||
|
||
query = ''' | ||
event.category:process and host.os.type:windows and | ||
powershell.file.script_block_text : ( | ||
("NTLMSSPNegotiate" and ("NegotiateSMB" or "NegotiateSMB2")) or | ||
"4E544C4D53535000" or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NTLMSSP in hex |
||
"0x4e,0x54,0x4c,0x4d,0x53,0x53,0x50" or | ||
"0x4e,0x54,0x20,0x4c,0x4d" or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NT LM 0.12 in hex |
||
"0x53,0x4d,0x42,0x20,0x32" or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SMB 2.002 in hex |
||
"0x81,0xbb,0x7a,0x36,0x44,0x98,0xf1,0x35,0xad,0x32,0x98,0xf0,0x38" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SMB named pipe UUID |
||
) | ||
''' | ||
|
||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
[[rule.threat.technique]] | ||
id = "T1557" | ||
name = "Adversary-in-the-Middle" | ||
reference = "https://attack.mitre.org/techniques/T1557/" | ||
|
||
|
||
|
||
[rule.threat.tactic] | ||
id = "TA0006" | ||
name = "Credential Access" | ||
reference = "https://attack.mitre.org/tactics/TA0006/" | ||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
[[rule.threat.technique]] | ||
id = "T1059" | ||
name = "Command and Scripting Interpreter" | ||
reference = "https://attack.mitre.org/techniques/T1059/" | ||
[[rule.threat.technique.subtechnique]] | ||
id = "T1059.001" | ||
name = "PowerShell" | ||
reference = "https://attack.mitre.org/techniques/T1059/001/" | ||
|
||
|
||
|
||
[rule.threat.tactic] | ||
id = "TA0002" | ||
name = "Execution" | ||
reference = "https://attack.mitre.org/tactics/TA0002/" | ||
|
||
[[rule.threat]] | ||
framework = "MITRE ATT&CK" | ||
[[rule.threat.technique]] | ||
id = "T1550" | ||
name = "Use Alternate Authentication Material" | ||
reference = "https://attack.mitre.org/techniques/T1550/" | ||
[[rule.threat.technique.subtechnique]] | ||
id = "T1550.002" | ||
name = "Pass the Hash" | ||
reference = "https://attack.mitre.org/techniques/T1550/002/" | ||
|
||
|
||
|
||
[rule.threat.tactic] | ||
id = "TA0008" | ||
name = "Lateral Movement" | ||
reference = "https://attack.mitre.org/tactics/TA0008/" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no
event.type == "start"
or something in these events?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm there is
event.type == "info"
, maybe makes sense to push this in a separated PR, as none of the other PowerShell rules include itUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think that would be good; especially giving the broad search of powershell text fields. For now - feel free to merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we may not need to do that, as we specifically use the
logs-windows.powershell*
index