Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
[[prebuilt-rule-8-16-15-account-discovery-command-via-system-account]]
=== Account Discovery Command via SYSTEM Account

Identifies when the SYSTEM account uses an account discovery utility. This could be a sign of discovery activity after an adversary has achieved privilege escalation.

*Rule type*: eql

*Rule indices*:

* winlogbeat-*
* logs-endpoint.events.process-*
* logs-windows.sysmon_operational-*

*Severity*: low

*Risk score*: 21

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*: None

*Tags*:

* Domain: Endpoint
* OS: Windows
* Use Case: Threat Detection
* Tactic: Discovery
* Tactic: Privilege Escalation
* Resources: Investigation Guide
* Data Source: Elastic Defend
* Data Source: Sysmon

*Version*: 214

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Investigation guide



*Triage and analysis*



*Investigating Account Discovery Command via SYSTEM Account*


After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.

This rule looks for the execution of account discovery utilities using the SYSTEM account, which is commonly observed after attackers successfully perform privilege escalation or exploit web applications.


*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.
- If the process tree includes a web-application server process such as w3wp, httpd.exe, nginx.exe and alike, investigate any suspicious file creation or modification in the last 48 hours to assess the presence of any potential webshell backdoor.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Determine how the SYSTEM account is being used. For example, users with administrator privileges can spawn a system shell using Windows services, scheduled tasks or other third party utilities.


*False positive analysis*


- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.


*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.
- 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 via 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).
- Use the data collected through the analysis to investigate other machines affected in the environment.


==== Setup



*Setup*


If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
`event.ingested` to @timestamp.
For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html


==== Rule query


[source, js]
----------------------------------
process where host.os.type == "windows" and event.type == "start" and
(?process.Ext.token.integrity_level_name : "System" or
?winlog.event_data.IntegrityLevel : "System") and
(
process.name : "whoami.exe" or
(
process.name : "net1.exe" and not process.parent.name : "net.exe" and not process.args : ("start", "stop", "/active:*")
)
) and
process.parent.executable != null and
not (process.name : "net1.exe" and process.working_directory : "C:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\") and
not process.parent.executable :
("C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe",
"C:\\Program Files\\Dell\\SupportAssistAgent\\SRE\\SRE.exe",
"C:\\Program Files\\Obkio Agent\\main.dist\\ObkioAgentSoftware.exe",
"C:\\Windows\\Temp\\WinGet\\defaultState\\PostgreSQL.PostgreSQL*\\postgresql-*-windows-x64.exe",
"C:\\Program Files\\Obkio Agent\\main.dist\\ObkioAgentSoftware.exe",
"C:\\Program Files (x86)\\SolarWinds\\Agent\\Plugins\\JobEngine\\SWJobEngineWorker2.exe") and
not (process.parent.executable : "C:\\Windows\\Sys?????\\WindowsPowerShell\\v1.0\\powershell.exe" and
process.parent.args : ("C:\\Program Files (x86)\\Microsoft Intune Management Extension\\*.ps1",
"Agent\\Modules\\AdHealthConfiguration\\AdHealthConfiguration.psd1'")) and
not (process.parent.name : "cmd.exe" and process.working_directory : "C:\\Program Files\\Infraon Corp\\SecuraAgent\\")

----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Discovery
** ID: TA0007
** Reference URL: https://attack.mitre.org/tactics/TA0007/
* Technique:
** Name: System Owner/User Discovery
** ID: T1033
** Reference URL: https://attack.mitre.org/techniques/T1033/
* Tactic:
** Name: Privilege Escalation
** ID: TA0004
** Reference URL: https://attack.mitre.org/tactics/TA0004/
* Technique:
** Name: Valid Accounts
** ID: T1078
** Reference URL: https://attack.mitre.org/techniques/T1078/
* Sub-technique:
** Name: Local Accounts
** ID: T1078.003
** Reference URL: https://attack.mitre.org/techniques/T1078/003/
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[[prebuilt-rule-8-16-15-delegated-managed-service-account-modification-by-an-unusual-user]]
=== Delegated Managed Service Account Modification by an Unusual User

Detects modifications in the msDS-ManagedAccountPrecededByLink attribute of a delegated managed service account by an unusual subject account. Attackers can abuse this attribute to take over the permission of a target account and inherit it's permissions allowing them to further elevate privileges.

*Rule type*: new_terms

*Rule indices*:

* winlogbeat-*
* logs-system.security*
* logs-windows.forwarded*

*Severity*: high

*Risk score*: 73

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://www.akamai.com/blog/security-research/abusing-dmsa-for-privilege-escalation-in-active-directory

*Tags*:

* Domain: Endpoint
* OS: Windows
* Use Case: Threat Detection
* Tactic: Privilege Escalation
* Use Case: Active Directory Monitoring
* Data Source: Active Directory
* Data Source: Windows Security Event Logs
* Resources: Investigation Guide

*Version*: 1

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Investigation guide



*Triage and analysis*



*Investigating Delegated Managed Service Account Modification by an Unusual User*



*Possible investigation steps*

- Examine the winlog.event_data.SubjectUserName field and verify if he is allowed and used to perform this kind of dMSA changes.
- Examine the winlog.event_data.AttributeValue field to verify the targeted account and if it's supposed to use dMSA.
- Examine if there are any recent dMSA account creation by the same winlog.event_data.SubjectUserName.
- Investigate the history of the identified user account to determine if there are any other suspicious activities or patterns of behavior.
- Collaborate with the IT or security team to determine if the changes were authorized or if further action is needed to secure the environment.


*False positive analysis*


- Migration of legacy service accounts using delegated managed service account.


*Response and remediation*


- Immediately disable the winlog.event_data.SubjectUserName account and revert all changes performed by that account.
- Identify and isolate the source machines from where the SubjectUserName is authenticating.
- Reset passwords for all accounts that were potentially affected or had their permissions altered, focusing on privileged accounts to prevent adversaries from regaining access.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine the scope of the breach, including identifying any other compromised systems or accounts.
- Review and update access control policies and security configurations to prevent similar attacks, ensuring that only authorized personnel have the ability to modify critical Active Directory objects or create OU child objects.

==== Rule query


[source, js]
----------------------------------
event.code:5136 and winlog.event_data.AttributeLDAPDisplayName:"msDS-ManagedAccountPrecededByLink"

----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Privilege Escalation
** ID: TA0004
** Reference URL: https://attack.mitre.org/tactics/TA0004/
* Technique:
** Name: Valid Accounts
** ID: T1078
** Reference URL: https://attack.mitre.org/techniques/T1078/
* Sub-technique:
** Name: Domain Accounts
** ID: T1078.002
** Reference URL: https://attack.mitre.org/techniques/T1078/002/
* Technique:
** Name: Account Manipulation
** ID: T1098
** Reference URL: https://attack.mitre.org/techniques/T1098/
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
[[prebuilt-rule-8-16-15-disabling-lsa-protection-via-registry-modification]]
=== Disabling Lsa Protection via Registry Modification

LSA protecton is provided to prevent nonprotected processes from reading memory and injecting code. This feature provides added security for the credentials that LSA stores and manages. Adversaries may modify the RunAsPPL registry and wait or initiate a system restart to enable Lsass credentials access.

*Rule type*: eql

*Rule indices*:

* winlogbeat-*
* logs-endpoint.events.registry-*
* logs-windows.sysmon_operational-*
* endgame-*
* logs-m365_defender.event-*
* logs-sentinel_one_cloud_funnel.*

*Severity*: high

*Risk score*: 73

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection

*Tags*:

* Domain: Endpoint
* OS: Windows
* Use Case: Threat Detection
* Tactic: Defense Evasion
* Resources: Investigation Guide
* Data Source: Elastic Endgame
* Data Source: Elastic Defend
* Data Source: Sysmon
* Data Source: Microsoft Defender for Endpoint
* Data Source: SentinelOne

*Version*: 1

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Investigation guide



*Triage and analysis*



*Investigating Disabling Lsa Protection via Registry Modification*


For more information about the Lsa Protection and how it works, check the https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection[official Microsoft docs page].

Attackers may disable Lsa protection to access Lsass memory for credentals. This rule identifies RunAsPPL registry value modifications.


*Possible investigation steps*


- Verify the context of the change and if it's related to a planned system administration activity.
- 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.
- Inspect the host for suspicious or abnormal behaviors in the alert timeframe.
- Investigate abnormal behaviors observed by the subject process such as network connections, registry or file modifications, and any spawned child processes.


*False positive analysis*


- Approved changes to relax the Lsa protection for compatibility with third party solutions such as authentication plugins or alike.


*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.
- 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.
- Restore UAC settings to the desired state.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- 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.
- 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).


==== Rule query


[source, js]
----------------------------------
registry where host.os.type == "windows" and event.type == "change" and
registry.path : ("HKLM\\SYSTEM\\ControlSet*\\Control\\Lsa\\RunAsPPL", "\\REGISTRY\\MACHINE\\SYSTEM\\ControlSet*\\Control\\Lsa\\RunAsPPL") and
not registry.data.strings : ("1", "0x00000001", "2", "0x00000002")

----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Defense Evasion
** ID: TA0005
** Reference URL: https://attack.mitre.org/tactics/TA0005/
* Technique:
** Name: Modify Registry
** ID: T1112
** Reference URL: https://attack.mitre.org/techniques/T1112/
* Technique:
** Name: Impair Defenses
** ID: T1562
** Reference URL: https://attack.mitre.org/techniques/T1562/
* Sub-technique:
** Name: Disable or Modify Tools
** ID: T1562.001
** Reference URL: https://attack.mitre.org/techniques/T1562/001/
Loading