Detection rules › Elastic

Elastic rules: 02

Active Directory Discovery using AdExplorer

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

This rule detects the use of ADExplorer utility. Active Directory Explorer (AD Explorer) is an advanced Active Directory (AD) viewer and editor. AD Explorer also includes the ability to save snapshots of an AD database for off-line viewing and comparisons. Adversaries may abuse this utility to perform domain reconnaissance.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2025/09/01"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"

[rule]
author = ["Elastic"]
description = """
This rule detects the use of ADExplorer utility. Active Directory Explorer (AD Explorer) is an advanced Active Directory (AD)
viewer and editor. AD Explorer also includes the ability to save snapshots of an AD database for off-line viewing and comparisons.
Adversaries may abuse this utility to perform domain reconnaissance.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process-*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-system.security*",
    "logs-windows.forwarded*",
    "logs-windows.sysmon_operational-*",
    "winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Active Directory Discovery using AdExplorer"
note = """## Triage and analysis

### Investigating Active Directory Discovery using AdExplorer

Active Directory Explorer (AD Explorer) is an advanced Active Directory (AD) viewer and editor. AD Explorer also includes the ability to save snapshots of an AD database for off-line viewing and comparisons.

#### Possible investigation steps

- Identify the user account that performed the action and whether it should perform this kind of action.
- Verify any file creation, this may indicate the creation of an AD snapshot.
- Identify when the AdExplorer binary was dropped and by what process reviewing file creation events.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.

### False positive analysis

- This rule has a high chance to produce false positives as it is a legitimate tool used by system administrators.
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and process path conditions.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

setup = """## Setup

This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.

Setup instructions: https://ela.st/install-elastic-defend

### Additional data sources

This rule also supports the following third-party data sources. For setup instructions, refer to the links below:

- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""

references = ["https://learn.microsoft.com/en-us/sysinternals/downloads/adexplorer"]
risk_score = 21
rule_id = "ff46eb26-0684-4da3-9dd6-21032c9878e1"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
    "Resources: Investigation Guide",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Windows Security Event Logs",
    "Data Source: Microsoft Defender XDR",
    "Data Source: Sysmon",
    "Data Source: SentinelOne",
    "Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and
  (process.name : "ADExplorer*.exe" or ?process.pe.original_file_name == "AdExp")
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"

[[rule.threat.technique]]
id = "T1018"
name = "Remote System Discovery"
reference = "https://attack.mitre.org/techniques/T1018/"

[[rule.threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"
[[rule.threat.technique.subtechnique]]
id = "T1069.002"
name = "Domain Groups"
reference = "https://attack.mitre.org/techniques/T1069/002/"


[[rule.threat.technique]]
id = "T1087"
name = "Account Discovery"
reference = "https://attack.mitre.org/techniques/T1087/"
[[rule.threat.technique.subtechnique]]
id = "T1087.002"
name = "Domain Account"
reference = "https://attack.mitre.org/techniques/T1087/002/"


[[rule.threat.technique]]
id = "T1482"
name = "Domain Trust Discovery"
reference = "https://attack.mitre.org/techniques/T1482/"


[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

Stages and Predicates

Stage 1: process

process where host.os.type == "windows" and event.type == "start" and
  (process.name : "ADExplorer*.exe" or ?process.pe.original_file_name == "AdExp")

Indicators

These rows show field, operator, and value matches.

AWS SNS Topic Message Publish by Rare User

#
Status
production
Severity
high
Time window
6m
Group by
aws.cloudtrail.resources.arn, cloud.account.id, user.name
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies when an SNS topic message is published by a rare user in AWS. Adversaries may publish messages to SNS topics for phishing campaigns, data exfiltration, or lateral movement within the AWS environment. SNS topics are used to send notifications and messages to subscribed endpoints such as applications, mobile devices or email addresses, making them a valuable target for adversaries to distribute malicious content or exfiltrate sensitive data. This is a New Terms rule that only flags when this behavior is observed for the first time by a user or role.

Known False Positives

  • New users or roles may legitimately publish messages to SNS topics for authorized purposes. Ensure that the action is authorized before taking action.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2025/01/07"
integration = ["aws"]
maturity = "production"
updated_date = "2026/07/08"

[rule]
author = ["Elastic"]
description = """
Identifies when an SNS topic message is published by a rare user in AWS. Adversaries may publish messages to SNS topics
for phishing campaigns, data exfiltration, or lateral movement within the AWS environment. SNS topics are used to send
notifications and messages to subscribed endpoints such as applications, mobile devices or email addresses, making them a
valuable target for adversaries to distribute malicious content or exfiltrate sensitive data. This is a New Terms rule that only flags
when this behavior is observed for the first time by a user or role.
"""
false_positives = [
    """
    New users or roles may legitimately publish messages to SNS topics for authorized purposes. Ensure that the action
    is authorized before taking action.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS SNS Topic Message Publish by Rare User"
note = """## Triage and Analysis

### Investigating AWS SNS Topic Message Publish by Rare User

This rule identifies when a message is published to an SNS topic by a user who has rarely or never published messages before. This activity could indicate adversarial actions, such as using SNS topics for phishing campaigns, data exfiltration, or lateral movement within an AWS environment.

This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags when this behavior is observed for the first time by a user or role.

#### Possible Investigation Steps

- **Identify the Actor and Resource**:
  - **User Identity and Role**: Examine the `aws.cloudtrail.user_identity.arn` to identify the user or role responsible for publishing the SNS message. Verify whether this actor is authorized to publish messages to SNS topics.
  - **Access Key Details**: Review the `aws.cloudtrail.user_identity.access_key_id` to determine the access key used.
  - **SNS Topic ARN**: Analyze `aws.cloudtrail.resources.arn` to confirm whether the SNS topic is critical, sensitive, or used for authorized purposes.

- **Evaluate the Context of the SNS Message**:
  - **Published Message Details**: AWS redacts the message content in CloudTrail logs, but you can view the message ID, subject, and other metadata. Investigate the message details for any indicators of malicious content.
  - **Message Recipients**: Investigate the subscriptions associated with the SNS topic to identify if messages were sent to unauthorized or unexpected recipients.

- **Analyze Source Information**:
  - **Source IP Address**: Examine the `source.ip` field to identify the origin of the activity. Unusual IP addresses or geolocations may indicate unauthorized access.
  - **User Agent**: Review `user_agent.original` to determine the tool or client used for publishing the SNS message. Automated tools or unexpected clients (e.g., `Boto3` from an unknown host) may signify misuse.

- **Review Historical Activity**:
  - **Actor’s Past Behavior**: Identify whether the user has published messages to SNS topics before. Review similar past events for context.
  - **Frequency and Patterns**: Examine the time and frequency of messages published by the same user or to the same SNS topic to detect anomalies.

- **Correlate with Other Events**:
  - **IAM or CloudTrail Events**: Look for events such as `AssumeRole`, `CreateAccessKey`, or other API actions associated with the same user ARN.
  - **Unusual IAM Role Activity**: Determine if the actor has assumed roles or performed administrative tasks atypical for their role.

### False Positive Analysis

- **Routine Operational Use**:
  - Confirm if the publishing activity aligns with standard operational tasks or automation scripts.
  - Validate whether new or rare users were recently granted permissions for publishing messages to SNS topics.

- **Testing or Monitoring Scripts**:
  - Automated testing or monitoring tools may trigger this rule if configured to publish messages to SNS topics.

### Response and Remediation

- **Immediate Action**:
  - If unauthorized activity is confirmed, disable the access key or IAM role associated with the user.
  - Restrict or remove permissions from the SNS topic to prevent further misuse.

- **Review Policies and Subscriptions**:
  - Audit the IAM policies tied to the user and SNS topic to ensure appropriate permissions.
  - Validate the subscriptions of the SNS topic to confirm all endpoints are authorized.

- **Enhance Monitoring and Alerting**:
  - Set up additional logging or alerting for SNS publish actions, especially from rare or unknown users.
  - Monitor for similar actions across other SNS topics within the environment.

- **Conduct a Root Cause Analysis**:
  - Investigate how the user or role gained access to publish messages to the SNS topic.
  - Determine if other AWS resources or services have been affected.

### Additional Information

For more information on SNS topic management and securing AWS resources, refer to:
- [AWS SNS Publish API Documentation](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html)
- [AWS CloudTrail Documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference.html)
"""
references = [
    "https://docs.aws.amazon.com/sns/latest/api/API_Publish.html",
    "https://hackingthe.cloud/aws/exploitation/Misconfigured_Resource-Based_Policies/exploting_public_resources_attack_playbook/",
    "https://permiso.io/blog/s/smishing-attack-on-aws-sms-new-phone-who-dis/",
    "https://www.sentinelone.com/labs/sns-sender-active-campaigns-unleash-messaging-spam-through-the-cloud/",
]
risk_score = 73
rule_id = "2112ecce-cd34-11ef-873f-f661ea17fbcd"
setup = "AWS SNS topic data event types need to be enabled in the CloudTrail trail configuration to capture the Publish action. Ensure that the AWS CloudTrail service is [configured](https://docs.aws.amazon.com/sns/latest/dg/logging-using-cloudtrail.html#cloudtrail-data-events) to log data events for SNS."
severity = "high"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS SNS",
    "Use Case: Threat Detection",
    "Resources: Investigation Guide",
    "Tactic: Lateral Movement",
    "Tactic: Exfiltration",
    "Tactic: Impact",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset:"aws.cloudtrail"
    and event.provider:"sns.amazonaws.com"
    and event.action:"Publish"
    and event.outcome:"success"
'''

[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 = "T1534"
name = "Internal Spearphishing"
reference = "https://attack.mitre.org/techniques/T1534/"

[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 = "T1567"
name = "Exfiltration Over Web Service"
reference = "https://attack.mitre.org/techniques/T1567/"

[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1496"
name = "Resource Hijacking"
reference = "https://attack.mitre.org/techniques/T1496/"

[[rule.threat.technique.subtechnique]]
id = "T1496.004"
name = "Cloud Service Hijacking"
reference = "https://attack.mitre.org/techniques/T1496/004/"

[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1102"
name = "Web Service"
reference = "https://attack.mitre.org/techniques/T1102/"

[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[rule.new_terms]
field = "new_terms_fields"
value = ["cloud.account.id", "user.name", "aws.cloudtrail.resources.arn"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-10d"


Stages and Predicates

Stage 1: new_terms

data_stream.dataset:"aws.cloudtrail"
    and event.provider:"sns.amazonaws.com"
    and event.action:"Publish"
    and event.outcome:"success"

Indicators

These rows show field, operator, and value matches.

AWS STS Role Chaining

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

Identifies role chaining activity. Role chaining is when you use one assumed role to assume a second role through the AWS CLI or API. While this a recognized functionality in AWS, role chaining can be abused for privilege escalation if the subsequent assumed role provides additional privileges. Role chaining can also be used as a persistence mechanism as each AssumeRole action results in a refreshed session token with a 1 hour maximum duration. This is a new terms rule that looks for the first occurance of one role (aws.cloudtrail.user_identity.session_context.session_issuer.arn) assuming another (aws.cloudtrail.resources.arn).

Known False Positives

  • Role chaining can be used as an access control. Ensure that this behavior is not part of a legitimate operation before taking action.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2024/10/23"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Identifies role chaining activity. Role chaining is when you use one assumed role to assume a second role through the
AWS CLI or API. While this a recognized functionality in AWS, role chaining can be abused for privilege escalation if
the subsequent assumed role provides additional privileges. Role chaining can also be used as a persistence mechanism as
each AssumeRole action results in a refreshed session token with a 1 hour maximum duration. This is a new terms rule that looks for the first occurance of one role (aws.cloudtrail.user_identity.session_context.session_issuer.arn) assuming another (aws.cloudtrail.resources.arn).
"""
false_positives = [
    """
    Role chaining can be used as an access control. Ensure that this behavior is not part of a legitimate operation
    before taking action.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS STS Role Chaining"
note = """
## Triage and analysis

### Investigating AWS STS Role Chaining

Role chaining occurs when a role assumed with temporary credentials (`AssumeRole`) is used to assume another role. While supported by AWS, chaining can increase risk of Privilege escalation, if the second role grants broader permissions; and Persistence, since each chained AssumeRole refreshes the session with up to 1-hour duration. This new terms rule triggers on the first observed combination of one role (`aws.cloudtrail.user_identity.session_context.session_issuer.arn`) assuming another (`aws.cloudtrail.resources.arn`). 

### Possible investigation steps

- **Review Alert Context**: Investigate the alert, focusing on `aws.cloudtrail.user_identity.session_context.session_issuer.arn` (the calling role) and `aws.cloudtrail.resources.arn` (the target role).  

- **Determine scope and intent.** Check `aws.cloudtrail.recipient_account_id` and `aws.cloudtrail.resources.account_id` fields to identify whether the chaining is Intra-account (within the same AWS account) or Cross-account (from another AWS account).  

- **Check role privileges.** Compare policies of the calling and target roles. Determine if chaining increases permissions (for example, access to S3 data, IAM modifications, or admin privileges).  

- **Correlate with other activity.** Look for related alerts or CloudTrail activity within ±30 minutes: policy changes, unusual S3 access, or use of sensitive APIs. Use `aws.cloudtrail.user_identity.arn` to track behavior from the same role session, use `aws.cloudtrail.user_identity.session_context.session_issuer.arn` to track broader behavior from the role itself.

- **Validate legitimacy.** Contact the account or service owner to confirm if the chaining was expected (for example, automation pipelines or federated access flows).  

- **Geography & source.** Review `cloud.region`, `source.address`, and other `geo` fields to assess if the activity originates from expected regions or network ranges.  

### False positive analysis

- **Expected role chaining.** Some organizations use role chaining as part of multi-account access strategies. Maintain an allowlist of known `issuer.arn` - `target.arn` pairs.  
- **Automation and scheduled tasks.** CI/CD systems or monitoring tools may assume roles frequently. Validate by `userAgent` and historical behavior.  
- **Test/dev environments.** Development accounts may generate experimental chaining patterns. Tune rules or exceptions to exclude low-risk accounts.  

### Response and remediation

**Immediate steps**
- **Preserve evidence.** Export triggering CloudTrail events (±30 minutes) into a restricted evidence bucket. Include session context, source IP, and user agent.  
- **Notify owners.** Contact the owners of both roles to validate intent.  

**Containment (if suspicious)**
- **Revoke temporary credentials.** [Revoke Session Permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_revoke-sessions.html) if possible, or attach [AWSDenyALL policy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSDenyAll.html) to the originating role.  
- **Restrict risky roles.** Apply least-privilege policies or temporarily deny `sts:AssumeRole` for suspicious principals.  
- **Enable monitoring.** Ensure CloudTrail and GuardDuty are active in all regions to detect further chaining.  

**Scope and hunt**
- Search for additional AssumeRole activity by the same `issuer.arn` or `resources.arn` across other accounts and regions.  
- Look for privilege escalation attempts (for example, IAM `AttachRolePolicy`, `UpdateAssumeRolePolicy`) or sensitive data access following the chain.  

**Recovery & hardening**
- Apply least privilege to all roles, limiting trust policies to only required principals.  
- Enforce MFA where possible on AssumeRole operations.  
- Periodically review role chaining patterns to validate necessity; remove unused or risky trust relationships.  
- Document and tune new terms exceptions for known, legitimate chains.  

### Additional information
 
- [AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/): NIST-aligned templates for evidence, containment, eradication, recovery, post-incident. 
- [AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/): Practical response steps for account and IAM misuse scenarios
- AWS IAM Best Practices: [AWS docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) for reducing risk from temporary credentials.  

## Setup

The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
"""
references = [
    "https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html#id_roles_terms-and-concepts",
    "https://www.uptycs.com/blog/detecting-anomalous-aws-sessions-temporary-credentials",
    "https://hackingthe.cloud/aws/post_exploitation/role-chain-juggling/",
]
risk_score = 47
rule_id = "ba5a0b0c-b477-4729-a3dc-0147c2049cf1"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS STS",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Privilege Escalation",
    "Tactic: Lateral Movement",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
    data_stream.dataset : "aws.cloudtrail" and 
    event.provider : "sts.amazonaws.com" and 
    event.action : "AssumeRole" and 
    aws.cloudtrail.user_identity.type : "AssumedRole" and 
    event.outcome : "success" 
'''

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user_agent.original",
    "source.ip",
    "user.name",
    "aws.cloudtrail.user_identity.session_context.session_issuer.arn",
    "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",
    "aws.cloudtrail.recipient_account_id",
    "aws.cloudtrail.resources.account_id",
    "cloud.region",
    "aws.cloudtrail.request_parameters",
    "aws.cloudtrail.response_elements"
]

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"

[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"

[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"

[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 = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"

[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"

[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[[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/"
[rule.new_terms]
field = "new_terms_fields"
value = ["aws.cloudtrail.user_identity.session_context.session_issuer.arn", "aws.cloudtrail.resources.arn"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-10d"

Stages and Predicates

Stage 1: new_terms

    data_stream.dataset : "aws.cloudtrail" and 
    event.provider : "sts.amazonaws.com" and 
    event.action : "AssumeRole" and 
    aws.cloudtrail.user_identity.type : "AssumedRole" and 
    event.outcome : "success"

Indicators

These rows show field, operator, and value matches.

Binary Proxy Execution via AppVLP

#
Source
github.com/elastic/protections-artifacts

Identifies the execution of a binary via the Application Virtualization Utility. Adversaries may bypass process and signature-based defenses by proxying execution of malicious content with signed, or otherwise trusted, binaries.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the execution of a binary via the Application Virtualization Utility. Adversaries may bypass process and
signature-based defenses by proxying execution of malicious content with signed, or otherwise trusted, binaries.
"""
id = "1fe0df3c-89fd-498a-ac50-28f21d7b0f28"
license = "Elastic License v2"
name = "Binary Proxy Execution via AppVLP"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/OtherMSBinaries/Appvlp/"]
version = "1.0.6"

query = '''
process where event.action == "start" and process.parent.name : "AppVLP.exe" and
 not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
 not (process.name : "rundll32.exe" and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
 process.hash.sha256 != "de40cd43ec9934769c830bd3d4bc4a5a3fd5ed0535fa8ce4fdb17be3301fc120"
'''

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.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and process.parent.name : "AppVLP.exe" and
 not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
 not (process.name : "rundll32.exe" and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
 process.hash.sha256 != "de40cd43ec9934769c830bd3d4bc4a5a3fd5ed0535fa8ce4fdb17be3301fc120"

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

CrashDump Disabled via Registry Modification

#
Source
github.com/elastic/protections-artifacts

Identifies attempt to disable memory crashdump via registry modification. Malware using kernel mode component may perform this action to limit exposure in the case of an unexpected system crash.

MITRE ATT&CK Coverage

TacticTechniques
Persistence
Defense Impairment

Rule Body

[rule]
description = """
Identifies attempt to disable memory crashdump via registry modification. Malware using kernel mode component may
perform this action to limit exposure in the case of an unexpected system crash.
"""
id = "77ca3fcc-f607-45e0-837e-e4173e4ffc2a"
license = "Elastic License v2"
name = "CrashDump Disabled via Registry Modification"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
    "https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/memory-dump-file-options",
]
version = "1.0.31"

query = '''
registry where registry.value : "CrashDumpEnabled" and registry.data.strings : "0" and
 process.executable != null and
 not (user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and 
      process.executable : ("?:\\Windows\\System32\\svchost.exe", "?:\\Windows\\System32\\msiexec.exe")) and
 not process.executable : (
       "?:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
       /* TBR */
       "?:\\Program Files (x86)\\Citrix\\Workspace Environment Management Agent\\Citrix.Wem.Agent.Service.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 = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"


[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: registry

registry where registry.value : "CrashDumpEnabled" and registry.data.strings : "0" and
 process.executable != null and
 not (user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
      process.executable : ("?:\\Windows\\System32\\svchost.exe", "?:\\Windows\\System32\\msiexec.exe")) and
 not process.executable : (
       "?:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
       "?:\\Program Files (x86)\\Citrix\\Workspace Environment Management Agent\\Citrix.Wem.Agent.Service.exe")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Cursor Arbitrary Code Execution via PHP

#
Source
github.com/elastic/protections-artifacts

Cursor disables a crucial security feature: Workspace Trust, which in VS Code helps prevent inadvertently running unsafe scripts or extensions. This omission poses a risk: attackers could embed malicious configurations like a .vscode/settings.json pointing to a harmful executable and trigger code execution just by opening a project. This rule detects the exploitation of this feature.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Cursor disables a crucial security feature: Workspace Trust, which in VS Code helps prevent inadvertently running unsafe
scripts or extensions. This omission poses a risk: attackers could embed malicious configurations like a
.vscode/settings.json pointing to a harmful executable and trigger code execution just by opening a project. This rule
detects the exploitation of this feature.
"""
id = "44e414c9-e072-48ef-9783-ee692619e028"
license = "Elastic License v2"
name = "Cursor Arbitrary Code Execution via PHP"
os_list = ["macos"]
reference = ["https://www.imperva.com/blog/cursors-magic-comes-with-a-catch-missing-trust-setting/"]
version = "1.0.5"

query = '''
process where event.type == "start" and event.action == "exec" and process.parent.code_signature.team_id == "VDXQ22DGB9" and
  (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and process.args like "/Users/*/.vscode/run" and
  process.args like "/Users/*.php"
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.parent.code_signature.team_id == "VDXQ22DGB9" and
  (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and process.args like "/Users/*/.vscode/run" and
  process.args like "/Users/*.php"

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/*.php
  • /Users/*/.vscode/run
field:"process.args" kind:wildcard
process.namein
  • bash corpus 181 (elastic 181)
  • csh corpus 148 (elastic 148)
  • dash corpus 150 (elastic 150)
  • fish corpus 151 (elastic 151)
  • ksh corpus 149 (elastic 149)
  • sh corpus 180 (elastic 180)
  • tclsh corpus 28 (elastic 28)
  • tcsh corpus 145 (elastic 145)
  • zsh corpus 180 (elastic 180)
field:"process_basename" kind:in
process.namewildcard
  • tclsh* corpus 23 (elastic 23)
field:"process_basename" kind:wildcard value:"tclsh*"
process.parent.code_signature.team_ideq
  • VDXQ22DGB9
field:"process.parent.code_signature.team_id" kind:eq value:"VDXQ22DGB9"

Entra ID Device-Bound PRT Replay via First-Party App from Unusual IP

#

External IP Lookup from Non-Browser Process

#
Status
production
Kind
building block (feeds higher-level correlation rules; not a standalone alert)
Severity
low
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies domains commonly used by adversaries for post-exploitation IP lookups. It is common for adversaries to test for Internet access and acquire their external IP address after they have gained access to a system. Among others, this has been observed in campaigns leveraging the information stealer, Trickbot.

Known False Positives

  • If the domains listed in this rule are used as part of an authorized workflow, this rule will be triggered by those events. Validate that this is expected activity and tune the rule to fit your environment variables.

MITRE ATT&CK Coverage

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 22: DNSEvent (DNS query)

Rule Body

[metadata]
bypass_bbr_timing = true
creation_date = "2020/09/04"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/05/21"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies domains commonly used by adversaries for post-exploitation IP lookups. It is common for adversaries to test
for Internet access and acquire their external IP address after they have gained access to a system. Among others, this
has been observed in campaigns leveraging the information stealer, Trickbot.
"""
false_positives = [
    """
    If the domains listed in this rule are used as part of an authorized workflow, this rule will be triggered by those
    events. Validate that this is expected activity and tune the rule to fit your environment variables.
    """,
]
from = "now-9m"
index = ["logs-endpoint.events.network-*"]
language = "eql"
license = "Elastic License v2"
name = "External IP Lookup from Non-Browser Process"
note = """## Triage and analysis

### Investigating External IP Lookup from Non-Browser Process

After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.

This rule looks for connections to known IP lookup services through non-browser processes or non-installed programs. Using only the IP address of the compromised system, attackers can obtain valuable information such as the system's geographic location, the company that owns the IP, whether the system is cloud-hosted, and more.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Investigate abnormal behaviors observed by the subject process, such as network connections, registry or file modifications, and any spawned child processes.

### False positive analysis

- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Use the data collected through the analysis to investigate other machines affected in the environment.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection 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://community.jisc.ac.uk/blogs/csirt/article/trickbot-analysis-and-mitigation",
    "https://www.cybereason.com/blog/dropping-anchor-from-a-trickbot-infection-to-the-discovery-of-the-anchor-malware",
]
risk_score = 21
rule_id = "1d72d014-e2ab-4707-b056-9b96abe7b511"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
    "Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
network where host.os.type == "windows" and network.protocol == "dns" and
    process.name != null and user.id not in ("S-1-5-19", "S-1-5-20") and
    event.action == "lookup_requested" and
    /* Add new external IP lookup services here */
    dns.question.name :
    (
        "*api.ipify.org",
        "*freegeoip.app",
        "*checkip.amazonaws.com",
        "*checkip.dyndns.org",
        "*freegeoip.app",
        "*icanhazip.com",
        "*ifconfig.*",
        "*ipecho.net",
        "*ipgeoapi.com",
        "*ipinfo.io",
        "*ip.anysrc.net",
        "*myexternalip.com",
        "*myipaddress.com",
        "*showipaddress.com",
        "*whatismyipaddress.com",
        "*wtfismyip.com",
        "*ipapi.co",
        "*ip-lookup.net",
        "*ipstack.com"
    ) and
    /* Insert noisy false positives here */
    not
    (
      (
        process.executable : (
            "?:\\Program Files\\*.exe",
            "?:\\Program Files (x86)\\*.exe",
            "?:\\Windows\\Prey\\versions\\*\\bin\\node.exe",
            "?:\\Windows\\System32\\WWAHost.exe",
            "?:\\Windows\\System32\\smartscreen.exe",
            "?:\\Windows\\System32\\MicrosoftEdgeCP.exe",
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
            "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Users\\*\\AppData\\Local\\Programs\\Fiddler\\Fiddler.exe",
            "?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
            "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\OneDrive.exe"
        ) and process.code_signature.trusted == true
      ) or
      (
        (process.name : "Evernote.exe" and process.code_signature.subject_name : "Evernote Corporation" and process.code_signature.trusted == true) or
        (process.name : "firefox.exe" and process.code_signature.subject_name : "Mozilla Corporation" and process.code_signature.trusted == true) or
        (process.name : "Loom.exe" and process.code_signature.subject_name : "Loom, Inc." and process.code_signature.trusted == true) or
        (process.name : "opera.exe" and process.code_signature.subject_name : "Opera Norway AS" and process.code_signature.trusted == true) or
        (process.name : "brave.exe" and process.code_signature.subject_name : "Brave Software, Inc." and process.code_signature.trusted == true) or
        (process.name : "vivaldi.exe" and process.code_signature.subject_name : "Vivaldi Technologies AS" and process.code_signature.trusted == true)
      )
    )
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"
[[rule.threat.technique.subtechnique]]
id = "T1016.001"
name = "Internet Connection Discovery"
reference = "https://attack.mitre.org/techniques/T1016/001/"


[[rule.threat.technique]]
id = "T1614"
name = "System Location Discovery"
reference = "https://attack.mitre.org/techniques/T1614/"


[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

Stages and Predicates

Stage 1: network

network where host.os.type == "windows" and network.protocol == "dns" and
    process.name != null and user.id not in ("S-1-5-19", "S-1-5-20") and
    event.action == "lookup_requested" and
    dns.question.name :
    (
        "*api.ipify.org",
        "*freegeoip.app",
        "*checkip.amazonaws.com",
        "*checkip.dyndns.org",
        "*freegeoip.app",
        "*icanhazip.com",
        "*ifconfig.*",
        "*ipecho.net",
        "*ipgeoapi.com",
        "*ipinfo.io",
        "*ip.anysrc.net",
        "*myexternalip.com",
        "*myipaddress.com",
        "*showipaddress.com",
        "*whatismyipaddress.com",
        "*wtfismyip.com",
        "*ipapi.co",
        "*ip-lookup.net",
        "*ipstack.com"
    ) and
    not
    (
      (
        process.executable : (
            "?:\\Program Files\\*.exe",
            "?:\\Program Files (x86)\\*.exe",
            "?:\\Windows\\Prey\\versions\\*\\bin\\node.exe",
            "?:\\Windows\\System32\\WWAHost.exe",
            "?:\\Windows\\System32\\smartscreen.exe",
            "?:\\Windows\\System32\\MicrosoftEdgeCP.exe",
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
            "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Users\\*\\AppData\\Local\\Programs\\Fiddler\\Fiddler.exe",
            "?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
            "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\OneDrive.exe"
        ) and process.code_signature.trusted == true
      ) or
      (
        (process.name : "Evernote.exe" and process.code_signature.subject_name : "Evernote Corporation" and process.code_signature.trusted == true) or
        (process.name : "firefox.exe" and process.code_signature.subject_name : "Mozilla Corporation" and process.code_signature.trusted == true) or
        (process.name : "Loom.exe" and process.code_signature.subject_name : "Loom, Inc." and process.code_signature.trusted == true) or
        (process.name : "opera.exe" and process.code_signature.subject_name : "Opera Norway AS" and process.code_signature.trusted == true) or
        (process.name : "brave.exe" and process.code_signature.subject_name : "Brave Software, Inc." and process.code_signature.trusted == true) or
        (process.name : "vivaldi.exe" and process.code_signature.subject_name : "Vivaldi Technologies AS" and process.code_signature.trusted == true)
      )
    )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namewildcard
  • *api.ipify.org corpus 3 (elastic 3)
  • *checkip.amazonaws.com corpus 3 (elastic 3)
  • *checkip.dyndns.org corpus 3 (elastic 3)
  • *freegeoip.app corpus 3 (elastic 3)
  • *icanhazip.com corpus 3 (elastic 3)
  • *ifconfig.*
  • *ip-lookup.net
  • *ip.anysrc.net
  • *ipapi.co
  • *ipecho.net corpus 3 (elastic 3)
  • *ipgeoapi.com
  • *ipinfo.io corpus 3 (elastic 3)
  • *ipstack.com
  • *myexternalip.com
  • *myipaddress.com
  • *showipaddress.com
  • *whatismyipaddress.com
  • *wtfismyip.com corpus 3 (elastic 3)
field:"QueryName" kind:wildcard
event.actioneq
  • lookup_requested corpus 5 (elastic 5)
field:"EventType" kind:eq value:"lookup_requested"
network.protocoleq
  • dns corpus 4 (elastic 4)
field:"DestinationPortName" kind:eq value:"dns"
process.nameis_not_null
  • (no value, null check)
field:"process_basename" kind:is_not_null

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqBrave Software, Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Brave Software, Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.nameeqbrave.exeexcludes:process.name field:"process.name" value:"brave.exe"
process.code_signature.subject_nameeqEvernote Corporationexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Evernote Corporation"
process.nameeqEvernote.exeexcludes:process.name field:"process.name" value:"Evernote.exe"
process.code_signature.subject_nameeqLoom, Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Loom, Inc."
process.nameeqLoom.exeexcludes:process.name field:"process.name" value:"Loom.exe"
process.code_signature.subject_nameeqMozilla Corporationexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Mozilla Corporation"
process.nameeqfirefox.exeexcludes:process.name field:"process.name" value:"firefox.exe"
process.code_signature.subject_nameeqOpera Norway ASexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Opera Norway AS"
process.nameeqopera.exeexcludes:process.name field:"process.name" value:"opera.exe"
process.code_signature.subject_nameeqVivaldi Technologies ASexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Vivaldi Technologies AS"
process.nameeqvivaldi.exeexcludes:process.name field:"process.name" value:"vivaldi.exe"
process.executablewildcard?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\Prey\versions\*\bin\node.exe, ?:\Windows\System32\WWAHost.exe, ?:\Windows\System32\smartscreen.exe, ?:\Windows\System32\MicrosoftEdgeCP.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MsMpEng.exe, ?:\Users\*\AppData\Local\Google\Chrome\Application\chrome.exe, ?:\Users\*\AppData\Local\Programs\Fiddler\Fiddler.exe, ?:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe, ?:\Users\*\AppData\Local\Microsoft\OneDrive\OneDrive.exeexcludes:process.executable
user.idinS-1-5-19, S-1-5-20excludes:user.id field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20"

Git Hook Command Execution

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

This rule detects the execution of a potentially malicious process from a Git hook. Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. An attacker can abuse Git hooks to execute arbitrary commands on the system and establish persistence.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/07/15"
integration = ["endpoint", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects the execution of a potentially malicious process from a Git hook. Git hooks are scripts that Git
executes before or after events such as: commit, push, and receive. An attacker can abuse Git hooks to execute arbitrary
commands on the system and establish persistence.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "logs-sentinel_one_cloud_funnel.*", "logs-crowdstrike.fdr*"]
language = "eql"
license = "Elastic License v2"
name = "Git Hook Command Execution"
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 Git Hook Command Execution

Git hooks are scripts that automate tasks by executing before or after Git events like commits or pushes. While useful for developers, adversaries can exploit them to run malicious commands, gaining persistence or evading defenses. The detection rule identifies suspicious processes initiated by Git hooks, focusing on shell executions, to flag potential abuse on Linux systems.

### Possible investigation steps

- Review the alert details to identify the specific Git hook script path and the suspicious process name that was executed, as indicated by the process.args and process.name fields.
- Examine the process tree to understand the parent-child relationship, focusing on the process.parent.name and process.entity_id fields, to determine how the suspicious process was initiated.
- Check the Git repository's history and recent changes to the .git/hooks directory to identify any unauthorized modifications or additions to the hook scripts.
- Investigate the user account associated with the process execution to determine if the activity aligns with their typical behavior or if it indicates potential compromise.
- Analyze the command-line arguments and environment variables of the suspicious process to gather more context on the nature of the executed command.
- Correlate this event with other security alerts or logs from the same host.id to identify any patterns or additional indicators of compromise.
- If possible, isolate the affected system and conduct a deeper forensic analysis to uncover any further malicious activity or persistence mechanisms.

### False positive analysis

- Developers using Git hooks for legitimate automation tasks may trigger this rule. To manage this, identify and document common scripts used in your development environment and create exceptions for these known benign processes.
- Continuous integration and deployment (CI/CD) systems often utilize Git hooks to automate workflows. Review the processes initiated by these systems and exclude them from detection if they are verified as non-malicious.
- Custom scripts executed via Git hooks for project-specific tasks can also cause false positives. Collaborate with development teams to catalog these scripts and adjust the detection rule to exclude them.
- Frequent updates or changes in Git repositories might lead to repeated triggering of the rule. Monitor these activities and, if consistent and verified as safe, consider adding them to an allowlist to reduce noise.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further malicious activity and lateral movement.
- Terminate any suspicious processes identified as being executed from Git hooks, especially those involving shell executions.
- Conduct a thorough review of the .git/hooks directory on the affected system to identify and remove any unauthorized or malicious scripts.
- Restore any modified or deleted files from a known good backup to ensure system integrity.
- Implement monitoring for any future modifications to the .git/hooks directory to detect unauthorized changes promptly.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
- Review and update access controls and permissions for Git repositories to limit the ability to modify hooks to trusted users only."""
references = [
    "https://swisskyrepo.github.io/InternalAllTheThings/redteam/persistence/linux-persistence/#backdooring-git",
    "https://www.elastic.co/security-labs/sequel-on-persistence-mechanisms",
]
risk_score = 21
rule_id = "dc61f382-dc0c-4cc0-a845-069f2a071704"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
  "Domain: Endpoint",
  "OS: Linux",
  "Use Case: Threat Detection",
  "Tactic: Persistence",
  "Tactic: Execution",
  "Tactic: Defense Evasion",
  "Data Source: Elastic Defend",
  "Data Source: SentinelOne",
  "Resources: Investigation Guide",
  "Data Source: Crowdstrike",
]
type = "eql"
query = '''
sequence by host.id with maxspan=3s
  [process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
   process.parent.name == "git" and process.args like ".git/hooks/*" and
   process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
  ] by process.entity_id
  [process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
   process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")] by process.parent.entity_id
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"

[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"

[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 3s, correlated by host.id, process.entity_id, process.parent.entity_id.

Stage 1: process

[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
   process.parent.name == "git" and process.args like ".git/hooks/*" and
   process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
  ] by process.entity_id

Stage 2: process

[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "ProcessRollup2") and
   process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")] by process.parent.entity_id

Indicators

These rows show field, operator, and value matches.

GKE Secret get or list with Suspicious User Agent

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

Detects successful GKE secret get or list operations where the user agent matches scripting runtimes, minimal HTTP clients, or offensive-distribution fingerprints rather than typical kubectl or controller traffic.

Known False Positives

  • Approved scripts, CI jobs, or penetration tests may use generic HTTP clients. Validate tickets and identity scope before treating as compromise.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/06/30"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/06/30"

[rule]
author = ["Elastic"]
description = """
Detects successful GKE secret get or list operations where the user agent matches scripting runtimes, minimal HTTP
clients, or offensive-distribution fingerprints rather than typical kubectl or controller traffic.
"""
false_positives = [
    """
    Approved scripts, CI jobs, or penetration tests may use generic HTTP clients. Validate tickets and identity scope
    before treating as compromise.
    """,
]
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE Secret get or list with Suspicious User Agent"
note = """## Triage and analysis

### Investigating GKE Secret get or list with Suspicious User Agent

Review `user.email`, `user_agent.original`, targeted secret resource, and `source.ip`.

### Investigation steps

- Confirm whether the identity should access secrets with this client fingerprint.
- Pivot on source IP for other API bursts, exec, or RBAC changes.

### False positives

- Internal automation using generic libraries; exclude stable service accounts after review.

## Setup

The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."""
references = [
    "https://attack.mitre.org/techniques/T1552/007/",
]
risk_score = 73
rule_id = "0c04d82f-6def-4659-aa62-ed6355a51f39"
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: Kubernetes",
    "Data Source: GCP",
    "Data Source: Google Cloud Platform",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and
event.action:("io.k8s.core.v1.secrets.list" or "io.k8s.core.v1.secrets.get") and user_agent.original:(
  curl* or python* or Python* or wget* or Go-http* or perl* or java* or node* or php* or *distrib#kali* or *kali-amd64* or
  *kali-arm64* or Bun* or axios* or undici*
)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"

[[rule.threat.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"

[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

Stages and Predicates

Stage 1: query

data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and
event.action:("io.k8s.core.v1.secrets.list" or "io.k8s.core.v1.secrets.get") and user_agent.original:(
  curl* or python* or Python* or wget* or Go-http* or perl* or java* or node* or php* or *distrib#kali* or *kali-amd64* or
  *kali-arm64* or Bun* or axios* or undici*
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.dataseteq
  • gcp.audit corpus 60 (elastic 60)
field:"data_stream.dataset" kind:eq value:"gcp.audit"
event.actionin
  • io.k8s.core.v1.secrets.get corpus 3 (elastic 3)
  • io.k8s.core.v1.secrets.list corpus 3 (elastic 3)
field:"EventType" kind:in
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
service.nameeq
  • k8s.io corpus 28 (elastic 28)
field:"ServiceName" kind:eq value:"k8s.io"
user_agent.originalwildcard
  • *distrib#kali* corpus 3 (elastic 3)
  • *kali-amd64* corpus 3 (elastic 3)
  • *kali-arm64* corpus 3 (elastic 3)
  • Bun* corpus 2 (elastic 2)
  • Go-http* corpus 2 (elastic 2)
  • Python* corpus 2 (elastic 2)
  • axios* corpus 4 (elastic 4)
  • curl* corpus 2 (elastic 2)
  • java* corpus 2 (elastic 2)
  • node* corpus 2 (elastic 2)
  • perl* corpus 2 (elastic 2)
  • php* corpus 2 (elastic 2)
  • python* corpus 2 (elastic 2)
  • undici* corpus 2 (elastic 2)
  • wget* corpus 2 (elastic 2)
field:"aws::userAgent" kind:wildcard

GRUB Configuration File Creation

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

This rule detects the creation of GRUB configuration files on Linux systems. The GRUB configuration file is used to configure the boot loader, which is responsible for loading the operating system. Attackers may create malicious GRUB configuration files to execute arbitrary code or escalate privileges during the boot process, which can be leveraged to maintain persistence on the system.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/01/16"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects the creation of GRUB configuration files on Linux systems. The GRUB configuration file is used to
configure the boot loader, which is responsible for loading the operating system. Attackers may create malicious GRUB
configuration files to execute arbitrary code or escalate privileges during the boot process, which can be leveraged to
maintain persistence on the system.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*", "logs-sentinel_one_cloud_funnel.*", "endgame-*"]
language = "eql"
license = "Elastic License v2"
name = "GRUB Configuration File 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 GRUB Configuration File Creation

GRUB (Grand Unified Bootloader) is crucial for booting Linux systems, managing the boot process, and loading the OS. Adversaries may exploit GRUB by creating or altering configuration files to execute unauthorized code or gain elevated privileges, ensuring persistence. The detection rule identifies suspicious creation of GRUB files, excluding legitimate processes, to flag potential security threats.

### Possible investigation steps

- Review the file path and name to determine if it matches any known GRUB configuration files, as specified in the query (e.g., "/etc/default/grub", "/boot/grub2/grub.cfg").
- Identify the process that created the file by examining the process.executable field, ensuring it is not one of the excluded legitimate processes.
- Check the timestamp of the file creation event to correlate it with any other suspicious activities or changes in the system around the same time.
- Investigate the user account associated with the process that created the file to determine if it has the necessary permissions and if the activity aligns with the user's typical behavior.
- Analyze the contents of the newly created or modified GRUB configuration file for any unauthorized or suspicious entries that could indicate malicious intent.
- Cross-reference the event with other security logs or alerts to identify any related activities or patterns that could suggest a broader attack or compromise.

### False positive analysis

- System package managers like dpkg, rpm, and yum may trigger false positives when they update or modify GRUB configuration files during routine package installations or updates. To handle this, ensure these processes are included in the exclusion list within the detection rule.
- Automated system management tools such as Puppet, Chef, and Ansible can also cause false positives when they manage GRUB configurations as part of their configuration management tasks. Consider adding these tools to the exclusion list if they are part of your environment.
- Virtualization and containerization tools like Docker, Podman, and VirtualBox might modify GRUB files as part of their operations. Verify these processes and exclude them if they are legitimate in your setup.
- Temporary files created by text editors or system processes, such as those with extensions like swp or swx, can be mistaken for GRUB configuration files. Ensure these extensions are part of the exclusion criteria to prevent unnecessary alerts.
- Custom scripts or administrative tasks that modify GRUB configurations for legitimate reasons should be reviewed and, if deemed safe, added to the exclusion list to avoid repeated false positives.

### Response and remediation

- Immediately isolate the affected system from the network to prevent potential lateral movement or further unauthorized access.
- Review the GRUB configuration files identified in the alert to confirm unauthorized modifications or creations. Restore any altered files from a known good backup if necessary.
- Conduct a thorough scan of the system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any malicious code or backdoors that may have been introduced.
- Change all system and user passwords on the affected machine to prevent unauthorized access using potentially compromised credentials.
- Monitor the system for any further suspicious activity, particularly focusing on processes attempting to modify GRUB configuration files.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Implement additional logging and monitoring for GRUB configuration changes to enhance detection capabilities and prevent future unauthorized modifications."""
risk_score = 21
rule_id = "ce4a32e5-32aa-47e6-80da-ced6d234387d"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Execution",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Defend",
    "Data Source: SentinelOne",
    "Data Source: Elastic Endgame",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.type == "creation" and process.executable != null and file.path like~ (
  "/etc/default/grub.d/*", "/etc/default/grub", "/etc/grub.d/*",
  "/boot/grub2/grub.cfg", "/boot/grub/grub.cfg", "/boot/efi/EFI/*/grub.cfg",
  "/etc/sysconfig/grub"
) and not (
  /* Too many FPs from Python automation */
  process.name like ("python*", "platform-python*") or
  process.executable in (
    "/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
    "/usr/bin/microdnf", "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum",
    "/bin/dnf", "/usr/bin/dnf", "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic",
    "/bin/pacman", "/usr/bin/pacman", "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk",
    "/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
    "/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
    "/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/usr/bin/pamac-daemon",
    "/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd", "/usr/bin/crio", "/usr/sbin/crond",
    "/opt/puppetlabs/puppet/bin/ruby", "/usr/libexec/platform-python", "/kaniko/kaniko-executor",
    "/usr/local/bin/dockerd", "/usr/bin/podman", "/bin/install", "/proc/self/exe", "/usr/lib/systemd/systemd",
    "/usr/sbin/sshd", "/usr/bin/gitlab-runner", "/opt/gitlab/embedded/bin/ruby", "/usr/sbin/gdm", "/usr/bin/install",
    "/usr/local/manageengine/uems_agent/bin/dcregister", "/usr/local/bin/pacman", "./usr/bin/podman", "/usr/bin/dnf5",
    "/usr/sbin/yum-cron"
  ) or
  process.executable like~ (
    "/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*"
  ) or
  file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
  (process.name == "sed" and file.name : "sed*")
)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1542"
name = "Pre-OS Boot"
reference = "https://attack.mitre.org/techniques/T1542/"

[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"

[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1542"
name = "Pre-OS Boot"
reference = "https://attack.mitre.org/techniques/T1542/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stages and Predicates

Stage 1: file

file where host.os.type == "linux" and event.type == "creation" and process.executable != null and file.path like~ (
  "/etc/default/grub.d/*", "/etc/default/grub", "/etc/grub.d/*",
  "/boot/grub2/grub.cfg", "/boot/grub/grub.cfg", "/boot/efi/EFI/*/grub.cfg",
  "/etc/sysconfig/grub"
) and not (
  process.name like ("python*", "platform-python*") or
  process.executable in (
    "/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
    "/usr/bin/microdnf", "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum",
    "/bin/dnf", "/usr/bin/dnf", "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic",
    "/bin/pacman", "/usr/bin/pacman", "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk",
    "/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
    "/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
    "/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/usr/bin/pamac-daemon",
    "/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd", "/usr/bin/crio", "/usr/sbin/crond",
    "/opt/puppetlabs/puppet/bin/ruby", "/usr/libexec/platform-python", "/kaniko/kaniko-executor",
    "/usr/local/bin/dockerd", "/usr/bin/podman", "/bin/install", "/proc/self/exe", "/usr/lib/systemd/systemd",
    "/usr/sbin/sshd", "/usr/bin/gitlab-runner", "/opt/gitlab/embedded/bin/ruby", "/usr/sbin/gdm", "/usr/bin/install",
    "/usr/local/manageengine/uems_agent/bin/dcregister", "/usr/local/bin/pacman", "./usr/bin/podman", "/usr/bin/dnf5",
    "/usr/sbin/yum-cron"
  ) or
  process.executable like~ (
    "/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*"
  ) or
  file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
  (process.name == "sed" and file.name : "sed*")
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • creation
field:"event.type" kind:eq value:"creation"
file.pathwildcard
  • /boot/efi/EFI/*/grub.cfg
  • /boot/grub/grub.cfg
  • /boot/grub2/grub.cfg
  • /etc/default/grub
  • /etc/default/grub.d/*
  • /etc/grub.d/*
  • /etc/sysconfig/grub
field:"TargetFilename" kind:wildcard
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.namestarts_withsedexcludes:file.name field:"file.name" value:"sed"
process.nameeqsedexcludes:process.name field:"process.name" value:"sed"
file.extensionindpkg-remove, swp, swpx, swxexcludes:file.extension
process.executablein./usr/bin/podman, /bin/autossl_check, /bin/chef-client, /bin/dnf, /bin/dnf-automatic, /bin/dockerd, /bin/dpkg, /bin/dpkg-divert, /bin/install, /bin/microdnf, /bin/pacman, /bin/pamac-daemon, /bin/podman, /bin/puppet, /bin/rpm, /bin/snapd, /bin/yum, /kaniko/kaniko-executor, /opt/gitlab/embedded/bin/ruby, /opt/puppetlabs/puppet/bin/puppet, /opt/puppetlabs/puppet/bin/ruby, /proc/self/exe, /sbin/apk, /usr/bin/apt, /usr/bin/autossl_check, /usr/bin/chef-client, /usr/bin/crio, /usr/bin/dnf, /usr/bin/dnf-automatic, /usr/bin/dnf5, /usr/bin/dockerd, /usr/bin/dpkg, /usr/bin/dpkg-divert, /usr/bin/gitlab-runner, /usr/bin/install, /usr/bin/microdnf, /usr/bin/pacman, /usr/bin/pamac-daemon, /usr/bin/podman, /usr/bin/puppet, /usr/bin/rpm, /usr/bin/snapd, /usr/bin/yum, /usr/lib/snapd/snapd, /usr/lib/systemd/systemd, /usr/libexec/platform-python, /usr/local/bin/dockerd, /usr/local/bin/pacman, /usr/local/manageengine/uems_agent/bin/dcregister, /usr/local/sbin/apk, /usr/sbin/apk, /usr/sbin/crond, /usr/sbin/dockerd, /usr/sbin/gdm, /usr/sbin/pacman, /usr/sbin/sshd, /usr/sbin/yum-cronexcludes:process.executable
process.executablestarts_with/nix/store/, /var/lib/dpkg/, /tmp/vmis., /snap/, /dev/fd/, /usr/lib/virtualbox/excludes:process.executable
process.namestarts_withpython, platform-pythonexcludes:process.name field:"process.name" value:"python" field:"process.name" value:"platform-python"

Incoming DCOM Lateral Movement with MMC

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

Identifies the use of Distributed Component Object Model (DCOM) to run commands from a remote host, which are launched via the MMC20 Application COM Object. This behavior may indicate an attacker abusing a DCOM application to move laterally.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2020/11/06"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/03"

[rule]
author = ["Elastic"]
description = """
Identifies the use of Distributed Component Object Model (DCOM) to run commands from a remote host, which are launched
via the MMC20 Application COM Object. This behavior may indicate an attacker abusing a DCOM application to move
laterally.
"""
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.process-*",
    "logs-endpoint.events.network-*",
    "logs-windows.sysmon_operational-*",
]
language = "eql"
license = "Elastic License v2"
name = "Incoming DCOM Lateral Movement with MMC"
references = ["https://enigma0x3.net/2017/01/05/lateral-movement-using-the-mmc20-application-com-object/"]
risk_score = 73
rule_id = "51ce96fb-9e52-4dad-b0ba-99b54440fc9a"
severity = "high"
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 host.id with maxspan=1m
 [network where host.os.type == "windows" and event.type == "start" and process.name : "mmc.exe" and source.port >= 49152 and
  destination.port >= 49152 and source.ip != "127.0.0.1" and source.ip != "::1" and
  network.direction : ("incoming", "ingress") and network.transport == "tcp"
 ] by process.entity_id
 [process where host.os.type == "windows" and event.type == "start" and process.parent.name : "mmc.exe"
 ] by process.parent.entity_id
'''

note = """## Triage and analysis

### Investigating Incoming DCOM Lateral Movement with MMC

#### Possible investigation steps

- Which Timeline source events define the target MMC instance, spawned child, and remote source?
  - Why: this asymmetric sequence links incoming "mmc.exe" network activity to a child process, and the alert may not preserve one reliable process identity.
  - Focus: recover the target MMC network event and child process event, recording target MMC and child `process.entity_id`, `source.ip`, and child `process.command_line`.
  - Implication: escalate if the chain does not resolve to one incoming MMC process spawning one child; lower suspicion only when it fits a recognized MMC administration source and child, then continue to command and network interpretation.
- Does the network event fit remote DCOM or RPC traffic into MMC?
  - Focus: the recovered "mmc.exe" network event: `source.ip`, `source.port`, `destination.port`, `network.direction`, and `network.transport`.
  - Implication: DCOM-style remote execution is supported by incoming TCP from a non-loopback `source.ip` with both ports in the high RPC range; concern rises when the source is a peer workstation, unrelated server, or unknown management origin.
- What did MMC execute through MMC20.Application COM automation?
  - Focus: recovered child `process.executable` and `process.command_line`.
  - Implication: escalate when MMC launches cmd.exe, PowerShell, script hosts, LOLBins, loaders, or download cradles; lower suspicion only when the exact child command is a recognized MMC snap-in helper or management binary and the source context also fits.
- Is the child binary identity consistent with the behavior, without treating signer trust as clearance?
  - Focus: child `process.hash.sha256`, `process.pe.original_file_name`, `process.code_signature.subject_name`, `process.code_signature.trusted`, and entity context.
  - Implication: mismatched PE metadata, user-writable paths, unexpected publishers, or quick follow-on LOLBin execution increases concern; a trusted signer confirms identity only and does not clear remote command execution.
- Does the target-side user and session fit remote administration from the recovered source?
  - Focus: child `user.id`, `user.name`, and `user.domain`, compared with the recovered source and target host.
  - Implication: escalate when the user, service context, or session is unexpected for that target or cannot explain administrative access from the source; lower suspicion when source, identity, and session match a recognized admin or jump-host path.
- Did the MMC-spawned child launch descendants after execution?
  - Focus: same-host process events from the child, checking child-of-child `process.parent.entity_id`. $investigate_2
  - Implication: escalate when the child launches more execution chains; absent descendants keeps the case centered on the recovered remote command, not benign.
- Did the child make DNS or connection activity?
  - Focus: same-host network events, checking DNS `dns.question.name` and connection `destination.ip`. $investigate_3
  - Hint: separate DNS events from connection events and keep the pivot bounded to the alert window. Missing network telemetry is unresolved, not benign.
  - Implication: escalate when the child resolves rare domains or connects to staging or command infrastructure.
- Does the recovered source or child command appear on other hosts after local triage stays suspicious?
  - Focus: same-host alerts for `host.id`. $investigate_0
  - Hint: if the same account is suspicious, compare same-`user.id` alerts for lateral-movement or credential-access patterns across other hosts. $investigate_1
  - Hint: broaden only after local evidence remains suspicious or unresolved; use `source.ip` for spread and a distinctive child `process.command_line` fragment for tool reuse.
  - Implication: expand scope when the same source touches more targets, the same child command appears elsewhere, or same-host alerts show lateral movement or defense evasion; keep the case local when the pattern stays confined and the workflow is otherwise explained.

- Escalate when source identity, incoming high-RPC network shape, child intent, identity/session, or descendant/DNS/destination evidence supports unauthorized MMC20.Application execution; close only when recovered evidence, with external confirmation when telemetry cannot prove intent, binds one exact recognized MMC administration workflow with no contradictory follow-on evidence; mixed or incomplete evidence means preserve and escalate.

### False positive analysis

- Remote MMC, server-management automation, or vendor/internal tooling can legitimately trigger this rule when a management host uses DCOM to drive MMC snap-ins or support commands. Confirm the recovered `source.ip` is a recognized admin, jump, or tooling host; child `process.executable` and `process.command_line` show the exact console/helper action; `user.id` or `user.name` fits that path; child `process.hash.sha256` or `process.code_signature.subject_name` is stable when tooling is involved; and descendant, DNS, and connection evidence stays quiet. If inventory or change records are unavailable, telemetry-only closure still requires current evidence to prove the exact workflow; prior recurrence of the same `source.ip`, child command, and `host.id` pattern is corroboration, not closure by itself.
- Before creating an exception, anchor it on the minimum confirmed workflow pattern: recognized `source.ip`, child `process.executable`, stable `process.command_line`, expected `user.id` or `user.name`, and the relevant `host.id` scope. Avoid exceptions on `process.parent.name` of "mmc.exe" or high RPC ports alone.

### Response and remediation

- If confirmed benign, record the recovered `source.ip`, child `process.executable`, child `process.command_line`, `user.id` or `user.name`, and target `host.id` that established the management workflow, then reverse any temporary containment. Create an exception only if the same pattern recurs consistently across prior alerts.
- If suspicious but unconfirmed, preserve a case export of the Timeline source events, the target MMC and child process instance IDs, child command line, source socket, and DNS/destination indicators before containment or cleanup.
- If suspicious but unconfirmed, apply reversible containment tied to the evidence, such as temporary DCOM/RPC restrictions from the recovered `source.ip` to the target `host.id`; isolate the host only when the child command or follow-on activity indicates payload execution and the host role can tolerate it.
- If confirmed malicious, first preserve the target MMC instance, child command, recovered source, descendant processes, and malicious DNS or destination indicators. Then isolate the target host and contain the recovered source system if it is in response scope; terminate processes or delete artifacts only after preservation and scoping.
- Review other hosts touched by the same recovered `source.ip` or child `process.command_line` pattern before terminating additional processes or removing artifacts so scoping completes before evidence is destroyed.
- Eradicate only scripts, binaries, persistence, or configuration changes identified during the investigation, then remediate the account, source host, or remote administration path that allowed the DCOM execution.
- Post-incident hardening: keep Windows Firewall enabled, disable unnecessary Microsoft Management Console inbound access, restrict DCOM/RPC between workstations, limit remote administrative rights to recognized jump hosts, and record the evidence and control changes for future triage."""

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.investigation_fields]
field_names = [
    "@timestamp",
    "host.id",
    "host.name",
    "user.id",
]

[transform]

[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Processes spawned by MMC on this host"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.parent.name", queryType = "phrase", value = "mmc.exe", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Network events for MMC on this host"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.name", queryType = "phrase", value = "mmc.exe", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[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.003"
name = "Distributed Component Object Model"
reference = "https://attack.mitre.org/techniques/T1021/003/"

[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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"

[[rule.threat.technique.subtechnique]]
id = "T1218.014"
name = "MMC"
reference = "https://attack.mitre.org/techniques/T1218/014/"

[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 = "T1559"
name = "Inter-Process Communication"
reference = "https://attack.mitre.org/techniques/T1559/"

[[rule.threat.technique.subtechnique]]
id = "T1559.001"
name = "Component Object Model"
reference = "https://attack.mitre.org/techniques/T1559/001/"

[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 host.id, process.entity_id, process.parent.entity_id.

Stage 1: network

[network where host.os.type == "windows" and event.type == "start" and process.name : "mmc.exe" and source.port >= 49152 and
  destination.port >= 49152 and source.ip != "127.0.0.1" and source.ip != "::1" and
  network.direction : ("incoming", "ingress") and network.transport == "tcp"
 ] by process.entity_id

Stage 2: process

[process where host.os.type == "windows" and event.type == "start" and process.parent.name : "mmc.exe"
 ] by process.parent.entity_id

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.portge
  • 49152 transforms: number corpus 4 (elastic 4)
field:"DestinationPort" kind:ge value:"49152"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
network.directionwildcard
  • incoming corpus 10 (elastic 10)
  • ingress corpus 12 (elastic 12)
field:"Initiated" kind:wildcard
network.transporteq
  • tcp corpus 16 (elastic 16)
field:"Protocol" kind:eq value:"tcp"
process.namewildcard
  • mmc.exe corpus 11 (elastic 7, splunk 4)
field:"process_basename" kind:wildcard value:"mmc.exe"
process.parent.namewildcard
  • mmc.exe corpus 7 (elastic 6, splunk 1)
field:"parent_process_basename" kind:wildcard value:"mmc.exe"
source.ipne
  • 127.0.0.1 corpus 22 (elastic 22)
  • ::1 corpus 20 (elastic 20)
field:"src_ip" kind:ne
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"

Kubectl Workload and Cluster Discovery

#
Status
production
Kind
building block (feeds higher-level correlation rules; not a standalone alert)
Severity
low
Time window
119m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule detects the execution of kubectl commands that are commonly used for workload and cluster discovery in Kubernetes environments. It looks for process events where kubectl is executed with arguments that query cluster information, such as namespaces, nodes, pods, deployments, and other resources. In environments where kubectl is not expected to be used, this could indicate potential reconnaissance activity by an adversary.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/06/19"
integration = ["endpoint", "auditd_manager", "crowdstrike", "cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
This rule detects the execution of kubectl commands that are commonly used for workload and cluster
discovery in Kubernetes environments. It looks for process events where kubectl is executed with
arguments that query cluster information, such as namespaces, nodes, pods, deployments, and other
resources. In environments where kubectl is not expected to be used, this could indicate potential
reconnaissance activity by an adversary.
"""
from = "now-119m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*", "logs-crowdstrike.fdr*", "logs-cloud_defend.process*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Kubectl Workload and Cluster Discovery"
risk_score = 21
rule_id = "74e5241e-c1a1-4e70-844e-84ee3d73eb7d"
severity = "low"
tags = [
  "Domain: Container",
  "Domain: Endpoint",
  "Domain: Kubernetes",
  "OS: Linux",
  "Use Case: Threat Detection",
  "Tactic: Discovery",
  "Rule Type: BBR",
  "Data Source: Elastic Defend",
  "Data Source: Elastic Endgame",
  "Data Source: Auditd Manager",
  "Data Source: Crowdstrike",
  "Data Source: Elastic Defend for Containers",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "executed", "process_started", "ProcessRollup2") and
process.name == "kubectl" and (
  (process.args in ("cluster-info", "api-resources", "api-versions", "version")) or
  (process.args in ("get", "describe") and process.args in (
    "namespaces", "nodes", "pods", "pod", "deployments", "deployment",
    "replicasets", "statefulsets", "daemonsets", "services", "service",
    "ingress", "ingresses", "endpoints", "configmaps", "events", "svc",
    "roles", "rolebindings", "clusterroles", "clusterrolebindings"
    )
  )
)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"

[[rule.threat.technique]]
id = "T1613"
name = "Container and Resource Discovery"
reference = "https://attack.mitre.org/techniques/T1613/"

[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "executed", "process_started", "ProcessRollup2") and
process.name == "kubectl" and (
  (process.args in ("cluster-info", "api-resources", "api-versions", "version")) or
  (process.args in ("get", "describe") and process.args in (
    "namespaces", "nodes", "pods", "pod", "deployments", "deployment",
    "replicasets", "statefulsets", "daemonsets", "services", "service",
    "ingress", "ingresses", "endpoints", "configmaps", "events", "svc",
    "roles", "rolebindings", "clusterroles", "clusterrolebindings"
    )
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2
  • exec
  • exec_event
  • executed
  • process_started
field:"EventType" kind:in
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argsin
  • api-resources
  • api-versions
  • cluster-info
  • clusterrolebindings
  • clusterroles
  • configmaps
  • daemonsets
  • deployment
  • deployments
  • describe
  • endpoints
  • events
  • get
  • ingress
  • ingresses
  • namespaces
  • nodes
  • pod
  • pods
  • replicasets
  • rolebindings
  • roles
  • service
  • services
  • statefulsets
  • svc
  • version
field:"process.args" kind:in
process.nameeq
  • kubectl
field:"process_basename" kind:eq value:"kubectl"

M365 Identity OAuth ROPC Grant via Legacy Authentication Client

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

Identifies a successful login by a user principal through a legacy authenticated client (such as Authenticated SMTP, IMAP, POP, or Exchange ActiveSync) in the Microsoft 365 Unified Audit Log, evidenced by the "BAV2ROPC" user agent. Legacy basic-authentication clients are translated by Entra ID into a Resource Owner Password Credentials (ROPC) grant, a single-factor flow that submits the user's password directly and bypasses interactive multi-factor authentication. This is commonly abused during password spraying and account takeover.

MITRE ATT&CK Coverage

Telemetry Coverage

PlatformRecord / event type
Microsoft 365UserLoggedIn

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/07/02"
integration = ["o365"]
maturity = "production"
updated_date = "2026/07/02"

[rule]
author = ["Elastic"]
description = """
Identifies a successful login by a user principal through a legacy authenticated client (such as Authenticated SMTP,
IMAP, POP, or Exchange ActiveSync) in the Microsoft 365 Unified Audit Log, evidenced by the "BAV2ROPC" user agent.
Legacy basic-authentication clients are translated by Entra ID into a Resource Owner Password Credentials (ROPC) grant,
a single-factor flow that submits the user's password directly and bypasses interactive multi-factor authentication.
This is commonly abused during password spraying and account takeover.
"""
from = "now-9m"
index = ["filebeat-*", "logs-o365.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "M365 Identity OAuth ROPC Grant via Legacy Authentication Client"
note = """## Triage and analysis

### Investigating M365 Identity OAuth ROPC Grant via Legacy Authentication Client

The Resource Owner Password Credentials (ROPC) flow allows a client to obtain tokens by submitting a user's credentials directly, without interactive sign-in. Legacy authentication clients (Authenticated SMTP, IMAP, POP, Exchange ActiveSync) that use basic authentication are translated by Entra ID into ROPC grants, which are single-factor and bypass interactive MFA. Microsoft 365 records these logins in the Unified Audit Log as `UserLoggedIn` events with the `BAV2ROPC` user agent. Adversaries abuse this flow for password spraying and account takeover against accounts that lack MFA enforcement or fall outside legacy-authentication blocking.

This rule identifies a successful ROPC/legacy-client login for a user principal not seen performing this activity in the last 10 days. Because the Unified Audit Log is a separate pipeline from the Entra ID sign-in diagnostic stream, this rule provides coverage even when non-interactive sign-in logs are not forwarded to the SIEM.

### Possible investigation steps
- Review `o365.audit.UserId` to identify the account that authenticated and determine whether it is expected to use legacy authentication clients.
- Review `o365.audit.ApplicationId` and `o365.audit.Target.ID` to identify the targeted resource. `00000002-0000-0ff1-ce00-000000000000` is Office 365 Exchange Online, the typical target of Authenticated SMTP.
- Confirm the client via `user_agent.original: "BAV2ROPC"`, which indicates a legacy basic-authentication client translated into a ROPC grant.
- Review `o365.audit.ClientIP` / `source.ip` and geolocation to determine whether the source is expected for this user. Correlate with known-malicious infrastructure or unusual ASNs.
- Pivot on `o365.audit.UserId` in Entra ID Sign-In Logs (`logs-azure.signinlogs-*`) to corroborate the login, and look for a preceding burst of failed authentications (password spraying) from the same source or against the same account.
- Review subsequent activity by the account (mailbox access, rule creation, mail forwarding, OAuth consent) for signs of post-compromise actions on objectives.

### False positive analysis
- Legitimate legacy applications, service accounts, or scripts that still rely on Authenticated SMTP or other basic-authentication clients may trigger this rule. Validate the account, source, and business purpose, and exclude confirmed benign service accounts.
- Multifunction devices, scan-to-email appliances, and monitoring tools that submit mail via Authenticated SMTP can generate this activity. These are typically stable in source IP and account and can be excluded once verified.

### Response and remediation
- If the login is confirmed malicious, disable the account, revoke active sessions and refresh tokens, and reset the password.
- Disable SMTP AUTH and other legacy authentication for the affected mailbox (`Set-CASMailbox -SmtpClientAuthenticationDisabled $true`) and, where feasible, tenant-wide.
- Enforce a Conditional Access policy that requires MFA and blocks legacy authentication for the affected user and, ideally, all users.
- Investigate the source IP and any preceding failed-authentication activity to scope a potential password-spray campaign.
- Review the account's activity after the login (mailbox rules, forwarding, delegate changes, OAuth grants) and remediate any unauthorized changes.
"""
references = [
    "https://www.proofpoint.com/us/blog/threat-insight/attackers-unleash-teamfiltration-account-takeover-campaign",
    "https://redcanary.com/blog/threat-detection/bav2ropc/",
    "https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth-ropc",
    "https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema",
    "https://www.huntress.com/blog/lshiy-password-spray-attack",
]
risk_score = 47
rule_id = "3d753eb2-68c4-404a-9279-91a3ad490765"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Identity",
    "Data Source: Microsoft 365",
    "Data Source: Microsoft 365 Audit Logs",
    "Use Case: Identity and Access Audit",
    "Tactic: Initial Access",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset: "o365.audit" and
    event.code: "AzureActiveDirectoryStsLogon" and
    event.action: "UserLoggedIn" and
    user_agent.original: "BAV2ROPC" and
    event.outcome: "success"
'''


[[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.new_terms]
field = "new_terms_fields"
value = ["o365.audit.UserId"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"


Stages and Predicates

Stage 1: new_terms

data_stream.dataset: "o365.audit" and
    event.code: "AzureActiveDirectoryStsLogon" and
    event.action: "UserLoggedIn" and
    user_agent.original: "BAV2ROPC" and
    event.outcome: "success"

Indicators

These rows show field, operator, and value matches.

Potential Code Injection via Remote Thread

#
Source
github.com/elastic/protections-artifacts

Identifies the creation of a thread in a remote process, this type of behavior may indicate inter-process code injection. Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

MITRE ATT&CK Coverage

TacticTechniques
Privilege Escalation

Rule Body

[rule]
description = """
Identifies the creation of a thread in a remote process, this type of behavior may indicate inter-process code
injection. Adversaries may inject code into processes in order to evade process-based defenses as well as possibly
elevate privileges.
"""
id = "458f0b4b-be9a-45bc-8f19-a26dac267250"
license = "Elastic License v2"
name = "Potential Code Injection via Remote Thread"
os_list = ["macos"]
reference = ["http://newosxbook.com/src.jl?tree=listings&file=inject.c"]
version = "1.0.31"

query = '''
process where event.action == "remote_thread" and
 not process.executable like
          ("/usr/libexec/rosetta/debugserver",
           "/Library/Developer/CoreSimulator/*/RemoteInjectionAgent",
           "/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent")
'''

min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: process

process where event.action == "remote_thread" and
 not process.executable like
          ("/usr/libexec/rosetta/debugserver",
           "/Library/Developer/CoreSimulator/*/RemoteInjectionAgent",
           "/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablewildcard/usr/libexec/rosetta/debugserver, /Library/Developer/CoreSimulator/*/RemoteInjectionAgent, /Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgentexcludes:process.executable field:"process.executable" value:"/usr/libexec/rosetta/debugserver" field:"process.executable" value:"/Library/Developer/CoreSimulator/*/RemoteInjectionAgent" field:"process.executable" value:"/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent"

Potential Netcat File Listener Established

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

Identifies the sequence of a file creation event followed by a process start event for netcat. This may indicate that a file listener has been established using netcat, which is often used for lateral movement or data exfiltration.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the sequence of a file creation event followed by a process start event for netcat. This may indicate that a
file listener has been established using netcat, which is often used for lateral movement or data exfiltration.
"""
id = "b3ab4040-1289-4a8a-959a-bb71c9b09afe"
license = "Elastic License v2"
name = "Potential Netcat File Listener Established"
os_list = ["linux"]
version = "1.0.7"

query = '''
sequence by process.entity_id with maxspan=5s
  [file where event.type == "creation" and file.path like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/home/*", "/root/*"
  )]
  [process where event.type == "start" and event.action == "exec" and
   process.name in ("nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional") and
   not (
     process.command_line like ("*127.0.0.1*", "*localhost*") or
     process.args like "-*z*"
   )]
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.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 = "T1570"
name = "Lateral Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1570/"


[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id.

Stage 1: file

[file where event.type == "creation" and file.path like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/home/*", "/root/*"
  )]

Stage 2: process

[process where event.type == "start" and event.action == "exec" and
   process.name in ("nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional") and
   not (
     process.command_line like ("*127.0.0.1*", "*localhost*") or
     process.args like "-*z*"
   )]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • creation
  • start
field:"event.type" kind:eq
file.pathwildcard
  • /dev/shm/*
  • /home/*
  • /root/*
  • /tmp/*
  • /var/tmp/*
field:"TargetFilename" kind:wildcard
process.namein
  • nc
  • nc.openbsd
  • nc.traditional
  • ncat
  • netcat
  • netcat.openbsd
  • netcat.traditional
field:"process_basename" kind:in

Exclusions

The rule actively suppresses these predicates.

Powershell Outbound Network Connection

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

Detects when Powershell (pwsh) on macOS makes an outbound network connection attempt. Powershell usage on macOS is extremely rare but usage of Powershell to connect out to the internet is almost always indicative of malicious behavior.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects when Powershell (pwsh) on macOS makes an outbound network connection attempt. Powershell usage on macOS is
extremely rare but usage of Powershell to connect out to the internet is almost always indicative of malicious behavior.
"""
id = "53aa049c-72d1-4ddf-b089-a86059642a35"
license = "Elastic License v2"
name = "Powershell Outbound Network Connection"
os_list = ["macos"]
version = "1.0.12"

query = '''
sequence by process.entity_id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and process.name == "pwsh"]
[network where event.type == "start" and event.action == "connection_attempted" and
   not cidrmatch(destination.ip, 
       "240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15", 
       "192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", 
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", 
       "100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
       "::1", "FE80::/10", "FF00::/8")]
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.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/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30s, correlated by process.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and process.name == "pwsh"]

Stage 2: network

[network where event.type == "start" and event.action == "connection_attempted" and
   not cidrmatch(destination.ip, 
       "240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15", 
       "192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", 
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", 
       "100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
       "::1", "FE80::/10", "FF00::/8")]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • connection_attempted corpus 72 (elastic 72)
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.nameeq
  • pwsh corpus 3 (elastic 3)
field:"process_basename" kind:eq value:"pwsh"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
destination.ipcidr_match240.0.0.0/4, 233.252.0.0/24, 224.0.0.0/4, 198.19.0.0/16, 192.18.0.0/15, 192.0.0.0/24, 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, ::1, FE80::/10, FF00::/8excludes:destination.ip

Suspicious Netcat Execution

#
Source
github.com/elastic/protections-artifacts

This rule detects the usage of netcat to connect to a remote host. This behavior may be indicative of a reverse shell connection being established.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule detects the usage of netcat to connect to a remote host. This behavior may be indicative of a reverse shell
connection being established.
"""
id = "a60859af-bd25-449d-bdb3-e71cb1725f58"
license = "Elastic License v2"
name = "Suspicious Netcat Execution"
os_list = ["linux"]
version = "1.0.2"

query = '''
process where event.type == "start" and event.action == "exec" and
process.name in ("nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional") and
process.args regex "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}" and
process.args_count >= 3 and
not (
  process.args like ("127.0.0.1", "127.0.0.01", "0.0.0.0", "::1", "-*z*", "--help", "8.8.8.8") or
  process.args regex """10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}""" or
  process.args regex """192\.168\.[0-9]{1,3}\.[0-9]{1,3}""" or
  process.args regex """172\.(1[6-9]|2[0-9]|3[0-1])\.[0-9]{1,3}\.[0-9]{1,3}""" or
  (process.parent.executable == "/usr/sbin/sshd" and process.args == "22")
)
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and
process.name in ("nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional") and
process.args regex "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}" and
process.args_count >= 3 and
not (
  process.args like ("127.0.0.1", "127.0.0.01", "0.0.0.0", "::1", "-*z*", "--help", "8.8.8.8") or
  process.args regex """10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}""" or
  process.args regex """192\.168\.[0-9]{1,3}\.[0-9]{1,3}""" or
  process.args regex """172\.(1[6-9]|2[0-9]|3[0-1])\.[0-9]{1,3}\.[0-9]{1,3}""" or
  (process.parent.executable == "/usr/sbin/sshd" and process.args == "22")
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq22excludes:process.args field:"process.args" value:"22"
process.parent.executableeq/usr/sbin/sshdexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/sbin/sshd"
process.argsregex_match10.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}excludes:process.args field:"process.args" value:"10.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}"
process.argsregex_match172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}excludes:process.args field:"process.args" value:"172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}"
process.argsregex_match192.168.[0-9]{1,3}.[0-9]{1,3}excludes:process.args field:"process.args" value:"192.168.[0-9]{1,3}.[0-9]{1,3}"
process.argswildcard127.0.0.1, 127.0.0.01, 0.0.0.0, ::1, -*z*, --help, 8.8.8.8excludes:process.args

Suspicious Path Invocation from Command Line

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

This rule detects the execution of a PATH variable in a command line invocation by a shell process. This behavior is unusual and may indicate an attempt to execute a command from a non-standard location. This technique may be used to evade detection or perform unauthorized actions on the system.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/06/14"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects the execution of a PATH variable in a command line invocation by a shell process. This behavior
is unusual and may indicate an attempt to execute a command from a non-standard location. This technique may be
used to evade detection or perform unauthorized actions on the system.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "kuery"
license = "Elastic License v2"
name = "Suspicious Path Invocation from Command Line"
references = ["https://blog.exatrack.com/Perfctl-using-portainer-and-new-persistences/"]
risk_score = 21
rule_id = "82f842c2-7c36-438c-b562-5afe54ab11f4"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:process and host.os.type:linux and event.type:start and event.action:exec and
process.name:(bash or csh or dash or fish or ksh or sh or tcsh or zsh) and process.args:-c and
process.command_line:*PATH=* and
not (
  process.command_line:(*_PATH=* or *PYTHONPATH=* or sh*/run/motd.dynamic.new) or
  process.parent.executable:(
    "/opt/puppetlabs/puppet/bin/puppet" or /var/lib/docker/overlay2/* or /vz/root/*/dovecot or
    "/usr/libexec/dovecot/auth" or /home/*/.local/share/containers/* or /vz/root/*/dovecot/auth or
    "/usr/local/bin/ansible-playbook" or "/opt/puppetlabs/puppet/bin/ruby" or /tmp/CVU_19_resource_*/exectask or
    "/opt/ds_agent/ds_agent" or "/usr/lib/systemd/systemd" or "/opt/TrendMicro/vls_agent/vls_agent" or
    "/opt/Tanium/TaniumClient/TaniumCX"
  ) or
  process.parent.command_line:"runc init" or
  process.parent.name:(gmake or sshd or sudo or make or ninja or ninja-build or steam or sshd-session)
)
'''
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 Path Invocation from Command Line

In Linux environments, shell processes like bash or zsh execute commands, often using the PATH variable to locate executables. Adversaries may manipulate PATH to run malicious scripts from non-standard directories, evading detection. The detection rule identifies unusual PATH assignments in command lines, signaling potential unauthorized actions by monitoring specific shell invocations and command patterns.

### Possible investigation steps

- Review the command line details captured in the alert to identify the specific PATH assignment and the command being executed. This can provide insight into whether the command is expected or potentially malicious.
- Check the process tree to understand the parent process and any child processes spawned by the suspicious shell invocation. This can help determine the context in which the command was executed.
- Investigate the user account associated with the process to determine if the activity aligns with the user's typical behavior or if the account may have been compromised.
- Examine the directory from which the command is being executed to verify if it is a non-standard or suspicious location. Look for any unusual files or scripts in that directory.
- Cross-reference the event with other security logs or alerts to identify any correlated activities that might indicate a broader attack or compromise.
- Assess the system's recent changes or updates to determine if they could have inadvertently caused the PATH modification or if it was intentionally altered by an adversary.

### False positive analysis

- System administrators or developers may intentionally modify the PATH variable for legitimate purposes, such as testing scripts or applications in development environments. To handle this, create exceptions for known users or specific directories commonly used for development.
- Automated scripts or configuration management tools might alter the PATH variable as part of their normal operation. Identify these scripts and exclude their execution paths or user accounts from triggering alerts.
- Some software installations or updates may temporarily change the PATH variable to include non-standard directories. Monitor installation processes and whitelist these activities when performed by trusted sources.
- Custom shell configurations or user profiles might include PATH modifications for convenience or performance reasons. Review and document these configurations, and exclude them from detection if they are verified as non-threatening.
- Educational or training environments where users experiment with shell commands may frequently trigger this rule. Consider excluding specific user groups or environments dedicated to learning and experimentation.

### Response and remediation

- Immediately isolate the affected system from the network to prevent potential lateral movement or data exfiltration.
- Terminate any suspicious processes identified by the alert to stop any ongoing unauthorized actions.
- Review the command history and PATH variable changes on the affected system to identify any unauthorized modifications or scripts executed from non-standard directories.
- Restore the PATH variable to its default state to ensure that only trusted directories are used for command execution.
- Conduct a thorough scan of the system using updated antivirus or endpoint detection tools to identify and remove any malicious scripts or files.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected.
- Implement monitoring for similar PATH manipulation attempts across the network to enhance detection and prevent recurrence."""

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"

[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"

[[rule.threat.technique.subtechnique]]
id = "T1574.007"
name = "Path Interception by PATH Environment Variable"
reference = "https://attack.mitre.org/techniques/T1574/007/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.parent.name"]

[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"

Stages and Predicates

Stage 1: new_terms

event.category:process and host.os.type:linux and event.type:start and event.action:exec and
process.name:(bash or csh or dash or fish or ksh or sh or tcsh or zsh) and process.args:-c and
process.command_line:*PATH=* and
not (
  process.command_line:(*_PATH=* or *PYTHONPATH=* or sh*/run/motd.dynamic.new) or
  process.parent.executable:(
    "/opt/puppetlabs/puppet/bin/puppet" or /var/lib/docker/overlay2dovecot or
    "/usr/libexec/dovecot/auth" or /homedovecot/auth or
    "/usr/local/bin/ansible-playbook" or "/opt/puppetlabs/puppet/bin/ruby" or /tmp/CVU_19_resource_*/exectask or
    "/opt/ds_agent/ds_agent" or "/usr/lib/systemd/systemd" or "/opt/TrendMicro/vls_agent/vls_agent" or
    "/opt/Tanium/TaniumClient/TaniumCX"
  ) or
  process.parent.command_line:"runc init" or
  process.parent.name:(gmake or sshd or sudo or make or ninja or ninja-build or steam or sshd-session)
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linematchPYTHONPATH=excludes:process.command_line field:"process.command_line" value:"PYTHONPATH="
process.command_linematch_PATH=excludes:process.command_line field:"process.command_line" value:"_PATH="
process.command_linewildcardsh*/run/motd.dynamic.newexcludes:process.command_line field:"process.command_line" value:"sh*/run/motd.dynamic.new"
process.parent.command_lineeqrunc initexcludes:process.parent.command_line field:"process.parent.command_line" value:"runc init"
process.parent.executableeq/opt/Tanium/TaniumClient/TaniumCXexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/Tanium/TaniumClient/TaniumCX"
process.parent.executableeq/opt/TrendMicro/vls_agent/vls_agentexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/TrendMicro/vls_agent/vls_agent"
process.parent.executableeq/opt/ds_agent/ds_agentexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/ds_agent/ds_agent"
process.parent.executableeq/opt/puppetlabs/puppet/bin/puppetexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/puppetlabs/puppet/bin/puppet"
process.parent.executableeq/opt/puppetlabs/puppet/bin/rubyexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/puppetlabs/puppet/bin/ruby"
process.parent.executableeq/usr/lib/systemd/systemdexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/lib/systemd/systemd"
process.parent.executableeq/usr/libexec/dovecot/authexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/libexec/dovecot/auth"
process.parent.executableeq/usr/local/bin/ansible-playbookexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/local/bin/ansible-playbook"
process.parent.executablestarts_with/var/lib/docker/overlay2/excludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/docker/overlay2/"
process.parent.executablewildcard/home/*/.local/share/containers/*excludes:process.parent.executable field:"process.parent.executable" value:"/home/*/.local/share/containers/*"
process.parent.executablewildcard/tmp/CVU_19_resource_*/exectaskexcludes:process.parent.executable field:"process.parent.executable" value:"/tmp/CVU_19_resource_*/exectask"
process.parent.executablewildcard/vz/root/*/dovecotexcludes:process.parent.executable field:"process.parent.executable" value:"/vz/root/*/dovecot"
process.parent.executablewildcard/vz/root/*/dovecot/authexcludes:process.parent.executable field:"process.parent.executable" value:"/vz/root/*/dovecot/auth"
process.parent.nameingmake, make, ninja, ninja-build, sshd, sshd-session, steam, sudoexcludes:process.parent.name

Untrusted DLL Loaded by a System Windows Process

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to load an unsigned and untrusted module by a SYSTEM process. This may indicate an attempt to elevate privileges via DLL search order hijacking.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies attempts to load an unsigned and untrusted module by a SYSTEM process. This may indicate an attempt to
elevate privileges via DLL search order hijacking.
"""
id = "39224ead-14f3-4df3-b6ed-ec69dc17db3a"
license = "Elastic License v2"
name = "Untrusted DLL Loaded by a System Windows Process"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/itw-windows-lpe-0days-insights-and-detection-strategies"]
version = "1.0.9"

query = '''
library where 
  process.code_signature.subject_name : "Microsoft *" and dll.hash.sha256 != null and 
  user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and not dll.code_signature.status : "trusted" and 
  dll.Ext.relative_file_creation_time <= 500 and 
  /* svchost covered by fce4b49f-59ff-464e-a69b-e3b38841b5fe */
  not process.name : ("rundll32.exe", "regsvr32.exe", "powershell.exe", "msiexec.exe", "svchost.exe", "w3wp.exe") and
  not dll.path : ("?:\\Windows\\system32\\*", 
                  "?:\\Windows\\syswow64\\*",
                  "?:\\Program Files (x86)\\*",
                  "?:\\Program Files\\*",
                  "?:\\Windows\\Installer\\*",
                  "?:\\Windows\\SystemTemp\\*",
                  "?:\\Windows\\SoftwareDistribution\\*",
                  "?:\\Windows\\WinSxS\\*",
                  "?:\\Windows\\assembly\\*") and
  process.executable :
               ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*", 
                "?:\\Program Files\\Windows *", 
                "?:\\Program Files (x86)\\Windows *", 
                "?:\\Program Files\\Common Files\\Microsoft*",
                "?:\\Program Files (x86)\\Common Files\\Microsoft*") and
  not dll.hash.sha256 :
                ("bf14ce30695de66d8040cb893ba72fb205add0404091cc889e5b4d18b368303b",
                 "94c62f5a203c21b8f7e100d95454d06081fca0bfda3e9259cd300a2f3b8c92b1",
                 "82a6b0eb4c223692946120f8b821e7f60b3b7b13d94ad10a7f7413f2c3e46547",
                 "e40828a0802b3bf759978a7b68b9534c55bf57036de1f872ccbce38ad2afa20b",
                 "20c86c2897eda813fd36fff693b722928db74d5d923046f4a36b4a6066919172",
                 "27912b78125ffcbef3f7239ab394552b1c0d188a0275f691bfaa87e072795bf9",
                 "90b969f3af89ff58628f6eb454294a9a4c494109b6b1eb255ce0ab117ef2ec3b",
                 "8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c",
                 "6b0e8b8976c2c33e1a9479481e0b52967f28d18ca4b7cb4058f87ac277720930",
                 "9b1a9c33beaefa3b30176d4214430de9ccd87af7d754ac36ba0c96d31dbd2362",
                 "4fb824b88b2301635ffe41117bdb8b2b34de6b1aef1650b292f834a1536f887c", 
                 "8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c", 
                 "bb64e0a09e4a99eea783cb5063edb180e0938f4fdf6f99dd285e198218d544c9", 
                 "837cfaafe17eeb3eceabbf6260c409efedf6220e93baef34ffe09e00e53ed607", 
                 "57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7")
'''

min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"



[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Stage 1: library

library where
  process.code_signature.subject_name : "Microsoft *" and dll.hash.sha256 != null and
  user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and not dll.code_signature.status : "trusted" and
  dll.Ext.relative_file_creation_time <= 500 and
  not process.name : ("rundll32.exe", "regsvr32.exe", "powershell.exe", "msiexec.exe", "svchost.exe", "w3wp.exe") and
  not dll.path : ("?:\\Windows\\system32\\*",
                  "?:\\Windows\\syswow64\\*",
                  "?:\\Program Files (x86)\\*",
                  "?:\\Program Files\\*",
                  "?:\\Windows\\Installer\\*",
                  "?:\\Windows\\SystemTemp\\*",
                  "?:\\Windows\\SoftwareDistribution\\*",
                  "?:\\Windows\\WinSxS\\*",
                  "?:\\Windows\\assembly\\*") and
  process.executable :
               ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*",
                "?:\\Program Files\\Windows *",
                "?:\\Program Files (x86)\\Windows *",
                "?:\\Program Files\\Common Files\\Microsoft*",
                "?:\\Program Files (x86)\\Common Files\\Microsoft*") and
  not dll.hash.sha256 :
                ("bf14ce30695de66d8040cb893ba72fb205add0404091cc889e5b4d18b368303b",
                 "94c62f5a203c21b8f7e100d95454d06081fca0bfda3e9259cd300a2f3b8c92b1",
                 "82a6b0eb4c223692946120f8b821e7f60b3b7b13d94ad10a7f7413f2c3e46547",
                 "e40828a0802b3bf759978a7b68b9534c55bf57036de1f872ccbce38ad2afa20b",
                 "20c86c2897eda813fd36fff693b722928db74d5d923046f4a36b4a6066919172",
                 "27912b78125ffcbef3f7239ab394552b1c0d188a0275f691bfaa87e072795bf9",
                 "90b969f3af89ff58628f6eb454294a9a4c494109b6b1eb255ce0ab117ef2ec3b",
                 "8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c",
                 "6b0e8b8976c2c33e1a9479481e0b52967f28d18ca4b7cb4058f87ac277720930",
                 "9b1a9c33beaefa3b30176d4214430de9ccd87af7d754ac36ba0c96d31dbd2362",
                 "4fb824b88b2301635ffe41117bdb8b2b34de6b1aef1650b292f834a1536f887c",
                 "8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c",
                 "bb64e0a09e4a99eea783cb5063edb180e0938f4fdf6f99dd285e198218d544c9",
                 "837cfaafe17eeb3eceabbf6260c409efedf6220e93baef34ffe09e00e53ed607",
                 "57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 11 (elastic 11)
field:"dll.Ext.relative_file_creation_time" kind:le value:"500"
dll.hash.sha256is_not_null
  • (no value, null check)
field:"Hashes" kind:is_not_null
process.code_signature.subject_namewildcard
  • Microsoft * corpus 10 (elastic 10)
field:"Signature" kind:wildcard value:"Microsoft *"
process.executablewildcard
  • ?:\Program Files (x86)\Common Files\Microsoft*
  • ?:\Program Files (x86)\Microsoft\* corpus 3 (elastic 3)
  • ?:\Program Files (x86)\Windows * corpus 2 (elastic 2)
  • ?:\Program Files\Common Files\Microsoft*
  • ?:\Program Files\Microsoft\* corpus 3 (elastic 3)
  • ?:\Program Files\Windows * corpus 2 (elastic 2)
  • ?:\Windows\system32\* corpus 6 (elastic 6)
  • ?:\Windows\syswow64\* corpus 6 (elastic 6)
field:"Image" kind:wildcard
user.idwildcard
  • S-1-5-18 corpus 13 (elastic 13)
  • S-1-5-19 corpus 3 (elastic 3)
  • S-1-5-20 corpus 3 (elastic 3)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.statuseqtrustedexcludes:dll.code_signature.status field:"dll.code_signature.status" value:"trusted"
dll.hash.sha256eqbf14ce30695de66d8040cb893ba72fb205add0404091cc889e5b4d18b368303b, 94c62f5a203c21b8f7e100d95454d06081fca0bfda3e9259cd300a2f3b8c92b1, 82a6b0eb4c223692946120f8b821e7f60b3b7b13d94ad10a7f7413f2c3e46547, e40828a0802b3bf759978a7b68b9534c55bf57036de1f872ccbce38ad2afa20b, 20c86c2897eda813fd36fff693b722928db74d5d923046f4a36b4a6066919172, 27912b78125ffcbef3f7239ab394552b1c0d188a0275f691bfaa87e072795bf9, 90b969f3af89ff58628f6eb454294a9a4c494109b6b1eb255ce0ab117ef2ec3b, 8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c, 6b0e8b8976c2c33e1a9479481e0b52967f28d18ca4b7cb4058f87ac277720930, 9b1a9c33beaefa3b30176d4214430de9ccd87af7d754ac36ba0c96d31dbd2362, 4fb824b88b2301635ffe41117bdb8b2b34de6b1aef1650b292f834a1536f887c, 8ccf0fea4b737acd56b328c3bbde7006df054ca5dc1dc2b978104c633d82d47c, bb64e0a09e4a99eea783cb5063edb180e0938f4fdf6f99dd285e198218d544c9, 837cfaafe17eeb3eceabbf6260c409efedf6220e93baef34ffe09e00e53ed607, 57ec9182ffb5e1baf5c105eb531111d11de1c8bb5c46740ae3dae557e40dffe7excludes:dll.hash.sha256
dll.pathstarts_with?:\Windows\system32\, ?:\Windows\syswow64\, ?:\Program Files (x86)\, ?:\Program Files\, ?:\Windows\Installer\, ?:\Windows\SystemTemp\, ?:\Windows\SoftwareDistribution\, ?:\Windows\WinSxS\, ?:\Windows\assembly\excludes:dll.path
process.nameeqrundll32.exe, regsvr32.exe, powershell.exe, msiexec.exe, svchost.exe, w3wp.exeexcludes:process.name

Unusual High Word Policy Blocks Detected

#
Status
production
Severity
medium
Time window
1h
Group by
user.id
Author
Elastic
Source
github.com/elastic/detection-rules

Detects repeated compliance violation 'BLOCKED' actions coupled with specific policy name such as 'word_policy', indicating persistent misuse or attempts to probe the model's denied topics.

Known False Positives

  • New model deployments.
  • Testing updates to compliance policies.

MITRE ATLAS Coverage

Adversarial-ML threat framework (not MITRE ATT&CK).

TacticTechniques
Execution
Privilege Escalation
Defense Evasion

Rule Body

[metadata]
creation_date = "2024/11/20"
integration = ["aws_bedrock"]
maturity = "production"
updated_date = "2025/11/10"

[rule]
author = ["Elastic"]
description = """
Detects repeated compliance violation 'BLOCKED' actions coupled with specific policy name such as 'word_policy',
indicating persistent misuse or attempts to probe the model's denied topics.
"""
false_positives = ["New model deployments.", "Testing updates to compliance policies."]
from = "now-60m"
interval = "10m"
language = "esql"
license = "Elastic License v2"
name = "Unusual High Word Policy Blocks Detected"
note = """## Triage and analysis

### Investigating Unusual High Word Policy Blocks Detected

Amazon Bedrock Guardrail is a set of features within Amazon Bedrock designed to help businesses apply robust safety and privacy controls to their generative AI applications.

It enables users to set guidelines and filters that manage content quality, relevancy, and adherence to responsible AI practices.

Through Guardrail, organizations can define "word filters" to prevent the model from generating content on profanity, undesired subjects,
and they can establish thresholds for harmful content categories, including hate speech, violence, or offensive language.

#### Possible investigation steps

- Identify the user account whose prompts contained profanity and whether it should perform this kind of action.
- Investigate other alerts associated with the user account during the past 48 hours.
- Consider the time of day. If the user is a human (not a program or script), did the activity take place during a normal time of day?
- Examine the account's prompts and responses in the last 24 hours.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking Amazon Bedrock model access, prompts generated, and responses to the prompts by the account in the last 24 hours.

### False positive analysis

- Verify the user account that queried denied topics, is not testing any new model deployments or updated compliance policies in Amazon Bedrock guardrails.

### 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.
    - Identify if the attacker is moving laterally and compromising other Amazon Bedrock Services.
    - Identify any regulatory or legal ramifications related to this activity.
- Review the permissions assigned to the implicated user group or role behind these requests to ensure they are authorized and expected to access bedrock and ensure that the least privilege principle is being followed.
- 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.aws.amazon.com/bedrock/latest/userguide/guardrails-components.html",
    "https://atlas.mitre.org/techniques/AML.T0051",
    "https://atlas.mitre.org/techniques/AML.T0054",
    "https://www.elastic.co/security-labs/elastic-advances-llm-security",
]
risk_score = 47
rule_id = "3216949c-9300-4c53-b57a-221e364c6457"
setup = """## Setup

This rule requires that guardrails are configured in AWS Bedrock. For more information, see the AWS Bedrock documentation:

https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-create.html
"""
severity = "medium"
tags = [
    "Domain: LLM",
    "Data Source: AWS Bedrock",
    "Data Source: AWS S3",
    "Use Case: Policy Violation",
    "Mitre Atlas: T0051",
    "Mitre Atlas: T0054",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-aws_bedrock.invocation-*

// Expand multivalued policy names
| mv_expand gen_ai.policy.name
| mv_expand gen_ai.policy.action

// Filter for blocked profanity-related policy violations
| where
  gen_ai.policy.action == "BLOCKED"
  and gen_ai.compliance.violation_detected == "true"
  and gen_ai.policy.name == "word_policy"

// keep relevant user field
| keep user.id

// count blocked profanity attempts per user
| stats
    Esql.ml_policy_blocked_profanity_count = count()
  by user.id

// Filter for excessive policy violations
| where Esql.ml_policy_blocked_profanity_count > 5

// sort by violation volume
| sort Esql.ml_policy_blocked_profanity_count desc
'''

Stages and Predicates

Stage 1: from

from logs-aws_bedrock.invocation-*

Stage 2: mv_expand

| mv_expand gen_ai.policy.name

Stage 3: mv_expand

| mv_expand gen_ai.policy.action

Stage 4: where

| where
  gen_ai.policy.action == "BLOCKED"
  and gen_ai.compliance.violation_detected == "true"
  and gen_ai.policy.name == "word_policy"

Stage 5: keep

| keep user.id

Stage 6: stats

| stats
    Esql.ml_policy_blocked_profanity_count = count()
  by user.id

Stage 7: where

| where Esql.ml_policy_blocked_profanity_count > 5

Stage 8: sort

| sort Esql.ml_policy_blocked_profanity_count desc

Indicators

These rows show field, operator, and value matches.

Output Fields

These fields are emitted when the rule matches.

FieldSource
Esql.ml_policy_blocked_profanity_countSTATS Esql.ml_policy_blocked_profanity_count = count()
user.idSTATS BY

Web Application Suspicious Activity: POST Request Declined

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

A POST request to a web application returned a 403 response, which indicates the web application declined to process the request because the action requested was not allowed.

Known False Positives

  • Security scans and tests may result in these errors. Misconfigured or buggy applications may produce large numbers of these errors. If the source is unexpected, the user unauthorized, or the request unusual, these may indicate suspicious or malicious activity.

Rule Body

[metadata]
creation_date = "2020/02/18"
integration = ["apm"]
maturity = "production"
updated_date = "2026/07/19"

[rule]
author = ["Elastic"]
description = """
A POST request to a web application returned a 403 response, which indicates the web application declined to process the
request because the action requested was not allowed.
"""
false_positives = [
    """
    Security scans and tests may result in these errors. Misconfigured or buggy applications may produce large numbers
    of these errors. If the source is unexpected, the user unauthorized, or the request unusual, these may indicate
    suspicious or malicious activity.
    """,
]
index = ["apm-*-transaction*", "traces-apm*"]
language = "kuery"
license = "Elastic License v2"
name = "Web Application Suspicious Activity: POST Request Declined"
references = ["https://en.wikipedia.org/wiki/HTTP_403"]
risk_score = 47
rule_id = "a87a4e42-1d82-44bd-b0bf-d9b7f91fb89e"
severity = "medium"
tags = ["Data Source: APM", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"

query = '''
http.response.status_code:403 and http.request.method:(POST or post)
'''
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 Web Application Suspicious Activity: POST Request Declined

Web applications often use POST requests to handle data submissions securely. However, adversaries may exploit this by attempting unauthorized actions, triggering a 403 error when access is denied. The detection rule identifies such anomalies by flagging POST requests that receive a 403 response, indicating potential misuse or probing attempts, thus aiding in early threat detection.

### Possible investigation steps

- Review the source IP address and user agent associated with the POST request to identify any patterns or known malicious actors.
- Examine the URL or endpoint targeted by the POST request to determine if it is a sensitive or restricted resource.
- Check the timestamp of the request to see if it coincides with other suspicious activities or known attack patterns.
- Analyze the frequency and volume of similar 403 POST requests from the same source to assess if this is part of a larger probing or attack attempt.
- Investigate any recent changes or updates to the web application that might have inadvertently triggered legitimate requests to be denied.

### False positive analysis

- Legitimate API interactions may trigger 403 responses if the API endpoint is accessed without proper authentication or authorization. Review API access logs to identify and whitelist known applications or users that frequently interact with the API.
- Web application firewalls (WAFs) might block certain POST requests due to predefined security rules, resulting in 403 errors. Analyze WAF logs to determine if specific rules are causing false positives and adjust the ruleset accordingly.
- Automated scripts or bots performing routine tasks might inadvertently trigger 403 responses. Identify these scripts and ensure they are configured with the necessary permissions or exclude their IP addresses from the detection rule.
- User error, such as incorrect form submissions or missing required fields, can lead to 403 responses. Educate users on proper form usage and consider implementing client-side validation to reduce these occurrences.
- Maintenance or configuration changes in the web application might temporarily cause 403 errors. Coordinate with the development or operations team to understand scheduled changes and adjust monitoring rules during these periods.

### Response and remediation

- Immediately review the logs associated with the 403 POST requests to identify the source IP addresses and user agents involved. Block any suspicious IP addresses at the firewall or web application firewall (WAF) to prevent further unauthorized attempts.
- Conduct a thorough review of the web application's access control policies and permissions to ensure that they are correctly configured to prevent unauthorized actions.
- Check for any recent changes or updates to the web application that might have inadvertently altered access controls or introduced vulnerabilities, and roll back or patch as necessary.
- Notify the security operations team to monitor for any additional suspicious activity from the identified IP addresses or similar patterns, and escalate to incident response if further malicious activity is detected.
- Implement additional logging and monitoring for POST requests that result in 403 responses to enhance detection capabilities and gather more context for future incidents.
- Review and update the web application firewall (WAF) rules to better detect and block unauthorized POST requests, ensuring that legitimate traffic is not affected.
- If applicable, engage with the development team to conduct a security review of the application code to identify and fix any potential vulnerabilities that could be exploited by attackers."""

Stages and Predicates

Stage 1: query

http.response.status_code:403 and http.request.method:(POST or post)

Indicators

These rows show field, operator, and value matches.

Windows Script Interpreter Executing Process via WMI

#
Status
production
Severity
medium
Time window
5s
Sequence by
host.id
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies use of the built-in Windows script interpreters (cscript.exe or wscript.exe) being used to execute a process via Windows Management Instrumentation (WMI). This may be indicative of malicious activity.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2020/11/27"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/04"

[rule]
author = ["Elastic"]
description = """
Identifies use of the built-in Windows script interpreters (cscript.exe or wscript.exe) being used to execute a process
via Windows Management Instrumentation (WMI). This may be indicative of malicious activity.
"""
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.process-*",
    "logs-endpoint.events.library-*",
    "logs-windows.sysmon_operational-*",
    "endgame-*",
]
language = "eql"
license = "Elastic License v2"
name = "Windows Script Interpreter Executing Process via WMI"
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Windows Script Interpreter Executing Process via WMI

Windows Management Instrumentation (WMI) is a powerful Windows feature that allows for system management and automation. Adversaries exploit WMI to execute scripts or processes stealthily, often using script interpreters like cscript.exe or wscript.exe. The detection rule identifies suspicious activity by monitoring for these interpreters executing processes via WMI, especially when initiated by non-system accounts, indicating potential malicious intent.

### Possible investigation steps

- Review the alert details to identify the specific script interpreter (cscript.exe or wscript.exe) and the process it executed. Check the process name and executable path for any anomalies or known malicious indicators.
- Examine the user account associated with the process execution. Verify if the user domain is not "NT AUTHORITY" and assess whether the account is expected to perform such actions. Investigate any unusual or unauthorized account activity.
- Investigate the parent process wmiprvse.exe to determine how it was initiated. Look for any preceding suspicious activities or processes that might have triggered the WMI execution.
- Check the system for any additional indicators of compromise, such as unexpected network connections, changes in system configurations, or other alerts related to the same host or user.
- Correlate the event with other security logs and alerts to identify any patterns or related incidents that might indicate a broader attack campaign or persistent threat.

### False positive analysis

- Legitimate administrative scripts or automation tasks may trigger this rule if they use cscript.exe or wscript.exe via WMI. To handle this, identify and document these scripts, then create exceptions for their specific execution paths or user accounts.
- Software installations or updates that utilize script interpreters through WMI can be mistaken for malicious activity. Monitor and whitelist known installation processes or update mechanisms that are frequently used in your environment.
- Custom applications or internal tools that rely on WMI for process execution might be flagged. Review these applications and exclude their specific process names or executable paths from the rule.
- Scheduled tasks or system maintenance scripts executed by non-system accounts could generate alerts. Verify these tasks and exclude them by specifying the user accounts or domains that are authorized to perform such actions.
- Security tools or monitoring solutions that leverage WMI for legitimate purposes may also be detected. Identify these tools and add them to the exception list based on their process names or executable locations.

### Response and remediation

- Immediately isolate the affected host from the network to prevent further malicious activity and lateral movement.
- Terminate any suspicious processes identified in the alert, such as cscript.exe or wscript.exe, that are running under non-system accounts.
- Conduct a thorough review of the affected host's scheduled tasks, startup items, and services to identify and remove any persistence mechanisms.
- Analyze the parent process wmiprvse.exe and its command-line arguments to understand the scope of the attack and identify any additional compromised systems.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if the threat is part of a larger campaign.
- Implement additional monitoring and alerting for similar activities across the network, focusing on WMI-based script execution and non-standard process launches.
- Review and update endpoint protection policies to block or alert on the execution of high-risk processes like those listed in the detection query, especially when initiated by non-system accounts."""
risk_score = 47
rule_id = "b64b183e-1a76-422d-9179-7b389513e74d"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Initial Access",
    "Tactic: Execution",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Resources: Investigation Guide",
]
type = "eql"

query = '''
sequence by host.id with maxspan = 5s
    [any where host.os.type == "windows" and
     (event.category : ("library", "driver") or (event.category == "process" and event.action : "Image loaded*")) and
     (?dll.name : "wmiutils.dll" or file.name : "wmiutils.dll") and process.name : ("wscript.exe", "cscript.exe")]
    [process where host.os.type == "windows" and event.type == "start" and
     process.parent.name : "wmiprvse.exe" and
     user.domain != "NT AUTHORITY" and
     (process.pe.original_file_name :
        (
          "cscript.exe",
          "wscript.exe",
          "PowerShell.EXE",
          "Cmd.Exe",
          "MSHTA.EXE",
          "RUNDLL32.EXE",
          "REGSVR32.EXE",
          "MSBuild.exe",
          "InstallUtil.exe",
          "RegAsm.exe",
          "RegSvcs.exe",
          "msxsl.exe",
          "CONTROL.EXE",
          "EXPLORER.EXE",
          "Microsoft.Workflow.Compiler.exe",
          "msiexec.exe"
        ) or
      process.executable : ("C:\\Users\\*.exe", "C:\\ProgramData\\*.exe")
     )
    ]
'''

setup = """## Setup

This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.

Setup instructions: https://ela.st/install-elastic-defend

### Additional data sources

This rule also supports the following third-party data sources. For setup instructions, refer to the links below:

- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Sysmon Event ID 7 - Image Loaded](https://ela.st/sysmon-event-7-setup)
"""


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"

[[rule.threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"

[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 = "T1047"
name = "Windows Management Instrumentation"
reference = "https://attack.mitre.org/techniques/T1047/"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"

[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5s, correlated by host.id.

Stage 1: any

[any where host.os.type == "windows" and
     (event.category : ("library", "driver") or (event.category == "process" and event.action : "Image loaded*")) and
     (?dll.name : "wmiutils.dll" or file.name : "wmiutils.dll") and process.name : ("wscript.exe", "cscript.exe")]

Stage 2: process

[process where host.os.type == "windows" and event.type == "start" and
     process.parent.name : "wmiprvse.exe" and
     user.domain != "NT AUTHORITY" and
     (process.pe.original_file_name :
        (
          "cscript.exe",
          "wscript.exe",
          "PowerShell.EXE",
          "Cmd.Exe",
          "MSHTA.EXE",
          "RUNDLL32.EXE",
          "REGSVR32.EXE",
          "MSBuild.exe",
          "InstallUtil.exe",
          "RegAsm.exe",
          "RegSvcs.exe",
          "msxsl.exe",
          "CONTROL.EXE",
          "EXPLORER.EXE",
          "Microsoft.Workflow.Compiler.exe",
          "msiexec.exe"
        ) or
      process.executable : ("C:\\Users\\*.exe", "C:\\ProgramData\\*.exe")
     )
    ]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namewildcard
  • wmiutils.dll corpus 6 (elastic 6)
field:"dll.name" kind:wildcard value:"wmiutils.dll"
event.actionwildcard
  • Image loaded* corpus 10 (elastic 10)
field:"EventType" kind:wildcard value:"Image loaded*"
event.categoryeq
  • process corpus 38 (elastic 38)
field:"event.category" kind:eq value:"process"
event.categorywildcard
  • driver corpus 7 (elastic 7)
  • library corpus 11 (elastic 11)
field:"event.category" kind:wildcard
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
file.namewildcard
  • wmiutils.dll corpus 2 (elastic 2)
field:"file.name" kind:wildcard value:"wmiutils.dll"
process.executablewildcard
  • C:\ProgramData\*.exe corpus 3 (elastic 3)
  • C:\Users\*.exe corpus 3 (elastic 3)
field:"Image" kind:wildcard
process.namewildcard
  • cscript.exe corpus 68 (elastic 66, splunk 2)
  • wscript.exe corpus 84 (elastic 82, splunk 1, kusto 1)
field:"process_basename" kind:wildcard
process.parent.namewildcard
  • wmiprvse.exe corpus 24 (elastic 19, splunk 5)
field:"parent_process_basename" kind:wildcard value:"wmiprvse.exe"
process.pe.original_file_namewildcard
  • CONTROL.EXE corpus 3 (elastic 2, splunk 1)
  • Cmd.Exe corpus 75 (sigma 43, splunk 17, elastic 15)
  • EXPLORER.EXE corpus 4 (elastic 3, splunk 1)
  • InstallUtil.exe corpus 19 (elastic 9, sigma 6, splunk 4)
  • MSBuild.exe corpus 16 (elastic 11, splunk 4, sigma 1)
  • MSHTA.EXE corpus 40 (elastic 21, sigma 13, splunk 6)
  • Microsoft.Workflow.Compiler.exe corpus 11 (elastic 6, sigma 3, splunk 2)
  • PowerShell.EXE corpus 134 (sigma 86, splunk 30, elastic 18)
  • REGSVR32.EXE corpus 37 (sigma 17, elastic 15, splunk 5)
  • RUNDLL32.EXE corpus 72 (sigma 35, splunk 21, elastic 16)
  • RegAsm.exe corpus 13 (sigma 6, elastic 6, splunk 1)
  • RegSvcs.exe corpus 12 (elastic 6, sigma 5, splunk 1)
  • cscript.exe corpus 32 (sigma 17, elastic 15)
  • msiexec.exe corpus 18 (elastic 9, sigma 5, splunk 4)
  • msxsl.exe corpus 9 (elastic 6, sigma 3)
  • wscript.exe corpus 37 (elastic 20, sigma 17)
field:"OriginalFileName" kind:wildcard
user.domainne
  • NT AUTHORITY corpus 5 (elastic 5)
field:"TargetDomainName" kind:ne value:"NT AUTHORITY"

Back to all Elastic rules