Detection rules › Elastic
Elastic rules: 0b
AWS EC2 Instance Profile Associated with Running Instance
#Identifies when an IAM instance profile is associated with a running EC2 instance or replaces the existing association. These APIs change which role credentials the instance obtains via the instance metadata service without terminating the instance. Attackers who can call AssociateIamInstanceProfile or ReplaceIamInstanceProfile may attach a more privileged role to a workload they control, enabling privilege escalation or lateral movement from the instance.
Known False Positives
- Blue/green deployments, instance remediation, and automation may rebind instance profiles intentionally. Confirm the instance id, new `iamInstanceProfile` or `IamInstanceProfile` ARN, and change records. Exclude known automation roles after validation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS Modify Cloud Compute Infrastructure (Panther)
Rule Body
[metadata]
creation_date = "2026/04/08"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/08"
[rule]
author = ["Elastic"]
description = """
Identifies when an IAM instance profile is associated with a running EC2 instance or replaces the existing association.
These APIs change which role credentials the instance obtains via the instance metadata service without terminating the
instance. Attackers who can call `AssociateIamInstanceProfile` or `ReplaceIamInstanceProfile` may attach a more
privileged role to a workload they control, enabling privilege escalation or lateral movement from the instance.
"""
false_positives = [
"""
Blue/green deployments, instance remediation, and automation may rebind instance profiles intentionally. Confirm the
instance id, new `iamInstanceProfile` or `IamInstanceProfile` ARN, and change records. Exclude known automation
roles after validation.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EC2 Instance Profile Associated with Running Instance"
note = """## Triage and analysis
### Investigating AWS EC2 Instance Profile Associated with Running Instance
`AssociateIamInstanceProfile` adds an instance profile to a running instance (where none was set at launch).
`ReplaceIamInstanceProfile` swaps the association. Both require `ec2:AssociateIamInstanceProfile` /
`ec2:ReplaceIamInstanceProfile` and typically `iam:PassRole` on the target instance profile’s role.
#### Possible investigation steps
- Parse `aws.cloudtrail.request_parameters` for `instanceId` and instance profile name or ARN.
- Identify the IAM role behind the profile and compare its policies to the prior role (if any).
- Map the instance to owner, application, and sensitivity; check for recent compromise indicators (SSRF to IMDS,
unusual `AssumeRole` from the instance role).
- Review `aws.cloudtrail.user_identity.arn`, `source.ip`, and `user_agent.original`.
### False positive analysis
- Legitimate fixes for missing or wrong profiles at launch; verify with service owners.
### Response and remediation
- If unauthorized: disassociate or replace with the correct profile, revoke `PassRole`/`ec2` permissions from the
actor, and rotate credentials that may have been issued from the over-privileged role.
### Additional information
- [AssociateIamInstanceProfile](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AssociateIamInstanceProfile.html)
- [ReplaceIamInstanceProfile](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ReplaceIamInstanceProfile.html)
"""
references = [
"https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AssociateIamInstanceProfile.html",
"https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ReplaceIamInstanceProfile.html",
]
risk_score = 73
rule_id = "e5f9a1b2-3c4d-4e6f-a7b8-9c0d1e2f3a4b"
severity = "high"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS EC2",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Lateral Movement",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset: "aws.cloudtrail"
and event.provider: "ec2.amazonaws.com"
and event.action: ("AssociateIamInstanceProfile" or "ReplaceIamInstanceProfile")
and event.outcome: "success"
and not aws.cloudtrail.user_identity.type: "AWSService"
and not aws.cloudtrail.user_identity.invoked_by: "ssm.amazonaws.com"
'''
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"aws.cloudtrail.resources.arn",
"aws.cloudtrail.resources.type",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
"aws.cloudtrail.response_elements",
]
[[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.005"
name = "Temporary Elevated Cloud Access"
reference = "https://attack.mitre.org/techniques/T1548/005/"
[[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 = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: query
event.dataset: "aws.cloudtrail"
and event.provider: "ec2.amazonaws.com"
and event.action: ("AssociateIamInstanceProfile" or "ReplaceIamInstanceProfile")
and event.outcome: "success"
and not aws.cloudtrail.user_identity.type: "AWSService"
and not aws.cloudtrail.user_identity.invoked_by: "ssm.amazonaws.com"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.dataset | eq |
| field:"event.dataset" kind:eq value:"aws.cloudtrail" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"ec2.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
aws.cloudtrail.user_identity.invoked_by | eq | ssm.amazonaws.com | excludes:aws.cloudtrail.user_identity.invoked_by field:"aws.cloudtrail.user_identity.invoked_by" value:"ssm.amazonaws.com" |
aws.cloudtrail.user_identity.type | eq | AWSService | excludes:aws.cloudtrail.user_identity.type field:"aws.cloudtrail.user_identity.type" value:"AWSService" |
AWS IAM Permission Boundary or Guardrail Policy Deleted by Unusual Identity
#Detects the first time an AWS identity successfully deletes an IAM managed policy whose ARN contains guardrail-related keywords (for example Boundary, Deny, Restrict, Guard, SCP, Guardrail). Adversaries who have obtained elevated IAM privileges may delete policies to remove restrictive permissions boundaries, eliminate deny-based guardrails, or clean up after a privilege escalation operation. Infrastructure-as-code tools (Terraform, CloudFormation, Pulumi, and Ansible) are excluded because policy lifecycle management is a routine part of automated deployments. A policy deletion by an identity not seen performing this activity during the prior seven days may indicate newly compromised credentials being used to modify the account's permission structure.
Known False Positives
- New IAM administrator roles, recently provisioned automation accounts, or first-time IaC deployments may legitimately delete policies for the first time. Validate that the identity is an authorized IAM management role and that the deleted policy was obsolete or replaced as part of a known change.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Defense Impairment |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| AWS | CloudTrail event DeletePolicy: Deletes the specified managed policy. |
Rule Body
[metadata]
creation_date = "2026/07/27"
integration = ["aws"]
maturity = "production"
updated_date = "2026/07/27"
[rule]
author = ["Elastic"]
description = """
Detects the first time an AWS identity successfully deletes an IAM managed policy whose ARN contains
guardrail-related keywords (for example Boundary, Deny, Restrict, Guard, SCP, Guardrail). Adversaries who have
obtained elevated IAM privileges may delete policies to remove restrictive permissions boundaries,
eliminate deny-based guardrails, or clean up after a privilege escalation operation. Infrastructure-as-code tools (Terraform, CloudFormation, Pulumi, and Ansible) are excluded because policy lifecycle management is a routine part of automated deployments. A policy deletion by an identity not seen performing this activity during the prior seven days may indicate newly compromised credentials being used to modify the account's permission structure.
"""
false_positives = [
"""
New IAM administrator roles, recently provisioned automation accounts, or first-time
IaC deployments may legitimately delete policies for the first time. Validate that the
identity is an authorized IAM management role and that the deleted policy was obsolete
or replaced as part of a known change.
""",
]
from = "now-6m"
index = ["logs-aws.cloudtrail-*"]
interval = "5m"
language = "kuery"
license = "Elastic License v2"
name = "AWS IAM Permission Boundary or Guardrail Policy Deleted by Unusual Identity"
note = """## Triage and analysis
### Investigating AWS IAM Permission Boundary or Guardrail Policy Deleted by Unusual Identity
This rule fires the first time an identity deletes a customer-managed IAM policy in the prior 7 days. Policy deletion is a privilege-escalation or defense-evasion primitive: removing a deny-based policy or permissions boundary silently expands the effective access of every principal that policy applied to.
### Possible investigation steps
- Identify the deleting principal (`aws.cloudtrail.user_identity.arn`) and determine whether they have a history of IAM policy management in audit logs beyond the 7-day window.
- Review `aws.cloudtrail.request_parameters` to identify the policy ARN that was deleted. Policies with names containing "Boundary", "Deny", or "Restrict" in the ARN are highest priority.
- Check whether any principal previously had this policy attached as a permissions boundary — if so, those principals may now operate without that constraint.
- Review the same identity's CloudTrail activity for other IAM privilege escalation indicators in the same session: `CreatePolicyVersion`, `SetDefaultPolicyVersion`, `AttachRolePolicy`, `UpdateAssumeRolePolicy`.
- Determine whether this identity was recently assumed via `AssumeRole` from an unusual source IP.
### False positive analysis
- First-time IaC deployments (Terraform apply, CDK deploy) that manage IAM resources will appear as new identities performing policy deletions.
- New service accounts introduced to handle IAM lifecycle management.
### Response and remediation
- If unauthorized, determine whether the deleted policy was a permissions boundary and re-apply it immediately to all affected principals.
- Revoke or disable the credentials used to perform the deletion pending investigation.
- Review all principals that had the policy attached and audit their current effective permissions.
"""
references = [
"https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeletePolicy.html",
]
risk_score = 47
rule_id = "f4a82031-9c8e-4b23-a7d5-6e1094b2c539"
setup = "The AWS CloudTrail integration must be enabled and configured to collect IAM management events."
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS IAM",
"Use Case: Identity and Access Audit",
"Tactic: Defense Evasion",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.action: "DeletePolicy"
and event.outcome: "success"
and not aws.cloudtrail.user_identity.type: "AWSService"
and aws.cloudtrail.request_parameters: (*Boundary* or *boundary* or *Deny* or *deny* or *Restrict* or *restrict* or *Guard* or *guard* or *SCP* or *Guardrail* or *guardrail*)
and not user_agent.original: (*Terraform* or *terraform* or "cloudformation.amazonaws.com" or *pulumi* or *Pulumi* or *ansible* or *Ansible*)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[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 = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.new_terms]
field = "new_terms_fields"
value = ["aws.cloudtrail.user_identity.arn"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
[rule.investigation_fields]
field_names = [
"@timestamp",
"aws.cloudtrail.user_identity.session_context.session_issuer.arn",
"aws.cloudtrail.user_identity.type",
"event.action",
"event.outcome",
"aws.cloudtrail.request_parameters",
"source.ip",
"cloud.region",
"cloud.account.id",
]
Stages and Predicates
Stage 1: new_terms
data_stream.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.action: "DeletePolicy"
and event.outcome: "success"
and not aws.cloudtrail.user_identity.type: "AWSService"
and aws.cloudtrail.request_parameters: (*Boundary* or *boundary* or *Deny* or *deny* or *Restrict* or *restrict* or *Guard* or *guard* or *SCP* or *Guardrail* or *guardrail*)
and not user_agent.original: (*Terraform* or *terraform* or "cloudformation.amazonaws.com" or *pulumi* or *Pulumi* or *ansible* or *Ansible*)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.request_parameters | wildcard |
| field:"aws::requestParameters" kind:wildcard |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | eq |
| field:"EventType" kind:eq value:"DeletePolicy" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"iam.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user_agent.original | eq | cloudformation.amazonaws.com | excludes:user_agent.original field:"user_agent.original" value:"cloudformation.amazonaws.com" |
user_agent.original | match | Ansible | excludes:user_agent.original field:"user_agent.original" value:"Ansible" |
user_agent.original | match | Pulumi | excludes:user_agent.original field:"user_agent.original" value:"Pulumi" |
user_agent.original | match | Terraform | excludes:user_agent.original field:"user_agent.original" value:"Terraform" |
user_agent.original | match | ansible | excludes:user_agent.original field:"user_agent.original" value:"ansible" |
user_agent.original | match | pulumi | excludes:user_agent.original field:"user_agent.original" value:"pulumi" |
user_agent.original | match | terraform | excludes:user_agent.original field:"user_agent.original" value:"terraform" |
aws.cloudtrail.user_identity.type | eq | AWSService | excludes:aws.cloudtrail.user_identity.type field:"aws.cloudtrail.user_identity.type" value:"AWSService" |
AWS Potential Cryptomining via ECS Task Definition Deployment
#Identifies a principal that, within a short window, both registers an Amazon ECS task definition using a public / non-ECR container image at a high CPU allocation (8 or 16 vCPU) AND launches ECS workloads (RunTask, StartTask, or CreateService). Registering a public miner image at maximum compute and then launching it is the ECS/Fargate cryptocurrency-mining deployment pattern seen after credential compromise. Requiring both the mining-signature registration and a launch by the same principal confirms an actual deployment rather than a standalone (possibly benign) task-definition registration, which sharply reduces false positives from high-compute workloads that are merely registered.
Known False Positives
- A principal that legitimately both registers a high-compute public-image task definition and runs ECS workloads in the same window could match (for example, some data-science or batch pipelines). Confirm the image and CPU in "aws.cloudtrail.request_parameters" of the RegisterTaskDefinition event, the launched workload, and whether the principal in "aws.cloudtrail.user_identity.arn" is an expected ECS operator; exclude known principals after validation. The CPU threshold and registry list are tunable in the query.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
creation_date = "2026/07/08"
integration = ["aws"]
maturity = "production"
updated_date = "2026/07/08"
[rule]
author = ["Elastic"]
description = """
Identifies a principal that, within a short window, both registers an Amazon ECS task definition using a public / non-ECR
container image at a high CPU allocation (8 or 16 vCPU) AND launches ECS workloads (RunTask, StartTask, or CreateService).
Registering a public miner image at maximum compute and then launching it is the ECS/Fargate cryptocurrency-mining
deployment pattern seen after credential compromise. Requiring both the mining-signature registration and a launch by the
same principal confirms an actual deployment rather than a standalone (possibly benign) task-definition registration,
which sharply reduces false positives from high-compute workloads that are merely registered.
"""
false_positives = [
"""
A principal that legitimately both registers a high-compute public-image task definition and runs ECS workloads in the
same window could match (for example, some data-science or batch pipelines). Confirm the image and CPU in
"aws.cloudtrail.request_parameters" of the RegisterTaskDefinition event, the launched workload, and whether the
principal in "aws.cloudtrail.user_identity.arn" is an expected ECS operator; exclude known principals after validation.
The CPU threshold and registry list are tunable in the query.
""",
]
from = "now-30m"
language = "esql"
license = "Elastic License v2"
name = "AWS Potential Cryptomining via ECS Task Definition Deployment"
note = """## Triage and analysis
### Investigating AWS Potential Cryptomining via ECS Task Definition Deployment
Amazon ECS runs containers from images referenced in a task definition. After credential compromise, a common impact action is to abuse ECS/Fargate for cryptomining: the adversary registers a task definition pointing at a public miner image (Docker Hub, GHCR, Quay, or the public ECR gallery) at maximum CPU to maximize hashrate, then launches it at scale via RunTask/CreateService, often across multiple regions.
This rule correlates by principal within the rule window and fires only when the same identity BOTH (a) registers a task definition whose container image comes from a public registry and whose CPU is high (8-16 vCPU), AND (b) launches ECS workloads (RunTask/StartTask/CreateService). Requiring the launch in addition to the mining-signature registration confirms active deployment and distinguishes it from a task definition that is merely registered.
### Possible investigation steps
- Review the RegisterTaskDefinition event's "aws.cloudtrail.request_parameters" for the container image, CPU/memory, and task family, and the launch event(s) for the cluster and desired count.
- Identify the principal in "aws.cloudtrail.user_identity.arn"/"aws.cloudtrail.user_identity.type" and whether it normally operates ECS; review "source.ip"/"source.as.number" and "user_agent.original".
- Correlate with related activity by the same principal: ECS "CreateCluster" (especially in unused regions), new IAM users with administrative policies, and prior reconnaissance.
- Inspect the referenced image and any running containers/tasks and their outbound network connections (mining-pool traffic).
### False positive analysis
- Legitimate batch/data-science workloads may both register a high-compute public-image task definition and run it. Validate the image, workload, and principal, and exclude known-good identities after confirmation.
### Response and remediation
- If unauthorized, stop and delete the launched services/tasks, deregister the task definition, and review other regions for the same activity.
- Investigate the principal for compromise, revoke or rotate its credentials, and review for persistence (new IAM users/policies).
- Restrict ECS task-definition registration and task execution roles, and require images from approved private ECR repositories.
"""
references = [
"https://securitylabs.datadoghq.com/articles/tales-from-the-cloud-trenches-ecs-crypto-mining/",
"https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html",
]
risk_score = 73
rule_id = "3ca27e45-b0cd-417a-914c-d086869acd1b"
setup = "This rule requires AWS CloudTrail logs ingested via the Elastic AWS integration. See https://docs.elastic.co/integrations/aws/cloudtrail for setup details."
severity = "high"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: AWS CloudTrail",
"Data Source: Amazon Web Services",
"Use Case: Threat Detection",
"Tactic: Impact",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM logs-aws.cloudtrail-*
| WHERE event.provider == "ecs.amazonaws.com"
AND event.action IN ("RegisterTaskDefinition", "RunTask", "StartTask", "CreateService")
| EVAL Esql.miner_register = CASE(
event.action == "RegisterTaskDefinition"
AND (aws.cloudtrail.request_parameters RLIKE """.*image=(docker.io|index.docker.io|ghcr.io|quay.io|public.ecr.aws)/.*"""
OR aws.cloudtrail.request_parameters RLIKE """.*image=[-a-zA-Z0-9_]+(/|[,} :]).*""")
AND aws.cloudtrail.request_parameters RLIKE """.*cpu=(8192|16384)[,} ].*""", 1, 0),
Esql.task_run = CASE(event.action IN ("RunTask", "StartTask", "CreateService"), 1, 0)
| STATS Esql.miner_register_sum = SUM(Esql.miner_register), Esql.task_run_sum = SUM(Esql.task_run), Esql.event_count = COUNT(*),
Esql.cloud_region_count_distinct = COUNT_DISTINCT(cloud.region), Esql.cloud_region_values = VALUES(cloud.region),
Esql.event_action_values = VALUES(event.action), Esql.source_ip_values = VALUES(source.ip),
Esql.source_as_number_values = VALUES(source.as.number), Esql.user_agent_original_values = VALUES(user_agent.original),
Esql.cloud_account_id_values = VALUES(cloud.account.id), Esql.aws_cloudtrail_user_identity_type_values = VALUES(aws.cloudtrail.user_identity.type),
Esql.timestamp_min = MIN(@timestamp), Esql.timestamp_max = MAX(@timestamp)
BY aws.cloudtrail.user_identity.arn
| WHERE Esql.miner_register_sum >= 1 AND Esql.task_run_sum >= 1
| KEEP aws.*, Esql.aws_cloudtrail_user_identity_type_values, Esql.miner_register_sum, Esql.task_run_sum, Esql.event_count, Esql.cloud_region_count_distinct, Esql.cloud_region_values, Esql.event_action_values, Esql.source_ip_values, Esql.source_as_number_values, Esql.user_agent_original_values, Esql.cloud_account_id_values, Esql.timestamp_min, Esql.timestamp_max
'''
[rule.investigation_fields]
field_names = [
"aws.cloudtrail.user_identity.arn",
"Esql.aws_cloudtrail_user_identity_type_values",
"Esql.miner_register_sum",
"Esql.task_run_sum",
"Esql.event_count",
"Esql.cloud_region_count_distinct",
"Esql.cloud_region_values",
"Esql.event_action_values",
"Esql.source_ip_values",
"Esql.source_as_number_values",
"Esql.user_agent_original_values",
"Esql.cloud_account_id_values",
"Esql.timestamp_min",
"Esql.timestamp_max",
]
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1496"
name = "Resource Hijacking"
reference = "https://attack.mitre.org/techniques/T1496/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
Stages and Predicates
Stage 1: from
FROM logs-aws.cloudtrail-*
Stage 2: where
| WHERE event.provider == "ecs.amazonaws.com"
AND event.action IN ("RegisterTaskDefinition", "RunTask", "StartTask", "CreateService")
Stage 3: eval
| EVAL Esql.miner_register = CASE(
event.action == "RegisterTaskDefinition"
AND (aws.cloudtrail.request_parameters RLIKE """.*image=(docker.io|index.docker.io|ghcr.io|quay.io|public.ecr.aws)/.*"""
OR aws.cloudtrail.request_parameters RLIKE """.*image=[-a-zA-Z0-9_]+(/|[,} :]).*""")
AND aws.cloudtrail.request_parameters RLIKE """.*cpu=(8192|16384)[,} ].*""", 1, 0),
Esql.task_run = CASE(event.action IN ("RunTask", "StartTask", "CreateService"), 1, 0)
Esql.miner_register =event.action == "RegisterTaskDefinition"
AND (aws.cloudtrail.request_parameters RLIKE """.*image=(docker.io|index.docker.io|ghcr.io|quay.io|public.ecr.aws)/.*"""
OR aws.cloudtrail.request_parameters RLIKE """.*image=[-a-zA-Z0-9_]+(/|[,} :]).*""")
AND aws.cloudtrail.request_parameters RLIKE """.*cpu=(8192|16384)[,} ].*"""10Esql.task_run =event.action IN ("RunTask", "StartTask", "CreateService")10Stage 4: stats
| STATS Esql.miner_register_sum = SUM(Esql.miner_register), Esql.task_run_sum = SUM(Esql.task_run), Esql.event_count = COUNT(*),
Esql.cloud_region_count_distinct = COUNT_DISTINCT(cloud.region), Esql.cloud_region_values = VALUES(cloud.region),
Esql.event_action_values = VALUES(event.action), Esql.source_ip_values = VALUES(source.ip),
Esql.source_as_number_values = VALUES(source.as.number), Esql.user_agent_original_values = VALUES(user_agent.original),
Esql.cloud_account_id_values = VALUES(cloud.account.id), Esql.aws_cloudtrail_user_identity_type_values = VALUES(aws.cloudtrail.user_identity.type),
Esql.timestamp_min = MIN(@timestamp), Esql.timestamp_max = MAX(@timestamp)
BY aws.cloudtrail.user_identity.arn
Stage 5: where
| WHERE Esql.miner_register_sum >= 1 AND Esql.task_run_sum >= 1
Stage 6: keep
| KEEP aws.*, Esql.aws_cloudtrail_user_identity_type_values, Esql.miner_register_sum, Esql.task_run_sum, Esql.event_count, Esql.cloud_region_count_distinct, Esql.cloud_region_values, Esql.event_action_values, Esql.source_ip_values, Esql.source_as_number_values, Esql.user_agent_original_values, Esql.cloud_account_id_values, Esql.timestamp_min, Esql.timestamp_max
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.miner_register_sum | ge |
| field:"Esql.miner_register_sum" kind:ge value:"1" |
Esql.task_run_sum | ge |
| field:"Esql.task_run_sum" kind:ge value:"1" |
event.action | in |
| field:"EventType" kind:in |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"ecs.amazonaws.com" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
aws.* | KEEP aws.* |
Esql.aws_cloudtrail_user_identity_type_values | KEEP Esql.aws_cloudtrail_user_identity_type_values |
Esql.miner_register_sum | KEEP Esql.miner_register_sum |
Esql.task_run_sum | KEEP Esql.task_run_sum |
Esql.event_count | KEEP Esql.event_count |
Esql.cloud_region_count_distinct | KEEP Esql.cloud_region_count_distinct |
Esql.cloud_region_values | KEEP Esql.cloud_region_values |
Esql.event_action_values | KEEP Esql.event_action_values |
Esql.source_ip_values | KEEP Esql.source_ip_values |
Esql.source_as_number_values | KEEP Esql.source_as_number_values |
Esql.user_agent_original_values | KEEP Esql.user_agent_original_values |
Esql.cloud_account_id_values | KEEP Esql.cloud_account_id_values |
Esql.timestamp_min | KEEP Esql.timestamp_min |
Esql.timestamp_max | KEEP Esql.timestamp_max |
Encoded Powershell Execution via MsiExec
#Detects attempts to execute encoded powershell commands via Windows Installers.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = "Detects attempts to execute encoded powershell commands via Windows Installers."
id = "5a7148dc-338a-4998-8adb-5b64d7557dfc"
license = "Elastic License v2"
name = "Encoded Powershell Execution via MsiExec"
os_list = ["windows"]
version = "1.0.3"
query = '''
process where event.action == "start" and
(process.name : "powershell.exe" or process.pe.original_file_name == "PowerShell.EXE") and
process.args : ("-e", "-enc", "-ec", "-encod", "-encode", "iex (gc *") and
(
descendant of [process where event.action == "start" and process.name : "msiexec.exe"] or
process.parent.name : "msiexec.exe"
)
'''
min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[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 = "7.16.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
(process.name : "powershell.exe" or process.pe.original_file_name == "PowerShell.EXE") and
process.args : ("-e", "-enc", "-ec", "-encod", "-encode", "iex (gc *") and
(
descendant of [process where event.action == "start" and process.name : "msiexec.exe"] or
process.parent.name : "msiexec.exe"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"powershell.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"msiexec.exe" |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"PowerShell.EXE" |
Entra ID Protection Alerts for User Detected
#Identifies more than two Microsoft Entra ID Protection alerts associated to the user principal in a short time period. Microsoft Entra ID Protection alerts are triggered by suspicious sign-in activity, such as anomalous IP addresses, risky sign-ins, or other risk detections. Multiple alerts in a short time frame may indicate an ongoing attack or compromised account.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence | |
| Stealth |
Rule Body
[metadata]
creation_date = "2025/04/30"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies more than two Microsoft Entra ID Protection alerts associated to the user principal in a short time period.
Microsoft Entra ID Protection alerts are triggered by suspicious sign-in activity, such as anomalous IP addresses, risky
sign-ins, or other risk detections. Multiple alerts in a short time frame may indicate an ongoing attack or compromised
account.
"""
from = "now-9m"
index = ["logs-azure.identity_protection-*"]
language = "eql"
license = "Elastic License v2"
name = "Entra ID Protection Alerts for User Detected"
note = """## Triage and analysis
### Investigating Entra ID Protection Alerts for User Detected
#### Possible investigation steps
- Identify the Risk Detection that triggered the event. A list with descriptions can be found [here](https://docs.microsoft.com/en-us/azure/active-directory/identity-protection/concept-identity-protection-risks#risk-types-and-detection).
- Identify the user account involved and validate whether the suspicious activity is normal for that user.
- Consider the source IP address and geolocation for the involved user account. Do they look normal?
- Consider the device used to sign in. Is it registered and compliant?
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account owner and confirm whether they are aware of this activity.
- Check if this operation was approved and performed according to the organization's change management policy.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
### False positive analysis
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and device conditions.
- Consider the context of the user account and whether the activity is expected. For example, if the user is a developer or administrator, they may have legitimate reasons for accessing resources from various locations or devices.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Follow security best practices [outlined](https://docs.microsoft.com/en-us/azure/security/fundamentals/identity-management-best-practices) by Microsoft.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
references = [
"https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/reference-azure-monitor-sign-ins-log-schema",
"https://docs.microsoft.com/en-us/azure/active-directory/identity-protection/overview-identity-protection",
"https://docs.microsoft.com/en-us/azure/active-directory/identity-protection/howto-identity-protection-investigate-risk",
"https://docs.microsoft.com/en-us/azure/active-directory/identity-protection/howto-identity-protection-investigate-risk#investigation-framework",
]
risk_score = 73
rule_id = "bcf0e362-0a2f-4f5e-9dd8-0d34f901781f"
severity = "high"
tags = [
"Domain: Cloud",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Protection Logs",
"Use Case: Identity and Access Audit",
"Resources: Investigation Guide",
"Tactic: Initial Access",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence by azure.identityprotection.properties.user_principal_name with maxspan=10m
[any where event.module == "azure" and data_stream.dataset == "azure.identity_protection"] with runs=2
'''
[[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.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 = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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 = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: any ×2
[any where event.module == "azure" and data_stream.dataset == "azure.identity_protection"] with runs=2
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"azure.identity_protection" |
event.module | eq |
| field:"event.module" kind:eq value:"azure" |
Kubernetes Pod Created With HostIPC
#This rule detects an attempt to create or modify a pod using the host IPC namespace. This gives access to data used by any pod that also use the hosts IPC namespace. If any process on the host or any processes in a pod uses the hosts inter-process communication mechanisms (shared memory, semaphore arrays, message queues, etc.), an attacker can read/write to those same mechanisms. They may look for files in /dev/shm or use ipcs to check for any IPC facilities being used.
Known False Positives
- An administrator or developer may want to use a pod that runs as root and shares the host's IPC, Network, and PID namespaces for debugging purposes. If something is going wrong in the cluster and there is no easy way to SSH onto the host nodes directly, a privileged pod of this nature can be useful for viewing things like iptable rules and network namespaces from the host's perspective. Add exceptions for trusted container images using the query field "kubernetes.audit.requestObject.spec.container.image"
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Kubernetes | create-pods: create pods |
| Kubernetes | update-pods: update pods |
| Kubernetes | patch-pods: patch pods |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure AKS Attempted User Exec into Pod (Elastic)
- Azure AKS Ephemeral Container Added to Pod (Elastic)
- Container With A hostPath Mount Created (Sigma)
- Creation Of Pod In System Namespace (Sigma)
- Direct Interactive Kubernetes API Request by Unusual Utilities (Elastic)
- Exec into Pod (Panther)
- GCP Break-glass Container Workload Deployed (Sigma)
- GCP K8s Pod Attached To Node Host Network (Panther)
Rule Body
[metadata]
creation_date = "2022/07/05"
integration = ["kubernetes"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
This rule detects an attempt to create or modify a pod using the host IPC namespace. This gives access to data used by
any pod that also use the hosts IPC namespace. If any process on the host or any processes in a pod uses the hosts
inter-process communication mechanisms (shared memory, semaphore arrays, message queues, etc.), an attacker can
read/write to those same mechanisms. They may look for files in /dev/shm or use ipcs to check for any IPC facilities
being used.
"""
false_positives = [
"""
An administrator or developer may want to use a pod that runs as root and shares the host's IPC, Network, and PID
namespaces for debugging purposes. If something is going wrong in the cluster and there is no easy way to SSH onto
the host nodes directly, a privileged pod of this nature can be useful for viewing things like iptable rules and
network namespaces from the host's perspective. Add exceptions for trusted container images using the query field
"kubernetes.audit.requestObject.spec.container.image"
""",
]
index = ["logs-kubernetes.audit_logs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Kubernetes Pod Created With HostIPC"
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 Kubernetes Pod Created With HostIPC
Kubernetes allows pods to share the host's IPC namespace, enabling inter-process communication. While useful for legitimate applications, adversaries can exploit this to access shared memory and IPC mechanisms, potentially leading to data exposure or privilege escalation. The detection rule identifies suspicious pod creation or modification events that enable host IPC, excluding known benign images, to flag potential security threats.
### Possible investigation steps
- Review the Kubernetes audit logs to identify the specific pod creation or modification event that triggered the alert, focusing on the event.dataset field with the value "kubernetes.audit_logs".
- Examine the kubernetes.audit.annotations.authorization_k8s_io/decision field to confirm that the action was allowed, and verify the identity of the user or service account that initiated the request.
- Investigate the kubernetes.audit.objectRef.resource field to ensure the resource involved is indeed a pod, and check the kubernetes.audit.verb field to determine if the action was a create, update, or patch operation.
- Analyze the kubernetes.audit.requestObject.spec.hostIPC field to confirm that host IPC was enabled, and cross-reference with the kubernetes.audit.requestObject.spec.containers.image field to ensure the image is not part of the known benign list.
- Check for any other pods or processes on the host that might be using the host's IPC namespace, and assess if there is any unauthorized access or data exposure risk.
- Look for any suspicious activity or anomalies in the /dev/shm directory or use the ipcs command to identify any IPC facilities that might be exploited.
### False positive analysis
- Pods using hostIPC for legitimate inter-process communication may trigger alerts. Review the pod's purpose and verify if hostIPC is necessary for its function.
- Known benign images, such as monitoring or logging agents, might use hostIPC. Update the exclusion list to include these images if they are verified as non-threatening.
- Development or testing environments often use hostIPC for debugging purposes. Consider excluding these environments from the rule or creating a separate rule with a higher threshold for alerts.
- Automated deployment tools might temporarily use hostIPC during setup. Ensure these tools are recognized and excluded if they are part of a controlled and secure process.
- Regularly review and update the exclusion list to reflect changes in your environment, ensuring that only verified and necessary uses of hostIPC are excluded.
### Response and remediation
- Immediately isolate the affected pod to prevent further access to the host's IPC namespace. This can be done by cordoning the node or deleting the pod if necessary.
- Review and revoke any unnecessary permissions or roles that allowed the pod to be created or modified with hostIPC enabled. Ensure that only trusted entities have the capability to modify pod specifications.
- Conduct a thorough audit of other pods and configurations in the cluster to identify any additional instances where hostIPC is enabled without a valid justification.
- Implement network policies to restrict communication between pods and the host, limiting the potential impact of any unauthorized access to the host's IPC mechanisms.
- Escalate the incident to the security operations team for further investigation and to determine if any data exposure or privilege escalation occurred.
- Update security policies and configurations to prevent the use of hostIPC in future pod deployments unless explicitly required and approved.
- Enhance monitoring and alerting to detect similar attempts in the future, ensuring that any unauthorized use of hostIPC is promptly flagged and addressed.
## Setup
The Kubernetes Fleet integration with Audit Logs enabled or similarly structured data is required to be compatible with this rule."""
references = [
"https://research.nccgroup.com/2021/11/10/detection-engineering-for-kubernetes-clusters/#part3-kubernetes-detections",
"https://kubernetes.io/docs/concepts/security/pod-security-policy/#host-namespaces",
"https://bishopfox.com/blog/kubernetes-pod-privilege-escalation",
]
risk_score = 47
rule_id = "764c8437-a581-4537-8060-1fdb0e92c92d"
severity = "medium"
tags = [
"Data Source: Kubernetes",
"Domain: Kubernetes",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset : "kubernetes.audit_logs" and kubernetes.audit.annotations.authorization_k8s_io/decision:"allow" and
kubernetes.audit.objectRef.resource:"pods" and kubernetes.audit.verb:("create" or "update" or "patch") and
kubernetes.audit.requestObject.spec.hostIPC:true and
not kubernetes.audit.requestObject.spec.containers.image: (
docker.elastic.co/beats/elastic-agent* or rancher/system-agent* or registry.crowdstrike.com/falcon-sensor*
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1611"
name = "Escape to Host"
reference = "https://attack.mitre.org/techniques/T1611/"
[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 = "T1610"
name = "Deploy Container"
reference = "https://attack.mitre.org/techniques/T1610/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: query
data_stream.dataset : "kubernetes.audit_logs" and kubernetes.audit.annotations.authorization_k8s_io/decision:"allow" and
kubernetes.audit.objectRef.resource:"pods" and kubernetes.audit.verb:("create" or "update" or "patch") and
kubernetes.audit.requestObject.spec.hostIPC:true and
not kubernetes.audit.requestObject.spec.containers.image: (
docker.elastic.co/beats/elastic-agent* or rancher/system-agent* or registry.crowdstrike.com/falcon-sensor*
)
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
kubernetes.audit.requestObject.spec.containers.image | starts_with | docker.elastic.co/beats/elastic-agent | excludes:kubernetes.audit.requestObject.spec.containers.image field:"kubernetes.audit.requestObject.spec.containers.image" value:"docker.elastic.co/beats/elastic-agent" |
kubernetes.audit.requestObject.spec.containers.image | starts_with | rancher/system-agent | excludes:kubernetes.audit.requestObject.spec.containers.image field:"kubernetes.audit.requestObject.spec.containers.image" value:"rancher/system-agent" |
kubernetes.audit.requestObject.spec.containers.image | starts_with | registry.crowdstrike.com/falcon-sensor | excludes:kubernetes.audit.requestObject.spec.containers.image field:"kubernetes.audit.requestObject.spec.containers.image" value:"registry.crowdstrike.com/falcon-sensor" |
Microsoft Office Loaded a Dropped Executable File
#Identifies when a Microsoft Office process creates an executable file (DLL) and the file is subsequently loaded. An adversary may deliver a weaponized Office document to their target that writes and loads malicious modules.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule Body
[rule]
description = """
Identifies when a Microsoft Office process creates an executable file (DLL) and the file is subsequently loaded. An
adversary may deliver a weaponized Office document to their target that writes and loads malicious modules.
"""
id = "a0a82ad6-98ed-4426-abd8-52e7b052e297"
license = "Elastic License v2"
name = "Microsoft Office Loaded a Dropped Executable File"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.33"
query = '''
sequence by process.entity_id with maxspan=1m
[ file where event.action != "deletion" and
process.name :
("WINWORD.EXE",
"EXCEL.EXE",
"POWERPNT.EXE",
"MSACCESS.EXE") and
(
file.extension : ("dll", "cpl", "ocx") or
// Match Windows PE files by header data (MZ)
file.Ext.header_bytes : "4d5a*"
)] by file.path
[ library where
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
dll.hash.sha256 != null and
not (dll.code_signature.trusted == true and dll.path : "?:\\Users\\*\\appdata\\local\\assembly\\*.dll") and
not (dll.code_signature.subject_name == "Bloomberg L.P." and dll.code_signature.trusted == true) and
not dll.hash.sha256 : ("8f66789803adb34bdce7dd6686c6d53a0d1089ebf998ec3ab2b455da2828fd3c",
"464266dd5656b82acaac189406983e1c9427be6578f6617360c613e5911c2b06",
"2ce237db9ba8d32db3e1fb7301b407e66cf101cc8f37efa32e5e97d40032f75a",
"aa6fd3c1caf2a53d1fba496564dff15d89779bbdf8f132917eec30049adc9678",
"077e534918a6d0ce90ad91b26168d6b838a854f3899ddf0720a38ca31d15102b",
"26815ae316c6fdeb699b722ba9663089590a5aeaee1ec10375d21d814c5f3aec",
"e464f82e4a44064dc00e997b18fb55c22e0f39182dc22e150ef081cd13af01fe",
"b0680c48dd70da998844bb34fb4bb70d95cc7698ebb7443c36be0d393adc14d5",
"3ab00c79bc361e4b10d79f7c9e1b9d4ab9935b5e5a622027700bc278b5eb622d",
"e0a51c0bf8b8563a91aba2b3a473e93c8e2febf6d2db1f0a3aeebd8dd3d8d054",
"2153b80f5d1cb4bce4b01ec7801abb0b0858b644f21ad5f8cb4d7d83c7db151d",
"e8db34b27fbedd8d4022b9ee9071ca2651730fe1741569bad746dbdf129e562a",
"0ac3251c8451349337c6b2b9763a95a47dfc5b883ba6f91eccd22b07c930c984",
"57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7") and
not dll.path : "?:\\Windows\\assembly\\NativeImages_*.dll" and
not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
not dll.pe.imphash : "dae02f32a21e03ce65412f6e56942daa"] by dll.path
'''
min_endpoint_version = "8.10.0"
optional_actions = []
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[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.10.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by dll.path, file.path, process.entity_id.
Stage 1: file
[ file where event.action != "deletion" and
process.name :
("WINWORD.EXE",
"EXCEL.EXE",
"POWERPNT.EXE",
"MSACCESS.EXE") and
(
file.extension : ("dll", "cpl", "ocx") or
file.Ext.header_bytes : "4d5a*"
)] by file.path
Stage 2: library
[ library where
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
dll.hash.sha256 != null and
not (dll.code_signature.trusted == true and dll.path : "?:\\Users\\*\\appdata\\local\\assembly\\*.dll") and
not (dll.code_signature.subject_name == "Bloomberg L.P." and dll.code_signature.trusted == true) and
not dll.hash.sha256 : ("8f66789803adb34bdce7dd6686c6d53a0d1089ebf998ec3ab2b455da2828fd3c",
"464266dd5656b82acaac189406983e1c9427be6578f6617360c613e5911c2b06",
"2ce237db9ba8d32db3e1fb7301b407e66cf101cc8f37efa32e5e97d40032f75a",
"aa6fd3c1caf2a53d1fba496564dff15d89779bbdf8f132917eec30049adc9678",
"077e534918a6d0ce90ad91b26168d6b838a854f3899ddf0720a38ca31d15102b",
"26815ae316c6fdeb699b722ba9663089590a5aeaee1ec10375d21d814c5f3aec",
"e464f82e4a44064dc00e997b18fb55c22e0f39182dc22e150ef081cd13af01fe",
"b0680c48dd70da998844bb34fb4bb70d95cc7698ebb7443c36be0d393adc14d5",
"3ab00c79bc361e4b10d79f7c9e1b9d4ab9935b5e5a622027700bc278b5eb622d",
"e0a51c0bf8b8563a91aba2b3a473e93c8e2febf6d2db1f0a3aeebd8dd3d8d054",
"2153b80f5d1cb4bce4b01ec7801abb0b0858b644f21ad5f8cb4d7d83c7db151d",
"e8db34b27fbedd8d4022b9ee9071ca2651730fe1741569bad746dbdf129e562a",
"0ac3251c8451349337c6b2b9763a95a47dfc5b883ba6f91eccd22b07c930c984",
"57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7") and
not dll.path : "?:\\Windows\\assembly\\NativeImages_*.dll" and
not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
not dll.pe.imphash : "dae02f32a21e03ce65412f6e56942daa"] by dll.path
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.hash.sha256 | is_not_null | field:"Hashes" kind:is_not_null | |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*" |
file.extension | wildcard |
| field:"file.extension" 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.subject_name | eq | Bloomberg L.P. | excludes:dll.code_signature.subject_name field:"dll.code_signature.subject_name" value:"Bloomberg L.P." |
dll.code_signature.trusted | eq | true | excludes:dll.code_signature.trusted field:"dll.code_signature.trusted" value:"true" |
dll.path | wildcard | ?:\Users\*\appdata\local\assembly\*.dll | excludes:dll.path field:"dll.path" value:"?:\Users\*\appdata\local\assembly\*.dll" |
dll.code_signature.status | wildcard | trusted, errorExpired, errorCode_endpoint* | excludes:dll.code_signature.status field:"dll.code_signature.status" value:"trusted" field:"dll.code_signature.status" value:"errorExpired" field:"dll.code_signature.status" value:"errorCode_endpoint*" |
dll.hash.sha256 | eq | 8f66789803adb34bdce7dd6686c6d53a0d1089ebf998ec3ab2b455da2828fd3c, 464266dd5656b82acaac189406983e1c9427be6578f6617360c613e5911c2b06, 2ce237db9ba8d32db3e1fb7301b407e66cf101cc8f37efa32e5e97d40032f75a, aa6fd3c1caf2a53d1fba496564dff15d89779bbdf8f132917eec30049adc9678, 077e534918a6d0ce90ad91b26168d6b838a854f3899ddf0720a38ca31d15102b, 26815ae316c6fdeb699b722ba9663089590a5aeaee1ec10375d21d814c5f3aec, e464f82e4a44064dc00e997b18fb55c22e0f39182dc22e150ef081cd13af01fe, b0680c48dd70da998844bb34fb4bb70d95cc7698ebb7443c36be0d393adc14d5, 3ab00c79bc361e4b10d79f7c9e1b9d4ab9935b5e5a622027700bc278b5eb622d, e0a51c0bf8b8563a91aba2b3a473e93c8e2febf6d2db1f0a3aeebd8dd3d8d054, 2153b80f5d1cb4bce4b01ec7801abb0b0858b644f21ad5f8cb4d7d83c7db151d, e8db34b27fbedd8d4022b9ee9071ca2651730fe1741569bad746dbdf129e562a, 0ac3251c8451349337c6b2b9763a95a47dfc5b883ba6f91eccd22b07c930c984, 57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7 | excludes:dll.hash.sha256 |
dll.path | wildcard | ?:\Windows\assembly\NativeImages_*.dll | excludes:dll.path field:"dll.path" value:"?:\Windows\assembly\NativeImages_*.dll" |
dll.pe.imphash | eq | dae02f32a21e03ce65412f6e56942daa | excludes:dll.pe.imphash field:"dll.pe.imphash" value:"dae02f32a21e03ce65412f6e56942daa" |
Network Connection Initiated by Suspicious SSHD Child Process
#This rule identifies an egress internet connection initiated by an SSH Daemon child process. This behavior is indicative of the alteration of a shell configuration file or other mechanism that launches a process when a new SSH login occurs. Attackers can also backdoor the SSH daemon to allow for persistence, call out to a C2 or to steal credentials.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Lateral Movement | |
| Command & Control |
Rule Body
[metadata]
creation_date = "2024/06/06"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule identifies an egress internet connection initiated by an SSH Daemon child process. This behavior is
indicative of the alteration of a shell configuration file or other mechanism that launches a process when a
new SSH login occurs. Attackers can also backdoor the SSH daemon to allow for persistence, call out to a C2
or to steal credentials.
"""
from = "now-9m"
index = ["logs-endpoint.events.network*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Network Connection Initiated by Suspicious SSHD Child Process"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Network Connection Initiated by Suspicious SSHD Child Process
The SSH Daemon (SSHD) facilitates secure remote logins and command execution on Linux systems. Adversaries may exploit SSHD by modifying shell configurations or backdooring the daemon to establish unauthorized connections, often for persistence or data exfiltration. The detection rule identifies suspicious outbound connections initiated by SSHD child processes, excluding benign processes and internal IP ranges, to flag potential malicious activity.
### Possible investigation steps
- Review the process details of the SSHD child process that initiated the network connection, focusing on the process.entity_id and process.parent.entity_id to understand the process hierarchy and parent-child relationship.
- Examine the destination IP address of the network connection attempt to determine if it is associated with known malicious activity or suspicious external entities, especially since it is not within the excluded internal IP ranges.
- Investigate the executable path of the process that initiated the connection to ensure it is not a known benign process like "/bin/yum" or "/usr/bin/yum", and verify if the process name is not among the excluded ones such as "login_duo", "ssh", "sshd", or "sshd-session".
- Check the timing and frequency of the SSHD child process executions and network connection attempts to identify any patterns or anomalies that could indicate unauthorized or persistent access attempts.
- Correlate the alert with other security events or logs from the same host.id to gather additional context and determine if there are other indicators of compromise or related suspicious activities.
### False positive analysis
- Internal administrative scripts or tools that initiate network connections upon SSH login can trigger false positives. To manage this, identify and whitelist these specific scripts or tools by their process names or executable paths.
- Automated software updates or package management processes like yum may occasionally initiate network connections. Exclude these processes by adding them to the exception list using their executable paths.
- Security tools such as login_duo or other authentication mechanisms that establish network connections during SSH sessions can be mistaken for malicious activity. Exclude these tools by specifying their process names in the exception list.
- Custom monitoring or logging solutions that connect to external servers for data aggregation might be flagged. Identify these processes and exclude them by their executable paths or process names to prevent false alerts.
### Response and remediation
- Immediately isolate the affected host from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious processes identified as child processes of SSHD that are attempting unauthorized network connections.
- Conduct a thorough review of SSHD configuration files and shell configuration files for unauthorized modifications or backdoors, and restore them from a known good backup if necessary.
- Change all credentials associated with the affected system, especially those that may have been exposed or used during the unauthorized SSH sessions.
- Apply security patches and updates to the SSH daemon and related software to mitigate known vulnerabilities that could be exploited for persistence or unauthorized access.
- Monitor network traffic for any further suspicious outbound connections from other systems, indicating potential lateral movement or additional compromised hosts.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine the scope of the compromise."""
references = ["https://hadess.io/the-art-of-linux-persistence/"]
risk_score = 47
rule_id = "63431796-f813-43af-820b-492ee2efec8e"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide"
]
type = "eql"
query = '''
sequence by host.id with maxspan=1s
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.parent.executable == "/usr/sbin/sshd" and not process.command_line like ("*ansible*", "*BECOME-SUCCESS*")] by process.entity_id
[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and (
process.executable like (
"/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "/lost+found/*",
"/proc/*", "/var/mail/*", "/var/www/*", "/home/*", "/root/*"
) or
process.name like~ (
// Hidden processes
".*",
// Suspicious file formats
"*.elf", "*.sh", "*.py", "*.rb", "*.pl", "*.lua*", "*.php*", ".js",
// Scheduled tasks
"systemd", "cron", "crond",
// Network utilities often used for reverse shells
"nc", "netcat", "ncat", "telnet", "socat", "openssl", "nc.openbsd", "ngrok", "nc.traditional"
)
) and
not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.executable in ("/bin/yum", "/usr/bin/yum") or
process.name in ("login_duo", "ssh", "sshd", "sshd-session", "sqlplus")
)
] by process.parent.entity_id
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.004"
name = "Unix Shell Configuration Modification"
reference = "https://attack.mitre.org/techniques/T1546/004/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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.004"
name = "SSH"
reference = "https://attack.mitre.org/techniques/T1021/004/"
[[rule.threat.technique]]
id = "T1563"
name = "Remote Service Session Hijacking"
reference = "https://attack.mitre.org/techniques/T1563/"
[[rule.threat.technique.subtechnique]]
id = "T1563.001"
name = "SSH Hijacking"
reference = "https://attack.mitre.org/techniques/T1563/001/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1095"
name = "Non-Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1095/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 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 == "exec" and
process.parent.executable == "/usr/sbin/sshd" and not process.command_line like ("*ansible*", "*BECOME-SUCCESS*")] by process.entity_id
Stage 2: network
[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and (
process.executable like (
"/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "/lost+found/*",
"/proc/*", "/var/mail/*", "/var/www/*", "/home/*", "/root/*"
) or
process.name like~ (
".*",
"*.elf", "*.sh", "*.py", "*.rb", "*.pl", "*.lua*", "*.php*", ".js",
"systemd", "cron", "crond",
"nc", "netcat", "ncat", "telnet", "socat", "openssl", "nc.openbsd", "ngrok", "nc.traditional"
)
) and
not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.executable in ("/bin/yum", "/usr/bin/yum") or
process.name in ("login_duo", "ssh", "sshd", "sshd-session", "sqlplus")
)
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.executable | eq |
| field:"ParentImage" kind:eq value:"/usr/sbin/sshd" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | match | ansible, BECOME-SUCCESS | excludes:process.command_line field:"process.command_line" value:"ansible" field:"process.command_line" value:"BECOME-SUCCESS" |
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8, 172.31.0.0/16 | excludes:destination.ip |
destination.ip | eq | 0.0.0.0 | excludes:destination.ip field:"destination.ip" value:"0.0.0.0" |
destination.ip | is_null | excludes:destination.ip | |
process.executable | in | /bin/yum, /usr/bin/yum | excludes:process.executable field:"process.executable" value:"/bin/yum" field:"process.executable" value:"/usr/bin/yum" |
process.name | in | login_duo, sqlplus, ssh, sshd, sshd-session | excludes:process.name |
Potential Browser Information Discovery
#Identifies attempts to access browser history and bookmarks files. Adversaries may enumerate information about browsers to learn more about compromised environments.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[rule]
description = """
Identifies attempts to access browser history and bookmarks files. Adversaries may enumerate information about browsers
to learn more about compromised environments.
"""
id = "b66bbe30-dd0a-4c79-ade4-2700930f8c09"
license = "Elastic License v2"
name = "Potential Browser Information Discovery"
os_list = ["windows"]
reference = ["https://attack.mitre.org/techniques/T1217/"]
version = "1.0.13"
query = '''
file where event.action == "open" and
process.executable != null and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and process.pid != 4 and
file.path :
("?:\\users\\*\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History",
"?:\\users\\*\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Bookmarks",
"?:\\users\\*\\appdata\\local\\microsoft\\edge\\user data\\default\\History",
"?:\\users\\*\\appdata\\local\\microsoft\\edge\\user data\\default\\Bookmarks",
"?:\\Users\\*\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*.default*\\places.sqlite",
"?:\\Users\\*\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*.default*\\formhistory.sqlite") and
process.thread.Ext.call_stack_summary : "?*" and
(
(process.code_signature.trusted == false and not process.code_signature.status : ("errorExpired", "errorCode_endpoint*")) or
process.code_signature.exists == false or
(process.code_signature.subject_name : "Microsoft*" and process.thread.Ext.call_stack_contains_unbacked == true and not process.name : "powershell.exe") or
process.executable :
("?:\\Users\\Public\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Windows\\Temp\\*",
"?:\\Windows\\Tasks\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Microsoft.NET\\*")
) and
not (process.code_signature.subject_name : ("Google LLC", "Mozilla Corporation", "BrowserWorks Ltd", "SAP SE", "Time Doctor LLC", "Emsisoft Ltd", "PIRIFORM SOFTWARE LIMITED") and
process.code_signature.trusted == true) and
not (process.code_signature.subject_name : "Shift Technologies Inc." and process.code_signature.status : "errorUntrustedRoot") and
not process.executable :
("?:\\Program Files (x86)\\*.exe",
"?:\\Program Files\\*.exe",
"?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\BitLockerDiscoveryVolumeContents\\BitLockerToGo.exe",
"?:\\Users\\*\\User Data\\Default\\mozilla_downloads.exe",
"?:\\Users\\*\\User Data\\Default\\chrome_downloads.exe",
"?:\\Users\\*\\User Data\\Default\\msedge_downloads.exe",
"?:\\Users\\*\\AppData\\Local\\Chromium\\Application\\chrome.exe",
"?:\\Users\\*\\AppData\\Local\\Thorium\\Application\\thorium.exe") and
not (process.executable : "C:\\Windows\\Temp\\RarSFX*\\scanstate.exe" and
process.thread.Ext.call_stack_summary == "ntdll.dll|sophosed.dll|apphelp.dll|kernelbase.dll|migcore.dll|migstore.dll|migcore.dll|scanstate.exe|kernel32.dll|ntdll.dll") and
not (process.executable : "C:\\Windows\\explorer.exe" and
process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|hostshellextension.dll|Unbacked") and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info : ("*\\chrome.dll!GetHandleVerifier*",
"*\\chrome.dll!ChromeMain*",
"*\\nw.dll!sqlite3_dbdata_init*",
"*\\nw.dll!GetHandleVerifier*",
"*\\BrowserSettings.dll!SetEdgeAsDefaultBrowserOnWin8Beyond*",
"*\\chrome.dll!IsSandboxedProcess*",
"*BrowserSettings.dll!SetEdgeAsDefaultBrowserOnWin*"))
'''
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 = "T1217"
name = "Browser Information Discovery"
reference = "https://attack.mitre.org/techniques/T1217/"
[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: file
file where event.action == "open" and
process.executable != null and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and process.pid != 4 and
file.path :
("?:\\users\\*\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History",
"?:\\users\\*\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Bookmarks",
"?:\\users\\*\\appdata\\local\\microsoft\\edge\\user data\\default\\History",
"?:\\users\\*\\appdata\\local\\microsoft\\edge\\user data\\default\\Bookmarks",
"?:\\Users\\*\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*.default*\\places.sqlite",
"?:\\Users\\*\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*.default*\\formhistory.sqlite") and
process.thread.Ext.call_stack_summary : "?*" and
(
(process.code_signature.trusted == false and not process.code_signature.status : ("errorExpired", "errorCode_endpoint*")) or
process.code_signature.exists == false or
(process.code_signature.subject_name : "Microsoft*" and process.thread.Ext.call_stack_contains_unbacked == true and not process.name : "powershell.exe") or
process.executable :
("?:\\Users\\Public\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Windows\\Temp\\*",
"?:\\Windows\\Tasks\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Microsoft.NET\\*")
) and
not (process.code_signature.subject_name : ("Google LLC", "Mozilla Corporation", "BrowserWorks Ltd", "SAP SE", "Time Doctor LLC", "Emsisoft Ltd", "PIRIFORM SOFTWARE LIMITED") and
process.code_signature.trusted == true) and
not (process.code_signature.subject_name : "Shift Technologies Inc." and process.code_signature.status : "errorUntrustedRoot") and
not process.executable :
("?:\\Program Files (x86)\\*.exe",
"?:\\Program Files\\*.exe",
"?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\BitLockerDiscoveryVolumeContents\\BitLockerToGo.exe",
"?:\\Users\\*\\User Data\\Default\\mozilla_downloads.exe",
"?:\\Users\\*\\User Data\\Default\\chrome_downloads.exe",
"?:\\Users\\*\\User Data\\Default\\msedge_downloads.exe",
"?:\\Users\\*\\AppData\\Local\\Chromium\\Application\\chrome.exe",
"?:\\Users\\*\\AppData\\Local\\Thorium\\Application\\thorium.exe") and
not (process.executable : "C:\\Windows\\Temp\\RarSFX*\\scanstate.exe" and
process.thread.Ext.call_stack_summary == "ntdll.dll|sophosed.dll|apphelp.dll|kernelbase.dll|migcore.dll|migstore.dll|migcore.dll|scanstate.exe|kernel32.dll|ntdll.dll") and
not (process.executable : "C:\\Windows\\explorer.exe" and
process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|hostshellextension.dll|Unbacked") and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info : ("*\\chrome.dll!GetHandleVerifier*",
"*\\chrome.dll!ChromeMain*",
"*\\nw.dll!sqlite3_dbdata_init*",
"*\\nw.dll!GetHandleVerifier*",
"*\\BrowserSettings.dll!SetEdgeAsDefaultBrowserOnWin8Beyond*",
"*\\chrome.dll!IsSandboxedProcess*",
"*BrowserSettings.dll!SetEdgeAsDefaultBrowserOnWin*"))
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.status | eq | errorUntrustedRoot | excludes:process.code_signature.status field:"process.code_signature.status" value:"errorUntrustedRoot" |
process.code_signature.subject_name | eq | Shift Technologies Inc. | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Shift Technologies Inc." |
process.code_signature.subject_name | eq | Google LLC, Mozilla Corporation, BrowserWorks Ltd, SAP SE, Time Doctor LLC, Emsisoft Ltd, PIRIFORM SOFTWARE LIMITED | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | eq | C:\Windows\explorer.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\explorer.exe" |
process.thread.Ext.call_stack_summary | eq | ntdll.dll|kernelbase.dll|hostshellextension.dll|Unbacked | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|kernelbase.dll|hostshellextension.dll|Unbacked" |
process.executable | wildcard | C:\Windows\Temp\RarSFX*\scanstate.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\Temp\RarSFX*\scanstate.exe" |
process.thread.Ext.call_stack_summary | eq | ntdll.dll|sophosed.dll|apphelp.dll|kernelbase.dll|migcore.dll|migstore.dll|migcore.dll|scanstate.exe|kernel32.dll|ntdll.dll | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|sophosed.dll|apphelp.dll|kernelbase.dll|migcore.dll|migstore.dll|migcore.dll|scanstate.exe|kernel32.dll|ntdll.dll" |
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.executable | wildcard | ?:\Program Files (x86)\*.exe, ?:\Program Files\*.exe, ?:\Windows\System32\svchost.exe, ?:\Windows\BitLockerDiscoveryVolumeContents\BitLockerToGo.exe, ?:\Users\*\User Data\Default\mozilla_downloads.exe, ?:\Users\*\User Data\Default\chrome_downloads.exe, ?:\Users\*\User Data\Default\msedge_downloads.exe, ?:\Users\*\AppData\Local\Chromium\Application\chrome.exe, ?:\Users\*\AppData\Local\Thorium\Application\thorium.exe | excludes:process.executable |
user.id | in | 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" |
Potential Decoy Document via Open
#Detects when the native system binary 'open' is used to open a .doc or .pdf file in a temporary directory or via an unsigned or untrusted process. Decoy documents are often used to trick users into believing a file or executable is harmless and distract them from what the malware is doing behind the scenes.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when the native system binary 'open' is used to open a .doc or .pdf file in a temporary directory or via an
unsigned or untrusted process. Decoy documents are often used to trick users into believing a file or executable is
harmless and distract them from what the malware is doing behind the scenes.
"""
id = "3f2c51ce-5da8-4c9b-8a39-17677ed08eb9"
license = "Elastic License v2"
name = "Potential Decoy Document via Open"
os_list = ["macos"]
reference = [
"https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/4a57b3dd5d28ad1bd79e927e04b20fd4d66934a0/ocean_lotus",
]
version = "1.0.9"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "open" and
process.args_count < 3 and
process.args like~ ("/tmp/*.doc*", "/tmp/*.pdf*", "/private/tmp/*.doc*", "/private/tmp/*.pdf*", "/Users/Shared/*.doc*", "/Users/Shared/*.pdf*", "/Users/*/Library/*.pdf") and
not process.args like~ "/tmp/PKInstallSandbox*" and
not process.args == "-R" and
not process.Ext.effective_parent.executable in ("/usr/bin/open", "/Applications/Cursor.app/Contents/MacOS/Cursor")
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name == "open" and
process.args_count < 3 and
process.args like~ ("/tmp/*.doc*", "/tmp/*.pdf*", "/private/tmp/*.doc*", "/private/tmp/*.pdf*", "/Users/Shared/*.doc*", "/Users/Shared/*.pdf*", "/Users/*/Library/*.pdf") and
not process.args like~ "/tmp/PKInstallSandbox*" and
not process.args == "-R" and
not process.Ext.effective_parent.executable in ("/usr/bin/open", "/Applications/Cursor.app/Contents/MacOS/Cursor")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.args_count | lt |
| field:"process.args_count" kind:lt value:"3" |
process.name | eq |
| field:"process_basename" kind:eq value:"open" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | in | /Applications/Cursor.app/Contents/MacOS/Cursor, /usr/bin/open | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Applications/Cursor.app/Contents/MacOS/Cursor" field:"process.Ext.effective_parent.executable" value:"/usr/bin/open" |
process.args | eq | -R | excludes:process.args field:"process.args" value:"-R" |
process.args | starts_with | /tmp/PKInstallSandbox | excludes:process.args field:"process.args" value:"/tmp/PKInstallSandbox" |
Potential Evasion via dotNET Framework Installation Utility
#The Installer tool is a command-line utility that allows you to install and uninstall server resources by executing the installer components in specified assemblies. Adversaries may abuse this utility to run malicious code.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Command & Control |
Rule Body
[rule]
description = """
The Installer tool is a command-line utility that allows you to install and uninstall server resources by executing the
installer components in specified assemblies. Adversaries may abuse this utility to run malicious code.
"""
id = "7558b740-a23a-4c73-a060-12ed4e1ddc14"
license = "Elastic License v2"
name = "Potential Evasion via dotNET Framework Installation Utility"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/Binaries/Installutil/"]
version = "1.0.22"
query = '''
process where event.action == "start" and
(
((process.name : "installutil.exe" or process.pe.original_file_name == "InstallUtil.exe") and process.command_line : ("*/LogFile*", "*http*")) or
descendant of [process where event.action == "start" and
(process.name : "installutil.exe" or process.pe.original_file_name == "InstallUtil.exe") and process.command_line : "*/LogFile*"]
) and
not (process.executable : "?:\\Windows\\System32\\conhost.exe" and process.args : "0xffffffff" and process.args : "-ForceV1") and
not (process.name : "installutil.exe" and
process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "PFU.PaperStream.Capture.FiScannerEventService.exe", "PFU.PaperStream.Capture.ReleaseService.exe")) and
not (process.parent.name : "installutil.exe" and process.parent.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
not process.executable :
("?:\\Program Files\\*exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Windows\\System32\\wbem\\mofcomp.exe",
"?:\\Windows\\SysWOW64\\wbem\\mofcomp.exe",
"?:\\Windows\\system32\\conhost.exe",
"?:\\Windows\\SysWOW64\\conhost.exe",
"?:\\Windows\\Sys*\\net.exe",
"?:\\Windows\\Sys*\\net1.exe",
"?:\\Windows\\System32\\wbem\\mofcomp.exe") and
not process.parent.executable :
("?:\\Program Files*\\SolarWinds\\Orion\\ConfigurationWizard.exe",
"?:\\Program Files*\\Rescue and Smart Assistant\\InstallUtil64.exe",
"?:\\Program Files*\\Rescue and Smart Assistant\\*.exe",
"?:\\Windows\\System32\\msiexec.exe") and
not (process.executable : "?:\\Windows\\System32\\sc.exe" and process.args : "delete") and
not (process.args : "/LogFile=C:\\ProgramData\\Veeam\\Setup\\Temp\\Veeam.Backup.PowerShell.InstallLog" and process.parent.name : "msiexec.exe") and
not (process.name : "InstallUtil.exe" and process.args : ("C:\\Estensa\\Bin64Client\\SL.Server.Cache.WindowsService.exe", "\\SolarWinds TFTP Server.exe"))
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.004"
name = "InstallUtil"
reference = "https://attack.mitre.org/techniques/T1218/004/"
[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 = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
(
((process.name : "installutil.exe" or process.pe.original_file_name == "InstallUtil.exe") and process.command_line : ("*/LogFile*", "*http*")) or
descendant of [process where event.action == "start" and
(process.name : "installutil.exe" or process.pe.original_file_name == "InstallUtil.exe") and process.command_line : "*/LogFile*"]
) and
not (process.executable : "?:\\Windows\\System32\\conhost.exe" and process.args : "0xffffffff" and process.args : "-ForceV1") and
not (process.name : "installutil.exe" and
process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "PFU.PaperStream.Capture.FiScannerEventService.exe", "PFU.PaperStream.Capture.ReleaseService.exe")) and
not (process.parent.name : "installutil.exe" and process.parent.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
not process.executable :
("?:\\Program Files\\*exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Windows\\System32\\wbem\\mofcomp.exe",
"?:\\Windows\\SysWOW64\\wbem\\mofcomp.exe",
"?:\\Windows\\system32\\conhost.exe",
"?:\\Windows\\SysWOW64\\conhost.exe",
"?:\\Windows\\Sys*\\net.exe",
"?:\\Windows\\Sys*\\net1.exe",
"?:\\Windows\\System32\\wbem\\mofcomp.exe") and
not process.parent.executable :
("?:\\Program Files*\\SolarWinds\\Orion\\ConfigurationWizard.exe",
"?:\\Program Files*\\Rescue and Smart Assistant\\InstallUtil64.exe",
"?:\\Program Files*\\Rescue and Smart Assistant\\*.exe",
"?:\\Windows\\System32\\msiexec.exe") and
not (process.executable : "?:\\Windows\\System32\\sc.exe" and process.args : "delete") and
not (process.args : "/LogFile=C:\\ProgramData\\Veeam\\Setup\\Temp\\Veeam.Backup.PowerShell.InstallLog" and process.parent.name : "msiexec.exe") and
not (process.name : "InstallUtil.exe" and process.args : ("C:\\Estensa\\Bin64Client\\SL.Server.Cache.WindowsService.exe", "\\SolarWinds TFTP Server.exe"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"installutil.exe" |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"InstallUtil.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | -ForceV1 | excludes:process.args field:"process.args" value:"-ForceV1" |
process.args | eq | 0xffffffff | excludes:process.args field:"process.args" value:"0xffffffff" |
process.executable | eq | ?:\Windows\System32\conhost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\conhost.exe" |
process.args | eq | /LogFile=C:\ProgramData\Veeam\Setup\Temp\Veeam.Backup.PowerShell.InstallLog | excludes:process.args field:"process.args" value:"/LogFile=C:\ProgramData\Veeam\Setup\Temp\Veeam.Backup.PowerShell.InstallLog" |
process.parent.name | eq | msiexec.exe | excludes:process.parent.name field:"process.parent.name" value:"msiexec.exe" |
process.args | eq | C:\Estensa\Bin64Client\SL.Server.Cache.WindowsService.exe, \SolarWinds TFTP Server.exe | excludes:process.args field:"process.args" value:"C:\Estensa\Bin64Client\SL.Server.Cache.WindowsService.exe" field:"process.args" value:"\SolarWinds TFTP Server.exe" |
process.name | eq | InstallUtil.exe | excludes:process.name field:"process.name" value:"InstallUtil.exe" |
process.args | eq | delete | excludes:process.args field:"process.args" value:"delete" |
process.executable | eq | ?:\Windows\System32\sc.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\sc.exe" |
process.args | wildcard | ?:\Program Files\*, ?:\Program Files (x86)\*, PFU.PaperStream.Capture.FiScannerEventService.exe, PFU.PaperStream.Capture.ReleaseService.exe | excludes:process.args |
process.name | eq | installutil.exe | excludes:process.name field:"process.name" value:"installutil.exe" |
process.parent.args | starts_with | ?:\Program Files\, ?:\Program Files (x86)\ | excludes:process.parent.args field:"process.parent.args" value:"?:\Program Files\" field:"process.parent.args" value:"?:\Program Files (x86)\" |
process.parent.name | eq | installutil.exe | excludes:process.parent.name field:"process.parent.name" value:"installutil.exe" |
process.executable | wildcard | ?:\Program Files\*exe, ?:\Program Files (x86)\*.exe, ?:\Windows\System32\wbem\mofcomp.exe, ?:\Windows\SysWOW64\wbem\mofcomp.exe, ?:\Windows\system32\conhost.exe, ?:\Windows\SysWOW64\conhost.exe, ?:\Windows\Sys*\net.exe, ?:\Windows\Sys*\net1.exe, ?:\Windows\System32\wbem\mofcomp.exe | excludes:process.executable |
process.parent.executable | wildcard | ?:\Program Files*\SolarWinds\Orion\ConfigurationWizard.exe, ?:\Program Files*\Rescue and Smart Assistant\InstallUtil64.exe, ?:\Program Files*\Rescue and Smart Assistant\*.exe, ?:\Windows\System32\msiexec.exe | excludes:process.parent.executable |
Potential Kerberos Coercion via DNS-Based SPN Spoofing
#Identifies directory-service access or creation events involving a MicrosoftDNS record that contains a base64-encoded blob matching the pattern "UWhRCA...BAAAA". This blob pattern corresponds to a marshaled CREDENTIAL_TARGET_INFORMATION structure associated with DNS-based SPN spoofing used in Kerberos coercion tradecraft. Adversaries may abuse such records to coerce victim systems into authenticating to attacker-controlled hosts while requesting Kerberos tickets for legitimate services.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/06/14"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/04/24"
[rule]
author = ["Elastic"]
description = """
Identifies directory-service access or creation events involving a MicrosoftDNS record that contains a base64-encoded
blob matching the pattern "UWhRCA...BAAAA". This blob pattern corresponds to a marshaled CREDENTIAL_TARGET_INFORMATION
structure associated with DNS-based SPN spoofing used in Kerberos coercion tradecraft. Adversaries may abuse such
records to coerce victim systems into authenticating to attacker-controlled hosts while requesting Kerberos tickets for
legitimate services.
"""
from = "now-9m"
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "Potential Kerberos Coercion via DNS-Based SPN Spoofing"
references = [
"https://www.synacktiv.com/en/publications/ntlm-reflection-is-dead-long-live-ntlm-reflection-an-in-depth-analysis-of-cve-2025.html",
"https://blog.redteam-pentesting.de/2025/reflective-kerberos-relay-attack/",
"https://googleprojectzero.blogspot.com/2021/10/using-kerberos-for-authentication-relay.html",
"https://github.com/CICADA8-Research/RemoteKrbRelay/blob/main/README.md",
"https://github.com/Orange-Cyberdefense/ocd-mindmaps/blob/main/excalimap/mindmap/ad/authenticated.md",
]
risk_score = 73
rule_id = "f701be14-0a36-4e9a-a851-b3e20ae55f09"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Active Directory",
"Use Case: Active Directory Monitoring",
"Data Source: Windows Security Event Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
host.os.type:"windows" and
(
(event.code:4662 and winlog.event_data.AdditionalInfo: *UWhRC*BAAAA*MicrosoftDNS*) or
(event.code:5137 and winlog.event_data.ObjectDN: *UWhRC*BAAAA*MicrosoftDNS*)
)
'''
note = """## Triage and analysis
### Investigating Potential Kerberos Coercion via DNS-Based SPN Spoofing
#### Possible investigation steps
- Which ADIDNS record or access event matched the coercion blob?
- Focus: `event.code`, `winlog.event_data.AdditionalInfo`, `winlog.event_data.ObjectDN`, `winlog.event_data.DSName`, and `winlog.computer_name` to place the marshaled CREDENTIAL_TARGET_INFORMATION blob in its MicrosoftDNS partition.
- Implication: a namespace used by real clients makes the alert high priority; a lab-only namespace reduces urgency only when later telemetry stays bounded.
- Which account and logon session touched the record?
- Focus: `user.id`, `winlog.event_data.SubjectUserSid`, `winlog.event_data.SubjectUserName`, `winlog.event_data.SubjectDomainName`, and `winlog.event_data.SubjectLogonId`.
- Hint: match `winlog.event_data.SubjectLogonId` on the same domain controller to authentication events where `winlog.event_data.TargetLogonId` matches, then read `source.ip` and `winlog.logon.type`. $investigate_2 Missing authentication telemetry is unresolved, not benign.
- Implication: an actor, source, or logon type outside the DNS or directory-administration tier raises concern; a lab-scoped account, source, and session lowers suspicion only when the change set and authentication evidence also stay bounded.
- Did the same session make adjacent MicrosoftDNS changes that show setup or cleanup?
- Why: Kerberos coercion setups can create, alter, and remove DNS objects around the single blob-bearing event.
- Focus: start with surrounding directory-service events for the same `winlog.event_data.SubjectLogonId`, then narrow manually with `winlog.event_data.ObjectDN`, `winlog.event_data.ObjectGUID`, `winlog.event_data.OpCorrelationID`, and `winlog.event_data.AttributeLDAPDisplayName`.
- Hint: use `winlog.event_data.AttributeValue` to identify added record data or cleanup values when the source logged them, and expect to filter unrelated same-session directory activity manually. $investigate_3
- Implication: coordinated creation, modification, or deletion supports coercion preparation; one bounded change is less concerning only when it matches the same validation scope.
- Could the spoofed name coerce Kerberos from valuable systems or services?
- Focus: `winlog.event_data.ObjectDN`, `winlog.event_data.AdditionalInfo`, and `winlog.event_data.DSName` for the spoofed hostname and ADIDNS zone.
- Implication: names resembling real servers, management systems, service SPN targets, or broad discovery labels increase relay risk; names isolated from real consumers carry lower practical risk.
- Do Windows Security authentication events show the coercion progressed?
- Focus: after the directory-service event, review Windows Security logon or explicit-credential events with `event.code`, `winlog.event_data.TargetServerName`, `winlog.event_data.TargetInfo`, and `winlog.event_data.AuthenticationPackageName` tied to the spoofed hostname or expected target service.
- Hint: use `source.ip`, `winlog.event_data.TargetUserName`, and `winlog.computer_name` to identify victim systems and relay targets. Missing authentication telemetry is unresolved, not benign.
- Implication: escalate as progressed coercion when Kerberos or service access follows the record creation, especially from machine accounts or management systems; treat it as attempted-only when authentication evidence remains absent and the local record evidence is otherwise bounded.
- Is the suspicious pattern isolated to this actor and domain controller?
- Focus: related relay, directory-service, credential-access, or privilege-escalation alerts for `user.id`. $investigate_0
- Hint: compare alerts on the logging domain controller's `host.id` for the same behavior families. $investigate_1
- Implication: expand case scope when the same actor or controller has related suspicious alerts; keep scope local when no related alerts contradict the locally validated test scope.
- What disposition is supported?
- Focus: record scope, actor/session, MicrosoftDNS change set, authentication progression, and related-alert scope.
- Implication: escalate when a meaningful blob-bearing record, abnormal actor/session, adjacent MicrosoftDNS changes, or follow-on Kerberos/service activity supports coercion; close only when telemetry binds those categories to a lab or security-test workflow, with external validation required for any legitimacy claim telemetry cannot prove; preserve and escalate when evidence is mixed or incomplete.
### False positive analysis
- Authorized security testing or lab validation can create CredMarshalTargetInfo-style ADIDNS records. Confirm by verifying that `winlog.event_data.ObjectDN` is in the test namespace named by the validation record, `user.id` or `winlog.event_data.SubjectUserSid` matches the named operator, the MicrosoftDNS change set stays bounded, and Windows Security authentication events stay inside the stated victim and target scope. If validation records are unavailable and telemetry cannot prove that exact workflow, keep the alert unresolved instead of closing on recurrence alone.
- Build exceptions from the minimum confirmed pattern: stable `user.id` or `winlog.event_data.SubjectUserSid`, the specific zone path in `winlog.event_data.ObjectDN`, and the logging `host.id`. Avoid exceptions on event codes 4662 or 5137, all MicrosoftDNS changes, or the blob pattern alone.
### Response and remediation
- If confirmed benign, reverse any temporary containment and document the recognized operator, ADIDNS zone or record pattern, and lab-only authentication scope that confirmed the security-test workflow. Create an exception only after the same actor, zone pattern, and domain-controller scope recur.
- If suspicious but unconfirmed, preserve a case export of the raw Windows Security event, `winlog.event_data.ObjectDN`, `winlog.event_data.ObjectGUID`, `winlog.event_data.AdditionalInfo`, the actor/session evidence, the logging domain controller, and any follow-on authentication events before containment. Export the record and surrounding zone state, then use reversible containment such as tightening the affected zone's write access or temporarily removing the actor's ability to modify MicrosoftDNS objects while scope is clarified.
- If confirmed malicious, preserve the coercion record, surrounding MicrosoftDNS changes, and Windows Security authentication evidence tied to the spoofed name; contain the implicated account before destructive cleanup. Review the affected zone, replicating domain controllers, victim systems, and relay targets before removing the spoofing record and adjacent unauthorized DNS objects created by the same session.
- If Kerberos, LDAP, SMB, ADCS, or other service access followed the record, reset exposed account or machine secrets as appropriate and review for RBCD, certificate enrollment, Shadow Credentials, LAPS retrieval, password changes, group changes, service creation, or interactive SMB follow-on behavior.
- Harden by removing unnecessary ADIDNS write permissions, restricting authenticated-user access to MicrosoftDNS objects, and enforcing relay-resistant controls such as SMB signing, LDAP signing/channel binding, and EPA where applicable.
- Retain directory-service and authentication telemetry that supported the decision, and document the confirmed workflow or malicious artifact set for future analysts.
"""
setup = """## Setup
The following Windows audit policies must be enabled to generate the events used by this rule:
- [Audit Directory Service Access](https://ela.st/audit-directory-service-access)
- [Audit Directory Service Changes](https://ela.st/audit-directory-service-changes)
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"event.code",
"host.id",
"winlog.computer_name",
"winlog.event_data.SubjectUserName",
"winlog.event_data.SubjectUserSid",
"winlog.event_data.SubjectDomainName",
"winlog.event_data.SubjectLogonId",
"winlog.event_data.ObjectDN",
"winlog.event_data.ObjectGUID",
"winlog.event_data.AdditionalInfo",
"winlog.event_data.DSName",
"winlog.event_data.OpCorrelationID",
"winlog.event_data.AttributeLDAPDisplayName",
"winlog.event_data.AttributeValue",
]
[[transform.investigate]]
label = "Alerts associated with the creator"
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 domain controller"
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 = "Authentication events for the subject logon session"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4624", valueType = "string" },
{ excluded = false, field = "winlog.event_data.TargetLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4648", valueType = "string" },
{ excluded = false, field = "winlog.event_data.SubjectLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" }
]
]
relativeFrom = "now-24h"
relativeTo = "now"
[[transform.investigate]]
label = "MicrosoftDNS directory-service events for the same session"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4662", valueType = "string" },
{ excluded = false, field = "winlog.event_data.SubjectLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "5136", valueType = "string" },
{ excluded = false, field = "winlog.event_data.SubjectLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "5137", valueType = "string" },
{ excluded = false, field = "winlog.event_data.SubjectLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" }
]
]
relativeFrom = "now-24h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1557"
name = "Adversary-in-the-Middle"
reference = "https://attack.mitre.org/techniques/T1557/"
[[rule.threat.technique.subtechnique]]
id = "T1557.001"
name = "LLMNR/NBT-NS Poisoning and SMB Relay"
reference = "https://attack.mitre.org/techniques/T1557/001/"
[[rule.threat.technique]]
id = "T1187"
name = "Forced Authentication"
reference = "https://attack.mitre.org/techniques/T1187/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: query
host.os.type:"windows" and
(
(event.code:4662 and winlog.event_data.AdditionalInfo: *UWhRC*BAAAA*MicrosoftDNS*) or
(event.code:5137 and winlog.event_data.ObjectDN: *UWhRC*BAAAA*MicrosoftDNS*)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.code | eq |
| field:"EventID" kind:eq |
winlog.event_data.AdditionalInfo | wildcard |
| field:"AdditionalInfo" kind:wildcard value:"*UWhRC*BAAAA*MicrosoftDNS*" |
winlog.event_data.ObjectDN | wildcard |
| field:"ObjectDN" kind:wildcard value:"*UWhRC*BAAAA*MicrosoftDNS*" |
Potential Proxy Execution via Crash
#This rule detects the execution of a command or binary through the crash binary. Attackers may use this technique to execute commands while attempting to evade detection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
This rule detects the execution of a command or binary through the crash binary. Attackers may use this technique to
execute commands while attempting to evade detection.
"""
id = "995c8bdb-5ebb-4c5b-9a03-4d39b52c0ff3"
license = "Elastic License v2"
name = "Potential Proxy Execution via Crash"
os_list = ["linux"]
reference = ["https://gtfobins.github.io/gtfobins/crash/"]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name == "crash" and
process.parent.args == "-h" and process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c"
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.name == "crash" and
process.parent.args == "-h" and process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c"
Indicators
These rows show field, operator, and value matches.
Potential Upgrade of Non-interactive Shell
#Identifies when a non-interactive terminal (tty) is being upgraded to a fully interactive shell. Attackers may upgrade a simple reverse shell to a fully interactive tty after obtaining initial access to a host, in order to obtain a more stable connection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[metadata]
creation_date = "2023/09/20"
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2025/12/18"
[rule]
author = ["Elastic"]
description = """
Identifies when a non-interactive terminal (tty) is being upgraded to a fully interactive shell. Attackers may upgrade a
simple reverse shell to a fully interactive tty after obtaining initial access to a host, in order to obtain a more
stable connection.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Upgrade of Non-interactive 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 Potential Upgrade of Non-interactive Shell
In Linux environments, attackers often seek to enhance a basic reverse shell to a fully interactive shell to gain a more robust foothold. This involves using tools like `stty` or `script` to manipulate terminal settings, enabling features like command history and job control. The detection rule identifies such activities by monitoring specific process executions and arguments, flagging potential misuse indicative of an upgrade attempt.
### Possible investigation steps
- Review the process execution details to confirm the presence of `stty` or `script` commands with the specific arguments outlined in the detection rule, such as `stty raw -echo` or `script -qc /dev/null`.
- Examine the parent process of the flagged `stty` or `script` command to determine how the shell was initially spawned and identify any potentially malicious scripts or binaries.
- Check the user account associated with the process execution to assess if it aligns with expected user behavior or if it indicates potential compromise.
- Investigate the network connections associated with the host at the time of the alert to identify any suspicious remote connections that could be indicative of a reverse shell.
- Review historical process execution and login records for the user and host to identify any patterns of suspicious activity or previous attempts to establish a reverse shell.
### False positive analysis
- System administrators or legitimate users may use stty or script commands for routine maintenance or troubleshooting, which can trigger the rule. To manage this, create exceptions for known user accounts or specific maintenance windows.
- Automated scripts or cron jobs that utilize stty or script for legitimate purposes might be flagged. Review these scripts and whitelist them by process hash or command line pattern to prevent false positives.
- Development environments where developers frequently use stty or script for testing purposes can generate alerts. Consider excluding specific development machines or user groups from the rule to reduce noise.
- Monitoring tools or security solutions that simulate shell upgrades for testing or auditing purposes may inadvertently trigger the rule. Identify these tools and add them to an exception list based on their process name or execution path.
### Response and remediation
- Immediately isolate the affected host from the network to prevent further unauthorized access or lateral movement by the attacker.
- Terminate any suspicious processes identified by the detection rule, specifically those involving `stty` or `script` with the flagged arguments, to disrupt the attacker's attempt to upgrade the shell.
- Conduct a thorough review of the affected system's logs and process history to identify any additional malicious activities or compromised accounts.
- Reset credentials for any user accounts that were active during the time of the alert to prevent unauthorized access using potentially compromised credentials.
- Apply security patches and updates to the affected system to address any vulnerabilities that may have been exploited by the attacker.
- Enhance monitoring and logging on the affected host and similar systems to detect any future attempts to upgrade non-interactive shells or other suspicious activities.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems may be affected."""
risk_score = 47
rule_id = "84d1f8db-207f-45ab-a578-921d91c23eb2"
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: Execution",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"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") and
(
(process.name == "stty" and process.args == "raw" and process.args == "-echo" and process.args_count >= 3) or
(
process.name == "script" and process.args in ("-qc", "-c") and process.args == "/dev/null" and process.args_count == 4
)
) and
not process.parent.command_line like ("linode-longview", "*bootstrap*", "*homebrew*")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
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") and
(
(process.name == "stty" and process.args == "raw" and process.args == "-echo" and process.args_count >= 3) or
(
process.name == "script" and process.args in ("-qc", "-c") and process.args == "/dev/null" and process.args_count == 4
)
) and
not process.parent.command_line like ("linode-longview", "*bootstrap*", "*homebrew*")
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 |
process.args | in |
| field:"process.args" kind:in |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"4" |
process.args_count | ge |
| field:"process.args_count" kind:ge value:"3" |
process.name | eq |
| field:"process_basename" kind:eq |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.command_line | wildcard | linode-longview, *bootstrap*, *homebrew* | excludes:process.parent.command_line field:"process.parent.command_line" value:"linode-longview" field:"process.parent.command_line" value:"*bootstrap*" field:"process.parent.command_line" value:"*homebrew*" |
Privileged Docker Container Creation
#This rule leverages the new_terms rule type to identify the creation of a potentially unsafe docker container from an unusual parent process. Attackers can use the "--privileged" flag to create containers with escalated privileges, which can lead to trivial privilege escalation, docker escaping and persistence. access.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2024/07/10"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule leverages the new_terms rule type to identify the creation of a potentially unsafe docker container from an
unusual parent process. Attackers can use the "--privileged" flag to create containers with escalated privileges, which
can lead to trivial privilege escalation, docker escaping and persistence. access.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "kuery"
license = "Elastic License v2"
name = "Privileged Docker Container Creation"
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 Privileged Docker Container Creation
Docker containers are lightweight, portable units that package applications and their dependencies. The `--privileged` flag grants containers extensive host access, posing security risks. Adversaries exploit this to escalate privileges or escape containers. The detection rule identifies unusual privileged container creation by monitoring specific process actions and arguments, helping to flag potential threats early.
### Possible investigation steps
- Review the alert details to confirm the presence of the `--privileged` flag in the process arguments, as indicated by the query field `process.args:(run and --privileged)`.
- Identify the parent process of the Docker command by examining the `event.category:process` and `event.type:start` fields to determine if it originates from an unusual or unauthorized source.
- Check the user account associated with the Docker process to verify if it has legitimate access and permissions to create privileged containers.
- Investigate the timeline of events leading up to the container creation by reviewing related logs and events around the `event.action:exec` to identify any suspicious activities or patterns.
- Assess the container's configuration and running processes to determine if any unauthorized or potentially harmful applications are being executed within the container.
- Correlate the alert with other security events or alerts in the environment to identify potential indicators of compromise or broader attack patterns.
### False positive analysis
- Routine administrative tasks may trigger the rule if system administrators use the --privileged flag for legitimate container management. To handle this, identify and document these tasks, then create exceptions for known administrative processes.
- Automated deployment scripts that require elevated privileges might also cause false positives. Review these scripts and whitelist them by specifying the parent process or script name in the exclusion criteria.
- Development environments often use privileged containers for testing purposes. To reduce noise, exclude processes originating from known development machines or user accounts.
- Some monitoring or security tools may use privileged containers for legitimate purposes. Verify these tools and add them to the exception list to prevent unnecessary alerts.
- Regularly review and update the exclusion list to ensure it reflects current operational practices and does not inadvertently allow malicious activity.
### Response and remediation
- Immediately isolate the affected container to prevent further interaction with the host system. This can be done by stopping the container using `docker stop <container_id>`.
- Review and revoke any unnecessary permissions or access rights granted to the container. Ensure that the `--privileged` flag is not used unless absolutely necessary.
- Conduct a thorough investigation of the container's filesystem and running processes to identify any malicious activity or unauthorized changes. Use tools like `docker exec` to inspect the container's environment.
- Check for any signs of container escape or host compromise by reviewing system logs and monitoring for unusual activity on the host machine.
- If a compromise is confirmed, initiate a full incident response procedure, including forensic analysis and system restoration from clean backups.
- Update and patch the Docker daemon and any related software to the latest versions to mitigate known vulnerabilities that could be exploited.
- Enhance monitoring and alerting for privileged container creation by integrating additional security tools or services that provide real-time threat intelligence and anomaly detection."""
risk_score = 47
rule_id = "a80d96cd-1164-41b3-9852-ef58724be496"
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: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type:linux and event.category:process and event.type:start and
event.action:(exec or exec_event or start) and
process.name:docker and process.args:(run and --privileged)
'''
[[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 = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"
[[rule.threat.technique]]
id = "T1610"
name = "Deploy Container"
reference = "https://attack.mitre.org/techniques/T1610/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1611"
name = "Escape to Host"
reference = "https://attack.mitre.org/techniques/T1611/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.parent.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
host.os.type:linux and event.category:process and event.type:start and
event.action:(exec or exec_event or start) and
process.name:docker and process.args:(run and --privileged)
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.name | eq |
| field:"process_basename" kind:eq value:"docker" |
Script Interpreter Process Writing to Commonly Abused Persistence Locations
#Identifies a Windows script interpreter writing to two persistence locations (registry run keys and startup folder). Adversaries may use this technique to maintain multiple methods of persistence on an endpoint.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies a Windows script interpreter writing to two persistence locations (registry run keys and startup folder).
Adversaries may use this technique to maintain multiple methods of persistence on an endpoint.
"""
id = "be42f9fc-bdca-41cd-b125-f223d09eef69"
license = "Elastic License v2"
name = "Script Interpreter Process Writing to Commonly Abused Persistence Locations"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/previous-versions/technet-magazine/ee851671(v=msdn.10)"]
version = "1.0.36"
query = '''
sequence by process.entity_id with maxspan=5m
[process where event.action == "start" and
process.pe.original_file_name : ("cscript.exe", "wscript.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "java.exe") and
not (process.name : "powershell.exe" and process.parent.executable : "C:\\Windows\\ccmcache\\*.exe") and
not (process.name : "powershell.exe" and process.parent.name : "cmd.exe" and process.parent.args : ("?:\\Windows\\ccmcache\\*", "\\\\*")) and
not (process.name : "powershell.exe" and process.command_line : "*\\cc-agent-install\\*\\CommandCenterAgent.ps1*")
]
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)
]
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)
]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[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 = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
process.pe.original_file_name : ("cscript.exe", "wscript.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "java.exe") and
not (process.name : "powershell.exe" and process.parent.executable : "C:\\Windows\\ccmcache\\*.exe") and
not (process.name : "powershell.exe" and process.parent.name : "cmd.exe" and process.parent.args : ("?:\\Windows\\ccmcache\\*", "\\\\*")) and
not (process.name : "powershell.exe" and process.command_line : "*\\cc-agent-install\\*\\CommandCenterAgent.ps1*")
]
Stage 2: any
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)
]
Stage 3: any
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\*",
"*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event.category | wildcard |
| field:"event.category" kind:wildcard |
file.name | is_not_null | field:"file.name" kind:is_not_null | |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"?:\*\Microsoft\Windows\Start Menu\Programs\Startup\*" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard |
registry.data.strings | is_not_null | field:"Details" kind:is_not_null | |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | wildcard | *\cc-agent-install\*\CommandCenterAgent.ps1* | excludes:process.command_line field:"process.command_line" value:"*\cc-agent-install\*\CommandCenterAgent.ps1*" |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.parent.args | starts_with | ?:\Windows\ccmcache\, \\ | excludes:process.parent.args field:"process.parent.args" value:"?:\Windows\ccmcache\" field:"process.parent.args" value:"\\" |
process.parent.name | eq | cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"cmd.exe" |
process.parent.executable | wildcard | C:\Windows\ccmcache\*.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\ccmcache\*.exe" |
Service Command Lateral Movement
#Identifies use of sc.exe to create, modify, or start services on remote hosts. This could be indicative of adversary lateral movement but will be noisy if commonly done by admins.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/09/02"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies use of sc.exe to create, modify, or start services on remote hosts. This could be indicative of adversary
lateral movement but will be noisy if commonly done by admins.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process-*",
"logs-endpoint.events.network-*",
"winlogbeat-*",
"logs-windows.sysmon_operational-*",
]
language = "eql"
license = "Elastic License v2"
name = "Service Command Lateral Movement"
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 Service Command Lateral Movement
The Service Control Manager in Windows allows for the management of services, which are crucial for system operations. Adversaries exploit this by using `sc.exe` to manipulate services on remote systems, facilitating lateral movement. The detection rule identifies suspicious `sc.exe` usage by monitoring for service-related commands targeting remote hosts, which may indicate unauthorized access attempts. This rule helps differentiate between legitimate administrative actions and potential threats.
### Possible investigation steps
- Review the process details to confirm the use of sc.exe, focusing on the process.entity_id and process.args fields to understand the specific service-related actions attempted.
- Examine the network activity associated with the sc.exe process, particularly the destination.ip field, to identify the remote host targeted by the command and assess if it is a legitimate administrative target.
- Check the event logs on the remote host for any corresponding service creation, modification, or start events to verify if the actions were successfully executed and to gather additional context.
- Investigate the user account associated with the sc.exe process to determine if it has the necessary permissions for such actions and if the account usage aligns with expected behavior.
- Correlate the alert with other recent alerts or logs involving the same process.entity_id or destination.ip to identify any patterns or additional suspicious activities that may indicate a broader attack campaign.
### False positive analysis
- Routine administrative tasks using sc.exe on remote systems can trigger false positives. Identify and document regular maintenance schedules and responsible personnel to differentiate these from potential threats.
- Automated scripts or management tools that use sc.exe for legitimate service management may cause alerts. Review and whitelist these scripts or tools by their process entity IDs to reduce noise.
- Internal IT operations often involve creating or modifying services remotely. Establish a baseline of normal activity patterns and exclude these from alerts by setting exceptions for known IP addresses or user accounts.
- Software deployment processes that involve service configuration changes can be mistaken for lateral movement. Coordinate with software deployment teams to understand their processes and exclude these activities from detection.
- Regularly review and update the exclusion list to ensure it reflects current operational practices and does not inadvertently allow malicious activity.
### Response and remediation
- Isolate the affected system from the network to prevent further lateral movement and unauthorized access to other systems.
- Terminate any suspicious `sc.exe` processes identified on the affected system to halt any ongoing malicious activity.
- Review and reset credentials for any accounts that were used in the suspicious `sc.exe` activity to prevent unauthorized access.
- Conduct a thorough examination of the affected system for any additional signs of compromise, such as unauthorized services or changes to existing services.
- Restore the affected system from a known good backup if any malicious modifications or persistent threats are detected.
- Implement network segmentation to limit the ability of adversaries to move laterally across the network in the future.
- 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 = 21
rule_id = "d61cbcf8-1bc1-4cff-85ba-e7b21c5beedc"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by process.entity_id with maxspan = 1m
[process where host.os.type == "windows" and event.type == "start" and
(process.name : "sc.exe" or process.pe.original_file_name : "sc.exe") and
process.args : "\\\\*" and process.args : ("binPath=*", "binpath=*") and
process.args : ("create", "config", "failure", "start")]
[network where host.os.type == "windows" and process.name : "sc.exe" and destination.ip != "127.0.0.1"]
'''
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)
- [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.002"
name = "SMB/Windows Admin Shares"
reference = "https://attack.mitre.org/techniques/T1021/002/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[rule.threat.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1569"
name = "System Services"
reference = "https://attack.mitre.org/techniques/T1569/"
[[rule.threat.technique.subtechnique]]
id = "T1569.002"
name = "Service Execution"
reference = "https://attack.mitre.org/techniques/T1569/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where host.os.type == "windows" and event.type == "start" and
(process.name : "sc.exe" or process.pe.original_file_name : "sc.exe") and
process.args : "\\\\*" and process.args : ("binPath=*", "binpath=*") and
process.args : ("create", "config", "failure", "start")]
Stage 2: network
[network where host.os.type == "windows" and process.name : "sc.exe" and destination.ip != "127.0.0.1"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.ip | ne |
| field:"dest_ip" kind:ne value:"127.0.0.1" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"sc.exe" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard value:"sc.exe" |
Setcap setuid/setgid Capability Set
#This rule monitors for the addition of the cap_setuid+ep or cap_setgid+ep capabilities via setcap. Setuid (Set User ID) and setgid (Set Group ID) are Unix-like OS features that enable processes to run with elevated privileges, based on the file owner or group. Threat actors can exploit these attributes to achieve persistence by creating malicious binaries, allowing them to maintain control over a compromised system with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
This rule monitors for the addition of the cap_setuid+ep or cap_setgid+ep capabilities via setcap. Setuid (Set User ID)
and setgid (Set Group ID) are Unix-like OS features that enable processes to run with elevated privileges, based on the
file owner or group. Threat actors can exploit these attributes to achieve persistence by creating malicious binaries,
allowing them to maintain control over a compromised system with elevated permissions.
"""
id = "c1556f07-4184-42dc-a55c-866011a63715"
license = "Elastic License v2"
name = "Setcap setuid/setgid Capability Set"
os_list = ["linux"]
version = "1.0.2"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name == "setcap" and process.command_line like "*cap_set?id+ep*" and
not (
process.parent.name in ("jem", "vzctl") or
process.args like "/usr/bin/new?idmap" or
process.parent.executable like "/var/lib/dpkg/info/*.postinst" or
process.parent.args like "/var/lib/dpkg/info/*.postinst"
)
'''
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.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.name == "setcap" and process.command_line like "*cap_set?id+ep*" and
not (
process.parent.name in ("jem", "vzctl") or
process.args like "/usr/bin/new?idmap" or
process.parent.executable like "/var/lib/dpkg/info/*.postinst" or
process.parent.args like "/var/lib/dpkg/info/*.postinst"
)
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.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*cap_set?id+ep*" |
process.name | eq |
| field:"process_basename" kind:eq value:"setcap" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | /usr/bin/new?idmap | excludes:process.args field:"process.args" value:"/usr/bin/new?idmap" |
process.parent.args | wildcard | /var/lib/dpkg/info/*.postinst | excludes:process.parent.args field:"process.parent.args" value:"/var/lib/dpkg/info/*.postinst" |
process.parent.executable | wildcard | /var/lib/dpkg/info/*.postinst | excludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/dpkg/info/*.postinst" |
process.parent.name | in | jem, vzctl | excludes:process.parent.name field:"process.parent.name" value:"jem" field:"process.parent.name" value:"vzctl" |
Suspicious Command Execution via Web Server
#Identifies suspicious command executions via a web server, which may suggest a vulnerability and remote shell access. Attackers may exploit a vulnerability in a web application to execute commands via a web server, or place a backdoor file that can be abused to gain code execution as a mechanism for persistence.
Known False Positives
- Network monitoring or management products may have a web server component that runs shell commands as part of normal behavior.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Persistence |
Rule Body
[metadata]
creation_date = "2026/06/01"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/20"
[rule]
author = ["Elastic"]
description = """
Identifies suspicious command executions via a web server, which may suggest a vulnerability and remote shell access.
Attackers may exploit a vulnerability in a web application to execute commands via a web server, or place a backdoor
file that can be abused to gain code execution as a mechanism for persistence.
"""
false_positives = [
"""
Network monitoring or management products may have a web server component that runs shell commands as part of normal
behavior.
""",
]
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Command Execution via Web Server"
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 Command Execution via Web Server
This alert fires when a Linux web server launches a shell to run commands that look like exploitation activity, such as discovery, credential access, payload decoding, or reverse shell setup. That matters because web servers rarely need to spawn shell commands, so this behavior often signals command injection, a dropped web shell, or attacker persistence. A common pattern is an app exploit causing php-fpm or nginx to run `sh -c 'id; cat /etc/passwd; curl ... | bash'` from `/tmp`.
### Possible investigation steps
- Review the full process ancestry and execution context to determine what application component invoked the shell, which service account ran it, what working directory and environment it used, and whether the command aligns with any documented application behavior.
- Correlate the execution time with web server access, error, and application logs to identify the triggering request, including source IP, requested URI, parameters, headers, authenticated user or session, and any indications of command injection or direct web shell access.
- Inspect recently created or modified files in the web root and writable locations such as upload, cache, temp, and shared-memory directories for dropped scripts, encoded payloads, cron changes, SSH key additions, or other persistence artifacts tied to the command.
- Scope for follow-on activity by pivoting on the source IP, command fragments, spawned children, outbound connections, and similar executions on other web servers to determine whether exploitation was successful, repeated, or part of a broader campaign.
- If the activity is unauthorized or cannot be explained, isolate the host, preserve relevant volatile and disk evidence, rotate secrets accessible to the web service, and remediate the vulnerable application or remove any discovered web shell before restoring service.
### False positive analysis
- A legitimate web administration or diagnostics function may invoke `sh -c` to run commands such as `id`, `whoami`, `hostname`, or read OS metadata for status pages; verify the command matches documented application behavior and correlate it to an authorized request in web or application logs.
- A normal application workflow may use the web server to unpack user uploads or stage temporary content under `/tmp`, `/var/tmp`, or `/dev/shm` during import, conversion, or update operations; verify the execution aligns with a known user action or scheduled maintenance window and that the created files are expected temporary artifacts owned by the service account.
### Response and remediation
- Isolate the affected web server from the network or remove it from the load balancer immediately, preserve a forensic snapshot if possible, and block the attacker-controlled IPs, domains, and downloaded payload locations observed in the command chain.
- Hunt for and remove persistence by deleting web shells and dropped scripts in the document root, uploads, `/tmp`, `/var/tmp`, and `/dev/shm`, and by cleaning unauthorized cron entries, systemd services, startup scripts, SSH `authorized_keys`, and any attacker-created local accounts.
- Reset trust on the host by rotating application secrets, database passwords, API tokens, cloud credentials, and SSH keys that were present or reachable from the web server, and invalidate active sessions tied to the compromised application.
- Rebuild or reimage the server from a known-good source, patch the exploited web application or server component, restore only validated content and configurations, and verify no unauthorized binaries, modified packages, or backdoored application files remain before returning it to service.
- Escalate to incident response immediately if the shell command opened a reverse shell, downloaded or piped a payload into an interpreter, accessed sensitive files such as `/etc/shadow`, `.ssh`, or cloud credential stores, or if similar activity is found on additional hosts.
- Harden the environment by removing unnecessary shell execution from the application, disabling write and execute permissions in web-accessible upload and temp paths, enforcing least privilege for the web service account, enabling WAF or virtual patching for the exploited weakness, and increasing monitoring on web roots and startup locations.
"""
risk_score = 47
rule_id = "6148b9f5-5b12-4704-9ef7-f4b4c5dd9bb5"
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: Persistence",
"Tactic: Initial Access",
"Use Case: Vulnerability",
"Data Source: Elastic Defend",
"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.parent.name in (
"nginx", "apache2", "httpd", "caddy", "mongrel_rails", "uwsgi", "daphne", "httpd.worker", "flask",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "lswsctrl", "varnishd", "uvicorn", "waitress-serve", "starman",
"frankenphp", "zabbix_server", "asterisk", "sw-engine-fpm"
) or
process.parent.name like ("php-fpm*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi") or
(
process.parent.name like "ruby*" and
process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*")
) or
(
process.parent.name like "python*" and
process.parent.command_line like~ (
"*hypercorn*", "*flask*", "*uvicorn*", "*django*", "*app.py*", "*server.py*", "*wsgi.py*", "*asgi.py*"
)
) or
(process.parent.name like "perl*" and process.parent.command_line like~ "*plackup*") or
(
process.parent.name == "java" and (
process.parent.args like~ (
/* Tomcat */
"org.apache.catalina.startup.Bootstrap", "-Dcatalina.base=*",
/* Jetty */
"org.eclipse.jetty.start.Main", "-Djetty.home=*",
/* WildFly / JBoss */
"org.jboss.modules.Main", "-Djboss.home.dir=*",
/* WebLogic */
"weblogic.Server", "-Dweblogic.Name=*", "*weblogic-launcher.jar*",
/* WebSphere traditional + Liberty */
"com.ibm.ws.runtime.WsServer", "com.ibm.ws.kernel.boot.cmdline.Bootstrap",
/* GlassFish */
"com.sun.enterprise.glassfish.bootstrap.ASMain",
/* Resin */
"com.caucho.server.resin.Resin",
/* Spring Boot */
"org.springframework.boot.loader.*",
/* Quarkus */
"*quarkus-run.jar*", "io.quarkus.runner.GeneratedMain",
/* Micronaut */
"io.micronaut.runtime.Micronaut",
/* Dropwizard */
"io.dropwizard.cli.ServerCommand",
/* Play */
"play.core.server.ProdServerStart",
/* Helidon */
"io.helidon.microprofile.server.Main", "io.helidon.webserver*",
/* Vert.x */
"io.vertx.core.Launcher",
/* Keycloak */
"org.keycloak*",
/* Apereo CAS */
"org.apereo.cas*",
/* Elasticsearch */
"org.elasticsearch.bootstrap.Elasticsearch",
/* Atlassian / Gerrit */
"com.atlassian.jira.startup.Launcher", "*BitbucketServerLauncher*", "com.google.gerrit.pgm.Daemon",
/* Solr */
"*-Dsolr.solr.home=*",
/* Jenkins */
"*jenkins.war*"
) or
?process.working_directory like "/u0?/*"
)
)
) and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox") and
process.args in ("-c", "-cl", "-lc") and (
process.command_line like~ (
/* Suspicious Paths */
"* /tmp/* ", "* /var/tmp/* ", "* /dev/shm/*", "* /run/*", "* /var/run/*",
/* Encoding, Decoding & Piping */
"*|sh", "*| sh *", "*| sh ", "*|bash*", "*| bash*", "*|zsh*", "*| zsh*", "*|dash*", "*| dash*",
"*|python*", "*| python*", "*|php*", "*| php*", "*|perl*", "*| perl*", "*|ruby*", "*| ruby*",
"*|node*", "*| node*", "*|lua*", "*| lua*", "*|busybox*", "*| busybox*", "*|*base64 -d*", "*|*base64 --decode*",
"*|*base64 --decode*", "*|*openssl base64 -d*", "*xxd *", "*| openssl*enc * -d *", "*b64decode -r*",
/* Interpreter Execution */
"*python -c*", "*python3 -c*", "*php -r*", "*perl -e*", "*ruby -e*", "*lua -e*", "*node -e *",
/* Reverse Shells */
"*netcat *", "* nc *", "*ncat *", "*/dev/tcp*", "*/dev/udp/*", "*socat *", "*openssl*s_client *", "*stty*raw*-echo*",
"*mkfifo /tmp/*",
/* File Access */
"*>*/etc/cron*", "*crontab*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*/etc/shadow*",
"*/etc/passwd*", "*/etc/master.passwd*",
/* Enumeration & Discovery */
"*/etc/hosts*", "*/etc/resolv.conf*", "*/etc/hostname*", "*/etc/issue*", "*/etc/os-release*", "*lsb_release*",
"*/proc/*/environ*", "*sudo -l*", "*/proc/*/cgroup*", "*dockerenv*", "*/proc/*/mountinfo*", "*printenv*",
"*cat*.env *", "*getcap*", "*capsh*", "*find / *", "*netstat *",
/* AWS Credentials */
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*.aws/credentials*", "*/.aws/config*",
/* Azure Credentials */
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*", "*/.azure/*",
"*/run/secrets/azure/*",
/* GCP Credentials */
"*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*",
"*client_email*", "*private_key_id*", "*/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*",
/* Misc. Cloud */
"*/.docker/config.json*", "*/.npmrc*", "*/secrets/kubernetes.io/serviceaccount/*",
/* Helpers */
"*timeout *sh -c *", "*env *sh *-c*", "*exec -a*",
/* Miscellaneous */
"*chattr *", "*busybox *", "*#!*", "*chmod +x *", "*chmod 777*", "*chpasswd*",
"*<?php*?>*", "*kworker*",
/* Decompression */
"*gzip -*d *", "*bzip2 -*d *", "*xz -*d *", "*tar -*x*",
/* Path Traversal */
"*../../../*etc/*", "*/.../*", "*../../../*home/*/*", "*../../../*root/*",
/* File Upload/Download */
"*pastebin.com*", "*transfer.sh*", "*bashupload.com*",
/* Enumeration & Discovery */
"* id *", "* whoami *", "* hostname *"
) or
/* Keep this to not miss FNs due to spacing */
process.args in ("id", "whoami", "hostname")
) and
not (
(
process.parent.name == "nginx" and
process.args like ("chmod 777 /etc/resty-*", "resty*")
) or
(
process.parent.name == "apache2" and (
process.command_line in (
"sh -c /usr/local/bin/php -r 'echo phpversion();'", "sh -c -- /usr/local/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.args like (
"""bash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*""",
"chmod 777 /etc/cobra/uploads/mysql*", "stat*"
) or
process.command_line like (
"*/usr/bin/crontab*phpupdatecrontab.txt", "*mysqldump*/var/www/html/*/writable/uploads/backup/mysql*",
"sh -c chmod 777 -R /opt/data/www/php_upload/*/temp"
)
)
) or
(
process.parent.name like "php-fpm*" and (
process.command_line in (
"sh -c /usr/bin/php -r 'echo phpversion();'", "sh -c -- /usr/bin/php -r 'echo phpversion();'",
"sh -c php -r 'print_r(phpversion());'", "sh -c chattr -i -a /usr/local/virtualizor/license2.php",
"sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKE",
"sh -c php -r \"echo date('T');\"",
"sh -c php -r \"echo PHP_VERSION;\""
) or
process.command_line like (
"*var_export*extension_loaded*", "*/tmp/tmp_resize*", "*/v1/objects/hosts/*_Infoterminal*", "*python -m json.tool*",
"sh -c timeout 3600 ssh -o ControlMaster=auto -o ControlPath=/var/www/html/storage/app/ssh/mux/*"
) or
process.args like ("ps*|*grep*", "ffmpeg*")
)
) or
(
process.parent.name == "php-cgi" and (
process.command_line like (
"sh -c nohup php /home/*/public_html/lockindex.php index.php >/dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-content/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-includes/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/*/wp-content/* >> /dev/null 2>&1 &",
"*-ef|grep*"
) or
process.args like "ps*| grep*"
)
) or
(
process.command_line == "/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" and
process.parent.name == "gunicorn"
) or
(
process.parent.executable == "/usr/local/bin/gunicorn" and
process.command_line == "/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
) or
(
process.parent.executable == "/opt/bitnami/apache/bin/httpd" and
process.command_line == "sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm" and
process.command_line == "sh -c /usr/local/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi" and
process.command_line == "/bin/sh -c { touch /run/uwsgi-logrotate }"
) or
(process.parent.name like "python*" and process.parent.command_line like "*hive_server.py*") or
(process.parent.name == "sw-engine-fpm" and process.command_line like ("*/opt/psa/admin/bin/*", "*/usr/local/psa/admin/*")) or
(process.parent.name == "httpd" and process.command_line like ("*/datastore/htdocs/control-states/compass*", "*/dev/shm/netmon-log*")) or
(process.parent.name == "asterisk" and process.args like "/bin/chmod 777 */gravacoes/*.WAV") or
(process.parent.name == "nginx" and process.command_line like "sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_*") or
(process.parent.name == "varnishd" and process.args like "exec gcc*") or
(process.parent.name == "zabbix_server" and process.command_line like "*/usr/sbin/sendmail*") or
(process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and process.command_line like "*morpheus-local*") or
(
process.parent.name == "ruby" and
process.command_line in (
"sh -c echo \"^d\" | openssl s_client -connect 127.0.0.1:443 2>&1",
"sh -c cat /etc/hosts.allow 2>/dev/null"
)
) or
(process.parent.name == "java" and process.args like "chmod 777 *.csv") or
process.command_line == "sh -c node -v || nodejs -v" or
process.working_directory like ("/var/lib/puppet/rack/puppetmasterd", "/u01/app/*/sysman/emd")
)
'''
[[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/"
[[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.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
process.parent.name in (
"nginx", "apache2", "httpd", "caddy", "mongrel_rails", "uwsgi", "daphne", "httpd.worker", "flask",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "lswsctrl", "varnishd", "uvicorn", "waitress-serve", "starman",
"frankenphp", "zabbix_server", "asterisk", "sw-engine-fpm"
) or
process.parent.name like ("php-fpm*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi") or
(
process.parent.name like "ruby*" and
process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*")
) or
(
process.parent.name like "python*" and
process.parent.command_line like~ (
"*hypercorn*", "*flask*", "*uvicorn*", "*django*", "*app.py*", "*server.py*", "*wsgi.py*", "*asgi.py*"
)
) or
(process.parent.name like "perl*" and process.parent.command_line like~ "*plackup*") or
(
process.parent.name == "java" and (
process.parent.args like~ (
"org.apache.catalina.startup.Bootstrap", "-Dcatalina.base=*",
"org.eclipse.jetty.start.Main", "-Djetty.home=*",
"org.jboss.modules.Main", "-Djboss.home.dir=*",
"weblogic.Server", "-Dweblogic.Name=*", "*weblogic-launcher.jar*",
"com.ibm.ws.runtime.WsServer", "com.ibm.ws.kernel.boot.cmdline.Bootstrap",
"com.sun.enterprise.glassfish.bootstrap.ASMain",
"com.caucho.server.resin.Resin",
"org.springframework.boot.loader.*",
"*quarkus-run.jar*", "io.quarkus.runner.GeneratedMain",
"io.micronaut.runtime.Micronaut",
"io.dropwizard.cli.ServerCommand",
"play.core.server.ProdServerStart",
"io.helidon.microprofile.server.Main", "io.helidon.webserver*",
"io.vertx.core.Launcher",
"org.keycloak*",
"org.apereo.cas*",
"org.elasticsearch.bootstrap.Elasticsearch",
"com.atlassian.jira.startup.Launcher", "*BitbucketServerLauncher*", "com.google.gerrit.pgm.Daemon",
"*-Dsolr.solr.home=*",
"*jenkins.war*"
) or
?process.working_directory like "/u0?/*"
)
)
) and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox") and
process.args in ("-c", "-cl", "-lc") and (
process.command_line like~ (
"* /tmp/* ", "* /var/tmp/* ", "* /dev/shm/*", "* /run/*", "* /var/run/*",
"*|sh", "*| sh *", "*| sh ", "*|bash*", "*| bash*", "*|zsh*", "*| zsh*", "*|dash*", "*| dash*",
"*|python*", "*| python*", "*|php*", "*| php*", "*|perl*", "*| perl*", "*|ruby*", "*| ruby*",
"*|node*", "*| node*", "*|lua*", "*| lua*", "*|busybox*", "*| busybox*", "*|*base64 -d*", "*|*base64 --decode*",
"*|*base64 --decode*", "*|*openssl base64 -d*", "*xxd *", "*| openssl*enc * -d *", "*b64decode -r*",
"*python -c*", "*python3 -c*", "*php -r*", "*perl -e*", "*ruby -e*", "*lua -e*", "*node -e *",
"*netcat *", "* nc *", "*ncat *", "*/dev/tcp*", "*/dev/udp/*", "*socat *", "*openssl*s_client *", "*stty*raw*-echo*",
"*mkfifo /tmp/*",
"*>*/etc/cron*", "*crontab*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*/etc/shadow*",
"*/etc/passwd*", "*/etc/master.passwd*",
"*/etc/hosts*", "*/etc/resolv.conf*", "*/etc/hostname*", "*/etc/issue*", "*/etc/os-release*", "*lsb_release*",
"*/proc/*/environ*", "*sudo -l*", "*/proc/*/cgroup*", "*dockerenv*", "*/proc/*/mountinfo*", "*printenv*",
"*cat*.env *", "*getcap*", "*capsh*", "*find / *", "*netstat *",
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*.aws/credentials*", "*/.aws/config*",
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*", "*/.azure/*",
"*/run/secrets/azure/*",
"*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*",
"*client_email*", "*private_key_id*", "*/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*",
"*/.docker/config.json*", "*/.npmrc*", "*/secrets/kubernetes.io/serviceaccount/*",
"*timeout *sh -c *", "*env *sh *-c*", "*exec -a*",
"*chattr *", "*busybox *", "*#!*", "*chmod +x *", "*chmod 777*", "*chpasswd*",
"*<?php*?>*", "*kworker*",
"*gzip -*d *", "*bzip2 -*d *", "*xz -*d *", "*tar -*x*",
"*../../../*etc/*", "*/.../*", "*../../../*home/*/*", "*../../../*root/*",
"*pastebin.com*", "*transfer.sh*", "*bashupload.com*",
"* id *", "* whoami *", "* hostname *"
) or
process.args in ("id", "whoami", "hostname")
) and
not (
(
process.parent.name == "nginx" and
process.args like ("chmod 777 /etc/resty-*", "resty*")
) or
(
process.parent.name == "apache2" and (
process.command_line in (
"sh -c /usr/local/bin/php -r 'echo phpversion();'", "sh -c -- /usr/local/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.args like (
"""bash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*""",
"chmod 777 /etc/cobra/uploads/mysql*", "stat*"
) or
process.command_line like (
"*/usr/bin/crontab*phpupdatecrontab.txt", "*mysqldump*/var/www/html/*/writable/uploads/backup/mysql*",
"sh -c chmod 777 -R /opt/data/www/php_upload/*/temp"
)
)
) or
(
process.parent.name like "php-fpm*" and (
process.command_line in (
"sh -c /usr/bin/php -r 'echo phpversion();'", "sh -c -- /usr/bin/php -r 'echo phpversion();'",
"sh -c php -r 'print_r(phpversion());'", "sh -c chattr -i -a /usr/local/virtualizor/license2.php",
"sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKE",
"sh -c php -r \"echo date('T');\"",
"sh -c php -r \"echo PHP_VERSION;\""
) or
process.command_line like (
"*var_export*extension_loaded*", "*/tmp/tmp_resize*", "*/v1/objects/hosts/*_Infoterminal*", "*python -m json.tool*",
"sh -c timeout 3600 ssh -o ControlMaster=auto -o ControlPath=/var/www/html/storage/app/ssh/mux/*"
) or
process.args like ("ps*|*grep*", "ffmpeg*")
)
) or
(
process.parent.name == "php-cgi" and (
process.command_line like (
"sh -c nohup php /home/*/public_html/lockindex.php index.php >/dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-content/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-includes/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/*/wp-content/* >> /dev/null 2>&1 &",
"*-ef|grep*"
) or
process.args like "ps*| grep*"
)
) or
(
process.command_line == "/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" and
process.parent.name == "gunicorn"
) or
(
process.parent.executable == "/usr/local/bin/gunicorn" and
process.command_line == "/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
) or
(
process.parent.executable == "/opt/bitnami/apache/bin/httpd" and
process.command_line == "sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm" and
process.command_line == "sh -c /usr/local/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi" and
process.command_line == "/bin/sh -c { touch /run/uwsgi-logrotate }"
) or
(process.parent.name like "python*" and process.parent.command_line like "*hive_server.py*") or
(process.parent.name == "sw-engine-fpm" and process.command_line like ("*/opt/psa/admin/bin/*", "*/usr/local/psa/admin/*")) or
(process.parent.name == "httpd" and process.command_line like ("*/datastore/htdocs/control-states/compass*", "*/dev/shm/netmon-log*")) or
(process.parent.name == "asterisk" and process.args like "/bin/chmod 777 */gravacoes/*.WAV") or
(process.parent.name == "nginx" and process.command_line like "sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_*") or
(process.parent.name == "varnishd" and process.args like "exec gcc*") or
(process.parent.name == "zabbix_server" and process.command_line like "*/usr/sbin/sendmail*") or
(process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and process.command_line like "*morpheus-local*") or
(
process.parent.name == "ruby" and
process.command_line in (
"sh -c echo \"^d\" | openssl s_client -connect 127.0.0.1:443 2>&1",
"sh -c cat /etc/hosts.allow 2>/dev/null"
)
) or
(process.parent.name == "java" and process.args like "chmod 777 *.csv") or
process.command_line == "sh -c node -v || nodejs -v" or
process.working_directory like ("/var/lib/puppet/rack/puppetmasterd", "/u01/app/*/sysman/emd")
)
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 | in |
| field:"process.args" kind:in |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
process.parent.args | wildcard |
| field:"process.parent.args" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"java" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
process.working_directory | wildcard |
| field:"CurrentDirectory" kind:wildcard value:"/u0?/*" |
Exclusions
The rule actively suppresses these predicates.
Suspicious Execution from VS Code Extension
#Detects suspicious process execution launched from a VS Code extension context (parent command line contains .vscode/extensions). Malicious extensions can run on startup and drop or execute payloads (e.g. RATs like ScreenConnect, script interpreters, or download utilities). This covers both script/LOLBin children and recently created executables from non-Program Files paths, as seen in campaigns such as the fake Clawdbot extension that installed ScreenConnect RAT.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| 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/02/13"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Detects suspicious process execution launched from a VS Code extension context (parent command line contains
.vscode/extensions). Malicious extensions can run on startup and drop or execute payloads (e.g. RATs like
ScreenConnect, script interpreters, or download utilities). This covers both script/LOLBin children and
recently created executables from non-Program Files paths, as seen in campaigns such as the fake Clawdbot
extension that installed ScreenConnect RAT.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Execution from VS Code Extension"
note = """## Triage and analysis
### Investigating Suspicious Execution from VS Code Extension
Malicious VS Code extensions can use `activationEvents: ["onStartupFinished"]` to run as soon as the editor starts, then spawn scripts or download-and-execute payloads (e.g. weaponized ScreenConnect, batch/PowerShell downloaders). This rule flags process starts whose parent command line indicates execution from the extension host under `.vscode\\extensions\\` (or `/.vscode/extensions/`).
### Possible investigation steps
- Identify the extension: from the parent process command line, extract the path under `.vscode\\extensions\\` to get the extension id (e.g. `publisher.name-version`).
- Check whether that extension is approved; search the VS Code marketplace (or internal registry) for the same name and compare hashes.
- Inspect the child process: if it is cmd/powershell/curl/node/rundll32/etc., review command line and network/file activity; if it is a recently created executable (e.g. Code.exe, Lightshot), check path (e.g. %TEMP%\\Lightshot) and code signature.
- Correlate with network events (C2 domains, Dropbox/URL downloads) and with [Fake Clawdbot VS Code Extension](https://www.aikido.dev/blog/fake-clawdbot-vscode-extension-malware) IOCs if relevant.
### False positive analysis
- Legitimate extensions that run scripts or tools (e.g. linters, formatters, task runners) can spawn cmd, node, or PowerShell. Tune by excluding known extension ids or by requiring additional conditions (e.g. outbound to unknown IPs).
- Extension development: running/debugging an extension from a workspace will spawn processes from `.vscode\\extensions\\`; consider excluding dev machines or specific parent paths.
### Response and remediation
- Uninstall the suspicious extension and restart VS Code.
- If payload was executed: check for ScreenConnect (or similar) installation paths and services, remove persisted artifacts, block IOCs at firewall/DNS, rotate any API keys or secrets that may have been entered into the extension.
"""
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.aikido.dev/blog/fake-clawdbot-vscode-extension-malware",
"https://attack.mitre.org/techniques/T1204/",
"https://attack.mitre.org/techniques/T1195/002/",
]
risk_score = 47
rule_id = "c3d4e5f6-a7b8-6c9d-0e1f-2a3b4c5d6e7f"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.action == "start" and
process.parent.name : ("node.exe", "Code.exe") and
process.parent.command_line != null and
process.parent.command_line : ("*vscode*extensions*", "*extensionHost*") and
(
process.name : (
"cmd.exe", "powershell.exe", "pwsh.exe", "rundll32.exe", "msiexec.exe",
"curl.exe", "bitsadmin.exe", "wscript.exe", "cscript.exe", "mshta.exe",
"node.exe"
) or
// recently dropped PE
process.Ext.relative_file_creation_time <= 500
) and
not (process.name : "cmd.exe" and process.args : ("npm.cmd config get prefix", "code -v", "chcp")) and
not (process.name : "python.exe" and process.parent.command_line : "*ms-python.vscode-*")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "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.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[[rule.threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[rule.threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[[rule.threat.technique.subtechnique]]
id = "T1218.007"
name = "Msiexec"
reference = "https://attack.mitre.org/techniques/T1218/007/"
[[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.action == "start" and
process.parent.name : ("node.exe", "Code.exe") and
process.parent.command_line != null and
process.parent.command_line : ("*vscode*extensions*", "*extensionHost*") and
(
process.name : (
"cmd.exe", "powershell.exe", "pwsh.exe", "rundll32.exe", "msiexec.exe",
"curl.exe", "bitsadmin.exe", "wscript.exe", "cscript.exe", "mshta.exe",
"node.exe"
) or
process.Ext.relative_file_creation_time <= 500
) and
not (process.name : "cmd.exe" and process.args : ("npm.cmd config get prefix", "code -v", "chcp")) and
not (process.name : "python.exe" and process.parent.command_line : "*ms-python.vscode-*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.relative_file_creation_time | le |
| field:"process.Ext.relative_file_creation_time" kind:le value:"500" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.command_line | is_not_null | field:"ParentCommandLine" kind:is_not_null | |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | npm.cmd config get prefix, code -v, chcp | excludes:process.args field:"process.args" value:"npm.cmd config get prefix" field:"process.args" value:"code -v" field:"process.args" value:"chcp" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.name | eq | python.exe | excludes:process.name field:"process.name" value:"python.exe" |
process.parent.command_line | match | ms-python.vscode- | excludes:process.parent.command_line field:"process.parent.command_line" value:"ms-python.vscode-" |
Suspicious Microsoft Office Embedded Object
#Identifies suspicious file extensions written by a Microsoft Office process from an embedded OLE stream, this is frequently used by malicious documents to drop malicious content for initial access.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution |
Rule Body
[rule]
description = """
Identifies suspicious file extensions written by a Microsoft Office process from an embedded OLE stream, this is
frequently used by malicious documents to drop malicious content for initial access.
"""
id = "a3afbd2f-e9e6-41d9-ad24-aecb6a4b6906"
license = "Elastic License v2"
name = "Suspicious Microsoft Office Embedded Object"
os_list = ["windows"]
version = "1.0.9"
query = '''
file where event.action != "deletion" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*!OleSaveToStream*", "*!OleLoad*")) and
(
file.extension : ("exe", "dll", "js", "vbs", "vbe", "jse", "url", "chm", "bat", "mht", "hta", "search-ms") or
/* PE & HelpFile */
file.Ext.header_bytes : ("4d5a*", "49545346*")
)
'''
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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*!OleSaveToStream*", "*!OleLoad*")) and
(
file.extension : ("exe", "dll", "js", "vbs", "vbe", "jse", "url", "chm", "bat", "mht", "hta", "search-ms") or
file.Ext.header_bytes : ("4d5a*", "49545346*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
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 |
UAC Bypass Attempt via Consent DLL Search Order Hijacking
#Identifies attempts to bypass User Account Control (UAC) via DLL search order hijacking. Attackers may attempt to bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to bypass User Account Control (UAC) via DLL search order hijacking. Attackers may attempt to bypass
UAC to stealthily execute code with elevated permissions.
"""
id = "39827014-4836-498e-8b16-bf62f7aae4bf"
license = "Elastic License v2"
name = "UAC Bypass Attempt via Consent DLL Search Order Hijacking"
os_list = ["windows"]
reference = [
"https://github.com/hfiref0x/UACME",
"https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection",
]
version = "1.0.32"
query = '''
sequence with maxspan=60s
[file where event.action : "rename" and process.name : "dllhost.exe" and
file.path : ("?:\\*\\consent.exe.*\\*.dll", "?:\\*\\consent.exe.*\\*.dll")]
[process where event.action == "start" and
process.parent.name : "consent.exe" and process.Ext.token.integrity_level_name == "system" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\wermgr.exe",
"?:\\Windows\\SysWOW64\\wermgr.exe")]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1129"
name = "Shared Modules"
reference = "https://attack.mitre.org/techniques/T1129/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: file
[file where event.action : "rename" and process.name : "dllhost.exe" and
file.path : ("?:\\*\\consent.exe.*\\*.dll", "?:\\*\\consent.exe.*\\*.dll")]
Stage 2: process
[process where event.action == "start" and
process.parent.name : "consent.exe" and process.Ext.token.integrity_level_name == "system" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\wermgr.exe",
"?:\\Windows\\SysWOW64\\wermgr.exe")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"rename" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"?:\*\consent.exe.*\*.dll" |
process.Ext.token.integrity_level_name | eq |
| field:"process.Ext.token.integrity_level_name" kind:eq value:"system" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"dllhost.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"consent.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\wermgr.exe, ?:\Windows\SysWOW64\wermgr.exe | excludes:process.executable |
UAC Bypass via DiskCleanup Scheduled Task Hijack
#Identifies User Account Control (UAC) bypass attempts via hijacking the DiskCleanup scheduled task. Attackers bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies User Account Control (UAC) bypass attempts via hijacking the DiskCleanup scheduled task. Attackers bypass UAC
to stealthily execute code with elevated permissions.
"""
id = "d487049e-381d-44ad-9ec9-d23e88dbf573"
license = "Elastic License v2"
name = "UAC Bypass via DiskCleanup Scheduled Task Hijack"
os_list = ["windows"]
reference = ["https://www.tiraniddo.dev/2017/05/exploiting-environment-variables-in.html"]
version = "1.0.32"
query = '''
process where event.action == "start" and
process.Ext.token.integrity_level_name == "high" and process.hash.sha256 != null and
process.args : "/autoclean" and process.args : "/d" and
not process.executable : ("?:\\Windows\\System32\\cleanmgr.exe",
"?:\\Windows\\SysWOW64\\cleanmgr.exe",
"?:\\Windows\\System32\\taskhostw.exe",
/* Issue #359 */
"?:\\Windows\\System32\\taskhost.exe",
"?:\\Windows\\SysWOW64\\taskhost.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\cleanmgr.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhostw.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhost.exe")
'''
min_endpoint_version = "7.15.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 = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.Ext.token.integrity_level_name == "high" and process.hash.sha256 != null and
process.args : "/autoclean" and process.args : "/d" and
not process.executable : ("?:\\Windows\\System32\\cleanmgr.exe",
"?:\\Windows\\SysWOW64\\cleanmgr.exe",
"?:\\Windows\\System32\\taskhostw.exe",
"?:\\Windows\\System32\\taskhost.exe",
"?:\\Windows\\SysWOW64\\taskhost.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\cleanmgr.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhostw.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhost.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.token.integrity_level_name | eq |
| field:"process.Ext.token.integrity_level_name" kind:eq value:"high" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.hash.sha256 | is_not_null | field:"Hashes" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\Windows\System32\cleanmgr.exe, ?:\Windows\SysWOW64\cleanmgr.exe, ?:\Windows\System32\taskhostw.exe, ?:\Windows\System32\taskhost.exe, ?:\Windows\SysWOW64\taskhost.exe, \Device\HarddiskVolume*\Windows\Sys*\cleanmgr.exe, \Device\HarddiskVolume*\Windows\Sys*\taskhostw.exe, \Device\HarddiskVolume*\Windows\Sys*\taskhost.exe | excludes:process.executable |
Unusual Base64 Encoding/Decoding Activity
#This rule leverages ESQL to detect unusual base64 encoding/decoding activity on Linux systems. Attackers may use base64 encoding/decoding to obfuscate data, such as command and control traffic or payloads, to evade detection by host- or network-based security controls. ESQL rules have limited fields available in its alert documents. Make sure to review the original documents to aid in the investigation of this alert.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2025/02/21"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/02"
[rule]
author = ["Elastic"]
description = """
This rule leverages ESQL to detect unusual base64 encoding/decoding activity on Linux systems. Attackers may use base64
encoding/decoding to obfuscate data, such as command and control traffic or payloads, to evade detection by host- or
network-based security controls. ESQL rules have limited fields available in its alert documents. Make sure to review
the original documents to aid in the investigation of this alert.
"""
from = "now-61m"
interval = "1h"
language = "esql"
license = "Elastic License v2"
name = "Unusual Base64 Encoding/Decoding Activity"
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 Unusual Base64 Encoding/Decoding Activity
Base64 encoding is a method to convert binary data into ASCII text, often used for data transmission. Adversaries exploit this to obfuscate malicious payloads or commands, bypassing security controls. The detection rule identifies suspicious Base64 activity on Linux by monitoring specific processes and command patterns, flagging anomalies for further investigation.
### Possible investigation steps
- Review the process name and command line arguments to understand the context of the Base64 activity. Check if the process name matches known legitimate applications or scripts.
- Examine the timestamp of the event to determine if the activity occurred during normal operational hours or if it coincides with other suspicious activities.
- Investigate the host operating system type and agent ID to identify the specific Linux system involved and assess if it has a history of similar alerts or other security incidents.
- Analyze the process command line for any unusual patterns or parameters that might indicate obfuscation or malicious intent, such as the presence of decode flags or unexpected Base64 operations.
- Correlate the event with other logs or alerts from the same host or network to identify potential lateral movement or coordinated attacks.
- Check for any recent changes or deployments on the affected system that might explain the Base64 activity, such as new software installations or updates.
- Consult threat intelligence sources to determine if the observed Base64 patterns or command line arguments are associated with known malware or attack techniques.
### False positive analysis
- Routine administrative scripts may use base64 encoding for legitimate data processing tasks. Review the process.command_line and process.args fields to identify known scripts and consider excluding them from the rule.
- Backup or data transfer operations might employ base64 encoding to handle binary data. Verify the process.name and process.command_line to ensure these operations are recognized and add exceptions for these specific processes.
- Development environments often use base64 encoding for testing purposes. Identify development-related processes by examining the process.name and process.command_line and exclude them if they are part of regular development activities.
- Automated system monitoring tools might trigger this rule if they use base64 encoding for log or data analysis. Check the agent.id and process.command_line to confirm these tools and exclude them from the rule if they are verified as non-threatening.
- Security tools that perform data encoding for analysis or reporting could be flagged. Validate these tools by reviewing the process.name and process.command_line and create exceptions for them if they are part of the security infrastructure.
### Response and remediation
- Isolate the affected Linux system from the network to prevent further data exfiltration or lateral movement by the adversary.
- Terminate any suspicious processes identified by the alert, particularly those involving base64 encoding/decoding, to halt potential malicious activity.
- Conduct a thorough review of the process command lines and arguments flagged by the alert to identify any malicious scripts or payloads. Remove or quarantine these files as necessary.
- Check for any unauthorized user accounts or privilege escalations that may have been established during the attack and revoke access immediately.
- Restore any affected systems or files from a known good backup to ensure the integrity of the system and data.
- Implement additional monitoring on the affected system and similar environments to detect any recurrence of the suspicious base64 activity.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if broader organizational impacts exist.
"""
risk_score = 21
rule_id = "c5637438-e32d-4bb3-bc13-bd7932b3289f"
setup = """## Setup
This rule requires data coming in from one of the following integrations:
- Elastic Defend
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-endpoint.events.process-* metadata _id, _index, _version
| mv_expand event.action
| where
host.os.type == "linux" and
event.type == "start" and
event.action == "exec" and (
(
process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and
(process.args like "--d*" or process.args like "-d*")
) or
(
process.name == "openssl" and
process.args == "enc" and
process.args in ("-d", "-base64", "-a")
) or
(
process.name like "python*" and (
(
process.args == "base64" and
process.args in ("-d", "-u", "-t")
) or
(
process.args == "-c" and
process.command_line like "*base64*" and
process.command_line like "*b64decode*"
)
)
) or
(
process.name like "perl*" and
process.command_line like "*decode_base64*"
) or
(
process.name like "ruby*" and
process.args == "-e" and
process.command_line like "*Base64.decode64*"
)
)
| keep
@timestamp,
_id,
_index,
_version,
host.os.type,
event.type,
event.action,
process.name,
process.args,
process.command_line,
process.parent.name,
process.parent.command_line,
agent.id,
host.name,
data_stream.dataset,
data_stream.namespace
| stats
Esql.event_count = count(),
Esql.process_parent_name_values = values(process.parent.name),
Esql.process_parent_command_line_values = values(process.parent.command_line),
Esql.agent_id_count_distinct = count_distinct(agent.id),
Esql.host_name_values = values(host.name),
Esql.agent_id_values = values(agent.id),
Esql.data_stream_dataset_values = values(data_stream.dataset),
Esql.data_stream_namespace_values = values(data_stream.namespace)
by process.name, process.command_line
| where
Esql.agent_id_count_distinct == 1 and
Esql.event_count < 15
| sort Esql.event_count asc
// Extract unique values to ECS fields for alerts exclusion
| eval agent.id = mv_min(Esql.agent_id_values),
host.name = mv_min(Esql.host_name_values)
| keep agent.id, host.name, process.name, process.command_line, Esql.*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[rule.threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[rule.threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[rule.threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: from
from logs-endpoint.events.process-* metadata _id, _index, _version
Stage 2: mv_expand
| mv_expand event.action
Stage 3: where
| where
host.os.type == "linux" and
event.type == "start" and
event.action == "exec" and (
(
process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and
(process.args like "--d*" or process.args like "-d*")
) or
(
process.name == "openssl" and
process.args == "enc" and
process.args in ("-d", "-base64", "-a")
) or
(
process.name like "python*" and (
(
process.args == "base64" and
process.args in ("-d", "-u", "-t")
) or
(
process.args == "-c" and
process.command_line like "*base64*" and
process.command_line like "*b64decode*"
)
)
) or
(
process.name like "perl*" and
process.command_line like "*decode_base64*"
) or
(
process.name like "ruby*" and
process.args == "-e" and
process.command_line like "*Base64.decode64*"
)
)
Stage 4: keep
| keep
@timestamp,
_id,
_index,
_version,
host.os.type,
event.type,
event.action,
process.name,
process.args,
process.command_line,
process.parent.name,
process.parent.command_line,
agent.id,
host.name,
data_stream.dataset,
data_stream.namespace
Stage 5: stats
| stats
Esql.event_count = count(),
Esql.process_parent_name_values = values(process.parent.name),
Esql.process_parent_command_line_values = values(process.parent.command_line),
Esql.agent_id_count_distinct = count_distinct(agent.id),
Esql.host_name_values = values(host.name),
Esql.agent_id_values = values(agent.id),
Esql.data_stream_dataset_values = values(data_stream.dataset),
Esql.data_stream_namespace_values = values(data_stream.namespace)
by process.name, process.command_line
Stage 6: where
| where
Esql.agent_id_count_distinct == 1 and
Esql.event_count < 15
Stage 7: sort
| sort Esql.event_count asc
Stage 8: eval
| eval agent.id = mv_min(Esql.agent_id_values),
host.name = mv_min(Esql.host_name_values)
Stage 9: keep
| keep agent.id, host.name, process.name, process.command_line, Esql.*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.agent_id_count_distinct | eq |
| field:"Esql.agent_id_count_distinct" kind:eq value:"1" |
Esql.event_count | lt |
| field:"Esql.event_count" kind:lt value:"15" |
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.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"openssl" |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
agent.id | KEEP agent.id |
host.name | KEEP host.name |
process.name | KEEP process.name |
process.command_line | KEEP process.command_line |
Esql.* | KEEP Esql.* |