Detection rules › Elastic

Elastic rules: 0b

AWS EC2 Instance Profile Associated with Running Instance

#
Status
production
Severity
high
Time window
6m
Author
Elastic
Source
github.com/elastic/detection-rules

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

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

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.

FieldKindValuesSearch
event.actionin
  • AssociateIamInstanceProfile
  • ReplaceIamInstanceProfile
field:"EventType" kind:in
event.dataseteq
  • aws.cloudtrail corpus 14 (elastic 14)
field:"event.dataset" kind:eq value:"aws.cloudtrail"
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
event.providereq
  • ec2.amazonaws.com corpus 18 (elastic 18)
field:"Provider_Name" kind:eq value:"ec2.amazonaws.com"

Exclusions

The rule actively suppresses these predicates.

AWS IAM Permission Boundary or Guardrail Policy Deleted by Unusual Identity

#
Status
production
Severity
medium
Time window
6m
Group by
aws.cloudtrail.user_identity.arn
Author
Elastic
Source
github.com/elastic/detection-rules

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

TacticTechniques
Persistence
Defense Impairment

Telemetry Coverage

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.

FieldKindValuesSearch
aws.cloudtrail.request_parameterswildcard
  • *Boundary*
  • *Deny*
  • *Guard*
  • *Guardrail*
  • *Restrict*
  • *SCP*
  • *boundary*
  • *deny*
  • *guard*
  • *guardrail*
  • *restrict*
field:"aws::requestParameters" kind:wildcard
data_stream.dataseteq
  • aws.cloudtrail corpus 143 (elastic 143)
field:"data_stream.dataset" kind:eq value:"aws.cloudtrail"
event.actioneq
  • DeletePolicy
field:"EventType" kind:eq value:"DeletePolicy"
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
event.providereq
  • iam.amazonaws.com corpus 24 (elastic 24)
field:"Provider_Name" kind:eq value:"iam.amazonaws.com"

Exclusions

The rule actively suppresses these predicates.

AWS Potential Cryptomining via ECS Task Definition Deployment

#
Status
production
Severity
high
Time window
30m
Group by
aws.cloudtrail.user_identity.arn
Author
Elastic
Source
github.com/elastic/detection-rules

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

TacticTechniques
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 =
ifevent.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
else0
Esql.task_run =
ifevent.action IN ("RunTask", "StartTask", "CreateService")1
else0

Stage 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.

Output Fields

These fields are emitted when the rule matches.

FieldSource
aws.*KEEP aws.*
Esql.aws_cloudtrail_user_identity_type_valuesKEEP Esql.aws_cloudtrail_user_identity_type_values
Esql.miner_register_sumKEEP Esql.miner_register_sum
Esql.task_run_sumKEEP Esql.task_run_sum
Esql.event_countKEEP Esql.event_count
Esql.cloud_region_count_distinctKEEP Esql.cloud_region_count_distinct
Esql.cloud_region_valuesKEEP Esql.cloud_region_values
Esql.event_action_valuesKEEP Esql.event_action_values
Esql.source_ip_valuesKEEP Esql.source_ip_values
Esql.source_as_number_valuesKEEP Esql.source_as_number_values
Esql.user_agent_original_valuesKEEP Esql.user_agent_original_values
Esql.cloud_account_id_valuesKEEP Esql.cloud_account_id_values
Esql.timestamp_minKEEP Esql.timestamp_min
Esql.timestamp_maxKEEP Esql.timestamp_max

Encoded Powershell Execution via MsiExec

#
Source
github.com/elastic/protections-artifacts

Detects attempts to execute encoded powershell commands via Windows Installers.

MITRE ATT&CK Coverage

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.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.argswildcard
  • -e corpus 5 (elastic 5)
  • -ec corpus 3 (elastic 3)
  • -enc corpus 4 (elastic 4)
  • -encod
  • -encode
  • iex (gc *
field:"process.args" kind:wildcard
process.namewildcard
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
field:"process_basename" kind:wildcard value:"powershell.exe"
process.parent.namewildcard
  • msiexec.exe corpus 18 (elastic 14, splunk 3, kusto 1)
field:"parent_process_basename" kind:wildcard value:"msiexec.exe"
process.pe.original_file_nameeq
  • PowerShell.EXE corpus 7 (elastic 7)
field:"OriginalFileName" kind:eq value:"PowerShell.EXE"

Entra ID Protection Alerts for User Detected

#
Status
production
Severity
high
Time window
10m
Group by
azure.identityprotection.properties.user_principal_name
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

Kubernetes Pod Created With HostIPC

#
Status
production
Severity
medium
Author
Elastic
Source
github.com/elastic/detection-rules

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

TacticTechniques
Execution
Privilege Escalation

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

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.

Microsoft Office Loaded a Dropped Executable File

#
Time window
1m
Sequence by
dll.path, file.path, process.entity_id
Source
github.com/elastic/protections-artifacts

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

TacticTechniques
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.

FieldKindValuesSearch
dll.hash.sha256is_not_null
  • (no value, null check)
field:"Hashes" kind:is_not_null
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 4d5a* corpus 45 (elastic 45)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.extensionwildcard
  • cpl corpus 19 (elastic 19)
  • dll corpus 32 (elastic 32)
  • ocx corpus 6 (elastic 6)
field:"file.extension" kind:wildcard
process.namewildcard
  • EXCEL.EXE corpus 34 (elastic 34)
  • MSACCESS.EXE corpus 19 (elastic 19)
  • POWERPNT.EXE corpus 31 (elastic 31)
  • WINWORD.EXE corpus 35 (elastic 35)
field:"process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.subject_nameeqBloomberg L.P.excludes:dll.code_signature.subject_name field:"dll.code_signature.subject_name" value:"Bloomberg L.P."
dll.code_signature.trustedeqtrueexcludes:dll.code_signature.trusted field:"dll.code_signature.trusted" value:"true"
dll.pathwildcard?:\Users\*\appdata\local\assembly\*.dllexcludes:dll.path field:"dll.path" value:"?:\Users\*\appdata\local\assembly\*.dll"
dll.code_signature.statuswildcardtrusted, 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.sha256eq8f66789803adb34bdce7dd6686c6d53a0d1089ebf998ec3ab2b455da2828fd3c, 464266dd5656b82acaac189406983e1c9427be6578f6617360c613e5911c2b06, 2ce237db9ba8d32db3e1fb7301b407e66cf101cc8f37efa32e5e97d40032f75a, aa6fd3c1caf2a53d1fba496564dff15d89779bbdf8f132917eec30049adc9678, 077e534918a6d0ce90ad91b26168d6b838a854f3899ddf0720a38ca31d15102b, 26815ae316c6fdeb699b722ba9663089590a5aeaee1ec10375d21d814c5f3aec, e464f82e4a44064dc00e997b18fb55c22e0f39182dc22e150ef081cd13af01fe, b0680c48dd70da998844bb34fb4bb70d95cc7698ebb7443c36be0d393adc14d5, 3ab00c79bc361e4b10d79f7c9e1b9d4ab9935b5e5a622027700bc278b5eb622d, e0a51c0bf8b8563a91aba2b3a473e93c8e2febf6d2db1f0a3aeebd8dd3d8d054, 2153b80f5d1cb4bce4b01ec7801abb0b0858b644f21ad5f8cb4d7d83c7db151d, e8db34b27fbedd8d4022b9ee9071ca2651730fe1741569bad746dbdf129e562a, 0ac3251c8451349337c6b2b9763a95a47dfc5b883ba6f91eccd22b07c930c984, 57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7excludes:dll.hash.sha256
dll.pathwildcard?:\Windows\assembly\NativeImages_*.dllexcludes:dll.path field:"dll.path" value:"?:\Windows\assembly\NativeImages_*.dll"
dll.pe.imphasheqdae02f32a21e03ce65412f6e56942daaexcludes:dll.pe.imphash field:"dll.pe.imphash" value:"dae02f32a21e03ce65412f6e56942daa"

Network Connection Initiated by Suspicious SSHD Child Process

#
Status
production
Severity
medium
Time window
1s
Sequence by
host.id, process.entity_id, process.parent.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

FieldKindValuesSearch
event.actioneq
  • connection_attempted
  • exec
field:"EventType" kind:eq
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /home/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namewildcard
  • *.elf
  • *.lua*
  • *.php*
  • *.pl
  • *.py
  • *.rb
  • *.sh
  • .*
  • .js
  • cron
  • crond
  • nc
  • nc.openbsd
  • nc.traditional
  • ncat
  • netcat
  • ngrok
  • openssl
  • socat
  • systemd
  • telnet
field:"process_basename" kind:wildcard
process.parent.executableeq
  • /usr/sbin/sshd
field:"ParentImage" kind:eq value:"/usr/sbin/sshd"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linematchansible, BECOME-SUCCESSexcludes:process.command_line field:"process.command_line" value:"ansible" field:"process.command_line" value:"BECOME-SUCCESS"
destination.ipcidr_match10.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/16excludes:destination.ip
destination.ipeq0.0.0.0excludes:destination.ip field:"destination.ip" value:"0.0.0.0"
destination.ipis_null(no value, null check)excludes:destination.ip
process.executablein/bin/yum, /usr/bin/yumexcludes:process.executable field:"process.executable" value:"/bin/yum" field:"process.executable" value:"/usr/bin/yum"
process.nameinlogin_duo, sqlplus, ssh, sshd, sshd-sessionexcludes:process.name

Potential Browser Information Discovery

#
Source
github.com/elastic/protections-artifacts

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

TacticTechniques
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.

FieldKindValuesSearch
event.actioneq
  • open corpus 49 (elastic 49)
field:"EventType" kind:eq value:"open"
file.pathwildcard
  • ?:\Users\*\AppData\Roaming\Mozilla\Firefox\Profiles\*.default*\formhistory.sqlite
  • ?:\Users\*\AppData\Roaming\Mozilla\Firefox\Profiles\*.default*\places.sqlite
  • ?:\users\*\AppData\Local\Google\Chrome\User Data\Default\Bookmarks
  • ?:\users\*\AppData\Local\Google\Chrome\User Data\Default\History
  • ?:\users\*\appdata\local\microsoft\edge\user data\default\Bookmarks
  • ?:\users\*\appdata\local\microsoft\edge\user data\default\History
field:"TargetFilename" kind:wildcard
process.code_signature.existseq
  • false transforms: boolean corpus 118 (elastic 118)
field:"process.code_signature.exists" kind:eq value:"false"
process.code_signature.subject_namewildcard
  • Microsoft* corpus 19 (elastic 19)
field:"Signature" kind:wildcard value:"Microsoft*"
process.code_signature.trustedeq
  • false transforms: boolean corpus 114 (elastic 114)
field:"process.code_signature.trusted" kind:eq value:"false"
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
process.executablewildcard
  • ?:\ProgramData\* corpus 18 (elastic 18)
  • ?:\Users\*\Downloads\* corpus 12 (elastic 12)
  • ?:\Users\Public\* corpus 22 (elastic 22)
  • ?:\Windows\Microsoft.NET\* corpus 11 (elastic 11)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
  • ?:\Windows\Temp\* corpus 7 (elastic 7)
field:"Image" kind:wildcard
process.pidne
  • 4 transforms: number corpus 44 (elastic 44)
field:"process_id" kind:ne value:"4"
process.thread.Ext.call_stack_contains_unbackedeq
  • true transforms: boolean corpus 4 (elastic 4)
field:"process.thread.Ext.call_stack_contains_unbacked" kind:eq value:"true"
process.thread.Ext.call_stack_summarywildcard
  • ?* corpus 9 (elastic 9)
field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"?*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statuseqerrorUntrustedRootexcludes:process.code_signature.status field:"process.code_signature.status" value:"errorUntrustedRoot"
process.code_signature.subject_nameeqShift Technologies Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Shift Technologies Inc."
process.code_signature.subject_nameeqGoogle LLC, Mozilla Corporation, BrowserWorks Ltd, SAP SE, Time Doctor LLC, Emsisoft Ltd, PIRIFORM SOFTWARE LIMITEDexcludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executableeqC:\Windows\explorer.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\explorer.exe"
process.thread.Ext.call_stack_summaryeqntdll.dll|kernelbase.dll|hostshellextension.dll|Unbackedexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|kernelbase.dll|hostshellextension.dll|Unbacked"
process.executablewildcardC:\Windows\Temp\RarSFX*\scanstate.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\Temp\RarSFX*\scanstate.exe"
process.thread.Ext.call_stack_summaryeqntdll.dll|sophosed.dll|apphelp.dll|kernelbase.dll|migcore.dll|migstore.dll|migcore.dll|scanstate.exe|kernel32.dll|ntdll.dllexcludes: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_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
process.executablewildcard?:\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.exeexcludes:process.executable
user.idinS-1-5-18, S-1-5-19, S-1-5-20excludes: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

#
Source
github.com/elastic/protections-artifacts

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

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.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • /Users/*/Library/*.pdf
  • /Users/Shared/*.doc*
  • /Users/Shared/*.pdf*
  • /private/tmp/*.doc*
  • /private/tmp/*.pdf*
  • /tmp/*.doc*
  • /tmp/*.pdf*
field:"process.args" kind:wildcard
process.args_countlt
  • 3 transforms: number
field:"process.args_count" kind:lt value:"3"
process.nameeq
  • open corpus 5 (elastic 5)
field:"process_basename" kind:eq value:"open"

Exclusions

The rule actively suppresses these predicates.

Potential Evasion via dotNET Framework Installation Utility

#
Source
github.com/elastic/protections-artifacts

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

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.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • */LogFile*
  • *http* corpus 45 (sigma 34, elastic 10, splunk 1)
field:"CommandLine" kind:wildcard
process.namewildcard
  • installutil.exe corpus 36 (elastic 32, splunk 4)
field:"process_basename" kind:wildcard value:"installutil.exe"
process.pe.original_file_nameeq
  • InstallUtil.exe corpus 2 (elastic 2)
field:"OriginalFileName" kind:eq value:"InstallUtil.exe"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq-ForceV1excludes:process.args field:"process.args" value:"-ForceV1"
process.argseq0xffffffffexcludes:process.args field:"process.args" value:"0xffffffff"
process.executableeq?:\Windows\System32\conhost.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\conhost.exe"
process.argseq/LogFile=C:\ProgramData\Veeam\Setup\Temp\Veeam.Backup.PowerShell.InstallLogexcludes:process.args field:"process.args" value:"/LogFile=C:\ProgramData\Veeam\Setup\Temp\Veeam.Backup.PowerShell.InstallLog"
process.parent.nameeqmsiexec.exeexcludes:process.parent.name field:"process.parent.name" value:"msiexec.exe"
process.argseqC:\Estensa\Bin64Client\SL.Server.Cache.WindowsService.exe, \SolarWinds TFTP Server.exeexcludes:process.args field:"process.args" value:"C:\Estensa\Bin64Client\SL.Server.Cache.WindowsService.exe" field:"process.args" value:"\SolarWinds TFTP Server.exe"
process.nameeqInstallUtil.exeexcludes:process.name field:"process.name" value:"InstallUtil.exe"
process.argseqdeleteexcludes:process.args field:"process.args" value:"delete"
process.executableeq?:\Windows\System32\sc.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\sc.exe"
process.argswildcard?:\Program Files\*, ?:\Program Files (x86)\*, PFU.PaperStream.Capture.FiScannerEventService.exe, PFU.PaperStream.Capture.ReleaseService.exeexcludes:process.args
process.nameeqinstallutil.exeexcludes:process.name field:"process.name" value:"installutil.exe"
process.parent.argsstarts_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.nameeqinstallutil.exeexcludes:process.parent.name field:"process.parent.name" value:"installutil.exe"
process.executablewildcard?:\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.exeexcludes:process.executable
process.parent.executablewildcard?:\Program Files*\SolarWinds\Orion\ConfigurationWizard.exe, ?:\Program Files*\Rescue and Smart Assistant\InstallUtil64.exe, ?:\Program Files*\Rescue and Smart Assistant\*.exe, ?:\Windows\System32\msiexec.exeexcludes:process.parent.executable

Potential Kerberos Coercion via DNS-Based SPN Spoofing

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

FieldKindValuesSearch
event.codeeq
  • 4662 corpus 8 (splunk 7, elastic 1)
  • 5137 corpus 6 (splunk 5, elastic 1)
field:"EventID" kind:eq
winlog.event_data.AdditionalInfowildcard
  • *UWhRC*BAAAA*MicrosoftDNS*
field:"AdditionalInfo" kind:wildcard value:"*UWhRC*BAAAA*MicrosoftDNS*"
winlog.event_data.ObjectDNwildcard
  • *UWhRC*BAAAA*MicrosoftDNS*
field:"ObjectDN" kind:wildcard value:"*UWhRC*BAAAA*MicrosoftDNS*"

Potential Proxy Execution via Crash

#
Source
github.com/elastic/protections-artifacts

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

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

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

Exclusions

The rule actively suppresses these predicates.

Privileged Docker Container Creation

#
Status
production
Severity
medium
Time window
9m
Group by
process.parent.executable
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

Script Interpreter Process Writing to Commonly Abused Persistence Locations

#
Time window
5m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

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.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
event.categorywildcard
  • file corpus 29 (elastic 29)
  • registry corpus 8 (elastic 8)
field:"event.category" kind:wildcard
file.nameis_not_null
  • (no value, null check)
field:"file.name" kind:is_not_null
file.pathwildcard
  • ?:\*\Microsoft\Windows\Start Menu\Programs\Startup\* corpus 9 (elastic 9)
field:"TargetFilename" kind:wildcard value:"?:\*\Microsoft\Windows\Start Menu\Programs\Startup\*"
process.pe.original_file_namewildcard
  • cscript.exe corpus 32 (sigma 17, elastic 15)
  • java.exe
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
  • powershell.exe corpus 134 (sigma 86, splunk 30, elastic 18)
  • pwsh.exe corpus 7 (elastic 7)
  • wscript.exe corpus 37 (elastic 20, sigma 17)
field:"OriginalFileName" kind:wildcard
registry.data.stringsis_not_null
  • (no value, null check)
field:"Details" kind:is_not_null
registry.pathwildcard
  • *\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 3 (elastic 3)
  • *\Software\Microsoft\Windows\CurrentVersion\RunOnceEx\* corpus 2 (elastic 2)
  • *\Software\Microsoft\Windows\CurrentVersion\RunOnce\* corpus 2 (elastic 2)
  • *\Software\Microsoft\Windows\CurrentVersion\Run\* corpus 3 (elastic 3)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 3 (elastic 3)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce\* corpus 2 (elastic 2)
  • *\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run\* corpus 3 (elastic 3)
field:"TargetObject" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Service Command Lateral Movement

#
Status
production
Severity
low
Time window
1m
Sequence by
process.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

FieldKindValuesSearch
destination.ipne
  • 127.0.0.1 corpus 7 (elastic 7)
field:"dest_ip" kind:ne value:"127.0.0.1"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • \\* corpus 4 (elastic 4)
  • binPath=*
  • binpath=*
  • config corpus 3 (elastic 3)
  • create corpus 5 (elastic 5)
  • failure
  • start corpus 7 (elastic 7)
field:"process.args" kind:wildcard
process.namewildcard
  • sc.exe corpus 32 (elastic 17, splunk 15)
field:"process_basename" kind:wildcard value:"sc.exe"
process.pe.original_file_namewildcard
  • sc.exe corpus 28 (sigma 12, splunk 10, elastic 6)
field:"OriginalFileName" kind:wildcard value:"sc.exe"

Setcap setuid/setgid Capability Set

#
Source
github.com/elastic/protections-artifacts

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

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.

Exclusions

The rule actively suppresses these predicates.

Suspicious Command Execution via Web Server

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

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

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.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argsin
  • -c
  • -cl
  • -lc
  • hostname
  • id
  • whoami
field:"process.args" kind:in
process.command_linewildcard
  • * /dev/shm/*
  • * /run/*
  • * /tmp/*
  • * /var/run/*
  • * /var/tmp/*
  • * hostname *
  • * id *
  • * nc *
  • * whoami *
  • *#!*
  • *../../../*etc/*
  • *../../../*home/*/*
  • *../../../*root/*
  • *.aws/credentials*
  • */.../*
  • */.aws/config*
  • */.azure/*
  • */.config/gcloud/*
  • */.docker/config.json*
  • */.npmrc*
  • */dev/tcp*
  • */dev/udp/*
  • */etc/hostname*
  • */etc/hosts*
  • */etc/issue*
  • */etc/master.passwd*
  • */etc/os-release*
  • */etc/passwd*
  • */etc/resolv.conf*
  • */etc/shadow*
  • */etc/ssh*
  • */home/*/.ssh/*
  • */proc/*/cgroup*
  • */proc/*/environ*
  • */proc/*/mountinfo*
  • */root/.ssh*
  • */run/secrets/azure/*
  • */run/secrets/google/*
  • */secrets/kubernetes.io/serviceaccount/*
  • *<?php*?>*
  • +88 more values (see full rule source)
field:"CommandLine" kind:wildcard
process.namein
  • bash
  • busybox
  • csh
  • dash
  • fish
  • ksh
  • mksh
  • sh
  • tcsh
  • zsh
field:"process_basename" kind:in
process.parent.argswildcard
  • *-Dsolr.solr.home=*
  • *BitbucketServerLauncher*
  • *jenkins.war*
  • *quarkus-run.jar*
  • *weblogic-launcher.jar*
  • -Dcatalina.base=*
  • -Djboss.home.dir=*
  • -Djetty.home=*
  • -Dweblogic.Name=*
  • com.atlassian.jira.startup.Launcher
  • com.caucho.server.resin.Resin
  • com.google.gerrit.pgm.Daemon
  • com.ibm.ws.kernel.boot.cmdline.Bootstrap
  • com.ibm.ws.runtime.WsServer
  • com.sun.enterprise.glassfish.bootstrap.ASMain
  • io.dropwizard.cli.ServerCommand
  • io.helidon.microprofile.server.Main
  • io.helidon.webserver*
  • io.micronaut.runtime.Micronaut
  • io.quarkus.runner.GeneratedMain
  • io.vertx.core.Launcher
  • org.apache.catalina.startup.Bootstrap
  • org.apereo.cas*
  • org.eclipse.jetty.start.Main
  • org.elasticsearch.bootstrap.Elasticsearch
  • org.jboss.modules.Main
  • org.keycloak*
  • org.springframework.boot.loader.*
  • play.core.server.ProdServerStart
  • weblogic.Server
field:"process.parent.args" kind:wildcard
process.parent.command_linewildcard
  • *app.py*
  • *asgi.py*
  • *django*
  • *flask*
  • *hypercorn*
  • *passenger*
  • *plackup*
  • *puma*
  • *rails*
  • *server.py*
  • *uvicorn*
  • *wsgi.py*
field:"ParentCommandLine" kind:wildcard
process.parent.nameeq
  • java
field:"parent_process_basename" kind:eq value:"java"
process.parent.namein
  • apache2
  • asterisk
  • caddy
  • daphne
  • flask
  • frankenphp
  • httpd
  • httpd.worker
  • lswsctrl
  • mongrel_rails
  • nginx
  • php-cgi
  • php-cgi.cagefs
  • php-fcgi
  • starman
  • sw-engine-fpm
  • uvicorn
  • uwsgi
  • varnishd
  • waitress-serve
  • zabbix_server
field:"parent_process_basename" kind:in
process.parent.namewildcard
  • *.cgi
  • *.fcgi
  • gunicorn*
  • lsphp*
  • perl*
  • php-fpm*
  • python*
  • ruby*
field:"parent_process_basename" kind:wildcard
process.working_directorywildcard
  • /u0?/*
field:"CurrentDirectory" kind:wildcard value:"/u0?/*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argswildcardbash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*, chmod 777 /etc/cobra/uploads/mysql*, stat*excludes:process.args
process.command_lineinsh -c -- /usr/local/bin/php -r 'echo phpversion();', sh -c /usr/bin/lsb_release -a 2>/dev/null, sh -c /usr/bin/php -r 'echo phpversion();', sh -c /usr/local/bin/php -r 'echo phpversion();'excludes:process.command_line
process.command_linewildcard*/usr/bin/crontab*phpupdatecrontab.txt, *mysqldump*/var/www/html/*/writable/uploads/backup/mysql*, sh -c chmod 777 -R /opt/data/www/php_upload/*/tempexcludes:process.command_line field:"process.command_line" value:"*/usr/bin/crontab*phpupdatecrontab.txt" field:"process.command_line" value:"*mysqldump*/var/www/html/*/writable/uploads/backup/mysql*" field:"process.command_line" value:"sh -c chmod 777 -R /opt/data/www/php_upload/*/temp"
process.parent.nameeqapache2excludes:process.parent.name field:"process.parent.name" value:"apache2"
process.argswildcardps*| grep*excludes:process.args field:"process.args" value:"ps*| grep*"
process.command_linewildcardsh -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*excludes:process.command_line
process.parent.nameeqphp-cgiexcludes:process.parent.name field:"process.parent.name" value:"php-cgi"
process.argswildcardps*|*grep*, ffmpeg*excludes:process.args field:"process.args" value:"ps*|*grep*" field:"process.args" value:"ffmpeg*"
process.command_lineinsh -c -- /usr/bin/php -r 'echo phpversion();', sh -c /usr/bin/php -r 'echo phpversion();', sh -c chattr -i -a /usr/local/virtualizor/license2.php, sh -c php -r "echo PHP_VERSION;", sh -c php -r "echo date('T');", sh -c php -r 'print_r(phpversion());', sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKEexcludes:process.command_line
process.command_linewildcard*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/*excludes:process.command_line
process.parent.namestarts_withphp-fpmexcludes:process.parent.name field:"process.parent.name" value:"php-fpm"
process.argsstarts_withchmod 777 /etc/resty-, restyexcludes:process.args field:"process.args" value:"chmod 777 /etc/resty-" field:"process.args" value:"resty"
process.parent.nameeqnginxexcludes:process.parent.name field:"process.parent.name" value:"nginx"
process.argsstarts_withexec gccexcludes:process.args field:"process.args" value:"exec gcc"
process.parent.nameeqvarnishdexcludes:process.parent.name field:"process.parent.name" value:"varnishd"
process.argswildcard/bin/chmod 777 */gravacoes/*.WAVexcludes:process.args field:"process.args" value:"/bin/chmod 777 */gravacoes/*.WAV"
process.parent.nameeqasteriskexcludes:process.parent.name field:"process.parent.name" value:"asterisk"
process.argswildcardchmod 777 *.csvexcludes:process.args field:"process.args" value:"chmod 777 *.csv"
process.parent.nameeqjavaexcludes:process.parent.name field:"process.parent.name" value:"java"
process.command_lineeq/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddateexcludes:process.command_line field:"process.command_line" value:"/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
process.parent.executableeq/usr/local/bin/gunicornexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/local/bin/gunicorn"
process.command_lineeq/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddateexcludes:process.command_line field:"process.command_line" value:"/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
process.parent.nameeqgunicornexcludes:process.parent.name field:"process.parent.name" value:"gunicorn"
process.command_lineeq/bin/sh -c { touch /run/uwsgi-logrotate }excludes:process.command_line field:"process.command_line" value:"/bin/sh -c { touch /run/uwsgi-logrotate }"
process.parent.executablewildcard/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgiexcludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi"
process.command_lineeqsh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'excludes:process.command_line field:"process.command_line" value:"sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'"
process.parent.executableeq/opt/bitnami/apache/bin/httpdexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/bitnami/apache/bin/httpd"
process.command_lineeqsh -c /usr/local/bin/php -r 'echo phpversion();'excludes:process.command_line field:"process.command_line" value:"sh -c /usr/local/bin/php -r 'echo phpversion();'"
process.parent.executablewildcard/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpmexcludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm"
process.command_lineinsh -c cat /etc/hosts.allow 2>/dev/null, sh -c echo "^d" | openssl s_client -connect 127.0.0.1:443 2>&1excludes:process.command_line
process.parent.nameeqrubyexcludes:process.parent.name field:"process.parent.name" value:"ruby"
process.command_linematch/datastore/htdocs/control-states/compass, /dev/shm/netmon-logexcludes:process.command_line field:"process.command_line" value:"/datastore/htdocs/control-states/compass" field:"process.command_line" value:"/dev/shm/netmon-log"
process.parent.nameeqhttpdexcludes:process.parent.name field:"process.parent.name" value:"httpd"
process.command_linematch/opt/psa/admin/bin/, /usr/local/psa/admin/excludes:process.command_line field:"process.command_line" value:"/opt/psa/admin/bin/" field:"process.command_line" value:"/usr/local/psa/admin/"
process.parent.nameeqsw-engine-fpmexcludes:process.parent.name field:"process.parent.name" value:"sw-engine-fpm"
process.command_linematch/usr/sbin/sendmailexcludes:process.command_line field:"process.command_line" value:"/usr/sbin/sendmail"
process.parent.nameeqzabbix_serverexcludes:process.parent.name field:"process.parent.name" value:"zabbix_server"
process.command_linematchmorpheus-localexcludes:process.command_line field:"process.command_line" value:"morpheus-local"
process.parent.executableeq/opt/morpheus/embedded/java/jre/bin/javaexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/morpheus/embedded/java/jre/bin/java"
process.command_linestarts_withsh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_excludes:process.command_line field:"process.command_line" value:"sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_"
process.parent.command_linematchhive_server.pyexcludes:process.parent.command_line field:"process.parent.command_line" value:"hive_server.py"
process.parent.namestarts_withpythonexcludes:process.parent.name field:"process.parent.name" value:"python"
process.command_lineeqsh -c node -v || nodejs -vexcludes:process.command_line field:"process.command_line" value:"sh -c node -v || nodejs -v"
process.working_directorywildcard/var/lib/puppet/rack/puppetmasterd, /u01/app/*/sysman/emdexcludes:process.working_directory field:"process.working_directory" value:"/var/lib/puppet/rack/puppetmasterd" field:"process.working_directory" value:"/u01/app/*/sysman/emd"

Suspicious Execution from VS Code Extension

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

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

Telemetry Coverage

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.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 28 (elastic 28)
field:"process.Ext.relative_file_creation_time" kind:le value:"500"
process.namewildcard
  • bitsadmin.exe corpus 25 (elastic 22, splunk 2, kusto 1)
  • cmd.exe corpus 122 (elastic 93, splunk 29)
  • cscript.exe corpus 68 (elastic 66, splunk 2)
  • curl.exe corpus 34 (elastic 32, splunk 2)
  • mshta.exe corpus 84 (elastic 80, splunk 4)
  • msiexec.exe corpus 45 (elastic 40, splunk 5)
  • node.exe corpus 6 (elastic 6)
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
  • pwsh.exe corpus 78 (elastic 49, splunk 29)
  • rundll32.exe corpus 123 (elastic 100, splunk 23)
  • wscript.exe corpus 84 (elastic 82, splunk 1, kusto 1)
field:"process_basename" kind:wildcard
process.parent.command_lineis_not_null
  • (no value, null check)
field:"ParentCommandLine" kind:is_not_null
process.parent.command_linewildcard
  • *extensionHost*
  • *vscode*extensions*
field:"ParentCommandLine" kind:wildcard
process.parent.namewildcard
  • Code.exe
  • node.exe corpus 4 (elastic 3, splunk 1)
field:"parent_process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Suspicious Microsoft Office Embedded Object

#
Source
github.com/elastic/protections-artifacts

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

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.

FieldKindValuesSearch
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 49545346*
  • 4d5a* corpus 45 (elastic 45)
field:"file.Ext.header_bytes" kind:wildcard
file.extensionwildcard
  • bat corpus 13 (elastic 13)
  • chm
  • dll corpus 32 (elastic 32)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • js corpus 22 (elastic 22)
  • jse corpus 18 (elastic 18)
  • mht
  • search-ms corpus 2 (elastic 2)
  • url corpus 3 (elastic 3)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
field:"file.extension" kind:wildcard
process.namewildcard
  • excel.exe corpus 34 (elastic 34)
  • powerpnt.exe corpus 31 (elastic 31)
  • winword.exe corpus 35 (elastic 35)
field:"process_basename" kind:wildcard

UAC Bypass Attempt via Consent DLL Search Order Hijacking

#

UAC Bypass via DiskCleanup Scheduled Task Hijack

#
Source
github.com/elastic/protections-artifacts

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

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.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.Ext.token.integrity_level_nameeq
  • high corpus 19 (elastic 19)
field:"process.Ext.token.integrity_level_name" kind:eq value:"high"
process.argswildcard
  • /autoclean corpus 2 (elastic 2)
  • /d corpus 2 (elastic 2)
field:"process.args" kind:wildcard
process.hash.sha256is_not_null
  • (no value, null check)
field:"Hashes" kind:is_not_null

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablewildcard?:\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.exeexcludes:process.executable

Unusual Base64 Encoding/Decoding Activity

#
Status
production
Severity
low
Time window
61m
Group by
process.command_line, process.name
Author
Elastic
Source
github.com/elastic/detection-rules

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.

Output Fields

These fields are emitted when the rule matches.

FieldSource
agent.idKEEP agent.id
host.nameKEEP host.name
process.nameKEEP process.name
process.command_lineKEEP process.command_line
Esql.*KEEP Esql.*

Back to all Elastic rules