Detection rules › Elastic
Elastic rules: 17
API Call from a Suspicious Stack
#Identifies the call to some Windows APIs from an unusual call stack. This may be the result of an evasion attempt to hide the origin of the API call from the call stack such as unbacked memory region.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies the call to some Windows APIs from an unusual call stack. This may be the result of an evasion attempt to
hide the origin of the API call from the call stack such as unbacked memory region.
"""
id = "1089f634-35bd-4877-a638-01e42cb47ae2"
license = "Elastic License v2"
name = "API Call from a Suspicious Stack"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.1"
query = '''
api where process.Ext.api.name in ("VirtualAlloc", "VirtualProtect", "WriteProcessMemory", "ResumeThread") and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like
("c:\\windows\\sys?????\\ntdll.dll!LdrLoadDll*",
"c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*",
"c:\\windows\\sys?????\\kernelbase.dll+0x*",
"c:\\windows\\sys?????\\ntdll.dll+0x*",
"c:\\windows\\sys?????\\kernelbase.dll!MsixIsSystemPackageByPackageFullName*"))
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name in ("VirtualAlloc", "VirtualProtect", "WriteProcessMemory", "ResumeThread") and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like
("c:\\windows\\sys?????\\ntdll.dll!LdrLoadDll*",
"c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*",
"c:\\windows\\sys?????\\kernelbase.dll+0x*",
"c:\\windows\\sys?????\\ntdll.dll+0x*",
"c:\\windows\\sys?????\\kernelbase.dll!MsixIsSystemPackageByPackageFullName*"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | in |
| field:"process.Ext.api.name" kind:in |
process.thread.Ext.call_stack_summary | eq |
| field:"process.thread.Ext.call_stack_summary" kind:eq value:"ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack |
Apple Script Execution followed by Network Connection
#Detects execution via the Apple script interpreter (osascript) followed by a network connection from the same process within a short time period. Adversaries may use malicious scripts for execution and command and control.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[metadata]
creation_date = "2020/12/07"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects execution via the Apple script interpreter (osascript) followed by a network connection from the same process
within a short time period. Adversaries may use malicious scripts for execution and command and control.
"""
from = "now-9m"
index = ["logs-endpoint.events.network*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Apple Script Execution followed by Network Connection"
references = [
"https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/index.html",
"https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml",
]
risk_score = 47
rule_id = "47f76567-d58a-4fed-b32b-21f571e28910"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Command and Control",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id, process.entity_id with maxspan=30s
[process where host.os.type == "macos" and event.type == "start" and process.name == "osascript"]
[network where host.os.type == "macos" and event.type == "start" and process.name == "osascript" and
not cidrmatch(destination.ip,
"240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15",
"192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
"100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
"::1", "FE80::/10", "FF00::/8")]
'''
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Apple Script Execution followed by Network Connection
AppleScript, a scripting language for macOS, automates tasks by controlling applications and system functions. Adversaries exploit it to execute scripts that establish unauthorized network connections, facilitating command and control activities. The detection rule identifies such abuse by monitoring the osascript process for script execution followed by network activity, excluding local and private IP ranges, within a short timeframe.
### Possible investigation steps
- Review the process details for the osascript execution event, focusing on the process.entity_id and host.id to understand the context of the script execution.
- Examine the network connection details associated with the osascript process, particularly the destination IP address, to determine if it is known or suspicious, and check if it falls outside the excluded IP ranges.
- Investigate the script content or command line arguments used in the osascript execution to identify any potentially malicious or unexpected behavior.
- Check the timeline of events to see if there are any other related or suspicious activities occurring on the same host around the time of the osascript execution and network connection.
- Correlate the osascript activity with any other alerts or logs from the same host to identify patterns or additional indicators of compromise.
- Assess the user account associated with the osascript process to determine if it is a legitimate user or if there are signs of account compromise.
### False positive analysis
- Legitimate automation scripts may trigger the rule if they execute osascript and establish network connections. Review the script's purpose and source to determine if it is authorized.
- System management tools that use AppleScript for remote administration can cause false positives. Identify these tools and consider creating exceptions for their known processes.
- Software updates or applications that use AppleScript for network communication might be flagged. Verify the application's legitimacy and update the rule to exclude these specific processes or IP addresses.
- Development environments that utilize AppleScript for testing or deployment may inadvertently match the rule. Ensure these environments are recognized and excluded from monitoring if they are trusted.
- Regularly review and update the list of excluded IP ranges and processes to ensure they reflect the current network and application landscape, minimizing unnecessary alerts.
### Response and remediation
- Immediately isolate the affected macOS host from the network to prevent further unauthorized access or data exfiltration.
- Terminate the osascript process identified in the alert to stop any ongoing malicious activity.
- Conduct a thorough review of the executed AppleScript to identify any malicious commands or payloads and remove any associated files or scripts from the system.
- Reset credentials for any accounts that were accessed or could have been compromised during the incident.
- Apply security patches and updates to the macOS system to address any vulnerabilities that may have been exploited.
- Monitor network traffic for any further suspicious activity originating from the affected host or similar patterns across other systems.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems have been compromised."""
[[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.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by host.id, process.entity_id.
Stage 1: process
[process where host.os.type == "macos" and event.type == "start" and process.name == "osascript"]
Stage 2: network
[network where host.os.type == "macos" and event.type == "start" and process.name == "osascript" and
not cidrmatch(destination.ip,
"240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15",
"192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
"100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
"::1", "FE80::/10", "FF00::/8")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | eq |
| field:"process_basename" kind:eq value:"osascript" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.ip | cidr_match | 240.0.0.0/4, 233.252.0.0/24, 224.0.0.0/4, 198.19.0.0/16, 192.18.0.0/15, 192.0.0.0/24, 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, ::1, FE80::/10, FF00::/8 | excludes:destination.ip |
Clipboard accessed by Unsigned or Untrusted Binary
#Detects when an unsigned or untrusted binary attempts to access the Pasteboard XPC service in order to collect Clipboard data. Threat actors will monitor the clipboard or collect its contents in order to gain access to sensitive information such as passwords and seedphrases.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Collection |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when an unsigned or untrusted binary attempts to access the Pasteboard XPC service in order to collect Clipboard
data. Threat actors will monitor the clipboard or collect its contents in order to gain access to sensitive information
such as passwords and seedphrases.
"""
id = "71ebb1e8-8089-4843-bdd7-8ae992c7df93"
license = "Elastic License v2"
name = "Clipboard accessed by Unsigned or Untrusted Binary"
os_list = ["macos"]
reference = [
"https://github.com/MythicAgents/poseidon/blob/master/Payload_Type/poseidon/poseidon/agentfunctions/clipboard.go",
"https://github.com/MythicAgents/poseidon/blob/master/Payload_Type/poseidon/poseidon/agentfunctions/clipboard_monitor.go",
]
version = "1.0.3"
query = '''
sequence by process.entity_id with maxspan=10s
[process where event.type == "start" and event.action == "fork" and process.name == "launchd" and
process.args like "xpcproxy" and process.args like "com.apple.pasteboard*" and
process.args_count == 2]
[process where event.type == "start" and event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false)]
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1115"
name = "Clipboard Data"
reference = "https://attack.mitre.org/techniques/T1115/"
[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 10s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "fork" and process.name == "launchd" and
process.args like "xpcproxy" and process.args like "com.apple.pasteboard*" and
process.args_count == 2]
Stage 2: process
[process where event.type == "start" and event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false)]
Indicators
These rows show field, operator, and value matches.
Data Encrypted and Archived
#Identifies when data is encrypted and archived using common compression and encryption tools. This activity can indicate an attempt to collect sensitive data and stage it for exfiltration.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Collection |
Telemetry Coverage
Rule Body
[rule]
description = """
Identifies when data is encrypted and archived using common compression and encryption tools. This activity can indicate
an attempt to collect sensitive data and stage it for exfiltration.
"""
id = "2454d6fc-1ff8-4a59-8bcf-d6e8c4bb2c09"
license = "Elastic License v2"
name = "Data Encrypted and Archived"
os_list = ["macos"]
reference = [
"https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/",
"https://www.virustotal.com/gui/file/71e35aef03099cd1f2d6446734273025a163597de93912df321ef118bf135238",
]
version = "1.0.4"
query = '''
sequence by process.parent.entity_id with maxspan=10s
[process where event.type == "start" and event.action in ("exec", "start") and process.name : ("openssl", "openssl.exe") and
process.args : ("enc", "pkeyutl", "cms", "smime")]
[process where event.type == "start" and event.action in ("exec", "start") and
process.name : (
"tar", "zip", "gzip", "xz", "7z", "7za", "7zr", "bzip2", "zstd",
"tar.exe", "zip.exe", "gzip.exe", "7z.exe", "7za.exe", "7zr.exe", "bzip2.exe", "zstd.exe", "zstd64.exe"
) and
not (
process.parent.args in (
"/opt/rudder/share/commands/agent-run", "/usr/sbin/backup_orbini", "/usr/local/bin/mariadb-backup.sh",
"/usr/local/bin/drupal-per-site-backup.sh"
) or
process.parent.args like "mariabackup*db_backup*" or
process.parent.command_line like (
"*mysqldump*localhost*/storage/backup*", "*/etc/pve*prox_backup*", "*/home/*/.local/bin/authd*"
) or
process.parent.executable == "/opt/rudder/bin/rudder" or
process.working_directory like "/mnt/vstk/queue/*" or
process.args like "/var/rudder/tmp/reports/*" or
(process.name == "tar" and process.working_directory like "/u/sysdat/*") or
(
(process.parent.executable == "/home/backup/backup.sh" or process.parent.args == "/backup/backup_temp") and
process.working_directory like "/storage/*"
)
)]
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique.subtechnique]]
id = "T1027.013"
name = "Encrypted/Encoded File"
reference = "https://attack.mitre.org/techniques/T1027/013/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[[threat.technique.subtechnique]]
id = "T1074.001"
name = "Local Data Staging"
reference = "https://attack.mitre.org/techniques/T1074/001/"
[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 10s, correlated by process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action in ("exec", "start") and process.name : ("openssl", "openssl.exe") and
process.args : ("enc", "pkeyutl", "cms", "smime")]
Stage 2: process
[process where event.type == "start" and event.action in ("exec", "start") and
process.name : (
"tar", "zip", "gzip", "xz", "7z", "7za", "7zr", "bzip2", "zstd",
"tar.exe", "zip.exe", "gzip.exe", "7z.exe", "7za.exe", "7zr.exe", "bzip2.exe", "zstd.exe", "zstd64.exe"
) and
not (
process.parent.args in (
"/opt/rudder/share/commands/agent-run", "/usr/sbin/backup_orbini", "/usr/local/bin/mariadb-backup.sh",
"/usr/local/bin/drupal-per-site-backup.sh"
) or
process.parent.args like "mariabackup*db_backup*" or
process.parent.command_line like (
"*mysqldump*localhost*/storage/backup*", "*/etc/pve*prox_backup*", "*/home/*/.local/bin/authd*"
) or
process.parent.executable == "/opt/rudder/bin/rudder" or
process.working_directory like "/mnt/vstk/queue/*" or
process.args like "/var/rudder/tmp/reports/*" or
(process.name == "tar" and process.working_directory like "/u/sysdat/*") or
(
(process.parent.executable == "/home/backup/backup.sh" or process.parent.args == "/backup/backup_temp") and
process.working_directory like "/storage/*"
)
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
Default Cobalt Strike Team Server Certificate
#This rule detects the use of the default Cobalt Strike Team Server TLS certificate. Cobalt Strike is software for Adversary Simulations and Red Team Operations which are security assessments that replicate the tactics and techniques of an advanced adversary in a network. Modifications to the Packetbeat configuration can be made to include MD5 and SHA256 hashing algorithms (the default is SHA1). See the References section for additional information on module configuration.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Rule Body
[metadata]
creation_date = "2020/10/05"
integration = ["network_traffic"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
This rule detects the use of the default Cobalt Strike Team Server TLS certificate. Cobalt Strike is software for
Adversary Simulations and Red Team Operations which are security assessments that replicate the tactics and techniques
of an advanced adversary in a network. Modifications to the Packetbeat configuration can be made to include MD5 and
SHA256 hashing algorithms (the default is SHA1). See the References section for additional information on module
configuration.
"""
from = "now-9m"
index = ["packetbeat-*", "auditbeat-*", "filebeat-*", "logs-network_traffic.*"]
language = "kuery"
license = "Elastic License v2"
name = "Default Cobalt Strike Team Server Certificate"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Default Cobalt Strike Team Server Certificate
Cobalt Strike is a tool used for simulating advanced cyber threats, often employed by security teams to test defenses. However, adversaries can exploit its default server certificate to establish covert command and control channels. The detection rule identifies this misuse by monitoring network traffic for specific cryptographic hashes associated with the default certificate, flagging potential unauthorized Cobalt Strike activity.
### Possible investigation steps
- Review the network traffic logs to identify any connections associated with the specific cryptographic hashes: MD5 (950098276A495286EB2A2556FBAB6D83), SHA1 (6ECE5ECE4192683D2D84E25B0BA7E04F9CB7EB7C), or SHA256 (87F2085C32B6A2CC709B365F55873E207A9CAA10BFFECF2FD16D3CF9D94D390C).
- Identify the source and destination IP addresses involved in the flagged network traffic to determine the potential origin and target of the Cobalt Strike activity.
- Correlate the identified IP addresses with known assets in the network to assess if any internal systems are potentially compromised.
- Check for any other suspicious or anomalous network activities around the same time as the alert to identify potential lateral movement or additional command and control channels.
- Investigate any associated processes or user accounts on the involved systems to determine if there are signs of compromise or unauthorized access.
- Review historical data to see if there have been previous alerts or similar activities involving the same cryptographic hashes or IP addresses, which might indicate a persistent threat.
### False positive analysis
- Legitimate security testing activities by internal teams using Cobalt Strike may trigger the rule. Coordinate with security teams to whitelist known testing IP addresses or certificate hashes.
- Some commercial penetration testing services may use Cobalt Strike with default certificates. Verify the legitimacy of such services and exclude their traffic from detection by adding their certificate hashes to an exception list.
- Network appliances or security tools that simulate adversary behavior for training purposes might use similar certificates. Identify these tools and configure exceptions for their specific network traffic patterns.
- In environments where Cobalt Strike is used for authorized red team exercises, ensure that the default certificate is replaced with a custom one to avoid false positives.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further communication with the potential Cobalt Strike server.
- Conduct a thorough forensic analysis of the isolated system to identify any malicious payloads or additional indicators of compromise.
- Revoke any compromised credentials and enforce a password reset for affected accounts to prevent unauthorized access.
- Update and patch all systems to the latest security standards to mitigate vulnerabilities that could be exploited by similar threats.
- Implement network segmentation to limit the lateral movement of threats within the network.
- Enhance monitoring and logging to capture detailed network traffic and endpoint activity, focusing on the identified cryptographic hashes.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and coordination with external threat intelligence sources if necessary.
## Threat intel
While Cobalt Strike is intended to be used for penetration tests and IR training, it is frequently used by actual threat actors (TA) such as APT19, APT29, APT32, APT41, FIN6, DarkHydrus, CopyKittens, Cobalt Group, Leviathan, and many other unnamed criminal TAs. This rule uses high-confidence atomic indicators, so alerts should be investigated rapidly."""
references = [
"https://attack.mitre.org/software/S0154/",
"https://www.cobaltstrike.com/help-setup-collaboration",
"https://www.elastic.co/guide/en/beats/packetbeat/current/configuration-tls.html",
"https://www.elastic.co/guide/en/beats/filebeat/7.9/filebeat-module-suricata.html",
"https://www.elastic.co/guide/en/beats/filebeat/7.9/filebeat-module-zeek.html",
"https://www.elastic.co/security-labs/collecting-cobalt-strike-beacons-with-the-elastic-stack",
]
risk_score = 73
rule_id = "e7075e8d-a966-458e-a183-85cd331af255"
severity = "high"
tags = [
"Tactic: Command and Control",
"Threat: Cobalt Strike",
"Use Case: Threat Detection",
"Domain: Endpoint",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
(data_stream.dataset: network_traffic.tls or event.category: (network or network_traffic))
and (tls.server.hash.md5:950098276A495286EB2A2556FBAB6D83
or tls.server.hash.sha1:6ECE5ECE4192683D2D84E25B0BA7E04F9CB7EB7C
or tls.server.hash.sha256:87F2085C32B6A2CC709B365F55873E207A9CAA10BFFECF2FD16D3CF9D94D390C)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[rule.threat.technique.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"
[[rule.threat.technique]]
id = "T1573"
name = "Encrypted Channel"
reference = "https://attack.mitre.org/techniques/T1573/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
Stages and Predicates
Stage 1: query
(data_stream.dataset: network_traffic.tls or event.category: (network or network_traffic))
and (tls.server.hash.md5:950098276A495286EB2A2556FBAB6D83
or tls.server.hash.sha1:6ECE5ECE4192683D2D84E25B0BA7E04F9CB7EB7C
or tls.server.hash.sha256:87F2085C32B6A2CC709B365F55873E207A9CAA10BFFECF2FD16D3CF9D94D390C)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"network_traffic.tls" |
event.category | in |
| field:"event.category" kind:in |
tls.server.hash.md5 | eq |
| field:"tls.server.hash.md5" kind:eq value:"950098276A495286EB2A2556FBAB6D83" |
tls.server.hash.sha1 | eq |
| field:"tls.server.hash.sha1" kind:eq value:"6ECE5ECE4192683D2D84E25B0BA7E04F9CB7EB7C" |
tls.server.hash.sha256 | eq |
| field:"tls.server.hash.sha256" kind:eq value:"87F2085C32B6A2CC709B365F55873E207A9CAA10BFFECF2FD16D3CF9D94D390C" |
Entra ID Elevated Access to User Access Administrator
#Identifies when a user has elevated their access to User Access Administrator for their Azure Resources. The User Access Administrator role allows users to manage user access to Azure resources, including the ability to assign roles and permissions. Adversaries may target an Entra ID Global Administrator or other privileged role to elevate their access to User Access Administrator, which can lead to further privilege escalation and unauthorized access to sensitive resources. This is a New Terms rule that only signals if the user principal name has not been seen doing this activity in the last 14 days.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | User has elevated their access to User Access Administrator for their Azure Resources |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure RBAC (Elevate Access) (Kusto)
Rule Body
[metadata]
creation_date = "2025/05/22"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic", "Austin Songer"]
description = """
Identifies when a user has elevated their access to User Access Administrator for their Azure Resources. The User Access
Administrator role allows users to manage user access to Azure resources, including the ability to assign roles and
permissions. Adversaries may target an Entra ID Global Administrator or other privileged role to elevate their access to
User Access Administrator, which can lead to further privilege escalation and unauthorized access to sensitive
resources. This is a New Terms rule that only signals if the user principal name has not been seen doing this activity
in the last 14 days.
"""
from = "now-9m"
index = ["filebeat-*", "logs-azure.auditlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID Elevated Access to User Access Administrator"
note = """## Triage and Analysis
### Investigating Entra ID Elevated Access to User Access Administrator
This rule identifies when a user elevates their permissions to the "User Access Administrator" role in Azure RBAC. This role allows full control over access management for Azure resources and can be abused by attackers for lateral movement, persistence, or privilege escalation. Since this is a New Terms rule, the alert will only trigger if the user has not performed this elevation in the past 14 days, helping reduce alert fatigue.
### Possible investigation steps
- Review the `azure.auditlogs.properties.initiated_by.user.userPrincipalName` field to identify the user who elevated access.
- Check `source.ip` and associated `source.geo.*` fields to determine the origin of the action. Confirm whether the IP, ASN, and location are expected for this user.
- Investigate the application ID from `azure.auditlogs.properties.additional_details.value` to determine which interface or method was used to elevate access.
- Pivot to Azure `signinlogs` or Entra `auditlogs` to:
- Review recent login history for the user.
- Look for unusual sign-in patterns or MFA prompts.
- Determine whether the account has performed any other privilege-related operations.
- Correlate with directory role assignments or role-based access control (RBAC) modifications to assess whether the elevated access was used to add roles or modify permissions.
### False positive analysis
- Legitimate admin actions may involve access elevation during maintenance, migration, or investigations.
- Some IT departments may elevate access temporarily without leaving structured change records.
- Review internal tickets, change logs, or admin activity dashboards for approved operations.
### Response and remediation
- If elevation was not authorized:
- Immediately remove the User Access Administrator role from the account.
- Disable or lock the account and begin credential rotation.
- Audit activity performed by the account after elevation, especially changes to role assignments and resource access.
- If suspicious:
- Notify the user and confirm whether they performed the action.
- Check for any automation or scripts that could be exploiting unused elevated access paths.
- Review conditional access and PIM (Privileged Identity Management) configurations to limit elevation without approval.
- Strengthen posture:
- Require MFA and approval for all privilege escalation actions.
- Consider enabling JIT (Just-in-Time) access with expiration.
- Add alerts for repeated or unusual use of `Microsoft.Authorization/elevateAccess/action`.
"""
references = [
"https://learn.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin?tabs=azure-portal%2Centra-audit-logs/",
"https://permiso.io/blog/azures-apex-permissions-elevate-access-the-logs-security-teams-overlook",
"https://www.microsoft.com/en-us/security/blog/2025/08/27/storm-0501s-evolving-techniques-lead-to-cloud-based-ransomware/"
]
risk_score = 73
rule_id = "8d9c4128-372a-11f0-9d8f-f661ea17fbcd"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Audit Logs",
"Use Case: Identity and Access Audit",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset: azure.auditlogs
and (
azure.auditlogs.operation_name: "User has elevated their access to User Access Administrator for their Azure Resources" or
azure.auditlogs.properties.additional_details.value: "Microsoft.Authorization/elevateAccess/action"
) and event.outcome: "success"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/003/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/003/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.new_terms]
field = "new_terms_fields"
value = ["azure.auditlogs.properties.initiated_by.user.userPrincipalName"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset: azure.auditlogs
and (
azure.auditlogs.operation_name: "User has elevated their access to User Access Administrator for their Azure Resources" or
azure.auditlogs.properties.additional_details.value: "Microsoft.Authorization/elevateAccess/action"
) and event.outcome: "success"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
azure.auditlogs.operation_name | eq |
| field:"azure_ad::activity_display_name" kind:eq value:"User has elevated their access to User Access Administrator for their Azure Resources" |
azure.auditlogs.properties.additional_details.value | eq |
| field:"azure.auditlogs.properties.additional_details.value" kind:eq value:"Microsoft.Authorization/elevateAccess/action" |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"azure.auditlogs" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
Entra ID OAuth PRT Issuance to Non-Managed Device Detected
#Identifies when a user signs in with a refresh token using the Microsoft Authentication Broker (MAB) client, followed by a Primary Refresh Token (PRT) sign-in from the same device within 1 hour from an unmanaged device. This pattern may indicate that an attacker has successfully registered a device using ROADtx and transitioned from short-term token access to long-term persistent access via PRTs. Excluding access to the Device Registration Service (DRS) ensures the PRT is being used beyond registration, often to access Microsoft 365 resources like Outlook or SharePoint.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence | |
| Stealth | |
| Credential Access | |
| Lateral Movement |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | Target application: Sign-in naming a target application |
Rule Body
[metadata]
creation_date = "2025/06/24"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies when a user signs in with a refresh token using the Microsoft Authentication Broker (MAB) client, followed by
a Primary Refresh Token (PRT) sign-in from the same device within 1 hour from an unmanaged device. This pattern may indicate that an attacker has
successfully registered a device using ROADtx and transitioned from short-term token access to long-term persistent
access via PRTs. Excluding access to the Device Registration Service (DRS) ensures the PRT is being used beyond
registration, often to access Microsoft 365 resources like Outlook or SharePoint.
"""
from = "now-60m"
index = ["filebeat-*", "logs-azure.signinlogs-*"]
interval = "30m"
language = "eql"
license = "Elastic License v2"
name = "Entra ID OAuth PRT Issuance to Non-Managed Device Detected"
note = """## Triage and analysis
### Investigating Entra ID OAuth PRT Issuance to Non-Managed Device Detected
This rule identifies a sequence where a Microsoft Entra ID authenticates using a refresh token issued to the Microsoft Authentication Broker (MAB), followed by an authentication using a Primary Refresh Token (PRT) from the same unmanaged device. This behavior is uncommon for normal user activity and strongly suggests adversarial behavior, particularly when paired with OAuth phishing and device registration tools like ROADtx. The use of PRT shortly after a refresh token sign-in typically indicates the attacker has registered a virtual device and is now using the PRT to impersonate a registered user+device pair. The device in question is still marked as unmanaged, indicating it is not compliant with organizational policies and managed by Intune or other MDM solutions.
### Possible investigation steps
- Identify the user principal and device from `azure.signinlogs.properties.user_principal_name` and `azure.signinlogs.properties.device_detail.device_id`.
- Confirm the first sign-in event came from the Microsoft Auth Broker (`app_id`) with `incoming_token_type: refreshToken`.
- Ensure the device has a `trust_type` of "Azure AD joined" and that the `sign_in_session_status` is "unbound".
- Confirm the second sign-in used `incoming_token_type: primaryRefreshToken` and that the `resource_display_name` is not "Device Registration Service".
- Investigate any Microsoft Graph, Outlook, or SharePoint access occurring shortly after.
- Review conditional access policy outcomes and determine whether MFA or device compliance was bypassed.
### False positive analysis
- Legitimate device onboarding and sign-ins using hybrid-joined endpoints may trigger this rule.
- Rapid device provisioning in enterprise environments using MAB could generate similar token behavior.
- Use supporting signals, such as IP address changes, geolocation, or user agent anomalies, to reduce noise.
### Response and remediation
- Investigate other sign-in patterns and assess whether token abuse has occurred.
- Revoke PRT sessions via Microsoft Entra ID or Conditional Access.
- Remove or quarantine the suspicious device registration.
- Require password reset and enforce MFA.
- Audit and tighten device trust and conditional access configurations.
"""
references = [
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
"https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/",
]
risk_score = 47
rule_id = "40e60816-5122-11f0-9caa-f661ea17fbcd"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Use Case: Threat Detection",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-In Logs",
"Tactic: Persistence",
"Tactic: Initial Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence by azure.signinlogs.properties.user_id, azure.signinlogs.properties.device_detail.device_id with maxspan=1h
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.category == "NonInteractiveUserSignInLogs" and
azure.signinlogs.properties.app_id == "29d9ed98-a469-4536-ade2-f981bc1d605e" and
azure.signinlogs.properties.incoming_token_type == "refreshToken" and
azure.signinlogs.properties.device_detail.trust_type == "Azure AD joined" and
azure.signinlogs.properties.device_detail.device_id != null and
azure.signinlogs.properties.token_protection_status_details.sign_in_session_status == "unbound" and
azure.signinlogs.properties.user_type == "Member" and
azure.signinlogs.result_signature == "SUCCESS"
]
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.properties.incoming_token_type == "primaryRefreshToken" and
azure.signinlogs.properties.resource_display_name != "Device Registration Service" and
azure.signinlogs.result_signature == "SUCCESS" and
azure.signinlogs.properties.device_detail.is_managed != true
and not (
azure.signinlogs.properties.app_display_name == "Windows Sign In" or
user_agent.original == "Windows-AzureAD-Authentication-Provider/1.0"
)
]
'''
[rule.investigation_fields]
field_names = [
"azure.signinlogs.properties.user_principal_name",
"azure.signinlogs.properties.device_detail.device_id",
"azure.signinlogs.properties.incoming_token_type",
"azure.signinlogs.properties.resource_display_name",
"azure.signinlogs.properties.token_protection_status_details.sign_in_session_status",
"azure.signinlogs.properties.app_id",
"azure.signinlogs.properties.device_detail.trust_type",
"source.geo.country_name",
"source.geo.city_name",
"source.address",
"event.outcome",
"event.category",
]
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.005"
name = "Device Registration"
reference = "https://attack.mitre.org/techniques/T1098/005/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1h, correlated by azure.signinlogs.properties.device_detail.device_id, azure.signinlogs.properties.user_id.
Stage 1: authentication
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.category == "NonInteractiveUserSignInLogs" and
azure.signinlogs.properties.app_id == "29d9ed98-a469-4536-ade2-f981bc1d605e" and
azure.signinlogs.properties.incoming_token_type == "refreshToken" and
azure.signinlogs.properties.device_detail.trust_type == "Azure AD joined" and
azure.signinlogs.properties.device_detail.device_id != null and
azure.signinlogs.properties.token_protection_status_details.sign_in_session_status == "unbound" and
azure.signinlogs.properties.user_type == "Member" and
azure.signinlogs.result_signature == "SUCCESS"
]
Stage 2: authentication
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.properties.incoming_token_type == "primaryRefreshToken" and
azure.signinlogs.properties.resource_display_name != "Device Registration Service" and
azure.signinlogs.result_signature == "SUCCESS" and
azure.signinlogs.properties.device_detail.is_managed != true
and not (
azure.signinlogs.properties.app_display_name == "Windows Sign In" or
user_agent.original == "Windows-AzureAD-Authentication-Provider/1.0"
)
]
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
azure.signinlogs.properties.app_display_name | eq | Windows Sign In | excludes:azure.signinlogs.properties.app_display_name field:"azure.signinlogs.properties.app_display_name" value:"Windows Sign In" |
user_agent.original | eq | Windows-AzureAD-Authentication-Provider/1.0 | excludes:user_agent.original field:"user_agent.original" value:"Windows-AzureAD-Authentication-Provider/1.0" |
Github Activity on a Private Repository from an Unusual IP
#Detects when there is activity on a private GitHub repository from an unusual IP address. Adversaries may access private repositories from unfamiliar IPs to exfiltrate sensitive code or data, potentially indicating a compromise or unauthorized access.
MITRE ATT&CK Coverage
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- GitHub Access Granted To Personal Access Token Followed By High Number Of Cloned Non Public Repositories (YARA-L)
- GitHub Actions Unusual Bot Push to Repository (Elastic)
- GitHub Exfiltration via High Number of Repository Clones by User (Elastic)
- GitHub High Number Of Non Public GitHub Repositories Cloned (YARA-L)
- GitHub User Initial Access to Private Repo (Panther)
- High Number of Cloned GitHub Repos From PAT (Elastic)
Rule Body
[metadata]
creation_date = "2025/12/16"
integration = ["github"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects when there is activity on a private GitHub repository from an unusual IP address. Adversaries may
access private repositories from unfamiliar IPs to exfiltrate sensitive code or data, potentially indicating
a compromise or unauthorized access.
"""
from = "now-9m"
index = ["logs-github.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "Github Activity on a Private Repository from an Unusual IP"
references = [
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
"https://trigger.dev/blog/shai-hulud-postmortem",
"https://posthog.com/blog/nov-24-shai-hulud-attack-post-mortem",
]
risk_score = 21
rule_id = "daf2e0e0-0bab-4672-bfa1-62db0ee5ec22"
severity = "low"
tags = [
"Domain: Cloud",
"Use Case: Threat Detection",
"Tactic: Impact",
"Tactic: Initial Access",
"Tactic: Persistence",
"Data Source: Github",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset:"github.audit" and event.action:("git.push" or "git.clone") and github.repository_public:false
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1213"
name = "Data from Information Repositories"
reference = "https://attack.mitre.org/techniques/T1213/"
[[rule.threat.technique.subtechnique]]
id = "T1213.003"
name = "Code Repositories"
reference = "https://attack.mitre.org/techniques/T1213/003/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[rule.new_terms]
field = "new_terms_fields"
value = ["source.ip", "github.repo"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset:"github.audit" and event.action:("git.push" or "git.clone") and github.repository_public:false
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"github.audit" |
event.action | in |
| field:"EventType" kind:in |
github.repository_public | eq |
| field:"github.repository_public" kind:eq value:"false" |
GKE User Exec into Pod
#Detects the first occurrence of a non-system GKE identity establishing an exec session into a pod. kubectl exec enables interactive command execution inside workloads and is a common post-compromise technique to access secrets and expand access.
Known False Positives
- Administrators routinely exec into pods for troubleshooting. Baseline expected users and target pods, then exclude known break-glass identities.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Kubernetes | get-pods-exec: get pods/exec |
| Kubernetes | create-pods-exec: create pods/exec |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure AKS Attempted User Exec into Pod (Elastic)
- Container With A hostPath Mount Created (Sigma)
- Creation Of Pod In System Namespace (Sigma)
- Direct Interactive Kubernetes API Request by Unusual Utilities (Elastic)
- Exec into Pod (Panther)
- GCP Break-glass Container Workload Deployed (Sigma)
- GCP K8s Pod Attached To Node Host Network (Panther)
- GCP K8S Pod Create Or Modify Host Path Volume Mount (Panther)
Rule Body
[metadata]
creation_date = "2026/06/30"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/06/30"
[rule]
author = ["Elastic"]
description = """
Detects the first occurrence of a non-system GKE identity establishing an exec session into a pod. kubectl exec enables
interactive command execution inside workloads and is a common post-compromise technique to access secrets and expand
access.
"""
false_positives = [
"""
Administrators routinely exec into pods for troubleshooting. Baseline expected users and target pods, then exclude
known break-glass identities.
""",
]
from = "now-6m"
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE User Exec into Pod"
note = """## Triage and analysis
### Investigating GKE User Exec into Pod
This new-terms rule alerts on the first exec into a given pod by a user identity in the lookback window.
### Investigation steps
- Review `user.email`, `orchestrator.resource.name`, `source.ip`, and `user_agent.original`.
- Determine whether the target pod holds sensitive data or cluster credentials.
- Correlate with secret access or RBAC changes from the same identity.
### False positives
- Approved admin debugging; exclude stable operator identities after review.
## Setup
The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."""
references = [
"https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/",
]
risk_score = 47
rule_id = "c040c962-1c60-4259-8ea3-601a40d4ab9f"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Kubernetes",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Use Case: Threat Detection",
"Tactic: Execution",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset:gcp.audit and event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
not user.email:system\:*
'''
[rule.new_terms]
field = "new_terms_fields"
value = ["user.email", "orchestrator.resource.name"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset:gcp.audit and event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
not user.email:system\:*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"gcp.audit" |
event.action | in |
| field:"EventType" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.email | starts_with | system: | excludes:user.email field:"user.email" value:"system:" |
Potential File Download via a Headless Browser
#Identifies headless browser execution from a suspicious parent process with arguments consistent with scripted retrieval. Adversaries use browsers because they are trusted, signed binaries that proxy and application-control policies allow through, bypassing restrictions on direct download tools.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2024/05/10"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/04/07"
[rule]
author = ["Elastic"]
description = """
Identifies headless browser execution from a suspicious parent process with arguments consistent with scripted retrieval. Adversaries use browsers because they are trusted, signed binaries that proxy and application-control policies allow through, bypassing restrictions on direct download tools.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential File Download via a Headless Browser"
references = ["https://lolbas-project.github.io/lolbas/Binaries/Msedge/"]
risk_score = 73
rule_id = "5f2f463e-6997-478c-8405-fb41cc283281"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Command and Control",
"Resources: Investigation Guide",
"Data Source: Windows",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Data Source: Sysmon",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : ("chrome.exe", "msedge.exe", "brave.exe", "browser.exe", "dragon.exe", "vivaldi.exe") and
process.args : "--headless*" and
process.args : ("--dump-dom", "*http*", "data:text/html;base64,*") and
process.parent.name :
("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe", "conhost.exe", "msiexec.exe",
"explorer.exe", "rundll32.exe", "winword.exe", "excel.exe", "onenote.exe", "hh.exe", "powerpnt.exe", "forfiles.exe",
"pcalua.exe", "wmiprvse.exe") and
not process.executable : (
"?:\\inetpub\\wwwroot\\*\\ext\\modules\\html2pdf\\bin\\chrome\\*\\chrome-win64\\chrome.exe",
"\\Device\\HarddiskVolume*\\inetpub\\wwwroot\\*\\ext\\modules\\html2pdf\\bin\\chrome\\*\\chrome-win64\\chrome.exe"
)
'''
note = """## Triage and analysis
### Investigating Potential File Download via a Headless Browser
#### Possible investigation steps
- What headless pattern does the command line express, and is the browser the installed product?
- Why: this rule fires on three distinct retrieval patterns -- remote URL fetch, inline base64 HTML decode ("data:text/html;base64"), or DOM dump ("--dump-dom") -- and each requires different follow-on evidence.
- Focus: `process.command_line` and `process.working_directory` to identify the retrieval pattern and output destination; confirm the browser is the installed product via `process.executable`, `process.code_signature.subject_name`, and `process.code_signature.trusted`.
- Implication: retrieval intent is stronger when the command line targets external content, decodes base64, or redirects output to unusual paths, especially when the browser is unsigned, portable, or renamed; more explainable when the arguments match a rendering or automation workflow and the browser is the standard signed installation.
- Does the parent, ancestry, and user-host pattern explain why a browser is being driven headlessly?
- Why: the same browser arguments mean different things when launched by a web-rendering service than when launched by a script host, Office application, or interactive shell.
- Focus: `process.parent.executable`, `process.parent.command_line`, `process.Ext.ancestry`, and `process.Ext.session_info.logon_type`; also check whether `user.id` and `host.id` fit a role where headless browser automation is expected.
- Implication: more concerning if launched by a script host, Office process, MSI, WMI, or an unexpected interactive session, or when the user-host pair should not be running headless browsers; more explainable if the ancestry resolves to a recognized rendering service or automation component for that host role.
- Do network events show the browser reaching destinations consistent with the claimed workflow?
- Focus: same-host network events scoped to the alert's `process.entity_id`, using `dns.resolved_ip` to bridge `dns.question.name` to `destination.ip` and treating `destination.as.organization.name` as ownership context rather than a verdict. $investigate_2
- Hint: if `process.entity_id` is not available, stay on the same `host.id` and alert window and use `dns.question.name`, `dns.resolved_ip`, and `destination.ip` to test whether the browser likely reached the fetched content.
- Implication: delivery risk increases when the browser reaches rare public destinations or infrastructure unrelated to the workflow, or when another process connects to an exposed debugging port; risk falls when destinations align with recognized internal services or known automation targets. Missing network telemetry is unresolved, not benign.
- Do file events or child processes from the browser show downloaded, decoded, or staged artifacts?
- Focus: file events scoped to `process.entity_id` (`file.path`, `file.origin_url`, `file.Ext.windows.zone_identifier`, `file.Ext.header_bytes`), child process activity, and later `process.executable` reuse of a written path.
- Implication: more likely delivery when the browser writes scripts, executables, archives, or decoded content to user-writable or deceptive paths, spawns child processes, or the artifact later appears in execution telemetry; less concerning when output stays in a renderer cache or report directory with no suspicious reuse.
- If the local browser, destination, or artifact evidence stays suspicious or unresolved, does related alert history show isolated automation or broader download activity on this user or host?
- Focus: related alerts for `host.id` and `user.id` in the last 48 hours, checking for sibling transfer tools, non-headless browser automation, or reuse of the same destinations across hosts.
- $investigate_0
- $investigate_1
- Implication: broaden when the same user or host shows repeated delivery behavior across hosts or through sibling tools; keep narrow when both alert views stay within one recognized automation component.
- Escalate when browser identity, command line, destinations, artifacts, or alert scope point to unauthorized headless retrieval or staging; close only when all evidence aligns with a recognized automation workflow; if mixed or incomplete, preserve and escalate.
### False positive analysis
- Server-side rendering, web testing, QA, or browser automation can legitimately start a headless browser with retrieval arguments. Confirm when `process.executable`, `process.parent.executable`, and the `dns.question.name` or `destination.ip` pattern all align with one automation component and no staged artifacts diverge from that workflow. If automation records are unavailable, require the same browser, parent, and destination pattern to recur across prior alerts.
- Before creating an exception, build on `process.executable`, `process.parent.executable`, `process.code_signature.subject_name`, and `host.id` or `user.id`. Avoid exceptions on `process.name` alone, the "--headless" flag alone, or `host.id` alone.
### Response and remediation
- If confirmed benign, reverse any temporary containment and document the `process.executable`, `process.parent.executable`, `process.command_line`, destination pattern from `dns.question.name` or `destination.ip`, and recurring `user.id` / `host.id` scope that proved the workflow. Create an exception only if that same pattern recurs consistently across prior alerts from this rule.
- If suspicious but unconfirmed, first preserve the alert's `process.entity_id`, `process.command_line`, related `file.path` outputs, `file.origin_url` provenance, and any linked `dns.question.name`, `dns.resolved_ip`, or `destination.ip` values. Then apply reversible containment such as temporary egress blocks or tighter monitoring of the affected `user.id` or `host.id`. Escalate to host isolation only when the browser, network, or artifact evidence shows material delivery or staging risk.
- If confirmed malicious, document the alert's `process.entity_id`, `process.command_line`, `process.parent.command_line`, written `file.path` artifacts, `process.hash.sha256`, and confirmed `dns.question.name` or `destination.ip` values before initiating response actions. Prefer endpoint isolation as the first containment step, weighing the host's role before isolating critical infrastructure such as servers, domain controllers, or build systems. If direct endpoint response is unavailable, escalate with the preserved artifact set to the team that can act.
- After containment, review other `host.id` and `user.id` alerts for the same `dns.question.name`, `destination.ip`, or `process.executable` pattern before deleting artifacts or restoring access. Then block the malicious destinations and downloaded artifact hashes identified during the investigation, eradicate the scripts, archives, browsers, or persistence artifacts uncovered during the artifact and scope review, and remediate the launcher, automation component, or execution-control gap that allowed the headless browser to retrieve content.
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"host.name",
"host.id",
"user.name",
"user.id",
"user.domain",
"process.entity_id",
"process.executable",
"process.command_line",
"process.pe.original_file_name",
"process.parent.executable",
"process.parent.command_line",
"process.code_signature.subject_name",
"process.code_signature.trusted",
"process.working_directory",
"process.hash.sha256",
]
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Network activity for the alerting process"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.name : ("chrome.exe", "msedge.exe", "brave.exe", "browser.exe", "dragon.exe", "vivaldi.exe") and
process.args : "--headless*" and
process.args : ("--dump-dom", "*http*", "data:text/html;base64,*") and
process.parent.name :
("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe", "conhost.exe", "msiexec.exe",
"explorer.exe", "rundll32.exe", "winword.exe", "excel.exe", "onenote.exe", "hh.exe", "powerpnt.exe", "forfiles.exe",
"pcalua.exe", "wmiprvse.exe") and
not process.executable : (
"?:\\inetpub\\wwwroot\\*\\ext\\modules\\html2pdf\\bin\\chrome\\*\\chrome-win64\\chrome.exe",
"\\Device\\HarddiskVolume*\\inetpub\\wwwroot\\*\\ext\\modules\\html2pdf\\bin\\chrome\\*\\chrome-win64\\chrome.exe"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\inetpub\wwwroot\*\ext\modules\html2pdf\bin\chrome\*\chrome-win64\chrome.exe, \Device\HarddiskVolume*\inetpub\wwwroot\*\ext\modules\html2pdf\bin\chrome\*\chrome-win64\chrome.exe | excludes:process.executable field:"process.executable" value:"?:\inetpub\wwwroot\*\ext\modules\html2pdf\bin\chrome\*\chrome-win64\chrome.exe" field:"process.executable" value:"\Device\HarddiskVolume*\inetpub\wwwroot\*\ext\modules\html2pdf\bin\chrome\*\chrome-win64\chrome.exe" |
Potential Privilege Escalation via Service ImagePath Modification
#Identifies registry modifications to default services that could enable privilege escalation to SYSTEM. Attackers with privileges from groups like Server Operators may change the ImagePath of services to executables under their control or to execute commands.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2024/06/05"
integration = ["endpoint", "windows", "crowdstrike", "sentinel_one_cloud_funnel", "m365_defender"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies registry modifications to default services that could enable privilege escalation to SYSTEM. Attackers with
privileges from groups like Server Operators may change the ImagePath of services to executables under their control or
to execute commands.
"""
from = "now-9m"
index = [
"logs-endpoint.events.registry-*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
"logs-crowdstrike.fdr*",
"logs-sentinel_one_cloud_funnel.*",
"logs-m365_defender.event-*",
"endgame-*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Privilege Escalation via Service ImagePath Modification"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Potential Privilege Escalation via Service ImagePath Modification
Windows services are crucial for system operations, often running with high privileges. Adversaries exploit this by altering the ImagePath registry key of services to execute malicious code with elevated privileges. The detection rule identifies suspicious modifications to service ImagePaths, focusing on changes that deviate from standard executable paths, thus flagging potential privilege escalation attempts.
### Possible investigation steps
- Review the specific registry key and value that triggered the alert to confirm it matches one of the monitored service keys, such as those listed in the query (e.g., *\\LanmanServer, *\\Winmgmt).
- Examine the modified ImagePath value to determine if it points to a non-standard executable path or a suspicious executable, especially those not located in %systemroot%\\system32\\.
- Check the process.executable field to identify the process responsible for the registry modification and assess its legitimacy.
- Investigate the user account associated with the modification event to determine if it has elevated privileges, such as membership in the Server Operators group.
- Correlate the event with other logs or alerts to identify any related suspicious activities, such as unexpected service starts or process executions.
- Review recent changes or activities on the host to identify any unauthorized access or configuration changes that could indicate a broader compromise.
### False positive analysis
- Legitimate software updates or installations may modify service ImagePaths. Users can create exceptions for known update processes or installation paths to prevent false positives.
- System administrators might intentionally change service configurations for maintenance or troubleshooting. Document and exclude these changes by adding exceptions for specific administrator actions or paths.
- Custom scripts or automation tools that modify service settings as part of their operation can trigger alerts. Identify and whitelist these scripts or tools to avoid unnecessary alerts.
- Some third-party security or management software may alter service ImagePaths as part of their functionality. Verify the legitimacy of such software and exclude their known paths from detection.
- Changes made by trusted IT personnel during system configuration or optimization should be logged and excluded from alerts to reduce noise.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement.
- Terminate any suspicious processes identified as running from non-standard executable paths, especially those not originating from the system32 directory.
- Restore the modified ImagePath registry key to its original state using a known good configuration or backup.
- Conduct a thorough scan of the system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any additional malicious files or persistence mechanisms.
- Review and audit user accounts and group memberships, particularly those with elevated privileges like Server Operators, to ensure no unauthorized changes have been made.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Implement enhanced monitoring and alerting for future modifications to service ImagePath registry keys, focusing on deviations from standard paths to detect similar threats promptly."""
references = ["https://cube0x0.github.io/Pocing-Beyond-DA/"]
risk_score = 47
rule_id = "b66b7e2b-d50a-49b9-a6fc-3a383baedc6b"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Privilege Escalation",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Crowdstrike",
"Resources: Investigation Guide",
"Data Source: SentinelOne",
"Data Source: Microsoft Defender XDR",
"Data Source: Elastic Endgame",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where host.os.type == "windows" and event.type == "change" and process.executable != null and
registry.data.strings != null and registry.value == "ImagePath" and
registry.key : (
"*\\ADWS", "*\\AppHostSvc", "*\\AppReadiness", "*\\AudioEndpointBuilder", "*\\AxInstSV", "*\\camsvc", "*\\CertSvc",
"*\\COMSysApp", "*\\CscService", "*\\defragsvc", "*\\DeviceAssociationService", "*\\DeviceInstall", "*\\DevQueryBroker",
"*\\Dfs", "*\\DFSR", "*\\diagnosticshub.standardcollector.service", "*\\DiagTrack", "*\\DmEnrollmentSvc", "*\\DNS",
"*\\dot3svc", "*\\Eaphost", "*\\GraphicsPerfSvc", "*\\hidserv", "*\\HvHost", "*\\IISADMIN", "*\\IKEEXT",
"*\\InstallService", "*\\iphlpsvc", "*\\IsmServ", "*\\LanmanServer", "*\\MSiSCSI", "*\\NcbService", "*\\Netlogon",
"*\\Netman", "*\\NtFrs", "*\\PlugPlay", "*\\Power", "*\\PrintNotify", "*\\ProfSvc", "*\\PushToInstall", "*\\RSoPProv",
"*\\sacsvr", "*\\SENS", "*\\SensorDataService", "*\\SgrmBroker", "*\\ShellHWDetection", "*\\shpamsvc", "*\\StorSvc",
"*\\svsvc", "*\\swprv", "*\\SysMain", "*\\Themes", "*\\TieringEngineService", "*\\TokenBroker", "*\\TrkWks",
"*\\UALSVC", "*\\UserManager", "*\\vm3dservice", "*\\vmicguestinterface", "*\\vmicheartbeat", "*\\vmickvpexchange",
"*\\vmicrdv", "*\\vmicshutdown", "*\\vmicvmsession", "*\\vmicvss", "*\\vmvss", "*\\VSS", "*\\w3logsvc", "*\\W3SVC",
"*\\WalletService", "*\\WAS", "*\\wercplsupport", "*\\WerSvc", "*\\Winmgmt", "*\\wisvc", "*\\wmiApSrv",
"*\\WPDBusEnum", "*\\WSearch"
) and
not (
registry.data.strings : (
"?:\\Windows\\system32\\*.exe",
"%systemroot%\\system32\\*.exe",
"%windir%\\system32\\*.exe",
"%SystemRoot%\\system32\\svchost.exe -k *",
"%windir%\\system32\\svchost.exe -k *"
) and
not registry.data.strings : (
"*\\cmd.exe",
"*\\cscript.exe",
"*\\ieexec.exe",
"*\\iexpress.exe",
"*\\installutil.exe",
"*\\Microsoft.Workflow.Compiler.exe",
"*\\msbuild.exe",
"*\\mshta.exe",
"*\\msiexec.exe",
"*\\msxsl.exe",
"*\\net.exe",
"*\\powershell.exe",
"*\\pwsh.exe",
"*\\reg.exe",
"*\\RegAsm.exe",
"*\\RegSvcs.exe",
"*\\regsvr32.exe",
"*\\rundll32.exe",
"*\\vssadmin.exe",
"*\\wbadmin.exe",
"*\\wmic.exe",
"*\\wscript.exe"
)
)
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Registry Events](https://ela.st/sysmon-event-reg-setup)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[rule.threat.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[rule.threat.technique.subtechnique]]
id = "T1574.011"
name = "Services Registry Permissions Weakness"
reference = "https://attack.mitre.org/techniques/T1574/011/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1569"
name = "System Services"
reference = "https://attack.mitre.org/techniques/T1569/"
[[rule.threat.technique.subtechnique]]
id = "T1569.002"
name = "Service Execution"
reference = "https://attack.mitre.org/techniques/T1569/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: registry
registry where host.os.type == "windows" and event.type == "change" and process.executable != null and
registry.data.strings != null and registry.value == "ImagePath" and
registry.key : (
"*\\ADWS", "*\\AppHostSvc", "*\\AppReadiness", "*\\AudioEndpointBuilder", "*\\AxInstSV", "*\\camsvc", "*\\CertSvc",
"*\\COMSysApp", "*\\CscService", "*\\defragsvc", "*\\DeviceAssociationService", "*\\DeviceInstall", "*\\DevQueryBroker",
"*\\Dfs", "*\\DFSR", "*\\diagnosticshub.standardcollector.service", "*\\DiagTrack", "*\\DmEnrollmentSvc", "*\\DNS",
"*\\dot3svc", "*\\Eaphost", "*\\GraphicsPerfSvc", "*\\hidserv", "*\\HvHost", "*\\IISADMIN", "*\\IKEEXT",
"*\\InstallService", "*\\iphlpsvc", "*\\IsmServ", "*\\LanmanServer", "*\\MSiSCSI", "*\\NcbService", "*\\Netlogon",
"*\\Netman", "*\\NtFrs", "*\\PlugPlay", "*\\Power", "*\\PrintNotify", "*\\ProfSvc", "*\\PushToInstall", "*\\RSoPProv",
"*\\sacsvr", "*\\SENS", "*\\SensorDataService", "*\\SgrmBroker", "*\\ShellHWDetection", "*\\shpamsvc", "*\\StorSvc",
"*\\svsvc", "*\\swprv", "*\\SysMain", "*\\Themes", "*\\TieringEngineService", "*\\TokenBroker", "*\\TrkWks",
"*\\UALSVC", "*\\UserManager", "*\\vm3dservice", "*\\vmicguestinterface", "*\\vmicheartbeat", "*\\vmickvpexchange",
"*\\vmicrdv", "*\\vmicshutdown", "*\\vmicvmsession", "*\\vmicvss", "*\\vmvss", "*\\VSS", "*\\w3logsvc", "*\\W3SVC",
"*\\WalletService", "*\\WAS", "*\\wercplsupport", "*\\WerSvc", "*\\Winmgmt", "*\\wisvc", "*\\wmiApSrv",
"*\\WPDBusEnum", "*\\WSearch"
) and
not (
registry.data.strings : (
"?:\\Windows\\system32\\*.exe",
"%systemroot%\\system32\\*.exe",
"%windir%\\system32\\*.exe",
"%SystemRoot%\\system32\\svchost.exe -k *",
"%windir%\\system32\\svchost.exe -k *"
) and
not registry.data.strings : (
"*\\cmd.exe",
"*\\cscript.exe",
"*\\ieexec.exe",
"*\\iexpress.exe",
"*\\installutil.exe",
"*\\Microsoft.Workflow.Compiler.exe",
"*\\msbuild.exe",
"*\\mshta.exe",
"*\\msiexec.exe",
"*\\msxsl.exe",
"*\\net.exe",
"*\\powershell.exe",
"*\\pwsh.exe",
"*\\reg.exe",
"*\\RegAsm.exe",
"*\\RegSvcs.exe",
"*\\regsvr32.exe",
"*\\rundll32.exe",
"*\\vssadmin.exe",
"*\\wbadmin.exe",
"*\\wmic.exe",
"*\\wscript.exe"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"change" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
registry.data.strings | is_not_null | field:"Details" kind:is_not_null | |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard |
registry.key | wildcard |
| field:"TargetObject" kind:wildcard |
registry.value | eq |
| field:"registry_value_name" kind:eq value:"ImagePath" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
registry.data.strings | ends_with | \cmd.exe, \cscript.exe, \ieexec.exe, \iexpress.exe, \installutil.exe, \Microsoft.Workflow.Compiler.exe, \msbuild.exe, \mshta.exe, \msiexec.exe, \msxsl.exe, \net.exe, \powershell.exe, \pwsh.exe, \reg.exe, \RegAsm.exe, \RegSvcs.exe, \regsvr32.exe, \rundll32.exe, \vssadmin.exe, \wbadmin.exe, \wmic.exe, \wscript.exe | excludes:registry.data.strings |
registry.data.strings | wildcard | ?:\Windows\system32\*.exe, %systemroot%\system32\*.exe, %windir%\system32\*.exe, %SystemRoot%\system32\svchost.exe -k *, %windir%\system32\svchost.exe -k * | excludes:registry.data.strings |
PowerShell Mailbox Collection Script
#Detects PowerShell script block content that indicates programmatic mailbox access using Outlook Interop/MAPI or EWS APIs. Adversaries can use mailbox access to collect email content and attachments for exfiltration.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2023/01/11"
integration = ["windows"]
maturity = "production"
updated_date = "2026/01/26"
[rule]
author = ["Elastic"]
description = """
Detects PowerShell script block content that indicates programmatic mailbox access using Outlook Interop/MAPI or EWS
APIs. Adversaries can use mailbox access to collect email content and attachments for exfiltration.
"""
from = "now-9m"
index = ["winlogbeat-*", "logs-windows.powershell*"]
language = "kuery"
license = "Elastic License v2"
name = "PowerShell Mailbox Collection Script"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating PowerShell Mailbox Collection Script
This alert indicates PowerShell script block content consistent with programmatic mailbox access using Outlook Interop/MAPI or Exchange Web Services (EWS) managed APIs. This can support legitimate administration and support workflows, but it can also be used to collect messages and attachments for discovery or theft. Prioritize determining (1) who ran the script and where, (2) which mailbox(es) and folders were accessed, and (3) whether any content was staged or transferred.
#### Key alert fields to review
- `user.name`, `user.domain`, `user.id`: Account execution context for correlation, prioritization, and scoping.
- `host.name`, `host.id`: Host execution context for correlation, prioritization, and scoping.
- `powershell.file.script_block_text`: Script block content that matched the detection logic.
- `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`: Script block metadata to pivot to other fragments or reconstruct full script content when split across multiple events.
- `file.path`, `file.directory`, `file.name`: File-origin context when the script block is sourced from an on-disk file.
- `powershell.file.script_block_length`: Script block length (size) context.
#### Possible investigation steps
- Confirm the execution context:
- Review `user.name`, `user.domain`, and `user.id` to identify the executing account and whether it commonly performs mailbox-related automation.
- Review `host.name` and `host.id` to identify the endpoint and whether it is expected to run mailbox access scripts.
- Use the alert time as an anchor to check for other suspicious activity from the same user and host in the surrounding timeframe.
- Analyze `powershell.file.script_block_text` for technique, targeting, and scope:
- Outlook Interop/MAPI usage commonly includes `Microsoft.Office.Interop.Outlook`, `Interop.Outlook.olDefaultFolders`, `Outlook.Application`, `GetNamespace`/`MAPI`, `Session`, `GetDefaultFolder`, `GetSharedDefaultFolder`, and default folder references such as `olFolderInBox`.
- EWS usage commonly includes `Microsoft.Exchange.WebServices.Data.ExchangeService`, `Microsoft.Exchange.WebServices.Data.Folder`, `Microsoft.Exchange.WebServices.Data.FileAttachment`, and mailbox enumeration or retrieval methods such as `FindItems`, `Bind`, `WellKnownFolderName`, `FolderId`, `ItemView`, `PropertySet`, `SearchFilter`, and `Attachments`.
- Identify mailbox identifiers (email addresses, aliases), folder targets (default folders, explicit folder names), and any shared mailbox references.
- Determine collection breadth by noting loops over folders/items, pagination settings (such as item views), and filtering criteria (date/keyword filters).
- Identify how items or attachments are handled (enumeration only vs retrieval and save/export) and any referenced storage locations.
- Reconstruct the full script:
- Pivot on `powershell.file.script_block_id` to collect all fragments related to the same script block.
- Use `powershell.sequence` and `powershell.total` to order fragments and confirm completeness; missing fragments can change intent and scope.
- Use `powershell.file.script_block_length` to understand whether the alert contains a short snippet or part of a larger tool.
- Determine script provenance and reuse:
- If present, review `file.path` and `file.name` to identify the on-disk script/module source and whether the location aligns with expected administrative tooling.
- If `file.path` is absent, treat the execution as potentially interactive or dynamically loaded; rely on the reconstructed script content to determine intent and scope.
- Search for the same `file.name`/`file.path` and distinctive strings from `powershell.file.script_block_text` across other hosts and users to identify reuse or deployment.
- Correlate with adjacent telemetry (if available) to identify launch method and downstream activity:
- Process execution: identify the PowerShell host process and any parent process/launcher to determine whether execution was interactive, automated, or initiated by another application.
- Network activity: review outbound connections around the alert time for access to Exchange/EWS endpoints and for unexpected external destinations that could indicate transfer of collected data.
- File activity: review for new or modified files consistent with staging mail content (exports, archives, or attachment dumps), especially in locations referenced by the script.
- Authentication activity: review for unusual sign-ins or repeated authentications by the executing account that align with mailbox enumeration or access to multiple mailboxes.
- Assess impact and prioritize response:
- Treat as higher priority when the script references shared mailboxes, multiple mailbox identifiers, broad folder enumeration, or attachment retrieval.
- Coordinate with messaging administrators to validate whether the access scope is authorized and to help identify potentially affected mailboxes and data types.
### False positive analysis
- Approved administration, reporting, archiving, or migration workflows that programmatically access mailbox data using Outlook Interop/MAPI or EWS.
- Support or troubleshooting activity where staff retrieve specific messages or attachments under an approved request.
- Development or testing of Outlook automation or EWS integrations on non-production hosts.
### Response and remediation
- If unauthorized or suspicious, contain the affected host to prevent continued mailbox access and reduce the risk of data transfer.
- Restrict the executing account (disable or reset credentials based on severity) and review mailbox permissions and delegation associated with the account.
- Preserve evidence for investigation and response:
- Retain the reconstructed script content and all associated script block events for `powershell.file.script_block_id`.
- If `file.path` is present, preserve the referenced script/module for forensic review and determine how it was introduced.
- Identify and remediate persistence or automation mechanisms that could re-run the script and expand collection scope.
- Assess and document impact using the reconstructed script content:
- Determine which mailbox(es), folders, and item types (messages and attachments) were targeted.
- Identify any local staging locations or transfer destinations referenced by the script.
- Coordinate with messaging administrators and relevant stakeholders to support mailbox-level investigation and response actions if sensitive data may have been accessed.
- Increase monitoring for recurrence by tracking similar script block content, repeated executions by the same user, and reuse of the same script file paths across hosts.
"""
references = [
"https://github.com/dafthack/MailSniper/blob/master/MailSniper.ps1",
"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/blob/master/apt29/Archive/CALDERA_DIY/evals/payloads/stepSeventeen_email.ps1",
]
risk_score = 47
rule_id = "a2d04374-187c-4fd9-b513-3ad4e7fdd67a"
setup = """## Setup
PowerShell Script Block Logging must be enabled to generate the events used by this rule (e.g., 4104).
Setup instructions: https://ela.st/powershell-logging-setup
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Collection",
"Data Source: PowerShell Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.category:process and host.os.type:windows and
(
(
powershell.file.script_block_text : (
"Microsoft.Office.Interop.Outlook" or
"Interop.Outlook.olDefaultFolders" or
"olFolderInBox" or
"Outlook.Application"
) and powershell.file.script_block_text : ("MAPI" or "GetDefaultFolder" or "GetNamespace" or "Session" or "GetSharedDefaultFolder")
) or
(
powershell.file.script_block_text : (
"Microsoft.Exchange.WebServices.Data.Folder" or
"Microsoft.Exchange.WebServices.Data.FileAttachment" or
"Microsoft.Exchange.WebServices.Data.ExchangeService"
) and
powershell.file.script_block_text : ("FindItems" or "Bind" or "WellKnownFolderName" or "FolderId" or "ItemView" or "PropertySet" or "SearchFilter" or "Attachments")
)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1114"
name = "Email Collection"
reference = "https://attack.mitre.org/techniques/T1114/"
[[rule.threat.technique.subtechnique]]
id = "T1114.001"
name = "Local Email Collection"
reference = "https://attack.mitre.org/techniques/T1114/001/"
[[rule.threat.technique.subtechnique]]
id = "T1114.002"
name = "Remote Email Collection"
reference = "https://attack.mitre.org/techniques/T1114/002/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[[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/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user.id",
"user.domain",
"powershell.file.script_block_text",
"powershell.file.script_block_id",
"powershell.sequence",
"powershell.total",
"file.path",
"file.directory",
"file.name",
"process.pid",
"host.name",
"host.id",
"powershell.file.script_block_length"
]
Stages and Predicates
Stage 1: query
event.category:process and host.os.type:windows and
(
(
powershell.file.script_block_text : (
"Microsoft.Office.Interop.Outlook" or
"Interop.Outlook.olDefaultFolders" or
"olFolderInBox" or
"Outlook.Application"
) and powershell.file.script_block_text : ("MAPI" or "GetDefaultFolder" or "GetNamespace" or "Session" or "GetSharedDefaultFolder")
) or
(
powershell.file.script_block_text : (
"Microsoft.Exchange.WebServices.Data.Folder" or
"Microsoft.Exchange.WebServices.Data.FileAttachment" or
"Microsoft.Exchange.WebServices.Data.ExchangeService"
) and
powershell.file.script_block_text : ("FindItems" or "Bind" or "WellKnownFolderName" or "FolderId" or "ItemView" or "PropertySet" or "SearchFilter" or "Attachments")
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
powershell.file.script_block_text | in |
| field:"ScriptBlockText" kind:in |
Privilege Escalation via Windir Environment Variable
#Identifies a privilege escalation attempt via a rogue Windows directory (Windir) environment variable. This is a known primitive that is often combined with other vulnerabilities to elevate privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Stealth | |
| Defense Impairment |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/11/26"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Identifies a privilege escalation attempt via a rogue Windows directory (Windir) environment variable. This is a known
primitive that is often combined with other vulnerabilities to elevate privileges.
"""
from = "now-9m"
index = [
"logs-endpoint.events.registry-*",
"endgame-*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Privilege Escalation via Windir Environment Variable"
references = ["https://www.tiraniddo.dev/2017/05/exploiting-environment-variables-in.html"]
risk_score = 73
rule_id = "d563aaba-2e72-462b-8658-3e5ea22db3a6"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where host.os.type == "windows" and event.type == "change" and
registry.value : ("windir", "systemroot") and registry.data.strings != null and
registry.path : (
"*\\Environment\\windir",
"*\\Environment\\systemroot"
) and
not registry.data.strings : ("C:\\windows", "%SystemRoot%")
'''
note = """## Triage and analysis
### Investigating Privilege Escalation via Windir Environment Variable
#### Possible investigation steps
- Does the alert show a Windir or SystemRoot override that can affect this user?
- Focus: `registry.path`, `registry.value`, `registry.data.strings`, `host.id`, and `user.id`.
- Implication: Escalate when a per-user Environment hive, such as HKEY_USERS SID or HKCU-equivalent context, changes "windir" or "systemroot" away from "C:\\Windows" or "%SystemRoot%"; lower suspicion only when the same host and user recur with the same test or image-engineering value.
- Does the replacement value create a redirection path?
- Focus: `registry.data.strings` and `registry.data.type`: user-writable roots, UNC paths, or unexpected command content.
- Implication: Escalate when the value can redirect a Windows-root process to attacker-controlled content or command execution; lower suspicion only when the exact replacement is bounded test or image data and no later elevated execution uses it.
- Is the writing process the expected tool in an explainable launch chain?
- Focus: `process.executable`, `process.command_line`, `process.code_signature.subject_name`, `process.code_signature.trusted`, and `process.parent.command_line`.
- Implication: Escalate when the writer is "reg.exe", a script host, unsigned or user-writable binary, browser or Office child, or renamed tool outside a recognized management chain; reduce suspicion only when signer, path, parent, and arguments match the same test or image-engineering toolchain.
- Does the session and token context make a UAC-bypass path feasible?
- Focus: `user.id`, `user.domain`, `process.Ext.session_info.logon_type`, `process.Ext.token.integrity_level_name`, and `process.Ext.token.elevation_level`.
- Implication: Escalate when an interactive or remote-admin user changes a per-user value from a medium or limited token and later activity reaches high integrity; lower suspicion when a noninteractive service or repair context cannot exercise an interactive auto-elevated task.
- Hint: Recover session and token fields from the writer process by `process.entity_id`; if absent, use the same host plus `process.pid` and a tight time window. $investigate_0
- Did follow-on process execution exercise the override?
- Focus: same-host, same-user process starts after the alert, comparing `process.executable`, `process.command_line`, `process.parent.executable`, and `process.Ext.token.integrity_level_name` to the replacement value.
- Implication: Escalate when follow-on execution resolves through the substituted path or higher integrity, or when command-line evidence consumes then deletes or restores the value.
- Hint: If no follow-on execution appears in the alert window, treat the value as staged and extend only far enough to test later starts reusing the same replacement string. $investigate_1
- If local evidence is suspicious or unresolved, do related alerts change scope?
- Focus: related alerts for meaningful `user.id` values, such as real users or named service accounts. For machine, local service, or generic service identities, prioritize same-host alerts.
- $investigate_2
- $investigate_3
- Implication: Broaden response when the same user or host has adjacent privilege-escalation, persistence, defense-evasion, credential-access, or suspicious elevated-process alerts; keep scope local when related alerts are absent and local telemetry supports the same test or image-engineering pattern.
Final - Escalate when the non-default value enables redirection or command execution and writer, session, follow-on, or related-alert evidence is suspicious; close only when the registry value, writer path and parent, session, timeline, and host or user pattern fit the same test or image-engineering workflow; preserve artifacts and escalate when evidence is mixed or visibility is incomplete.
### False positive analysis
- Non-default per-user "windir" or "systemroot" values are unusual on production endpoints. Close as benign only when registry value, writer identity, parent chain, session, host and user pattern, and surrounding process or registry activity converge on one exact test or image-engineering workflow; outside confirmation can corroborate only after telemetry aligns. Recurrence can support missing records but not unresolved current telemetry.
- Do not close if the replacement value, writer lineage, host or user pattern, or elevated-execution evidence drifts.
- Before creating an exception, validate the minimum stable pattern: exact `registry.path`, exact or tightly bounded `registry.data.strings`, writer `process.executable`, parent `process.parent.command_line`, `host.id`, and `user.id`. Avoid exceptions on `registry.value`, process names such as "cmd.exe", or `host.id` alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and record the exact evidence that proved the workflow: `registry.path`, `registry.data.strings`, writer `process.executable`, `process.parent.command_line`, `host.id`, and `user.id`. Create an exception only if the same bounded pattern is stable across prior alerts from this rule.
- If suspicious but unconfirmed, preserve a case export of the alert and registry event, the original and modified Environment values, the writer process tree anchored on `process.entity_id`, command lines, and any substituted-path binaries or scripts recovered from the host before containment or cleanup.
- Apply reversible containment first: heightened monitoring, temporary task or execution restrictions, or removal of the rogue Environment value after evidence capture if operations permit it. Escalate to host isolation or account containment only when follow-on elevated execution, higher-integrity child processes, or related post-exploitation alerts make active misuse likely and the host role can tolerate stronger action.
- If confirmed malicious, isolate the endpoint when the registry value, writer lineage, session context, and follow-on execution show unauthorized privilege escalation. Before terminating processes or deleting artifacts, record the writer and follow-on process entity IDs, command lines, parent chain, modified registry path and value, substituted-path artifacts, and privileged process paths.
- After scope is preserved, restore "windir" or "systemroot" to the expected value, remove substituted-path content or execution triggers identified during triage, and review which privileged processes executed from the substituted path before cleanup.
- If the override was exercised or related alerts show broader compromise, treat the affected user context as potentially elevated beyond its intended boundary. Scope administrator or remote-access accounts active on the host and perform credential hygiene according to exposure and role.
- Post-incident hardening: reduce use of environment-variable-expanded paths in auto-elevated tasks where possible, retain process and registry telemetry needed for writer-lineage and follow-on execution review, and record any uncovered variant or visibility gap in the case outcome."""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Registry Events](https://ela.st/sysmon-event-reg-setup)
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"host.id",
"user.id",
"process.executable",
"process.command_line",
"process.pid",
"process.entity_id",
"process.parent.command_line",
"registry.hive",
"registry.path",
"registry.value",
"registry.data.type",
"registry.data.strings",
]
[transform]
[[transform.investigate]]
label = "Writer process event"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
],
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events for the same user and host"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[rule.threat.technique.subtechnique]]
id = "T1574.007"
name = "Path Interception by PATH Environment Variable"
reference = "https://attack.mitre.org/techniques/T1574/007/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: registry
registry where host.os.type == "windows" and event.type == "change" and
registry.value : ("windir", "systemroot") and registry.data.strings != null and
registry.path : (
"*\\Environment\\windir",
"*\\Environment\\systemroot"
) and
not registry.data.strings : ("C:\\windows", "%SystemRoot%")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"change" |
registry.data.strings | is_not_null | field:"Details" kind:is_not_null | |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
registry.value | wildcard |
| field:"registry_value_name" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
registry.data.strings | eq | C:\windows, %SystemRoot% | excludes:registry.data.strings field:"registry.data.strings" value:"C:\windows" field:"registry.data.strings" value:"%SystemRoot%" |
Script Execution via APDS XSS Injection
#Identifies attempts to execute a Windows script via a malicious Microsoft Management Console File abusing an known XSS injection vulnerability in the APDS.dll resource. Adversaries may use MSC files for initial access and execution.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies attempts to execute a Windows script via a malicious Microsoft Management Console File abusing an known XSS
injection vulnerability in the APDS.dll resource. Adversaries may use MSC files for initial access and execution.
"""
id = "c1b4893e-49cb-4003-8e88-a7305c6bbf6d"
license = "Elastic License v2"
name = "Script Execution via APDS XSS Injection"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/grimresource",
"https://medium.com/@knownsec404team/from-http-domain-to-res-domain-xss-by-using-ie-adobes-pdf-activex-plugin-ba4f082c8199",
]
version = "1.0.2"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
process.executable : "?:\\Windows\\System32\\mmc.exe" and process.args : "*.msc"]
[file where event.action == "open" and file.path : "?:\\Windows\\System32\\apds.dll"]
'''
min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.014"
name = "MMC"
reference = "https://attack.mitre.org/techniques/T1218/014/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
process.executable : "?:\\Windows\\System32\\mmc.exe" and process.args : "*.msc"]
Stage 2: file
[file where event.action == "open" and file.path : "?:\\Windows\\System32\\apds.dll"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"?:\Windows\System32\apds.dll" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"*.msc" |
process.executable | wildcard |
| field:"Image" kind:wildcard value:"?:\Windows\System32\mmc.exe" |
Suspicious API Call via Windows Script Interpreter
#Identifies a suspicious managed code hosting process which could indicate code injection or other form of suspicious code execution via Windows scripts.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies a suspicious managed code hosting process which could indicate code injection or other form of suspicious
code execution via Windows scripts.
"""
id = "58adbf08-73bd-4bd3-a74c-6b0f82d23a82"
license = "Elastic License v2"
name = "Suspicious API Call via Windows Script Interpreter"
os_list = ["windows"]
reference = ["https://github.com/med0x2e/GadgetToJScript", "https://github.com/mdsecactivebreach/SharpShooter"]
version = "1.0.5"
query = '''
api where
process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "cmstp.exe", "msxsl.exe", "mmc.exe") and
process.Ext.api.name : ("VirtualAlloc", "MapViewOfFile*") and
process.Ext.api.metadata.target_address_name : "?*" and process.Ext.api.parameters.protection == "RWX" and
process.thread.Ext.call_stack_final_user_module.name in ("clr.dll", "mscoreei.dll") and
process.thread.Ext.call_stack_summary : ("*|clr.dll|jscript*", "*|clr.dll|vbscript.dll|msxml?.dll|*") and
not process.Ext.api.metadata.target_address_name in ("clr.dll", "gdi32full.dll") and
process.Ext.api.parameters.size != 296 and
not process.parent.executable :
("?:\\IPeople\\Script\\IPScriptDirector.exe",
"?:\\Program Files\\Microsoft System Center\\Operations Manager\\Server\\MonitoringHost.exe",
"?:\\Program Files\\Microsoft System Center\\Operations Manager\\Server\\MonitoringHost.exe",
"C:\\Program Files (x86)\\DarkWebAdvisorsAgent\\PCPitstopScheduleService.exe",
"C:\\Program Files (x86)\\TelesystemAgent\\PCPitstopScheduleService.exe") and
not (process.executable : "C:\\Windows\\SysWOW64\\cscript.exe" and process.parent.executable : "C:\\Windows\\SysWOW64\\cmd.exe" and
process.command_line like "cscript //B scan.wsf *" and user.id == "S-1-5-18") and
not (process.executable : "C:\\Windows\\System32\\mmc.exe" and
process.thread.Ext.call_stack_summary like "ntdll.dll|*|mswb7.dll|clr.dll|jscript.dll|mmcndmgr.dll|mmc.exe*") and
not process.command_line :
("\"C:\\Windows\\System32\\cscript.exe\" //B //Nologo C:\\Windows\\Options\\SWD\\MapHomeDrive_1_0_0.vbs",
"C:\\WINDOWS\\System32\\WScript.exe \"M:\\DOH\\Data Exchange\\OCFS\\Severe Maternal Morbidity\\EGScript1.vbs\" ",
"cscript.exe //T:120 //U //Nologo \"C:\\Program Files (x86)\\Site24x7\\WinAgent\\monitoring\\conf\\scripts\\topprocess.vbs\" 2 ")
'''
min_endpoint_version = "8.10.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[[threat.technique]]
id = "T1220"
name = "XSL Script Processing"
reference = "https://attack.mitre.org/techniques/T1220/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: api
api where
process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "cmstp.exe", "msxsl.exe", "mmc.exe") and
process.Ext.api.name : ("VirtualAlloc", "MapViewOfFile*") and
process.Ext.api.metadata.target_address_name : "?*" and process.Ext.api.parameters.protection == "RWX" and
process.thread.Ext.call_stack_final_user_module.name in ("clr.dll", "mscoreei.dll") and
process.thread.Ext.call_stack_summary : ("*|clr.dll|jscript*", "*|clr.dll|vbscript.dll|msxml?.dll|*") and
not process.Ext.api.metadata.target_address_name in ("clr.dll", "gdi32full.dll") and
process.Ext.api.parameters.size != 296 and
not process.parent.executable :
("?:\\IPeople\\Script\\IPScriptDirector.exe",
"?:\\Program Files\\Microsoft System Center\\Operations Manager\\Server\\MonitoringHost.exe",
"?:\\Program Files\\Microsoft System Center\\Operations Manager\\Server\\MonitoringHost.exe",
"C:\\Program Files (x86)\\DarkWebAdvisorsAgent\\PCPitstopScheduleService.exe",
"C:\\Program Files (x86)\\TelesystemAgent\\PCPitstopScheduleService.exe") and
not (process.executable : "C:\\Windows\\SysWOW64\\cscript.exe" and process.parent.executable : "C:\\Windows\\SysWOW64\\cmd.exe" and
process.command_line like "cscript //B scan.wsf *" and user.id == "S-1-5-18") and
not (process.executable : "C:\\Windows\\System32\\mmc.exe" and
process.thread.Ext.call_stack_summary like "ntdll.dll|*|mswb7.dll|clr.dll|jscript.dll|mmcndmgr.dll|mmc.exe*") and
not process.command_line :
("\"C:\\Windows\\System32\\cscript.exe\" //B //Nologo C:\\Windows\\Options\\SWD\\MapHomeDrive_1_0_0.vbs",
"C:\\WINDOWS\\System32\\WScript.exe \"M:\\DOH\\Data Exchange\\OCFS\\Severe Maternal Morbidity\\EGScript1.vbs\" ",
"cscript.exe //T:120 //U //Nologo \"C:\\Program Files (x86)\\Site24x7\\WinAgent\\monitoring\\conf\\scripts\\topprocess.vbs\" 2 ")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.metadata.target_address_name | wildcard |
| field:"process.Ext.api.metadata.target_address_name" kind:wildcard value:"?*" |
process.Ext.api.name | wildcard |
| field:"process.Ext.api.name" kind:wildcard |
process.Ext.api.parameters.protection | eq |
| field:"process.Ext.api.parameters.protection" kind:eq value:"RWX" |
process.Ext.api.parameters.size | ne |
| field:"process.Ext.api.parameters.size" kind:ne value:"296" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.thread.Ext.call_stack_final_user_module.name | in |
| field:"process.thread.Ext.call_stack_final_user_module.name" kind:in |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | starts_with | cscript //B scan.wsf | excludes:process.command_line field:"process.command_line" value:"cscript //B scan.wsf " |
process.executable | eq | C:\Windows\SysWOW64\cscript.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\cscript.exe" |
process.parent.executable | eq | C:\Windows\SysWOW64\cmd.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\SysWOW64\cmd.exe" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
process.executable | eq | C:\Windows\System32\mmc.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\mmc.exe" |
process.thread.Ext.call_stack_summary | wildcard | ntdll.dll|*|mswb7.dll|clr.dll|jscript.dll|mmcndmgr.dll|mmc.exe* | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|*|mswb7.dll|clr.dll|jscript.dll|mmcndmgr.dll|mmc.exe*" |
process.Ext.api.metadata.target_address_name | in | clr.dll, gdi32full.dll | excludes:process.Ext.api.metadata.target_address_name field:"process.Ext.api.metadata.target_address_name" value:"clr.dll" field:"process.Ext.api.metadata.target_address_name" value:"gdi32full.dll" |
process.command_line | eq | "C:\Windows\System32\cscript.exe" //B //Nologo C:\Windows\Options\SWD\MapHomeDrive_1_0_0.vbs, C:\WINDOWS\System32\WScript.exe "M:\DOH\Data Exchange\OCFS\Severe Maternal Morbidity\EGScript1.vbs" , cscript.exe //T:120 //U //Nologo "C:\Program Files (x86)\Site24x7\WinAgent\monitoring\conf\scripts\topprocess.vbs" 2 | excludes:process.command_line |
process.parent.executable | eq | ?:\IPeople\Script\IPScriptDirector.exe, ?:\Program Files\Microsoft System Center\Operations Manager\Server\MonitoringHost.exe, ?:\Program Files\Microsoft System Center\Operations Manager\Server\MonitoringHost.exe, C:\Program Files (x86)\DarkWebAdvisorsAgent\PCPitstopScheduleService.exe, C:\Program Files (x86)\TelesystemAgent\PCPitstopScheduleService.exe | excludes:process.parent.executable |
Suspicious Curl File Download from Raw IP
#Detects when Curl makes an outbound network connection to a raw IP address in order to download a script (shell, apple, or python) or unsigned/untrusted binary. Many different types of malware use this in order to download additional payloads to a victim system.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| macOS | ESF event write (NOTIFY): Fires after a process writes data to a file. |
Rule Body
[rule]
description = """
Detects when Curl makes an outbound network connection to a raw IP address in order to download a script (shell, apple,
or python) or unsigned/untrusted binary. Many different types of malware use this in order to download additional
payloads to a victim system.
"""
id = "19606783-671d-46cb-8a19-b96f96bf596a"
license = "Elastic License v2"
name = "Suspicious Curl File Download from Raw IP"
os_list = ["macos"]
version = "1.0.5"
query = '''
sequence by process.entity_id with maxspan=1m
[network where event.type == "start" and process.name in ("curl", "nscurl") and destination.domain == null and
not cidrmatch(destination.ip,
"240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15",
"192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
"100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
"::1", "FE80::/10", "FF00::/8")]
[file where event.action == "modification" and file.extension in ("sh", "py", "scpt") and
not Effective_process.executable like "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon"]
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: network
[network where event.type == "start" and process.name in ("curl", "nscurl") and destination.domain == null and
not cidrmatch(destination.ip,
"240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15",
"192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
"100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
"::1", "FE80::/10", "FF00::/8")]
Stage 2: file
[file where event.action == "modification" and file.extension in ("sh", "py", "scpt") and
not Effective_process.executable like "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.domain | is_null | field:"DestinationHostname" kind:is_null | |
event.action | eq |
| field:"EventType" kind:eq value:"modification" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.extension | in |
| field:"file.extension" kind:in |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.ip | cidr_match | 240.0.0.0/4, 233.252.0.0/24, 224.0.0.0/4, 198.19.0.0/16, 192.18.0.0/15, 192.0.0.0/24, 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, ::1, FE80::/10, FF00::/8 | excludes:destination.ip |
Effective_process.executable | eq | /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon | excludes:Effective_process.executable field:"Effective_process.executable" value:"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon" |
Suspicious Execution via Compiled HTML File
#Identifies when the Microsoft HTML Help Executable (hh.exe) spawn a suspicious child process or open a compiled HTM file from a suspicious location. Adversaries may conceal malicious code in a CHM file and deliver it to a victim for execution.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth |
Rule Body
[rule]
description = """
Identifies when the Microsoft HTML Help Executable (hh.exe) spawn a suspicious child process or open a compiled HTM file
from a suspicious location. Adversaries may conceal malicious code in a CHM file and deliver it to a victim for
execution.
"""
id = "e2554e2b-7333-4379-88af-67e5bfac677a"
license = "Elastic License v2"
name = "Suspicious Execution via Compiled HTML File"
os_list = ["windows"]
reference = [
"https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-backdoors-old-and-new/",
]
version = "1.0.25"
query = '''
process where event.action == "start" and
(
(process.parent.executable : "?:\\Windows\\hh.exe" and
process.name : ("cmd.exe",
"powershell.exe",
"MSHTA.EXE",
"CertUtil.exe",
"CertReq.exe",
"rundll32.exe",
"regsvr32.exe",
"MSbuild.exe",
"cscript.exe",
"wscript.exe",
"installutil.exe",
"schtasks.exe",
"msiexec.exe")) or
(process.parent.executable : "?:\\Windows\\hh.exe" and (process.code_signature.trusted == false or process.code_signature.exists == false))
)
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.001"
name = "Compiled HTML File"
reference = "https://attack.mitre.org/techniques/T1218/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
(
(process.parent.executable : "?:\\Windows\\hh.exe" and
process.name : ("cmd.exe",
"powershell.exe",
"MSHTA.EXE",
"CertUtil.exe",
"CertReq.exe",
"rundll32.exe",
"regsvr32.exe",
"MSbuild.exe",
"cscript.exe",
"wscript.exe",
"installutil.exe",
"schtasks.exe",
"msiexec.exe")) or
(process.parent.executable : "?:\\Windows\\hh.exe" and (process.code_signature.trusted == false or process.code_signature.exists == false))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard value:"?:\Windows\hh.exe" |
Suspicious PowerShell Engine ImageLoad
#Identifies the PowerShell engine being invoked by unexpected processes. Rather than executing PowerShell functionality with powershell.exe, some attackers do this to operate more stealthily.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[metadata]
creation_date = "2020/11/17"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies the PowerShell engine being invoked by unexpected processes. Rather than executing PowerShell functionality
with powershell.exe, some attackers do this to operate more stealthily.
"""
from = "now-9m"
index = ["logs-endpoint.events.library-*"]
language = "kuery"
license = "Elastic License v2"
name = "Suspicious PowerShell Engine ImageLoad"
note = """## Triage and analysis
### Investigating Suspicious PowerShell Engine ImageLoad
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 use PowerShell without having to execute `PowerShell.exe` directly. This technique, often called "PowerShell without PowerShell," works by using the underlying System.Management.Automation namespace and can bypass application allowlisting and PowerShell security features.
#### 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 abnormal behaviors observed by the subject process, such as network connections, registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
- Retrieve the implementation (DLL, executable, etc.) and determine if it is malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Use the PowerShell `Get-FileHash` cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
### False positive analysis
- This activity can happen legitimately. Some vendors have their own PowerShell implementations that are shipped with some products. These benign true positives (B-TPs) can be added as exceptions if necessary after analysis.
### 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.
- 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).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
"""
references = ["https://www.elastic.co/security-labs/elastic-security-labs-steps-through-the-r77-rootkit"]
risk_score = 47
rule_id = "852c1f19-68e8-43a6-9dce-340771fe1be3"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type:windows and event.category:library and
dll.name:("System.Management.Automation.dll" or "System.Management.Automation.ni.dll") and
not (
process.code_signature.subject_name:(
"Microsoft Corporation" or
"Microsoft Dynamic Code Publisher" or
"Microsoft Windows"
) and process.code_signature.trusted:true and not process.name.caseless:"regsvr32.exe"
) and
not (
process.executable:(C\:\\Program*Files*\(x86\)\\*.exe or C\:\\Program*Files\\*.exe) and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\Windows\\Lenovo\\*.exe and process.code_signature.subject_name:"Lenovo" and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\Windows\\AdminArsenal\\PDQInventory-Scanner\\service-*\\exec\\PDQInventoryScanner.exe and
process.code_signature.subject_name:"PDQ.com Corporation" and
process.code_signature.trusted:true
) and
not (
process.name: (_is*.exe or "DellInstaller_x64.exe") and
process.code_signature.subject_name:("Dell Technologies Inc." or "Dell Inc" or "Dell Inc.") and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\ProgramData\\chocolatey\\* and
process.code_signature.subject_name:("Chocolatey Software, Inc." or "Chocolatey Software, Inc") and
process.code_signature.trusted:true
) and
not (
process.name: "Docker Desktop Installer.exe" and
process.code_signature.subject_name:"Docker Inc" and
process.code_signature.trusted:true
) and
not process.executable : (
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" or
"C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe"
)
'''
[[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/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
host.os.type:windows and event.category:library and
dll.name:("System.Management.Automation.dll" or "System.Management.Automation.ni.dll") and
not (
process.code_signature.subject_name:(
"Microsoft Corporation" or
"Microsoft Dynamic Code Publisher" or
"Microsoft Windows"
) and process.code_signature.trusted:true and not process.name.caseless:"regsvr32.exe"
) and
not (
process.executable:(C\:\\Program*Files*\(x86\)\\*.exe or C\:\\Program*Files\\*.exe) and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\Windows\\Lenovo\\*.exe and process.code_signature.subject_name:"Lenovo" and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\Windows\\AdminArsenal\\PDQInventory-Scanner\\service-*\\exec\\PDQInventoryScanner.exe and
process.code_signature.subject_name:"PDQ.com Corporation" and
process.code_signature.trusted:true
) and
not (
process.name: (_is*.exe or "DellInstaller_x64.exe") and
process.code_signature.subject_name:("Dell Technologies Inc." or "Dell Inc" or "Dell Inc.") and
process.code_signature.trusted:true
) and
not (
process.executable: C\:\\ProgramData\\chocolatey\\* and
process.code_signature.subject_name:("Chocolatey Software, Inc." or "Chocolatey Software, Inc") and
process.code_signature.trusted:true
) and
not (
process.name: "Docker Desktop Installer.exe" and
process.code_signature.subject_name:"Docker Inc" and
process.code_signature.trusted:true
) and
not process.executable : (
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" or
"C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.name | in |
| field:"dll.name" kind:in |
event.category | eq |
| field:"event.category" kind:eq value:"library" |
process.name.caseless | eq |
| field:"process.name.caseless" kind:eq value:"regsvr32.exe" |
Exclusions
The rule actively suppresses these predicates.
Suspicious Shell Command Execution via Node.js Parent
#This rule detects when a shell command is executed as a child process of a Node.js process. Attackers may use Node.js to run shell commands for various malicious purposes, such as downloading and executing payloads, establishing persistence, or exfiltrating data.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
This rule detects when a shell command is executed as a child process of a Node.js process. Attackers may use Node.js to
run shell commands for various malicious purposes, such as downloading and executing payloads, establishing persistence,
or exfiltrating data.
"""
id = "5f6dbe52-6643-486f-9130-256f58ba9a0c"
license = "Elastic License v2"
name = "Suspicious Shell Command Execution via Node.js Parent"
os_list = ["linux"]
version = "1.0.11"
query = '''
process where event.type == "start" and event.action == "exec" and
process.parent.executable in ("/bin/node", "/usr/bin/node", "/usr/local/bin/node") and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args == "-c" and (
(process.command_line like "*echo *" and process.command_line like (
"*./.*", "*http://*", "*https://*", "*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*",
"*import*subprocess*call*", "*TCPSocket.new*", "*TCPSocket.open*", "*io.popen*", "*os.execute*",
"*fsockopen*", "*disown*", "*wget*", "*curl*"
)
) or
(
process.command_line like (
"*/etc/cron*", "*/etc/rc.local*", "*/dev/tcp/*", "*/etc/init.d*", "*/etc/update-motd.d*",
"*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", "*base32 *", "*base16 *", "*/etc/profile.d/*",
"*/dev/shm/*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*" , "*~/.ssh/*", "*autostart*",
"*xxd *", "*/etc/shadow*", "*/var/tmp/*"
)
) or
(process.command_line regex~ """.*http?://[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.*""")
) and
not (
process.executable like "/tmp/newroot/*" or
process.command_line like (
"*169.254.169.254*", "*localhost*", "*127.0.0.1*", "*SNAPSHOT_FILE=*", "*/tmp/claude-shell-snapshot*",
"/home/*/.openclaw/*", "/api.notion.com/*", "/shubble.git/*"
) or
process.args like ("-l SNAPSHOT_FILE*", "-l source*", "NODE_TLS_REJECT_UNAUTHORIZED=0*", "*.claude/*", "ssh-keyscan*", "supergateway --sse*") or
(
process.command_line like "/bin/sh -c rm -rf /dev/shm/streams/*" and
process.parent.args == "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js"
) or
process.parent.args like ("/home/*/openclaw/*", "openclaw-gateway", "/opt/cursor-agent/node", "/usr/lib/node_modules/openclaw/dist/index.js", "/usr/local/bin/gemini") or
process.parent.command_line like ("*@playwright/cli*", "*playwright-cli*") or
process.command_line in (
"""/bin/sh -c echo BROWSER=none > .env && echo DEMO=true >> .env && echo PORT=3000 >> .env && printf "PUBLIC_URL=http://$(hostname -I | awk '{print $1}'):3000/\n" >> .env && echo WDS_SOCKET_PORT=3000 >> .env && printf "WDS_SOCKET_HOST=$(hostname -I | awk '{print $1}')\n" >> .env && echo JSX_IMPORT_SOURCE=@ac/library-utils/dist/web-components/wc-jsx >> .env""",
"/bin/sh -c chmod +x /etc/init.d/pm2-docker-deployer", """/bin/sh -c grep "^#[ ]*Port[ ]*[0-9]*" /etc/ssh/sshd_config 2>/dev/null"""
) or
(process.command_line like "*shubblecompose-app*" and process.parent.command_line == "node -r dotenv/config dist/server.mjs")
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.parent.executable in ("/bin/node", "/usr/bin/node", "/usr/local/bin/node") and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args == "-c" and (
(process.command_line like "*echo *" and process.command_line like (
"*./.*", "*http://*", "*https://*", "*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*",
"*import*subprocess*call*", "*TCPSocket.new*", "*TCPSocket.open*", "*io.popen*", "*os.execute*",
"*fsockopen*", "*disown*", "*wget*", "*curl*"
)
) or
(
process.command_line like (
"*/etc/cron*", "*/etc/rc.local*", "*/dev/tcp/*", "*/etc/init.d*", "*/etc/update-motd.d*",
"*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", "*base32 *", "*base16 *", "*/etc/profile.d/*",
"*/dev/shm/*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*" , "*~/.ssh/*", "*autostart*",
"*xxd *", "*/etc/shadow*", "*/var/tmp/*"
)
) or
(process.command_line regex~ """.*http?://[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.*""")
) and
not (
process.executable like "/tmp/newroot/*" or
process.command_line like (
"*169.254.169.254*", "*localhost*", "*127.0.0.1*", "*SNAPSHOT_FILE=*", "*/tmp/claude-shell-snapshot*",
"/home/*/.openclaw/*", "/api.notion.com/*", "/shubble.git/*"
) or
process.args like ("-l SNAPSHOT_FILE*", "-l source*", "NODE_TLS_REJECT_UNAUTHORIZED=0*", "*.claude/*", "ssh-keyscan*", "supergateway --sse*") or
(
process.command_line like "/bin/sh -c rm -rf /dev/shm/streams/*" and
process.parent.args == "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js"
) or
process.parent.args like ("/home/*/openclaw/*", "openclaw-gateway", "/opt/cursor-agent/node", "/usr/lib/node_modules/openclaw/dist/index.js", "/usr/local/bin/gemini") or
process.parent.command_line like ("*@playwright/cli*", "*playwright-cli*") or
process.command_line in (
"""/bin/sh -c echo BROWSER=none > .env && echo DEMO=true >> .env && echo PORT=3000 >> .env && printf "PUBLIC_URL=http:
"/bin/sh -c chmod +x /etc/init.d/pm2-docker-deployer", """/bin/sh -c grep "^#[ ]*Port[ ]*[0-9]*" /etc/ssh/sshd_config 2>/dev/null"""
) or
(process.command_line like "*shubblecompose-app*" and process.parent.command_line == "node -r dotenv/config dist/server.mjs")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.command_line | regex_match |
| field:"CommandLine" kind:regex_match value:".*http?://[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.*" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
process.parent.executable | in |
| field:"ParentImage" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | match | shubblecompose-app | excludes:process.command_line field:"process.command_line" value:"shubblecompose-app" |
process.parent.command_line | eq | node -r dotenv/config dist/server.mjs | excludes:process.parent.command_line field:"process.parent.command_line" value:"node -r dotenv/config dist/server.mjs" |
process.command_line | starts_with | /bin/sh -c rm -rf /dev/shm/streams/ | excludes:process.command_line field:"process.command_line" value:"/bin/sh -c rm -rf /dev/shm/streams/" |
process.parent.args | eq | /usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js | excludes:process.parent.args field:"process.parent.args" value:"/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js" |
process.args | wildcard | -l SNAPSHOT_FILE*, -l source*, NODE_TLS_REJECT_UNAUTHORIZED=0*, *.claude/*, ssh-keyscan*, supergateway --sse* | excludes:process.args |
process.command_line | in | /bin/sh -c chmod +x /etc/init.d/pm2-docker-deployer, /bin/sh -c echo BROWSER=none > .env && echo DEMO=true >> .env && echo PORT=3000 >> .env && printf "PUBLIC_URL=http://$(hostname -I | awk '{print $1}'):3000/\n" >> .env && echo WDS_SOCKET_PORT=3000 >> .env && printf "WDS_SOCKET_HOST=$(hostname -I | awk '{print $1}')\n" >> .env && echo JSX_IMPORT_SOURCE=@ac/library-utils/dist/web-components/wc-jsx >> .env, /bin/sh -c grep "^#[ ]*Port[ ]*[0-9]*" /etc/ssh/sshd_config 2>/dev/null | excludes:process.command_line |
process.command_line | wildcard | *169.254.169.254*, *localhost*, *127.0.0.1*, *SNAPSHOT_FILE=*, */tmp/claude-shell-snapshot*, /home/*/.openclaw/*, /api.notion.com/*, /shubble.git/* | excludes:process.command_line |
process.executable | starts_with | /tmp/newroot/ | excludes:process.executable field:"process.executable" value:"/tmp/newroot/" |
process.parent.args | wildcard | /home/*/openclaw/*, openclaw-gateway, /opt/cursor-agent/node, /usr/lib/node_modules/openclaw/dist/index.js, /usr/local/bin/gemini | excludes:process.parent.args |
process.parent.command_line | match | @playwright/cli, playwright-cli | excludes:process.parent.command_line field:"process.parent.command_line" value:"@playwright/cli" field:"process.parent.command_line" value:"playwright-cli" |
Suspicious SolarWinds Child Process
#A suspicious SolarWinds child process was detected, which may indicate an attempt to execute malicious programs.
Known False Positives
- Trusted SolarWinds child processes, verify process details such as network connections and file writes.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2020/12/14"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = "A suspicious SolarWinds child process was detected, which may indicate an attempt to execute malicious programs."
false_positives = [
"Trusted SolarWinds child processes, verify process details such as network connections and file writes.",
]
from = "now-9m"
index = ["logs-endpoint.events.process-*", "endgame-*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious SolarWinds Child Process"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Suspicious SolarWinds Child Process
SolarWinds is a widely used IT management software that operates critical network and system monitoring functions. Adversaries may exploit its trusted processes to execute unauthorized programs, leveraging its elevated privileges to bypass security controls. The detection rule identifies unusual child processes spawned by SolarWinds' core services, excluding known legitimate operations, to flag potential malicious activity.
### Possible investigation steps
- Review the details of the triggered alert to identify the specific child process name and executable path that caused the alert.
- Check the parent process details, specifically SolarWinds.BusinessLayerHost.exe or SolarWinds.BusinessLayerHostx64.exe, to confirm its legitimacy and ensure it is running from the expected directory.
- Investigate the child process's code signature to determine if it is trusted or if there are any anomalies in the signature that could indicate tampering.
- Analyze the historical activity of the suspicious child process on the host to identify any patterns or previous instances of execution that could provide context.
- Correlate the suspicious process activity with other security events or logs from the same host to identify any related malicious behavior or indicators of compromise.
- Consult threat intelligence sources to determine if the suspicious process or executable path is associated with known malware or adversary techniques.
### False positive analysis
- Legitimate SolarWinds updates or patches may trigger the rule. Ensure that the process code signature is verified as trusted and matches known update signatures.
- Custom scripts or tools integrated with SolarWinds for automation purposes might be flagged. Review these processes and add them to the exclusion list if they are verified as safe and necessary for operations.
- Third-party plugins or extensions that interact with SolarWinds could be misidentified. Validate these plugins and consider excluding them if they are from a trusted source and essential for functionality.
- Scheduled tasks or maintenance activities that involve SolarWinds processes may appear suspicious. Confirm these tasks are part of regular operations and exclude them if they are consistent with expected behavior.
- Temporary diagnostic or troubleshooting tools used by IT staff might be detected. Ensure these tools are authorized and add them to the exclusion list if they are frequently used and pose no threat.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement by the adversary.
- Terminate any suspicious child processes identified that are not part of the known legitimate operations list, ensuring that no malicious programs continue to execute.
- Conduct a thorough review of the affected system's recent activity logs to identify any additional indicators of compromise or unauthorized changes.
- Restore the affected system from a known good backup to ensure that any potential malware or unauthorized changes are removed.
- Update all SolarWinds software and related components to the latest versions to patch any known vulnerabilities that could be exploited.
- Implement enhanced monitoring on the affected system and similar environments to detect any recurrence of suspicious activity, focusing on unusual child processes spawned by SolarWinds services.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if broader organizational impacts need to be addressed."""
references = [
"https://www.fireeye.com/blog/threat-research/2020/12/evasive-attacker-leverages-solarwinds-supply-chain-compromises-with-sunburst-backdoor.html",
"https://github.com/mandiant/sunburst_countermeasures/blob/main/rules/SUNBURST/hxioc/SUNBURST%20SUSPICIOUS%20CHILD%20PROCESSES%20(METHODOLOGY).ioc",
]
risk_score = 47
rule_id = "93b22c0a-06a0-4131-b830-b10d5e166ff4"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.parent.name: ("SolarWinds.BusinessLayerHost.exe", "SolarWinds.BusinessLayerHostx64.exe") and
not (
process.name : (
"APMServiceControl*.exe",
"ExportToPDFCmd*.Exe",
"SolarWinds.Credentials.Orion.WebApi*.exe",
"SolarWinds.Orion.Topology.Calculator*.exe",
"Database-Maint.exe",
"SolarWinds.Orion.ApiPoller.Service.exe",
"WerFault.exe",
"WerMgr.exe",
"SolarWinds.BusinessLayerHost.exe",
"SolarWinds.BusinessLayerHostx64.exe",
"SolarWinds.Topology.Calculator.exe",
"SolarWinds.Topology.Calculatorx64.exe",
"SolarWinds.APM.RealTimeProcessPoller.exe") and
process.code_signature.trusted == true
) and
not process.executable : ("?:\\Windows\\SysWOW64\\ARP.EXE", "?:\\Windows\\SysWOW64\\lodctr.exe", "?:\\Windows\\SysWOW64\\unlodctr.exe")
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.parent.name: ("SolarWinds.BusinessLayerHost.exe", "SolarWinds.BusinessLayerHostx64.exe") and
not (
process.name : (
"APMServiceControl*.exe",
"ExportToPDFCmd*.Exe",
"SolarWinds.Credentials.Orion.WebApi*.exe",
"SolarWinds.Orion.Topology.Calculator*.exe",
"Database-Maint.exe",
"SolarWinds.Orion.ApiPoller.Service.exe",
"WerFault.exe",
"WerMgr.exe",
"SolarWinds.BusinessLayerHost.exe",
"SolarWinds.BusinessLayerHostx64.exe",
"SolarWinds.Topology.Calculator.exe",
"SolarWinds.Topology.Calculatorx64.exe",
"SolarWinds.APM.RealTimeProcessPoller.exe") and
process.code_signature.trusted == true
) and
not process.executable : ("?:\\Windows\\SysWOW64\\ARP.EXE", "?:\\Windows\\SysWOW64\\lodctr.exe", "?:\\Windows\\SysWOW64\\unlodctr.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.name | wildcard | APMServiceControl*.exe, ExportToPDFCmd*.Exe, SolarWinds.Credentials.Orion.WebApi*.exe, SolarWinds.Orion.Topology.Calculator*.exe, Database-Maint.exe, SolarWinds.Orion.ApiPoller.Service.exe, WerFault.exe, WerMgr.exe, SolarWinds.BusinessLayerHost.exe, SolarWinds.BusinessLayerHostx64.exe, SolarWinds.Topology.Calculator.exe, SolarWinds.Topology.Calculatorx64.exe, SolarWinds.APM.RealTimeProcessPoller.exe | excludes:process.name |
process.executable | eq | ?:\Windows\SysWOW64\ARP.EXE, ?:\Windows\SysWOW64\lodctr.exe, ?:\Windows\SysWOW64\unlodctr.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\SysWOW64\ARP.EXE" field:"process.executable" value:"?:\Windows\SysWOW64\lodctr.exe" field:"process.executable" value:"?:\Windows\SysWOW64\unlodctr.exe" |
Telegram Data Accessed by Osascript
#Identifies the Osascript process accessing Telegram data. Adversaries can steal Telegram files that will allow them access to sensitive data or the ability to login and spy on the user.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| macOS | ESF event open (NOTIFY): Fires after the kernel grants a process access to open a file. |
Rule Body
[rule]
description = """
Identifies the Osascript process accessing Telegram data. Adversaries can steal Telegram files that will allow them
access to sensitive data or the ability to login and spy on the user.
"""
id = "b11b4670-7368-4269-b199-8c90ed8db511"
license = "Elastic License v2"
name = "Telegram Data Accessed by Osascript"
os_list = ["macos"]
version = "1.0.5"
query = '''
file where event.action == "open" and
file.path like~ "/Users/*/Library/Application Support/Telegram Desktop/tdata/*" and
process.name == "osascript"
'''
min_endpoint_version = "8.11.1"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.executable"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "8.11.1"
Stages and Predicates
Stage 1: file
file where event.action == "open" and
file.path like~ "/Users/*/Library/Application Support/Telegram Desktop/tdata/*" and
process.name == "osascript"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"open" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"/Users/*/Library/Application Support/Telegram Desktop/tdata/*" |
process.name | eq |
| field:"process_basename" kind:eq value:"osascript" |