|
| 1 | +[metadata] |
| 2 | +creation_date = "2024/03/27" |
| 3 | +integration = ["windows"] |
| 4 | +maturity = "production" |
| 5 | +min_stack_comments = "New fields added: required_fields, related_integrations, setup" |
| 6 | +min_stack_version = "8.3.0" |
| 7 | +updated_date = "2024/03/27" |
| 8 | + |
| 9 | +[rule] |
| 10 | +author = ["Elastic"] |
| 11 | +description = """ |
| 12 | +Detects PowerShell scripts that can execute pass-the-hash (PtH) attacks, intercept and relay NTLM challenges, and carry |
| 13 | +out other man-in-the-middle (MitM) attacks. |
| 14 | +""" |
| 15 | +from = "now-9m" |
| 16 | +index = ["winlogbeat-*", "logs-windows.powershell*"] |
| 17 | +language = "kuery" |
| 18 | +license = "Elastic License v2" |
| 19 | +name = "Potential PowerShell Pass-the-Hash/Relay Script" |
| 20 | +references = [ |
| 21 | + "https://github.com/Kevin-Robertson/Invoke-TheHash/blob/master/Invoke-WMIExec.ps1", |
| 22 | + "https://github.com/Kevin-Robertson/Invoke-TheHash/blob/master/Invoke-SMBExec.ps1", |
| 23 | + "https://github.com/dafthack/Check-LocalAdminHash/blob/master/Check-LocalAdminHash.ps1", |
| 24 | + "https://github.com/nettitude/PoshC2/blob/master/resources/modules/Invoke-Tater.ps1", |
| 25 | + "https://github.com/Kevin-Robertson/Inveigh/blob/master/Inveigh.ps1" |
| 26 | +] |
| 27 | +risk_score = 47 |
| 28 | +rule_id = "951779c2-82ad-4a6c-82b8-296c1f691449" |
| 29 | +setup = """## Setup |
| 30 | +
|
| 31 | +The 'PowerShell Script Block Logging' logging policy must be enabled. |
| 32 | +Steps to implement the logging policy with Advanced Audit Configuration: |
| 33 | +
|
| 34 | +``` |
| 35 | +Computer Configuration > |
| 36 | +Administrative Templates > |
| 37 | +Windows PowerShell > |
| 38 | +Turn on PowerShell Script Block Logging (Enable) |
| 39 | +``` |
| 40 | +
|
| 41 | +Steps to implement the logging policy via registry: |
| 42 | +
|
| 43 | +``` |
| 44 | +reg add "hklm\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1 |
| 45 | +``` |
| 46 | +""" |
| 47 | +severity = "medium" |
| 48 | +tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Credential Access", "Resources: Investigation Guide", "Data Source: PowerShell Logs"] |
| 49 | +timestamp_override = "event.ingested" |
| 50 | +type = "query" |
| 51 | + |
| 52 | +query = ''' |
| 53 | +event.category:process and host.os.type:windows and |
| 54 | + powershell.file.script_block_text : ( |
| 55 | + ("NTLMSSPNegotiate" and ("NegotiateSMB" or "NegotiateSMB2")) or |
| 56 | + "4E544C4D53535000" or |
| 57 | + "0x4e,0x54,0x4c,0x4d,0x53,0x53,0x50" or |
| 58 | + "0x4e,0x54,0x20,0x4c,0x4d" or |
| 59 | + "0x53,0x4d,0x42,0x20,0x32" or |
| 60 | + "0x81,0xbb,0x7a,0x36,0x44,0x98,0xf1,0x35,0xad,0x32,0x98,0xf0,0x38" |
| 61 | + ) |
| 62 | +''' |
| 63 | + |
| 64 | + |
| 65 | +[[rule.threat]] |
| 66 | +framework = "MITRE ATT&CK" |
| 67 | +[[rule.threat.technique]] |
| 68 | +id = "T1557" |
| 69 | +name = "Adversary-in-the-Middle" |
| 70 | +reference = "https://attack.mitre.org/techniques/T1557/" |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +[rule.threat.tactic] |
| 75 | +id = "TA0006" |
| 76 | +name = "Credential Access" |
| 77 | +reference = "https://attack.mitre.org/tactics/TA0006/" |
| 78 | + |
| 79 | +[[rule.threat]] |
| 80 | +framework = "MITRE ATT&CK" |
| 81 | +[[rule.threat.technique]] |
| 82 | +id = "T1059" |
| 83 | +name = "Command and Scripting Interpreter" |
| 84 | +reference = "https://attack.mitre.org/techniques/T1059/" |
| 85 | +[[rule.threat.technique.subtechnique]] |
| 86 | +id = "T1059.001" |
| 87 | +name = "PowerShell" |
| 88 | +reference = "https://attack.mitre.org/techniques/T1059/001/" |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +[rule.threat.tactic] |
| 93 | +id = "TA0002" |
| 94 | +name = "Execution" |
| 95 | +reference = "https://attack.mitre.org/tactics/TA0002/" |
| 96 | + |
| 97 | +[[rule.threat]] |
| 98 | +framework = "MITRE ATT&CK" |
| 99 | +[[rule.threat.technique]] |
| 100 | +id = "T1550" |
| 101 | +name = "Use Alternate Authentication Material" |
| 102 | +reference = "https://attack.mitre.org/techniques/T1550/" |
| 103 | +[[rule.threat.technique.subtechnique]] |
| 104 | +id = "T1550.002" |
| 105 | +name = "Pass the Hash" |
| 106 | +reference = "https://attack.mitre.org/techniques/T1550/002/" |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +[rule.threat.tactic] |
| 111 | +id = "TA0008" |
| 112 | +name = "Lateral Movement" |
| 113 | +reference = "https://attack.mitre.org/tactics/TA0008/" |
| 114 | + |
0 commit comments