LSASS Memory Dump Handle Access
Identifies handle requests for the Local Security Authority Subsystem Service (LSASS) object access with specific access masks that many tools with a capability to dump memory to disk use (0x1fffff, 0x1010, 0x120089). This rule is tool agnostic as it has been validated against a host of various LSASS dump tools such as SharpDump, Procdump, Mimikatz, Comsvcs etc. It detects this behavior at a low level and does not depend on a specific tool or dump file name.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/02/16"
3integration = ["system", "windows"]
4maturity = "production"
5updated_date = "2024/10/15"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[transform]
10[[transform.osquery]]
11label = "Osquery - Retrieve DNS Cache"
12query = "SELECT * FROM dns_cache"
13
14[[transform.osquery]]
15label = "Osquery - Retrieve All Services"
16query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
17
18[[transform.osquery]]
19label = "Osquery - Retrieve Services Running on User Accounts"
20query = """
21SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
22NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
23user_account == null)
24"""
25
26[[transform.osquery]]
27label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
28query = """
29SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
30services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
31authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
32"""
33
34
35[rule]
36author = ["Elastic"]
37description = """
38Identifies handle requests for the Local Security Authority Subsystem Service (LSASS) object access with specific access
39masks that many tools with a capability to dump memory to disk use (0x1fffff, 0x1010, 0x120089). This rule is tool
40agnostic as it has been validated against a host of various LSASS dump tools such as SharpDump, Procdump, Mimikatz,
41Comsvcs etc. It detects this behavior at a low level and does not depend on a specific tool or dump file name.
42"""
43from = "now-9m"
44index = ["winlogbeat-*", "logs-system.*", "logs-windows.*"]
45language = "eql"
46license = "Elastic License v2"
47name = "LSASS Memory Dump Handle Access"
48note = """## Triage and analysis
49
50### Investigating LSASS Memory Dump Handle Access
51
52Local Security Authority Server Service (LSASS) is a process in Microsoft Windows operating systems that is responsible for enforcing security policy on the system. It verifies users logging on to a Windows computer or server, handles password changes, and creates access tokens.
53
54Adversaries may attempt to access credential material stored in LSASS process memory. After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory. This is meant to facilitate single sign-on (SSO) ensuring a user isn’t prompted each time resource access is requested. These credential materials can be harvested by an adversary using administrative user or SYSTEM privileges to conduct lateral movement using [alternate authentication material](https://attack.mitre.org/techniques/T1550/).
55
56> **Note**:
57> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
58
59#### Possible investigation steps
60
61- Investigate the process 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.
62- Investigate other alerts associated with the user/host during the past 48 hours.
63- Examine the host for derived artifacts that indicate suspicious activities:
64 - Analyze the process executable using a private sandboxed analysis system.
65 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
66 - Attempts to contact external domains and addresses.
67 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
68 - Examine the DNS cache for suspicious or anomalous entries.
69 - $osquery_0
70 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
71 - Examine the host services for suspicious or anomalous entries.
72 - $osquery_1
73 - $osquery_2
74 - $osquery_3
75 - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
76- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
77
78
79### False positive analysis
80
81- There should be very few or no false positives for this rule. If this activity is expected or noisy in your environment, consider adding exceptions — preferably with a combination of user and command line conditions.
82- If the process is related to antivirus or endpoint detection and response solutions, validate that it is installed on the correct path and signed with the company's valid digital signature.
83
84### Response and remediation
85
86- Initiate the incident response process based on the outcome of the triage.
87- Isolate the involved host to prevent further post-compromise behavior.
88- Scope compromised credentials and disable the accounts.
89- If the triage identified malware, search the environment for additional compromised hosts.
90 - Implement temporary network rules, procedures, and segmentation to contain the malware.
91 - Stop suspicious processes.
92 - Immediately block the identified indicators of compromise (IoCs).
93 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
94- Remove and block malicious artifacts identified during triage.
95- 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.
96- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
97- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
98- 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).
99"""
100references = [
101 "https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4656",
102 "https://twitter.com/jsecurity101/status/1227987828534956033?s=20",
103 "https://attack.mitre.org/techniques/T1003/001/",
104 "https://threathunterplaybook.com/notebooks/windows/06_credential_access/WIN-170105221010.html",
105 "http://findingbad.blogspot.com/2017/",
106 "https://www.elastic.co/security-labs/detect-credential-access",
107]
108risk_score = 73
109rule_id = "208dbe77-01ed-4954-8d44-1e5751cb20de"
110setup = """## Setup
111
112Ensure advanced audit policies for Windows are enabled, specifically:
113Object Access policies [Event ID 4656](https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4656) (Handle to an Object was Requested)
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policies Configuration > System Audit Policies > Object Access > Audit File System (Success,Failure) Audit Handle Manipulation (Success,Failure)
1
2Also, this event generates only if the object’s [SACL](https://docs.microsoft.com/en-us/windows/win32/secauthz/access-control-lists) has the required access control entry (ACE) to handle the use of specific access rights.
3
4If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
5events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
6Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
7`event.ingested` to @timestamp.
8For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
9"""
10severity = "high"
11tags = [
12 "Domain: Endpoint",
13 "OS: Windows",
14 "Use Case: Threat Detection",
15 "Tactic: Credential Access",
16 "Resources: Investigation Guide",
17 "Data Source: System",
18]
19timestamp_override = "event.ingested"
20type = "eql"
21
22query = '''
23any where event.action == "File System" and event.code == "4656" and
24
25 winlog.event_data.ObjectName : (
26 "?:\\Windows\\System32\\lsass.exe",
27 "\\Device\\HarddiskVolume?\\Windows\\System32\\lsass.exe",
28 "\\Device\\HarddiskVolume??\\Windows\\System32\\lsass.exe") and
29
30 /* The right to perform an operation controlled by an extended access right. */
31
32 (winlog.event_data.AccessMask : ("0x1fffff" , "0x1010", "0x120089", "0x1F3FFF") or
33 winlog.event_data.AccessMaskDescription : ("READ_CONTROL", "Read from process memory"))
34
35 /* Common Noisy False Positives */
36
37 and not winlog.event_data.ProcessName : (
38 "?:\\Program Files\\*.exe",
39 "?:\\Program Files (x86)\\*.exe",
40 "?:\\Windows\\system32\\wbem\\WmiPrvSE.exe",
41 "?:\\Windows\\System32\\dllhost.exe",
42 "?:\\Windows\\System32\\svchost.exe",
43 "?:\\Windows\\System32\\msiexec.exe",
44 "?:\\ProgramData\\Microsoft\\Windows Defender\\*.exe",
45 "?:\\Windows\\explorer.exe",
46 "?:\\Windows\\System32\\poqexec.exe")
47'''
48
49
50[[rule.threat]]
51framework = "MITRE ATT&CK"
52[[rule.threat.technique]]
53id = "T1003"
54name = "OS Credential Dumping"
55reference = "https://attack.mitre.org/techniques/T1003/"
56[[rule.threat.technique.subtechnique]]
57id = "T1003.001"
58name = "LSASS Memory"
59reference = "https://attack.mitre.org/techniques/T1003/001/"
60
61
62
63[rule.threat.tactic]
64id = "TA0006"
65name = "Credential Access"
66reference = "https://attack.mitre.org/tactics/TA0006/"
Triage and analysis
Investigating LSASS Memory Dump Handle Access
Local Security Authority Server Service (LSASS) is a process in Microsoft Windows operating systems that is responsible for enforcing security policy on the system. It verifies users logging on to a Windows computer or server, handles password changes, and creates access tokens.
Adversaries may attempt to access credential material stored in LSASS process memory. After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory. This is meant to facilitate single sign-on (SSO) ensuring a user isn’t prompted each time resource access is requested. These credential materials can be harvested by an adversary using administrative user or SYSTEM privileges to conduct lateral movement using alternate authentication material.
Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
Possible investigation steps
- Investigate the process 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.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the process executable using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
process.entity_id
. - Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Attempts to contact external domains and addresses.
- Retrieve the files' SHA-256 hash values using the PowerShell
Get-FileHash
cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
False positive analysis
- There should be very few or no false positives for this rule. If this activity is expected or noisy in your environment, consider adding exceptions — preferably with a combination of user and command line conditions.
- If the process is related to antivirus or endpoint detection and response solutions, validate that it is installed on the correct path and signed with the company's valid digital signature.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- Scope compromised credentials and disable the accounts.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- 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
- Multiple Logon Failure Followed by Logon Success
- Multiple Logon Failure from the same Source Address
- Potential Credential Access via DCSync
- Privileged Account Brute Force
- Suspicious Remote Registry Access via SeBackupPrivilege