Detection rules › Elastic
Elastic rules: 21
AWS SSM `SendCommand` with Run Shell Command Parameters
#Identifies the use of the AWS Systems Manager (SSM) SendCommand API with the either AWS-RunShellScript or AWS-RunPowerShellScript parameters. The SendCommand API call allows users to execute commands on EC2 instances using the SSM service. Adversaries may use this technique to execute commands on EC2 instances without the need for SSH or RDP access. This behavior may indicate an adversary attempting to execute commands on an EC2 instance for malicious purposes. This is a New Terms rule that only flags when this behavior is observed for the first time on a host in the last 7 days.
Known False Positives
- Legitimate use of the `SendCommand` API call to execute commands on EC2 instances using the SSM service may be done by system administrators or DevOps engineers for legitimate purposes.
MITRE ATT&CK Coverage
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2022/09/03"
integration = ["endpoint", "auditd_manager"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Identifies the use of the AWS Systems Manager (SSM) `SendCommand` API with the either `AWS-RunShellScript` or
`AWS-RunPowerShellScript` parameters. The `SendCommand` API call allows users to execute commands on EC2 instances using
the SSM service. Adversaries may use this technique to execute commands on EC2 instances without the need for SSH or RDP
access. This behavior may indicate an adversary attempting to execute commands on an EC2 instance for malicious
purposes. This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags
when this behavior is observed for the first time on a host in the last 7 days.
"""
false_positives = [
"""
Legitimate use of the `SendCommand` API call to execute commands on EC2 instances using the SSM service may be done
by system administrators or DevOps engineers for legitimate purposes.
""",
]
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS SSM `SendCommand` with Run Shell Command Parameters"
references = [
"https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc",
"https://securitycafe.ro/2023/01/17/aws-post-explitation-with-ssm-sendcommand/",
]
risk_score = 47
rule_id = "c371e9fc-6a10-11ef-a0ac-f661ea17fbcc"
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 = "medium"
tags = [
"Domain: Endpoint",
"Domain: Cloud",
"OS: Linux",
"OS: macOS",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Auditd Manager",
"Resources: Investigation Guide"
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category: "process" and event.type: "start" and process.name: "aws"
and (
host.os.type: ("windows" or "macos")
or (
host.os.type: "linux"
and event.action: ("exec" or "exec_event" or "executed" or "process_started")
)
)
and process.args: (
"send-command" and "--parameters" and commands=*
and ("AWS-RunShellScript" or "AWS-RunPowerShellScript")
)
'''
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 AWS SSM `SendCommand` with Run Shell Command Parameters
AWS Systems Manager (SSM) allows remote command execution on EC2 instances via the `SendCommand` API, using scripts like `AWS-RunShellScript` or `AWS-RunPowerShellScript`. Adversaries may exploit this to execute unauthorized commands without direct access. The detection rule identifies unusual command executions by monitoring process activities, flagging first-time occurrences within a week to spot potential threats.
### Possible investigation steps
- Review the alert details to identify the specific EC2 instance and the user account associated with the `SendCommand` API call.
- Check the AWS CloudTrail logs for the `SendCommand` event to gather additional context, such as the source IP address, user agent, and any associated IAM roles or policies.
- Investigate the command parameters used in the `SendCommand` API call, focusing on the `commands` field to determine the nature and intent of the executed script.
- Examine the process execution history on the affected host to identify any unusual or unauthorized processes that may have been initiated as a result of the command.
- Assess the recent activity of the user account involved in the alert to identify any other suspicious actions or deviations from normal behavior.
- Verify the integrity and security posture of the affected EC2 instance, checking for any signs of compromise or unauthorized changes.
### False positive analysis
- Routine administrative tasks using AWS SSM SendCommand may trigger alerts. Identify and document regular maintenance scripts and exclude them from detection to reduce noise.
- Automated deployment processes often use AWS-RunShellScript or AWS-RunPowerShellScript. Review deployment logs and whitelist these processes if they are verified as non-threatening.
- Monitoring or compliance checks that utilize SSM for gathering system information can be mistaken for malicious activity. Confirm these activities with the relevant teams and create exceptions for known benign operations.
- Scheduled tasks or cron jobs that execute commands via SSM should be reviewed. If they are part of standard operations, consider excluding them from the rule to prevent false positives.
- Development and testing environments frequently use SSM for testing scripts. Ensure these environments are well-documented and apply exceptions to avoid unnecessary alerts.
### Response and remediation
- Immediately isolate the affected EC2 instance from the network to prevent further unauthorized command execution and potential lateral movement.
- Review the AWS CloudTrail logs to identify the source of the `SendCommand` API call, including the IAM user or role that initiated the command, and assess whether the access was legitimate or compromised.
- Revoke or rotate the credentials of the IAM user or role involved in the suspicious activity to prevent further unauthorized access.
- Conduct a thorough examination of the affected EC2 instance to identify any unauthorized changes or installed malware, and restore the instance from a known good backup if necessary.
- Implement stricter IAM policies and permissions to limit the use of the `SendCommand` API to only trusted users and roles, ensuring the principle of least privilege is enforced.
- Enable multi-factor authentication (MFA) for all IAM users with permissions to execute commands on EC2 instances to add an additional layer of security.
- Escalate the incident to the security operations team for further investigation and to determine if additional instances or resources have been compromised."""
[rule.investigation_fields]
field_names = [
"@timestamp",
"process.user.name",
"process.entry_leader.group.name",
"process.entry_leader.real_user.name",
"event.action",
"event.type",
"host.os.type",
"host.os.kernel",
"process.entry_leader.executable",
"process.entry_leader.working_directory",
"process.parent.executable",
"process.executable",
"process.hash.sha256",
"process.parent.command_line",
"process.command_line",
"process.args"
]
[[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.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique]]
id = "T1651"
name = "Cloud Administration Command"
reference = "https://attack.mitre.org/techniques/T1651/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
event.category: "process" and event.type: "start" and process.name: "aws"
and (
host.os.type: ("windows" or "macos")
or (
host.os.type: "linux"
and event.action: ("exec" or "exec_event" or "executed" or "process_started")
)
)
and process.args: (
"send-command" and "--parameters" and commands=*
and ("AWS-RunShellScript" or "AWS-RunPowerShellScript")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.category | eq |
| field:"event.category" kind:eq value:"process" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"commands=*" |
process.name | eq |
| field:"process_basename" kind:eq value:"aws" |
Azure Service Principal Sign-In Followed by Arc Cluster Credential Access
#Detects when a service principal authenticates to Microsoft Entra ID and then lists credentials for an Azure Arc-connected Kubernetes cluster within a short time window. The listClusterUserCredential action retrieves tokens that enable kubectl access through the Arc Cluster Connect proxy. This sequence (service principal sign-in followed by Arc credential retrieval), represents the exact attack chain used by adversaries with stolen service principal secrets to establish a proxy tunnel into Kubernetes clusters. Service principals that authenticate externally (as opposed to managed identities) and immediately access Arc cluster credentials warrant investigation, particularly when the sign-in originates from an unexpected location or ASN.
Known False Positives
- CI/CD pipelines that authenticate as a service principal and then access Arc clusters as part of deployment workflows will trigger this rule. Identify and exclude known automation service principal app IDs.
- Administrators using service principal credentials to manage Arc-connected clusters during maintenance windows may trigger this rule. Correlate with change management records.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Credential Access |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | Success: Successful sign-in |
Rules Detecting the Same Action
These rules filter on the same operation.
- [Entra ID] Suspicious Continuous OAuth Token Usage (Kusto)
- Anomalous sign-in location by user account and authenticating application (Kusto)
- Anomalous Single Factor Signin (Kusto)
- Authentications of Privileged Accounts Outside of Expected Controls (Kusto)
- Azure Portal sign in from another Azure Tenant (Kusto)
- Azure SignIn via Legacy Authentication Protocol (Panther)
- Cisco - firewall block but success logon to Microsoft Entra ID (Kusto)
- Detect non-admin requesting token for admin applications (Kusto)
Rule Body
[metadata]
creation_date = "2026/03/10"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects when a service principal authenticates to Microsoft Entra ID and then lists credentials for an Azure
Arc-connected Kubernetes cluster within a short time window. The `listClusterUserCredential` action retrieves tokens
that enable kubectl access through the Arc Cluster Connect proxy. This sequence (service principal sign-in followed by
Arc credential retrieval), represents the exact attack chain used by adversaries with stolen service principal secrets
to establish a proxy tunnel into Kubernetes clusters. Service principals that authenticate externally (as opposed to
managed identities) and immediately access Arc cluster credentials warrant investigation, particularly when the sign-in
originates from an unexpected location or ASN.
"""
false_positives = [
"""
CI/CD pipelines that authenticate as a service principal and then access Arc clusters as part of deployment
workflows will trigger this rule. Identify and exclude known automation service principal app IDs.
""",
"""
Administrators using service principal credentials to manage Arc-connected clusters during maintenance windows may
trigger this rule. Correlate with change management records.
""",
]
from = "now-30m"
index = ["logs-azure.signinlogs-*", "logs-azure.activitylogs-*"]
interval = "15m"
language = "eql"
license = "Elastic License v2"
name = "Azure Service Principal Sign-In Followed by Arc Cluster Credential Access"
note = """## Triage and analysis
### Investigating Azure Service Principal Sign-In Followed by Arc Cluster Credential Access
This rule detects the complete attack entry point for Arc-proxied Kubernetes attacks: a service principal authenticates
to Azure AD, then immediately retrieves Arc cluster credentials. This is the prerequisite sequence before any
Kubernetes-level activity can occur through the Arc proxy.
### Possible investigation steps
- Identify the service principal using the `app_id` from the sign-in event and resolve it in Azure AD — is this a
known application?
- Check the sign-in source IP and geolocation — does it match expected infrastructure locations for this SP?
- Review when the SP credentials were last rotated — stale credentials are more likely compromised.
- Check the ASN of the sign-in source — is it from a known cloud provider, corporate network, or unexpected consumer ISP?
- Examine Azure Activity Logs after the credential listing for any Arc-proxied operations (secret/configmap CRUD).
- Correlate with Kubernetes audit logs for operations by the Arc proxy service account
(`system:serviceaccount:azure-arc:azure-arc-kube-aad-proxy-sa`) in the same time window.
- Review Azure AD Audit Logs for recent changes to this SP (new credentials, federated identities, owner changes).
### Response and remediation
- Immediately rotate the service principal credentials (secrets and certificates).
- Revoke active sessions and tokens for the SP.
- Review and remove any unauthorized Azure role assignments on Arc-connected clusters.
- Check Kubernetes audit logs for any operations performed through the Arc proxy after credential access.
- Rotate any Kubernetes secrets that may have been accessed through the proxy tunnel.
- Enable conditional access policies to restrict service principal authentication by location if supported.
"""
references = [
"https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/cluster-connect",
"https://learn.microsoft.com/en-us/cli/azure/connectedk8s#az-connectedk8s-proxy",
"https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins",
"https://www.ibm.com/think/x-force/identifying-abusing-azure-arc-for-hybrid-escalation-persistence",
"https://www.microsoft.com/en-us/security/blog/2025/08/27/storm-0501s-evolving-techniques-lead-to-cloud-based-ransomware/",
]
risk_score = 47
rule_id = "dacfbecd-7927-46a7-a8ba-feb65a2e990d"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Azure Arc",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-In Logs",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Tactic: Initial Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence with maxspan=30m
[authentication where data_stream.dataset == "azure.signinlogs"
and azure.signinlogs.category == "ServicePrincipalSignInLogs"
and azure.signinlogs.properties.status.error_code == 0
] by azure.signinlogs.properties.app_id
[any where data_stream.dataset == "azure.activitylogs"
and azure.activitylogs.operation_name : "MICROSOFT.KUBERNETES/CONNECTEDCLUSTERS/LISTCLUSTERUSERCREDENTIAL/ACTION"
and event.outcome : ("Success", "success")
] by azure.activitylogs.identity.claims.appid
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"
[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 = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"azure.signinlogs.properties.app_id",
"azure.signinlogs.properties.app_display_name",
"azure.signinlogs.properties.service_principal_name",
"azure.signinlogs.category",
"azure.activitylogs.operation_name",
"azure.activitylogs.identity.claims.appid",
"azure.resource.id",
"source.ip",
"source.geo.country_name",
"source.geo.city_name",
"source.as.organization.name",
]
Stages and Predicates
Ordered sequence: each step below must occur in order within 30m, correlated by azure.activitylogs.identity.claims.appid, azure.signinlogs.properties.app_id.
Stage 1: authentication
[authentication where data_stream.dataset == "azure.signinlogs"
and azure.signinlogs.category == "ServicePrincipalSignInLogs"
and azure.signinlogs.properties.status.error_code == 0
] by azure.signinlogs.properties.app_id
Stage 2: any
[any where data_stream.dataset == "azure.activitylogs"
and azure.activitylogs.operation_name : "MICROSOFT.KUBERNETES/CONNECTEDCLUSTERS/LISTCLUSTERUSERCREDENTIAL/ACTION"
and event.outcome : ("Success", "success")
] by azure.activitylogs.identity.claims.appid
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
azure.activitylogs.operation_name | wildcard |
| field:"azure.activitylogs.operation_name" kind:wildcard value:"MICROSOFT.KUBERNETES/CONNECTEDCLUSTERS/LISTCLUSTERUSERCREDENTIAL/ACTION" |
azure.signinlogs.category | eq |
| field:"azure_ad::signin_category" kind:eq value:"ServicePrincipalSignInLogs" |
azure.signinlogs.properties.status.error_code | eq |
| field:"azure_ad::result_type" kind:eq value:"0" |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq |
event.outcome | wildcard |
| field:"event.outcome" kind:wildcard |
Cloud Credential Search Detected via Defend for Containers
#This rule detects the use of system search utilities like grep and find to search for AWS credentials inside a container. Unauthorized access to these sensitive files could lead to further compromise of the container environment or facilitate a container breakout to the underlying cloud environment.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Discovery |
Rule Body
[metadata]
creation_date = "2023/05/12"
integration = ["cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/07/29"
[rule]
author = ["Elastic"]
description = """
This rule detects the use of system search utilities like grep and find to search for AWS credentials inside a
container. Unauthorized access to these sensitive files could lead to further compromise of the container
environment or facilitate a container breakout to the underlying cloud environment.
"""
from = "now-6m"
index = ["logs-cloud_defend.process*"]
interval = "5m"
language = "eql"
license = "Elastic License v2"
name = "Cloud Credential Search Detected via Defend for Containers"
references = ["https://sysdig.com/blog/threat-detection-aws-cloud-containers/"]
risk_score = 47
rule_id = "d0b0f3ed-0b37-44bf-adee-e8cb7de92767"
severity = "medium"
tags = [
"Data Source: Elastic Defend for Containers",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
process.name in ("grep", "egrep", "fgrep", "find", "locate", "mlocate", "cat", "sed", "awk") or
(
/* Account for tools that execute utilities as a subprocess, in this case the target utility name will appear as a process arg */
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in (
"grep", "/bin/grep", "/usr/bin/grep", "/usr/local/bin/grep",
"egrep", "/bin/egrep", "/usr/bin/egrep", "/usr/local/bin/egrep",
"fgrep", "/bin/fgrep", "/usr/bin/fgrep", "/usr/local/bin/fgrep",
"find", "/bin/find", "/usr/bin/find", "/usr/local/bin/find",
"locate", "/bin/locate", "/usr/bin/locate", "/usr/local/bin/locate",
"mlocate", "/bin/mlocate", "/usr/bin/mlocate", "/usr/local/bin/mlocate",
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
) and
/* default exclusion list to not FP on default multi-process commands */
not process.args in (
"which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
"man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
"chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
"chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
)
)
)
and
process.args like~ (
/* AWS Credentials */
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*access_key*", "*.aws/credentials*",
/* Azure Credentials */
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*",
"*/.azure/*", "*/var/run/secrets/azure/*",
/* GCP Credentials */
"*/.config/gcloud/*", "*application_default_credentials.json*",
"*type: service_account*", "*client_email*", "*private_key_id*", "*private_key*",
"*/var/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*"
) and container.id like "*"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[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.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1083"
name = "File and Directory Discovery"
reference = "https://attack.mitre.org/techniques/T1083/"
[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 == "linux" and event.type == "start" and event.action == "exec" and (
process.name in ("grep", "egrep", "fgrep", "find", "locate", "mlocate", "cat", "sed", "awk") or
(
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in (
"grep", "/bin/grep", "/usr/bin/grep", "/usr/local/bin/grep",
"egrep", "/bin/egrep", "/usr/bin/egrep", "/usr/local/bin/egrep",
"fgrep", "/bin/fgrep", "/usr/bin/fgrep", "/usr/local/bin/fgrep",
"find", "/bin/find", "/usr/bin/find", "/usr/local/bin/find",
"locate", "/bin/locate", "/usr/bin/locate", "/usr/local/bin/locate",
"mlocate", "/bin/mlocate", "/usr/bin/mlocate", "/usr/local/bin/mlocate",
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
) and
not process.args in (
"which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
"man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
"chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
"chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
)
)
)
and
process.args like~ (
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*access_key*", "*.aws/credentials*",
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*",
"*/.azure/*", "*/var/run/secrets/azure/*",
"*/.config/gcloud/*", "*application_default_credentials.json*",
"*type: service_account*", "*client_email*", "*private_key_id*", "*private_key*",
"*/var/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*"
) and container.id like "*"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
container.id | wildcard |
| field:"container.id" kind:wildcard value:"*" |
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
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 | in |
| field:"process_basename" kind:in |
DARKRADIATION Ransomware Infection
#Identifies a file extension used by DARKRADIATION bash ransomware that abuses the openssl utility to encrypt files. Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
Rule Body
[rule]
description = """
Identifies a file extension used by DARKRADIATION bash ransomware that abuses the openssl utility to encrypt files.
Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to
system and network resources.
"""
id = "33309858-3154-47a6-b601-eda2de62557b"
license = "Elastic License v2"
name = "DARKRADIATION Ransomware Infection"
os_list = ["linux", "macos"]
reference = [
"https://www.trendmicro.com/en_us/research/21/f/bash-ransomware-darkradiation-targets-red-hat--and-debian-based-linux-distributions.html",
]
version = "1.0.29"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name == "xargs" and process.args == "openssl" and process.args == "enc" and
/* radiation unicode symbol used by DARKRADIATION ransomware */
process.command_line like "*.☢*"
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"
[threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[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 == "xargs" and process.args == "openssl" and process.args == "enc" and
process.command_line like "*.☢*"
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 |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*.☢*" |
process.name | eq |
| field:"process_basename" kind:eq value:"xargs" |
DNS Request to Suspicious Top Level Domain
#This rule detects DNS queries to commonly abused top level domains. Malware authors may use these domains to host command and control infrastructure, exfiltrate data, or to download payloads for later execution.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Command & Control | |
| Exfiltration |
Rule Body
[metadata]
creation_date = "2026/07/02"
integration = ["endpoint"]
maturity = "production"
min_stack_version = "9.3.0"
min_stack_comments = "DNS for Linux support was introduced in 9.3.0"
updated_date = "2026/07/20"
[rule]
author = ["Elastic"]
description = """
This rule detects DNS queries to commonly abused top level domains. Malware authors may use these
domains to host command and control infrastructure, exfiltrate data, or to download payloads
for later execution.
"""
from = "now-9m"
index = ["logs-endpoint.events.network-*"]
language = "eql"
license = "Elastic License v2"
name = "DNS Request to Suspicious Top Level Domain"
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 DNS Request to Suspicious Top Level Domain
This rule flags a Linux process making DNS lookups for top-level domains that threat actors frequently abuse, which can reveal command-and-control staging, payload retrieval, or data theft paths that blend into normal name resolution. A common pattern is a compromised Linux server or container resolving a .xyz, .top, or .ru domain immediately before a downloader, backdoor, or script beacon starts exchanging instructions or uploading collected data.
### Possible investigation steps
- Review the originating binary’s full command line, executable path, parent or child lineage, and user or service account to determine whether the lookup came from approved software, an admin script, or an unexpected downloader or shell.
- Correlate the DNS event with nearby outbound connections, HTTP or TLS sessions, and file activity on the same host to see whether the domain was followed by beaconing, payload retrieval, or data transfer.
- Enrich the queried domain and any resolved IPs with passive DNS, registration age, reputation, ASN or geolocation, and prevalence in your environment to distinguish newly created or low-reputation infrastructure from known business services.
- Determine whether the host is a server, workstation, or containerized workload and validate if the domain fits its normal role by comparing against recent activity, peer hosts, deployed applications, and change or deployment records.
- If the activity is not readily explained, inspect for adjacent compromise indicators such as new cron jobs or systemd timers, unexpected binaries in writable paths, recent package or script changes, and authentication or privilege escalation events around the same timeframe.
### False positive analysis
- Newly deployed or updated Linux applications, scripts, or package retrieval tasks may legitimately resolve domains in low-cost or regional TLDs for updates, licensing, or content delivery; verify the process path and parent chain match approved software and that similar lookups appear on peer hosts during the same change window.
- A user or service performing legitimate research or accessing region-specific content may query a country-code or commonly abused TLD from a browser or expected application; confirm the domain aligns with the host’s business purpose and that the activity is limited to normal browsing without subsequent suspicious connections, downloads, or persistence changes.
### Response and remediation
- Isolate the affected Linux host or container from the network except for approved management access, and immediately block the suspicious domain, its resolved IP addresses, and any follow-on destinations at DNS, proxy, and firewall controls.
- Terminate the offending process and remove persistence tied to the activity, including unauthorized systemd services or timers, cron entries, startup scripts, shell profile changes, and newly added SSH authorized_keys for the impacted account.
- Preserve the malicious binary or script and relevant logs for scoping, then rebuild the system from a known-good image or snapshot rather than cleaning in place, and restore altered files only from trusted backups.
- Rotate credentials and secrets exposed on the host, especially SSH keys, API tokens, service account passwords, and cloud or instance metadata credentials, because DNS-based command-and-control often precedes remote tasking and data theft.
- Escalate to incident response immediately if the same domain or related infrastructure appears on multiple hosts, if the process ran as root or a privileged service account, or if you identify outbound uploads, payload downloads, or lateral movement activity.
- Harden the environment by forcing outbound DNS through approved resolvers, restricting egress to required destinations, monitoring Linux systems for new systemd or cron persistence, and adding detections for the domain, executable hash, and related infrastructure.
"""
risk_score = 21
rule_id = "44a2de72-fe41-4558-b7ec-3e42de5f0432"
severity = "low"
tags = [
"Domain: Endpoint",
"Domain: Network",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Command and Control",
"Tactic: Exfiltration",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
network where host.os.type == "linux" and dns.question.name != null and process.name != null and
dns.question.name like~ (
"*.forum", "*.pro", "*.team", "*.lol", "*.kr", "*.ke", "*.nu", "*.space", "*.capital", "*.in", "*.cfd", "*.online",
"*.ru", "*.info", "*.top", "*.buzz", "*.xyz", "*.rest", "*.ml", "*.cf", "*.gq", "*.ga", "*.onion", "*.network",
"*.monster", "*.marketing", "*.cyou", "*.quest", "*.cc", "*.bar", "*.click", "*.cam", "*.surf", "*.tk", "*.shop",
"*.club", "*.icu", "*.pw", "*.ws", "*.fun", "*.life", "*.boats", "*.store", "*.hair", "*.mom",
"*.beauty", "*.bond", "*.biz", "*.live", "*.zone"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[rule.threat.technique.subtechnique]]
id = "T1071.004"
name = "DNS"
reference = "https://attack.mitre.org/techniques/T1071/004/"
[[rule.threat.technique]]
id = "T1090"
name = "Proxy"
reference = "https://attack.mitre.org/techniques/T1090/"
[[rule.threat.technique.subtechnique]]
id = "T1090.002"
name = "External Proxy"
reference = "https://attack.mitre.org/techniques/T1090/002/"
[[rule.threat.technique]]
id = "T1102"
name = "Web Service"
reference = "https://attack.mitre.org/techniques/T1102/"
[[rule.threat.technique.subtechnique]]
id = "T1102.001"
name = "Dead Drop Resolver"
reference = "https://attack.mitre.org/techniques/T1102/001/"
[[rule.threat.technique.subtechnique]]
id = "T1102.002"
name = "Bidirectional Communication"
reference = "https://attack.mitre.org/techniques/T1102/002/"
[[rule.threat.technique]]
id = "T1568"
name = "Dynamic Resolution"
reference = "https://attack.mitre.org/techniques/T1568/"
[[rule.threat.technique.subtechnique]]
id = "T1568.002"
name = "Domain Generation Algorithms"
reference = "https://attack.mitre.org/techniques/T1568/002/"
[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 = "T1567"
name = "Exfiltration Over Web Service"
reference = "https://attack.mitre.org/techniques/T1567/"
[[rule.threat.technique.subtechnique]]
id = "T1567.001"
name = "Exfiltration to Code Repository"
reference = "https://attack.mitre.org/techniques/T1567/001/"
[[rule.threat.technique.subtechnique]]
id = "T1567.002"
name = "Exfiltration to Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1567/002/"
[[rule.threat.technique.subtechnique]]
id = "T1567.003"
name = "Exfiltration to Text Storage Sites"
reference = "https://attack.mitre.org/techniques/T1567/003/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
Stages and Predicates
Stage 1: network
network where host.os.type == "linux" and dns.question.name != null and process.name != null and
dns.question.name like~ (
"*.forum", "*.pro", "*.team", "*.lol", "*.kr", "*.ke", "*.nu", "*.space", "*.capital", "*.in", "*.cfd", "*.online",
"*.ru", "*.info", "*.top", "*.buzz", "*.xyz", "*.rest", "*.ml", "*.cf", "*.gq", "*.ga", "*.onion", "*.network",
"*.monster", "*.marketing", "*.cyou", "*.quest", "*.cc", "*.bar", "*.click", "*.cam", "*.surf", "*.tk", "*.shop",
"*.club", "*.icu", "*.pw", "*.ws", "*.fun", "*.life", "*.boats", "*.store", "*.hair", "*.mom",
"*.beauty", "*.bond", "*.biz", "*.live", "*.zone"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | is_not_null | field:"QueryName" kind:is_not_null | |
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard |
process.name | is_not_null | field:"process_basename" kind:is_not_null |
Incoming Execution via WinRM Remote Shell
#Identifies remote execution via Windows Remote Management (WinRM) remote shell on a target host. This could be an indication of lateral movement.
Known False Positives
- WinRM is a dual-use protocol that can be used for benign or malicious activity. It's important to baseline your environment to determine the amount of noise to expect from this tool.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/11/24"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies remote execution via Windows Remote Management (WinRM) remote shell on a target host. This could be an
indication of lateral movement.
"""
false_positives = [
"""
WinRM is a dual-use protocol that can be used for benign or malicious activity. It's important to baseline your
environment to determine the amount of noise to expect from this tool.
""",
]
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.process-*",
"logs-endpoint.events.network-*",
"logs-windows.sysmon_operational-*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Incoming Execution via WinRM Remote Shell"
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 Incoming Execution via WinRM Remote Shell
Windows Remote Management (WinRM) is a protocol that allows for remote management and execution of commands on Windows machines. While beneficial for legitimate administrative tasks, adversaries can exploit WinRM for lateral movement by executing commands remotely. The detection rule identifies suspicious activity by monitoring network traffic on specific ports and processes initiated by WinRM, flagging potential unauthorized remote executions.
### Possible investigation steps
- Review the network traffic logs to confirm the presence of incoming connections on ports 5985 or 5986, which are used by WinRM, and verify if these connections are expected or authorized.
- Identify the source IP address of the incoming connection and determine if it belongs to a known and trusted network or device. Investigate any unfamiliar or suspicious IP addresses.
- Examine the process tree for the process initiated by winrshost.exe to identify any unusual or unauthorized processes that were started as a result of the remote execution.
- Check the user account associated with the WinRM session to ensure it is legitimate and has not been compromised. Look for any signs of unauthorized access or privilege escalation.
- Correlate the event with other security logs, such as authentication logs, to identify any related suspicious activities or patterns that might indicate lateral movement or a broader attack campaign.
- Investigate the timeline of events to determine if there are any other related alerts or activities occurring around the same time that could provide additional context or evidence of malicious intent.
### False positive analysis
- Legitimate administrative tasks using WinRM can trigger alerts. Regularly review and whitelist known administrative IP addresses or users to reduce false positives.
- Automated scripts or management tools that use WinRM for routine tasks may be flagged. Identify these scripts and create exceptions for their specific process names or execution paths.
- Monitoring tools that check system health via WinRM might be misidentified as threats. Exclude these tools by specifying their source IPs or process names in the detection rule.
- Scheduled tasks that utilize WinRM for updates or maintenance can cause alerts. Document these tasks and adjust the rule to ignore their specific execution patterns.
- Internal security scans or compliance checks using WinRM should be accounted for. Coordinate with security teams to recognize these activities and exclude them from triggering alerts.
### Response and remediation
- Isolate the affected host immediately from the network to prevent further lateral movement and potential data exfiltration.
- Terminate any suspicious processes associated with WinRM, particularly those not originating from legitimate administrative tools or known good sources.
- Review and revoke any unauthorized access credentials or accounts that may have been used to initiate the WinRM session.
- Conduct a thorough examination of the affected host for any additional signs of compromise, such as unauthorized software installations or changes to system configurations.
- Restore the affected system from a known good backup if any malicious activity or unauthorized changes are confirmed.
- Implement network segmentation to limit the ability of threats to move laterally across the network, focusing on restricting access to critical systems.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected."""
risk_score = 47
rule_id = "1cd01db9-be24-4bef-8e7c-e923f0ff78ab"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
"Data Source: SentinelOne",
]
type = "eql"
query = '''
sequence by host.id with maxspan=30s
[network where host.os.type == "windows" and process.pid == 4 and network.direction : ("incoming", "ingress") and
destination.port in (5985, 5986) and source.ip != "127.0.0.1" and source.ip != "::1"]
[process where host.os.type == "windows" and
event.type == "start" and process.parent.name : "winrshost.exe" and not process.executable : "?:\\Windows\\System32\\conhost.exe"]
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Sysmon Event ID 3 - Network Connection](https://ela.st/sysmon-event-3-setup)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[rule.threat.technique.subtechnique]]
id = "T1021.006"
name = "Windows Remote Management"
reference = "https://attack.mitre.org/techniques/T1021/006/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by host.id.
Stage 1: network
[network where host.os.type == "windows" and process.pid == 4 and network.direction : ("incoming", "ingress") and
destination.port in (5985, 5986) and source.ip != "127.0.0.1" and source.ip != "::1"]
Stage 2: process
[process where host.os.type == "windows" and
event.type == "start" and process.parent.name : "winrshost.exe" and not process.executable : "?:\\Windows\\System32\\conhost.exe"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | in |
| field:"DestinationPort" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
network.direction | wildcard |
| field:"Initiated" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"winrshost.exe" |
process.pid | eq |
| field:"process_id" kind:eq value:"4" |
source.ip | ne |
| field:"src_ip" kind:ne |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Windows\System32\conhost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\conhost.exe" |
Microsoft Build Engine Started by a Script Process
#An instance of MSBuild, the Microsoft Build Engine, was started by a script or the Windows command interpreter. This behavior is unusual and is sometimes used by malicious payloads.
Known False Positives
- The Build Engine is commonly used by Windows developers but use by non-engineers is unusual.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[metadata]
creation_date = "2020/03/25"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
An instance of MSBuild, the Microsoft Build Engine, was started by a script or the Windows command interpreter. This
behavior is unusual and is sometimes used by malicious payloads.
"""
false_positives = ["The Build Engine is commonly used by Windows developers but use by non-engineers is unusual."]
from = "now-9m"
index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.sysmon_operational-*"]
language = "kuery"
license = "Elastic License v2"
name = "Microsoft Build Engine Started by a Script 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 Microsoft Build Engine Started by a Script Process
The Microsoft Build Engine (MSBuild) is a platform for building applications, typically invoked by developers. However, adversaries exploit its ability to execute inline tasks, using it as a proxy for executing malicious code. The detection rule identifies unusual MSBuild invocations initiated by script interpreters, signaling potential misuse for stealthy execution or defense evasion tactics.
### Possible investigation steps
- Review the process tree to understand the parent-child relationship, focusing on the parent process names such as cmd.exe, powershell.exe, pwsh.exe, powershell_ise.exe, cscript.exe, wscript.exe, or mshta.exe, which initiated the msbuild.exe process.
- Examine the command line arguments used to start msbuild.exe to identify any suspicious or unusual inline tasks or scripts that may indicate malicious activity.
- Check the user account associated with the msbuild.exe process to determine if it aligns with expected usage patterns or if it might be compromised.
- Investigate the timing and frequency of the msbuild.exe execution to see if it coincides with known legitimate build activities or if it appears anomalous.
- Look for any related network activity or file modifications around the time of the msbuild.exe execution to identify potential data exfiltration or further malicious actions.
- Cross-reference the alert with other security events or logs to identify any correlated indicators of compromise or additional suspicious behavior.
### False positive analysis
- Development environments where scripts are used to automate builds may trigger this rule. To manage this, identify and whitelist specific script processes or directories commonly used by developers.
- Automated testing frameworks that utilize scripts to initiate builds can cause false positives. Exclude these processes by creating exceptions for known testing tools and their associated scripts.
- Continuous integration/continuous deployment (CI/CD) pipelines often use scripts to invoke MSBuild. Consider excluding the parent processes associated with these pipelines from the rule.
- Administrative scripts that perform legitimate system maintenance tasks might start MSBuild. Review and exclude these scripts if they are verified as non-threatening.
- Custom scripts developed in-house for specific business functions may also trigger alerts. Conduct a review of these scripts and exclude them if they are deemed safe and necessary for operations.
### Response and remediation
- Isolate the affected system from the network to prevent further malicious activity and lateral movement.
- Terminate the suspicious MSBuild process and any associated script interpreter processes (e.g., cmd.exe, powershell.exe) to stop the execution of potentially malicious code.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any malicious payloads or artifacts.
- Review and analyze the parent script or command that initiated the MSBuild process to understand the scope and intent of the attack, and identify any additional compromised systems or accounts.
- Reset credentials for any user accounts that were active on the affected system during the time of the alert to prevent unauthorized access.
- 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 MSBuild and script interpreter activities across the network to detect and respond to similar threats in the future."""
risk_score = 47
rule_id = "9d110cb3-5f4b-4c9a-b9f5-53f0a1707ae2"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type:windows and event.category:process and event.type:start and (
process.name.caseless:"msbuild.exe" or process.pe.original_file_name:"MSBuild.exe") and
process.parent.name:("cmd.exe" or "powershell.exe" or "pwsh.exe" or "powershell_ise.exe" or "cscript.exe" or
"wscript.exe" or "mshta.exe") and
not process.executable : (
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\amd64\\MSBuild.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:
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1127"
name = "Trusted Developer Utilities Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1127/"
[[rule.threat.technique.subtechnique]]
id = "T1127.001"
name = "MSBuild"
reference = "https://attack.mitre.org/techniques/T1127/001/"
[[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.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.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[[rule.threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
host.os.type:windows and event.category:process and event.type:start and (
process.name.caseless:"msbuild.exe" or process.pe.original_file_name:"MSBuild.exe") and
process.parent.name:("cmd.exe" or "powershell.exe" or "pwsh.exe" or "powershell_ise.exe" or "cscript.exe" or
"wscript.exe" or "mshta.exe") and
not process.executable : (
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\amd64\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe" or
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name.caseless | eq |
| field:"process.name.caseless" kind:eq value:"msbuild.exe" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"MSBuild.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | in | C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe, C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe, C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe, C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe | excludes:process.executable |
Microsoft Exchange Worker Spawning Suspicious Processes
#Identifies suspicious processes being spawned by the Microsoft Exchange Server worker process (w3wp). This activity may indicate exploitation activity or access to an existing web shell backdoor.
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 = "2021/03/08"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Identifies suspicious processes being spawned by the Microsoft Exchange Server worker process (w3wp). This activity may
indicate exploitation activity or access to an existing web shell backdoor.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process-*",
"winlogbeat-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Microsoft Exchange Worker Spawning Suspicious Processes"
references = [
"https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers",
"https://www.volexity.com/blog/2021/03/02/active-exploitation-of-microsoft-exchange-zero-day-vulnerabilities",
"https://discuss.elastic.co/t/detection-and-response-for-hafnium-activity/266289",
]
risk_score = 73
rule_id = "f81ee52c-297e-46d9-9205-07e66931df26"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "w3wp.exe" and process.parent.args : "MSExchange*AppPool" and
(
(process.name : ("cmd.exe", "powershell.exe", "pwsh.exe", "powershell_ise.exe") or
?process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE", "pwsh.dll", "powershell_ise.EXE"))
)
'''
note = """## Triage and analysis
### Investigating Microsoft Exchange Worker Spawning Suspicious Processes
#### Possible investigation steps
- What Exchange worker-child path did the alert capture?
- Focus: child `process.executable` and `process.command_line`; worker `process.parent.executable`, `process.parent.args`, and `process.parent.command_line`; exact MSExchange app pool.
- Implication: escalate when an Exchange app pool launches shell/PowerShell for execution, download, discovery, or staging; lower suspicion only when parent arguments and child command match one narrow maintenance task with no webshell or RCE indicators.
- What intent does the shell or PowerShell command show?
- Focus: `process.command_line`; encoded or inline execution, download cradles, archive/export, discovery, Set-OabVirtualDirectory, mailbox access, or FrontEnd\\HttpProxy, aspnet_client, web.config, and applicationHost.config paths.
- Implication: escalate on payload retrieval, web-root staging, credential access, account changes, mailbox export, cleanup, or lateral movement; lower suspicion only for one bounded recognized Exchange maintenance or validation action.
- Does token and session context support human administration or service-context abuse?
- Why: w3wp.exe children often inherit app-pool or service identity, so user fields alone do not prove human administration.
- Focus: `user.id`, `user.name`, `user.domain`, `process.Ext.session_info.logon_type`, and `process.Ext.authentication_id`.
- Implication: escalate when a service, app-pool, or unexpected logon context launches interactive shell behavior or remote administration; lower suspicion only when identity, session type, and command scope match the same recognized workflow.
- Is the child binary expected or masqueraded?
- Focus: `process.executable`, `process.hash.sha256`, `process.pe.original_file_name`, `process.code_signature.subject_name`, and `process.code_signature.trusted`.
- Implication: escalate when the child is renamed, user-writable, unsigned or untrusted, hash-new for the server, or mismatched to PE original name; a trusted Microsoft shell lowers identity concern but does not clear the unusual chain.
- If process evidence is suspicious or unresolved, did file evidence show webshells or artifacts?
- Focus: with endpoint file telemetry, scope by `host.id` + `process.entity_id`, or `host.id` + `process.pid` + tight alert window if absent; inspect `file.path`, `file.Ext.original.path`, `file.origin_url`, and `file.Ext.windows.zone_identifier` for ASPX, scripts, binaries, DLLs, archives, or output under Exchange/IIS paths. $investigate_1
- Hint: check whether a written `file.path` later appears as `process.executable`; missing file telemetry limits proof but is not benign.
- Implication: escalate when the child writes new or modified ASPX, scripts, binaries, DLLs, archives, or output under Exchange FrontEnd\\HttpProxy, IIS aspnet_client, temp, or web-root paths; lower suspicion only when file activity stays inside the exact maintenance path with no web-content or payload staging.
- If process evidence is suspicious or unresolved, did network evidence show retrieval or callback?
- Focus: with endpoint network telemetry, scope DNS and connections by `host.id` + `process.entity_id`, or `host.id` + `process.pid` + tight alert window if absent; read DNS (`dns.question.name`, `dns.resolved_ip`) separately from connections (`destination.ip`, `destination.port`). $investigate_2
- Hint: map `dns.resolved_ip` to `destination.ip` before deciding whether the same process reached it. Missing network telemetry is unresolved, not benign.
- Implication: escalate when the child downloads tools, reaches public staging or callback infrastructure, or connects to systems unrelated to the Exchange task; lower suspicion only when destinations are internal, proxy, or vendor services fitting the same bounded workflow.
- Does same-worker or same-host scope show broader Exchange compromise?
- Focus: surrounding same-worker process starts and related alerts on `host.id` or `user.id`, especially `process.parent.executable`, `process.parent.args`, `process.command_line`, and `process.hash.sha256` for repeated w3wp.exe descendants, credential dumping, account changes, archiving, cleanup, or side-loading chains.
- $investigate_3
- $investigate_0
- $investigate_4
- Implication: escalate scope when the host shows credential dumping, account changes, archive creation, cleanup, lateral movement, or repeated Exchange worker children; keep local only when surrounding process evidence and related alerts stay confined to the same recognized maintenance window.
- Escalate on unexplained server-side execution, suspicious command intent, payload staging, suspicious destinations, or broader host compromise; close only when all available evidence aligns with one recognized Exchange workflow on this host; preserve artifacts and escalate when evidence is mixed or visibility incomplete.
### False positive analysis
- Recognized Exchange maintenance or controlled validation is the bounded benign path. Confirm only when `process.parent.args`, child `process.command_line`, `process.executable`, `process.hash.sha256`, `process.code_signature.subject_name`, `user.id`, and `host.id` align with one task, and any `file.path`, `dns.question.name`, or `destination.ip` evidence shows no payload staging or external callback. Use change records as corroboration; otherwise require recurring prior alerts with the same parent arguments, command pattern, child identity, user, host, and no contradictory artifacts or destinations.
- Build exceptions only from the minimum confirmed pattern: `process.parent.args`, child `process.executable` or `process.hash.sha256`, `process.code_signature.subject_name`, stable `process.command_line` fragment, `user.id`, `host.id`, and any bounded artifact or destination pattern distinguishing the benign task. Avoid exceptions on "w3wp.exe", `process.name`, or `host.id` alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and document the exact evidence that validated the workflow: `process.parent.args`, child `process.executable`, `process.command_line`, `user.id`, `host.id`, and any bounded artifact or destination pattern. Create an exception only after the same pattern is stable across prior alerts from this rule.
- If suspicious but unconfirmed, preserve the alert, process tree, child `process.entity_id` or `process.pid`, `process.command_line`, parent `process.parent.entity_id`, `process.parent.args`, child hash and signer, `user.id`, `host.id`, and any staged artifacts, destinations, or IIS/Exchange log snippets before containment. Apply reversible containment first: block confirmed malicious destinations, restrict external access to the implicated Exchange service, or increase monitoring. Isolate only when active compromise evidence and server criticality justify disruption.
- If confirmed malicious, contain the Exchange server or exposed service path based on the process, artifact, destination, and same-host evidence already preserved. Record process and artifact identifiers before terminating the child, then block confirmed malicious domains, IPs, and hashes.
- Eradicate only the webshells, scripts, archives, scheduled tasks, dropped utilities, and configuration changes identified during triage. Restore modified Exchange or IIS content from known-good state, patch the Exchange server, review the virtual directories and app pools implicated by `process.parent.args`, and rotate Exchange, application, or service credentials if credential access, configuration theft, or mailbox export was involved.
- Retain the related process, file, network, IIS, and Exchange logs that supported the decision. Document any adjacent variant or telemetry gap, such as missing endpoint file/network events or unavailable IIS request logs, for the detection engineering team.
"""
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.investigation_fields]
field_names = [
"@timestamp",
"host.name",
"host.id",
"user.id",
"process.entity_id",
"process.pid",
"process.executable",
"process.command_line",
"process.pe.original_file_name",
"process.hash.sha256",
"process.code_signature.subject_name",
"process.code_signature.trusted",
"process.parent.entity_id",
"process.parent.executable",
"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 = "File events for the suspicious child 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 = "Network events for the suspicious child process"
description = ""
providers = [
[
{ 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.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events from the same Exchange worker"
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 = "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"
[[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/"
[[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.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 = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[rule.threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "w3wp.exe" and process.parent.args : "MSExchange*AppPool" and
(
(process.name : ("cmd.exe", "powershell.exe", "pwsh.exe", "powershell_ise.exe") or
?process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE", "pwsh.dll", "powershell_ise.EXE"))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.args | wildcard |
| field:"process.parent.args" kind:wildcard value:"MSExchange*AppPool" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"w3wp.exe" |
process.pe.original_file_name | in |
| field:"OriginalFileName" kind:in |
Microsoft Office AddIn Loaded
#Detects attempts to load an unsigned executable from known Microsoft Office add-ins directories. Adversaries may leverage Office Addins for persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Detects attempts to load an unsigned executable from known Microsoft Office add-ins directories. Adversaries may
leverage Office Addins for persistence.
"""
id = "aaa80718-1ed9-43bd-bcf7-97f2a6c93ea8"
license = "Elastic License v2"
name = "Microsoft Office AddIn Loaded"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/previous-versions/technet-magazine/ee851671(v=msdn.10)"]
version = "1.0.27"
query = '''
library where
process.name : ("winword.exe", "excel.exe") and
(dll.code_signature.trusted == false or dll.code_signature.exists == false) and
not dll.code_signature.status : ("errorExpired", "errorCode_endpoint*") and dll.hash.sha256 != null and
dll.path :
("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Word\\Startup\\*",
"?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*",
"?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\*") and
/* mainly https://github.com/Excel-DNA/ExcelDna */
not dll.hash.sha256 :
("77fbc709353e2fc68091ef4eaf92d9926b1f36201e1cb5c59583867c6b8979e2",
"20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a",
"cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df",
"cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df",
"20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a",
"b89a91c4cacda40c8ecafc9d9accd42d75a9158457273f12b1dbd0d1962becf3",
"a5b7f6173251349613213e8ee0517e7677c03367b213d70d62f0f251283c3253",
"582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1",
"b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053",
"6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759",
"582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1",
"b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053",
"6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759",
"e6ae5ef0a7b1d1a0276be13de9df13c2effbb8c70df45379a24882188d681b51",
"83fd2689932d14a23f17de26ddc201f5a9f69060f550992feb421396c6914b06",
"ff0c659513d58f670e1518fd529ba77dc2b051599dd74d88392a6c0a94414ee2")
'''
min_endpoint_version = "8.10.0"
optional_actions = []
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1137"
name = "Office Application Startup"
reference = "https://attack.mitre.org/techniques/T1137/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: library
library where
process.name : ("winword.exe", "excel.exe") and
(dll.code_signature.trusted == false or dll.code_signature.exists == false) and
not dll.code_signature.status : ("errorExpired", "errorCode_endpoint*") and dll.hash.sha256 != null and
dll.path :
("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Word\\Startup\\*",
"?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*",
"?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\*") and
not dll.hash.sha256 :
("77fbc709353e2fc68091ef4eaf92d9926b1f36201e1cb5c59583867c6b8979e2",
"20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a",
"cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df",
"cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df",
"20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a",
"b89a91c4cacda40c8ecafc9d9accd42d75a9158457273f12b1dbd0d1962becf3",
"a5b7f6173251349613213e8ee0517e7677c03367b213d70d62f0f251283c3253",
"582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1",
"b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053",
"6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759",
"582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1",
"b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053",
"6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759",
"e6ae5ef0a7b1d1a0276be13de9df13c2effbb8c70df45379a24882188d681b51",
"83fd2689932d14a23f17de26ddc201f5a9f69060f550992feb421396c6914b06",
"ff0c659513d58f670e1518fd529ba77dc2b051599dd74d88392a6c0a94414ee2")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.code_signature.exists | eq |
| field:"dll.code_signature.exists" kind:eq value:"false" |
dll.code_signature.trusted | eq |
| field:"dll.code_signature.trusted" kind:eq value:"false" |
dll.hash.sha256 | is_not_null | field:"Hashes" kind:is_not_null | |
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dll.code_signature.status | wildcard | errorExpired, errorCode_endpoint* | excludes:dll.code_signature.status field:"dll.code_signature.status" value:"errorExpired" field:"dll.code_signature.status" value:"errorCode_endpoint*" |
dll.hash.sha256 | eq | 77fbc709353e2fc68091ef4eaf92d9926b1f36201e1cb5c59583867c6b8979e2, 20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a, cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df, cb9b45da021609e16290e8abed62a6bc3c5ac588316bab40b091f64ea137e7df, 20a33e2b3bf3da40a44b2001b60fbdac5e047154a169d77170b2ef7b0f5ae75a, b89a91c4cacda40c8ecafc9d9accd42d75a9158457273f12b1dbd0d1962becf3, a5b7f6173251349613213e8ee0517e7677c03367b213d70d62f0f251283c3253, 582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1, b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053, 6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759, 582098e0e01d7beddd8f63333569aac96e06bfcef2d1ce61a9fddd99f651caf1, b0a8ca7e555f53536e4f570ba3c8bf34274745bb63e70539fb080a1010dba053, 6e5fab5ccee725eb32144e36e1f0486f892ed99ad85e8d6a0354ced2eeed3759, e6ae5ef0a7b1d1a0276be13de9df13c2effbb8c70df45379a24882188d681b51, 83fd2689932d14a23f17de26ddc201f5a9f69060f550992feb421396c6914b06, ff0c659513d58f670e1518fd529ba77dc2b051599dd74d88392a6c0a94414ee2 | excludes:dll.hash.sha256 |
Msiexec Execution via a Windows Script Interpreter
#Identifies when a Windows script attempts to execute commands using the Windows Installer service via Component Object Model.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies when a Windows script attempts to execute commands using the Windows Installer service via Component Object
Model.
"""
id = "1eae6aaf-7854-4fa7-8470-f19f87f9802a"
license = "Elastic License v2"
name = "Msiexec Execution via a Windows Script Interpreter"
os_list = ["windows"]
version = "1.0.5"
query = '''
sequence with maxspan=1m
[process where event.action == "start" and not user.id : "S-1-5-18" and
process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "powershell.exe", "mshta.exe", "cmstp.exe", "msxsl.exe") and
not (process.name : "powershell.exe" and
process.parent.executable : ("?:\\Program Files (x86)\\Microsoft Intune Management Extension\\agentexecutor.exe",
"?:\\Program Files (x86)\\ScreenConnect Client*\\ScreenConnect.WindowsBackstageShell.exe",
"?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dctask64.exe",
"C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe",
"C:\\Program Files\\Oracle Cloud Agent\\plugins\\unifiedmonitoring\\unifiedmonitoring.exe"))
] by process.entity_id
[process where event.action == "start" and process.parent.name : "msiexec.exe" and
not (process.name : "regsvr32.exe" and user.id : "S-1-5-18") and
not (process.name : "cmd.exe" and
process.command_line : "cmd /C if exist \"%appdata%/Messenger\" rmdir \"%appdata%/Messenger\" /s /q & if exist \"%appdata%/chatgenie\" rmdir \"%appdata%/chatgenie\" /s /q") and
not (process.executable : "?:\\Windows\\Sys*\\msiexec.exe" and
process.args : "/Z" and process.args : ("C:\\Program Files (x86)\\*.dll", "C:\\Program Files\\*.dll"))
] by process.Ext.effective_parent.entity_id
'''
min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.007"
name = "Msiexec"
reference = "https://attack.mitre.org/techniques/T1218/007/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.Ext.effective_parent.entity_id, process.entity_id.
Stage 1: process
[process where event.action == "start" and not user.id : "S-1-5-18" and
process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "powershell.exe", "mshta.exe", "cmstp.exe", "msxsl.exe") and
not (process.name : "powershell.exe" and
process.parent.executable : ("?:\\Program Files (x86)\\Microsoft Intune Management Extension\\agentexecutor.exe",
"?:\\Program Files (x86)\\ScreenConnect Client*\\ScreenConnect.WindowsBackstageShell.exe",
"?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dctask64.exe",
"C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe",
"C:\\Program Files\\Oracle Cloud Agent\\plugins\\unifiedmonitoring\\unifiedmonitoring.exe"))
] by process.entity_id
Stage 2: process
[process where event.action == "start" and process.parent.name : "msiexec.exe" and
not (process.name : "regsvr32.exe" and user.id : "S-1-5-18") and
not (process.name : "cmd.exe" and
process.command_line : "cmd /C if exist \"%appdata%/Messenger\" rmdir \"%appdata%/Messenger\" /s /q & if exist \"%appdata%/chatgenie\" rmdir \"%appdata%/chatgenie\" /s /q") and
not (process.executable : "?:\\Windows\\Sys*\\msiexec.exe" and
process.args : "/Z" and process.args : ("C:\\Program Files (x86)\\*.dll", "C:\\Program Files\\*.dll"))
] by process.Ext.effective_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" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"msiexec.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.parent.executable | wildcard | ?:\Program Files (x86)\Microsoft Intune Management Extension\agentexecutor.exe, ?:\Program Files (x86)\ScreenConnect Client*\ScreenConnect.WindowsBackstageShell.exe, ?:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\dctask64.exe, C:\Program Files (x86)\FastTrack Software\Admin By Request\AdminByRequest.exe, C:\Program Files\Oracle Cloud Agent\plugins\unifiedmonitoring\unifiedmonitoring.exe | excludes:process.parent.executable |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
process.args | eq | /Z | excludes:process.args field:"process.args" value:"/Z" |
process.args | wildcard | C:\Program Files (x86)\*.dll, C:\Program Files\*.dll | excludes:process.args field:"process.args" value:"C:\Program Files (x86)\*.dll" field:"process.args" value:"C:\Program Files\*.dll" |
process.executable | wildcard | ?:\Windows\Sys*\msiexec.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\Sys*\msiexec.exe" |
process.command_line | eq | cmd /C if exist "%appdata%/Messenger" rmdir "%appdata%/Messenger" /s /q & if exist "%appdata%/chatgenie" rmdir "%appdata%/chatgenie" /s /q | excludes:process.command_line |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.name | eq | regsvr32.exe | excludes:process.name field:"process.name" value:"regsvr32.exe" |
Potential Linux Hack Tool Launched
#Monitors for the execution of different processes that might be used by attackers for malicious intent. An alert from this rule should be investigated further, as hack tools are commonly used by blue teamers and system administrators as well.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Reconnaissance | |
| Initial Access | |
| Credential Access | |
| Discovery |
Rule Body
[metadata]
creation_date = "2023/09/22"
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Monitors for the execution of different processes that might be used by attackers for malicious intent. An alert from
this rule should be investigated further, as hack tools are commonly used by blue teamers and system administrators as
well.
"""
from = "now-9m"
index = [
"auditbeat-*",
"endgame-*",
"logs-auditd_manager.auditd-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Linux Hack Tool Launched"
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 Linux Hack Tool Launched
Linux environments often utilize various tools for system administration and security testing. While these tools serve legitimate purposes, adversaries can exploit them for malicious activities, such as unauthorized access or data exfiltration. The detection rule identifies suspicious process executions linked to known hacking tools, flagging potential misuse by monitoring specific process names and actions indicative of exploitation attempts.
### Possible investigation steps
- Review the process name that triggered the alert to determine if it matches any known hacking tools listed in the query, such as "crackmapexec" or "sqlmap".
- Check the user account associated with the process execution to assess if it is a legitimate user or potentially compromised.
- Investigate the source and destination IP addresses involved in the process execution to identify any unusual or unauthorized network activity.
- Examine the command line arguments used during the process execution to understand the intent and scope of the activity.
- Correlate the event with other logs or alerts from the same host to identify any patterns or additional suspicious activities.
- Verify if the process execution aligns with any scheduled tasks or known administrative activities to rule out false positives.
### False positive analysis
- System administrators and security teams often use tools like "john", "hashcat", and "hydra" for legitimate security testing and password recovery. To reduce false positives, create exceptions for these tools when used by authorized personnel or during scheduled security assessments.
- Blue team exercises may involve the use of exploitation frameworks such as "msfconsole" and "msfvenom". Implement a process to whitelist these activities when they are part of a sanctioned security drill.
- Network scanning tools like "zenmap" and "nuclei" are frequently used for network mapping and vulnerability assessments. Establish a baseline of normal usage patterns and exclude these from alerts when they match expected behavior.
- Web enumeration tools such as "gobuster" and "dirbuster" might be used by web developers for testing purposes. Coordinate with development teams to identify legitimate use cases and exclude these from triggering alerts.
- Regularly review and update the list of excluded processes to ensure that only non-threatening activities are exempted, maintaining a balance between security and operational efficiency.
### Response and remediation
- Immediately isolate the affected Linux host from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious processes identified by the alert, such as those listed in the detection query, to halt potential malicious activities.
- Conduct a thorough review of system logs and process execution history to identify any additional indicators of compromise or lateral movement attempts.
- Restore the affected system from a known good backup if any unauthorized changes or data exfiltration are confirmed.
- Update and patch all software and applications on the affected host to mitigate vulnerabilities that could be exploited by the identified tools.
- Implement stricter access controls and monitoring on the affected host to prevent unauthorized execution of potentially malicious tools in the future.
- Escalate the incident to the security operations team for further analysis and to determine if additional systems may be affected."""
risk_score = 47
rule_id = "1df1152b-610a-4f48-9d7a-504f6ee5d9da"
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 to select "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 = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Execution",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Auditd Manager",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name in~ (
// exploitation frameworks
"crackmapexec", "msfconsole", "msfvenom", "sliver-client", "sliver-server", "havoc",
// network scanners (nmap left out to reduce noise)
"zenmap", "nuclei", "netdiscover", "legion",
// web enumeration
"gobuster", "dirbuster", "dirb", "wfuzz", "ffuf", "whatweb", "eyewitness",
// web vulnerability scanning
"wpscan", "joomscan", "droopescan", "nikto",
// exploitation tools
"sqlmap", "commix", "yersinia",
// cracking and brute forcing
"john", "hashcat", "hydra", "ncrack", "cewl", "fcrackzip", "rainbowcrack",
// host and network
"linenum.sh", "linpeas.sh", "pspy32", "pspy32s", "pspy64", "pspy64s", "binwalk", "evil-winrm",
"linux-exploit-suggester-2.pl", "linux-exploit-suggester.sh", "panix.sh"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"
[[rule.threat.technique.subtechnique]]
id = "T1110.001"
name = "Password Guessing"
reference = "https://attack.mitre.org/techniques/T1110/001/"
[[rule.threat.technique.subtechnique]]
id = "T1110.002"
name = "Password Cracking"
reference = "https://attack.mitre.org/techniques/T1110/002/"
[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 = "T1046"
name = "Network Service Discovery"
reference = "https://attack.mitre.org/techniques/T1046/"
[[rule.threat.technique]]
id = "T1057"
name = "Process Discovery"
reference = "https://attack.mitre.org/techniques/T1057/"
[[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/"
[[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/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1595"
name = "Active Scanning"
reference = "https://attack.mitre.org/techniques/T1595/"
[[rule.threat.technique.subtechnique]]
id = "T1595.002"
name = "Vulnerability Scanning"
reference = "https://attack.mitre.org/techniques/T1595/002/"
[[rule.threat.technique.subtechnique]]
id = "T1595.003"
name = "Wordlist Scanning"
reference = "https://attack.mitre.org/techniques/T1595/003/"
[rule.threat.tactic]
id = "TA0043"
name = "Reconnaissance"
reference = "https://attack.mitre.org/tactics/TA0043/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name in~ (
"crackmapexec", "msfconsole", "msfvenom", "sliver-client", "sliver-server", "havoc",
"zenmap", "nuclei", "netdiscover", "legion",
"gobuster", "dirbuster", "dirb", "wfuzz", "ffuf", "whatweb", "eyewitness",
"wpscan", "joomscan", "droopescan", "nikto",
"sqlmap", "commix", "yersinia",
"john", "hashcat", "hydra", "ncrack", "cewl", "fcrackzip", "rainbowcrack",
"linenum.sh", "linpeas.sh", "pspy32", "pspy32s", "pspy64", "pspy64s", "binwalk", "evil-winrm",
"linux-exploit-suggester-2.pl", "linux-exploit-suggester.sh", "panix.sh"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_basename" kind:in |
Potential Okta Password Spray (Multi-Source)
#Detects potential password spray attacks where multiple source IPs target multiple Okta user accounts within a time window, indicating coordinated attacks using IP rotation to evade single-source detection.
Known False Positives
- Large enterprises with many users experiencing simultaneous password issues during credential rotation events.
- Automated monitoring or penetration testing tools scanning from multiple IPs.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- Failed Logins from Unknown or Invalid User (Kusto)
- First Occurrence of Okta User Session Started via Proxy (Elastic)
- High-Risk Admin Activity (Kusto)
- Multiple Okta Sessions Detected for a Single User (Elastic)
- Multiple Okta User Authentication Events with Same Device Token Hash (Elastic)
- New Device/Location sign-in along with critical operation (Kusto)
- Okta AiTM Session Cookie Replay (Elastic)
- Okta Login From CrowdStrike Unmanaged Device (Panther)
Rule Body
[metadata]
creation_date = "2026/02/19"
integration = ["okta"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects potential password spray attacks where multiple source IPs target multiple Okta user accounts within a
time window, indicating coordinated attacks using IP rotation to evade single-source detection.
"""
false_positives = [
"Large enterprises with many users experiencing simultaneous password issues during credential rotation events.",
"Automated monitoring or penetration testing tools scanning from multiple IPs.",
]
from = "now-1h"
interval = "15m"
language = "esql"
license = "Elastic License v2"
name = "Potential Okta Password Spray (Multi-Source)"
note = """## Triage and analysis
### Investigating Potential Okta Password Spray (Multi-Source)
This rule identifies coordinated password spray attacks where multiple source IPs target multiple user accounts within a time window. This pattern indicates attackers using IP rotation to evade single-source detection while spraying passwords across the organization.
#### Possible investigation steps
- Review the list of targeted user accounts and check if any authentications succeeded.
- Examine the source IPs and their ASN ownership for signs of proxy, VPN, or cloud infrastructure.
- Check if Okta flagged any of the sources as known threats or proxies.
- Analyze the attempts-per-user ratio to confirm spray behavior versus brute force.
- Review the geographic distribution of source IPs for coordination patterns.
- Cross-reference with successful authentication events to identify potential compromises.
### False positive analysis
- Organization-wide password rotation or expiration events may cause widespread authentication failures.
- Misconfigured SSO or SAML integrations can cause batch failures from legitimate infrastructure.
- Penetration testing should be coordinated and whitelisted in advance.
### Response and remediation
- If attack is confirmed, notify affected users and enforce password resets for potentially compromised accounts.
- Block attacking IP ranges at the network perimeter.
- Enable or strengthen MFA for targeted accounts.
- Review Okta sign-on policies to add additional friction for suspicious authentication patterns.
- Consider temporary lockdowns for highly targeted accounts.
"""
references = [
"https://support.okta.com/help/s/article/Troubleshooting-Distributed-Brute-Force-andor-Password-Spray-attacks-in-Okta",
"https://www.okta.com/identity-101/brute-force/",
"https://developer.okta.com/docs/reference/api/event-types/",
"https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
"https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
"https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
]
risk_score = 47
rule_id = "2d3c27d5-d133-4152-8102-8d051619ec4a"
setup = "The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."
severity = "medium"
tags = [
"Domain: Identity",
"Use Case: Identity and Access Audit",
"Use Case: Threat Detection",
"Data Source: Okta",
"Data Source: Okta System Logs",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM logs-okta.system-* METADATA _id, _version, _index
| WHERE
data_stream.dataset == "okta.system"
AND (event.action LIKE "user.authentication.*" OR event.action == "user.session.start")
AND okta.outcome.reason IN ("INVALID_CREDENTIALS", "LOCKED_OUT")
AND okta.actor.alternate_id IS NOT NULL
// Bucket into 15-minute windows and create user-source mapping for context
| EVAL
Esql.time_bucket = DATE_TRUNC(15 minutes, @timestamp),
Esql.user_source_info = CONCAT(
"{\"user\":\"", okta.actor.alternate_id,
"\",\"ip\":\"", COALESCE(okta.client.ip::STRING, "unknown"),
"\",\"user_agent\":\"", COALESCE(okta.client.user_agent.raw_user_agent, "unknown"), "\"}"
)
// Aggregate across entire tenant per time bucket to detect distributed spray
| STATS
Esql.unique_users = COUNT_DISTINCT(okta.actor.alternate_id),
Esql.unique_source_ips = COUNT_DISTINCT(okta.client.ip),
Esql.total_attempts = COUNT(*),
Esql.unique_user_agents = COUNT_DISTINCT(okta.client.user_agent.raw_user_agent),
Esql.unique_asns = COUNT_DISTINCT(source.as.number),
Esql.unique_countries = COUNT_DISTINCT(client.geo.country_name),
Esql.first_seen = MIN(@timestamp),
Esql.last_seen = MAX(@timestamp),
Esql.target_users = VALUES(okta.actor.alternate_id),
Esql.source_ip_values = VALUES(okta.client.ip),
Esql.user_source_mapping = VALUES(Esql.user_source_info),
Esql.event_action_values = VALUES(event.action),
Esql.user_agent_values = VALUES(okta.client.user_agent.raw_user_agent),
Esql.device_values = VALUES(okta.client.device),
Esql.is_proxy_values = VALUES(okta.security_context.is_proxy),
Esql.geo_country_values = VALUES(client.geo.country_name),
Esql.geo_city_values = VALUES(client.geo.city_name),
Esql.source_asn_values = VALUES(source.as.number),
Esql.source_asn_org_values = VALUES(source.as.organization.name),
Esql.threat_suspected_values = VALUES(okta.debug_context.debug_data.threat_suspected),
Esql.risk_level_values = VALUES(okta.debug_context.debug_data.risk_level),
Esql.risk_reasons_values = VALUES(okta.debug_context.debug_data.risk_reasons)
BY Esql.time_bucket
// Calculate spray metrics
| EVAL
Esql.attempts_per_user = Esql.total_attempts * 1.0 / Esql.unique_users,
Esql.attempts_per_ip = Esql.total_attempts * 1.0 / Esql.unique_source_ips,
Esql.users_per_ip = Esql.unique_users * 1.0 / Esql.unique_source_ips
// Distributed spray: many IPs, many users, moderate spread across both
// Key differentiator: attacks come from multiple IPs (evading per-IP rules)
| WHERE
Esql.unique_source_ips >= 5
AND Esql.unique_users >= 8
AND Esql.total_attempts >= 25
AND Esql.attempts_per_user <= 5.0
AND Esql.users_per_ip >= 1.0
| SORT Esql.total_attempts DESC
| KEEP Esql.*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"
[[rule.threat.technique.subtechnique]]
id = "T1110.003"
name = "Password Spraying"
reference = "https://attack.mitre.org/techniques/T1110/003/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: from
FROM logs-okta.system-* METADATA _id, _version, _index
Stage 2: where
| WHERE
data_stream.dataset == "okta.system"
AND (event.action LIKE "user.authentication.*" OR event.action == "user.session.start")
AND okta.outcome.reason IN ("INVALID_CREDENTIALS", "LOCKED_OUT")
AND okta.actor.alternate_id IS NOT NULL
Stage 3: eval
| EVAL
Esql.time_bucket = DATE_TRUNC(15 minutes, @timestamp),
Esql.user_source_info = CONCAT(
"{\"user\":\"", okta.actor.alternate_id,
"\",\"ip\":\"", COALESCE(okta.client.ip::STRING, "unknown"),
"\",\"user_agent\":\"", COALESCE(okta.client.user_agent.raw_user_agent, "unknown"), "\"}"
)
Stage 4: stats
| STATS
Esql.unique_users = COUNT_DISTINCT(okta.actor.alternate_id),
Esql.unique_source_ips = COUNT_DISTINCT(okta.client.ip),
Esql.total_attempts = COUNT(*),
Esql.unique_user_agents = COUNT_DISTINCT(okta.client.user_agent.raw_user_agent),
Esql.unique_asns = COUNT_DISTINCT(source.as.number),
Esql.unique_countries = COUNT_DISTINCT(client.geo.country_name),
Esql.first_seen = MIN(@timestamp),
Esql.last_seen = MAX(@timestamp),
Esql.target_users = VALUES(okta.actor.alternate_id),
Esql.source_ip_values = VALUES(okta.client.ip),
Esql.user_source_mapping = VALUES(Esql.user_source_info),
Esql.event_action_values = VALUES(event.action),
Esql.user_agent_values = VALUES(okta.client.user_agent.raw_user_agent),
Esql.device_values = VALUES(okta.client.device),
Esql.is_proxy_values = VALUES(okta.security_context.is_proxy),
Esql.geo_country_values = VALUES(client.geo.country_name),
Esql.geo_city_values = VALUES(client.geo.city_name),
Esql.source_asn_values = VALUES(source.as.number),
Esql.source_asn_org_values = VALUES(source.as.organization.name),
Esql.threat_suspected_values = VALUES(okta.debug_context.debug_data.threat_suspected),
Esql.risk_level_values = VALUES(okta.debug_context.debug_data.risk_level),
Esql.risk_reasons_values = VALUES(okta.debug_context.debug_data.risk_reasons)
BY Esql.time_bucket
Stage 5: eval
| EVAL
Esql.attempts_per_user = Esql.total_attempts * 1.0 / Esql.unique_users,
Esql.attempts_per_ip = Esql.total_attempts * 1.0 / Esql.unique_source_ips,
Esql.users_per_ip = Esql.unique_users * 1.0 / Esql.unique_source_ips
Stage 6: where
| WHERE
Esql.unique_source_ips >= 5
AND Esql.unique_users >= 8
AND Esql.total_attempts >= 25
AND Esql.attempts_per_user <= 5.0
AND Esql.users_per_ip >= 1.0
Stage 7: sort
| SORT Esql.total_attempts DESC
Stage 8: keep
| KEEP Esql.*
Indicators
These rows show field, operator, and value matches.
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.* | KEEP Esql.* |
Potential Payload Download via AppleScript Applet
#Identifies activity where an AppleScript applet is executed followed by the immediate execution of the "curl" command. An attacker might use an AppleScript applet to automate malicious tasks and leverage "curl" to download additional payloads or communicate with a command and control (C2) server. This activity has been observed being utilized by XCSSET and more recently by a new threat deemed "Rustbucket" by JAMF to bypass Gatekeeper and download a second stage payload.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment | |
| Command & Control |
Rule Body
[rule]
description = """
Identifies activity where an AppleScript applet is executed followed by the immediate execution of the "curl" command.
An attacker might use an AppleScript applet to automate malicious tasks and leverage "curl" to download additional
payloads or communicate with a command and control (C2) server. This activity has been observed being utilized by XCSSET
and more recently by a new threat deemed "Rustbucket" by JAMF to bypass Gatekeeper and download a second stage payload.
"""
id = "52ad2198-1a7b-4492-b578-6ffa110f9b09"
license = "Elastic License v2"
name = "Potential Payload Download via AppleScript Applet"
os_list = ["macos"]
reference = [
"https://www.jamf.com/blog/bluenoroff-apt-targets-macos-rustbucket-malware/",
"https://attack.mitre.org/techniques/T1553/001/",
"https://attack.mitre.org/techniques/T1105/",
]
version = "1.0.19"
query = '''
process where event.type == "start" and
process.name in ("curl", "nscurl") and
(process.Ext.effective_parent.name == "applet" or process.parent.name == "applet") and
not process.args like "POST"
'''
min_endpoint_version = "8.7.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 = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[threat.technique.subtechnique]]
id = "T1553.001"
name = "Gatekeeper Bypass"
reference = "https://attack.mitre.org/techniques/T1553/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and
process.name in ("curl", "nscurl") and
(process.Ext.effective_parent.name == "applet" or process.parent.name == "applet") and
not process.args like "POST"
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | POST | excludes:process.args field:"process.args" value:"POST" |
Potential Port Monitor or Print Processor Registration Abuse
#Identifies port monitor and print processor registry modifications. Adversaries may abuse port monitor and print processors to run malicious DLLs during system boot that will be executed as SYSTEM for privilege escalation and/or persistence, if permissions allow writing a fully-qualified pathname for that DLL.
MITRE ATT&CK Coverage
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2021/01/21"
integration = ["endpoint", "m365_defender"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies port monitor and print processor registry modifications. Adversaries may abuse port monitor and print
processors to run malicious DLLs during system boot that will be executed as SYSTEM for privilege escalation and/or
persistence, if permissions allow writing a fully-qualified pathname for that DLL.
"""
from = "now-9m"
index = ["logs-endpoint.events.registry-*", "endgame-*", "logs-m365_defender.event-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Port Monitor or Print Processor Registration Abuse"
references = ["https://www.welivesecurity.com/2020/05/21/no-game-over-winnti-group/"]
risk_score = 47
rule_id = "8f3e91c7-d791-4704-80a1-42c160d7aa27"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Microsoft Defender XDR",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where host.os.type == "windows" and event.type == "change" and
registry.path : (
"HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\*",
"HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\*",
"\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\*",
"\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\*"
) and registry.data.strings : "*.dll" and
/* exclude SYSTEM SID - look for changes by non-SYSTEM user */
not user.id : "S-1-5-18"
'''
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)
"""
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 Port Monitor or Print Processor Registration Abuse
Port monitors and print processors are integral to Windows printing, managing data flow and processing print jobs. Adversaries exploit these by registering malicious DLLs, which execute with SYSTEM privileges at boot, enabling persistence and privilege escalation. The detection rule identifies registry changes in specific paths, focusing on non-SYSTEM user modifications, to flag potential abuse.
### Possible investigation steps
- Review the registry path specified in the alert to confirm the presence of any unauthorized or suspicious DLLs in the paths: HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\* and HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\*.
- Identify the user account associated with the registry change by examining the user.id field, ensuring it is not the SYSTEM account (S-1-5-18), and determine if the account has a legitimate reason to modify these registry paths.
- Check the file properties and digital signatures of the DLLs found in the registry paths to verify their legitimacy and identify any anomalies or signs of tampering.
- Investigate the system's event logs around the time of the registry change to gather additional context, such as other activities performed by the same user or related processes that might indicate malicious behavior.
- Conduct a threat intelligence search on the identified DLLs and any associated file hashes to determine if they are known to be associated with malicious activity or threat actors.
- Assess the system for any signs of privilege escalation or persistence mechanisms that may have been established as a result of the registry modification, such as new services or scheduled tasks.
### False positive analysis
- Legitimate software installations or updates may modify print processor or port monitor registry paths. Users should verify if recent installations or updates coincide with the detected changes.
- System administrators performing maintenance or configuration changes might trigger alerts. Ensure that such activities are documented and cross-referenced with the alert timestamps.
- Some third-party printing solutions may register their own DLLs in these registry paths. Identify and whitelist these known applications to prevent unnecessary alerts.
- Automated scripts or management tools that modify printer settings could cause false positives. Review and adjust these tools to ensure they operate under expected user accounts or exclude their known behaviors.
- Regularly review and update the exclusion list to include any new benign applications or processes that interact with the monitored registry paths.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further spread or communication with potential command and control servers.
- Terminate any suspicious processes associated with the malicious DLLs identified in the registry paths to halt their execution.
- Remove the unauthorized DLL entries from the registry paths: HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\* and HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\* to eliminate persistence mechanisms.
- Conduct a thorough scan of the system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any additional malicious files or remnants.
- Review and reset credentials for any accounts that may have been compromised, especially those with elevated privileges, to prevent unauthorized access.
- Implement application whitelisting to prevent unauthorized DLLs from executing, focusing on the paths identified in the alert.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected, ensuring comprehensive threat containment and eradication."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[rule.threat.technique.subtechnique]]
id = "T1547.010"
name = "Port Monitors"
reference = "https://attack.mitre.org/techniques/T1547/010/"
[[rule.threat.technique.subtechnique]]
id = "T1547.012"
name = "Print Processors"
reference = "https://attack.mitre.org/techniques/T1547/012/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[rule.threat.technique.subtechnique]]
id = "T1547.010"
name = "Port Monitors"
reference = "https://attack.mitre.org/techniques/T1547/010/"
[[rule.threat.technique.subtechnique]]
id = "T1547.012"
name = "Print Processors"
reference = "https://attack.mitre.org/techniques/T1547/012/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: registry
registry where host.os.type == "windows" and event.type == "change" and
registry.path : (
"HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\*",
"HKLM\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\*",
"\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Control\\Print\\Monitors\\*",
"\\REGISTRY\\MACHINE\\SYSTEM\\*ControlSet*\\Control\\Print\\Environments\\Windows*\\Print Processors\\*"
) and registry.data.strings : "*.dll" 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:"change" |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard value:"*.dll" |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
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" |
Potential Process Name Stomping with Prctl
#This rule leverages Auditd data to detect the use of the "prctl" syscall to potentially hide a process by changing its name. The "prctl" syscall is used to control various process attributes. Attackers can use this syscall to change the name of a process to a hidden directory or file, making it harder to detect. The query looks for the "prctl" syscall with the "PR_SET_NAME" argument set to "f" (PR_SET_NAME is used to set the name of a process).
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[metadata]
creation_date = "2025/01/09"
integration = ["auditd_manager"]
maturity = "production"
updated_date = "2025/12/18"
[rule]
author = ["Elastic"]
description = """
This rule leverages Auditd data to detect the use of the "prctl" syscall to potentially hide a process
by changing its name. The "prctl" syscall is used to control various process attributes. Attackers can use
this syscall to change the name of a process to a hidden directory or file, making it harder to detect. The
query looks for the "prctl" syscall with the "PR_SET_NAME" argument set to "f" (PR_SET_NAME is used to set
the name of a process).
"""
from = "now-9m"
index = ["logs-auditd_manager.auditd-*", "auditbeat-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Process Name Stomping with Prctl"
references = [
"https://haxrob.net/process-name-stomping/",
"https://haxrob.net/hiding-in-plain-sight-part-2/",
"https://www.elastic.co/security-labs/linux-detection-engineering-with-auditd",
]
risk_score = 73
rule_id = "fef62ecf-0260-4b71-848b-a8624b304828"
setup = """## Setup
This rule requires data coming in from Auditd Manager.
### 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" on a Linux 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 the following additional audit rules are required to be added to the integration:
-- "-a exit,always -F arch=b64 -S prctl -k prctl_detection"
"""
severity = "high"
tags = [
"Data Source: Auditd Manager",
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and auditd.data.syscall == "prctl" and auditd.data.a0 == "f" and
process.executable like (
"/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/var/run/*", "/etc/update-motd.d/*",
"/tmp/*", "/var/log/*", "/var/tmp/*", "/home/*", "/run/shm/*", "/run/*", "./*"
) and
not process.executable like ("/home/*/.vscode-server/*", "/tmp/VeeamAgent*", "/home/*/.xmonad/xmonad*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 Potential Process Name Stomping with Prctl
The `prctl` syscall in Linux allows processes to modify their attributes, including renaming themselves. This capability can be exploited by attackers to disguise malicious processes, making them harder to identify. The detection rule monitors for `prctl` invocations with specific arguments indicative of name changes, especially when linked to suspicious directories, thus flagging potential evasion attempts.
### Possible investigation steps
- Review the process details associated with the alert, focusing on the executable path to determine if it matches any suspicious directories listed in the query, such as "/tmp/*" or "/var/tmp/*".
- Examine the process tree to identify the parent process and any child processes spawned by the suspicious process, which may provide context on how the process was initiated and its potential impact.
- Check the command line arguments and environment variables of the process to gather additional context on its intended function and any anomalies.
- Investigate the user account under which the process is running to determine if it aligns with expected behavior or if it indicates potential compromise.
- Correlate the alert with other security events or logs, such as file modifications or network connections, to identify any related malicious activity or patterns.
- Assess the historical activity of the process executable and its associated files to determine if this behavior is new or part of a recurring pattern.
### False positive analysis
- System maintenance scripts may invoke prctl to rename processes for legitimate reasons. Review scheduled tasks and maintenance scripts in directories like /etc/cron.* and /etc/init.d to identify benign uses.
- Development environments often use prctl for testing purposes. Exclude known development directories such as /home/developer or /tmp/dev from the rule to reduce noise.
- Some monitoring or logging tools might use prctl to rename their processes for clarity. Identify these tools and add their executable paths to an exception list.
- Custom scripts or applications that manage process names for operational reasons should be documented. Exclude these scripts by specifying their paths in the rule configuration.
- Regularly review and update the exception list to ensure it reflects the current environment and does not inadvertently exclude new threats.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further malicious activity or lateral movement.
- Terminate any suspicious processes identified by the detection rule, especially those with altered names in critical directories.
- Conduct a thorough review of the affected system's process tree and file system to identify any additional signs of compromise or persistence mechanisms.
- Restore any altered or suspicious files from a known good backup to ensure system integrity.
- Update and patch the affected system to close any vulnerabilities that may have been exploited by the attacker.
- Monitor the network for any signs of similar activity or attempts to use the `prctl` syscall with the `PR_SET_NAME` argument in other systems.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if broader organizational impacts exist."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[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 == "linux" and auditd.data.syscall == "prctl" and auditd.data.a0 == "f" and
process.executable like (
"/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/var/run/*", "/etc/update-motd.d/*",
"/tmp/*", "/var/log/*", "/var/tmp/*", "/home/*", "/run/shm/*", "/run/*", "./*"
) and
not process.executable like ("/home/*/.vscode-server/*", "/tmp/VeeamAgent*", "/home/*/.xmonad/xmonad*linux*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
auditd.data.a0 | eq |
| field:"auditd.data.a0" kind:eq value:"f" |
auditd.data.syscall | eq |
| field:"auditd.data.syscall" kind:eq value:"prctl" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | /home/*/.vscode-server/*, /tmp/VeeamAgent*, /home/*/.xmonad/xmonad*linux* | excludes:process.executable field:"process.executable" value:"/home/*/.vscode-server/*" field:"process.executable" value:"/tmp/VeeamAgent*" field:"process.executable" value:"/home/*/.xmonad/xmonad*linux*" |
Potential Protocol Tunneling via Yuze
#Identifies execution of Yuze, a lightweight open-source tunneling tool used for intranet penetration. Yuze supports forward and reverse SOCKS5 proxy tunneling and is typically executed via rundll32 loading yuze.dll with the RunYuze export. Threat actors may use it to proxy C2 or pivot traffic.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Command & Control |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2026/03/18"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender", "system", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies execution of Yuze, a lightweight open-source tunneling tool used for intranet penetration. Yuze supports
forward and reverse SOCKS5 proxy tunneling and is typically executed via rundll32 loading yuze.dll with the RunYuze
export. Threat actors may use it to proxy C2 or pivot traffic.
"""
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.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Protocol Tunneling via Yuze"
note = """## Triage and analysis
### Investigating Potential Protocol Tunneling via Yuze
Yuze is a C-based tunneling tool used for intranet penetration and supports forward and reverse SOCKS5 proxy tunneling. It is commonly executed as `rundll32 yuze.dll,RunYuze reverse -c <ip>:<port>` and has been observed in threat actor campaigns.
### Possible investigation steps
- Confirm the command line contains `yuze.dll` and `RunYuze`; typical form is `rundll32 yuze.dll,RunYuze reverse -c <ip>:<port>`.
- Extract the remote endpoint from the `-c` argument (C2 or relay) and look up the IP/domain in threat intelligence.
- Locate where yuze.dll was loaded from; check file creation time to see if it was recently dropped.
- Identify the parent process that started rundll32 (script, scheduled task, exploit, etc.) to understand the execution chain.
- Correlate with network events for outbound connections from this host to the IP/port in the command line.
### False positive analysis
- Legitimate use of Yuze is rare; most hits are likely malicious or red-team. If you use Yuze for authorized testing, consider an exception by host or user.
### Response and remediation
- Isolate the host and terminate the rundll32 process.
- Remove yuze.dll from disk and hunt for other copies or related artifacts.
- Block the C2/relay IP or domain at DNS/firewall; rotate credentials if the tunnel was used for access.
"""
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)
"""
references = [
"https://attack.mitre.org/techniques/T1572/",
"https://github.com/P001water/yuze",
"https://www.trendmicro.com/tr_tr/research/26/c/dissecting-a-warlock-attack.html",
]
risk_score = 47
rule_id = "e7f2c4a1-9b3d-5e8f-c6a0-2d1b4e7f8c3a"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Command and Control",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Microsoft Defender XDR",
"Data Source: Crowdstrike",
"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.args : "reverse" and process.args : ("-c", "-s")) or
(process.args : ("proxy", "fwd") and process.args : "-l")
) and
(?process.code_signature.exists == false or process.name : "rundll32.exe")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1090"
name = "Proxy"
reference = "https://attack.mitre.org/techniques/T1090/"
[[rule.threat.technique]]
id = "T1572"
name = "Protocol Tunneling"
reference = "https://attack.mitre.org/techniques/T1572/"
[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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"
[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.args : "reverse" and process.args : ("-c", "-s")) or
(process.args : ("proxy", "fwd") and process.args : "-l")
) and
(?process.code_signature.exists == false or process.name : "rundll32.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"rundll32.exe" |
Potential Root Effective Shell from Non-Standard Path via Auditd
#Identifies process execution events where the effective user is root while the real user is not, the process arguments include the privileged shell flag commonly associated with setuid-capable shells, and the executable path is outside standard system binary directories. That combination is consistent with abuse of setuid shells or similar helpers copied or linked into writable locations, a pattern used to regain a root context after local exploitation.
Known False Positives
- Custom administrative wrappers or hardened images that legitimately ship a setuid shell outside /usr/bin or /bin for emergency access may match; document and exclude by executable hash or path when verified.
- Field mapping differences between auditd versions can occasionally mis-populate effective versus real user IDs; validate raw audit fields when triaging unexpected hits.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2026/04/24"
integration = ["auditd_manager"]
maturity = "production"
updated_date = "2026/07/17"
[rule]
author = ["Elastic"]
description = """
Identifies process execution events where the effective user is root while the real user is not, the process arguments
include the privileged shell flag commonly associated with setuid-capable shells, and the executable path is outside
standard system binary directories. That combination is consistent with abuse of setuid shells or similar helpers
copied or linked into writable locations, a pattern used to regain a root context after local exploitation.
"""
false_positives = [
"""
Custom administrative wrappers or hardened images that legitimately ship a setuid shell outside /usr/bin or /bin
for emergency access may match; document and exclude by executable hash or path when verified.
""",
"""
Field mapping differences between auditd versions can occasionally mis-populate effective versus real user IDs;
validate raw audit fields when triaging unexpected hits.
""",
]
from = "now-9m"
index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
language = "kuery"
license = "Elastic License v2"
name = "Potential Root Effective Shell from Non-Standard Path via Auditd"
note = """## Triage and analysis
### Investigating Potential Root Effective Shell from Non-Standard Path via Auditd
The rule surfaces executed processes where effective UID is root, real UID is not, the argument list contains -p
(often used with bash, dash, or similar to preserve privileges), and the executable is not under typical distro paths.
That aligns with interactive or scripted abuse of elevated shells from user-controlled locations.
### Possible investigation steps
- Inspect process.executable, process.args, process.parent, and the full command line reconstructed in audit or ECS
fields.
- Confirm user.id versus user.effective.id and map the login session, TTY, and parent chain (SSH, cron, container
entrypoint).
- Check the on-disk binary for setuid bit, ownership, and recent file creation or rename events in the same directory.
- Correlate with authentication logs and sudo or polkit outcomes around the same timestamp.
### False positive analysis
- Rare vendor bundles that place setuid helpers under /opt or /usr/local may need allowlisting after review.
- Container hosts where audit captures host and namespace PIDs together can add noise; scope by host group if needed.
### Response and remediation
- If malicious, isolate the host, remove or quarantine the binary, revoke compromised accounts, audit all setuid
binaries on the filesystem, and re-image if integrity cannot be proven.
"""
references = [
"https://attack.mitre.org/techniques/T1548/001/",
"https://gtfobins.github.io/gtfobins/bash/",
]
risk_score = 73
rule_id = "7f3a9c2e-1d4b-5e6f-8a9b-0c1d2e3f4a5b"
setup = """## Setup
This rule requires data from Auditd Manager or legacy Auditbeat shipping comparable ECS process fields on Linux.
### Auditd Manager Integration Setup
Auditd Manager receives events from the Linux audit subsystem. Deploy the integration from Kibana under Integrations,
add it to an agent policy, and install the Elastic Agent on Linux hosts that should emit syscall-backed process data.
For integration details, see the [Auditd Manager documentation](https://docs.elastic.co/integrations/auditd_manager).
Ensure process execution (for example execve) is audited so `event.action`, `user.id`, `user.effective.id`,
`process.args`, and `process.executable` are populated consistently for interactive shells.
"""
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Data Source: Auditd Manager",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
host.os.type:linux and event.category:process and
event.action:(exec or executed) and user.id:(* and not 0) and
process.executable:(* and not (/bin/* or /nix/store/*/bin/sudo or /run/wrappers/wrappers*/sudo or /sbin/* or /usr/bin/* or /usr/sbin/* or "/usr/local/bin/pbrun")) and
user.effective.id:0 and process.args:-p
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[rule.threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: query
host.os.type:linux and event.category:process and
event.action:(exec or executed) and user.id:(* and not 0) and
process.executable:(* and not (/binbin/sudo or /run/wrappers/wrappers*/sudo or /sbin/* or /usr/bin/* or /usr/sbin/* or "/usr/local/bin/pbrun")) and
user.effective.id:0 and process.args:-p
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | /usr/local/bin/pbrun | excludes:process.executable field:"process.executable" value:"/usr/local/bin/pbrun" |
process.executable | starts_with | /bin/ | excludes:process.executable field:"process.executable" value:"/bin/" |
process.executable | starts_with | /sbin/ | excludes:process.executable field:"process.executable" value:"/sbin/" |
process.executable | starts_with | /usr/bin/ | excludes:process.executable field:"process.executable" value:"/usr/bin/" |
process.executable | starts_with | /usr/sbin/ | excludes:process.executable field:"process.executable" value:"/usr/sbin/" |
process.executable | wildcard | /nix/store/*/bin/sudo | excludes:process.executable field:"process.executable" value:"/nix/store/*/bin/sudo" |
process.executable | wildcard | /run/wrappers/wrappers*/sudo | excludes:process.executable field:"process.executable" value:"/run/wrappers/wrappers*/sudo" |
user.id | eq | 0 | excludes:user.id field:"user.id" value:"0" |
Potential Shell via Wildcard Injection Detected
#This rule monitors for the execution of a set of linux binaries, that are potentially vulnerable to wildcard injection, with suspicious command line flags followed by a shell spawn event. Linux wildcard injection is a type of security vulnerability where attackers manipulate commands or input containing wildcards (e.g., *, ?, []) to execute unintended operations or access sensitive data by tricking the system into interpreting the wildcard characters in unexpected ways.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2023/07/28"
integration = ["endpoint", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the execution of a set of linux binaries, that are potentially vulnerable to wildcard injection,
with suspicious command line flags followed by a shell spawn event. Linux wildcard injection is a type of security
vulnerability where attackers manipulate commands or input containing wildcards (e.g., *, ?, []) to execute unintended
operations or access sensitive data by tricking the system into interpreting the wildcard characters in unexpected ways.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "logs-sentinel_one_cloud_funnel.*", "logs-crowdstrike.fdr*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Shell via Wildcard Injection Detected"
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 Shell via Wildcard Injection Detected
Wildcard injection exploits vulnerabilities in Linux command-line utilities by manipulating wildcard characters to execute unauthorized commands. Adversaries leverage this to escalate privileges or execute arbitrary code. The detection rule identifies suspicious use of vulnerable binaries like `tar`, `rsync`, and `zip` followed by shell execution, indicating potential exploitation attempts.
### Possible investigation steps
- Review the process details to identify the specific command executed, focusing on the process name and arguments, especially those involving `tar`, `rsync`, or `zip` with suspicious flags like `--checkpoint=*`, `-e*`, or `--unzip-command`.
- Examine the parent process information to determine if a shell process (e.g., `bash`, `sh`, `zsh`) was spawned, indicating potential exploitation.
- Check the process execution path to ensure it does not match the exclusion pattern `/tmp/newroot/*`, which might indicate a benign operation.
- Investigate the host's recent activity logs to identify any other suspicious or related events that might indicate a broader attack or compromise.
- Correlate the alert with any other security events or alerts from the same host to assess if this is part of a larger attack pattern or campaign.
- Assess the user account associated with the process execution to determine if it has the necessary privileges and if the activity aligns with expected behavior for that account.
### False positive analysis
- Legitimate use of tar, rsync, or zip with wildcard-related flags in automated scripts or backup processes can trigger false positives. Review the context of these processes and consider excluding specific scripts or directories from monitoring if they are verified as safe.
- System administrators or maintenance scripts may use shell commands following tar, rsync, or zip for legitimate purposes. Identify these routine operations and create exceptions for known safe parent processes or specific command patterns.
- Development environments or testing scenarios might involve intentional use of wildcard characters for testing purposes. Exclude these environments from the rule or adjust the rule to ignore specific user accounts or process paths associated with development activities.
- Scheduled tasks or cron jobs that involve the use of these binaries with wildcard flags can be mistaken for malicious activity. Verify the legitimacy of these tasks and exclude them based on their schedule or specific command line arguments.
- Security tools or monitoring solutions that simulate attacks for testing or validation purposes might trigger this rule. Ensure these tools are recognized and excluded from monitoring to prevent unnecessary alerts.
### Response and remediation
- Immediately isolate the affected host from the network to prevent further unauthorized access or lateral movement.
- Terminate any suspicious processes identified in the alert, particularly those involving the execution of shell commands following the use of `tar`, `rsync`, or `zip`.
- Conduct a thorough review of the affected system's logs to identify any additional indicators of compromise or unauthorized access attempts.
- Restore the affected system from a known good backup if any unauthorized changes or malicious activities are confirmed.
- Apply security patches and updates to the affected system to address any vulnerabilities that may have been exploited.
- Implement file integrity monitoring on critical systems to detect unauthorized changes to system binaries or configuration files.
- Escalate the incident to the security operations team for further investigation and to assess the potential impact on other systems within the network."""
references = ["https://www.exploit-db.com/papers/33930"]
risk_score = 47
rule_id = "0b803267-74c5-444d-ae29-32b5db2d562a"
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 = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
"Data Source: Crowdstrike",
]
type = "eql"
query = '''
sequence by host.id with maxspan=1s
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and (
(process.name == "tar" and process.args : "--checkpoint=*" and process.args : "--checkpoint-action=*") or
(process.name == "rsync" and process.args : "-e*") or
(process.name == "zip" and process.args == "--unzip-command")
) and not (
process.executable like "/tmp/newroot/*" or
process.working_directory like ("/home/*/.steam/*", "/home/*/steam/*", "/home/*/.local/share/Steam")
)
] by process.entity_id
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
process.parent.name : ("tar", "rsync", "zip") and
process.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
] by process.parent.entity_id
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "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]]
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/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1s, correlated by host.id, process.entity_id, process.parent.entity_id.
Stage 1: process
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and (
(process.name == "tar" and process.args : "--checkpoint=*" and process.args : "--checkpoint-action=*") or
(process.name == "rsync" and process.args : "-e*") or
(process.name == "zip" and process.args == "--unzip-command")
) and not (
process.executable like "/tmp/newroot/*" or
process.working_directory like ("/home/*/.steam/*", "/home/*/steam/*", "/home/*/.local/share/Steam")
)
] by process.entity_id
Stage 2: process
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
process.parent.name : ("tar", "rsync", "zip") and
process.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"--unzip-command" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | starts_with | /tmp/newroot/ | excludes:process.executable field:"process.executable" value:"/tmp/newroot/" |
process.working_directory | wildcard | /home/*/.steam/*, /home/*/steam/*, /home/*/.local/share/Steam | excludes:process.working_directory field:"process.working_directory" value:"/home/*/.steam/*" field:"process.working_directory" value:"/home/*/steam/*" field:"process.working_directory" value:"/home/*/.local/share/Steam" |
Potential Windows Session Hijacking via CcmExec
#This detection rule identifies when 'SCNotification.exe' loads an untrusted DLL, which is a potential indicator of an attacker attempt to hijack/impersonate a Windows user session.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 7: Image loaded |
Rule Body
[metadata]
creation_date = "2024/04/17"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
This detection rule identifies when 'SCNotification.exe' loads an untrusted DLL, which is a potential indicator of an
attacker attempt to hijack/impersonate a Windows user session.
"""
from = "now-9m"
index = ["logs-endpoint.events.library-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Windows Session Hijacking via CcmExec"
references = [
"https://cloud.google.com/blog/topics/threat-intelligence/windows-session-hijacking-via-ccmexec",
"https://mayfly277.github.io/posts/SCCM-LAB-part0x3/#impersonate-users---revshell-connected-users",
]
risk_score = 47
rule_id = "e7357fec-6e9c-41b9-b93d-6e4fc40c7d47"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
library where host.os.type == "windows" and process.name : "SCNotification.exe" and
(dll.Ext.relative_file_creation_time < 86400 or dll.Ext.relative_file_name_modify_time <= 500) and dll.code_signature.status != "trusted"
'''
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
"""
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 Windows Session Hijacking via CcmExec
CcmExec, part of Microsoft's System Center Configuration Manager, manages client configurations and software updates. Adversaries may exploit it by loading malicious DLLs into SCNotification.exe, a process associated with user notifications. This detection rule identifies suspicious DLL activity, such as recent file creation or modification and untrusted signatures, indicating potential session hijacking attempts.
### Possible investigation steps
- Review the alert details to confirm that the process name is SCNotification.exe and check the associated DLL file's creation or modification times to ensure they match the query conditions.
- Investigate the untrusted DLL by examining its file path, hash, and any available metadata to determine its origin and legitimacy.
- Check the code signature status of the DLL to understand why it is marked as untrusted and verify if it has been tampered with or is from an unknown publisher.
- Analyze recent system logs and user activity around the time the DLL was loaded to identify any suspicious behavior or unauthorized access attempts.
- Correlate the alert with other security events or alerts from the same host to identify potential patterns or related incidents that could indicate a broader attack.
### False positive analysis
- Legitimate software updates or installations may trigger the rule if they involve recent DLL file creation or modification. Users can create exceptions for known software update processes to prevent unnecessary alerts.
- System maintenance activities, such as patch management or configuration changes, might cause SCNotification.exe to load new DLLs. Exclude these activities by identifying and whitelisting trusted maintenance operations.
- Custom or in-house applications that are not signed by a recognized authority may be flagged. Ensure these applications are signed with a trusted certificate or add them to an allowlist to avoid false positives.
- Security tools or monitoring software that interact with SCNotification.exe could be mistakenly identified. Verify these tools and exclude them from the rule if they are deemed safe and necessary for operations.
### Response and remediation
- Isolate the affected system from the network to prevent further unauthorized access or lateral movement by the attacker.
- Terminate the SCNotification.exe process to stop the execution of the untrusted DLL and prevent further malicious activity.
- Conduct a thorough scan of the affected system using updated antivirus and anti-malware tools to identify and remove any additional malicious files or software.
- Review and restore any modified or corrupted system files from a known good backup to ensure system integrity.
- Investigate the source of the untrusted DLL and remove any unauthorized software or scripts that may have facilitated its introduction.
- Implement application whitelisting to prevent unauthorized DLLs from being loaded by SCNotification.exe or other critical processes in the future.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[rule.threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: library
library where host.os.type == "windows" and process.name : "SCNotification.exe" and
(dll.Ext.relative_file_creation_time < 86400 or dll.Ext.relative_file_name_modify_time <= 500) and dll.code_signature.status != "trusted"
Indicators
These rows show field, operator, and value matches.
PowerShell Invoke-NinjaCopy script
#Detects PowerShell script block content containing Invoke-NinjaCopy or related Stealth* functions used for direct volume file access. Attackers use NinjaCopy to read locked system files such as NTDS.dit or registry hives for credential dumping.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth | |
| Credential Access |
Rule Body
[metadata]
creation_date = "2023/01/23"
integration = ["windows"]
maturity = "production"
updated_date = "2026/04/26"
[rule]
author = ["Elastic"]
description = """
Detects PowerShell script block content containing Invoke-NinjaCopy or related Stealth* functions used for direct volume
file access. Attackers use NinjaCopy to read locked system files such as NTDS.dit or registry hives for credential
dumping.
"""
from = "now-9m"
index = ["logs-windows.powershell*", "winlogbeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "PowerShell Invoke-NinjaCopy script"
references = [
"https://github.com/BC-SECURITY/Empire/blob/main/empire/server/data/module_source/collection/Invoke-NinjaCopy.ps1",
]
risk_score = 73
rule_id = "b8386923-b02c-4b94-986a-d223d9b01f88"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: PowerShell Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
"StealthReadFile" or
"StealthReadFileAddr" or
"StealthCloseFileDelegate" or
"StealthOpenFile" or
"StealthCloseFile" or
"Invoke-NinjaCopy"
) and
not powershell.file.script_block_text : (
"sentinelbreakpoints" and "Set-PSBreakpoint" and "PowerSploitIndicators"
)
'''
note = """## Triage and analysis
### Investigating PowerShell Invoke-NinjaCopy script
#### Possible investigation steps
- Does the alert-preserved script content show active NinjaCopy direct-volume access rather than inert reference text?
- Focus: `powershell.file.script_block_text`, `powershell.file.script_block_length`, and file-backed `file.path` or `file.name`.
- Implication: escalate sooner when the fragment shows `Invoke-NinjaCopy`, `StealthOpenFile`, `StealthReadFile`, credential-store targets, output destinations, or cleanup logic; lower concern only for inert example or recognized validation content that later recovery does not contradict.
- Does full script reconstruction reveal target, destination, or cleanup behavior that the matching fragment did not show?
- Why: Script Block Logging can split one script across events; later fragments often contain output paths, loops, or cleanup logic that change urgency.
- Focus: reconstruct on `host.id` + `powershell.file.script_block_id`, ordering by `powershell.sequence` / `powershell.total`; read `powershell.file.script_block_text` for "-Path", "-ComputerName", "-LocalDestination", or "-RemoteDestination". $investigate_2
- Hint: if `powershell.sequence` is missing or never reaches `powershell.total`, record the gap before treating the script as understood.
- Implication: escalate when reconstruction adds remote targets, credential stores (`NTDS.dit`, `SAM`, `SYSTEM`, `SECURITY`), temp/share destinations, large copy buffers, archive paths, encoding, or delete-after-copy logic; lower concern when the full script is confirmed lab, forensic, or validation content with no hostile follow-on behavior.
- Does the script provenance and reconstructed target fit a recognized workflow?
- Focus: `file.path`, `file.name`, `user.id`, `host.id`, and reconstructed "-Path", "-ComputerName", "-LocalDestination", or "-RemoteDestination".
- Hint: if `file.path` is absent, treat content as inline, generated, interactive, or remote; do not close on path absence alone.
- Implication: escalate when source is temp, downloads, or user-writable shares, or parameters name remote servers, `NTDS.dit`, registry hives, or staging destinations; lower concern when source, targets, and destinations match one recognized forensic, IR, lab, or validation workflow.
- Do surrounding script blocks from the same user and host show staging, retries, or variant logic?
- Focus: manually search the same execution window for `user.id`, `host.id`, `powershell.file.script_block_text`, and adjacent `powershell.file.script_block_id` values.
- Hint: renamed wrappers may omit `Invoke-NinjaCopy`; still check `Stealth*` helpers and reconstructed target or destination values.
- Implication: escalate when adjacent fragments show retries, renamed helpers, alternative raw-volume logic, output-file reuse, or follow-on compression and cleanup.
- Can process telemetry recover the PowerShell process and explain how it was launched?
- Focus: match the PowerShell PID on `host.id`, `process.pid`, and `@timestamp`; record `process.entity_id`, then interpret `process.command_line`, `process.parent.command_line`, and `process.Ext.token.integrity_level_name`. $investigate_3
- Hint: recover the matching process via `host.id + process.pid` before using `process.*` or `process.parent.*`. If no process start event appears, expand the window because PowerShell can predate the script block; if still absent, bound file review to `host.id`, `user.id`, `process.pid`, and alert time.
- Implication: escalate when recovery shows encoded commands, remote-admin launchers, Office/browser ancestry, or unexpected high-integrity execution; unresolved process recovery does not make direct-volume script content benign.
- Do file events confirm copied credential stores or staging artifacts?
- Focus: endpoint file events scoped to `host.id`, `process.pid`, and alert time; review `file.path`, `file.directory`, and `file.name`. $investigate_4
- Implication: escalate when file activity confirms copied hives, `NTDS.dit`, archives, or renamed staging files; missing file telemetry is unresolved, not benign.
- If the local script, launch, or artifact answers remain suspicious or unresolved, is this script block isolated, or part of broader suspicious activity for the same user or host?
- Focus: related `user.id` alerts for repeated credential access, execution, or post-compromise behavior. $investigate_0
- Hint: compare `host.id` alerts for credential access, persistence, or staging. $investigate_1
- Implication: broaden scope when either view shows adjacent credential-access or post-compromise behavior; keep it local only when both are quiet and the local evidence fits one recognized workflow.
- Escalate when script content, reconstruction, target parameters, launch context, or artifacts show unauthorized direct-volume access or credential-store targeting; close only when source path, targets, destinations, launch context, and artifacts align with one recognized forensic, IR, lab, or validation workflow; preserve and escalate if mixed or incomplete.
### False positive analysis
- Recognized red-team, security-validation, forensic-acquisition, or IR workflows can legitimately include NinjaCopy-derived code. Confirm only when `powershell.file.script_block_text`, reconstructed targets/destinations, `file.path`, `user.id`, `host.id`, and recovered launch context align with the same workflow. If records are unavailable, prior recurrence can support but not replace local telemetry proof; first occurrences stay candidate exceptions.
- Build exceptions from `user.id`, `host.id`, stable `file.path`, recovered parent-launch pattern when available, and the `powershell.file.script_block_text` pattern. Avoid exceptions on "Invoke-NinjaCopy", `user.name`, or host alone.
### Response and remediation
- If confirmed benign, reverse containment and document the recognized workflow: `user.id`, `host.id`, `file.path`, `powershell.file.script_block_id`, recovered launch context, and reconstructed target or destination values. Create an exception only if the same pattern recurs across prior alerts.
- If suspicious but unconfirmed, preserve reconstructed `powershell.file.script_block_text`, `powershell.file.script_block_id`, `powershell.sequence`, `process.pid`, recovered launch context, target or destination values, and `file.path` before cleanup. Apply reversible containment first; escalate to host isolation only if copied credential artifacts, staging, or broader post-compromise activity appears.
- If confirmed malicious, preserve the reconstructed script, launch context, targets, destinations, copied stores, and related alerts first. Then use reversible endpoint response to isolate the host when needed; if unavailable, escalate with the preserved artifact set to the team that can act. Record all evidence before terminating processes or deleting files.
- If "NTDS.dit", "SAM", "SYSTEM", or "SECURITY" targeting is confirmed with copied artifacts, follow the organization's credential-exposure playbook and prioritize privileged-account hygiene.
- Before eradicating, review related hosts for the same script pattern, `file.path` destinations, and recovered parent-launch pattern. Then remove unauthorized scripts, copied stores, archives, and persistence mechanisms and remediate the delivery path.
- Post-incident hardening: restrict direct-volume-copy tooling to controlled acquisition hosts, retain PowerShell Script Block Logging and endpoint file/process telemetry, and document the recognized workflow pattern for future analysts.
"""
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
"""
[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"
]
[transform]
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Script block fragments for the same script"
description = ""
providers = [
[
{ excluded = false, field = "powershell.file.script_block_id", queryType = "phrase", value = "{{powershell.file.script_block_id}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events for the PowerShell instance"
description = ""
providers = [
[
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "File events for the PowerShell process"
description = ""
providers = [
[
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", 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 = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.002"
name = "Security Account Manager"
reference = "https://attack.mitre.org/techniques/T1003/002/"
[[rule.threat.technique.subtechnique]]
id = "T1003.003"
name = "NTDS"
reference = "https://attack.mitre.org/techniques/T1003/003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.004"
name = "LSA Secrets"
reference = "https://attack.mitre.org/techniques/T1003/004/"
[[rule.threat.technique.subtechnique]]
id = "T1003.005"
name = "Cached Domain Credentials"
reference = "https://attack.mitre.org/techniques/T1003/005/"
[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 = "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.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1006"
name = "Direct Volume Access"
reference = "https://attack.mitre.org/techniques/T1006/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
"StealthReadFile" or
"StealthReadFileAddr" or
"StealthCloseFileDelegate" or
"StealthOpenFile" or
"StealthCloseFile" or
"Invoke-NinjaCopy"
) and
not powershell.file.script_block_text : (
"sentinelbreakpoints" and "Set-PSBreakpoint" and "PowerSploitIndicators"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
powershell.file.script_block_text | in |
| field:"ScriptBlockText" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
powershell.file.script_block_text | eq | PowerSploitIndicators | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"PowerSploitIndicators" |
powershell.file.script_block_text | eq | Set-PSBreakpoint | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"Set-PSBreakpoint" |
powershell.file.script_block_text | eq | sentinelbreakpoints | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"sentinelbreakpoints" |
PowerShell Suspicious Script with Screenshot Capabilities
#Detects PowerShell script block content that uses CopyFromScreen with .NET bitmap classes to capture screenshots. Attackers use screen capture to collect on-screen information and credentials.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Collection |
Rule Body
[metadata]
creation_date = "2021/10/19"
integration = ["windows"]
maturity = "production"
updated_date = "2026/03/30"
[rule]
author = ["Elastic"]
description = """
Detects PowerShell script block content that uses CopyFromScreen with .NET bitmap classes to capture screenshots.
Attackers use screen capture to collect on-screen information and credentials.
"""
from = "now-9m"
index = ["logs-windows.powershell*", "winlogbeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "PowerShell Suspicious Script with Screenshot Capabilities"
references = ["https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen"]
risk_score = 73
rule_id = "959a7353-1129-4aa7-9084-30746b256a70"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Collection",
"Resources: Investigation Guide",
"Data Source: PowerShell Logs",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
CopyFromScreen and
("System.Drawing.Bitmap" or "Drawing.Bitmap")
) and not user.id : "S-1-5-18"
'''
note = """## Triage and analysis
### Investigating PowerShell Suspicious Script with Screenshot Capabilities
#### Possible investigation steps
- Does the alert-preserved script content indicate a bounded screenshot action or deliberate repeated screen collection?
- Focus: the preserved script text on the alert and any associated `file.path`.
- Implication: supports deliberate collection when the script loops, captures full desktops, or targets multiple monitors; weaker support when the content shows a single bounded capture tied to a recurring support or test action.
- Does the reconstructed script add save, encode, archive, or transfer logic that changes risk?
- Why: script block logging can split one script across multiple records; later fragments often reveal output paths, encoding, or transfer logic.
- Focus: `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`, and `powershell.file.script_block_length` to rebuild adjacent fragments, then the reconstructed script body for output paths, image encoding, archive helpers, or remote destinations. $investigate_0
- Implication: staging becomes more likely when reconstruction shows image saves, compression, archiving, or transfer logic.
- Can you recover the PowerShell process and explain how it was launched?
- Focus: the matching process start event via `process.pid` and `host.id`, recovering `process.command_line`, `process.parent.executable`, `process.parent.command_line`, and `process.Ext.session_info.logon_type`. $investigate_1
- Hint: if the process event cannot be found, keep later file and network review bounded to the same host and alert time.
- Implication: supports unauthorized use when the process runs from user-writable paths, inherits an unusual parent, or lands in an unexpected session type.
- Does the user-host pattern fit a recognized support, accessibility, or QA workflow?
- Focus: the `user.id` and `host.id` pairing, the recovered `process.parent.executable`, and any prior alert recurrence for the same pairing and launcher.
- Hint: if workflow documentation is unavailable, require the same pairing and launcher to recur across prior alerts.
- Implication: escalate when the user-host pair has no recurring support or QA pattern, the launcher is new, or the host is used for privileged sessions.
- Do file events show screenshot output, staging artifacts, or suspicious script provenance?
- Focus: file events for the same `process.entity_id`, with attention to `file.path`, `file.Ext.header_bytes`, `file.origin_url` or `file.Ext.windows.zone_identifier`, and later reuse of a written path as `process.executable`.
- Implication: staging is more likely when the script arrives from download locations, writes screenshots to user-writable paths, or produces files that later execute.
- Do network events show transfer of captured images or related staging activity?
- Focus: network events for the same `process.entity_id`, separating DNS `lookup_result` events (`dns.question.name`, `dns.resolved_ip`) from connection events (`destination.ip`, `destination.port`).
- Implication: delivery risk increases when the process reaches rare external infrastructure, remote storage, or destinations named in the script. Missing network telemetry is unresolved, not benign.
- Does the host or session context suggest privileged or sensitive on-screen data could have been exposed?
- Why: the same capture script is far more consequential on admin workstations, jump hosts, or finance endpoints than on a lab box used for UI testing.
- Focus: the recovered `process.Ext.session_info.logon_type` and the `user.id`/`host.id` pairing. For remote sessions, bridge `process.Ext.authentication_id` to authentication events for `source.ip`; if unavailable, treat origin as unresolved.
- Implication: raise urgency when the visible desktop likely contained credentials, privileged consoles, or finance data.
- If the local evidence stays suspicious, do related alerts suggest broader compromise?
- Focus: related alerts for the same `user.id` and `host.id` in the last 48 hours to spot recurrence across hosts or same-host staging, archive helpers, or alternate capture routines. $investigate_2 $investigate_3
- Implication: broaden when the same user repeats screenshot capture across hosts or the host shows precursor access or alternate capture routines; keep narrow when both views stay confined to one recognized launcher.
- Escalate when capture scope, launch context, artifacts, network, or session sensitivity align on unauthorized screen collection; close only when all evidence supports a recognized benign workflow; if mixed or incomplete, preserve and escalate.
### False positive analysis
- Support, QA, accessibility, or testing workflows can legitimately trigger this rule. Confirm by matching the same `process.executable`, signer, and `host.id` pattern across prior alerts or against workflow records.
- Before creating an exception, validate that the same `user.id`, `host.id`, `file.path`, and a stable `powershell.file.script_block_text` substring recur across prior alerts. Avoid exceptions on screenshot-related strings alone, `user.name` alone, or the host alone.
### Response and remediation
- If confirmed benign, reverse any temporary containment and document the confirmed workflow evidence: the stable user-host pairing, recovered launch chain, and bounded internal capture or transfer path. Create an exception only if the same user, host, and launch context recur consistently across prior alerts from this rule.
- If suspicious but unconfirmed, preserve the reconstructed script content, recovered `process.entity_id`, written `file.path` artifacts, and any `dns.question.name` or `destination.ip` values linked to transfer. Apply reversible containment such as temporary egress restrictions or tighter monitoring on the exposed session. Escalate to host isolation only when capture, staging, or transfer evidence is strong and the host role can tolerate it. Avoid destructive cleanup until scope is clearer.
- If confirmed malicious, document the recovered `process.entity_id`, `process.command_line`, `process.parent.executable`, written `file.path` artifacts, and any confirmed `dns.question.name` or `destination.ip` values before initiating response actions. Use available endpoint response integrations to isolate the host and contain the affected account when capture scope, launch chain, artifacts, or delivery evidence shows unauthorized screen collection or transfer. If direct endpoint response is unavailable, escalate with the documented artifacts to the team that can act.
- If linked `dns.question.name`, `destination.ip`, or transfer artifacts confirm screenshot delivery or staging, block the confirmed destination, channel, or automation path before cleanup and preserve any related cloud, messaging, or remote-storage identifiers needed for follow-on scoping.
- If screenshots may have captured credentials, privileged sessions, or other sensitive on-screen data, follow the incident process for credential reset and access review for the exposed accounts or sessions, and review post-alert access from the same host or user for follow-on misuse.
- After containment, review related users and hosts for the same `powershell.file.script_block_text` content, `file.path` pattern, or `dns.question.name` destinations before eradicating. Remove confirmed staged scripts, screenshot artifacts, and transfer helpers. Restrict the execution path, such as tightening PowerShell execution policies or script-path allowlists.
- Retain PowerShell script block logging and related endpoint telemetry so the case remains auditable.
"""
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
"""
[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"
]
[[transform.investigate]]
label = "Script block fragments for the same script"
description = ""
providers = [
[
{ excluded = false, field = "powershell.file.script_block_id", queryType = "phrase", value = "{{powershell.file.script_block_id}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events for the PowerShell instance"
description = ""
providers = [
[
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", 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 = "T1113"
name = "Screen Capture"
reference = "https://attack.mitre.org/techniques/T1113/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: query
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
CopyFromScreen and
("System.Drawing.Bitmap" or "Drawing.Bitmap")
) and not user.id : "S-1-5-18"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
powershell.file.script_block_text | eq |
| field:"ScriptBlockText" kind:eq value:"CopyFromScreen" |
powershell.file.script_block_text | in |
| field:"ScriptBlockText" kind:in |
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" |
Process Execution Followed by Self-Deletion
#Detects a process execution followed by immediate self-deletion, a common technique used by adversaries to remove traces of their activity on the system. This pattern is often observed in malware and APT campaigns.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Detects a process execution followed by immediate self-deletion, a common technique used by adversaries to remove traces
of their activity on the system. This pattern is often observed in malware and APT campaigns.
"""
id = "530ad3d7-7360-4467-83d3-f49d705535ba"
license = "Elastic License v2"
name = "Process Execution Followed by Self-Deletion"
os_list = ["linux"]
version = "1.0.5"
query = '''
sequence by process.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and
process.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*") and
not (
process.parent.executable like ("/usr/openv/netbackup/bin/bpcd", "/usr/bin/x-terminal-emulator") or
process.executable like (
"/tmp/VeeamAgent*", "/tmp/VeeamApp_*", "/tmp/par-*", "/tmp/newroot/home/*/.local/bin/kiro-cli",
"/tmp/.dropbox-dist-new-*/dropbox", "/tmp/builds/*/node_modules/.bin/rimraf", "/var/tmp/*/conftest",
"/tmp/cmdickens/*", "/tmp/newroot/home/*/studio3t/jre/bin/java",
"/tmp/newroot/opt/docker/buildkit/executor/*/rootfs/usr/bin/dpkg", "/tmp/newroot/opt/orbit/bin/orbit/orbit",
"/tmp/*/conftest", "/tmp/thangha/easybuild/netCDF/*", "/tmp/baum/easybuild/LLVM/*", "/tmp/*/easybuild/*",
"/tmp/root/spack-stage/*", "/tmp/plz_sandbox/test", "/tmp/par_tmp.*", "/tmp/github-runner-*/_actions/*/apt_query-x86",
"/tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-*/dropboxd", "/tmp/deinstall*/perl/bin/perl"
) or
process.parent.args like ("/usr/sbin/weak-modules", "apt-get", "/tmp/thangha/easybuild/*") or
process.parent.command_line == "/opt/Elastic/Agent/elastic-agent" or
(
process.executable like "/run/user/*/.bubblewrap/newroot/opt/Elastic/Agent/elastic-agent" and
process.parent.executable == "/usr/lib/systemd/systemd"
)
)] as event0
[file where event.action == "deletion" and startswith~(file.path, event0.process.executable)]
'''
min_endpoint_version = "8.6.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 = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"
[[threat.technique.subtechnique]]
id = "T1070.004"
name = "File Deletion"
reference = "https://attack.mitre.org/techniques/T1070/004/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.6.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 15s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and
process.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*") and
not (
process.parent.executable like ("/usr/openv/netbackup/bin/bpcd", "/usr/bin/x-terminal-emulator") or
process.executable like (
"/tmp/VeeamAgent*", "/tmp/VeeamApp_*", "/tmp/par-*", "/tmp/newroot/home/*/.local/bin/kiro-cli",
"/tmp/.dropbox-dist-new-*/dropbox", "/tmp/builds/*/node_modules/.bin/rimraf", "/var/tmp/*/conftest",
"/tmp/cmdickens/*", "/tmp/newroot/home/*/studio3t/jre/bin/java",
"/tmp/newroot/opt/docker/buildkit/executor/*/rootfs/usr/bin/dpkg", "/tmp/newroot/opt/orbit/bin/orbit/orbit",
"/tmp/*/conftest", "/tmp/thangha/easybuild/netCDF/*", "/tmp/baum/easybuild/LLVM/*", "/tmp/*/easybuild/*",
"/tmp/root/spack-stage/*", "/tmp/plz_sandbox/test", "/tmp/par_tmp.*", "/tmp/github-runner-*/_actions/*/apt_query-x86",
"/tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-*/dropboxd", "/tmp/deinstall*/perl/bin/perl"
) or
process.parent.args like ("/usr/sbin/weak-modules", "apt-get", "/tmp/thangha/easybuild/*") or
process.parent.command_line == "/opt/Elastic/Agent/elastic-agent" or
(
process.executable like "/run/user/*/.bubblewrap/newroot/opt/Elastic/Agent/elastic-agent" and
process.parent.executable == "/usr/lib/systemd/systemd"
)
)] as event0
Stage 2: file
[file where event.action == "deletion" and startswith~(file.path, event0.process.executable)]
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" |
file.path | starts_with |
| field:"TargetFilename" kind:starts_with value:"event0.process.executable" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | /run/user/*/.bubblewrap/newroot/opt/Elastic/Agent/elastic-agent | excludes:process.executable field:"process.executable" value:"/run/user/*/.bubblewrap/newroot/opt/Elastic/Agent/elastic-agent" |
process.parent.executable | eq | /usr/lib/systemd/systemd | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/lib/systemd/systemd" |
process.executable | wildcard | /tmp/VeeamAgent*, /tmp/VeeamApp_*, /tmp/par-*, /tmp/newroot/home/*/.local/bin/kiro-cli, /tmp/.dropbox-dist-new-*/dropbox, /tmp/builds/*/node_modules/.bin/rimraf, /var/tmp/*/conftest, /tmp/cmdickens/*, /tmp/newroot/home/*/studio3t/jre/bin/java, /tmp/newroot/opt/docker/buildkit/executor/*/rootfs/usr/bin/dpkg, /tmp/newroot/opt/orbit/bin/orbit/orbit, /tmp/*/conftest, /tmp/thangha/easybuild/netCDF/*, /tmp/baum/easybuild/LLVM/*, /tmp/*/easybuild/*, /tmp/root/spack-stage/*, /tmp/plz_sandbox/test, /tmp/par_tmp.*, /tmp/github-runner-*/_actions/*/apt_query-x86, /tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-*/dropboxd, /tmp/deinstall*/perl/bin/perl | excludes:process.executable |
process.parent.args | wildcard | /usr/sbin/weak-modules, apt-get, /tmp/thangha/easybuild/* | excludes:process.parent.args field:"process.parent.args" value:"/usr/sbin/weak-modules" field:"process.parent.args" value:"apt-get" field:"process.parent.args" value:"/tmp/thangha/easybuild/*" |
process.parent.command_line | eq | /opt/Elastic/Agent/elastic-agent | excludes:process.parent.command_line field:"process.parent.command_line" value:"/opt/Elastic/Agent/elastic-agent" |
process.parent.executable | eq | /usr/openv/netbackup/bin/bpcd, /usr/bin/x-terminal-emulator | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/openv/netbackup/bin/bpcd" field:"process.parent.executable" value:"/usr/bin/x-terminal-emulator" |
Startup or Run Key Registry Modification
#Identifies run key or startup key registry modifications. In order to survive reboots and other system interrupts, attackers will modify run keys within the registry or leverage startup folder items as a form of persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/11/18"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"
[transform]
[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"
[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""
[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""
[rule]
author = ["Elastic"]
description = """
Identifies run key or startup key registry modifications. In order to survive reboots and other system interrupts,
attackers will modify run keys within the registry or leverage startup folder items as a form of persistence.
"""
from = "now-9m"
index = ["logs-endpoint.events.registry-*"]
language = "eql"
license = "Elastic License v2"
name = "Startup or Run Key Registry Modification"
note = """## Triage and analysis
### Investigating Startup or Run Key Registry Modification
Adversaries may achieve persistence by referencing a program with a registry run key. Adding an entry to the run keys in the registry will cause the program referenced to be executed when a user logs in. These programs will executed under the context of the user and will have the account's permissions. This rule looks for this behavior by monitoring a range of registry run keys.
> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
#### Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Validate if the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the process executable using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
- Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
### False positive analysis
- There is a high possibility of benign legitimate programs being added to registry run keys. This activity could be based on new software installations, patches, or any kind of network administrator related activity. Before undertaking further investigation, verify that this activity is not benign.
### Related rules
- Suspicious Startup Shell Folder Modification - c8b150f0-0164-475b-a75e-74b47800a9ff
- Persistent Scripts in the Startup Directory - f7c4dc5a-a58d-491d-9f14-9b66507121c0
- Startup Folder Persistence via Unsigned Process - 2fba96c0-ade5-4bce-b92f-a5df2509da3f
- Startup Persistence by a Suspicious Process - 440e2db4-bc7f-4c96-a068-65b78da59bde
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
"""
references = ["https://www.elastic.co/security-labs/elastic-security-uncovers-blister-malware-campaign"]
risk_score = 21
rule_id = "97fc44d3-8dae-4019-ae83-298c3015600f"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
]
timeline_id = "3e47ef71-ebfc-4520-975c-cb27fc090799"
timeline_title = "Comprehensive Registry Timeline"
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where host.os.type == "windows" and event.type == "change" and
registry.data.strings != null and registry.hive : ("HKEY_USERS", "HKLM") and
registry.path : (
/* Machine Hive */
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell\\*",
/* Users Hive */
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell\\*"
) and
/* add common legitimate changes without being too restrictive as this is one of the most abused AESPs */
not registry.data.strings : "ctfmon.exe /n" and
not (registry.value : "Application Restart #*" and process.name : "csrss.exe") and
not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
not registry.data.strings : ("*:\\Program Files\\*",
"*:\\Program Files (x86)\\*",
"*:\\Users\\*\\AppData\\Local\\*",
"* --processStart *",
"* --process-start-args *",
"ms-teamsupdate.exe -UninstallT20",
" ",
"grpconv -o", "* /burn.runonce*", "* /startup",
"?:\\WINDOWS\\SysWOW64\\Macromed\\Flash\\FlashUtil32_*_Plugin.exe -update plugin") and
not process.executable : ("?:\\Windows\\System32\\msiexec.exe",
"?:\\Windows\\SysWOW64\\msiexec.exe",
"D:\\*",
"\\Device\\Mup*",
"C:\\Windows\\SysWOW64\\reg.exe",
"C:\\Windows\\System32\\changepk.exe",
"C:\\Windows\\System32\\netsh.exe",
"C:\\$WINDOWS.~BT\\Sources\\SetupPlatform.exe",
"C:\\$WINDOWS.~BT\\Sources\\SetupHost.exe",
"C:\\Program Files\\Cisco Spark\\CiscoCollabHost.exe",
"C:\\Sistemas\\Programas MP\\CCleaner\\CCleaner64.exe",
"C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe",
"C:\\Program Files (x86)\\Exclaimer Ltd\\Cloud Signature Update Agent\\Exclaimer.CloudSignatureAgent.exe",
"C:\\ProgramData\\Lenovo\\Vantage\\AddinData\\LenovoBatteryGaugeAddin\\x64\\QSHelper.exe",
"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe",
"C:\\ProgramData\\bomgar-scc-*\\bomgar-scc.exe",
"C:\\Windows\\SysWOW64\\Macromed\\Flash\\FlashUtil*_pepper.exe",
"C:\\Windows\\System32\\spool\\drivers\\x64\\3\\*.EXE",
"C:\\Program Files (x86)\\Common Files\\Adobe\\ARM\\*\\AdobeARM.exe")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[rule.threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: registry
registry where host.os.type == "windows" and event.type == "change" and
registry.data.strings != null and registry.hive : ("HKEY_USERS", "HKLM") and
registry.path : (
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell\\*"
) and
not registry.data.strings : "ctfmon.exe /n" and
not (registry.value : "Application Restart #*" and process.name : "csrss.exe") and
not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
not registry.data.strings : ("*:\\Program Files\\*",
"*:\\Program Files (x86)\\*",
"*:\\Users\\*\\AppData\\Local\\*",
"* --processStart *",
"* --process-start-args *",
"ms-teamsupdate.exe -UninstallT20",
" ",
"grpconv -o", "* /burn.runonce*", "* /startup",
"?:\\WINDOWS\\SysWOW64\\Macromed\\Flash\\FlashUtil32_*_Plugin.exe -update plugin") and
not process.executable : ("?:\\Windows\\System32\\msiexec.exe",
"?:\\Windows\\SysWOW64\\msiexec.exe",
"D:\\*",
"\\Device\\Mup*",
"C:\\Windows\\SysWOW64\\reg.exe",
"C:\\Windows\\System32\\changepk.exe",
"C:\\Windows\\System32\\netsh.exe",
"C:\\$WINDOWS.~BT\\Sources\\SetupPlatform.exe",
"C:\\$WINDOWS.~BT\\Sources\\SetupHost.exe",
"C:\\Program Files\\Cisco Spark\\CiscoCollabHost.exe",
"C:\\Sistemas\\Programas MP\\CCleaner\\CCleaner64.exe",
"C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe",
"C:\\Program Files (x86)\\Exclaimer Ltd\\Cloud Signature Update Agent\\Exclaimer.CloudSignatureAgent.exe",
"C:\\ProgramData\\Lenovo\\Vantage\\AddinData\\LenovoBatteryGaugeAddin\\x64\\QSHelper.exe",
"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe",
"C:\\ProgramData\\bomgar-scc-*\\bomgar-scc.exe",
"C:\\Windows\\SysWOW64\\Macromed\\Flash\\FlashUtil*_pepper.exe",
"C:\\Windows\\System32\\spool\\drivers\\x64\\3\\*.EXE",
"C:\\Program Files (x86)\\Common Files\\Adobe\\ARM\\*\\AdobeARM.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"change" |
registry.data.strings | is_not_null | field:"Details" kind:is_not_null | |
registry.hive | wildcard |
| field:"registry.hive" kind:wildcard |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | eq | csrss.exe | excludes:process.name field:"process.name" value:"csrss.exe" |
registry.value | starts_with | Application Restart # | excludes:registry.value field:"registry.value" value:"Application Restart #" |
process.executable | wildcard | ?:\Windows\System32\msiexec.exe, ?:\Windows\SysWOW64\msiexec.exe, D:\*, \Device\Mup*, C:\Windows\SysWOW64\reg.exe, C:\Windows\System32\changepk.exe, C:\Windows\System32\netsh.exe, C:\$WINDOWS.~BT\Sources\SetupPlatform.exe, C:\$WINDOWS.~BT\Sources\SetupHost.exe, C:\Program Files\Cisco Spark\CiscoCollabHost.exe, C:\Sistemas\Programas MP\CCleaner\CCleaner64.exe, C:\Program Files (x86)\FastTrack Software\Admin By Request\AdminByRequest.exe, C:\Program Files (x86)\Exclaimer Ltd\Cloud Signature Update Agent\Exclaimer.CloudSignatureAgent.exe, C:\ProgramData\Lenovo\Vantage\AddinData\LenovoBatteryGaugeAddin\x64\QSHelper.exe, C:\Program Files (x86)\Microsoft\Edge\Application\*\Installer\setup.exe, C:\ProgramData\bomgar-scc-*\bomgar-scc.exe, C:\Windows\SysWOW64\Macromed\Flash\FlashUtil*_pepper.exe, C:\Windows\System32\spool\drivers\x64\3\*.EXE, C:\Program Files (x86)\Common Files\Adobe\ARM\*\AdobeARM.exe | excludes:process.executable |
registry.data.strings | eq | ctfmon.exe /n | excludes:registry.data.strings field:"registry.data.strings" value:"ctfmon.exe /n" |
registry.data.strings | wildcard | *:\Program Files\*, *:\Program Files (x86)\*, *:\Users\*\AppData\Local\*, * --processStart *, * --process-start-args *, ms-teamsupdate.exe -UninstallT20, , grpconv -o, * /burn.runonce*, * /startup, ?:\WINDOWS\SysWOW64\Macromed\Flash\FlashUtil32_*_Plugin.exe -update plugin | excludes:registry.data.strings |
user.id | eq | S-1-5-18, S-1-5-19, S-1-5-20 | excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20" |
Suspicious Executable Heap Allocation via CLR
#Identifies attempts to allocate large RWX heap memory from native code, this may indicate an attempt to execute assembly payload via Microsoft Common Language Runtime DLL.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to allocate large RWX heap memory from native code, this may indicate an attempt to execute assembly
payload via Microsoft Common Language Runtime DLL.
"""
id = "98e95014-ee8c-429a-9ff0-359c80d9ec8d"
license = "Elastic License v2"
name = "Suspicious Executable Heap Allocation via CLR"
os_list = ["windows"]
version = "1.0.3"
query = '''
api where process.Ext.api.name == "VirtualAlloc" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.parameters.protection == "RWX" and process.thread.Ext.call_stack_final_user_module.name == "mscoreei.dll" and
process.thread.Ext.call_stack_summary regex """ntdll.dll\|kernelbase.dll\|mscoreei.dll\|clr.dll\|[a-z0-9]+\.(dll|exe)""" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "c:\\windows\\microsoft.net\\framework64\\*\\mscoreei.dll!GetProcessExecutableHeap*") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "c:\\windows\\microsoft.net\\framework64\\*\\clr.dll!GetClassActivatorForApplicationImpl*") and
not (process.executable : "C:\\Program Files\\ASM Technologies\\ASMTower*\\ASMTower.exe" and
process.code_signature.subject_name == "ASM Technologies" and process.code_signature.trusted == true)
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "VirtualAlloc" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.parameters.protection == "RWX" and process.thread.Ext.call_stack_final_user_module.name == "mscoreei.dll" and
process.thread.Ext.call_stack_summary regex """ntdll.dll\|kernelbase.dll\|mscoreei.dll\|clr.dll\|[a-z0-9]+\.(dll|exe)""" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "c:\\windows\\microsoft.net\\framework64\\*\\mscoreei.dll!GetProcessExecutableHeap*") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "c:\\windows\\microsoft.net\\framework64\\*\\clr.dll!GetClassActivatorForApplicationImpl*") and
not (process.executable : "C:\\Program Files\\ASM Technologies\\ASMTower*\\ASMTower.exe" and
process.code_signature.subject_name == "ASM Technologies" and process.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | eq | ASM Technologies | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"ASM Technologies" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | C:\Program Files\ASM Technologies\ASMTower*\ASMTower.exe | excludes:process.executable field:"process.executable" value:"C:\Program Files\ASM Technologies\ASMTower*\ASMTower.exe" |
Suspicious File Creation via Kworker
#This rule monitors for a file creation event originating from a kworker parent process. kworker, or kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Stealth |
Rule Body
[metadata]
creation_date = "2023/10/26"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[transform]
[[transform.osquery]]
label = "Osquery - Retrieve File Listing Information"
query = "SELECT * FROM file WHERE path = {{file.path}}\n"
[[transform.osquery]]
label = "Osquery - Retrieve Additional File Listing Information"
query = """
SELECT f.path, u.username AS file_owner, g.groupname AS group_owner, datetime(f.atime, 'unixepoch') AS
file_last_access_time, datetime(f.mtime, 'unixepoch') AS file_last_modified_time, datetime(f.ctime, 'unixepoch') AS
file_last_status_change_time, datetime(f.btime, 'unixepoch') AS file_created_time, f.size AS size_bytes FROM file f LEFT
JOIN users u ON f.uid = u.uid LEFT JOIN groups g ON f.gid = g.gid WHERE path = {{file.path}}
"""
[[transform.osquery]]
label = "Osquery - Retrieve Running Processes by User"
query = "SELECT pid, username, name FROM processes p JOIN users u ON u.uid = p.uid ORDER BY username"
[[transform.osquery]]
label = "Osquery - Retrieve Crontab Information"
query = "SELECT * FROM crontab"
[[transform.osquery]]
label = "Osquery - Retrieve Listening Ports"
query = "SELECT pid, address, port, socket, protocol, path FROM listening_ports"
[[transform.osquery]]
label = "Osquery - Retrieve Open Sockets"
query = "SELECT pid, family, remote_address, remote_port, socket, state FROM process_open_sockets"
[[transform.osquery]]
label = "Osquery - Retrieve Information for a Specific User"
query = "SELECT * FROM users WHERE username = {{user.name}}"
[[transform.osquery]]
label = "Osquery - Investigate the Account Authentication Status"
query = "SELECT * FROM logged_in_users WHERE user = {{user.name}}"
[rule]
author = ["Elastic"]
description = """
This rule monitors for a file creation event originating from a kworker parent process. kworker, or kernel worker,
processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has been scheduled
to be done in kernel space, which might include tasks like handling interrupts, background activities, and other
kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process.
"""
from = "now-9m"
index = ["endgame-*", "logs-endpoint.events.file*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious File Creation via Kworker"
note = """## Triage and analysis
### Investigating Suspicious File Creation via Kworker
Kworker, or kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks.
Attackers may attempt to evade detection by masquerading as a kernel worker process.
This rule monitors for suspicious file creation events through the kworker process. This is not common, and could indicate malicious behaviour.
> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
> This investigation guide uses [placeholder fields](https://www.elastic.co/guide/en/security/current/osquery-placeholder-fields.html) to dynamically pass alert data into Osquery queries. Placeholder fields were introduced in Elastic Stack version 8.7.0. If you're using Elastic Stack version 8.6.0 or earlier, you'll need to manually adjust this investigation guide's queries to ensure they properly run.
#### Possible Investigation Steps
- Investigate the file that was created or modified through OSQuery.
- $osquery_0
- $osquery_1
- Investigate the script execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence and whether they are located in expected locations.
- $osquery_2
- Investigate other alerts associated with the user/host during the past 48 hours.
- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
- Investigate whether the altered scripts call other malicious scripts elsewhere on the file system.
- If scripts or executables were dropped, retrieve the files and determine if they are malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- Check if the domain is newly registered or unexpected.
- Check the reputation of the domain or IP address.
- File access, modification, and creation activities.
- Cron jobs, services and other persistence mechanisms.
- $osquery_3
- Investigate abnormal behaviors by the subject process/user such as network connections, file modifications, and any other spawned child processes.
- Investigate listening ports and open sockets to look for potential command and control traffic or data exfiltration.
- $osquery_4
- $osquery_5
- Identify the user account that performed the action, analyze it, and check whether it should perform this kind of action.
- $osquery_6
- Investigate whether the user is currently logged in and active.
- $osquery_7
### False Positive Analysis
- If this activity is related to new benign software installation activity, consider adding exceptions — preferably with a combination of user and command line conditions.
- If this activity is related to a system administrator that performed these actions for administrative purposes, consider adding exceptions for this specific administrator user account.
- Try to understand the context of the execution by thinking about the user, machine, or business purpose. A small number of endpoints, such as servers with unique software, might appear unusual but satisfy a specific business need.
### Related Rules
- Suspicious Kworker UID Elevation - 7dfaaa17-425c-4fe7-bd36-83705fde7c2b
- Network Activity Detected via Kworker - 25d917c4-aa3c-4111-974c-286c0312ff95
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Leverage the incident response data and logging to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
risk_score = 47
rule_id = "ae343298-97bc-47bc-9ea2-5f2ad831c16e"
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 to select "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 = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
"Data Source: Elastic Endgame",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.action in ("creation", "file_create_event") and
process.name : "kworker*" and not (
process.name : "kworker*kcryptd*" or
file.path like (
"/var/log/*", "/var/crash/*", "/var/run/*", "/var/lib/systemd/coredump/*", "/var/spool/*",
"/var/lib/nfs/nfsdcltrack/main.sqlite-journal", "/proc/*/cwd/core.*", "/var/run/apport.lock",
"/var/spool/abrt/ccpp-*", "/var/lib/dynatrace/oneagent/*", "/var/lib/nfs*", "/run/user/*/.bubblewrap/*",
"/etc/localtime/*", "/proc/*/cwd/core.*", "/tmp/sh-thd.*", "/var/lib/apport/coredump/*", "/var/tmp/abrt/ccpp*"
)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1014"
name = "Rootkit"
reference = "https://attack.mitre.org/techniques/T1014/"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: file
file where host.os.type == "linux" and event.action in ("creation", "file_create_event") and
process.name : "kworker*" and not (
process.name : "kworker*kcryptd*" or
file.path like (
"/var/log/*", "/var/crash/*", "/var/run/*", "/var/lib/systemd/coredump/*", "/var/spool/*",
"/var/lib/nfs/nfsdcltrack/main.sqlite-journal", "/proc/*/cwd/core.*", "/var/run/apport.lock",
"/var/spool/abrt/ccpp-*", "/var/lib/dynatrace/oneagent/*", "/var/lib/nfs*", "/run/user/*/.bubblewrap/*",
"/etc/localtime/*", "/proc/*/cwd/core.*", "/tmp/sh-thd.*", "/var/lib/apport/coredump/*", "/var/tmp/abrt/ccpp*"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"kworker*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | wildcard | /var/log/*, /var/crash/*, /var/run/*, /var/lib/systemd/coredump/*, /var/spool/*, /var/lib/nfs/nfsdcltrack/main.sqlite-journal, /proc/*/cwd/core.*, /var/run/apport.lock, /var/spool/abrt/ccpp-*, /var/lib/dynatrace/oneagent/*, /var/lib/nfs*, /run/user/*/.bubblewrap/*, /etc/localtime/*, /proc/*/cwd/core.*, /tmp/sh-thd.*, /var/lib/apport/coredump/*, /var/tmp/abrt/ccpp* | excludes:file.path |
process.name | wildcard | kworker*kcryptd* | excludes:process.name field:"process.name" value:"kworker*kcryptd*" |
Suspicious File Dropped by a Macro Enabled Document
#Identifies when a Microsoft Office process writes an executable file type and from a call stack pointing to Microsoft Office Visual Basic for Applications modules. This may indicate an attempt to get initial access using malicious macro enabled documents.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule Body
[rule]
description = """
Identifies when a Microsoft Office process writes an executable file type and from a call stack pointing to Microsoft
Office Visual Basic for Applications modules. This may indicate an attempt to get initial access using malicious macro
enabled documents.
"""
id = "9eca0b31-cf47-4120-afe9-9badb0c308e0"
license = "Elastic License v2"
name = "Suspicious File Dropped by a Macro Enabled Document"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/upping-the-ante-detecting-in-memory-threats-with-kernel-call-stacks",
]
version = "1.0.22"
query = '''
file where event.action != "deletion" and event.action != "open" and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "mspub.exe", "fltldr.exe", "visio.exe") and
process.thread.Ext.call_stack_summary : "*|vbe?.dll*" and
(file.extension : ("exe", "pif", "scr", "iso", "rar", "7z", "img", "vhd", "js", "vbs", "wsh", "hta", "cpl", "jse", "vbe", "bat", "cmd", "dll") or
file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
not (file.extension == "zip" and file.Ext.header_bytes == "504b0506000000000000000000000000")
'''
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 = "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/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and event.action != "open" and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "mspub.exe", "fltldr.exe", "visio.exe") and
process.thread.Ext.call_stack_summary : "*|vbe?.dll*" and
(file.extension : ("exe", "pif", "scr", "iso", "rar", "7z", "img", "vhd", "js", "vbs", "wsh", "hta", "cpl", "jse", "vbe", "bat", "cmd", "dll") or
file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
not (file.extension == "zip" and file.Ext.header_bytes == "504b0506000000000000000000000000")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.extension | wildcard |
| field:"file.extension" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"*|vbe?.dll*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.Ext.header_bytes | eq | 504b0506000000000000000000000000 | excludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"504b0506000000000000000000000000" |
file.extension | eq | zip | excludes:file.extension field:"file.extension" value:"zip" |
Suspicious Perl Child Process Execution
#Detects when Perl executes suspicious child processes on macOS. Perl can be abused by adversaries to execute malicious commands or scripts.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when Perl executes suspicious child processes on macOS. Perl can be abused by adversaries to execute malicious
commands or scripts.
"""
id = "45681609-ac5b-4151-9014-204590e87e1d"
license = "Elastic License v2"
name = "Suspicious Perl Child Process Execution"
os_list = ["macos"]
version = "1.0.5"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name == "perl" and
(process.name like~ ("python*", "curl", "nscurl", "osascript", "whoami", "cat", "Terminal") or
(process.name in ("sh", "zsh", "bash") and process.args_count == 2 and process.args == "-c" and process.args like ("/Users/*", "/tmp/*", "/private/tmp/*"))) and
not process.parent.command_line like "perl /Library/TeX/texbin/tlmgr*" and
not process.Ext.effective_parent.executable like ("/System/*", "/Applications/Xcode.app/Contents/MacOS/Xcode")
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.name == "perl" and
(process.name like~ ("python*", "curl", "nscurl", "osascript", "whoami", "cat", "Terminal") or
(process.name in ("sh", "zsh", "bash") and process.args_count == 2 and process.args == "-c" and process.args like ("/Users/*", "/tmp/*", "/private/tmp/*"))) and
not process.parent.command_line like "perl /Library/TeX/texbin/tlmgr*" and
not process.Ext.effective_parent.executable like ("/System/*", "/Applications/Xcode.app/Contents/MacOS/Xcode")
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:"2" |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"perl" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | wildcard | /System/*, /Applications/Xcode.app/Contents/MacOS/Xcode | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/System/*" field:"process.Ext.effective_parent.executable" value:"/Applications/Xcode.app/Contents/MacOS/Xcode" |
process.parent.command_line | starts_with | perl /Library/TeX/texbin/tlmgr | excludes:process.parent.command_line field:"process.parent.command_line" value:"perl /Library/TeX/texbin/tlmgr" |
Suspicious StartupItem Plist Creation
#Detects the creation or modification of a StartupParameters.plist file, indicating the presence of a StartupItem on the system. StartupItems have been deprecated on modern macOS systems (post Mavericks) in favor of Launch Daemons but still function. Creation of a StartupItem should be highly suspicious as legitimate applications no longer use this method for persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[metadata]
creation_date = "2026/01/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/01/30"
[rule]
author = ["Elastic"]
description = """
Detects the creation or modification of a StartupParameters.plist file, indicating the presence of a
StartupItem on the system. StartupItems have been deprecated on modern macOS systems (post Mavericks)
in favor of Launch Daemons but still function. Creation of a StartupItem should be highly suspicious
as legitimate applications no longer use this method for persistence.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious StartupItem Plist Creation"
references = [
"https://www.virusbulletin.com/uploads/pdf/conference/vb2014/VB2014-Wardle.pdf"
]
risk_score = 73
rule_id = "15606250-449d-46a8-aaff-4043e42aefb9"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide"
]
timestamp_override = "event.ingested"
type = "eql"
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 StartupItem Plist Creation
StartupItems are a deprecated macOS persistence mechanism that predates LaunchDaemons and was phased out after OS X Mavericks. Despite deprecation, the StartupItem infrastructure still functions on modern macOS versions for backward compatibility. Because legitimate software no longer uses StartupItems, the creation of a StartupParameters.plist file in /Library/StartupItems/ or /System/Library/StartupItems/ is highly anomalous and strongly indicates malicious activity seeking persistence through an overlooked mechanism.
### Possible investigation steps
- Examine the file.path to identify the specific StartupItem directory and verify that it was newly created versus modified.
- Review the StartupParameters.plist contents using plutil to identify the Description, Provides, OrderPreference, and other configuration values.
- Locate the StartupItem script in the same directory (typically named after the item) and analyze its contents for malicious commands.
- Check the process.executable that created the StartupItem to understand the initial delivery mechanism.
- Review file creation timestamps to correlate the StartupItem creation with other suspicious activity on the system.
- Search for additional files or binaries that may have been deployed alongside the StartupItem.
- Check for corresponding entries in /etc/rc files that may interact with the StartupItem.
### False positive analysis
- Very old legacy applications may use StartupItems for backward compatibility. Verify the software's legitimacy and whether it is still supported.
- Some enterprise or industrial software may not have been updated to use modern persistence mechanisms. Confirm with IT operations if legacy software is expected.
- Apple's shove process is already excluded in the query as it may interact with StartupItem directories during system maintenance.
### Response and remediation
- Remove the entire StartupItem directory containing the malicious StartupParameters.plist and associated scripts.
- Verify that the StartupItem was not successfully executed by checking system logs for execution evidence.
- Reboot the system to confirm the StartupItem has been fully removed and no longer executes.
- Investigate the initial access vector that allowed creation of the StartupItem.
- Search for other deprecated persistence mechanisms on the system that may indicate comprehensive malware deployment.
- Review other systems in the environment for similar StartupItem creations.
- Monitor the /Library/StartupItems/ directory for future unauthorized file creation.
- Consider implementing file integrity monitoring on persistence directories to detect future modifications.
"""
query = '''
file where host.os.type == "macos" and event.type != "deletion" and
file.name == "StartupParameters.plist" and
file.path like ("/System/Library/StartupItems/*/StartupParameters.plist",
"/Library/StartupItems/*/StartupParameters.plist") and
not (process.code_signature.signing_id == "com.apple.shove" and process.code_signature.trusted == true)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
name = "Persistence"
id = "TA0003"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat.technique]]
name = "Boot or Logon Initialization Scripts"
id = "T1037"
reference = "https://attack.mitre.org/techniques/T1037/"
[[rule.threat.technique.subtechnique]]
name = "Startup Items"
id = "T1037.005"
reference = "https://attack.mitre.org/techniques/T1037/005/"
Stages and Predicates
Stage 1: file
file where host.os.type == "macos" and event.type != "deletion" and
file.name == "StartupParameters.plist" and
file.path like ("/System/Library/StartupItems/*/StartupParameters.plist",
"/Library/StartupItems/*/StartupParameters.plist") and
not (process.code_signature.signing_id == "com.apple.shove" and process.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.name | eq |
| field:"file.name" kind:eq value:"StartupParameters.plist" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.signing_id | eq | com.apple.shove | excludes:process.code_signature.signing_id field:"process.code_signature.signing_id" value:"com.apple.shove" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
Unsigned DLL from Suspicious Directory
#Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a malicious DLL within the memory space of a signed processes.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted
program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a
malicious DLL within the memory space of a signed processes.
"""
id = "971462bd-6f34-4199-b79b-b5e26644a177"
license = "Elastic License v2"
name = "Unsigned DLL from Suspicious Directory"
os_list = ["windows"]
version = "1.0.13"
query = '''
library where
process.code_signature.trusted == true and dll.path != null and
dll.Ext.relative_file_creation_time <= 500 and
not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and
/* Suspicious Paths */
dll.path : ("?:\\PerfLogs\\*.dll",
"?:\\Users\\*\\Pictures\\*.dll",
"?:\\Users\\*\\Music\\*.dll",
"?:\\Users\\Public\\*.dll",
"?:\\Windows\\Tasks\\*.dll",
"?:\\Windows\\System32\\Tasks\\*.dll",
"?:\\Intel\\*.dll",
"?:\\AMD\\Temp\\*.dll",
"?:\\Windows\\AppReadiness\\*.dll",
"?:\\Windows\\ServiceState\\*.dll",
"?:\\Windows\\security\\*.dll",
"?:\\Windows\\System\\*.dll",
"?:\\Windows\\IdentityCRL\\*.dll",
"?:\\Windows\\Branding\\*.dll",
"?:\\Windows\\csc\\*.dll",
"?:\\Windows\\DigitalLocker\\*.dll",
"?:\\Windows\\en-US\\*.dll",
"?:\\Windows\\wlansvc\\*.dll",
"?:\\Windows\\Prefetch\\*.dll",
"?:\\Windows\\Fonts\\*.dll",
"?:\\Windows\\diagnostics\\*.dll",
"?:\\Windows\\TAPI\\*.dll",
"?:\\Windows\\INF\\*.dll",
"?:\\windows\\tracing\\*.dll",
"?:\\windows\\IME\\*.dll",
"?:\\Windows\\Performance\\*.dll",
"?:\\windows\\intel\\*.dll",
"?:\\windows\\ms\\*.dll",
"?:\\Windows\\dot3svc\\*.dll",
"?:\\Windows\\ServiceProfiles\\*.dll",
"?:\\Windows\\panther\\*.dll",
"?:\\Windows\\RemotePackages\\*.dll",
"?:\\Windows\\OCR\\*.dll",
"?:\\Windows\\appcompat\\*.dll",
"?:\\Windows\\apppatch\\*.dll",
"?:\\Windows\\addins\\*.dll",
"?:\\Windows\\Setup\\*.dll",
"?:\\Windows\\Help\\*.dll",
"?:\\Windows\\SKB\\*.dll",
"?:\\Windows\\Vss\\*.dll",
"?:\\Windows\\Web\\*.dll",
"?:\\Windows\\servicing\\*.dll",
"?:\\Windows\\CbsTemp\\*.dll",
"?:\\Windows\\Logs\\*.dll",
"?:\\Windows\\WaaS\\*.dll",
"?:\\Windows\\twain_32\\*.dll",
"?:\\Windows\\ShellExperiences\\*.dll",
"?:\\Windows\\ShellComponents\\*.dll",
"?:\\Windows\\PLA\\*.dll",
"?:\\Windows\\Migration\\*.dll",
"?:\\Windows\\debug\\*.dll",
"?:\\Windows\\hp\\*.dll",
"?:\\Windows\\Cursors\\*.dll",
"?:\\Windows\\Containers\\*.dll",
"?:\\Windows\\Boot\\*.dll",
"?:\\Windows\\bcastdvr\\*.dll",
"?:\\Windows\\TextInput\\*.dll",
"?:\\Windows\\schemas\\*.dll",
"?:\\Windows\\SchCache\\*.dll",
"?:\\Windows\\Resources\\*.dll",
"?:\\Windows\\rescache\\*.dll",
"?:\\Windows\\Provisioning\\*.dll",
"?:\\Windows\\PrintDialog\\*.dll",
"?:\\Windows\\PolicyDefinitions\\*.dll",
"?:\\Windows\\media\\*.dll",
"?:\\Windows\\Globalization\\*.dll",
"?:\\Windows\\L2Schemas\\*.dll",
"?:\\Windows\\LiveKernelReports\\*.dll",
"?:\\Windows\\ModemLogs\\*.dll",
"?:\\Windows\\ImmersiveControlPanel\\*.dll",
"?:\\$Recycle.Bin\\*.dll",
"?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and
/* DLL loaded from the process.executable current directory */
endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and
not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
process.executable : "?:\\Windows\\twain_32\\*.exe") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Bedford, Freeman & Worth Publishing Group, LLC",
"Delta Electronics, Inc.",
"Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"
'''
min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[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 = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: library
library where
process.code_signature.trusted == true and dll.path != null and
dll.Ext.relative_file_creation_time <= 500 and
not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and
dll.path : ("?:\\PerfLogs\\*.dll",
"?:\\Users\\*\\Pictures\\*.dll",
"?:\\Users\\*\\Music\\*.dll",
"?:\\Users\\Public\\*.dll",
"?:\\Windows\\Tasks\\*.dll",
"?:\\Windows\\System32\\Tasks\\*.dll",
"?:\\Intel\\*.dll",
"?:\\AMD\\Temp\\*.dll",
"?:\\Windows\\AppReadiness\\*.dll",
"?:\\Windows\\ServiceState\\*.dll",
"?:\\Windows\\security\\*.dll",
"?:\\Windows\\System\\*.dll",
"?:\\Windows\\IdentityCRL\\*.dll",
"?:\\Windows\\Branding\\*.dll",
"?:\\Windows\\csc\\*.dll",
"?:\\Windows\\DigitalLocker\\*.dll",
"?:\\Windows\\en-US\\*.dll",
"?:\\Windows\\wlansvc\\*.dll",
"?:\\Windows\\Prefetch\\*.dll",
"?:\\Windows\\Fonts\\*.dll",
"?:\\Windows\\diagnostics\\*.dll",
"?:\\Windows\\TAPI\\*.dll",
"?:\\Windows\\INF\\*.dll",
"?:\\windows\\tracing\\*.dll",
"?:\\windows\\IME\\*.dll",
"?:\\Windows\\Performance\\*.dll",
"?:\\windows\\intel\\*.dll",
"?:\\windows\\ms\\*.dll",
"?:\\Windows\\dot3svc\\*.dll",
"?:\\Windows\\ServiceProfiles\\*.dll",
"?:\\Windows\\panther\\*.dll",
"?:\\Windows\\RemotePackages\\*.dll",
"?:\\Windows\\OCR\\*.dll",
"?:\\Windows\\appcompat\\*.dll",
"?:\\Windows\\apppatch\\*.dll",
"?:\\Windows\\addins\\*.dll",
"?:\\Windows\\Setup\\*.dll",
"?:\\Windows\\Help\\*.dll",
"?:\\Windows\\SKB\\*.dll",
"?:\\Windows\\Vss\\*.dll",
"?:\\Windows\\Web\\*.dll",
"?:\\Windows\\servicing\\*.dll",
"?:\\Windows\\CbsTemp\\*.dll",
"?:\\Windows\\Logs\\*.dll",
"?:\\Windows\\WaaS\\*.dll",
"?:\\Windows\\twain_32\\*.dll",
"?:\\Windows\\ShellExperiences\\*.dll",
"?:\\Windows\\ShellComponents\\*.dll",
"?:\\Windows\\PLA\\*.dll",
"?:\\Windows\\Migration\\*.dll",
"?:\\Windows\\debug\\*.dll",
"?:\\Windows\\hp\\*.dll",
"?:\\Windows\\Cursors\\*.dll",
"?:\\Windows\\Containers\\*.dll",
"?:\\Windows\\Boot\\*.dll",
"?:\\Windows\\bcastdvr\\*.dll",
"?:\\Windows\\TextInput\\*.dll",
"?:\\Windows\\schemas\\*.dll",
"?:\\Windows\\SchCache\\*.dll",
"?:\\Windows\\Resources\\*.dll",
"?:\\Windows\\rescache\\*.dll",
"?:\\Windows\\Provisioning\\*.dll",
"?:\\Windows\\PrintDialog\\*.dll",
"?:\\Windows\\PolicyDefinitions\\*.dll",
"?:\\Windows\\media\\*.dll",
"?:\\Windows\\Globalization\\*.dll",
"?:\\Windows\\L2Schemas\\*.dll",
"?:\\Windows\\LiveKernelReports\\*.dll",
"?:\\Windows\\ModemLogs\\*.dll",
"?:\\Windows\\ImmersiveControlPanel\\*.dll",
"?:\\$Recycle.Bin\\*.dll",
"?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and
endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and
not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
process.executable : "?:\\Windows\\twain_32\\*.exe") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Bedford, Freeman & Worth Publishing Group, LLC",
"Delta Electronics, Inc.",
"Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.Ext.relative_file_creation_time | le |
| field:"dll.Ext.relative_file_creation_time" kind:le value:"500" |
dll.path | is_not_null | field:"ImageLoaded" kind:is_not_null | |
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"true" |
Exclusions
The rule actively suppresses these predicates.
Unusual Windows Network Activity
#Identifies Windows processes that do not usually use the network but have unexpected network activity, which can indicate command-and-control, lateral movement, persistence, or data exfiltration activity. A process with unusual network activity can denote process exploitation or injection, where the process is used to run persistence mechanisms that allow a malicious actor remote access or control of the host, data exfiltration, and execution of unauthorized network applications.
Known False Positives
- A newly installed program or one that rarely uses the network could trigger this alert.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Lateral Movement | |
| Command & Control | |
| Exfiltration |
Rule Body
[metadata]
creation_date = "2020/03/25"
integration = ["endpoint", "windows"]
maturity = "production"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
updated_date = "2026/07/27"
[rule]
anomaly_threshold = 50
author = ["Elastic"]
description = """
Identifies Windows processes that do not usually use the network but have unexpected network activity, which can
indicate command-and-control, lateral movement, persistence, or data exfiltration activity. A process with unusual
network activity can denote process exploitation or injection, where the process is used to run persistence mechanisms
that allow a malicious actor remote access or control of the host, data exfiltration, and execution of unauthorized
network applications.
"""
false_positives = ["A newly installed program or one that rarely uses the network could trigger this alert."]
from = "now-45m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = ["v3_windows_anomalous_network_activity_ea"]
name = "Unusual Windows Network Activity"
note = """## Triage and analysis
### Investigating Unusual Windows Network Activity
Detection alerts from this rule indicate the presence of network activity from a Windows process for which network activity is very unusual. Here are some possible avenues of investigation:
- Consider the IP addresses, protocol and ports. Are these used by normal but infrequent network workflows? Are they expected or unexpected?
- If the destination IP address is remote or external, does it associate with an expected domain, organization or geography? Note: avoid interacting directly with suspected malicious IP addresses.
- Consider the user as identified by the username field. Is this network activity part of an expected workflow for the user who ran the program?
- Examine the history of execution. If this process only manifested recently, it might be part of 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 it is performing.
- Consider the same for the parent process. If the parent process is a legitimate system utility or service, this could be related to software updates or system management. If the parent process is something user-facing like an Office application, this process could be more suspicious.
- If you have file hash values in the event data, and you suspect malware, you can optionally run a search for the file hash to see if the file is identified as malware by anti-malware tools."""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "ba342eb2-583c-439f-b04d-1fdd7c1417cc"
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
- Windows
### 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).
### Windows Integration Setup
The Windows integration allows you to monitor the Windows OS, services, applications, and more.
#### The following steps should be executed in order to add the Elastic Agent System integration "windows" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Windows” and select the integration to see more details about it.
- Click “Add Windows”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “windows” to an existing or a new agent policy, and deploy the agent on your system from which windows log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/windows).
"""
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Use Case: Threat Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[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 = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[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 = "T1041"
name = "Exfiltration Over C2 Channel"
reference = "https://attack.mitre.org/techniques/T1041/"
[[rule.threat.technique]]
id = "T1048"
name = "Exfiltration Over Alternative Protocol"
reference = "https://attack.mitre.org/techniques/T1048/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
VirtualProtect API via Stack Truncation
#Identifies VirtualProtect API calls from call stacks that are unexpectedly short. This may be an attempt to conceal the true source of the call.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies VirtualProtect API calls from call stacks that are unexpectedly short. This may be an attempt to conceal the
true source of the call.
"""
id = "ef47dbfc-5e0b-4e97-83f6-d40026634999"
license = "Elastic License v2"
name = "VirtualProtect API via Stack Truncation"
os_list = ["windows"]
version = "1.0.4"
query = '''
api where process.Ext.api.name == "VirtualProtect" and
process.thread.Ext.call_stack_final_user_module.name in ("Unknown", "Undetermined") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "c:\\windows\\sys?????\\ntdll.dll!??ProtectVirtualMemory*") and
(
(process.thread.Ext.call_stack_summary == "ntdll.dll|Unknown" and process.Ext.api.behaviors == "native_api" and
process.Ext.api.behaviors in ("hollow_unbacked", "image_indirect_call")) or
(process.Ext.api.behaviors == "truncated_stack" and process.thread.Ext.call_stack_summary == "ntdll.dll" and
process.Ext.api.parameters.size > 4096 and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info: ("c:\\windows\\sys?????\\ntdll.dll!RtlUserThreadStart*",
"c:\\windows\\sys?????\\ntdll.dll!LdrInitializeThunk*",
"c:\\windows\\sys?????\\ntdll.dll!RtlCaptureStackContext*",
/* covered by 9906a386-771f-4003-b426-fbe75bdd6e73 */
"c:\\windows\\system32\\ntdll.dll!NtTestAlert*")) and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like ("Kernel", "Kernel|*")))
) and
/* Dr.Web Shellguard anti-exploit module */
not (process.thread.Ext.call_stack_summary == "ntdll.dll|Unknown" and
process.executable : ("C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE",
"C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE") and
process.parent.executable : ("C:\\Windows\\System32\\svchost.exe",
"C:\\Windows\\explorer.exe",
"C:\\Windows\\System32\\OpenWith.exe"))
'''
min_endpoint_version = "8.14.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.14.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "VirtualProtect" and
process.thread.Ext.call_stack_final_user_module.name in ("Unknown", "Undetermined") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "c:\\windows\\sys?????\\ntdll.dll!??ProtectVirtualMemory*") and
(
(process.thread.Ext.call_stack_summary == "ntdll.dll|Unknown" and process.Ext.api.behaviors == "native_api" and
process.Ext.api.behaviors in ("hollow_unbacked", "image_indirect_call")) or
(process.Ext.api.behaviors == "truncated_stack" and process.thread.Ext.call_stack_summary == "ntdll.dll" and
process.Ext.api.parameters.size > 4096 and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info: ("c:\\windows\\sys?????\\ntdll.dll!RtlUserThreadStart*",
"c:\\windows\\sys?????\\ntdll.dll!LdrInitializeThunk*",
"c:\\windows\\sys?????\\ntdll.dll!RtlCaptureStackContext*",
"c:\\windows\\system32\\ntdll.dll!NtTestAlert*")) and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like ("Kernel", "Kernel|*")))
) and
not (process.thread.Ext.call_stack_summary == "ntdll.dll|Unknown" and
process.executable : ("C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE",
"C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE") and
process.parent.executable : ("C:\\Windows\\System32\\svchost.exe",
"C:\\Windows\\explorer.exe",
"C:\\Windows\\System32\\OpenWith.exe"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.behaviors | eq |
| field:"process.Ext.api.behaviors" kind:eq |
process.Ext.api.behaviors | in |
| field:"process.Ext.api.behaviors" kind:in |
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"VirtualProtect" |
process.Ext.api.parameters.size | gt |
| field:"process.Ext.api.parameters.size" kind:gt value:"4096" |
process.thread.Ext.call_stack_final_user_module.name | in |
| field:"process.thread.Ext.call_stack_final_user_module.name" kind:in |
process.thread.Ext.call_stack_summary | eq |
| field:"process.thread.Ext.call_stack_summary" kind:eq |
Exclusions
The rule actively suppresses these predicates.
Windows Defender Exclusions Added via PowerShell
#Identifies modifications to the Windows Defender configuration settings using PowerShell to add exclusions at the folder directory or process level.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Defense Impairment |
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 = "2021/07/20"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies modifications to the Windows Defender configuration settings using PowerShell to add exclusions at the folder
directory or process level.
"""
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 = "Windows Defender Exclusions Added via PowerShell"
note = """## Triage and analysis
### Investigating Windows Defender Exclusions Added via PowerShell
Microsoft Windows Defender is an antivirus product built into Microsoft Windows. Since this software product is used to prevent and stop malware, it's important to monitor what specific exclusions are made to the product's configuration settings. These can often be signs of an adversary or malware trying to bypass Windows Defender's capabilities. One of the more notable [examples](https://www.cyberbit.com/blog/endpoint-security/latest-trickbot-variant-has-new-tricks-up-its-sleeve/) was observed in 2018 where Trickbot incorporated mechanisms to disable Windows Defender to avoid detection.
#### Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Examine the exclusion in order to determine the intent behind it.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- If the exclusion specifies a suspicious file or path, retrieve the file(s) and determine if malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
### False positive analysis
- This rule has a high chance to produce false positives due to how often network administrators legitimately configure exclusions. In order to validate the activity further, review the specific exclusion and its intent. There are many legitimate reasons for exclusions, so it's important to gain context.
### Related rules
- Windows Defender Disabled via Registry Modification - 2ffa1f1e-b6db-47fa-994b-1512743847eb
- Disabling Windows Defender Security Settings via PowerShell - c8cccb06-faf2-4cd5-886e-2c9636cfcb87
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Exclusion lists for antimalware capabilities should always be routinely monitored for review.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### 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)
"""
references = [
"https://www.bitdefender.com/files/News/CaseStudies/study/400/Bitdefender-PR-Whitepaper-MosaicLoader-creat5540-en-EN.pdf",
"https://www.elastic.co/security-labs/elastic-security-uncovers-blister-malware-campaign",
"https://www.elastic.co/security-labs/operation-bleeding-bear",
"https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine",
]
risk_score = 47
rule_id = "2c17e5d7-08b9-43b2-b58a-0270d65ac85b"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: 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 : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or ?process.pe.original_file_name in ("PowerShell.EXE", "pwsh.dll", "powershell_ise.EXE")) and
process.args : ("*Add-MpPreference*", "*Set-MpPreference*") and
process.args : ("*-Exclusion*")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[rule.threat.technique.subtechnique]]
id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/001/"
[[rule.threat.technique.subtechnique]]
id = "T1562.006"
name = "Indicator Blocking"
reference = "https://attack.mitre.org/techniques/T1562/006/"
[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/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
(process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") or ?process.pe.original_file_name in ("PowerShell.EXE", "pwsh.dll", "powershell_ise.EXE")) and
process.args : ("*Add-MpPreference*", "*Set-MpPreference*") and
process.args : ("*-Exclusion*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.pe.original_file_name | in |
| field:"OriginalFileName" kind:in |