Detection rules › Elastic
Elastic rules: 2v
Arbitrary Python Code Execution via Nodejs
#Detects the execution of arbitrary Python code via Nodejs.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[rule]
description = "Detects the execution of arbitrary Python code via Nodejs."
id = "f8ec483c-dc3b-4d60-b863-65f61b4d382e"
license = "Elastic License v2"
name = "Arbitrary Python Code Execution via Nodejs"
os_list = ["macos"]
reference = ["https://jp.security.ntt/tech_blog/contagious-interview-ottercookie"]
version = "1.0.5"
query = '''
process where event.type == "start" and event.action == "exec" and process.name like~ "python*" and process.args == "-c" and
(process.parent.name == "node" or process.Ext.effective_parent.name == "node") and
process.command_line : ("*os.system*", "*subprocess.run*", "*subprocess.Popen*", "*exec(*", "*eval(*")
'''
min_endpoint_version = "8.10.2"
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.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name like~ "python*" and process.args == "-c" and
(process.parent.name == "node" or process.Ext.effective_parent.name == "node") and
process.command_line : ("*os.system*", "*subprocess.run*", "*subprocess.Popen*", "*exec(*", "*eval(*")
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.Ext.effective_parent.name | eq |
| field:"process.Ext.effective_parent.name" kind:eq value:"node" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"python*" |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"node" |
AWS EC2 Full Network Packet Capture Detected
#Detects successful creation of an Amazon EC2 Traffic Mirroring session. A session copies full packets from a source Elastic Network Interface (ENI) to a mirror target (e.g., an ENI or NLB) using a mirror filter (ingress/egress rules). While used for diagnostics and NDR/IDS tooling, adversaries can abuse sessions to covertly capture and exfiltrate sensitive, potentially unencrypted, traffic from instances or subnets.
Known False Positives
- Traffic Mirroring may be done by a system or network administrator. Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Traffic Mirroring from unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Discovery | |
| Collection | |
| Exfiltration |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS EC2 Traffic Mirroring (Panther)
Rule Body
[metadata]
creation_date = "2021/05/05"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic", "Austin Songer"]
description = """
Detects successful creation of an Amazon EC2 Traffic Mirroring session. A session copies full packets from a source
Elastic Network Interface (ENI) to a mirror target (e.g., an ENI or NLB) using a mirror filter (ingress/egress rules).
While used for diagnostics and NDR/IDS tooling, adversaries can abuse sessions to covertly capture and exfiltrate
sensitive, potentially unencrypted, traffic from instances or subnets.
"""
false_positives = [
"""
Traffic Mirroring may be done by a system or network administrator. Verify whether the user identity, user agent,
and/or hostname should be making changes in your environment. Traffic Mirroring from unfamiliar users or hosts
should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EC2 Full Network Packet Capture Detected"
note = """## Triage and analysis
### Investigating AWS EC2 Full Network Packet Capture Detected
This alert fires on a successful `CreateTrafficMirrorSession`, which enables full-packet Traffic Mirroring from a
source ENI to a mirror target under a given filter. Because sessions immediately begin sending packets once active,
treat unexpected creations as high priority.
#### Possible investigation steps
**Identify the actor and execution context**
- **Principal**: Review `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.type`, and
`aws.cloudtrail.user_identity.access_key_id` to determine who created the session (human IAM user vs. assumed role vs. automation).
- **Caller metadata**: Check `user_agent.original`, and `source.ip` for unusual tools, hosts, or locations.
- **Account/Region/Time**: Validate `cloud.account.id`, `cloud.region`, and `@timestamp` against change windows or tickets.
**Extract the session details from the event**
- **Request parameters**: Parse `aws.cloudtrail.request_parameters` for:
- `NetworkInterfaceId` (mirrored source ENI) map to the EC2 instance and its business function.
- `TrafficMirrorTargetId` identify where packets are being sent (ENI vs. NLB).
- `TrafficMirrorFilterId` check which directions and protocols are allowed (ingress/egress, ports).
- `SessionNumber`, `Description`, `TagSpecifications` look for operator tags or suspicious notes.
- **Response elements**: Use `aws.cloudtrail.response_elements` to confirm the created `TrafficMirrorSessionId` and
any resolved resource ARNs/IDs.
**Pivot for related API calls to validate scope and intent**
Look before and after this event (±30–60 minutes) by the same principal / access key / source IP for:
- **Target & Filter lifecycle**: `CreateTrafficMirrorTarget`, `CreateTrafficMirrorFilter`, `CreateTrafficMirrorFilterRule`,
`ModifyTrafficMirrorSession|Filter|FilterRule`, and `Delete*` calls (rapid create-modify patterns can indicate staging).
- **Session management**: `DeleteTrafficMirrorSession` shortly after creation (test/probe), or repeated creations to different targets.
- **Discovery/positioning**: `DescribeNetworkInterfaces`, `DescribeInstances`, `DescribeVpcs/Subnets/RouteTables` around the same time.
- **Cross-account indicators**: creation of targets that forward to infrastructure not owned by your account (e.g., NLB in shared services).
- **Other suspicious changes**: IAM permission changes, new access keys, or S3/SNS setup that could support exfil/ops.
**Validate the mirror destination and potential data exposure**
- If the target is an ENI: identify the owning instance/application; confirm it is an approved NDR/packet capture host.
- If the target is an NLB target: determine where the NLB sends traffic (could be a collection point in another VPC or account).
- Assess whether mirrored flows include plaintext protocols (internal HTTP, databases, LDAP, etc.) increasing sensitivity.
### False positive analysis
- **Authorized monitoring**: Approved NDR/IDS tooling or troubleshooting playbooks may legitimately create sessions.
- **Ops/diagnostics**: Short-lived sessions during incident handling or performance analysis.
- **Automation**: Infrastructure pipelines that stand up temporary mirroring for validation.
### Response and remediation
**Contain**
- If unauthorized, terminate the session immediately (use the `TrafficMirrorSessionId` from `aws.cloudtrail.response_elements`)
and block creation permissions for the offending principal.
- Quarantine or restrict egress from the target if you suspect it is forwarding captured traffic outside approved destinations.
**Investigate**
- Enumerate all active sessions in the affected account/region; verify there aren’t additional rogue sessions.
- Review related target and filter resources (and recent `Modify*` calls) to understand captured scope and recipients.
- Trace the source ENI back to the EC2 instance and validate whether sensitive workloads were mirrored.
**Recover & harden**
- Remove or lock down unapproved targets/filters; enforce least privilege on `ec2:CreateTrafficMirrorSession/Target/Filter`.
- Consider SCPs or IAM conditions limiting who/where sessions can be created (e.g., only into designated monitoring VPCs).
- Ensure monitoring targets are controlled, logged, and not internet-reachable.
**Improve**
- Add correlation logic to automatically surface CreateTrafficMirrorSession alongside Create/Modify Target/Filter calls by the same actor.
- Require tags on approved mirroring resources; alert on untagged/unticketed creations.
- Update playbooks to include a standard validation checklist (principal, source ENI, target, filter rules, destination path).
"""
references = [
"https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TrafficMirrorSession.html",
"https://rhinosecuritylabs.com/aws/abusing-vpc-traffic-mirroring-in-aws/",
]
risk_score = 47
rule_id = "c1812764-0788-470f-8e74-eb4a14d47573"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS EC2",
"Use Case: Network Security Monitoring",
"Tactic: Exfiltration",
"Tactic: Collection",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: "aws.cloudtrail" and
event.provider: "ec2.amazonaws.com" and
event.action: "CreateTrafficMirrorSession" and
event.outcome: "success"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1020"
name = "Automated Exfiltration"
reference = "https://attack.mitre.org/techniques/T1020/"
[[rule.threat.technique]]
id = "T1537"
name = "Transfer Data to Cloud Account"
reference = "https://attack.mitre.org/techniques/T1537/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1040"
name = "Network Sniffing"
reference = "https://attack.mitre.org/techniques/T1040/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1040"
name = "Network Sniffing"
reference = "https://attack.mitre.org/techniques/T1040/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
"aws.cloudtrail.response_elements",
]
Stages and Predicates
Stage 1: query
data_stream.dataset: "aws.cloudtrail" and
event.provider: "ec2.amazonaws.com" and
event.action: "CreateTrafficMirrorSession" and
event.outcome: "success"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | eq |
| field:"EventType" kind:eq value:"CreateTrafficMirrorSession" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"ec2.amazonaws.com" |
Background Process Execution via Shell
#Detects when a binary located in a suspicious location gets executed by a shell interpreter and put in the background via the & operator. Malwares may execute their payloads in the background in an effort to remain hidden.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when a binary located in a suspicious location gets executed by a shell interpreter and put in the background
via the & operator. Malwares may execute their payloads in the background in an effort to remain hidden.
"""
id = "603ac59e-9cca-4c48-9750-e38399079043"
license = "Elastic License v2"
name = "Background Process Execution via Shell"
os_list = ["macos"]
version = "1.0.19"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name like~ ("bash", "sh", "zsh", "tclsh*") and
process.args == "-c" and process.args like~ ("/* &", "/*&") and
process.args_count == 3 and
process.parent.executable like~
("/private/tmp/*",
"/var/tmp/*",
"/tmp/*",
"/var/folders/*",
"/Library/Containers/*",
"/Library/Graphics/*",
"/Users/Shared/*",
"/Users/*/Library/Preferences/*",
"/var/root/*",
"/Library/WebServer/*",
"/Library/Preferences/*",
"/Library/Services/*",
"/Library/Fonts/*",
"/usr/local/bin/*")
'''
min_endpoint_version = "8.10.2"
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/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.name like~ ("bash", "sh", "zsh", "tclsh*") and
process.args == "-c" and process.args like~ ("/* &", "/*&") and
process.args_count == 3 and
process.parent.executable like~
("/private/tmp/*",
"/var/tmp/*",
"/tmp/*",
"/var/folders/*",
"/Library/Containers/*",
"/Library/Graphics/*",
"/Users/Shared/*",
"/Users/*/Library/Preferences/*",
"/var/root/*",
"/Library/WebServer/*",
"/Library/Preferences/*",
"/Library/Services/*",
"/Library/Fonts/*",
"/usr/local/bin/*")
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.args | wildcard |
| field:"process.args" kind:wildcard |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"3" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
Chattr Execution from Unusual Parent
#This rule detects the execution of the "chattr" command from an unusual parent process. The "chattr" command is used to change file attributes, and is often used by attackers to hide files or directories or mark them as immutable and/or undeletable.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Rule Body
[rule]
description = """
This rule detects the execution of the "chattr" command from an unusual parent process. The "chattr" command is used to
change file attributes, and is often used by attackers to hide files or directories or mark them as immutable and/or
undeletable.
"""
id = "3f3e9299-1a05-4922-aef2-6d855a07f8ef"
license = "Elastic License v2"
name = "Chattr Execution from Unusual Parent"
os_list = ["linux"]
reference = [
"https://www.trendmicro.com/en_nl/research/22/i/how-malicious-actors-abuse-native-linux-tools-in-their-attacks.html",
]
version = "1.0.10"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "chattr" and
process.executable like ("/bin/chattr", "/usr/bin/chattr", "/usr/local/bin/chattr") and
(process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*") or process.parent.name like ".*") and
process.args like~ ("-*i*", "+*i*", "+*u*", "-*u*") and not (
process.parent.name == "." or
process.parent.executable like (
"./scannerYaraALFA*", "/tmp/newroot/lib/systemd/systemd", "./ldap2sshkeys", "/tmp/newroot/var/lib/docker/rootfs/overlayfs/*/entrypoint.sh",
"/tmp/newroot/opt/omnissa/*/bin/ws1HubUtil"
) or
process.parent.executable in ("/tmp/newroot/usr/bin/sudo", "/tmp/newroot/usr/bin/zsh") or
process.parent.args like "/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_file.py"
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1222"
name = "File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/"
[[threat.technique.subtechnique]]
id = "T1222.002"
name = "Linux and Mac File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/002/"
[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.type == "start" and event.action == "exec" and process.name == "chattr" and
process.executable like ("/bin/chattr", "/usr/bin/chattr", "/usr/local/bin/chattr") and
(process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*") or process.parent.name like ".*") and
process.args like~ ("-*i*", "+*i*", "+*u*", "-*u*") and not (
process.parent.name == "." or
process.parent.executable like (
"./scannerYaraALFA*", "/tmp/newroot/lib/systemd/systemd", "./ldap2sshkeys", "/tmp/newroot/var/lib/docker/rootfs/overlayfs/*/entrypoint.sh",
"/tmp/newroot/opt/omnissa/*/bin/ws1HubUtil"
) or
process.parent.executable in ("/tmp/newroot/usr/bin/sudo", "/tmp/newroot/usr/bin/zsh") or
process.parent.args like "/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_file.py"
)
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 | wildcard |
| field:"process.args" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"chattr" |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:".*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.args | wildcard | /root/.ansible/tmp/ansible-tmp-*/AnsiballZ_file.py | excludes:process.parent.args field:"process.parent.args" value:"/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_file.py" |
process.parent.executable | in | /tmp/newroot/usr/bin/sudo, /tmp/newroot/usr/bin/zsh | excludes:process.parent.executable field:"process.parent.executable" value:"/tmp/newroot/usr/bin/sudo" field:"process.parent.executable" value:"/tmp/newroot/usr/bin/zsh" |
process.parent.executable | wildcard | ./scannerYaraALFA*, /tmp/newroot/lib/systemd/systemd, ./ldap2sshkeys, /tmp/newroot/var/lib/docker/rootfs/overlayfs/*/entrypoint.sh, /tmp/newroot/opt/omnissa/*/bin/ws1HubUtil | excludes:process.parent.executable |
process.parent.name | eq | . | excludes:process.parent.name field:"process.parent.name" value:"." |
DPKG Package Installed by Unusual Parent Process
#This rule detects the installation of a Debian package (dpkg) by an unusual parent process. The dpkg command is used to install, remove, and manage Debian packages on a Linux system. Attackers can abuse the dpkg command to install malicious packages on a system.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Persistence | |
| Privilege Escalation | |
| Stealth |
Rule Body
[metadata]
creation_date = "2024/07/09"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule detects the installation of a Debian package (dpkg) by an unusual parent process. The dpkg command is used to
install, remove, and manage Debian packages on a Linux system. Attackers can abuse the dpkg command to install malicious
packages on a system.
"""
from = "now-9m"
index = ["logs-endpoint.events.*"]
language = "kuery"
license = "Elastic License v2"
name = "DPKG Package Installed by Unusual Parent 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 DPKG Package Installed by Unusual Parent Process
DPKG is a core utility for managing Debian packages on Linux systems, crucial for software installation and maintenance. Adversaries may exploit DPKG to install malicious packages, leveraging unusual parent processes to evade detection. The detection rule identifies such anomalies by monitoring DPKG executions initiated by atypical parent processes, signaling potential unauthorized package installations.
### Possible investigation steps
- Review the process tree to identify the parent process of the dpkg execution. Determine if the parent process is legitimate or unusual for package installations.
- Examine the command-line arguments used with the dpkg command, specifically looking for the "-i" or "--install" flags, to understand what package was being installed.
- Check the source and integrity of the package being installed to ensure it is from a trusted repository or source.
- Investigate the user account under which the dpkg command was executed to determine if it has the necessary permissions and if the activity aligns with the user's typical behavior.
- Correlate the event with other logs or alerts around the same timeframe to identify any related suspicious activities or patterns.
- Assess the system for any signs of compromise or unauthorized changes following the package installation.
### False positive analysis
- System updates or maintenance scripts may trigger the rule when legitimate administrative tools or scripts use dpkg to install updates. To handle this, identify and whitelist known maintenance scripts or processes that regularly perform package installations.
- Automated deployment tools like Ansible or Puppet might use dpkg for software deployment, leading to false positives. Exclude these tools by adding their process names to an exception list if they are part of your standard operations.
- Custom internal applications or scripts that manage software installations could also cause alerts. Review these applications and, if verified as safe, configure exceptions for their parent processes.
- Developers or system administrators using dpkg for testing or development purposes might inadvertently trigger the rule. Establish a policy for such activities and exclude known development environments or user accounts from triggering alerts.
- Backup or recovery operations that reinstall packages as part of their process can be mistaken for malicious activity. Identify these operations and exclude their associated processes from the rule.
### Response and remediation
- Isolate the affected system from the network to prevent further unauthorized package installations or lateral movement by the adversary.
- Terminate the dpkg process if it is still running to stop any ongoing malicious package installation.
- Identify and remove any suspicious or unauthorized packages installed by the dpkg command using the package management tools available on the system.
- Conduct a thorough review of the system's package installation logs and history to identify any other potentially malicious packages or unusual installation activities.
- Restore the system from a known good backup if malicious packages have altered critical system components or configurations.
- Implement stricter access controls and monitoring on systems to prevent unauthorized use of package management utilities by non-administrative users or processes.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected, ensuring a coordinated response to the threat."""
references = ["https://www.makeuseof.com/how-deb-packages-are-backdoored-how-to-detect-it/"]
risk_score = 21
rule_id = "f4d1c0ac-aedb-4063-9fa6-cc651eb5e6ee"
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 Linux 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, either "Traditional Endpoints" or "Cloud Workloads".
- 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/8.10/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 = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.name:dpkg and
process.args:("-i" or "--install")
'''
[[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]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.016"
name = "Installer Packages"
reference = "https://attack.mitre.org/techniques/T1546/016/"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.016"
name = "Installer Packages"
reference = "https://attack.mitre.org/techniques/T1546/016/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.parent.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.name:dpkg and
process.args:("-i" or "--install")
Indicators
These rows show field, operator, and value matches.
Execution from ZIP File via Explorer
#Identifies process execution from a ZIP file when handled via Explorer. Adversaries often leverage ZIP file to deliver malicious executables and scripts for initial access and execution.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies process execution from a ZIP file when handled via Explorer. Adversaries often leverage ZIP file to deliver
malicious executables and scripts for initial access and execution.
"""
id = "6631e7e4-ecca-4f34-88e1-b86a4ab711b1"
license = "Elastic License v2"
name = "Execution from ZIP File via Explorer"
os_list = ["windows"]
version = "1.0.11"
query = '''
process where event.action == "start" and
process.parent.name : "explorer.exe" and process.parent.thread.Ext.call_stack_summary : "*zipfldr.dll*" and
process.name : ("wscript.exe",
"cscript.exe",
"rundll32.exe",
"regsvr32.exe",
"cmstp.exe",
"RegAsm.exe",
"installutil.exe",
"mshta.exe",
"RegSvcs.exe",
"msbuild.exe",
"msxsl.exe",
"xwizard.exe",
"powershell.exe",
"AddInProcess.exe",
"AddInProcess32.exe",
"AddInUtil.exe",
"AppLaunch.exe",
"aspnet_compiler.exe") and
not (process.parent.name : "explorer.exe" and process.executable : "C:\\Windows\\SysWOW64\\mshta.exe") and
not (process.name : "rundll32.exe" and
process.args : ("cryptext.dll,CryptExt*",
"ImageView_Fullscreen",
"?:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication",
"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll,#1"))
'''
min_endpoint_version = "8.7.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.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[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.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.name : "explorer.exe" and process.parent.thread.Ext.call_stack_summary : "*zipfldr.dll*" and
process.name : ("wscript.exe",
"cscript.exe",
"rundll32.exe",
"regsvr32.exe",
"cmstp.exe",
"RegAsm.exe",
"installutil.exe",
"mshta.exe",
"RegSvcs.exe",
"msbuild.exe",
"msxsl.exe",
"xwizard.exe",
"powershell.exe",
"AddInProcess.exe",
"AddInProcess32.exe",
"AddInUtil.exe",
"AppLaunch.exe",
"aspnet_compiler.exe") and
not (process.parent.name : "explorer.exe" and process.executable : "C:\\Windows\\SysWOW64\\mshta.exe") and
not (process.name : "rundll32.exe" and
process.args : ("cryptext.dll,CryptExt*",
"ImageView_Fullscreen",
"?:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication",
"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll,#1"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"explorer.exe" |
process.parent.thread.Ext.call_stack_summary | wildcard |
| field:"process.parent.thread.Ext.call_stack_summary" kind:wildcard value:"*zipfldr.dll*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | cryptext.dll,CryptExt*, ImageView_Fullscreen, ?:\Windows\System32\dfshim.dll,ShOpenVerbApplication, C:\ProgramData\FastTrack Software\Admin By Request\ShellHelper32.dll,#1 | excludes:process.args |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.executable | eq | C:\Windows\SysWOW64\mshta.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\mshta.exe" |
process.parent.name | eq | explorer.exe | excludes:process.parent.name field:"process.parent.name" value:"explorer.exe" |
Execution of Commonly Abused Utilities via Explorer Trampoline
#Identifies the execution of commonly abused utilities to run DLLs or scripts via a separate Windows Explorer trampoline. Explorer can be abused to launch malicious scripts or executables from a trusted parent process.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies the execution of commonly abused utilities to run DLLs or scripts via a separate Windows Explorer trampoline.
Explorer can be abused to launch malicious scripts or executables from a trusted parent process.
"""
id = "5e8498bb-8cc0-412f-9017-793d94ab76a5"
license = "Elastic License v2"
name = "Execution of Commonly Abused Utilities via Explorer Trampoline"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/Binaries/Explorer/"]
version = "1.0.36"
query = '''
process where event.action == "start" and
(
process.name : ("cscript.exe", "wscript.exe", "rundll32.exe", "mshta.exe", "regsvr32.exe") or
process.pe.original_file_name :
("cscript.exe",
"wscript.exe",
"rundll32.exe",
"mshta.exe",
"regsvr32.exe")
) and
/* Explorer started via DCOM */
process.parent.name : "explorer.exe" and process.parent.command_line : "*/factory,{75dff2b7-6936-4c06-a8bb-676a7b00b24b}*" and
not
(
process.name : "rundll32.exe" and
process.args : ("rundll32.exe*\\Users\\*\\AppData\\Local\\Cognitas\\CrossLink6\\csathl32.dll*",
/* Issue #340 */
"*dfshim.dll*ShOpenVerbApplication*",
"dfshim.dll,",
"?:\\WINDOWS\\system32\\hotplug.dll,HotPlugSafeRemovalDriveNotification",
"cryptext.dll,CryptExtOpen*",
"cryptext.dll,CryptExtAddCER",
"ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile",
"shwebsvc.dll,AddNetPlaceRunDll",
"?:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll*",
"?:\\Windows\\system32\\hotplug.dll,HotPlugSafeRemovalDriveNotification",
"devmgr.dll,DeviceProperties_RunDLL",
"printui.dll,PrintUIEntryDPIAware",
"?:\\windows\\System32\\srchadmin.dll",
"fdprint,InvokeTask",
"cryptext.dll,CryptExtAddPFX",
"shell32.dll,SHCreateLocalServerRunDll",
"?:\\WINDOWS\\System32\\SHELL32.dll,RunAsNewUser_RunDLL",
"?:\\WINDOWS\\system32\\spool\\DRIVERS\\x64\\3\\*",
"C:\\Program Files (x86)\\Stardock\\Fences\\FencesMenu64.dll,StartFences",
"C:\\Windows\\System32\\*.cpl")
) and
not (process.name : ("wscript.exe", "cscript.exe") and
process.args : ("\\\\*.vbs", "C:\\Robocopy\\robocopy_Mail_Config_Veeam.vbs", "C:\\Users\\*\\Documents\\*.vbs", "X:\\*.vbs", "W:\\*.vbs"))
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[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.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[[threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"
[[threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"
[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.name : ("cscript.exe", "wscript.exe", "rundll32.exe", "mshta.exe", "regsvr32.exe") or
process.pe.original_file_name :
("cscript.exe",
"wscript.exe",
"rundll32.exe",
"mshta.exe",
"regsvr32.exe")
) and
process.parent.name : "explorer.exe" and process.parent.command_line : "*/factory,{75dff2b7-6936-4c06-a8bb-676a7b00b24b}*" and
not
(
process.name : "rundll32.exe" and
process.args : ("rundll32.exe*\\Users\\*\\AppData\\Local\\Cognitas\\CrossLink6\\csathl32.dll*",
"*dfshim.dll*ShOpenVerbApplication*",
"dfshim.dll,",
"?:\\WINDOWS\\system32\\hotplug.dll,HotPlugSafeRemovalDriveNotification",
"cryptext.dll,CryptExtOpen*",
"cryptext.dll,CryptExtAddCER",
"ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile",
"shwebsvc.dll,AddNetPlaceRunDll",
"?:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll*",
"?:\\Windows\\system32\\hotplug.dll,HotPlugSafeRemovalDriveNotification",
"devmgr.dll,DeviceProperties_RunDLL",
"printui.dll,PrintUIEntryDPIAware",
"?:\\windows\\System32\\srchadmin.dll",
"fdprint,InvokeTask",
"cryptext.dll,CryptExtAddPFX",
"shell32.dll,SHCreateLocalServerRunDll",
"?:\\WINDOWS\\System32\\SHELL32.dll,RunAsNewUser_RunDLL",
"?:\\WINDOWS\\system32\\spool\\DRIVERS\\x64\\3\\*",
"C:\\Program Files (x86)\\Stardock\\Fences\\FencesMenu64.dll,StartFences",
"C:\\Windows\\System32\\*.cpl")
) and
not (process.name : ("wscript.exe", "cscript.exe") and
process.args : ("\\\\*.vbs", "C:\\Robocopy\\robocopy_Mail_Config_Veeam.vbs", "C:\\Users\\*\\Documents\\*.vbs", "X:\\*.vbs", "W:\\*.vbs"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"*/factory,{75dff2b7-6936-4c06-a8bb-676a7b00b24b}*" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"explorer.exe" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | \\*.vbs, C:\Robocopy\robocopy_Mail_Config_Veeam.vbs, C:\Users\*\Documents\*.vbs, X:\*.vbs, W:\*.vbs | excludes:process.args |
process.name | eq | wscript.exe, cscript.exe | excludes:process.name field:"process.name" value:"wscript.exe" field:"process.name" value:"cscript.exe" |
process.args | wildcard | rundll32.exe*\Users\*\AppData\Local\Cognitas\CrossLink6\csathl32.dll*, *dfshim.dll*ShOpenVerbApplication*, dfshim.dll,, ?:\WINDOWS\system32\hotplug.dll,HotPlugSafeRemovalDriveNotification, cryptext.dll,CryptExtOpen*, cryptext.dll,CryptExtAddCER, ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile, shwebsvc.dll,AddNetPlaceRunDll, ?:\Program Files\Windows Photo Viewer\PhotoViewer.dll*, ?:\Windows\system32\hotplug.dll,HotPlugSafeRemovalDriveNotification, devmgr.dll,DeviceProperties_RunDLL, printui.dll,PrintUIEntryDPIAware, ?:\windows\System32\srchadmin.dll, fdprint,InvokeTask, cryptext.dll,CryptExtAddPFX, shell32.dll,SHCreateLocalServerRunDll, ?:\WINDOWS\System32\SHELL32.dll,RunAsNewUser_RunDLL, ?:\WINDOWS\system32\spool\DRIVERS\x64\3\*, C:\Program Files (x86)\Stardock\Fences\FencesMenu64.dll,StartFences, C:\Windows\System32\*.cpl | excludes:process.args |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
File Made Executable via Package Install Script
#Detects when a file in a suspicious file path is made executable via the chmod binary immediately after an installer pkg is executed via the postinstall script. This is not a common occurrence and indicates the installation of a malicious binary.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when a file in a suspicious file path is made executable via the chmod binary immediately after an installer pkg
is executed via the postinstall script. This is not a common occurrence and indicates the installation of a malicious
binary.
"""
id = "75f5d51a-218f-4d5b-80e5-eb74e498fde4"
license = "Elastic License v2"
name = "File Made Executable via Package Install Script"
os_list = ["macos"]
version = "1.0.27"
query = '''
sequence by process.parent.pid with maxspan=30s
[process where event.type == "start" and event.action == "fork" and
process.name like~ ("bash", "zsh", "sh", "python*", "tclsh*", "dash", "csh", "tcsh", "ksh", "fish") and
process.args like~ "/tmp/PKInstallSandbox.*/Scripts/*/postinstall" and
process.args like ("/Users/*", "/Volumes/*") and
not process.args like "/Applications/Adobe Acrobat DC"]
[process where event.type == "start" and event.action == "exec" and
process.name == "chmod" and
process.args in ("+x", "a+x", "0777", "777") and
process.args like~ ("/private/tmp/*",
"/var/tmp/*",
"/var/lib/*",
"/tmp/*",
"/var/folders/*",
"/Users/Shared/*",
"/Library/Containers/*",
"/Users/*/Library/*",
"/Users/*/Applications/*",
"/var/root/*",
"/Library/WebServer/*",
"/Library/Fonts/*",
"/usr/local/bin/*") and
process.parent.name like~ ("bash", "zsh", "sh", "python*", "tclsh*", "osascript", "dash", "csh", "tcsh", "ksh", "fish") and not
process.command_line == "chmod +x decompress"]
'''
min_endpoint_version = "8.11.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 = "T1222"
name = "File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/"
[[threat.technique.subtechnique]]
id = "T1222.002"
name = "Linux and Mac File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/002/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.parent.pid.
Stage 1: process
[process where event.type == "start" and event.action == "fork" and
process.name like~ ("bash", "zsh", "sh", "python*", "tclsh*", "dash", "csh", "tcsh", "ksh", "fish") and
process.args like~ "/tmp/PKInstallSandbox.*/Scripts/*/postinstall" and
process.args like ("/Users/*", "/Volumes/*") and
not process.args like "/Applications/Adobe Acrobat DC"]
Stage 2: process
[process where event.type == "start" and event.action == "exec" and
process.name == "chmod" and
process.args in ("+x", "a+x", "0777", "777") and
process.args like~ ("/private/tmp/*",
"/var/tmp/*",
"/var/lib/*",
"/tmp/*",
"/var/folders/*",
"/Users/Shared/*",
"/Library/Containers/*",
"/Users/*/Library/*",
"/Users/*/Applications/*",
"/var/root/*",
"/Library/WebServer/*",
"/Library/Fonts/*",
"/usr/local/bin/*") and
process.parent.name like~ ("bash", "zsh", "sh", "python*", "tclsh*", "osascript", "dash", "csh", "tcsh", "ksh", "fish") and not
process.command_line == "chmod +x decompress"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"chmod" |
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.args | eq | /Applications/Adobe Acrobat DC | excludes:process.args field:"process.args" value:"/Applications/Adobe Acrobat DC" |
process.command_line | eq | chmod +x decompress | excludes:process.command_line field:"process.command_line" value:"chmod +x decompress" |
InstallUtil Activity
#InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific installer components specified in .NET binaries. Adversaries may use InstallUtil to proxy the execution of code through a trusted Windows utility.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
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 = "2023/08/24"
integration = ["endpoint", "windows", "system"]
maturity = "production"
updated_date = "2025/03/20"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
InstallUtil is a command-line utility that allows for installation and uninstallation of resources by executing specific
installer components specified in .NET binaries. Adversaries may use InstallUtil to proxy the execution of code through
a trusted Windows utility.
"""
from = "now-119m"
index = [
"endgame-*",
"logs-endpoint.events.process-*",
"logs-system.security*",
"logs-windows.*",
"winlogbeat-*",
]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "InstallUtil Activity"
risk_score = 21
rule_id = "90babaa8-5216-4568-992d-d4a01a105d98"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Rule Type: BBR",
"Data Source: Elastic Endgame",
"Data Source: Windows Security Event Logs",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : "installutil.exe" and not user.id : "S-1-5-18"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.004"
name = "InstallUtil"
reference = "https://attack.mitre.org/techniques/T1218/004/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.name : "installutil.exe" and not user.id : "S-1-5-18"
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 | wildcard |
| field:"process_basename" kind:wildcard value:"installutil.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Multiple Elastic Defend Alerts by Agent
#This rule uses alert data to determine when multiple alerts from Elastic Defend involving the same host are triggered. Analysts can use this to prioritize triage and response, as these hosts are more likely to be compromised.
Rule Body
[metadata]
creation_date = "2025/11/19"
maturity = "production"
updated_date = "2025/11/19"
[rule]
author = ["Elastic"]
description = """
This rule uses alert data to determine when multiple alerts from Elastic Defend involving the same host are triggered.
Analysts can use this to prioritize triage and response, as these hosts are more likely to be compromised.
"""
from = "now-60m"
interval = "30m"
language = "esql"
license = "Elastic License v2"
name = "Multiple Elastic Defend Alerts by Agent"
risk_score = 73
rule_id = "ab25369e-ea5e-46f1-9cd5-478a0a4a131a"
severity = "high"
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide", "Data Source: Elastic Defend"]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-endpoint.alerts-* metadata _id
| eval target_time_window = DATE_TRUNC(24 hours, @timestamp)
| where event.code in ("malicious_file", "memory_signature", "shellcode_thread", "behavior") and
agent.id is not null and not rule.name in ("Multi.EICAR.Not-a-virus")
| stats Esql.alerts_count = COUNT(*),
Esql.event_code_distinct_count = count_distinct(event.code),
Esql.rule_name_distinct_count = COUNT_DISTINCT(rule.name),
Esql.file_hash_distinct_count = COUNT_DISTINCT(file.hash.sha256),
Esql.process_name_distinct_count = COUNT_DISTINCT(process.entity_id),
Esql.event_code_values = VALUES(event.code),
Esql.rule_name_values = VALUES(rule.name),
Esql.message_values = VALUES(message),
Esql.file_path_values = VALUES(file.path),
Esql.dll_path_values = VALUES(dll.path),
Esql.process_executable_values = VALUES(process.executable),
Esql.process_parent_executable_values = VALUES(process.parent.executable),
Esql.process_command_line_values = VALUES(process.command_line),
Esql.process_hash_sha256_values = VALUES(process.hash.sha256),
Esql.file_hash_sha256_values = VALUES(file.hash.sha256),
Esql.dll_hash_sha256_values = VALUES(dll.hash.sha256) by agent.id
| where (Esql.event_code_distinct_count >= 2 or Esql.rule_name_distinct_count >= 3 or Esql.file_hash_distinct_count >= 2)
| keep agent.id,
Esql.alerts_count,
Esql.event_code_distinct_count,
Esql.rule_name_distinct_count,
Esql.message_values,
Esql.event_code_values,
Esql.rule_name_values,
Esql.process_executable_values,
Esql.process_parent_executable_values,
Esql.process_command_line_values,
Esql.file_path_values,
Esql.dll_path_values,
Esql.process_hash_sha256_values,
Esql.file_hash_sha256_values,
Esql.dll_hash_sha256_values
'''
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 Multiple Elastic Defend Alerts by Agent
Endpoint security technologies monitor and analyze activities on devices to detect malicious behavior. Adversaries exploit these systems by deploying malware that triggers specific signatures across multiple hosts, indicating a coordinated attack. The detection rule identifies such threats by analyzing alert data for specific malware signatures across several hosts, flagging potential widespread infections for prioritized investigation.
### Possible investigation steps
- Review the alert details to identify the specific host involved and the different ATT&CK tactics that triggered the alerts.
- Examine the timeline of the alerts to understand the sequence of events and determine if there is a pattern or progression in the tactics used.
- Correlate the alert data with other logs and telemetry from the host, such as process creation, network connections, and file modifications, to gather additional context.
- Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary.
- Check for any indicators of compromise (IOCs) associated with the alerts, such as suspicious IP addresses, domains, or file hashes, and search for these across the network.
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
### False positive analysis
- Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance.
- Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise.
- Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening.
- Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score.
- User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities.
### Response and remediation
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
- Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved.
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
- Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks.
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
- Monitor the host and network for any signs of re-infection or further suspicious activity, using enhanced logging and alerting based on the identified attack patterns.
- Escalate the incident to the appropriate internal or external cybersecurity teams for further investigation and potential legal action if the attack is part of a larger campaign."""
references = ["https://github.com/elastic/protections-artifacts/tree/main/yara/rules"]
Stages and Predicates
Stage 1: from
from logs-endpoint.alerts-* metadata _id
Stage 2: eval
| eval target_time_window = DATE_TRUNC(24 hours, @timestamp)
Stage 3: where
| where event.code in ("malicious_file", "memory_signature", "shellcode_thread", "behavior") and
agent.id is not null and not rule.name in ("Multi.EICAR.Not-a-virus")
Stage 4: stats
| stats Esql.alerts_count = COUNT(*),
Esql.event_code_distinct_count = count_distinct(event.code),
Esql.rule_name_distinct_count = COUNT_DISTINCT(rule.name),
Esql.file_hash_distinct_count = COUNT_DISTINCT(file.hash.sha256),
Esql.process_name_distinct_count = COUNT_DISTINCT(process.entity_id),
Esql.event_code_values = VALUES(event.code),
Esql.rule_name_values = VALUES(rule.name),
Esql.message_values = VALUES(message),
Esql.file_path_values = VALUES(file.path),
Esql.dll_path_values = VALUES(dll.path),
Esql.process_executable_values = VALUES(process.executable),
Esql.process_parent_executable_values = VALUES(process.parent.executable),
Esql.process_command_line_values = VALUES(process.command_line),
Esql.process_hash_sha256_values = VALUES(process.hash.sha256),
Esql.file_hash_sha256_values = VALUES(file.hash.sha256),
Esql.dll_hash_sha256_values = VALUES(dll.hash.sha256) by agent.id
Stage 5: where
| where (Esql.event_code_distinct_count >= 2 or Esql.rule_name_distinct_count >= 3 or Esql.file_hash_distinct_count >= 2)
Stage 6: keep
| keep agent.id,
Esql.alerts_count,
Esql.event_code_distinct_count,
Esql.rule_name_distinct_count,
Esql.message_values,
Esql.event_code_values,
Esql.rule_name_values,
Esql.process_executable_values,
Esql.process_parent_executable_values,
Esql.process_command_line_values,
Esql.file_path_values,
Esql.dll_path_values,
Esql.process_hash_sha256_values,
Esql.file_hash_sha256_values,
Esql.dll_hash_sha256_values
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.event_code_distinct_count | ge |
| field:"Esql.event_code_distinct_count" kind:ge value:"2" |
Esql.file_hash_distinct_count | ge |
| field:"Esql.file_hash_distinct_count" kind:ge value:"2" |
Esql.rule_name_distinct_count | ge |
| field:"Esql.rule_name_distinct_count" kind:ge value:"3" |
agent.id | is_not_null | field:"agent.id" kind:is_not_null | |
event.code | in |
| field:"EventID" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
rule.name | eq | Multi.EICAR.Not-a-virus | excludes:rule.name field:"rule.name" value:"Multi.EICAR.Not-a-virus" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
agent.id | KEEP agent.id |
Esql.alerts_count | KEEP Esql.alerts_count |
Esql.event_code_distinct_count | KEEP Esql.event_code_distinct_count |
Esql.rule_name_distinct_count | KEEP Esql.rule_name_distinct_count |
Esql.message_values | KEEP Esql.message_values |
Esql.event_code_values | KEEP Esql.event_code_values |
Esql.rule_name_values | KEEP Esql.rule_name_values |
Esql.process_executable_values | KEEP Esql.process_executable_values |
Esql.process_parent_executable_values | KEEP Esql.process_parent_executable_values |
Esql.process_command_line_values | KEEP Esql.process_command_line_values |
Esql.file_path_values | KEEP Esql.file_path_values |
Esql.dll_path_values | KEEP Esql.dll_path_values |
Esql.process_hash_sha256_values | KEEP Esql.process_hash_sha256_values |
Esql.file_hash_sha256_values | KEEP Esql.file_hash_sha256_values |
Esql.dll_hash_sha256_values | KEEP Esql.dll_hash_sha256_values |
Potential Dynamic IEX Reconstruction via Environment Variables
#Detects PowerShell scripts that reconstructs IEX (Invoke-Expression) by indexing environment variable strings (for example, $env:VAR[1,2,3]) or related .name[...] slices and joining characters at runtime. Attackers use environment-variable slicing to hide dynamic execution and evade keyword-based detections and AMSI.
MITRE ATT&CK Coverage
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| PowerShell | Event ID 4104: Creating Scriptblock text (MessageNumber of MessageTotal). |
Rule Body
[metadata]
creation_date = "2025/04/16"
integration = ["windows"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects PowerShell scripts that reconstructs IEX (Invoke-Expression) by indexing environment variable strings (for example, $env:VAR[1,2,3]) or related `.name[...]` slices and joining characters at runtime.
Attackers use environment-variable slicing to hide dynamic execution and evade keyword-based detections and AMSI.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Potential Dynamic IEX Reconstruction via Environment Variables"
note = """## Triage and analysis
> **Disclaimer**:
> This guide was created by humans with the assistance of generative AI. While its contents have been manually curated to include the most valuable information, always validate assumptions and adjust procedures to match your internal runbooks and incident triage and response policies.
### Investigating Potential Dynamic IEX Reconstruction via Environment Variables
This alert indicates PowerShell Script Block Logging captured a script that builds "IEX" (Invoke-Expression) at runtime by indexing characters from environment variable strings or related name properties and combining them. This technique is commonly used to obscure dynamic execution and can indicate an attempt to execute attacker-controlled content.
#### 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.
- `file.path`, `file.directory`, `file.name`: File-origin context when the script block is sourced from an on-disk file.
- `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.
- `Esql.script_block_tmp`: Transformed script block where detection patterns replace original content with a marker to support scoring/counting and quickly spot match locations.
- `Esql.script_block_pattern_count`: Count of matches for the detection pattern(s) observed in the script block content.
- `powershell.file.script_block_entropy_bits`: Shannon entropy of the script block. Higher values may indicate obfuscation.
- `powershell.file.script_block_surprisal_stdev`: Standard deviation of surprisal across the script block. Low values indicate uniform randomness. High values indicate mixed patterns and variability.
- `powershell.file.script_block_unique_symbols`: Count of distinct characters present in the script block.
- `powershell.file.script_block_length`: Script block length (size) context.
#### Possible investigation steps
- Confirm scope and execution context:
- Review `host.name` and `host.id` to identify the impacted endpoint and determine whether it is a typical user workstation, server, or a special-purpose system in your environment.
- Review `user.name`, `user.domain`, and `user.id` to understand who executed the script and whether the account is expected to run PowerShell on this host (interactive user, service account, or administrative context).
- Use `agent.id` (if available) to identify the reporting agent and to support correlation with other telemetry collected from the same endpoint.
- Use the alert timestamp as the anchor to correlate activity immediately before and after the script block ran.
- Analyze the obfuscation and intended execution:
- Examine `powershell.file.script_block_text` to locate environment-variable slicing patterns (for example, `$env:<var>[<idx>]`, `$env:<var>[<idx1>,<idx2>,<idx3>]`, or `.name[<idx1>,<idx2>,<idx3>]`) and identify the variable names and indices being used.
- Use `Esql.script_block_tmp` to quickly find the match locations, then review the surrounding context in `powershell.file.script_block_text` to determine how the reconstructed string is used (assignment, concatenation/join, or immediate invocation).
- Determine whether the reconstructed output is used as a dynamic execution primitive (for example, passed to `Invoke-Expression` / `IEX`, used with the call operator, or invoked via a method). Focus on what content is ultimately evaluated or executed.
- Reconstruct full script content:
- If the script appears incomplete or staged across multiple events, use `powershell.file.script_block_id` with `powershell.sequence` and `powershell.total` to collect all fragments and rebuild the full script in order.
- After reconstruction, identify where string construction occurs versus where execution occurs to understand the end-to-end flow.
- Assess obfuscation level and intent using available enrichments:
- Review `Esql.script_block_pattern_count` to understand how frequently the reconstruction pattern appears within the script block; repeated occurrences can indicate systematic obfuscation rather than an isolated string operation.
- Review `powershell.file.script_block_length` for size context and compare it with typical script sizes seen for the same host or user.
- Review `powershell.file.script_block_entropy_bits`, `powershell.file.script_block_surprisal_stdev`, and `powershell.file.script_block_unique_symbols` to gauge whether the script contains encoded or highly obfuscated content (for example, large high-entropy blocks that may indicate packed or encoded data).
- Identify script origin and potential spread:
- If `file.path` is populated, review `file.name` and `file.directory` to determine where the script was sourced from and whether the location aligns with approved administrative tooling or software distribution paths.
- If `file.path` is not populated, treat the activity as potentially inline or dynamically generated and prioritize identifying the initiating process or source using adjacent telemetry.
- Scope for other alerts or script blocks on the same `host.id` or associated with the same `user.id` that show similar reconstruction patterns, especially within the same time window.
- Correlate with adjacent telemetry (as available in your environment):
- Using `host.id` / `host.name`, `user.id`, and the alert time, correlate with process execution data to identify the PowerShell host process and the initiating parent process or source (for example, interactive session, script runner, scheduled task, service, or another application).
- Correlate with network, file, registry, and authentication telemetry on the same host around the alert time to identify follow-on activity that supports malicious intent (download or retrieval of content, creation or modification of files, persistence-related changes, or suspicious logons).
### False positive analysis
- Legitimate automation or administration scripts may construct command strings dynamically, including deriving short tokens from environment variables for compatibility or to reduce hard-coded strings.
- Security testing and purple-team or red-team activity may intentionally use environment-variable slicing to emulate evasive tradecraft.
- Developer tooling, obfuscation research, or PowerShell training content may include this technique. Benign usage is typically tied to known owners, consistent hosts, predictable execution windows, and the absence of suspicious downstream activity.
### Response and remediation
- If the activity is suspected or confirmed malicious:
- Contain the affected host to prevent additional execution and reduce lateral movement risk.
- Preserve evidence by collecting the complete script content using `powershell.file.script_block_id`, `powershell.sequence`, and `powershell.total`, and retain the original `powershell.file.script_block_text` for analysis.
- Extract and track indicators from the script content (for example, URLs, domains, IP addresses, file names, or unique strings) and scope for additional occurrences across the environment using `host.id`, `host.name`, `user.id`, and `file.path` when present.
- Identify and remediate the initial execution source (parent process or launching mechanism) and remove or quarantine any associated script files referenced by `file.path`.
- If account compromise is suspected, reset affected credentials and review for additional suspicious PowerShell activity associated with the same `user.id`.
- If the activity is determined to be benign:
- Document the business justification, owning team, expected hosts, and expected script location (`file.path` when present).
- Monitor for deviations in execution context (new hosts, new users, or materially different script content) and consider targeted tuning based on stable attributes such as `file.path` and known `user.id` values.
"""
risk_score = 47
rule_id = "b0c98cfb-0745-4513-b6f9-08dddb033490"
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: Defense Evasion",
"Data Source: PowerShell Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-windows.powershell_operational* metadata _id, _version, _index
| where event.code == "4104"
// Filter out smaller scripts that are unlikely to implement obfuscation using the patterns we are looking for
| eval Esql.script_block_length = length(powershell.file.script_block_text)
| where Esql.script_block_length > 500
// replace the patterns we are looking for with the 🔥 emoji to enable counting them
// The emoji is used because it's unlikely to appear in scripts and has a consistent character length of 1
| eval Esql.script_block_tmp = replace(
powershell.file.script_block_text,
"""(?i)(\$(?:\w+|\w+\:\w+)\[\d++\]\+\$(?:\w+|\w+\:\w+)\[\d++\]\+['"]x['"]|\$(?:\w+\:\w+)\[\d++,\d++,\d++\]|\.name\[\d++,\d++,\d++\])""",
"🔥"
)
// count how many patterns were detected by calculating the number of 🔥 characters inserted
| eval Esql.script_block_pattern_count = length(Esql.script_block_tmp) - length(replace(Esql.script_block_tmp, "🔥", ""))
// keep the fields relevant to the query, although this is not needed as the alert is populated using _id
| keep
Esql.script_block_pattern_count,
Esql.script_block_length,
Esql.script_block_tmp,
powershell.file.*,
file.path,
powershell.sequence,
powershell.total,
_id,
_version,
_index,
host.name,
host.id,
agent.id,
user.id
// Filter for scripts that match the pattern at least once
| where Esql.script_block_pattern_count >= 1
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[rule.threat.technique.subtechnique]]
id = "T1027.010"
name = "Command Obfuscation"
reference = "https://attack.mitre.org/techniques/T1027/010/"
[[rule.threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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: from
from logs-windows.powershell_operational* metadata _id, _version, _index
Stage 2: where
| where event.code == "4104"
Stage 3: eval
| eval Esql.script_block_length = length(powershell.file.script_block_text)
Stage 4: where
| where Esql.script_block_length > 500
Stage 5: eval
| eval Esql.script_block_tmp = replace(
powershell.file.script_block_text,
"""(?i)(\$(?:\w+|\w+\:\w+)\[\d++\]\+\$(?:\w+|\w+\:\w+)\[\d++\]\+['"]x['"]|\$(?:\w+\:\w+)\[\d++,\d++,\d++\]|\.name\[\d++,\d++,\d++\])""",
"🔥"
)
Stage 6: eval
| eval Esql.script_block_pattern_count = length(Esql.script_block_tmp) - length(replace(Esql.script_block_tmp, "🔥", ""))
Stage 7: keep
| keep
Esql.script_block_pattern_count,
Esql.script_block_length,
Esql.script_block_tmp,
powershell.file.*,
file.path,
powershell.sequence,
powershell.total,
_id,
_version,
_index,
host.name,
host.id,
agent.id,
user.id
Stage 8: where
| where Esql.script_block_pattern_count >= 1
Indicators
These rows show field, operator, and value matches.
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.script_block_pattern_count | KEEP Esql.script_block_pattern_count |
Esql.script_block_length | KEEP Esql.script_block_length |
Esql.script_block_tmp | KEEP Esql.script_block_tmp |
powershell.file.* | KEEP powershell.file.* |
file.path | KEEP file.path |
powershell.sequence | KEEP powershell.sequence |
powershell.total | KEEP powershell.total |
_id | KEEP _id |
_version | KEEP _version |
_index | KEEP _index |
host.name | KEEP host.name |
host.id | KEEP host.id |
agent.id | KEEP agent.id |
user.id | KEEP user.id |
Potential Java Service Exploitation via Suspicious Child Process
#Identifies a Java process that accepts an inbound network connection and then spawns a suspicious child process. This may indicate exploitation of a Java service that runs attacker-controlled code, such as one that deserializes untrusted objects.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2021/12/10"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/08/26"
[rule]
author = ["Elastic"]
description = """
Identifies a Java process that accepts an inbound network connection and then spawns a suspicious child process. This
may indicate exploitation of a Java service that runs attacker-controlled code, such as one that deserializes untrusted
objects.
"""
from = "now-9m"
index = ["auditbeat-*", "logs-endpoint.events.*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Java Service Exploitation via Suspicious Child Process"
references = [
"https://www.lunasec.io/docs/blog/log4j-zero-day/",
"https://github.com/christophetd/log4shell-vulnerable-app",
"https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf",
"https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security",
"https://www.elastic.co/security-labs/analysis-of-log4shell-cve-2021-45046",
"https://archive.ph/Xowgn",
]
risk_score = 73
rule_id = "c3f5e1d8-910e-43b4-8d44-d748e498ca86"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Linux",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Execution",
"Use Case: Vulnerability",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id with maxspan=5s
[network where event.action == "connection_accepted" and network.direction == "ingress" and
process.name : "java" and
destination.port < 49152 and source.port >= 32768] by process.pid
[process where event.type == "start" and
/* Suspicious JAVA child process */
process.parent.name : "java" and
process.name : (
"sh", "bash", "dash", "ksh", "tcsh", "zsh", "ash", "mksh", "busybox",
"curl", "wget", "perl*", "python*", "ruby*", "php*", "lua*", "socat",
"nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd",
"nc.traditional", "nohup", "setsid", "disown", "hostname", "whoami", "id"
) and
not process.command_line like~ (
"bash -c ulimit -u",
"bash /opt/flutter/bin/flutter*",
"bash -c echo $$",
"/bin/bash /opt/python3/bin/jira*",
"/bin/sh -c env LC_ALL=C /usr/sbin/lpc status*"
)] by process.parent.pid
'''
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 Java Service Exploitation via Suspicious Child Process
Some Java services accept inbound connections and deserialize untrusted objects, such as a leftover Log4j socket or collector that rebuilds serialized `LogEvent` objects through `FilteredObjectInputStream`. If that path can be reached, an attacker can send a crafted payload to the listening port and get the JVM to run attacker-controlled code. This rule looks for a Java process that accepts an inbound connection on a service port from an ephemeral source port, then quickly starts a suspicious child process (shell, interpreter, curl, or wget) whose working directory is under `/opt`. That sequence is consistent with remote code execution against a Java listener rather than a normal outbound application callback.
### Possible investigation steps
- Confirm the inbound `connection_accepted` event: Java was the accepting process, `network.direction` is ingress, the destination port is a service port (below 49152), and the source port is ephemeral (32768 or higher on Linux; 49152 or higher is typical on macOS).
- Identify the source IP and determine whether it is expected to talk to this Java service. Internal sources still matter; a collector or socket server exposed only on a private network can still be used for lateral movement.
- Review the child process that started within a few seconds of the accepted connection. Check `process.name`, `process.command_line`, `process.working_directory`, and the parent/child PID relationship to Java.
- Inspect the Java process command line and working directory to see which application accepted the connection (for example a service under `/opt`) and whether it is a known listener that deserializes input.
- Look for follow-on activity on the same host after the child process: additional shells, file writes under `/tmp` or `/opt`, new outbound connections, or persistence changes.
- Correlate with other alerts on the same host or user around the same time to see whether this is isolated or part of a broader intrusion.
### False positive analysis
- Java services installed may spawn shells or interpreters during install, upgrade, health checks, or administrative scripts. Confirm whether the child command line matches a known maintenance pattern before treating the alert as malicious.
- Some already-excluded patterns include Flutter tooling, Jira helper scripts, and trivial `bash -c` probes such as `ulimit` or `echo $$`. Add similar exceptions for other trusted `/opt` applications when the parent Java process and command line are stable.
- Development or lab collectors that intentionally accept serialized Java objects will match this rule if they also start a shell. Restrict those hosts or exclude the specific service path if that activity is expected.
- Containerized or non-`/opt` Java applications are outside this rule's working-directory constraint and should not be tuned here; investigate those with a broader hunt if needed.
### Response and remediation
- Isolate the affected host from the network to stop further inbound exploitation and limit lateral movement.
- Stop the suspicious child processes and, if exploitation is confirmed, stop the Java listener that accepted the connection until it can be patched or removed.
- Capture the Java process command line, listening port, child process command line, and inbound source IP for scoping.
- Hunt for the same source IP, the same Java service path, and similar child processes on other hosts.
- Remove or disable unused Java socket servers, collectors, or sample bridges that deserialize untrusted input. Patch remaining Java applications and apply a JVM-wide serialization filter where deserialization cannot be avoided.
- Restore from a known-good backup if unauthorized files, persistence, or additional malware are found.
- Escalate to the security operations center or incident response team if the inbound source, child process, or follow-on activity indicates a successful compromise."""
[[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.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[[rule.threat.technique]]
id = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1190"
name = "Exploit Public-Facing Application"
reference = "https://attack.mitre.org/techniques/T1190/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5s, correlated by host.id, process.parent.pid, process.pid.
Stage 1: network
[network where event.action == "connection_accepted" and network.direction == "ingress" and
process.name : "java" and
destination.port < 49152 and source.port >= 32768] by process.pid
Stage 2: process
[process where event.type == "start" and
process.parent.name : "java" and
process.name : (
"sh", "bash", "dash", "ksh", "tcsh", "zsh", "ash", "mksh", "busybox",
"curl", "wget", "perl*", "python*", "ruby*", "php*", "lua*", "socat",
"nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd",
"nc.traditional", "nohup", "setsid", "disown", "hostname", "whoami", "id"
) and
not process.command_line like~ (
"bash -c ulimit -u",
"bash /opt/flutter/bin/flutter*",
"bash -c echo $$",
"/bin/bash /opt/python3/bin/jira*",
"/bin/sh -c env LC_ALL=C /usr/sbin/lpc status*"
)] by process.parent.pid
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | lt |
| field:"DestinationPort" kind:lt value:"49152" |
event.action | eq |
| field:"EventType" kind:eq value:"connection_accepted" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
network.direction | eq |
| field:"Initiated" kind:eq value:"ingress" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"java" |
source.port | ge |
| field:"SourcePort" kind:ge value:"32768" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | wildcard | bash -c ulimit -u, bash /opt/flutter/bin/flutter*, bash -c echo $$, /bin/bash /opt/python3/bin/jira*, /bin/sh -c env LC_ALL=C /usr/sbin/lpc status* | excludes:process.command_line |
Potential Linux Reverse Shell via Java Shell Execution
#Identifies the execution of a Linux shell process from a Java parent application before an incoming network connection. This behavior may indicate reverse shell activity via a Java application.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
Identifies the execution of a Linux shell process from a Java parent application before an incoming network connection.
This behavior may indicate reverse shell activity via a Java application.
"""
id = "41424b6d-8875-409f-a3ab-96792e7c8cd6"
license = "Elastic License v2"
name = "Potential Linux Reverse Shell via Java Shell Execution"
os_list = ["linux"]
version = "1.0.1"
query = '''
sequence by process.entity_id with maxspan=5s
[process where event.type == "start" and event.action == "exec" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.parent.name == "java"
]
[network where event.type == "start" and event.action == "connection_attempted" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
not (destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "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", "224.0.0.0/4", "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", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8"
)
)]
'''
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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[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
Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.parent.name == "java"
]
Stage 2: network
[network where event.type == "start" and event.action == "connection_attempted" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
not (destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "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", "224.0.0.0/4", "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", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8"
)
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"java" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 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, 224.0.0.0/4, 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, 240.0.0.0/4, ::1, FE80::/10, FF00::/8 | excludes:destination.ip |
destination.ip | eq | 0.0.0.0 | excludes:destination.ip field:"destination.ip" value:"0.0.0.0" |
destination.ip | is_null | excludes:destination.ip |
Service Path Modification via sc.exe
#Identifies attempts to modify a service path setting using sc.exe. Attackers may attempt to modify existing services for persistence or privilege escalation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2023/08/29"
integration = ["endpoint", "windows", "system"]
maturity = "production"
updated_date = "2025/03/20"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies attempts to modify a service path setting using sc.exe. Attackers may attempt to modify existing services for
persistence or privilege escalation.
"""
from = "now-119m"
index = [
"endgame-*",
"logs-endpoint.events.process-*",
"logs-system.security*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Service Path Modification via sc.exe"
risk_score = 21
rule_id = "c5677997-f75b-4cda-b830-a75920514096"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Rule Type: BBR",
"Data Source: Sysmon",
"Data Source: Windows Security Event Logs",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and process.name : "sc.exe" and
process.args : "*config*" and process.args : "*binPath*"
'''
[[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/"
[[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.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: process
process where event.type == "start" and process.name : "sc.exe" and
process.args : "*config*" and process.args : "*binPath*"
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 value:"sc.exe" |
Suspicious Executable Copied from Volume Mount
#Detects when an executable file is copied from a hidden directory on a volume mounted disk to the applications directory. Geacon samples have been observed utilizing this technique as a method for setting up persistence with the second stage payload prior to establishing persistence via the .zshrc file.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when an executable file is copied from a hidden directory on a volume mounted disk to the applications
directory. Geacon samples have been observed utilizing this technique as a method for setting up persistence with the
second stage payload prior to establishing persistence via the .zshrc file.
"""
id = "0facb446-7d95-4b27-bd40-490bbec5a95b"
license = "Elastic License v2"
name = "Suspicious Executable Copied from Volume Mount"
os_list = ["macos"]
reference = ["https://github.com/darkr4y/geacon"]
version = "1.0.6"
query = '''
sequence by process.entity_id with maxspan=3s
[process where event.type == "start" and event.action == "exec" and process.name == "cp" and
process.args_count == 3 and process.args in ("cp", "/bin/cp", "/usr/bin/cp") and
process.args like~ "/Volumes/*/.*" and process.args like "/Applications/*"] as event0
[file where event.action == "modification" and process.name == "cp" and file.path like "/Applications/*" and
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and
stringcontains~(event0.process.command_line, file.name)]
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 3s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.name == "cp" and
process.args_count == 3 and process.args in ("cp", "/bin/cp", "/usr/bin/cp") and
process.args like~ "/Volumes/*/.*" and process.args like "/Applications/*"] as event0
Stage 2: file
[file where event.action == "modification" and process.name == "cp" and file.path like "/Applications/*" and
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and
stringcontains~(event0.process.command_line, file.name)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
event0.process.command_line | contains |
| field:"event0.process.command_line" kind:contains value:"file.name" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"/Applications/*" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"3" |
process.name | eq |
| field:"process_basename" kind:eq value:"cp" |
Suspicious Execution via DCOM
#Identifies suspicious execution via the Distributed Component Object Model service. This may indicate an attempt to evade detection via suspicious process tree.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Lateral Movement |
Rule Body
[rule]
description = """
Identifies suspicious execution via the Distributed Component Object Model service. This may indicate an attempt to
evade detection via suspicious process tree.
"""
id = "8f3b570f-afe6-4974-8842-b6ac71cd9ea9"
license = "Elastic License v2"
name = "Suspicious Execution via DCOM"
os_list = ["windows"]
reference = [
"https://www.cybereason.com/blog/dcom-lateral-movement-techniques",
"https://codewhitesec.blogspot.com/2018/07/lethalhta.html",
]
version = "1.0.40"
query = '''
sequence with maxspan=1m
[process where event.action == "start" and
process.parent.name : "svchost.exe" and
(
process.Ext.effective_parent.executable :
("?:\\Users\\*",
"?:\\Windows\\Temp\\*",
"?:\\Windows\\Tasks\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Microsoft.NET\\*") or
process.Ext.effective_parent.name : ("powershell.exe", "cscript.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe",
"mshta.exe", "msbuild.exe", "winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe",
"InstallUtil.exe", "Microsoft.Workflow.Compiler.exe", "ScriptRunner.exe", "pwsh.exe", "cmd.exe")
) and
/* excluding AppInfo WerFault Openwith and Dllhost */
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\system32\\OpenWith.exe",
"?:\\Windows\\System32\\prevhost.exe",
"?:\\Windows\\SysWOW64\\prevhost.exe",
"?:\\Windows\\System32\\vdsldr.exe",
"?:\\Windows\\SysWOW64\\vdsldr.exe",
"?:\\Windows\\System32\\CredentialUIBroker.exe",
"?:\\WINDOWS\\System32\\DriverStore\\FileRepository\\*.exe",
"?:\\Program Files (x86)\\Dropbox\\Client\\Dropbox.exe",
"?:\\ProgramData\\*\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\*\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\FileCoAuth.exe") and
/* excluding AppInfo */
not process.parent.Ext.real.pid > 0 and
/* noisy FPs */
not (process.name : "rundll32.exe" and
process.args : ("?:\\WINDOWS\\system32\\davclnt.dll,DavSetCookie",
"?:\\WINDOWS\\SYSTEM32\\EDGEHTML.dll,#141",
"?:\\Program Files (x86)\\*",
"?:\\Program Files\\*")) and
not process.hash.sha256 : "f18a9d2e5af55587a3c13edde7a33a235634b2be8b567fa0a195923305e13f09" and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not (process.pe.original_file_name : "msedgeupdate.dll" and process.code_signature.trusted == true)
] by process.entity_id
[process where event.action : "start" and
not process.executable :
("?:\\Program Files (x86)\\*.exe",
"?:\\Program Files\\*.exe",
"?:\\WINDOWS\\splwow64.exe",
"?:\\Windows\\System32\\IESettingSync.exe",
"?:\\WINDOWS\\system32\\srtasks.exe",
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\DWWIN.EXE",
"?:\\Windows\\SysWOW64\\DWWIN.EXE",
"?:\\Windows\\system32\\msiexec.exe",
"?:\\Windows\\SysWOW64\\msiexec.exe",
"?:\\Windows\\Microsoft.NET\\Framework*\\csc.exe",
"?:\\Windows\\SysWOW64\\unregmp2.exe",
"?:\\WINDOWS\\system32\\verclsid.exe",
"?:\\Windows\\system32\\dllhost.exe",
"?:\\Windows\\SysWOW64\\dllhost.exe",
"?:\\Windows\\System32\\mspaint.exe",
"?:\\Windows\\SysWOW64\\mspaint.exe",
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
"?:\\Windows\\System32\\TokenBrokerCookies.exe",
"?:\\Windows\\Sys*\\PresentationHost.exe",
"?:\\Windows\\System32\\w32tm.exe",
"?:\\Windows\\System32\\colorcpl.exe",
"?:\\Windows\\SysWOW64\\colorcpl.exe",
"?:\\Windows\\SysWOW64\\psr.exe",
"?:\\Windows\\System32\\psr.exe",
"?:\\Windows\\BrowserCore\\BrowserCore.exe",
"?:\\Windows\\System32\\conhost.exe",
"?:\\Windows\\System32\\UsoClient.exe",
"?:\\Windows\\System32\\mcbuilder.exe",
"?:\\Windows\\System32\\mstsc.exe",
"?:\\Windows\\System32\\wermgr.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\Install\\*\\MicrosoftEdge_X64*.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\Install\\*\\MicrosoftEdge_*.exe") and
not process.parent.executable :
("?:\\Program Files (x86)\\Common Files\\InstallShield\\Engine\\*\\IKernel.exe",
"?:\\Program Files\\Common Files\\InstallShield\\Engine\\*\\IKernel.exe",
"?:\\Windows\\SysWOW64\\PresentationHost.exe",
"?:\\Program Files (x86)\\BL\\BL\\ACTIVEX.OUT.OF.PROCESS\\*.exe",
"?:\\Program Files (x86)\\Minitab\\Minitab *\\Mtb.exe",
"?:\\Program Files (x86)\\Common Files\\InstallShield\\Driver\\*\\IDriver.exe",
"?:\\Program Files\\Kerio\\Outlook Connector (Offline Edition)\\KoffBackend.exe") and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not (process.executable :
("?:\\Users\\*",
"?:\\Windows\\System32\\spool\\drivers\\*",
"?:\\ProgramData\\") and process.code_signature.trusted == true) and
not (process.name : ("rundll32.exe", "regsvr32.exe") and
process.command_line :
("*windows\\system32\\spool\\DRIVERS\\*MonitorPrintJobStatus*",
"*WINDOWS\\system32\\inetcpl*ClearMyTracksByProcess*",
"*PhotoViewer.dll*ImageView_Fullscreen*",
"*\\Program Files (x86)\\AllesTechnologyAgent\\Super Shield\\SuperShieldHookCpy64.dll*",
"*:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\*",
"*\\Windows\\System32\\shell32.dll,Control_RunDLL ?:\\Windows\\System32\\*")) and
not (process.name : "regsvr32.exe" and process.parent.name : "dllhost.exe" and
process.parent.args : "/Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}") and
not process.hash.sha256 in
("4a06605651958c56e89a468f600c3322e3fdc97c8143bcfd1d8d1ebadb0920fb",
"b04266ca05e8125a1544e68c8852f7d44dde9c7e4f3b08a0383c0bf4ab6cfd2d",
"ef7d80e4cc017ba0b8ca0cef2956ed762f4a3e8053d2569785bfaf735e9aecb9",
"1b71b0b94f70215fa4ed9fe8cf950558eb20413feb54967cade34148ca97793e",
"e08a98f79de70175f6bb4c319b70bc13063aa1f03780709393f4f6d498da9c0f",
"d0f324e0267f7075e60f896cf064538e8398fb51557d2e1a53f348d39d10c3ac",
"1d70bbb5c62a2c27583cd38261c09fdc9c208f6ea96349e535b6c4135c0a8569",
"b52ee82c7e579fd73abc31c368462df9d99c6623be91526ee150706286dc19ee",
"a430089ee8c6d119ee90ca586626038d0e1e8b4fbd742440ce5c83d295f2fc46",
"e600ebf1bdada253a31f59a9870b8aa18d9a985c390510bfe9219acb44da406d",
"d539b4957d8c03b6503357df836f1ed92fa37d73e19e0962d83b3dcba507f4bf",
"91c176db26a66a0ef8249a43d5ff9ccf76571cd965070baf8e72f96559f28289",
"2ec75fa569c0fa92add37c7221d700acd4bd70f5438154695ecccc4fd30b5e60",
"065b386addf06337ad1d40f7b05cbb137c6c4ee7589c1ea22e4e18c0cefe850c",
"3c387b216fe27eaadf788598e8071fdaad5cfa02419f7e068dcfaac0e78276b7") and
not (process.pe.original_file_name == "Teams.exe" and
process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft Corporation") and
not (process.executable : "?:\\Windows\\System32\\conhost.exe" and process.parent.executable : "?:\\Windows\\System32\\sdiagnhost.exe") and
not (process.parent.name : "dllhost.exe" and process.parent.args : "/Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}") and
not (process.name : "rundll32.exe" and process.args : "?:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication" and
process.parent.command_line : "\"?:\\Program Files\\Internet Explorer\\iexplore.exe\" -startmanager -Embedding")
] by process.parent.entity_id
'''
min_endpoint_version = "8.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[threat.technique.subtechnique]]
id = "T1021.003"
name = "Distributed Component Object Model"
reference = "https://attack.mitre.org/techniques/T1021/003/"
[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "start" and
process.parent.name : "svchost.exe" and
(
process.Ext.effective_parent.executable :
("?:\\Users\\*",
"?:\\Windows\\Temp\\*",
"?:\\Windows\\Tasks\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Microsoft.NET\\*") or
process.Ext.effective_parent.name : ("powershell.exe", "cscript.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe",
"mshta.exe", "msbuild.exe", "winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe",
"InstallUtil.exe", "Microsoft.Workflow.Compiler.exe", "ScriptRunner.exe", "pwsh.exe", "cmd.exe")
) and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\system32\\OpenWith.exe",
"?:\\Windows\\System32\\prevhost.exe",
"?:\\Windows\\SysWOW64\\prevhost.exe",
"?:\\Windows\\System32\\vdsldr.exe",
"?:\\Windows\\SysWOW64\\vdsldr.exe",
"?:\\Windows\\System32\\CredentialUIBroker.exe",
"?:\\WINDOWS\\System32\\DriverStore\\FileRepository\\*.exe",
"?:\\Program Files (x86)\\Dropbox\\Client\\Dropbox.exe",
"?:\\ProgramData\\*\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\*\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\FileCoAuth.exe") and
not process.parent.Ext.real.pid > 0 and
not (process.name : "rundll32.exe" and
process.args : ("?:\\WINDOWS\\system32\\davclnt.dll,DavSetCookie",
"?:\\WINDOWS\\SYSTEM32\\EDGEHTML.dll,#141",
"?:\\Program Files (x86)\\*",
"?:\\Program Files\\*")) and
not process.hash.sha256 : "f18a9d2e5af55587a3c13edde7a33a235634b2be8b567fa0a195923305e13f09" and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not (process.pe.original_file_name : "msedgeupdate.dll" and process.code_signature.trusted == true)
] by process.entity_id
Stage 2: process
[process where event.action : "start" and
not process.executable :
("?:\\Program Files (x86)\\*.exe",
"?:\\Program Files\\*.exe",
"?:\\WINDOWS\\splwow64.exe",
"?:\\Windows\\System32\\IESettingSync.exe",
"?:\\WINDOWS\\system32\\srtasks.exe",
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\DWWIN.EXE",
"?:\\Windows\\SysWOW64\\DWWIN.EXE",
"?:\\Windows\\system32\\msiexec.exe",
"?:\\Windows\\SysWOW64\\msiexec.exe",
"?:\\Windows\\Microsoft.NET\\Framework*\\csc.exe",
"?:\\Windows\\SysWOW64\\unregmp2.exe",
"?:\\WINDOWS\\system32\\verclsid.exe",
"?:\\Windows\\system32\\dllhost.exe",
"?:\\Windows\\SysWOW64\\dllhost.exe",
"?:\\Windows\\System32\\mspaint.exe",
"?:\\Windows\\SysWOW64\\mspaint.exe",
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
"?:\\Windows\\System32\\TokenBrokerCookies.exe",
"?:\\Windows\\Sys*\\PresentationHost.exe",
"?:\\Windows\\System32\\w32tm.exe",
"?:\\Windows\\System32\\colorcpl.exe",
"?:\\Windows\\SysWOW64\\colorcpl.exe",
"?:\\Windows\\SysWOW64\\psr.exe",
"?:\\Windows\\System32\\psr.exe",
"?:\\Windows\\BrowserCore\\BrowserCore.exe",
"?:\\Windows\\System32\\conhost.exe",
"?:\\Windows\\System32\\UsoClient.exe",
"?:\\Windows\\System32\\mcbuilder.exe",
"?:\\Windows\\System32\\mstsc.exe",
"?:\\Windows\\System32\\wermgr.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\Install\\*\\MicrosoftEdge_X64*.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\EdgeUpdate\\Install\\*\\MicrosoftEdge_*.exe") and
not process.parent.executable :
("?:\\Program Files (x86)\\Common Files\\InstallShield\\Engine\\*\\IKernel.exe",
"?:\\Program Files\\Common Files\\InstallShield\\Engine\\*\\IKernel.exe",
"?:\\Windows\\SysWOW64\\PresentationHost.exe",
"?:\\Program Files (x86)\\BL\\BL\\ACTIVEX.OUT.OF.PROCESS\\*.exe",
"?:\\Program Files (x86)\\Minitab\\Minitab *\\Mtb.exe",
"?:\\Program Files (x86)\\Common Files\\InstallShield\\Driver\\*\\IDriver.exe",
"?:\\Program Files\\Kerio\\Outlook Connector (Offline Edition)\\KoffBackend.exe") and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not (process.executable :
("?:\\Users\\*",
"?:\\Windows\\System32\\spool\\drivers\\*",
"?:\\ProgramData\\") and process.code_signature.trusted == true) and
not (process.name : ("rundll32.exe", "regsvr32.exe") and
process.command_line :
("*windows\\system32\\spool\\DRIVERS\\*MonitorPrintJobStatus*",
"*WINDOWS\\system32\\inetcpl*ClearMyTracksByProcess*",
"*PhotoViewer.dll*ImageView_Fullscreen*",
"*\\Program Files (x86)\\AllesTechnologyAgent\\Super Shield\\SuperShieldHookCpy64.dll*",
"*:\\Windows\\system32\\spool\\DRIVERS\\x64\\3\\*",
"*\\Windows\\System32\\shell32.dll,Control_RunDLL ?:\\Windows\\System32\\*")) and
not (process.name : "regsvr32.exe" and process.parent.name : "dllhost.exe" and
process.parent.args : "/Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}") and
not process.hash.sha256 in
("4a06605651958c56e89a468f600c3322e3fdc97c8143bcfd1d8d1ebadb0920fb",
"b04266ca05e8125a1544e68c8852f7d44dde9c7e4f3b08a0383c0bf4ab6cfd2d",
"ef7d80e4cc017ba0b8ca0cef2956ed762f4a3e8053d2569785bfaf735e9aecb9",
"1b71b0b94f70215fa4ed9fe8cf950558eb20413feb54967cade34148ca97793e",
"e08a98f79de70175f6bb4c319b70bc13063aa1f03780709393f4f6d498da9c0f",
"d0f324e0267f7075e60f896cf064538e8398fb51557d2e1a53f348d39d10c3ac",
"1d70bbb5c62a2c27583cd38261c09fdc9c208f6ea96349e535b6c4135c0a8569",
"b52ee82c7e579fd73abc31c368462df9d99c6623be91526ee150706286dc19ee",
"a430089ee8c6d119ee90ca586626038d0e1e8b4fbd742440ce5c83d295f2fc46",
"e600ebf1bdada253a31f59a9870b8aa18d9a985c390510bfe9219acb44da406d",
"d539b4957d8c03b6503357df836f1ed92fa37d73e19e0962d83b3dcba507f4bf",
"91c176db26a66a0ef8249a43d5ff9ccf76571cd965070baf8e72f96559f28289",
"2ec75fa569c0fa92add37c7221d700acd4bd70f5438154695ecccc4fd30b5e60",
"065b386addf06337ad1d40f7b05cbb137c6c4ee7589c1ea22e4e18c0cefe850c",
"3c387b216fe27eaadf788598e8071fdaad5cfa02419f7e068dcfaac0e78276b7") and
not (process.pe.original_file_name == "Teams.exe" and
process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft Corporation") and
not (process.executable : "?:\\Windows\\System32\\conhost.exe" and process.parent.executable : "?:\\Windows\\System32\\sdiagnhost.exe") and
not (process.parent.name : "dllhost.exe" and process.parent.args : "/Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}") and
not (process.name : "rundll32.exe" and process.args : "?:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication" and
process.parent.command_line : "\"?:\\Program Files\\Internet Explorer\\iexplore.exe\" -startmanager -Embedding")
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"start" |
process.Ext.effective_parent.executable | wildcard |
| field:"process.Ext.effective_parent.executable" kind:wildcard |
process.Ext.effective_parent.name | wildcard |
| field:"process.Ext.effective_parent.name" kind:wildcard |
process.code_signature.subject_name | wildcard |
| field:"Signature" kind:wildcard value:"Microsoft*" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"svchost.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | starts_with | Microsoft | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.args | wildcard | ?:\WINDOWS\system32\davclnt.dll,DavSetCookie, ?:\WINDOWS\SYSTEM32\EDGEHTML.dll,#141, ?:\Program Files (x86)\*, ?:\Program Files\* | excludes:process.args |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.pe.original_file_name | eq | msedgeupdate.dll | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"msedgeupdate.dll" |
process.executable | wildcard | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\system32\OpenWith.exe, ?:\Windows\System32\prevhost.exe, ?:\Windows\SysWOW64\prevhost.exe, ?:\Windows\System32\vdsldr.exe, ?:\Windows\SysWOW64\vdsldr.exe, ?:\Windows\System32\CredentialUIBroker.exe, ?:\WINDOWS\System32\DriverStore\FileRepository\*.exe, ?:\Program Files (x86)\Dropbox\Client\Dropbox.exe, ?:\ProgramData\*\Microsoft\Teams\current\Teams.exe, ?:\*\AppData\Local\Microsoft\Teams\current\Teams.exe, ?:\Users\*\AppData\Local\Microsoft\OneDrive\*\FileCoAuth.exe | excludes:process.executable |
process.hash.sha256 | eq | f18a9d2e5af55587a3c13edde7a33a235634b2be8b567fa0a195923305e13f09 | excludes:process.hash.sha256 field:"process.hash.sha256" value:"f18a9d2e5af55587a3c13edde7a33a235634b2be8b567fa0a195923305e13f09" |
process.parent.Ext.real.pid | gt | 0 | excludes:process.parent.Ext.real.pid field:"process.parent.Ext.real.pid" value:"0" |
process.args | eq | ?:\Windows\System32\dfshim.dll,ShOpenVerbApplication | excludes:process.args field:"process.args" value:"?:\Windows\System32\dfshim.dll,ShOpenVerbApplication" |
process.parent.command_line | eq | "?:\Program Files\Internet Explorer\iexplore.exe" -startmanager -Embedding | excludes:process.parent.command_line |
process.code_signature.subject_name | eq | Microsoft Corporation | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Corporation" |
process.pe.original_file_name | eq | Teams.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"Teams.exe" |
process.executable | wildcard | ?:\Users\*, ?:\Windows\System32\spool\drivers\*, ?:\ProgramData\ | excludes:process.executable field:"process.executable" value:"?:\Users\*" field:"process.executable" value:"?:\Windows\System32\spool\drivers\*" field:"process.executable" value:"?:\ProgramData\" |
process.command_line | wildcard | *windows\system32\spool\DRIVERS\*MonitorPrintJobStatus*, *WINDOWS\system32\inetcpl*ClearMyTracksByProcess*, *PhotoViewer.dll*ImageView_Fullscreen*, *\Program Files (x86)\AllesTechnologyAgent\Super Shield\SuperShieldHookCpy64.dll*, *:\Windows\system32\spool\DRIVERS\x64\3\*, *\Windows\System32\shell32.dll,Control_RunDLL ?:\Windows\System32\* | excludes:process.command_line |
process.name | eq | rundll32.exe, regsvr32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" field:"process.name" value:"regsvr32.exe" |
process.executable | eq | ?:\Windows\System32\conhost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\conhost.exe" |
process.parent.executable | eq | ?:\Windows\System32\sdiagnhost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\sdiagnhost.exe" |
process.name | eq | regsvr32.exe | excludes:process.name field:"process.name" value:"regsvr32.exe" |
process.parent.args | eq | /Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0} | excludes:process.parent.args field:"process.parent.args" value:"/Processid:{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}" |
process.parent.name | eq | dllhost.exe | excludes:process.parent.name field:"process.parent.name" value:"dllhost.exe" |
process.executable | wildcard | ?:\Program Files (x86)\*.exe, ?:\Program Files\*.exe, ?:\WINDOWS\splwow64.exe, ?:\Windows\System32\IESettingSync.exe, ?:\WINDOWS\system32\srtasks.exe, ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\DWWIN.EXE, ?:\Windows\SysWOW64\DWWIN.EXE, ?:\Windows\system32\msiexec.exe, ?:\Windows\SysWOW64\msiexec.exe, ?:\Windows\Microsoft.NET\Framework*\csc.exe, ?:\Windows\SysWOW64\unregmp2.exe, ?:\WINDOWS\system32\verclsid.exe, ?:\Windows\system32\dllhost.exe, ?:\Windows\SysWOW64\dllhost.exe, ?:\Windows\System32\mspaint.exe, ?:\Windows\SysWOW64\mspaint.exe, ?:\Windows\System32\DriverStore\FileRepository\*, ?:\Windows\System32\TokenBrokerCookies.exe, ?:\Windows\Sys*\PresentationHost.exe, ?:\Windows\System32\w32tm.exe, ?:\Windows\System32\colorcpl.exe, ?:\Windows\SysWOW64\colorcpl.exe, ?:\Windows\SysWOW64\psr.exe, ?:\Windows\System32\psr.exe, ?:\Windows\BrowserCore\BrowserCore.exe, ?:\Windows\System32\conhost.exe, ?:\Windows\System32\UsoClient.exe, ?:\Windows\System32\mcbuilder.exe, ?:\Windows\System32\mstsc.exe, ?:\Windows\System32\wermgr.exe, ?:\Users\*\AppData\Local\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe, ?:\Users\*\AppData\Local\Microsoft\EdgeUpdate\Install\*\MicrosoftEdge_X64*.exe, ?:\Users\*\AppData\Local\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe, ?:\Users\*\AppData\Local\Microsoft\EdgeUpdate\Install\*\MicrosoftEdge_*.exe | excludes:process.executable |
process.hash.sha256 | in | 065b386addf06337ad1d40f7b05cbb137c6c4ee7589c1ea22e4e18c0cefe850c, 1b71b0b94f70215fa4ed9fe8cf950558eb20413feb54967cade34148ca97793e, 1d70bbb5c62a2c27583cd38261c09fdc9c208f6ea96349e535b6c4135c0a8569, 2ec75fa569c0fa92add37c7221d700acd4bd70f5438154695ecccc4fd30b5e60, 3c387b216fe27eaadf788598e8071fdaad5cfa02419f7e068dcfaac0e78276b7, 4a06605651958c56e89a468f600c3322e3fdc97c8143bcfd1d8d1ebadb0920fb, 91c176db26a66a0ef8249a43d5ff9ccf76571cd965070baf8e72f96559f28289, a430089ee8c6d119ee90ca586626038d0e1e8b4fbd742440ce5c83d295f2fc46, b04266ca05e8125a1544e68c8852f7d44dde9c7e4f3b08a0383c0bf4ab6cfd2d, b52ee82c7e579fd73abc31c368462df9d99c6623be91526ee150706286dc19ee, d0f324e0267f7075e60f896cf064538e8398fb51557d2e1a53f348d39d10c3ac, d539b4957d8c03b6503357df836f1ed92fa37d73e19e0962d83b3dcba507f4bf, e08a98f79de70175f6bb4c319b70bc13063aa1f03780709393f4f6d498da9c0f, e600ebf1bdada253a31f59a9870b8aa18d9a985c390510bfe9219acb44da406d, ef7d80e4cc017ba0b8ca0cef2956ed762f4a3e8053d2569785bfaf735e9aecb9 | excludes:process.hash.sha256 |
process.parent.executable | wildcard | ?:\Program Files (x86)\Common Files\InstallShield\Engine\*\IKernel.exe, ?:\Program Files\Common Files\InstallShield\Engine\*\IKernel.exe, ?:\Windows\SysWOW64\PresentationHost.exe, ?:\Program Files (x86)\BL\BL\ACTIVEX.OUT.OF.PROCESS\*.exe, ?:\Program Files (x86)\Minitab\Minitab *\Mtb.exe, ?:\Program Files (x86)\Common Files\InstallShield\Driver\*\IDriver.exe, ?:\Program Files\Kerio\Outlook Connector (Offline Edition)\KoffBackend.exe | excludes:process.parent.executable |
Suspicious Execution via Windows Subsystem for Linux
#Detects Linux Bash commands from the Windows Subsystem for Linux. Adversaries may enable and use WSL for Linux to avoid detection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth | |
| Credential Access |
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 = "2023/01/13"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/08/03"
[rule]
author = ["Elastic"]
description = """
Detects Linux Bash commands from the Windows Subsystem for Linux. Adversaries may enable and use WSL for Linux to
avoid detection.
"""
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.process-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Execution via Windows Subsystem for Linux"
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 Execution via Windows Subsystem for Linux
Windows Subsystem for Linux (WSL) allows users to run Linux binaries natively on Windows, providing a seamless integration of Linux tools. Adversaries may exploit WSL to execute Linux commands stealthily, bypassing traditional Windows security measures. The detection rule identifies unusual WSL activity by monitoring specific executable paths, command-line arguments, and parent-child process relationships, flagging deviations from typical usage patterns to uncover potential threats.
### Possible investigation steps
- Review the process command line and executable path to determine if the execution of bash.exe or any other Linux binaries is expected or authorized for the user or system in question.
- Investigate the parent-child process relationship, especially focusing on whether wsl.exe is the parent process and if it has spawned any unexpected child processes that are not wslhost.exe.
- Examine the command-line arguments used with wsl.exe for any suspicious or unauthorized commands, such as accessing sensitive files like /etc/shadow or /etc/passwd, or using network tools like curl.
- Check the user's activity history and system logs to identify any patterns of behavior that might indicate misuse or compromise, particularly focusing on any deviations from typical usage patterns.
- Correlate the alert with other security events or logs from data sources like Elastic Endgame, Microsoft Defender XDR, or Sysmon to gather additional context and determine if this is part of a broader attack or isolated incident.
### False positive analysis
- Frequent use of WSL for legitimate development tasks may trigger alerts. Users can create exceptions for specific user accounts or directories commonly used for development to reduce noise.
- Automated scripts or tools that utilize WSL for system maintenance or monitoring might be flagged. Identify these scripts and whitelist their specific command-line patterns or parent processes.
- Docker-related processes may cause false positives due to their interaction with WSL. Exclude Docker executable paths from the detection rule to prevent unnecessary alerts.
- Visual Studio Code extensions that interact with WSL can generate alerts. Exclude known non-threatening extensions by specifying their command-line arguments in the exception list.
- Regular system updates or administrative tasks that involve WSL might be misidentified. Document these activities and adjust the detection rule to recognize them as benign.
### Response and remediation
- Isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious processes identified by the detection rule, such as those involving bash.exe or wsl.exe with unusual command-line arguments.
- Conduct a thorough review of the affected system's WSL configuration and installed Linux distributions to identify any unauthorized changes or installations.
- Remove any unauthorized or suspicious Linux binaries or scripts found within the WSL environment.
- Reset credentials for any accounts that may have been compromised, especially if sensitive files like /etc/shadow or /etc/passwd were accessed.
- 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 logging for WSL activities across the network to detect similar threats in the future, ensuring that alerts are promptly reviewed and acted upon."""
references = [
"https://blog.f-secure.com/hunting-for-windows-subsystem-for-linux/",
"https://lolbas-project.github.io/lolbas/OtherMSBinaries/Wsl/",
"https://blog.qualys.com/vulnerabilities-threat-research/2022/03/22/implications-of-windows-subsystem-for-linux-for-adversaries-defenders-part-1",
]
risk_score = 21
rule_id = "3e0eeb75-16e8-4f2f-9826-62461ca128b7"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Defense Evasion",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"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.executable : "?:\\Windows\\System32\\bash.exe" or ?process.pe.original_file_name == "Bash.exe") and
not process.command_line : ("bash", "bash.exe")
) or
process.executable : "?:\\Users\\*\\AppData\\Local\\Packages\\*\\rootfs\\usr\\bin\\bash" or
(
process.parent.name : "wsl.exe" and process.parent.command_line : "bash*" and not process.name : "wslhost.exe"
) or
(
process.name : "wsl.exe" and
(
process.args : "--system" or
(
process.args : "--manage" and process.args : "--set-default-user" and process.args : "root"
) or
(
(process.args : ("curl", "wget") and process.args : ("http://*", "https://*")) or
process.args : ("*curl*http://*", "*curl*https://*", "*wget*http://*", "*wget*https://*")
) or
(
(
process.args like~ ("*/dev/tcp/*", "*/dev/udp/*", "*zsh/net/tcp*") and
process.args like ("*&>*", "*<>*", "*>&*", "*<&*")
) or
(
process.args : ("nc", "netcat", "nc.traditional", "ncat", "*/nc", "*/netcat", "*/nc.traditional", "*/ncat") and
process.args : ("sh", "/bin/sh", "bash", "/bin/bash") and
process.args : ("-e", "--exec", "-c", "--sh-exec")
) or
(
process.args like~ "*socat*" and
process.args like~ ("*exec:*", "*system:*", "*shell:*") and
process.args like~ ("*tcp*", "*udp*", "*openssl*")
)
) or
(
process.args : ("-e", "--exec") and
process.args : (
"/mnt/c/*.exe", "/mnt/c/*.ps1", "/mnt/c/*.bat", "/mnt/c/*.cmd", "/mnt/c/*.vbs", "/mnt/c/*.js",
"/mnt/c/*.hta"
) and
not process.args : "*wslpath*"
) or
process.args : (
"*/etc/passwd*", "*/etc/shadow*", "*/etc/sudoers*", "*/etc/sudoers.d/*", "*/root/.ssh/*", "*/home/*/.ssh/*",
"*/root/.aws/credentials*", "*/home/*/.aws/credentials*", "*/root/.kube/config*", "*/home/*/.kube/config*",
"*/mnt/c/Windows/System32/config/SAM*",
"*/mnt/c/Windows/System32/config/SECURITY*",
"*/mnt/c/Windows/System32/config/SYSTEM", "*/mnt/c/Windows/System32/config/SYSTEM.*",
"*/mnt/c/Windows/NTDS/ntds.dit*",
"*/mnt/c/Users/*/AppData/Roaming/Microsoft/Credentials/*",
"*/mnt/c/Users/*/AppData/Local/Microsoft/Credentials/*",
"*/mnt/c/Users/*/AppData/Roaming/Microsoft/Protect/*",
"*/mnt/c/Users/*/.ssh/*",
"*/mnt/c/Users/*/.aws/credentials",
"*/mnt/c/Users/*/.azure/*",
"*/mnt/c/Users/*/.config/gcloud/*",
"*/mnt/c/Users/*/AppData/Local/Google/Chrome/User Data/*/Login Data*",
"*/mnt/c/Users/*/AppData/Local/Microsoft/Edge/User Data/*/Login Data*"
)
)
)
) and
not process.parent.executable : ("?:\\Program Files\\Docker\\*.exe", "?:\\Program Files (x86)\\Docker\\*.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:
- [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)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1202"
name = "Indirect Command Execution"
reference = "https://attack.mitre.org/techniques/T1202/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.008"
name = "/etc/passwd and /etc/shadow"
reference = "https://attack.mitre.org/techniques/T1003/008/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type : "start" and
(
(
(process.executable : "?:\\Windows\\System32\\bash.exe" or ?process.pe.original_file_name == "Bash.exe") and
not process.command_line : ("bash", "bash.exe")
) or
process.executable : "?:\\Users\\*\\AppData\\Local\\Packages\\*\\rootfs\\usr\\bin\\bash" or
(
process.parent.name : "wsl.exe" and process.parent.command_line : "bash*" and not process.name : "wslhost.exe"
) or
(
process.name : "wsl.exe" and
(
process.args : "--system" or
(
process.args : "--manage" and process.args : "--set-default-user" and process.args : "root"
) or
(
(process.args : ("curl", "wget") and process.args : ("http://*", "https://*")) or
process.args : ("*curl*http://*", "*curl*https://*", "*wget*http://*", "*wget*https://*")
) or
(
(
process.args like~ ("*/dev/tcp/*", "*/dev/udp/*", "*zsh/net/tcp*") and
process.args like ("*&>*", "*<>*", "*>&*", "*<&*")
) or
(
process.args : ("nc", "netcat", "nc.traditional", "ncat", "*/nc", "*/netcat", "*/nc.traditional", "*/ncat") and
process.args : ("sh", "/bin/sh", "bash", "/bin/bash") and
process.args : ("-e", "--exec", "-c", "--sh-exec")
) or
(
process.args like~ "*socat*" and
process.args like~ ("*exec:*", "*system:*", "*shell:*") and
process.args like~ ("*tcp*", "*udp*", "*openssl*")
)
) or
(
process.args : ("-e", "--exec") and
process.args : (
"/mnt/c/*.exe", "/mnt/c/*.ps1", "/mnt/c/*.bat", "/mnt/c/*.cmd", "/mnt/c/*.vbs", "/mnt/c/*.js",
"/mnt/c/*.hta"
) and
not process.args : "*wslpath*"
) or
process.args : (
"*/etc/passwd*", "*/etc/shadow*", "*/etc/sudoers*", "*/etc/sudoers.d/*", "*/root/.ssh/*", "*/home/*/.ssh/*",
"*/root/.aws/credentials*", "*/home/*/.aws/credentials*", "*/root/.kube/config*", "*/home/*/.kube/config*",
"*/mnt/c/Windows/System32/config/SAM*",
"*/mnt/c/Windows/System32/config/SECURITY*",
"*/mnt/c/Windows/System32/config/SYSTEM", "*/mnt/c/Windows/System32/config/SYSTEM.*",
"*/mnt/c/Windows/NTDS/ntds.dit*",
"*/mnt/c/Users/*/AppData/Roaming/Microsoft/Credentials/*",
"*/mnt/c/Users/*/AppData/Local/Microsoft/Credentials/*",
"*/mnt/c/Users/*/AppData/Roaming/Microsoft/Protect/*",
"*/mnt/c/Users/*/.ssh/*",
"*/mnt/c/Users/*/.aws/credentials",
"*/mnt/c/Users/*/.azure/*",
"*/mnt/c/Users/*/.config/gcloud/*",
"*/mnt/c/Users/*/AppData/Local/Google/Chrome/User Data/*/Login Data*",
"*/mnt/c/Users/*/AppData/Local/Microsoft/Edge/User Data/*/Login Data*"
)
)
)
) and
not process.parent.executable : ("?:\\Program Files\\Docker\\*.exe", "?:\\Program Files (x86)\\Docker\\*.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | wildcard |
| field:"event.type" kind:wildcard value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"wsl.exe" |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"bash*" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"wsl.exe" |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"Bash.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.executable | wildcard | ?:\Program Files\Docker\*.exe, ?:\Program Files (x86)\Docker\*.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Docker\*.exe" field:"process.parent.executable" value:"?:\Program Files (x86)\Docker\*.exe" |
Suspicious File Rename via SMB
#Identifies an incoming SMB connection followed by a suspicious file rename operation. This may indicate a remote ransomware attack via the SMB protocol.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Rule Body
[rule]
description = """
Identifies an incoming SMB connection followed by a suspicious file rename operation. This may indicate a remote
ransomware attack via the SMB protocol.
"""
id = "58b7beb4-0b8a-4196-a17d-7317620ef495"
license = "Elastic License v2"
name = "Suspicious File Rename via SMB"
os_list = ["windows"]
version = "1.0.6"
query = '''
sequence with maxspan=3s
[network where event.action == "connection_accepted" and destination.port == 445 and source.port >= 49152 and
process.pid == 4 and network.type == "ipv4" and not endswith(source.address, destination.address) and
source.ip != "127.0.0.1" and source.ip != "::1" ]
[file where event.action == "rename" and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and
file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk", "*.txt") and
not file.extension in~ ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk", "txt")]
[file where event.action == "rename" and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and
file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk", "*.txt") and
not file.extension in~ ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk", "txt")]
'''
actions = []
min_endpoint_version = "8.4.0"
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"
[[threat.technique]]
id = "T1490"
name = "Inhibit System Recovery"
reference = "https://attack.mitre.org/techniques/T1490/"
[threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Stage 1: network
[network where event.action == "connection_accepted" and destination.port == 445 and source.port >= 49152 and
process.pid == 4 and network.type == "ipv4" and not endswith(source.address, destination.address) and
source.ip != "127.0.0.1" and source.ip != "::1" ]
Stage 2: file
[file where event.action == "rename" and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and
file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk", "*.txt") and
not file.extension in~ ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk", "txt")]
Stage 3: file
[file where event.action == "rename" and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and
file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk", "*.txt") and
not file.extension in~ ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk", "txt")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | eq |
| field:"DestinationPort" kind:eq value:"445" |
event.action | eq |
| field:"EventType" kind:eq |
file.Ext.entropy | ge |
| field:"file.Ext.entropy" kind:ge value:"6" |
file.Ext.original.name | wildcard |
| field:"file.Ext.original.name" kind:wildcard |
file.extension | is_not_null | field:"file.extension" kind:is_not_null | |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"C:\Users\*" |
network.type | eq |
| field:"network.type" kind:eq value:"ipv4" |
process.pid | eq |
| field:"process_id" kind:eq value:"4" |
source.ip | ne |
| field:"src_ip" kind:ne |
source.port | ge |
| field:"SourcePort" kind:ge value:"49152" |
user.id | wildcard |
| field:"user.id" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
source.address | ends_with | destination.address | excludes:source.address field:"source.address" value:"destination.address" |
file.extension | in | bmp, doc, docx, jpg, lnk, pdf, png, ppt, pptx, txt, xls, xlsx | excludes:file.extension |
Suspicious Windows Command Shell Arguments
#Identifies the execution of the Windows Command Shell process (cmd.exe) with suspicious argument values. This behavior is often observed during malware installation.
MITRE ATT&CK Coverage
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/09/06"
integration = ["windows", "system", "sentinel_one_cloud_funnel", "m365_defender", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Identifies the execution of the Windows Command Shell process (cmd.exe) with suspicious argument values. This behavior
is often observed during malware installation.
"""
from = "now-9m"
index = [
"logs-crowdstrike.fdr*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
"endgame-*",
]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Windows Command Shell Arguments"
risk_score = 73
rule_id = "d9ffc3d6-9de9-4b29-9395-5757d0695ecf"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Resources: Investigation Guide",
"Data Source: Windows Security Event Logs",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Microsoft Defender XDR",
"Data Source: Elastic Endgame",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : "cmd.exe" and
(
process.command_line : (
"*).Run(*", "*GetObject*", "* curl*regsvr32*", "*echo*wscript*", "*echo*ZONE.identifier*",
"*ActiveXObject*", "*dir /s /b *echo*", "*unescape(*", "*findstr*TVNDRgAAAA*", "*findstr*passw*", "*start*\\\\*\\DavWWWRoot\\*",
"* explorer*%CD%*", "*%cd%\\*.js*", "*attrib*%CD%*", "*/?cMD<*", "*/AutoIt3ExecuteScript*..*", "*&cls&cls&cls&cls&cls&*",
"**;*;*;*;*", "* &&s^eT*", "*& ChrW(*", "*&explorer /root*", "*start __ & __\\*", "*findstr /V /L *forfiles*",
"*=wscri& set *", "*http*!COmpUternaME!*", "*start *.pdf * start /min cmd.exe /c *\\\\*", "*pip install*System.Net.WebClient*",
"*Invoke-WebReques*Start-Process*", "*-command (Invoke-webrequest*", "*copy /b *\\\\* ping *-n*", "*echo*.ToCharArray*"
) or
(process.args : "echo" and process.parent.name : ("wscript.exe", "mshta.exe")) or
process.args : ("1>?:\\*.vbs", "1>?:\\*.js") or
(process.args : "explorer.exe" and process.args : "type" and process.args : ">" and process.args : "start") or
(
process.parent.name : "explorer.exe" and
process.command_line : (
"*&&S^eT *",
"*&& set *&& set *&& set *&& set *&& set *&& call*",
"**\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??*"
)
) or
(process.parent.name : "explorer.exe" and process.args : "copy" and process.args : "&&" and process.args : "\\\\*@*\\*")
) and
/* false positives */
not (process.args : "%TEMP%\\Spiceworks\\*" and process.parent.name : "wmiprvse.exe") and
not ?process.parent.executable : (
"?:\\Perl64\\bin\\perl.exe",
"?:\\Program Files\\nodejs\\node.exe",
"?:\\Program Files\\HP\\RS\\pgsql\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\64 bit\\PRTG Server.exe",
"?:\\Program Files (x86)\\Spiceworks\\bin\\spiceworks-finder.exe",
"?:\\Program Files (x86)\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files\\Tripwire\\Agent\\Plugins\\twexec\\twexec.exe",
"D:\\Agents\\?\\_work\\_tasks\\*\\SonarScanner.MSBuild.exe",
"?:\\Program Files\\Microsoft VS Code\\Code.exe",
"?:\\programmiweb\\NetBeans-*\\netbeans\\bin\\netbeans64.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files\\NetBeans-*\\netbeans\\bin\\netbeans*.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files (x86)\\Helpdesk Button\\button_gui.exe",
"?:\\VTSPortable\\VTS\\jre\\bin\\javaw.exe",
"?:\\Program Files\\Bot Framework Composer\\Bot Framework Composer.exe",
"?:\\Program Files\\KMSYS Worldwide\\eQuate\\*\\SessionMgr.exe",
"?:\\Program Files (x86)\\Craneware\\Pricing Analyzer\\Craneware.Pricing.Shell.exe",
"?:\\Program Files (x86)\\jumpcloud-agent-app\\jumpcloud-agent-app.exe",
"?:\\Program Files\\PostgreSQL\\*\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\Vim\\vim*\\vimrun.exe") and
not (
/* Crowdstrike doesn't populate process.parent.executable */
data_stream.dataset == "crowdstrike.fdr" and
process.parent.name : (
"perl.exe", "node.exe", "pg_dumpall.exe", "PRTG Server.exe", "spiceworks-finder.exe", "leds.exe", "twexec.exe",
"SonarScanner.MSBuild.exe", "Code.exe", "netbeans64.exe", "javaw.exe", "Bot Framework Composer.exe", "SessionMgr.exe",
"Craneware.Pricing.Shell.exe", "jumpcloud-agent-app.exe", "vimrun.exe"
)
) and
not (process.args : "?:\\Program Files\\Citrix\\Secure Access Client\\nsauto.exe" and process.parent.name : "userinit.exe") and
not process.args : (
"?:\\Program Files (x86)\\PCMatic\\PCPitstopScheduleService.exe",
"?:\\Program Files (x86)\\AllesTechnologyAgent\\*",
"https://auth.axis.com/oauth2/oauth-authorize*"
) and
not process.command_line : (
"\"cmd\" /c %NETBEANS_MAVEN_COMMAND_LINE%",
"?:\\Windows\\system32\\cmd.exe /q /d /s /c \"npm.cmd ^\"install^\" ^\"--no-bin-links^\" ^\"--production^\"\""
) and
not (process.name : "cmd.exe" and process.args : "%TEMP%\\Spiceworks\\*" and process.args : "http*/dataloader/persist_netstat_data") and
not (process.args == "echo" and process.args == "GEQ" and process.args == "1073741824")
'''
note = """## Triage and analysis
### Investigating Suspicious Windows Command Shell Arguments
#### Possible investigation steps
- What abuse path and launch context does the alerting "cmd.exe" show?
- Focus: `process.command_line`, `process.args`, `process.executable`, `process.parent.executable`, and `process.parent.command_line`; classify reconstruction, remote retrieval, WebDAV or UNC execution, obfuscated environment setup, or handoff to "regsvr32.exe", "wscript.exe", "mshta.exe", PowerShell, or AutoIt.
- Implication: escalate when the command reconstructs scripts, pulls remote content, starts from a remote share, chains to proxy execution, runs from a non-native path, or has a parent conflicting with command purpose; lower suspicion only when parent-command, user-host, child, artifact, and destination evidence form one consistent current activity. Identity or recurrence alone does not clear suspicious arguments.
- Did the same "cmd.exe" instance launch a second stage?
- Focus: child starts where `host.id` and `process.parent.entity_id` map to `process.entity_id`; review child `process.executable` and `process.command_line`. $investigate_2
- Hint: if `process.entity_id` is absent, use `host.id` plus `process.pid` in a tight alert-time window.
- Implication: escalate when the shell launches PowerShell, "regsvr32.exe", "wscript.exe", "mshta.exe", archive tools, script files, or newly staged payloads; lower suspicion when no child follows or stays inside the parent directory or command-named output path.
- If endpoint file telemetry is available, did the shell reconstruct or stage executable content?
- Focus: file activity tied to `process.entity_id` or, if needed, `host.id` plus `process.pid`, checking `file.path`, `file.Ext.original.path`, `file.Ext.header_bytes`, and `file.Ext.windows.zone_identifier`. $investigate_4
- Implication: escalate when the shell writes scriptable files, rebuilds archive or PE content, renames staged payloads, or leaves internet-marked content in temp, public, or user-writable paths; lower suspicion when paths stay under the parent directory or command-named output path and no written content later executes. Missing file telemetry is unresolved, not benign.
- If endpoint network telemetry is available, did the shell retrieve content or execute from WebDAV or UNC infrastructure?
- Focus: process-scoped DNS and connections for `host.id` and `process.entity_id`; compare DNS `dns.question.name` or `dns.resolved_ip` and connection `destination.ip` or `destination.port` with UNC, "DavWWWRoot", or URL fragments in `process.command_line`. $investigate_3
- Hint: if `dns.resolved_ip` is present, correlate it to `destination.ip` on the same host and process before judging the destination.
- Implication: escalate when the shell reaches rare public hosts, unexpected WebDAV endpoints, or shares unrelated to the parent; lower suspicion when DNS and connections match the share, URL, or host pattern visible in the command and parent. Missing network telemetry is unresolved, not benign.
- If local findings remain suspicious or unresolved, does the pattern recur on the same host or user?
- Focus: recent alerts for the same `host.id`, emphasizing execution, delivery, persistence, or proxy-execution detections that reuse the same command-shell pattern. $investigate_0
- Hint: if the host is shared or quiet, compare recent alerts for the same `user.id` to test whether the user carries the pattern to other systems. $investigate_1
- Implication: broaden scope when the same host or user also shows delivery, shell, or persistence alerts; keep local when related alerts are clean and telemetry binds one parent-command, child, artifact, destination, and user-host tuple.
- What disposition does the parent-command, child, artifact, destination, and user-host tuple support?
- Escalate for staged execution, remote retrieval, script reconstruction, proxy execution, or broader compromise; close only when alert-local command, parent, child, artifact, destination, user-host, and related-alert evidence bind one exact benign tuple with no contradictions. Preserve evidence and escalate on conflicts or incomplete visibility.
### False positive analysis
- Packaging, build, installer, or developer activity can use "cmd.exe" to reconstruct files, call package managers, or hand off to helper utilities. Confirm `process.parent.executable`, `process.parent.command_line`, `process.command_line`, `user.id`, and `host.id` align with the same current parent path, helper command, package cache, build output, or database-export output, and that recovered child, file, or destination evidence does not conflict. Build records or change tickets are corroboration only.
- Remote-support or software-distribution activity can reference UNC paths or "DavWWWRoot". When network or file telemetry exists, confirm `process.command_line`, `process.parent.executable`, `host.id`, and any recovered `dns.question.name`, `destination.ip`, or `file.path` stay inside one current distribution share, vendor endpoint, support-client cache, or deployment path and no unexpected child appears. Missing file or network telemetry is unresolved, not benign. Support records or inventories are corroboration only.
- Before creating an exception, validate that the same `process.parent.executable`, `process.command_line`, `user.id`, `host.id`, and recovered artifact or destination anchors recur across prior alerts from this rule. Avoid exceptions on "cmd.exe" alone, one argument token, one destination, or parent name.
### Response and remediation
- If confirmed benign, reverse temporary containment and document the parent command, alerting command, user-host scope, and recovered artifact or destination evidence. Create an exception only after the same tuple is stable across prior alerts from this rule.
- If suspicious but unconfirmed, preserve the alert, Timeline records, full command lines, process tree, recovered child details, staged files, and DNS or connection evidence before destructive action. Apply reversible containment first, such as temporary destination restrictions or heightened monitoring on `host.id` and `user.id`; isolate only when follow-on execution, staged payloads, or remote retrieval justifies disruption.
- If confirmed malicious, isolate the host when identity, lineage, artifact, or destination evidence establishes unauthorized execution, then block confirmed malicious domains, destinations, or hashes. Record malicious shell and child identifiers before termination, scope related hosts and users before artifact removal, then remove only the scripts, archives, rebuilt payloads, persistence artifacts, or launcher components identified during the investigation.
- Post-incident hardening: retain process, file, and network telemetry. If browser, explorer, script-host, or AutoIt launch paths were involved, review controls for user-driven shell launches; if WebDAV, UNC, or URL retrieval was involved, review remote-share and WebDAV execution controls. Note adjacent "mshta.exe", "wscript.exe", "regsvr32.exe", PowerShell, AutoIt, and explorer-driven clickfix-style variants for future triage.
"""
setup = """## Setup
This rule requires telemetry from one of the configured source integrations to be enabled and ingested.
### Supported data sources
This rule can use the following 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.id",
"user.id",
"process.entity_id",
"process.pid",
"process.executable",
"process.command_line",
"process.args",
"process.parent.name",
"process.parent.executable",
"process.parent.command_line",
"process.parent.args",
]
[transform]
[[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 = "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 = "Child process starts from the same cmd.exe instance"
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.parent.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.parent.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Network activity for the alerting cmd.exe instance"
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" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "File activity for the alerting cmd.exe instance"
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 = "file", 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" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[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.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[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/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[[rule.threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.name : "cmd.exe" and
(
process.command_line : (
"*).Run(*", "*GetObject*", "* curl*regsvr32*", "*echo*wscript*", "*echo*ZONE.identifier*",
"*ActiveXObject*", "*dir /s /b *echo*", "*unescape(*", "*findstr*TVNDRgAAAA*", "*findstr*passw*", "*start*\\\\*\\DavWWWRoot\\*",
"* explorer*%CD%*", "*%cd%\\*.js*", "*attrib*%CD%*", "*/?cMD<*", "*/AutoIt3ExecuteScript*..*", "*&cls&cls&cls&cls&cls&*",
"**;*;*;*;*", "* &&s^eT*", "*& ChrW(*", "*&explorer /root*", "*start __ & __\\*", "*findstr /V /L *forfiles*",
"*=wscri& set *", "*http*!COmpUternaME!*", "*start *.pdf * start /min cmd.exe /c *\\\\*", "*pip install*System.Net.WebClient*",
"*Invoke-WebReques*Start-Process*", "*-command (Invoke-webrequest*", "*copy /b *\\\\* ping *-n*", "*echo*.ToCharArray*"
) or
(process.args : "echo" and process.parent.name : ("wscript.exe", "mshta.exe")) or
process.args : ("1>?:\\*.vbs", "1>?:\\*.js") or
(process.args : "explorer.exe" and process.args : "type" and process.args : ">" and process.args : "start") or
(
process.parent.name : "explorer.exe" and
process.command_line : (
"*&&S^eT *",
"*&& set *&& set *&& set *&& set *&& set *&& call*",
"**\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??*"
)
) or
(process.parent.name : "explorer.exe" and process.args : "copy" and process.args : "&&" and process.args : "\\\\*@*\\*")
) and
not (process.args : "%TEMP%\\Spiceworks\\*" and process.parent.name : "wmiprvse.exe") and
not ?process.parent.executable : (
"?:\\Perl64\\bin\\perl.exe",
"?:\\Program Files\\nodejs\\node.exe",
"?:\\Program Files\\HP\\RS\\pgsql\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\64 bit\\PRTG Server.exe",
"?:\\Program Files (x86)\\Spiceworks\\bin\\spiceworks-finder.exe",
"?:\\Program Files (x86)\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files\\Tripwire\\Agent\\Plugins\\twexec\\twexec.exe",
"D:\\Agents\\?\\_work\\_tasks\\*\\SonarScanner.MSBuild.exe",
"?:\\Program Files\\Microsoft VS Code\\Code.exe",
"?:\\programmiweb\\NetBeans-*\\netbeans\\bin\\netbeans64.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files\\NetBeans-*\\netbeans\\bin\\netbeans*.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files (x86)\\Helpdesk Button\\button_gui.exe",
"?:\\VTSPortable\\VTS\\jre\\bin\\javaw.exe",
"?:\\Program Files\\Bot Framework Composer\\Bot Framework Composer.exe",
"?:\\Program Files\\KMSYS Worldwide\\eQuate\\*\\SessionMgr.exe",
"?:\\Program Files (x86)\\Craneware\\Pricing Analyzer\\Craneware.Pricing.Shell.exe",
"?:\\Program Files (x86)\\jumpcloud-agent-app\\jumpcloud-agent-app.exe",
"?:\\Program Files\\PostgreSQL\\*\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\Vim\\vim*\\vimrun.exe") and
not (
data_stream.dataset == "crowdstrike.fdr" and
process.parent.name : (
"perl.exe", "node.exe", "pg_dumpall.exe", "PRTG Server.exe", "spiceworks-finder.exe", "leds.exe", "twexec.exe",
"SonarScanner.MSBuild.exe", "Code.exe", "netbeans64.exe", "javaw.exe", "Bot Framework Composer.exe", "SessionMgr.exe",
"Craneware.Pricing.Shell.exe", "jumpcloud-agent-app.exe", "vimrun.exe"
)
) and
not (process.args : "?:\\Program Files\\Citrix\\Secure Access Client\\nsauto.exe" and process.parent.name : "userinit.exe") and
not process.args : (
"?:\\Program Files (x86)\\PCMatic\\PCPitstopScheduleService.exe",
"?:\\Program Files (x86)\\AllesTechnologyAgent\\*",
"https://auth.axis.com/oauth2/oauth-authorize*"
) and
not process.command_line : (
"\"cmd\" /c %NETBEANS_MAVEN_COMMAND_LINE%",
"?:\\Windows\\system32\\cmd.exe /q /d /s /c \"npm.cmd ^\"install^\" ^\"--no-bin-links^\" ^\"--production^\"\""
) and
not (process.name : "cmd.exe" and process.args : "%TEMP%\\Spiceworks\\*" and process.args : "http*/dataloader/persist_netstat_data") and
not (process.args == "echo" and process.args == "GEQ" and process.args == "1073741824")
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.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"cmd.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
data_stream.dataset | eq | crowdstrike.fdr | excludes:data_stream.dataset field:"data_stream.dataset" value:"crowdstrike.fdr" |
process.parent.name | eq | perl.exe, node.exe, pg_dumpall.exe, PRTG Server.exe, spiceworks-finder.exe, leds.exe, twexec.exe, SonarScanner.MSBuild.exe, Code.exe, netbeans64.exe, javaw.exe, Bot Framework Composer.exe, SessionMgr.exe, Craneware.Pricing.Shell.exe, jumpcloud-agent-app.exe, vimrun.exe | excludes:process.parent.name |
process.args | eq | 1073741824 | excludes:process.args field:"process.args" value:"1073741824" |
process.args | eq | GEQ | excludes:process.args field:"process.args" value:"GEQ" |
process.args | eq | echo | excludes:process.args field:"process.args" value:"echo" |
process.args | eq | ?:\Program Files\Citrix\Secure Access Client\nsauto.exe | excludes:process.args field:"process.args" value:"?:\Program Files\Citrix\Secure Access Client\nsauto.exe" |
process.parent.name | eq | userinit.exe | excludes:process.parent.name field:"process.parent.name" value:"userinit.exe" |
process.args | starts_with | %TEMP%\Spiceworks\ | excludes:process.args field:"process.args" value:"%TEMP%\Spiceworks\" |
process.args | wildcard | http*/dataloader/persist_netstat_data | excludes:process.args field:"process.args" value:"http*/dataloader/persist_netstat_data" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.parent.name | eq | wmiprvse.exe | excludes:process.parent.name field:"process.parent.name" value:"wmiprvse.exe" |
process.args | wildcard | ?:\Program Files (x86)\PCMatic\PCPitstopScheduleService.exe, ?:\Program Files (x86)\AllesTechnologyAgent\*, https://auth.axis.com/oauth2/oauth-authorize* | excludes:process.args field:"process.args" value:"?:\Program Files (x86)\PCMatic\PCPitstopScheduleService.exe" field:"process.args" value:"?:\Program Files (x86)\AllesTechnologyAgent\*" field:"process.args" value:"https://auth.axis.com/oauth2/oauth-authorize*" |
process.command_line | eq | "cmd" /c %NETBEANS_MAVEN_COMMAND_LINE%, ?:\Windows\system32\cmd.exe /q /d /s /c "npm.cmd ^"install^" ^"--no-bin-links^" ^"--production^"" | excludes:process.command_line |
process.parent.executable | wildcard | ?:\Perl64\bin\perl.exe, ?:\Program Files\nodejs\node.exe, ?:\Program Files\HP\RS\pgsql\bin\pg_dumpall.exe, ?:\Program Files (x86)\PRTG Network Monitor\64 bit\PRTG Server.exe, ?:\Program Files (x86)\Spiceworks\bin\spiceworks-finder.exe, ?:\Program Files (x86)\Zuercher Suite\production\leds\leds.exe, ?:\Program Files\Tripwire\Agent\Plugins\twexec\twexec.exe, D:\Agents\?\_work\_tasks\*\SonarScanner.MSBuild.exe, ?:\Program Files\Microsoft VS Code\Code.exe, ?:\programmiweb\NetBeans-*\netbeans\bin\netbeans64.exe, ?:\Program Files (x86)\Public Safety Suite Professional\production\leds\leds.exe, ?:\Program Files (x86)\Tier2Tickets\button_gui.exe, ?:\Program Files\NetBeans-*\netbeans\bin\netbeans*.exe, ?:\Program Files (x86)\Public Safety Suite Professional\production\leds\leds.exe, ?:\Program Files (x86)\Tier2Tickets\button_gui.exe, ?:\Program Files (x86)\Helpdesk Button\button_gui.exe, ?:\VTSPortable\VTS\jre\bin\javaw.exe, ?:\Program Files\Bot Framework Composer\Bot Framework Composer.exe, ?:\Program Files\KMSYS Worldwide\eQuate\*\SessionMgr.exe, ?:\Program Files (x86)\Craneware\Pricing Analyzer\Craneware.Pricing.Shell.exe, ?:\Program Files (x86)\jumpcloud-agent-app\jumpcloud-agent-app.exe, ?:\Program Files\PostgreSQL\*\bin\pg_dumpall.exe, ?:\Program Files (x86)\Vim\vim*\vimrun.exe | excludes:process.parent.executable |
Unusual Linux Username
#A machine learning job detected activity for a username that is not normally active, which can indicate unauthorized changes, activity by unauthorized users, lateral movement, or compromised credentials. In many organizations, new usernames are not often created apart from specific types of system activities, such as creating new accounts for new employees. These user accounts quickly become active and routine. Events from rarely used usernames can point to suspicious activity. Additionally, automated Linux fleets tend to see activity from rarely used usernames only when personnel log in to make authorized or unauthorized changes, or threat actors have acquired credentials and log in for malicious purposes. Unusual usernames can also indicate pivoting, where compromised credentials are used to try and move laterally from one host to another.
Known False Positives
- Uncommon user activity can be due to an engineer logging onto a server instance in order to perform manual troubleshooting or reconfiguration.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule Body
[metadata]
creation_date = "2020/03/25"
integration = ["auditd_manager", "endpoint"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 50
author = ["Elastic"]
description = """
A machine learning job detected activity for a username that is not normally active, which can indicate unauthorized
changes, activity by unauthorized users, lateral movement, or compromised credentials. In many organizations, new
usernames are not often created apart from specific types of system activities, such as creating new accounts for new
employees. These user accounts quickly become active and routine. Events from rarely used usernames can point to
suspicious activity. Additionally, automated Linux fleets tend to see activity from rarely used usernames only when
personnel log in to make authorized or unauthorized changes, or threat actors have acquired credentials and log in for
malicious purposes. Unusual usernames can also indicate pivoting, where compromised credentials are used to try and move
laterally from one host to another.
"""
false_positives = [
"""
Uncommon user activity can be due to an engineer logging onto a server instance in order to perform manual
troubleshooting or reconfiguration.
""",
]
from = "now-45m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = ["v3_linux_anomalous_user_name_ea"]
name = "Unusual Linux Username"
setup = """## Setup
This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
- Elastic Defend
- Auditd Manager
### Anomaly Detection Setup
Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).
### 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 to your 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, either "Traditional Endpoints" or "Cloud Workloads".
- 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).
### Auditd Manager Integration Setup
The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel.
Auditd Manager provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system.
#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Auditd Manager” and select the integration to see more details about it.
- Click “Add Auditd Manager”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “auditd manager” to an existing or a new agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager).
#### Rule Specific Setup Note
Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration.
However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
- For this detection rule no additional audit rules are required.
"""
note = """## Triage and analysis
### Investigating Unusual Linux Username
Detection alerts from this rule indicate activity for a Linux user name that is rare and unusual. Here are some possible avenues of investigation:
- Consider the user as identified by the username field. Is this program part of an expected workflow for the user who ran this program on this host? Could this be related to troubleshooting or debugging activity by a developer or site reliability engineer?
- Examine the history of user activity. If this user only manifested recently, it might be a service account for a new software package. If it has a consistent cadence (for example if it runs monthly or quarterly), it might be part of a monthly or quarterly business process.
- Examine the process arguments, title and working directory. These may provide indications as to the source of the program or the nature of the tasks that the user is performing."""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "b347b919-665f-4aac-b9e8-68369bf2340c"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Data Source: Elastic Defend",
"Data Source: Auditd Manager",
"Use Case: Threat Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Initial Access",
"Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
User TCC DB Access by Osascript
#Detects the attempt to access or open the users TCC database by the Osascript binary. This activity may indicate the presence of a malicious payload attempting to bypass TCC or gain awareness of system permissions in place.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Discovery |
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 = """
Detects the attempt to access or open the users TCC database by the Osascript binary. This activity may indicate the
presence of a malicious payload attempting to bypass TCC or gain awareness of system permissions in place.
"""
id = "e5c7649a-9585-4626-833c-90f96489a9ba"
license = "Elastic License v2"
name = "User TCC DB Access by Osascript"
os_list = ["macos"]
reference = ["https://github.com/cedowens/SwiftBelt-JXA/blob/main/SwiftBelt-JXA.js"]
version = "1.0.5"
query = '''
file where event.action == "open" and process.executable != null and
file.path like~ "/Users/*/Library/Application Support/com.apple.TCC/TCC.db" and
process.name == "osascript"
'''
min_endpoint_version = "8.10.2"
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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[[threat.technique]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.006"
name = "TCC Manipulation"
reference = "https://attack.mitre.org/techniques/T1548/006/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"
[[threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: file
file where event.action == "open" and process.executable != null and
file.path like~ "/Users/*/Library/Application Support/com.apple.TCC/TCC.db" 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/com.apple.TCC/TCC.db" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.name | eq |
| field:"process_basename" kind:eq value:"osascript" |
Windows CryptoAPI Spoofing Vulnerability (CVE-2020-0601 - CurveBall)
#A spoofing vulnerability exists in the way Windows CryptoAPI (Crypt32.dll) validates Elliptic Curve Cryptography (ECC) certificates. An attacker could exploit the vulnerability by using a spoofed code-signing certificate to sign a malicious executable, making it appear the file was from a trusted, legitimate source.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Rule Body
[metadata]
creation_date = "2020/03/19"
integration = ["windows", "system"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
A spoofing vulnerability exists in the way Windows CryptoAPI (Crypt32.dll) validates Elliptic Curve Cryptography (ECC)
certificates. An attacker could exploit the vulnerability by using a spoofed code-signing certificate to sign a
malicious executable, making it appear the file was from a trusted, legitimate source.
"""
index = ["winlogbeat-*", "logs-windows.forwarded*", "logs-system.security*"]
language = "kuery"
license = "Elastic License v2"
name = "Windows CryptoAPI Spoofing Vulnerability (CVE-2020-0601 - CurveBall)"
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 Windows CryptoAPI Spoofing Vulnerability (CVE-2020-0601 - CurveBall)
The Windows CryptoAPI is crucial for validating ECC certificates, ensuring secure communications and software authenticity. CVE-2020-0601, known as CurveBall, exposes a flaw where attackers can craft fake certificates, misleading systems into trusting malicious software. The detection rule identifies exploitation attempts by monitoring specific event logs and messages linked to this vulnerability, focusing on defense evasion tactics.
### Possible investigation steps
- Review the event logs filtered by event.provider:"Microsoft-Windows-Audit-CVE" and message:"[CVE-2020-0601]" to identify the specific instances of the vulnerability being triggered.
- Analyze the host.os.type:windows field to determine which Windows systems are affected and prioritize them based on their criticality and exposure.
- Examine the details of the spoofed certificates involved in the alert to understand the scope and potential impact of the attack.
- Investigate any associated processes or executables that were signed with the spoofed certificates to assess if malicious software was executed.
- Check for any recent changes or updates to Crypt32.dll on the affected systems to ensure they are patched against CVE-2020-0601.
- Correlate the findings with other security events or alerts to identify any patterns or additional indicators of compromise related to defense evasion tactics.
### False positive analysis
- Legitimate software updates or installations may trigger alerts if they use ECC certificates similar to those exploited in the vulnerability. Users can create exceptions for known trusted software vendors to reduce noise.
- Internal testing environments that simulate certificate validation processes might generate false positives. Exclude these environments from monitoring or adjust the rule to ignore specific test-related events.
- Security tools or scripts that perform certificate validation checks could inadvertently match the detection criteria. Identify and whitelist these tools to prevent unnecessary alerts.
- Regular system maintenance activities involving certificate updates might be flagged. Schedule these activities during known maintenance windows and temporarily adjust monitoring rules to avoid false positives.
### Response and remediation
- Immediately isolate affected systems from the network to prevent further exploitation or spread of malicious software.
- Revoke any certificates identified as spoofed or compromised and update the certificate trust list to prevent future misuse.
- Apply the latest security patches from Microsoft to all affected systems to address the CVE-2020-0601 vulnerability.
- Conduct a thorough scan of the isolated systems using updated antivirus and endpoint detection tools to identify and remove any malicious software.
- Review and update endpoint protection configurations to ensure they are set to detect and block similar spoofing attempts.
- Escalate the incident to the security operations center (SOC) for further analysis and to determine if additional systems may be affected.
- Implement enhanced monitoring for signs of defense evasion tactics, focusing on event logs and messages related to certificate validation processes."""
risk_score = 21
rule_id = "56557cde-d923-4b88-adee-c61b3f3b5dc3"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Use Case: Vulnerability",
"Data Source: Windows Security Event Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.provider:"Microsoft-Windows-Audit-CVE" and message:"[CVE-2020-0601]" and host.os.type:windows
'''
setup = """## Setup
Audit Process Creation and Command Line must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-process-creation
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[rule.threat.technique.subtechnique]]
id = "T1553.002"
name = "Code Signing"
reference = "https://attack.mitre.org/techniques/T1553/002/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
event.provider:"Microsoft-Windows-Audit-CVE" and message:"[CVE-2020-0601]" and host.os.type:windows
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.provider | eq |
| field:"Provider_Name" kind:eq value:"Microsoft-Windows-Audit-CVE" |
message | eq |
| field:"message" kind:eq value:"[CVE-2020-0601]" |
Wireless Credential Dumping using Netsh Command
#Identifies attempts to dump Wireless saved access keys in clear text using the Windows built-in utility Netsh.
MITRE ATT&CK Coverage
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 = "2022/11/01"
integration = ["endpoint", "system", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/04/27"
[rule]
author = ["Elastic"]
description = "Identifies attempts to dump Wireless saved access keys in clear text using the Windows built-in utility Netsh."
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 = "Wireless Credential Dumping using Netsh Command"
references = [
"https://learn.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-contexts",
"https://www.geeksforgeeks.org/how-to-find-the-wi-fi-password-using-cmd-in-windows/",
]
risk_score = 73
rule_id = "2de87d72-ee0c-43e2-b975-5f0b029ac600"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Tactic: Discovery",
"Data Source: Elastic Endgame",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
(process.name : "netsh.exe" or ?process.pe.original_file_name == "netsh.exe") and
process.args : "wlan" and process.args : "key*clear"
'''
note = """## Triage and analysis
### Investigating Wireless Credential Dumping using Netsh Command
#### Possible investigation steps
- What did the alert-local netsh command expose or export?
- Focus: `process.command_line`, `process.executable`, `process.pe.original_file_name`, `process.code_signature.subject_name`.
- Implication: escalate when `key=clear` appears with bulk profile listing, `export profile`, omitted profile name, remote `-r`, script-file `-f`, or redirection; lower concern only when one local profile display fits recognized support or recovery. A signed Microsoft binary does not clear credential exposure.
- Does the launcher, session, and user context explain why this account retrieved a wireless key on this host?
- Focus: `process.parent.executable`, `process.parent.command_line`, `process.Ext.session_info.logon_type`, `user.id`, `host.id`.
- Implication: escalate when the parent is a shell, script host, remote-admin chain, document-spawned process, unexpected service identity, or unusual device-support user; lower concern when an interactive support shell or endpoint-management parent on the same host explains the exact command.
- Did the same launcher fan out from one display command into broader wireless-profile collection?
- Why: attackers often enumerate profile names with `wlan show profiles`, then display or export cleartext secrets; same-launcher enumeration without `key=clear` is precursor discovery.
- Focus: related process starts on `host.id` and `process.parent.entity_id`, using `process.executable` and `process.command_line`. $investigate_0
- Implication: escalate when the parent also runs profile enumeration, repeated `show profile`, `export profile`, or export without `name=`; keep review local when activity stays isolated to one profile display.
- Hint: If `process.parent.entity_id` is absent, pivot with `host.id`, `process.parent.pid`, and the alert window.
- Did the launcher or siblings stage recovered wireless material?
- Focus: same-parent process starts on `host.id`, using `process.executable` and `process.command_line`; file events from `host.id` plus `process.entity_id` or weaker `process.pid`, reviewing `file.path`, `file.extension`, and `file.size`. $investigate_1
- Implication: escalate when XML, redirected text, ZIP files, copied profiles, archive tools, copy utilities, cloud-sync clients, shell redirection, or script wrappers stage material for later use or transfer; missing file telemetry is unresolved, not benign. A clean file view lowers concern only when command and lineage also stay limited.
- If local evidence remains suspicious or unresolved, do related alerts change scope or urgency?
- Focus: related alerts for `user.id`, especially credential-access, lateral-movement, staging, remote-access, or persistence findings. $investigate_2
- Implication: broaden response when the same user or host also shows dumping, staging, remote access, or persistence; keep scope local when related alerts are absent and local evidence supports one bounded workflow.
- Hint: If the user view is sparse or the host is shared, review alerts for the same `host.id`. $investigate_3
- Escalate when command intent, lineage, same-launcher collection, staging, file artifacts, or related alerts show bulk credential access or broader compromise; close only when binary identity, command scope, parent workflow, user-host context, and recovery records bind to one recognized support or recovery action; preserve artifacts and escalate when evidence is mixed or incomplete.
### False positive analysis
- Helpdesk, field-support, device-recovery, imaging, hardware replacement, or Wi-Fi profile migration can retrieve one saved wireless key. Confirm signed netsh identity, one local profile display or expected export in `process.command_line`, support-tooling parentage, and no bulk enumeration, archive staging, or transfer; use asset or ticket records only to corroborate that exact action, otherwise require the same executable, parent, command pattern, `user.id`, `host.id`, and quiet surrounding activity across prior alerts from this rule.
- Before creating an exception, validate recurrence of the same `process.executable`, `process.parent.executable`, `process.command_line` pattern, `user.id`, and `host.id` with the same limited scope. Avoid exceptions on `process.name`, `key=clear` alone, the host alone, or all netsh wireless activity.
### Response and remediation
- If confirmed benign, reverse any temporary containment and document which evidence matched the support or recovery workflow: command scope, binary identity, parent workflow, `user.id`, `host.id`, and absence of collection or staging. Create an exception only after the same limited pattern recurs.
- If suspicious but unconfirmed, preserve the alert record, case export, volatile process context, `process.entity_id`, `process.command_line`, `process.parent.command_line`, sibling process starts, staged artifacts when recovered, and affected `user.id` and `host.id`. Start with reversible containment such as temporary wireless or network restrictions; use host isolation only if staging, export, transfer, or broader compromise is evident.
- If confirmed malicious, isolate the endpoint or terminate the offending process through endpoint-response tooling after recording `process.entity_id`, `process.command_line`, parent context, exposed profile names, staged artifacts, and related-alert evidence. If tooling is unavailable, escalate with the preserved evidence set.
- Reset or rotate credentials exposed by the dumped wireless profile. For PSK environments, rotate the affected SSID key; for 802.1X environments, revoke or reissue affected certificates, reset cached credentials, and verify whether the exposed profile could grant broader network access.
- Before deleting artifacts, review other hosts and users for the same `process.command_line`, parent pattern, or exported profile artifacts so scoping finishes before evidence is destroyed.
- Eradicate only scripts, batch files, XML exports, archives, and persistence mechanisms found during the investigation, then remediate the initial access path that allowed the key retrieval.
"""
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.id",
"user.id",
"process.entity_id",
"process.pid",
"process.executable",
"process.command_line",
"process.args",
"process.pe.original_file_name",
"process.parent.entity_id",
"process.parent.pid",
"process.parent.executable",
"process.parent.command_line",
"process.code_signature.subject_name",
"process.code_signature.trusted",
]
[transform]
[[transform.investigate]]
label = "Process starts from the same parent"
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.parent.entity_id", queryType = "phrase", value = "{{process.parent.entity_id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "File activity for the alerting process"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", 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" }
]
]
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 = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"
[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
(process.name : "netsh.exe" or ?process.pe.original_file_name == "netsh.exe") and
process.args : "wlan" and process.args : "key*clear"
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 value:"netsh.exe" |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"netsh.exe" |