From 729ecf8b589e65003c95b8bc76bec2d149083dba Mon Sep 17 00:00:00 2001 From: Jonhnathan <26856693+w0rk3r@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:00:57 -0300 Subject: [PATCH] [New Rule] PowerShell Invoke-NinjaCopy script (#2488) * [New Rule] PowerShell Invoke-NinjaCopy script * Update credential_access_posh_invoke_ninjacopy.toml * Update credential_access_posh_invoke_ninjacopy.toml --- ...edential_access_posh_invoke_ninjacopy.toml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 rules/windows/credential_access_posh_invoke_ninjacopy.toml diff --git a/rules/windows/credential_access_posh_invoke_ninjacopy.toml b/rules/windows/credential_access_posh_invoke_ninjacopy.toml new file mode 100644 index 000000000..c57b8ff8a --- /dev/null +++ b/rules/windows/credential_access_posh_invoke_ninjacopy.toml @@ -0,0 +1,87 @@ +[metadata] +creation_date = "2023/01/23" +integration = ["windows"] +maturity = "production" +min_stack_comments = "New fields added: required_fields, related_integrations, setup" +min_stack_version = "8.3.0" +updated_date = "2023/01/23" + +[rule] +author = ["Elastic"] +description = """ +Detects PowerShell scripts that contain the default exported functions used on Invoke-NinjaCopy. Attackers can use +Invoke-NinjaCopy to read SYSTEM files that are normally locked, such as the NTDS.dit file or registry hives. +""" +from = "now-9m" +index = ["winlogbeat-*", "logs-windows.*"] +language = "kuery" +license = "Elastic License v2" +name = "PowerShell Invoke-NinjaCopy script" +references = [ + "https://github.com/BC-SECURITY/Empire/blob/main/empire/server/data/module_source/collection/Invoke-NinjaCopy.ps1" +] +risk_score = 47 +rule_id = "b8386923-b02c-4b94-986a-d223d9b01f88" +severity = "medium" +tags = ["Elastic", "Host", "Windows", "Threat Detection", "Credential Access", "PowerShell"] +timestamp_override = "event.ingested" +type = "query" + +query = ''' +event.category:process and + powershell.file.script_block_text : ( + "StealthReadFile" or + "StealthReadFileAddr" or + "StealthCloseFileDelegate" or + "StealthOpenFile" or + "StealthCloseFile" or + "StealthReadFile" or + "Invoke-NinjaCopy" + ) + and not user.id : "S-1-5-18" +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1003" +name = "OS Credential Dumping" +reference = "https://attack.mitre.org/techniques/T1003/" + + [[rule.threat.technique.subtechnique]] + id = "T1003.002" + name = "Security Account Manager" + reference = "https://attack.mitre.org/techniques/T1003/002/" + + [[rule.threat.technique.subtechnique]] + id = "T1003.003" + name = "NTDS" + reference = "https://attack.mitre.org/techniques/T1003/003/" + + + +[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/" +