PowerShell MiniDump Script

This rule detects PowerShell scripts capable of dumping process memory using WindowsErrorReporting or Dbghelp.dll MiniDumpWriteDump. Attackers can use this tooling to dump LSASS and get access to credentials.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2021/10/05"
 3integration = ["windows"]
 4maturity = "production"
 5updated_date = "2024/10/28"
 6min_stack_version = "8.14.0"
 7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
 8
 9[rule]
10author = ["Elastic"]
11description = """
12This rule detects PowerShell scripts capable of dumping process memory using WindowsErrorReporting or Dbghelp.dll
13MiniDumpWriteDump. Attackers can use this tooling to dump LSASS and get access to credentials.
14"""
15false_positives = ["PowerShell scripts that use this capability for troubleshooting."]
16from = "now-9m"
17index = ["winlogbeat-*", "logs-windows.powershell*"]
18language = "kuery"
19license = "Elastic License v2"
20name = "PowerShell MiniDump Script"
21note = """## Triage and analysis
22
23### Investigating PowerShell MiniDump Script
24
25PowerShell is one of the main tools system administrators use for automation, report routines, and other tasks. This makes it available for use in various environments, and creates an attractive way for attackers to execute code.
26
27Attackers can abuse Process Memory Dump capabilities to extract credentials from LSASS or to obtain other privileged information stored in the process memory.
28
29#### Possible investigation steps
30
31- Examine the script content that triggered the detection; look for suspicious DLL imports, collection or exfiltration capabilities, suspicious functions, encoded or compressed data, and other potentially malicious characteristics.
32- Investigate the script execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
33- Examine file or network events from the involved PowerShell process for suspicious behavior.
34- Investigate other alerts associated with the user/host during the past 48 hours.
35- Evaluate whether the user needs to use PowerShell to complete tasks.
36- Check if the imported function was executed and which process it targeted.
37
38### False positive analysis
39
40- Regular users do not have a business justification for using scripting utilities to dump process memory, making false positives unlikely.
41
42### Related rules
43
44- PowerShell PSReflect Script - 56f2e9b5-4803-4e44-a0a4-a52dc79d57fe
45- Potential Process Injection via PowerShell - 2e29e96a-b67c-455a-afe4-de6183431d0d
46
47### Response and remediation
48
49- Initiate the incident response process based on the outcome of the triage.
50- Isolate the involved hosts to prevent further post-compromise behavior.
51- Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
52- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
53- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
54- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
55- 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).
56"""
57references = [
58    "https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Out-Minidump.ps1",
59    "https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Get-ProcessMiniDump.ps1",
60    "https://github.com/atc-project/atc-data/blob/master/docs/Logging_Policies/LP_0109_windows_powershell_script_block_log.md",
61]
62risk_score = 73
63rule_id = "577ec21e-56fe-4065-91d8-45eb8224fe77"
64setup = """## Setup
65
66The 'PowerShell Script Block Logging' logging policy must be enabled.
67Steps to implement the logging policy with Advanced Audit Configuration:

Computer Configuration > Administrative Templates > Windows PowerShell > Turn on PowerShell Script Block Logging (Enable)

1
2Steps to implement the logging policy via registry:

reg add "hklm\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1

 1"""
 2severity = "high"
 3tags = [
 4    "Domain: Endpoint",
 5    "OS: Windows",
 6    "Use Case: Threat Detection",
 7    "Tactic: Credential Access",
 8    "Resources: Investigation Guide",
 9    "Data Source: PowerShell Logs",
10]
11timestamp_override = "event.ingested"
12type = "query"
13
14query = '''
15event.category:process and host.os.type:windows and powershell.file.script_block_text:(MiniDumpWriteDump or MiniDumpWithFullMemory or pmuDetirWpmuDiniM) and not user.id : "S-1-5-18"
16'''
17
18
19[[rule.threat]]
20framework = "MITRE ATT&CK"
21[[rule.threat.technique]]
22id = "T1003"
23name = "OS Credential Dumping"
24reference = "https://attack.mitre.org/techniques/T1003/"
25[[rule.threat.technique.subtechnique]]
26id = "T1003.001"
27name = "LSASS Memory"
28reference = "https://attack.mitre.org/techniques/T1003/001/"
29
30
31
32[rule.threat.tactic]
33id = "TA0006"
34name = "Credential Access"
35reference = "https://attack.mitre.org/tactics/TA0006/"
36[[rule.threat]]
37framework = "MITRE ATT&CK"
38[[rule.threat.technique]]
39id = "T1059"
40name = "Command and Scripting Interpreter"
41reference = "https://attack.mitre.org/techniques/T1059/"
42[[rule.threat.technique.subtechnique]]
43id = "T1059.001"
44name = "PowerShell"
45reference = "https://attack.mitre.org/techniques/T1059/001/"
46
47
48
49[rule.threat.tactic]
50id = "TA0002"
51name = "Execution"
52reference = "https://attack.mitre.org/tactics/TA0002/"

Triage and analysis

Investigating PowerShell MiniDump Script

PowerShell is one of the main tools system administrators use for automation, report routines, and other tasks. This makes it available for use in various environments, and creates an attractive way for attackers to execute code.

Attackers can abuse Process Memory Dump capabilities to extract credentials from LSASS or to obtain other privileged information stored in the process memory.

Possible investigation steps

  • Examine the script content that triggered the detection; look for suspicious DLL imports, collection or exfiltration capabilities, suspicious functions, encoded or compressed data, and other potentially malicious characteristics.
  • Investigate the script execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Examine file or network events from the involved PowerShell process for suspicious behavior.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Evaluate whether the user needs to use PowerShell to complete tasks.
  • Check if the imported function was executed and which process it targeted.

False positive analysis

  • Regular users do not have a business justification for using scripting utilities to dump process memory, making false positives unlikely.
  • PowerShell PSReflect Script - 56f2e9b5-4803-4e44-a0a4-a52dc79d57fe
  • Potential Process Injection via PowerShell - 2e29e96a-b67c-455a-afe4-de6183431d0d

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • 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).

References

Related rules

to-top