Detection rules › Elastic

Elastic rules: 0r

AWS EC2 Deprecated AMI Discovery

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

Identifies when a user has queried for deprecated Amazon Machine Images (AMIs) in AWS. This may indicate an adversary looking for outdated AMIs that may be vulnerable to exploitation. While deprecated AMIs are not inherently malicious or indicative of a breach, they may be more susceptible to vulnerabilities and should be investigated for potential security risks.

Known False Positives

  • Legitimate use of deprecated AMIs for testing or development purposes.
  • Automated tools or scripts that query for deprecated AMIs as part of a security assessment.
  • Misconfigured applications or services that rely on deprecated AMIs for compatibility reasons.
  • Administrators or developers who are unaware of the deprecation status of AMIs they are using.

MITRE ATT&CK Coverage

TacticTechniques
Discovery

Telemetry Coverage

Rule Body

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

[rule]
author = ["Elastic"]
description = """
Identifies when a user has queried for deprecated Amazon Machine Images (AMIs) in AWS. This may indicate an adversary looking for outdated AMIs that may be vulnerable to exploitation. While deprecated AMIs are not inherently malicious or indicative of a breach, they may be more susceptible to vulnerabilities and should be investigated for potential security risks.
"""
false_positives = [
    "Legitimate use of deprecated AMIs for testing or development purposes.",
    "Automated tools or scripts that query for deprecated AMIs as part of a security assessment.",
    "Misconfigured applications or services that rely on deprecated AMIs for compatibility reasons.",
    "Administrators or developers who are unaware of the deprecation status of AMIs they are using.",
]
from = "now-6m"
interval = "5m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EC2 Deprecated AMI Discovery"
note = """## Triage and analysis

### Investigating AWS EC2 Deprecated AMI Discovery

This rule detects when a user queries AWS for deprecated Amazon Machine Images (AMIs). While deprecated AMIs are not inherently malicious, their use can introduce vulnerabilities or misconfigurations. Adversaries may exploit deprecated AMIs in search of outdated or unpatched systems. Investigating these queries can help identify potential risks or misconfigurations.

### Possible investigation steps

**Identify the user**:
   - Review the `aws.cloudtrail.user_identity.arn` field to determine the AWS user or role making the request.
   - Check `aws.cloudtrail.user_identity.type` and `aws.cloudtrail.user_identity.access_key_id` to verify the type of access (e.g., IAM user, role, or federated identity).

**Analyze the source**:
   - Review the `source.ip` field to determine the IP address of the source making the request.
   - Check `source.geo` for the geographic location of the IP address.
   - Analyze the `user_agent.original` field to determine the client or tool used (e.g., AWS CLI, SDK).

**Validate the query context**:
   - Inspect the `aws.cloudtrail.request_parameters` field 
   - Determine if the request is part of legitimate activity, such as:
     - Security assessments or vulnerability scans.
     - Maintenance or testing of legacy systems.
   - Check if the query aligns with recent changes in the AWS environment, such as new configurations or services.

**Correlate with other events**:
   - Investigate additional AWS API calls from the same user or IP address for signs of reconnaissance or exploitation.
   - Review logs for related actions, such as launching instances from deprecated AMIs (`RunInstances` API call).

**Assess security risks**:
   - Evaluate the use of deprecated AMIs within your environment and their associated vulnerabilities.
   - Ensure that deprecated AMIs are not being used in production environments or systems exposed to external threats.

### False positive analysis

- Users may query for deprecated AMIs for testing or compatibility purposes.
- Security or compliance tools might query deprecated AMIs as part of regular assessments.
- Legacy systems may rely on deprecated AMIs for compatibility, leading to legitimate queries.

### Response and remediation

**Immediate actions**:
   - Verify the intent of the user querying for deprecated AMIs.
   - Restrict IAM permissions to prevent unauthorized access to deprecated AMIs.

**Mitigation steps**:
   - Identify and replace deprecated AMIs in use with supported and updated AMIs.
   - Update AWS IAM policies to minimize permissions for querying or using deprecated AMIs.

**Enhance monitoring**:
   - Enable alerts for future queries involving deprecated AMIs or other unusual API activity.
   - Monitor CloudTrail logs for additional reconnaissance or suspicious behavior.

**Security audits**:
   - Conduct a review of all AMIs in use across your environment to identify outdated or deprecated images.
   - Remove any deprecated AMIs from production environments and restrict their usage to isolated testing.

**Add rule exceptions**:
   - Create exceptions for legitimate use cases or automated tools that query for deprecated AMIs.
   - Document and communicate the exceptions to relevant teams to avoid future alerts.

### Additional resources

- [AWS Documentation: AMI Lifecycle Management](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)
- [AWS Documentation: Deprecated AMIs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-deprecate.html)
"""
references = [
    "https://hackingthe.cloud/aws/exploitation/Misconfigured_Resource-Based_Policies/exploting_public_resources_attack_playbook/",
]
risk_score = 21
rule_id = "264c641e-c202-11ef-993e-f661ea17fbce"
severity = "low"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: AWS EC2",
    "Resources: Investigation Guide",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: "aws.cloudtrail"
    and event.provider: "ec2.amazonaws.com"
    and event.action: "DescribeImages"
    and event.outcome: "success"
    and aws.cloudtrail.flattened.request_parameters.includeDeprecated: "true"
'''
[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user_agent.original",
    "source.ip",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.type",
    "aws.cloudtrail.user_identity.access_key_id",
    "event.action",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters"
]

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1580"
name = "Cloud Infrastructure Discovery"
reference = "https://attack.mitre.org/techniques/T1580/"


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

Stages and Predicates

Stage 1: query

data_stream.dataset: "aws.cloudtrail"
    and event.provider: "ec2.amazonaws.com"
    and event.action: "DescribeImages"
    and event.outcome: "success"
    and aws.cloudtrail.flattened.request_parameters.includeDeprecated: "true"

Indicators

These rows show field, operator, and value matches.

AWS Management Console Root Login

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

Identifies a successful login to the AWS Management Console by the Root user.

Known False Positives

  • It's strongly recommended that the root user is not used for everyday tasks, including the administrative ones. Verify whether the IP address, location, and/or hostname should be logging in as root in your environment. Unfamiliar root logins should be investigated immediately. If known behavior is causing false positives, it can be exempted from the rule.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2020/06/11"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = "Identifies a successful login to the AWS Management Console by the Root user."
false_positives = [
    """
    It's strongly recommended that the root user is not used for everyday tasks, including the administrative ones.
    Verify whether the IP address, location, and/or hostname should be logging in as root in your environment.
    Unfamiliar root logins should be investigated immediately. If known behavior is causing false positives, it can be exempted from the rule.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS Management Console Root Login"
note = """## Triage and analysis

### Investigating AWS Management Console Root Login

The AWS root user is the original identity with unrestricted privileges over every resource in the account. Because it bypasses IAM boundaries and carries irreversible privileges, any successful root console login should be treated as a critical security event. AWS explicitly recommends locking away the root credentials and only using them for a small number of account-level administrative tasks (for example, closing an account, modifying support plans, or restoring MFA). See [Tasks that require the root user](https://docs.aws.amazon.com/general/latest/gr/root-vs-iam.html#aws_tasks-that-require-root).

This rule detects a successful AWS Management Console login by the root user (`ConsoleLogin` events with `userIdentity.type: Root` and `event.outcome: Success`).

#### Possible investigation steps

- **Confirm legitimacy.**  
  Contact the designated root credential custodian or account owner to verify whether this login was expected and approved. Root access should only occur under documented change-control conditions.

- **Review contextual event details.**  
  Examine the CloudTrail fields in the alert:
  - `source.ip` – does it match known corporate IPs or expected admin VPNs?  
  - `user_agent.original` – browser or automation?  
  - `geo fields` – consistent with normal operations?  
  - `@timestamp` – within a planned maintenance window?

- **Check for prior or subsequent root activity.**  
  Query CloudTrail for the last 30–90 days for any other root logins or root-initiated API calls. Multiple or recent root logins can indicate credential misuse.

- **Correlate follow-on actions.**  
  Look for risky API calls immediately after the login, such as:
  - `CreateUser`, `CreateAccessKey`, `AttachRolePolicy`, `PutBucketPolicy`, `UpdateAssumeRolePolicy`, `DeleteTrail`, or `StopLogging`.  
  These actions may indicate persistence or cover-up attempts.

- **Cross-account verification.**  
  If the root user is federated through AWS Organizations or linked accounts, confirm no simultaneous logins occurred elsewhere.

### False positive analysis

- **Planned administrative actions.**  
  Some rare maintenance tasks require root credentials (for example, payment method updates). If the login aligns with documented change control and was performed using MFA by the approved owner, the alert can be closed as benign.
- **Third-party managed account scenarios.**  
  Managed service providers may log in as root during onboarding or support activities. Confirm via ticketing or contractual documentation.

### Response and remediation

**Immediate verification and containment**
- If the login was not authorized or cannot be confirmed quickly:  
  - Reset the root password using the AWS Management Console.  
  - Rotate or remove any root access keys (root keys should normally not exist).  
  - Ensure MFA is enabled and enforced on the root account.  
  - Notify your security operations or cloud governance team.

**Evidence preservation**
- Export the alert’s CloudTrail record and all subsequent events for 1 hour after the login.  
  Store them in a restricted, immutable S3 evidence bucket.  
- Retain related GuardDuty findings, AWS Config history, and CloudTrail logs for the same period.

**Scope and investigation**
- Review additional events under the same `source.ip` to detect resource creation, IAM changes, or billing actions.  
- Inspect newly created users, roles, or keys since the login time to identify potential persistence mechanisms.  
- Check for any disabled or deleted CloudTrail trails, Security Hub findings suppression, or logging configuration changes.

**Recovery and hardening**
- Confirm MFA is working and only the authorized owner can access the root credentials.  
- Store root credentials in an offline vault under dual-custody control.  
- Enable organization-wide CloudTrail, GuardDuty, and Security Hub across all regions.  
- Implement policy and automation to alert on any future `userIdentity.type: Root` logins in real time.  
- Conduct a short post-incident review to update root-access procedures and reinforce least-privilege IAM practices.

### Additional information

- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/tree/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks):** See “Account Compromise” and “Credential Compromise” playbooks for containment and recovery procedures.  
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs):** Reference “Account Access Investigation” for evidence handling and credential rotation steps.  
- **AWS Documentation:** [Tasks that require the root user](https://docs.aws.amazon.com/general/latest/gr/root-vs-iam.html#aws_tasks-that-require-root).  
- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).  

"""
references = ["https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html"]
risk_score = 47
rule_id = "e2a67480-3b79-403d-96e3-fdd2992c50ef"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS Sign-In",
    "Use Case: Identity and Access Audit",
    "Resources: Investigation Guide",
    "Tactic: Initial Access",
    "Tactic: Privilege Escalation",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:aws.cloudtrail and 
event.provider:signin.amazonaws.com and 
event.action:ConsoleLogin and 
aws.cloudtrail.user_identity.type:Root and 
event.outcome:success
'''

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user_agent.original",
    "source.ip",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.type",
    "event.action",
    "event.outcome",
    "aws.cloudtrail.console_login.additional_eventdata.mfa_used",
    "cloud.account.id",
    "cloud.region",
    "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.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 = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

Stages and Predicates

Stage 1: query

data_stream.dataset:aws.cloudtrail and 
event.provider:signin.amazonaws.com and 
event.action:ConsoleLogin and 
aws.cloudtrail.user_identity.type:Root and 
event.outcome:success

Indicators

These rows show field, operator, and value matches.

Azure Key Vault Excessive Secret or Key Retrieved

#
Status
production
Severity
medium
Time window
9m
Group by
Esql.time_window_date_trunc, azure.platformlogs.identity.claim.upn
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies excessive secret or key retrieval operations from Azure Key Vault. This rule detects when a user principal retrieves secrets or keys from Azure Key Vault multiple times within a short time frame, which may indicate potential abuse or unauthorized access attempts. The rule focuses on high-frequency retrieval operations that deviate from normal user behavior, suggesting possible credential harvesting or misuse of sensitive information.

Known False Positives

  • Service accounts or applications that frequently access Azure Key Vault for configuration or operational purposes may trigger this rule.
  • Automated scripts or processes that retrieve secrets or keys for legitimate purposes, such as secret rotation or application configuration, may also lead to false positives.
  • Security teams performing routine audits or assessments that involve retrieving keys or secrets from Key Vaults may trigger this rule if they perform multiple retrievals in a short time frame.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/07/10"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Identifies excessive secret or key retrieval operations from Azure Key Vault. This rule detects when a user principal
retrieves secrets or keys from Azure Key Vault multiple times within a short time frame, which may indicate potential
abuse or unauthorized access attempts. The rule focuses on high-frequency retrieval operations that deviate from normal
user behavior, suggesting possible credential harvesting or misuse of sensitive information.
"""
false_positives = [
    """
    Service accounts or applications that frequently access Azure Key Vault for configuration or operational purposes
    may trigger this rule.
    """,
    """
    Automated scripts or processes that retrieve secrets or keys for legitimate purposes, such as secret rotation or
    application configuration, may also lead to false positives.
    """,
    """
    Security teams performing routine audits or assessments that involve retrieving keys or secrets from Key Vaults may
    trigger this rule if they perform multiple retrievals in a short time frame.
    """,
]
from = "now-9m"
interval = "8m"
language = "esql"
license = "Elastic License v2"
name = "Azure Key Vault Excessive Secret or Key Retrieved"
note = """## Triage and analysis

### Investigating Azure Key Vault Excessive Secret or Key Retrieved

Azure Key Vault is a cloud service that safeguards encryption keys and secrets like certificates, connection strings, and passwords. It is crucial for managing sensitive data in Azure environments. Unauthorized modifications to Key Vaults can lead to data breaches or service disruptions. This rule detects excessive secret or key retrieval operations from Azure Key Vault, which may indicate potential abuse or unauthorized access attempts.

### Possible investigation steps
- Review the `azure.platformlogs.identity.claim.upn` field to identify the user principal making the retrieval requests. This can help determine if the activity is legitimate or suspicious.
- Check the `azure.platformlogs.identity.claim.appid` or `azure.platformlogs.identity.claim.appid_display_name` to identify the application or service making the requests. If the application is not recognized or authorized, it may indicate a potential security incident. It is plausible that the application is a FOCI compliant application, which are commonly abused by adversaries to evade security controls or conditional access policies.
- Analyze the `azure.platformlogs.resource.name` field to determine which Key Vault is being accessed. This can help assess the impact of the retrieval operations and whether they target sensitive resources.
- Review the `event.action` field to confirm the specific actions being performed, such as `KeyGet`, `SecretGet`, or `CertificateGet`. These actions indicate retrieval of keys, secrets, or certificates from the Key Vault.
- Check the `source.ip` or `source.geo.*` fields to identify the source of the retrieval requests. Look for unusual or unexpected IP addresses, especially those associated with known malicious activity or geographic locations that do not align with the user's typical behavior.
- Use the `time_window` field to analyze the frequency of retrieval operations. If multiple retrievals occur within a short time frame (e.g., within a few minutes), it may indicate excessive or suspicious activity.
- Correlate the retrieval operations with other security events or alerts in the environment to identify any patterns or related incidents.
- Triage the user with Entra ID sign-in logs to gather more context about their authentication behavior and any potential anomalies.

### False positive analysis
- Routine administrative tasks or automated scripts may trigger excessive retrievals, especially in environments where Key Vaults are heavily utilized for application configurations or secrets management. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user principals.
- Legitimate applications or services may perform frequent retrievals of keys or secrets for operational purposes, such as configuration updates or secret rotation. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user principals.
- Security teams may perform periodic audits or assessments that involve retrieving keys or secrets from Key Vaults. If this is expected behavior, consider adjusting the rule or adding exceptions for specific user principals or applications.
- Some applications may require frequent access to keys or secrets for normal operation, leading to high retrieval counts. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user principals.

### Response and remediation
- Investigate the user principal making the excessive retrieval requests to determine if they are authorized to access the Key Vault and its contents. If the user is not authorized, take appropriate actions to block their access and prevent further unauthorized retrievals.
- Review the application or service making the requests to ensure it is legitimate and authorized to access the Key Vault. If the application is unauthorized or suspicious, consider blocking it and revoking its permissions to access the Key Vault.
- Assess the impact of the excessive retrieval operations on the Key Vault and its contents. Determine if any sensitive data was accessed or compromised during the retrievals.
- Implement additional monitoring and alerting for the Key Vault to detect any further suspicious activity or unauthorized access attempts.
- Consider implementing stricter access controls or policies for Key Vaults to limit excessive retrievals and ensure that only authorized users and applications can access sensitive keys and secrets.
- Educate users and administrators about the risks associated with excessive retrievals from Key Vaults and encourage them to follow best practices for managing keys and secrets in Azure environments.
"""
references = ["https://www.inversecos.com/2022/05/detection-and-compromise-azure-key.html"]
risk_score = 43
rule_id = "c07f7898-5dc3-11f0-9f27-f661ea17fbcd"
setup = """#### Required Azure Key Vault Diagnostic Logs

To ensure this rule functions correctly, the following diagnostic logs must be enabled for Azure Key Vault:
- AuditEvent: This log captures all read and write operations performed on the Key Vault, including secret, key, and certificate retrievals. These logs should be streamed to the Event Hub used for the Azure integration configuration.
"""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Storage",
    "Domain: Identity",
    "Data Source: Azure",
    "Data Source: Azure Platform Logs",
    "Data Source: Azure Key Vault",
    "Use Case: Threat Detection",
    "Use Case: Identity and Access Audit",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-azure.platformlogs-* metadata _id, _index

// Filter for Azure Key Vault read operations
| where data_stream.dataset == "azure.platformlogs"
  and event.action in (
    "VaultGet",
    "KeyGet",
    "KeyList",
    "KeyListVersions",
    "KeyGetDeleted",
    "KeyListDeleted",
    "SecretGet",
    "SecretList",
    "SecretListVersions",
    "SecretGetDeleted",
    "SecretListDeleted",
    "CertificateGet",
    "CertificateList",
    "CertificateListVersions",
    "CertificateGetDeleted",
    "CertificateListDeleted",
    "CertificatePolicyGet",
    "CertificateContactsGet",
    "CertificateIssuerGet",
    "CertificateIssuersList"
  )

// Truncate timestamps into 1-minute windows
| eval Esql.time_window_date_trunc = date_trunc(1 minute, @timestamp)

// Aggregate identity, geo, resource, and activity info
| stats
    Esql_priv.azure_platformlogs_identity_claim_upn_values = values(azure.platformlogs.identity.claim.upn),
    Esql.azure_platformlogs_identity_claim_upn_count_distinct = count_distinct(azure.platformlogs.identity.claim.upn),
    Esql.azure_platformlogs_identity_claim_appid_values = values(azure.platformlogs.identity.claim.appid),

    Esql.source_ip_values = values(source.ip),
    Esql.source_geo_city_values = values(source.geo.city_name),
    Esql.source_geo_region_values = values(source.geo.region_name),
    Esql.source_geo_country_values = values(source.geo.country_name),
    Esql.source_as_organization_name_values = values(source.as.organization.name),

    Esql.event_action_values = values(event.action),
    Esql.event_count = count(*),
    Esql.event_action_count_distinct = count_distinct(event.action),
    Esql.azure_resource_name_count_distinct = count_distinct(azure.resource.name),
    Esql.azure_resource_name_values = values(azure.resource.name),
    Esql.azure_platformlogs_result_type_values = values(azure.platformlogs.result_type),
    Esql.cloud_region_values = values(cloud.region),

    Esql.agent_name_values = values(agent.name),
    Esql.azure_subscription_id_values = values(azure.subscription_id),
    Esql.azure_resource_group_values = values(azure.resource.group),
    Esql.azure_resource_id_values = values(azure.resource.id)

by Esql.time_window_date_trunc, azure.platformlogs.identity.claim.upn

// keep relevant fields
| keep
    Esql.time_window_date_trunc,
    Esql_priv.azure_platformlogs_identity_claim_upn_values,
    Esql.azure_platformlogs_identity_claim_upn_count_distinct,
    Esql.azure_platformlogs_identity_claim_appid_values,
    Esql.source_ip_values,
    Esql.source_geo_city_values,
    Esql.source_geo_region_values,
    Esql.source_geo_country_values,
    Esql.source_as_organization_name_values,
    Esql.event_action_values,
    Esql.event_count,
    Esql.event_action_count_distinct,
    Esql.azure_resource_name_count_distinct,
    Esql.azure_resource_name_values,
    Esql.azure_platformlogs_result_type_values,
    Esql.cloud_region_values,
    Esql.agent_name_values,
    Esql.azure_subscription_id_values,
    Esql.azure_resource_group_values,
    Esql.azure_resource_id_values

// Filter for suspiciously high volume of distinct Key Vault reads by a single actor
| where Esql.azure_platformlogs_identity_claim_upn_count_distinct == 1 and Esql.event_count >= 10 and Esql.event_action_count_distinct >= 2

| sort Esql.time_window_date_trunc desc
'''


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

[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"

[[rule.threat.technique.subtechnique]]
id = "T1555.006"
name = "Cloud Secrets Management Stores"
reference = "https://attack.mitre.org/techniques/T1555/006/"

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

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

[[rule.threat.technique]]
id = "T1213"
name = "Data from Information Repositories"
reference = "https://attack.mitre.org/techniques/T1213/"

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

Stages and Predicates

Stage 1: from

from logs-azure.platformlogs-* metadata _id, _index

Stage 2: where

| where data_stream.dataset == "azure.platformlogs"
  and event.action in (
    "VaultGet",
    "KeyGet",
    "KeyList",
    "KeyListVersions",
    "KeyGetDeleted",
    "KeyListDeleted",
    "SecretGet",
    "SecretList",
    "SecretListVersions",
    "SecretGetDeleted",
    "SecretListDeleted",
    "CertificateGet",
    "CertificateList",
    "CertificateListVersions",
    "CertificateGetDeleted",
    "CertificateListDeleted",
    "CertificatePolicyGet",
    "CertificateContactsGet",
    "CertificateIssuerGet",
    "CertificateIssuersList"
  )

Stage 3: eval

| eval Esql.time_window_date_trunc = date_trunc(1 minute, @timestamp)

Stage 4: stats

| stats
    Esql_priv.azure_platformlogs_identity_claim_upn_values = values(azure.platformlogs.identity.claim.upn),
    Esql.azure_platformlogs_identity_claim_upn_count_distinct = count_distinct(azure.platformlogs.identity.claim.upn),
    Esql.azure_platformlogs_identity_claim_appid_values = values(azure.platformlogs.identity.claim.appid),
    Esql.source_ip_values = values(source.ip),
    Esql.source_geo_city_values = values(source.geo.city_name),
    Esql.source_geo_region_values = values(source.geo.region_name),
    Esql.source_geo_country_values = values(source.geo.country_name),
    Esql.source_as_organization_name_values = values(source.as.organization.name),
    Esql.event_action_values = values(event.action),
    Esql.event_count = count(*),
    Esql.event_action_count_distinct = count_distinct(event.action),
    Esql.azure_resource_name_count_distinct = count_distinct(azure.resource.name),
    Esql.azure_resource_name_values = values(azure.resource.name),
    Esql.azure_platformlogs_result_type_values = values(azure.platformlogs.result_type),
    Esql.cloud_region_values = values(cloud.region),
    Esql.agent_name_values = values(agent.name),
    Esql.azure_subscription_id_values = values(azure.subscription_id),
    Esql.azure_resource_group_values = values(azure.resource.group),
    Esql.azure_resource_id_values = values(azure.resource.id)
by Esql.time_window_date_trunc, azure.platformlogs.identity.claim.upn

Stage 5: keep

| keep
    Esql.time_window_date_trunc,
    Esql_priv.azure_platformlogs_identity_claim_upn_values,
    Esql.azure_platformlogs_identity_claim_upn_count_distinct,
    Esql.azure_platformlogs_identity_claim_appid_values,
    Esql.source_ip_values,
    Esql.source_geo_city_values,
    Esql.source_geo_region_values,
    Esql.source_geo_country_values,
    Esql.source_as_organization_name_values,
    Esql.event_action_values,
    Esql.event_count,
    Esql.event_action_count_distinct,
    Esql.azure_resource_name_count_distinct,
    Esql.azure_resource_name_values,
    Esql.azure_platformlogs_result_type_values,
    Esql.cloud_region_values,
    Esql.agent_name_values,
    Esql.azure_subscription_id_values,
    Esql.azure_resource_group_values,
    Esql.azure_resource_id_values

Stage 6: where

| where Esql.azure_platformlogs_identity_claim_upn_count_distinct == 1 and Esql.event_count >= 10 and Esql.event_action_count_distinct >= 2

Stage 7: sort

| sort Esql.time_window_date_trunc desc

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Esql.azure_platformlogs_identity_claim_upn_count_distincteq
  • 1
field:"Esql.azure_platformlogs_identity_claim_upn_count_distinct" kind:eq value:"1"
Esql.event_action_count_distinctge
  • 2
field:"Esql.event_action_count_distinct" kind:ge value:"2"
Esql.event_countge
  • 10
field:"Esql.event_count" kind:ge value:"10"
data_stream.dataseteq
  • azure.platformlogs
field:"data_stream.dataset" kind:eq value:"azure.platformlogs"
event.actionin
  • CertificateContactsGet
  • CertificateGet
  • CertificateGetDeleted
  • CertificateIssuerGet
  • CertificateIssuersList
  • CertificateList
  • CertificateListDeleted
  • CertificateListVersions
  • CertificatePolicyGet
  • KeyGet
  • KeyGetDeleted
  • KeyList
  • KeyListDeleted
  • KeyListVersions
  • SecretGet
  • SecretGetDeleted
  • SecretList
  • SecretListDeleted
  • SecretListVersions
  • VaultGet
field:"EventType" kind:in

Output Fields

These fields are emitted when the rule matches.

FieldSource
Esql.time_window_date_truncKEEP Esql.time_window_date_trunc
Esql_priv.azure_platformlogs_identity_claim_upn_valuesKEEP Esql_priv.azure_platformlogs_identity_claim_upn_values
Esql.azure_platformlogs_identity_claim_upn_count_distinctKEEP Esql.azure_platformlogs_identity_claim_upn_count_distinct
Esql.azure_platformlogs_identity_claim_appid_valuesKEEP Esql.azure_platformlogs_identity_claim_appid_values
Esql.source_ip_valuesKEEP Esql.source_ip_values
Esql.source_geo_city_valuesKEEP Esql.source_geo_city_values
Esql.source_geo_region_valuesKEEP Esql.source_geo_region_values
Esql.source_geo_country_valuesKEEP Esql.source_geo_country_values
Esql.source_as_organization_name_valuesKEEP Esql.source_as_organization_name_values
Esql.event_action_valuesKEEP Esql.event_action_values
Esql.event_countKEEP Esql.event_count
Esql.event_action_count_distinctKEEP Esql.event_action_count_distinct
Esql.azure_resource_name_count_distinctKEEP Esql.azure_resource_name_count_distinct
Esql.azure_resource_name_valuesKEEP Esql.azure_resource_name_values
Esql.azure_platformlogs_result_type_valuesKEEP Esql.azure_platformlogs_result_type_values
Esql.cloud_region_valuesKEEP Esql.cloud_region_values
Esql.agent_name_valuesKEEP Esql.agent_name_values
Esql.azure_subscription_id_valuesKEEP Esql.azure_subscription_id_values
Esql.azure_resource_group_valuesKEEP Esql.azure_resource_group_values
Esql.azure_resource_id_valuesKEEP Esql.azure_resource_id_values

Cloud Credential Files Accessed by Process in Suspicious Directory

#
Source
github.com/elastic/protections-artifacts

Identifies an untrusted or unsigned process accessing cloud credential and configuration files. Adversaries may attempt to access these files in order to gain access to sensitive data, laterally move or gain initial access into a cloud environment.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Identifies an untrusted or unsigned process accessing cloud credential and configuration files. Adversaries may attempt
to access these files in order to gain access to sensitive data, laterally move or gain initial access into a cloud
environment.
"""
id = "caf1b0eb-ab71-4474-84cf-d7821ec0c292"
license = "Elastic License v2"
name = "Cloud Credential Files Accessed by Process in Suspicious Directory"
os_list = ["macos"]
version = "1.0.13"

query = '''
file where event.action == "open" and 
 file.path like~ ("/Users/*/.aws/*", "/Users/*/.config/gcloud/credentials.db", "/Users/*/.azure/*") and
 Effective_process.executable != null and
 (Effective_process.executable like~
                                 ("/Users/Shared/*",
                                  "/Users/*/Public/*",
                                  "/private/tmp/*",
                                  "/tmp/*",
                                  "/var/root/*",
                                  "/Library/WebServer/*",
                                  "/Library/Graphics/*",
                                  "/Library/Fonts/*",
                                  "/private/var/root/Library/HTTPStorages/*",
                                  "/private/var/root/Library/*") or
  process.executable like~ ("/Users/Shared/*",
                            "/Users/*/Public/*",
                            "/private/tmp/*",
                            "/tmp/*",
                            "/var/root/*",
                            "/Library/WebServer/*",
                            "/Library/Graphics/*",
                            "/Library/Fonts/*",
                            "/private/var/root/Library/HTTPStorages/*",
                            "/private/var/root/Library/*")) and
 not process.name like~ "python*" and
 not process.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*") and 
 not (process.executable like ("/private/tmp/claude-*/go-build*.test", 
      "/private/tmp/*/.terraform/providers/registry.opentofu.org/hashicorp/aws/*/terraform-provider-aws",
      "/private/tmp/*/.terraform/providers/registry.terraform.io/hashicorp/aws/*/terraform-provider-aws*",
      "/private/tmp/f2-agentcore-*/bin/Debug/net*/f2-agentcore-*") and file.name in ("credentials", "config")) and 
 not Effective_process.executable in ("/Applications/Cursor.app/Contents/MacOS/Cursor")
'''

min_endpoint_version = "8.11.1"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 0

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"



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

[internal]
min_endpoint_version = "8.11.1"

Stages and Predicates

Stage 1: file

file where event.action == "open" and 
 file.path like~ ("/Users/*/.aws/*", "/Users/*/.config/gcloud/credentials.db", "/Users/*/.azure/*") and
 Effective_process.executable != null and
 (Effective_process.executable like~
                                 ("/Users/Shared/*",
                                  "/Users/*/Public/*",
                                  "/private/tmp/*",
                                  "/tmp/*",
                                  "/var/root/*",
                                  "/Library/WebServer/*",
                                  "/Library/Graphics/*",
                                  "/Library/Fonts/*",
                                  "/private/var/root/Library/HTTPStorages/*",
                                  "/private/var/root/Library/*") or
  process.executable like~ ("/Users/Shared/*",
                            "/Users/*/Public/*",
                            "/private/tmp/*",
                            "/tmp/*",
                            "/var/root/*",
                            "/Library/WebServer/*",
                            "/Library/Graphics/*",
                            "/Library/Fonts/*",
                            "/private/var/root/Library/HTTPStorages/*",
                            "/private/var/root/Library/*")) and
 not process.name like~ "python*" and
 not process.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*") and 
 not (process.executable like ("/private/tmp/claude-*/go-build*.test", 
      "/private/tmp/*/.terraform/providers/registry.opentofu.org/hashicorp/aws/*/terraform-provider-aws",
      "/private/tmp/*/.terraform/providers/registry.terraform.io/hashicorp/aws/*/terraform-provider-aws*",
      "/private/tmp/f2-agentcore-*/bin/Debug/net*/f2-agentcore-*") and file.name in ("credentials", "config")) and 
 not Effective_process.executable in ("/Applications/Cursor.app/Contents/MacOS/Cursor")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Effective_process.executableis_not_null
  • (no value, null check)
field:"Effective_process.executable" kind:is_not_null
Effective_process.executablewildcard
  • /Library/Fonts/*
  • /Library/Graphics/*
  • /Library/WebServer/*
  • /Users/*/Public/*
  • /Users/Shared/*
  • /private/tmp/*
  • /private/var/root/Library/*
  • /private/var/root/Library/HTTPStorages/*
  • /tmp/*
  • /var/root/*
field:"Effective_process.executable" kind:wildcard
event.actioneq
  • open corpus 49 (elastic 49)
field:"EventType" kind:eq value:"open"
file.pathwildcard
  • /Users/*/.aws/* corpus 2 (elastic 2)
  • /Users/*/.azure/* corpus 2 (elastic 2)
  • /Users/*/.config/gcloud/credentials.db corpus 2 (elastic 2)
field:"TargetFilename" kind:wildcard
process.executablewildcard
  • /Library/Fonts/* corpus 2 (elastic 2)
  • /Library/Graphics/* corpus 2 (elastic 2)
  • /Library/WebServer/* corpus 2 (elastic 2)
  • /Users/*/Public/*
  • /Users/Shared/* corpus 3 (elastic 3)
  • /private/tmp/* corpus 4 (elastic 4)
  • /private/var/root/Library/*
  • /private/var/root/Library/HTTPStorages/* corpus 2 (elastic 2)
  • /tmp/* corpus 17 (elastic 17)
  • /var/root/*
field:"Image" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.nameinconfig, credentialsexcludes:file.name field:"file.name" value:"config" field:"file.name" value:"credentials"
process.executablewildcard/private/tmp/claude-*/go-build*.test, /private/tmp/*/.terraform/providers/registry.opentofu.org/hashicorp/aws/*/terraform-provider-aws, /private/tmp/*/.terraform/providers/registry.terraform.io/hashicorp/aws/*/terraform-provider-aws*, /private/tmp/f2-agentcore-*/bin/Debug/net*/f2-agentcore-*excludes:process.executable
Effective_process.executableeq/Applications/Cursor.app/Contents/MacOS/Cursorexcludes:Effective_process.executable field:"Effective_process.executable" value:"/Applications/Cursor.app/Contents/MacOS/Cursor"
process.executablestarts_with/opt/homebrew/, /usr/local/Cellar/excludes:process.executable field:"process.executable" value:"/opt/homebrew/" field:"process.executable" value:"/usr/local/Cellar/"
process.namestarts_withpythonexcludes:process.name field:"process.name" value:"python"

Entra ID Federated Identity Credential Issuer Modified

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

Detects when the issuer URL of a federated identity credential is changed on an Entra ID application. Adversaries may modify the issuer to point to an attacker-controlled identity provider, enabling them to authenticate as the application's service principal and gain persistent access to Azure resources. This technique allows bypassing traditional authentication controls by federating trust with a malicious external identity provider.

MITRE ATT&CK Coverage

Telemetry Coverage

PlatformRecord / event type
AzureUpdate application

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2025/07/14"
integration = ["azure"]
maturity = "production"
min_stack_version = "9.3.0"
min_stack_comments = "Changing min stack to 9.3.0, the latest minimum supported version for 9.X releases."
updated_date = "2026/07/20"

[rule]
author = ["Elastic"]
description = """
Detects when the issuer URL of a federated identity credential is changed on an Entra ID application. Adversaries may
modify the issuer to point to an attacker-controlled identity provider, enabling them to authenticate as the
application's service principal and gain persistent access to Azure resources. This technique allows bypassing
traditional authentication controls by federating trust with a malicious external identity provider.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Entra ID Federated Identity Credential Issuer Modified"
note = """## Triage and analysis

### Investigating Entra ID Federated Identity Credential Issuer Modified

This rule detects when the issuer URL within a federated identity credential is modified on an Entra ID application. Federated identity credentials allow applications to authenticate using tokens from external identity providers (like GitHub Actions, AWS, etc.) without managing secrets. Adversaries can abuse this by changing the issuer to an attacker-controlled identity provider, allowing them to generate valid tokens and authenticate as the application's service principal.

This technique provides persistent access to Azure resources with the application's permissions and bypasses secret-based authentication controls.

### Possible investigation steps

- Review `azure.auditlogs.properties.initiated_by.user.userPrincipalName` and `ipAddress` to identify who made the change and from where.
- Examine the `Esql.external_idp_old_issuer` and `Esql.external_idp_new_issuer` fields to determine if the new issuer is expected or potentially malicious.
- Check if the new issuer domain is controlled by the organization or if it's an external/suspicious domain.
- Review the application's assigned roles and permissions to understand the scope of access gained.
- Use `azure.correlation_id` to pivot to related changes in the same session.
- Check for subsequent Azure sign-in activity using the modified federated credential.
- Investigate if the application has been used to access sensitive resources after the change.

### False positive analysis

- Legitimate migrations from one identity provider to another (e.g., GitHub to GitLab) may trigger this detection.
- DevOps teams may update issuer URLs as part of CI/CD pipeline changes.
- Validate any changes with the application owner or DevOps team before taking action.

### Response and remediation

- If the change is unauthorized, immediately remove or revert the federated identity credential.
- Rotate any secrets or certificates associated with the application.
- Review Azure sign-in logs and audit logs for any unauthorized activity using the application's identity.
- Disable the application or service principal if compromise is confirmed.
- Investigate how the unauthorized change occurred (e.g., compromised admin account, over-privileged service principal).
- Implement conditional access policies and PIM (Privileged Identity Management) to protect application management operations.
"""
references = [
    "https://dirkjanm.io/persisting-with-federated-credentials-entra-apps-managed-identities/",
    "https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation",
]
risk_score = 73
rule_id = "498e4094-60e7-11f0-8847-f661ea17fbcd"
setup = """### Microsft Entra ID Audit Logs
This rule requires the Azure integration with Microsoft Entra ID Audit Logs data stream ingesting in your Elastic Stack deployment. For more information, refer to the [Microsoft Entra ID Audit Logs integration documentation](https://www.elastic.co/docs/reference/integrations/azure/adlogs).
"""
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: Identity",
    "Data Source: Azure",
    "Data Source: Microsoft Entra ID",
    "Data Source: Microsoft Entra ID Audit Logs",
    "Use Case: Identity and Access Audit",
    "Tactic: Persistence",
    "Tactic: Privilege Escalation",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-azure.auditlogs-* metadata _id, _version, _index
| where event.action == "Update application"
| where `azure.auditlogs.properties.target_resources.0.modified_properties.0.display_name` == "FederatedIdentityCredentials"
| eval Esql.target_resources_old_value_clean = replace(`azure.auditlogs.properties.target_resources.0.modified_properties.0.old_value`, "\\\\", "")
| eval Esql.target_resources_new_value_clean = replace(`azure.auditlogs.properties.target_resources.0.modified_properties.0.new_value`, "\\\\", "")
| dissect Esql.target_resources_old_value_clean "%{}\"Issuer\":\"%{Esql.external_idp_old_issuer}\"%{}"
| dissect Esql.target_resources_new_value_clean "%{}\"Issuer\":\"%{Esql.external_idp_new_issuer}\"%{}"
| where Esql.external_idp_old_issuer is not null and Esql.external_idp_new_issuer is not null
| where Esql.external_idp_old_issuer != Esql.external_idp_new_issuer
| keep @timestamp, Esql.*, azure.*, event.*, cloud.*, related.*, tags, source.*, agent.*, client.*, _id, _version, _index, data_stream.namespace
'''


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

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[[rule.threat.technique.subtechnique]]
id = "T1098.001"
name = "Additional Cloud Credentials"
reference = "https://attack.mitre.org/techniques/T1098/001/"

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

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

[[rule.threat.technique]]
id = "T1484"
name = "Domain or Tenant Policy Modification"
reference = "https://attack.mitre.org/techniques/T1484/"

[[rule.threat.technique.subtechnique]]
id = "T1484.002"
name = "Trust Modification"
reference = "https://attack.mitre.org/techniques/T1484/002/"

[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 = "T1484"
name = "Domain or Tenant Policy Modification"
reference = "https://attack.mitre.org/techniques/T1484/"

[[rule.threat.technique.subtechnique]]
id = "T1484.002"
name = "Trust Modification"
reference = "https://attack.mitre.org/techniques/T1484/002/"

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

Stages and Predicates

Stage 1: from

from logs-azure.auditlogs-* metadata _id, _version, _index

Stage 2: where

| where event.action == "Update application"

Stage 3: where

| where `azure.auditlogs.properties.target_resources.0.modified_properties.0.display_name` == "FederatedIdentityCredentials"

Stage 4: eval

| eval Esql.target_resources_old_value_clean = replace(`azure.auditlogs.properties.target_resources.0.modified_properties.0.old_value`, "\\\\", "")

Stage 5: eval

| eval Esql.target_resources_new_value_clean = replace(`azure.auditlogs.properties.target_resources.0.modified_properties.0.new_value`, "\\\\", "")

Stage 6: dissect

| dissect Esql.target_resources_old_value_clean "%{}\"Issuer\":\"%{Esql.external_idp_old_issuer}\"%{}"

Stage 7: dissect

| dissect Esql.target_resources_new_value_clean "%{}\"Issuer\":\"%{Esql.external_idp_new_issuer}\"%{}"

Stage 8: where

| where Esql.external_idp_old_issuer is not null and Esql.external_idp_new_issuer is not null

Stage 9: where

| where Esql.external_idp_old_issuer != Esql.external_idp_new_issuer

Stage 10: keep

| keep @timestamp, Esql.*, azure.*, event.*, cloud.*, related.*, tags, source.*, agent.*, client.*, _id, _version, _index, data_stream.namespace

Indicators

These rows show field, operator, and value matches.

Output Fields

These fields are emitted when the rule matches.

FieldSource
@timestampKEEP @timestamp
Esql.*KEEP Esql.*
azure.*KEEP azure.*
event.*KEEP event.*
cloud.*KEEP cloud.*
related.*KEEP related.*
tagsKEEP tags
source.*KEEP source.*
agent.*KEEP agent.*
client.*KEEP client.*
_idKEEP _id
_versionKEEP _version
_indexKEEP _index
data_stream.namespaceKEEP data_stream.namespace

Entra ID Illicit Consent Grant via Registered Application

#

Keystrokes Input Capture via SetWindowsHookEx

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

Identifies attempts to install an application-defined hook procedure to monitor keystroke messages. Adversaries may log user keystrokes to intercept credentials or other information from the user as the user types them.

MITRE ATT&CK Coverage

TacticTechniques
Collection

Rule Body

[rule]
description = """
Identifies attempts to install an application-defined hook procedure to monitor keystroke messages. Adversaries may log
user keystrokes to intercept credentials or other information from the user as the user types them.
"""
id = "a7e3958f-3f07-495a-8b2f-2a1d342c943f"
license = "Elastic License v2"
name = "Keystrokes Input Capture via SetWindowsHookEx"
os_list = ["windows"]
reference = [
    "https://attack.mitre.org/techniques/T1056/001/",
    "https://www.elastic.co/security-labs/protecting-your-devices-from-information-theft-keylogger-protection",
]
version = "1.0.3"

query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
 (process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
 (process.code_signature.trusted == false or process.code_signature.exists == false) and
 not user.id : ("S-1-5-18", "s-1-5-19", "S-1-5-20") and
 not process.hash.sha256 :
               ("fd47875b3f3fb8f3c0ff83c148d94c0794aa4686a0495ed9006b2dbe23feb958",
                "eca768e56ce3ab01984ab0e7e1401515a0a36b7380fed2b175b17a98b2bea6b8")]
[api where
  process.Ext.api.name == "SetWindowsHookEx" and process.Ext.api.parameters.hook_type == "WH_KEYBOARD_LL" and
  process.thread.Ext.call_stack_final_user_module.name == "Unknown" and
  not process.Ext.api.parameters.hook_module :
                     ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\*")]
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1056"
name = "Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/"
[[threat.technique.subtechnique]]
id = "T1056.001"
name = "Keylogging"
reference = "https://attack.mitre.org/techniques/T1056/001/"



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

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
 (process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
 (process.code_signature.trusted == false or process.code_signature.exists == false) and
 not user.id : ("S-1-5-18", "s-1-5-19", "S-1-5-20") and
 not process.hash.sha256 :
               ("fd47875b3f3fb8f3c0ff83c148d94c0794aa4686a0495ed9006b2dbe23feb958",
                "eca768e56ce3ab01984ab0e7e1401515a0a36b7380fed2b175b17a98b2bea6b8")]

Stage 2: api

[api where
  process.Ext.api.name == "SetWindowsHookEx" and process.Ext.api.parameters.hook_type == "WH_KEYBOARD_LL" and
  process.thread.Ext.call_stack_final_user_module.name == "Unknown" and
  not process.Ext.api.parameters.hook_module :
                     ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\*")]

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

M365 Entra ID Risk Detection Signal

#
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 Microsoft Entra ID (formerly Azure AD) risk detection signals including risky sign-ins, compromised credentials, impossible travel, and other identity-based anomalies. These events indicate potential credential compromise, account takeover attempts, or suspicious authentication patterns detected by Microsoft's identity protection. This building block rule generates security events for correlation, threat hunting, and telemetry collection to support detection of credential access and initial access attempts.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
bypass_bbr_timing = true
creation_date = "2026/02/20"
integration = ["o365"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies Microsoft Entra ID (formerly Azure AD) risk detection signals including risky sign-ins, compromised
credentials, impossible travel, and other identity-based anomalies. These events indicate potential credential
compromise, account takeover attempts, or suspicious authentication patterns detected by Microsoft's identity
protection. This building block rule generates security events for correlation, threat hunting, and telemetry
collection to support detection of credential access and initial access attempts.
"""
from = "now-9m"
index = ["logs-o365.audit-*", "filebeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "M365 Entra ID Risk Detection Signal"
references = [
    "https://learn.microsoft.com/en-us/entra/id-protection/concept-identity-protection-risks",
    "https://learn.microsoft.com/en-us/office/office-365-management-api/office-365-management-activity-api-schema#enum-auditlogrecordtype---type-edmint32",
]
risk_score = 21
rule_id = "cccc9be5-d8b0-466e-8a37-617eae57351a"
setup = """### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "low"
tags = [
    "Domain: Cloud",
    "Domain: SaaS",
    "Data Source: Microsoft 365",
    "Data Source: Microsoft 365 Audit Logs",
    "Data Source: Microsoft Entra ID",
    "Data Source: Microsoft Entra ID Protection",
    "Use Case: Threat Detection",
    "Use Case: Identity Threat Detection",
    "Tactic: Credential Access",
    "Tactic: Initial Access",
    "Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.dataset:o365.audit and event.code:AadRiskDetection
'''


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

[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"

[[rule.threat.technique.subtechnique]]
id = "T1110.003"
name = "Password Spraying"
reference = "https://attack.mitre.org/techniques/T1110/003/"

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

[[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/"

Stages and Predicates

Stage 1: query

event.dataset:o365.audit and event.code:AadRiskDetection

Indicators

These rows show field, operator, and value matches.

Microsoft Defender XDR Alert External Alerts

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

Generates a detection alert for each Microsoft Defender XDR alert written to the configured indices. Microsoft Defender emits multiple update events for the same alert over its lifecycle, all sharing a stable alert identifier. This rule suppresses those update events so that a single, continuous Elastic alert is maintained per Defender alert rather than a new alert per update. Enabling this rule allows you to immediately begin investigating Microsoft Defender XDR alerts in the app.

Rule Body

[metadata]
creation_date = "2026/06/30"
integration = ["m365_defender"]
maturity = "production"
promotion = true
updated_date = "2026/06/30"

[rule]
author = ["Elastic"]
description = """
Generates a detection alert for each Microsoft Defender XDR alert written to the configured indices. Microsoft Defender
emits multiple update events for the same alert over its lifecycle, all sharing a stable alert identifier. This rule
suppresses those update events so that a single, continuous Elastic alert is maintained per Defender alert rather than a
new alert per update. Enabling this rule allows you to immediately begin investigating Microsoft Defender XDR alerts in
the app.
"""
from = "now-2m"
index = ["logs-m365_defender.alert-*"]
interval = "1m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "Microsoft Defender XDR Alert External Alerts"
note = """## Triage and analysis

### Investigating Microsoft Defender XDR Alert External Alerts

Microsoft Defender XDR is a unified pre- and post-breach enterprise defense suite that natively coordinates detection, prevention, investigation, and response across endpoints, identities, email, and applications. The alert data stream (`logs-m365_defender.alert-*`) carries pre-correlated alerts already triaged by Defender. This rule promotes each Defender alert into an Elastic detection alert so analysts can investigate without leaving the app.

Microsoft Defender emits several update events for the same alert as its status, classification, and evidence evolve. Every update shares the same stable Defender alert identifier (`m365_defender.alert.id`, which the integration also copies into `event.id`). The rule groups on that identifier so subsequent updates accumulate into the existing Elastic alert rather than creating duplicates.

If you also collect Microsoft Defender alerts through the Microsoft 365 Unified Audit Log (`logs-o365.audit-*`) rather than the native integration data stream, the M365 Defender Alerts Signal (UAL) building block rule (rule_id: 054853f3-2ce0-41f3-a6eb-4a4867f39cdc) generates correlation signals from that source and can be used alongside this promotion rule.

### Possible investigation steps

- Review `m365_defender.alert.title`, `m365_defender.alert.category`, and `m365_defender.alert.threat_display_name` to understand what Defender detected.
- Pivot to the Defender portal using `m365_defender.alert.incident_web_url.original` for the full evidence graph, process tree, and remediation status.
- Examine the evidence fields under `m365_defender.alert.evidence.*` (host, file, process, user account, URL, sender) to scope the impacted entities.
- Check `m365_defender.alert.incident_id` to correlate the alert with its parent Defender incident and any sibling alerts.
- Review `m365_defender.alert.status` and `m365_defender.alert.classification` to see whether Defender has already resolved or classified the alert.

### False positive analysis

- Defender alerts are pre-correlated and tuned by Microsoft, so true false positives are uncommon. When they occur, confirm with the responsible team before excluding.
- Alerts involving known and trusted administrative tools, security assessments, or scheduled automation may be benign. Validate intent before adding an exception.
- Use `m365_defender.alert.classification` and `m365_defender.alert.determination` to filter out activity Defender itself has marked as a false positive.

### Response and remediation

- Isolate affected endpoints or disable affected accounts if malicious behavior is confirmed.
- Use the Defender portal to action native response options (quarantine, automated investigation, account remediation) for the alert.
- Investigate how the threat entered the environment and close any exploited gaps.
- Reset credentials for compromised accounts or escalate to incident response.
- Document the findings and tune the upstream Defender policy or add an Elastic exception as appropriate.
"""
references = ["https://docs.elastic.co/en/integrations/m365_defender"]
risk_score = 47
rule_id = "c2a0e42b-ac3d-468f-82a5-0082066e1b59"
rule_name_override = "m365_defender.alert.title"
setup = """## Setup

### Microsoft Defender XDR Alert Integration
This rule is designed to capture alert events generated by the Microsoft Defender XDR integration and promote them as Elastic detection alerts.

To capture Microsoft Defender XDR alerts, install and configure the Microsoft Defender XDR integration to ingest alert events into the `logs-m365_defender.alert-*` index pattern.

### Alert suppression and the Defender update lifecycle

Microsoft Defender writes multiple update events per alert during its lifecycle, all sharing the same stable identifier (`m365_defender.alert.id`, copied to `event.id`). This rule suppresses on that identifier so updates accumulate into one Elastic alert. Note the following alert suppression semantics:

- Suppression applies going forward from when the suppressing alert is created; it does not retroactively merge alerts created before the rule was enabled.
- Updates are aggregated into the existing alert only while that alert is open and within the suppression window. If an analyst closes the suppressing alert, a later Defender update will open a new Elastic alert.
- The suppression window (default 1 day) is tunable. Size it to your environment's typical Defender alert lifecycle; extending it keeps a single alert open longer but delays new-alert creation for late updates.

### Avoiding duplicate alerts

To avoid double-counting, enable either this alert-level rule or the Microsoft Defender XDR Incident External Alerts rule (incident-level), not both: a Defender incident's child alerts appear in both data streams. Choose incident-level for the least noise (one Elastic alert per Defender incident) or alert-level for finer-grained, per-alert triage.

### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "medium"
tags = [
    "Data Source: Microsoft Defender XDR",
    "Use Case: Threat Detection",
    "Resources: Investigation Guide",
    "Promotion: External Alerts",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.kind: alert and data_stream.dataset: m365_defender.alert
'''


[[rule.risk_score_mapping]]
field = "event.severity"
operator = "equals"
value = ""

[[rule.severity_mapping]]
field = "m365_defender.alert.severity"
operator = "equals"
severity = "low"
value = "informational"

[[rule.severity_mapping]]
field = "m365_defender.alert.severity"
operator = "equals"
severity = "low"
value = "low"

[[rule.severity_mapping]]
field = "m365_defender.alert.severity"
operator = "equals"
severity = "medium"
value = "medium"

[[rule.severity_mapping]]
field = "m365_defender.alert.severity"
operator = "equals"
severity = "high"
value = "high"

[rule.alert_suppression]
group_by = ["m365_defender.alert.id", "m365_defender.alert.tenant_id"]
missing_fields_strategy = "doNotSuppress"

[rule.alert_suppression.duration]
unit = "h"
value = 24

Stages and Predicates

Stage 1: query

event.kind: alert and data_stream.dataset: m365_defender.alert

Indicators

These rows show field, operator, and value matches.

Potential REMCOS Trojan Execution

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

Identifies known file and registry traces of the REMCOS Remote Access Trojan, including log files, persistence values, and cleanup artifacts. Adversaries use Remcos to maintain persistent remote access to compromised hosts.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/08/20"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender"]
maturity = "production"
updated_date = "2026/04/07"

[rule]
author = ["Elastic"]
description = """
Identifies known file and registry traces of the REMCOS Remote Access Trojan, including log files, persistence values, and cleanup artifacts. Adversaries use Remcos to maintain persistent remote access to compromised hosts.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-endpoint.events.registry-*",
    "logs-endpoint.events.file-*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-windows.sysmon_operational-*",
    "winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential REMCOS Trojan Execution"
references = [
  "https://any.run/malware-trends/remcos",
  "https://attack.mitre.org/software/S0332/",
  "https://www.elastic.co/security-labs/exploring-the-ref2731-intrusion-set"
]
risk_score = 73
rule_id = "d8b2f85a-cf1c-40fc-acf0-bb5d588a8ea6"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Command and Control",
    "Resources: Investigation Guide",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: SentinelOne",
    "Data Source: Microsoft Defender XDR"
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
any where host.os.type == "windows" and
(
 (event.category == "file" and event.type == "deletion" and file.path like "?:\\Users\\*\\AppData\\Local\\Temp\\TH????.tmp") or

 (event.category == "file" and file.path : "?:\\Users\\*\\AppData\\Roaming\\remcos\\logs.dat") or

 (event.category == "registry" and
  registry.value : ("Remcos", "Rmc-??????", "licence") and
  registry.path : (
      "*\\Windows\\CurrentVersion\\Run\\Remcos",
      "*\\Windows\\CurrentVersion\\Run\\Rmc-??????",
      "*\\SOFTWARE\\Remcos-*\\licence",
      "*\\Software\\Rmc-??????\\licence"
  )
 )
)
'''

note = """## Triage and analysis

### Investigating Potential REMCOS Trojan Execution

#### Possible investigation steps

- Which Remcos-related artifact family matched, and does it indicate install, persistence, or cleanup evidence?
  - Focus: `event.category` plus the matched `file.path`, `registry.path`, `registry.value`, `registry.data.strings`, and whether the trace's user profile or hive scope matches `user.id`.
  - Implication: "logs.dat" indicates active or recent keystroke/clipboard logging; a Run-key or licence registry path indicates persistence is set; a temp-file deletion indicates installer cleanup. The artifact's user profile or hive scope identifies which account is compromised.

- Which process or user touched the Remcos trace, and does that writer fit detonation, remediation, or malware execution?
  - Focus: the recovered writer identity and launch context, especially `process.executable`, `process.code_signature.subject_name`, `process.parent.executable`, and `user.id`.
  - Hint: if the source event lacks process identity, recover the writer via `process.entity_id` or `process.pid` plus a tight time window on the same `host.id`.
  - Implication: if the writer is an unknown binary on a non-lab host, treat it as the Remcos payload or its installer. If the writer is a known sandbox, detonation engine, or IR cleanup tool on a designated lab host, the trace is expected.

- What payload or persistence target do adjacent file and registry events resolve to?
  - Focus: file and registry events on the same `host.id`: `file.path`, `file.Ext.original.path`, `registry.path`, `registry.data.strings`, and any payload or autorun target tied to `process.entity_id`.
  - Implication: a surviving Run-key target, startup copy, or staged binary under `%APPDATA%` or `%TEMP%` confirms the infection has active persistence and the payload is still present. Bounded removal of those artifacts without a surviving payload indicates cleanup is underway but verify that ALL persistence mechanisms are gone, not just the ones visible in the alert.

- Is there active outbound C2 or proxy traffic on this host?
  - Focus: host-scoped network events around the alert time, checking `dns.question.name`, `dns.resolved_ip`, `destination.ip`, `destination.port` for connections to rare public destinations, direct-IP egress, dynamic-DNS infrastructure, or unusual ports consistent with Remcos controller or SOCKS proxy use.
  - Implication: active C2 traffic confirms the infection is live and requires immediate containment; absence of C2 traffic may indicate the payload was already removed or has not yet activated. Missing network telemetry is unresolved, not benign.

- If the local evidence stays suspicious, does this host or user show related alerts that explain precursor compromise or follow-on access?
  - Focus: related alerts for the same `host.id` and `user.id` in the last 48 hours to identify delivery, persistence, credential, command-and-control, or lateral-movement activity.
    - $investigate_0
    - $investigate_1
  - Implication: broaden when the host or user shows delivery, credential theft, or follow-on remote-access alerts after the artifact; keep the case narrower when related activity is absent or resolves to one detonation or remediation workflow.

- Escalate when the artifact, writer, persistence status, C2 activity, or alert scope align with active Remcos execution; close only when all evidence fits a recognized detonation or remediation workflow; if mixed or incomplete, preserve and escalate.

### False positive analysis

- Malware-analysis or detonation hosts can legitimately create Remcos traces. Confirm it when the writer identity, `host.id`, and any network activity all stay inside a known lab or sandbox environment. If lab records are unavailable, require the same writer and `host.id` to recur across prior alerts.
- Incident-response cleanup can remove Remcos artifacts. Confirm it when the writer matches a known cleanup tool, surrounding events show bounded removal, and no new C2 or lateral-movement activity follows.

### Response and remediation

- If confirmed benign, reverse any temporary containment and document the confirmed writer, `host.id`, and artifact family that justified the closure. Create an exception only if that same workflow recurs consistently across prior alerts from this rule.
- If suspicious but unconfirmed, preserve the matched `file.path` or `registry.path`, `registry.data.strings`, recovered `process.entity_id`, writer executable and parent context. Apply the least disruptive reversible containment that matches the findings, starting with outbound restrictions on confirmed destinations and using host isolation only when active command-and-control or lateral movement is still plausible for that asset. Avoid destructive cleanup until scope is clearer.
- If confirmed malicious, use endpoint response to isolate the host after weighing host criticality and record the `process.entity_id`, command line, parent chain, and trace paths. If direct endpoint response is unavailable, escalate with that evidence set to the team that can contain the host and implicated accounts.
- Before eradicating or reimaging, review other hosts and users for the same writer identity, artifact family, or C2 destinations so scoping is complete. For confirmed infections, consider reimaging over manual cleanup -- Remcos can establish multiple persistence mechanisms and manual eradication risks missing one. If reimaging is not feasible, eradicate all identified Remcos artifacts including Run keys, licence-related registry paths, staged binaries, "logs.dat", and linked temp artifacts, then verify no alternate persistence survives.
- Post-incident hardening: review how the payload reached the host, restrict user-writable persistence paths where practical, and retain registry and network telemetry for Remcos-related activity.
"""

setup = """## Setup

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

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

### Additional data sources

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

- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 11 - File Create](https://ela.st/sysmon-event-11-setup)
- [Sysmon Registry Events](https://ela.st/sysmon-event-reg-setup)
- [Sysmon Event ID 23 - File Delete](https://ela.st/sysmon-event-23-setup)
"""

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "event.category",
    "event.type",
    "event.action",
    "host.name",
    "host.id",
    "user.name",
    "user.id",
    "process.name",
    "process.executable",
    "process.entity_id",
    "process.pid",
    "process.code_signature.subject_name",
    "file.path",
    "file.name",
    "registry.path",
    "registry.value",
    "registry.data.strings",
]

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

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

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

[[rule.threat.technique]]
id = "T1219"
name = "Remote Access Tools"
reference = "https://attack.mitre.org/techniques/T1219/"

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

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

[[rule.threat.technique]]
id = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"

[[rule.threat.technique.subtechnique]]
id = "T1070.004"
name = "File Deletion"
reference = "https://attack.mitre.org/techniques/T1070/004/"

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

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

[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"

[[rule.threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"

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

Stages and Predicates

Stage 1: any

any where host.os.type == "windows" and
(
 (event.category == "file" and event.type == "deletion" and file.path like "?:\\Users\\*\\AppData\\Local\\Temp\\TH????.tmp") or

 (event.category == "file" and file.path : "?:\\Users\\*\\AppData\\Roaming\\remcos\\logs.dat") or

 (event.category == "registry" and
  registry.value : ("Remcos", "Rmc-??????", "licence") and
  registry.path : (
      "*\\Windows\\CurrentVersion\\Run\\Remcos",
      "*\\Windows\\CurrentVersion\\Run\\Rmc-??????",
      "*\\SOFTWARE\\Remcos-*\\licence",
      "*\\Software\\Rmc-??????\\licence"
  )
 )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.categoryeq
  • file corpus 14 (elastic 14)
  • registry corpus 7 (elastic 7)
field:"event.category" kind:eq
event.typeeq
  • deletion corpus 16 (elastic 16)
field:"event.type" kind:eq value:"deletion"
file.pathwildcard
  • ?:\Users\*\AppData\Local\Temp\TH????.tmp
  • ?:\Users\*\AppData\Roaming\remcos\logs.dat corpus 2 (elastic 2)
field:"TargetFilename" kind:wildcard
registry.pathwildcard
  • *\SOFTWARE\Remcos-*\licence
  • *\Software\Rmc-??????\licence
  • *\Windows\CurrentVersion\Run\Remcos
  • *\Windows\CurrentVersion\Run\Rmc-??????
field:"TargetObject" kind:wildcard
registry.valuewildcard
  • Remcos
  • Rmc-??????
  • licence
field:"registry_value_name" kind:wildcard

Potential Secure File Deletion via SDelete Utility

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

Detects file name patterns generated by the use of Sysinternals SDelete utility to securely delete a file via multiple file overwrite and rename operations.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2020/08/18"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"

[rule]
author = ["Elastic"]
description = """
Detects file name patterns generated by the use of Sysinternals SDelete utility to securely delete a file via multiple
file overwrite and rename operations.
"""
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.file-*",
    "logs-windows.sysmon_operational-*",
    "endgame-*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Secure File Deletion via SDelete Utility"
note = """## Triage and analysis

### Investigating Potential Secure File Deletion via SDelete Utility

SDelete is a tool primarily used for securely deleting data from storage devices, making it unrecoverable. Microsoft develops it as part of the Sysinternals Suite. Although commonly used to delete data securely, attackers can abuse it to delete forensic indicators and remove files as a post-action to a destructive action such as ransomware or data theft to hinder recovery efforts.

This rule identifies file name patterns generated by the use of SDelete utility to securely delete a file via multiple file overwrite and rename operations.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Examine the command line and identify the files deleted, their importance and whether they could be the target of antiforensics activity.

### False positive analysis

- This is a dual-use tool, meaning its usage is not inherently malicious. Analysts can dismiss the alert if the administrator is aware of the activity, no other suspicious activity was identified, and there are justifications for the execution.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
  - Prioritize cases involving critical servers and users.
- Isolate the involved hosts 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.
- If important data was encrypted, deleted, or modified, activate your data recovery plan.
    - Perform data recovery locally or restore the backups from replicated copies (cloud, other servers, etc.).
- 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.
- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
- 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 11 - File Create](https://ela.st/sysmon-event-11-setup)
"""

risk_score = 21
rule_id = "5aee924b-6ceb-4633-980e-1bde8cdb40c5"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Tactic: Impact",
    "Data Source: Elastic Endgame",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: Microsoft Defender XDR",
    "Data Source: SentinelOne",
    "Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type == "windows" and event.type == "change" and file.name : "*AAA.AAA"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"
[[rule.threat.technique.subtechnique]]
id = "T1070.004"
name = "File Deletion"
reference = "https://attack.mitre.org/techniques/T1070/004/"



[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1485"
name = "Data Destruction"
reference = "https://attack.mitre.org/techniques/T1485/"


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

Stages and Predicates

Stage 1: file

file where host.os.type == "windows" and event.type == "change" and file.name : "*AAA.AAA"

Indicators

These rows show field, operator, and value matches.

Potential Shadow Read via Unprivileged User

#
Source
github.com/elastic/protections-artifacts

This rule detects instances where an unprivileged user changes to the shadow group, via a world-/user-writeable process, potentially indicating the execution of an exploit to read the shadow file.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule detects instances where an unprivileged user changes to the shadow group, via a world-/user-writeable process,
potentially indicating the execution of an exploit to read the shadow file.
"""
id = "1d796727-35a3-4d2c-93f0-2a745554b252"
license = "Elastic License v2"
name = "Potential Shadow Read via Unprivileged User"
os_list = ["linux"]
reference = ["https://github.com/0xdeadbeefnetwork/ssh-keysign-pwn"]
version = "1.0.1"

query = '''
process where event.type == "change" and event.action == "gid_change" and
group.name == "shadow" and user.id >= 1000 and process.parent.user.id >= 1000 and process.parent.group.id >= 1000 and
(
  process.parent.executable like (".*", "/tmp/*", "/dev/shm/*", "/var/tmp/*", "/home/*/*", "/run/user/*", "/var/run/user/*") or
  process.executable like (".*", "/tmp/*", "/dev/shm/*", "/var/tmp/*", "/home/*/*", "/run/user/*", "/var/run/user/*")
) and
not (
  process.group_leader.executable in (
    "/usr/sbin/lightdm", "/usr/bin/xfce4-session", "/usr/bin/ksmserver", "/tmp/newroot/usr/bin/xfce4-session"
  ) or
  process.executable in (
    "/tmp/newroot/usr/bin/i3lock", "/tmp/newroot/newroot/newroot/usr/bin/i3lock", "/tmp/newroot/bin/bash"
  )
)
'''

min_endpoint_version = "8.6.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 = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[threat.technique.subtechnique]]
id = "T1003.008"
name = "/etc/passwd and /etc/shadow"
reference = "https://attack.mitre.org/techniques/T1003/008/"



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

[internal]
min_endpoint_version = "8.6.0"

Stages and Predicates

Stage 1: process

process where event.type == "change" and event.action == "gid_change" and
group.name == "shadow" and user.id >= 1000 and process.parent.user.id >= 1000 and process.parent.group.id >= 1000 and
(
  process.parent.executable like (".*", "/tmp/*", "/dev/shm/*", "/var/tmp/*", "/home/*/*", "/run/user/*", "/var/run/user/*") or
  process.executable like (".*", "/tmp/*", "/dev/shm/*", "/var/tmp/*", "/home/*/*", "/run/user/*", "/var/run/user/*")
) and
not (
  process.group_leader.executable in (
    "/usr/sbin/lightdm", "/usr/bin/xfce4-session", "/usr/bin/ksmserver", "/tmp/newroot/usr/bin/xfce4-session"
  ) or
  process.executable in (
    "/tmp/newroot/usr/bin/i3lock", "/tmp/newroot/newroot/newroot/usr/bin/i3lock", "/tmp/newroot/bin/bash"
  )
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablein/tmp/newroot/bin/bash, /tmp/newroot/newroot/newroot/usr/bin/i3lock, /tmp/newroot/usr/bin/i3lockexcludes:process.executable field:"process.executable" value:"/tmp/newroot/bin/bash" field:"process.executable" value:"/tmp/newroot/newroot/newroot/usr/bin/i3lock" field:"process.executable" value:"/tmp/newroot/usr/bin/i3lock"
process.group_leader.executablein/tmp/newroot/usr/bin/xfce4-session, /usr/bin/ksmserver, /usr/bin/xfce4-session, /usr/sbin/lightdmexcludes:process.group_leader.executable

Potential Virtual Machine Fingerprinting via VMDetect

#
Source
github.com/elastic/protections-artifacts

Identifies the use of VMdetect utility to avoid execution on Malware sandboxes and virtual machines. An adversary may attempt to get detailed information about the operating system and hardware.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the use of VMdetect utility to avoid execution on Malware sandboxes and virtual machines. An adversary may
attempt to get detailed information about the operating system and hardware.
"""
id = "75226c55-55b5-47b6-b27a-757b895c3bce"
license = "Elastic License v2"
name = "Potential Virtual Machine Fingerprinting via VMDetect"
os_list = ["windows"]
reference = ["https://github.com/dretax/VMDetect"]
version = "1.0.22"

query = '''
process where event.action == "start" and process.pe.original_file_name == "vmdetect.exe"
'''

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

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

[[threat.technique]]
id = "T1497"
name = "Virtualization/Sandbox Evasion"
reference = "https://attack.mitre.org/techniques/T1497/"
[[threat.technique.subtechnique]]
id = "T1497.001"
name = "System Checks"
reference = "https://attack.mitre.org/techniques/T1497/001/"



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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and process.pe.original_file_name == "vmdetect.exe"

Indicators

These rows show field, operator, and value matches.

Process Injection - Detected - Elastic Endgame

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

Elastic Endgame detected Process Injection. Click the Elastic Endgame icon in the event.module column or the link in the rule.reference column for additional information.

MITRE ATT&CK Coverage

TacticTechniques
Privilege Escalation

Rule Body

[metadata]
creation_date = "2020/02/18"
maturity = "production"
promotion = true
updated_date = "2025/03/21"

[rule]
author = ["Elastic"]
description = """
Elastic Endgame detected Process Injection. Click the Elastic Endgame icon in the event.module column or the link in the
rule.reference column for additional information.
"""
from = "now-2m"
index = ["endgame-*"]
interval = "1m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "Process Injection - Detected - Elastic Endgame"
risk_score = 73
rule_id = "80c52164-c82a-402c-9964-852533d58be1"
setup = """## Setup

### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "high"
tags = ["Data Source: Elastic Endgame", "Use Case: Threat Detection", "Tactic: Privilege Escalation", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.kind:alert and event.module:endgame and endgame.metadata.type:detection and (event.action:kernel_shellcode_event or endgame.event_subtype_full:kernel_shellcode_event)
'''
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 Process Injection - Detected - Elastic Endgame

Elastic Endgame is a security solution that monitors and detects suspicious activities like process injection, a technique often used by adversaries to execute malicious code within the address space of another process, thereby evading detection. This detection rule identifies such threats by analyzing alerts and specific event actions related to kernel shellcode, indicating potential privilege escalation attempts. By leveraging MITRE ATT&CK frameworks, it effectively flags high-risk activities, aiding analysts in mitigating threats.

### Possible investigation steps

- Review the alert details in the Elastic Endgame console by clicking the Elastic Endgame icon in the event.module column or the link in the rule.reference column to gather more context about the detected process injection.
- Examine the specific event.action and endgame.event_subtype_full fields to confirm the presence of kernel_shellcode_event, which indicates potential malicious activity.
- Analyze the process tree and parent-child relationships of the affected process to identify any unusual or unauthorized processes that may have initiated the injection.
- Check for any recent privilege escalation attempts or suspicious activities associated with the affected process by correlating with other alerts or logs in the system.
- Investigate the source and destination IP addresses, if available, to determine if there is any external communication that could suggest a command and control connection.
- Assess the risk and impact of the detected activity by considering the risk score and severity level, and prioritize response actions accordingly.
- If necessary, isolate the affected system to prevent further malicious activity and begin remediation efforts based on the findings.

### False positive analysis

- Legitimate software updates or patches may trigger process injection alerts. Users can create exceptions for known update processes by identifying their unique process names or hashes.
- Security tools or monitoring software that use process injection for legitimate purposes might be flagged. Users should whitelist these tools by specifying their process identifiers or paths.
- Custom scripts or automation tasks that interact with system processes could be misidentified as threats. Users can exclude these scripts by defining their execution context or command-line arguments.
- Debugging or development activities involving process manipulation might cause false positives. Users should consider excluding these activities during known development periods or within specific environments.
- Virtualization or sandboxing solutions that mimic process injection techniques for isolation purposes may be detected. Users can create exceptions for these solutions by recognizing their specific signatures or behaviors.

### Response and remediation

- Isolate the affected system immediately to prevent further spread of the malicious code. Disconnect it from the network and any shared resources.
- Terminate the malicious process identified by the alert to stop the execution of injected code. Use process management tools to safely end the process.
- Conduct a thorough scan of the affected system using updated antivirus and anti-malware tools to identify and remove any additional threats or remnants of the attack.
- Review and analyze system logs and the specific event details from the alert to understand the scope of the intrusion and identify any other potentially compromised systems.
- Apply security patches and updates to the operating system and all software applications on the affected system to close any vulnerabilities exploited by the attacker.
- Restore the system from a known good backup taken before the incident occurred, ensuring that the backup is free from any malicious code.
- Report the incident to the appropriate internal security team or external authorities if required, providing them with detailed information about the attack and the steps taken for remediation."""


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


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

Stages and Predicates

Stage 1: query

event.kind:alert and event.module:endgame and endgame.metadata.type:detection and (event.action:kernel_shellcode_event or endgame.event_subtype_full:kernel_shellcode_event)

Indicators

These rows show field, operator, and value matches.

Script Execution via Microsoft HTML Application

#
Source
github.com/elastic/protections-artifacts

Identifies the execution of scripts via HTML applications using Windows utilities rundll32.exe or mshta.exe. Adversaries may bypass process and/or signature-based defenses by proxying execution of malicious content with signed binaries.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the execution of scripts via HTML applications using Windows utilities rundll32.exe or mshta.exe. Adversaries
may bypass process and/or signature-based defenses by proxying execution of malicious content with signed binaries.
"""
id = "f0630213-c4c4-4898-9514-746395eb9962"
license = "Elastic License v2"
name = "Script Execution via Microsoft HTML Application"
os_list = ["windows"]
version = "1.0.38"

query = '''
process where event.action == "start" and
 (process.name : ("rundll32.exe", "mshta.exe") or
  process.pe.original_file_name in ("MSHTA.EXE", "RUNDLL32.EXE")) and
  (
     (process.command_line :
        (
        "*script*eval(*",
         "*script*GetObject*",
         "*.regread(*",
         "*WScript.Shell*",
         "*.run(*",
         "*).Exec()*",
         "*mshta*http*",
         "*mshtml*RunHTMLApplication*",
         "*mshtml*,#135*",
         "*StrReverse*",
         "*.RegWrite*",
         /* Issue #379 */
         "*window.close(*",
         "* Chr(*"
         )
     /* FPs observed in telemetry */
     and not process.parent.executable :
                  ("?:\\Program Files (x86)\\Citrix\\System32\\wfshell.exe",
                   "?:\\Program Files (x86)\\Microsoft Office\\Office*\\MSACCESS.EXE",
                   "?:\\Program Files\\Quokka.Works GTInstaller\\GTInstaller.exe")
     and not (process.name : "mshta.exe" and process.parent.name : "cscript.exe" and process.parent.command_line : "*GTInstaller.vbs*")
     ) or
    /* Issue #379 */
    (process.pe.original_file_name : "mshta.exe" and
     not process.command_line : ("*.hta*", "*.htm*", "-Embedding") and process.args_count >=2) or

     /* Execution of HTA file downloaded from the internet */
     (process.pe.original_file_name : "mshta.exe" and process.command_line : "*\\Users\\*\\Downloads\\*.hta*") or

     /* Execution of HTA file from archive */
     (process.pe.original_file_name : "mshta.exe" and
      process.args : ("?:\\Users\\*\\Temp\\7z*", "?:\\Users\\*\\Temp\\Rar$*", "?:\\Users\\*\\Temp\\Temp?_*", "?:\\Users\\*\\Temp\\BNZ.*")) or

     /* Execution of HTA file from mounted ISO files */
     (process.pe.original_file_name : "mshta.exe" and
      process.parent.name : ("explorer.exe", "cmd.exe", "powershell.exe") and process.working_directory : "?:\\") or

     /* Webdav */
     (process.name : "mshta.exe" and process.args : "\\\\*@*\\*")
   ) and

  /* FPs */
  not (process.parent.executable : "C:\\Windows\\SysWOW64\\runonce.exe" and
       process.args : "\"& 'C:\\System.sav\\util\\HpseuHostLauncher.ps1'\"\", 0 : window.close)") and
  not (process.name : "mshta.exe" and
       process.args : ("*\\Support\\AzureVirtualDesktop\\ImageSources\\DisableTeamsAutoStart.ps1*",
                       "*C:\\Program Files (x86)\\combit\\*\\ServicePackNotification.ps1*")) and
  not process.command_line :  ("*encodeURIComponent*", "*.Popup*", "*C:\\PROGRA~2*", "*\\Downloads\\download*.hta*", "*Readme_he-IL.hta*", "*cisco-secure-client-win*") and
  not (process.parent.name : "cmd.exe" and process.name : "mshta.exe" and process.args : "D:\\start.hta") and
  not (process.name : "mshta.exe" and process.parent.executable : "C:\\Windows\\SysWOW64\\cmd.exe" and
       process.parent.args : "C:\\HP Universal Print Driver\\*\\Installer\\Install.bat")
'''

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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"

[[threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"



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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
 (process.name : ("rundll32.exe", "mshta.exe") or
  process.pe.original_file_name in ("MSHTA.EXE", "RUNDLL32.EXE")) and
  (
     (process.command_line :
        (
        "*script*eval(*",
         "*script*GetObject*",
         "*.regread(*",
         "*WScript.Shell*",
         "*.run(*",
         "*).Exec()*",
         "*mshta*http*",
         "*mshtml*RunHTMLApplication*",
         "*mshtml*,#135*",
         "*StrReverse*",
         "*.RegWrite*",
         "*window.close(*",
         "* Chr(*"
         )
     and not process.parent.executable :
                  ("?:\\Program Files (x86)\\Citrix\\System32\\wfshell.exe",
                   "?:\\Program Files (x86)\\Microsoft Office\\Office*\\MSACCESS.EXE",
                   "?:\\Program Files\\Quokka.Works GTInstaller\\GTInstaller.exe")
     and not (process.name : "mshta.exe" and process.parent.name : "cscript.exe" and process.parent.command_line : "*GTInstaller.vbs*")
     ) or
    (process.pe.original_file_name : "mshta.exe" and
     not process.command_line : ("*.hta*", "*.htm*", "-Embedding") and process.args_count >=2) or
     (process.pe.original_file_name : "mshta.exe" and process.command_line : "*\\Users\\*\\Downloads\\*.hta*") or
     (process.pe.original_file_name : "mshta.exe" and
      process.args : ("?:\\Users\\*\\Temp\\7z*", "?:\\Users\\*\\Temp\\Rar$*", "?:\\Users\\*\\Temp\\Temp?_*", "?:\\Users\\*\\Temp\\BNZ.*")) or
     (process.pe.original_file_name : "mshta.exe" and
      process.parent.name : ("explorer.exe", "cmd.exe", "powershell.exe") and process.working_directory : "?:\\") or
     (process.name : "mshta.exe" and process.args : "\\\\*@*\\*")
   ) and
  not (process.parent.executable : "C:\\Windows\\SysWOW64\\runonce.exe" and
       process.args : "\"& 'C:\\System.sav\\util\\HpseuHostLauncher.ps1'\"\", 0 : window.close)") and
  not (process.name : "mshta.exe" and
       process.args : ("*\\Support\\AzureVirtualDesktop\\ImageSources\\DisableTeamsAutoStart.ps1*",
                       "*C:\\Program Files (x86)\\combit\\*\\ServicePackNotification.ps1*")) and
  not process.command_line :  ("*encodeURIComponent*", "*.Popup*", "*C:\\PROGRA~2*", "*\\Downloads\\download*.hta*", "*Readme_he-IL.hta*", "*cisco-secure-client-win*") and
  not (process.parent.name : "cmd.exe" and process.name : "mshta.exe" and process.args : "D:\\start.hta") and
  not (process.name : "mshta.exe" and process.parent.executable : "C:\\Windows\\SysWOW64\\cmd.exe" and
       process.parent.args : "C:\\HP Universal Print Driver\\*\\Installer\\Install.bat")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.argswildcard
  • ?:\Users\*\Temp\7z* corpus 4 (elastic 4)
  • ?:\Users\*\Temp\BNZ.* corpus 3 (elastic 3)
  • ?:\Users\*\Temp\Rar$* corpus 4 (elastic 4)
  • ?:\Users\*\Temp\Temp?_* corpus 4 (elastic 4)
  • \\*@*\* corpus 3 (elastic 3)
field:"process.args" kind:wildcard
process.args_countge
  • 2 transforms: number corpus 18 (elastic 18)
field:"process.args_count" kind:ge value:"2"
process.command_linewildcard
  • * Chr(* corpus 2 (elastic 2)
  • *).Exec()* corpus 2 (elastic 2)
  • *.RegWrite* corpus 2 (elastic 2)
  • *.regread(* corpus 2 (elastic 2)
  • *.run(* corpus 2 (elastic 2)
  • *StrReverse* corpus 2 (elastic 2)
  • *WScript.Shell* corpus 3 (elastic 3)
  • *\Users\*\Downloads\*.hta* corpus 2 (elastic 2)
  • *mshta*http* corpus 2 (elastic 2)
  • *mshtml*,#135* corpus 2 (elastic 2)
  • *mshtml*RunHTMLApplication* corpus 2 (elastic 2)
  • *script*GetObject* corpus 2 (elastic 2)
  • *script*eval(* corpus 2 (elastic 2)
  • *window.close(* corpus 2 (elastic 2)
field:"CommandLine" kind:wildcard
process.namewildcard
  • mshta.exe corpus 84 (elastic 80, splunk 4)
  • rundll32.exe corpus 123 (elastic 100, splunk 23)
field:"process_basename" kind:wildcard
process.parent.namewildcard
  • cmd.exe corpus 37 (elastic 32, splunk 4, kusto 1)
  • explorer.exe corpus 50 (elastic 50)
  • powershell.exe corpus 37 (elastic 35, splunk 1, kusto 1)
field:"parent_process_basename" kind:wildcard
process.pe.original_file_namein
  • MSHTA.EXE corpus 8 (elastic 8)
  • RUNDLL32.EXE corpus 8 (elastic 8)
field:"OriginalFileName" kind:in
process.pe.original_file_namewildcard
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
field:"OriginalFileName" kind:wildcard value:"mshta.exe"
process.working_directorywildcard
  • ?:\ corpus 8 (elastic 8)
field:"CurrentDirectory" kind:wildcard value:"?:\"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseqD:\start.htaexcludes:process.args field:"process.args" value:"D:\start.hta"
process.nameeqmshta.exeexcludes:process.name field:"process.name" value:"mshta.exe"
process.parent.nameeqcmd.exeexcludes:process.parent.name field:"process.parent.name" value:"cmd.exe"
process.argseq"& 'C:\System.sav\util\HpseuHostLauncher.ps1'"", 0 : window.close)excludes:process.args
process.parent.executableeqC:\Windows\SysWOW64\runonce.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\SysWOW64\runonce.exe"
process.argswildcard*\Support\AzureVirtualDesktop\ImageSources\DisableTeamsAutoStart.ps1*, *C:\Program Files (x86)\combit\*\ServicePackNotification.ps1*excludes:process.args field:"process.args" value:"*\Support\AzureVirtualDesktop\ImageSources\DisableTeamsAutoStart.ps1*" field:"process.args" value:"*C:\Program Files (x86)\combit\*\ServicePackNotification.ps1*"
process.parent.argswildcardC:\HP Universal Print Driver\*\Installer\Install.batexcludes:process.parent.args field:"process.parent.args" value:"C:\HP Universal Print Driver\*\Installer\Install.bat"
process.parent.executableeqC:\Windows\SysWOW64\cmd.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\SysWOW64\cmd.exe"
process.command_linewildcard*encodeURIComponent*, *.Popup*, *C:\PROGRA~2*, *\Downloads\download*.hta*, *Readme_he-IL.hta*, *cisco-secure-client-win*excludes:process.command_line

Simple HTTP Web Server Connection

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

This rule detects connections accepted by a simple HTTP web server in Python and PHP built-in modules. Adversaries may create simple HTTP web servers to establish persistence on a compromised system by uploading a reverse or command shell payload to the server web root, allowing them to regain remote access to the system if lost. This event may occur when an attacker requests the server to execute a command or script via a potential backdoor.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/12/17"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects connections accepted by a simple HTTP web server in Python and PHP built-in modules. Adversaries may
create simple HTTP web servers to establish persistence on a compromised system by uploading a reverse or command shell
payload to the server web root, allowing them to regain remote access to the system if lost. This event may occur when
an attacker requests the server to execute a command or script via a potential backdoor.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "logs-endpoint.events.network*"]
language = "eql"
license = "Elastic License v2"
name = "Simple HTTP Web Server Connection"
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 Simple HTTP Web Server Connection

Simple HTTP servers in Python and PHP are often used for development and testing, providing a quick way to serve web content. However, attackers can exploit these servers to maintain access on compromised Linux systems by deploying backdoors or executing commands remotely. The detection rule identifies suspicious server activity by monitoring for specific process patterns and command-line arguments indicative of these lightweight servers, flagging potential misuse for further investigation.

### Possible investigation steps

- Review the process details, including the process name and command line arguments, to confirm if the server was started using Python or PHP, as indicated by the query fields.
- Check the network connection details associated with the event, such as the source and destination IP addresses and ports, to identify any suspicious or unexpected connections.
- Investigate the user account under which the process was initiated to determine if it aligns with expected behavior or if it indicates potential unauthorized access.
- Examine the system logs and any related events around the time of the alert to identify any additional suspicious activities or anomalies.
- Assess the server's web root directory for any unauthorized files or scripts that could indicate a backdoor or malicious payload.
- Correlate this event with other alerts or indicators of compromise on the system to evaluate if this is part of a larger attack campaign.

### False positive analysis

- Development and testing environments may frequently trigger this rule when developers use Python or PHP's built-in HTTP servers for legitimate purposes. To manage this, consider excluding specific user accounts or IP addresses associated with development activities from the rule.
- Automated scripts or cron jobs that start simple HTTP servers for routine tasks can also generate false positives. Identify these scripts and add their process names or command-line patterns to an exception list.
- Educational or training environments where students are learning web development might cause alerts. In such cases, exclude the network segments or user groups associated with these activities.
- Internal tools or services that rely on lightweight HTTP servers for functionality might be flagged. Review these tools and whitelist their specific process names or command-line arguments to prevent unnecessary alerts.
- Temporary testing servers spun up for short-term projects can be mistaken for malicious activity. Document these instances and apply temporary exceptions during the project duration.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious Python or PHP processes identified by the detection rule to stop the potential backdoor or unauthorized server activity.
- Conduct a thorough review of the system's file system, focusing on the web root directory, to identify and remove any unauthorized scripts or payloads that may have been uploaded.
- Change all credentials associated with the compromised system, including SSH keys and passwords, to prevent attackers from regaining access.
- Restore the system from a known good backup if any unauthorized changes or persistent threats are detected that cannot be easily remediated.
- Implement network monitoring to detect any future unauthorized HTTP server activity, focusing on unusual process patterns and command-line arguments.
- Escalate the incident to the security operations team for further investigation and to assess the potential impact on other systems within the network."""
risk_score = 21
rule_id = "183f3cd2-4cc6-44c0-917c-c5d29ecdcf74"
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: Command and Control",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence by process.entity_id with maxspan=1m
[process where host.os.type == "linux" and event.type == "start" and 
 (
  (process.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.command_line like "*-S*") or
  (process.name like "python*" and process.command_line like ("*--cgi*", "*CGIHTTPServer*"))
 ) and not process.parent.command_line == "runc init"
]
[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_accepted"]
'''

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

[[rule.threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"

[[rule.threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"

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

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

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

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

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

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

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

[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"

[[rule.threat.technique.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"

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

Stages and Predicates

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

Stage 1: process

[process where host.os.type == "linux" and event.type == "start" and 
 (
  (process.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.command_line like "*-S*") or
  (process.name like "python*" and process.command_line like ("*--cgi*", "*CGIHTTPServer*"))
 ) and not process.parent.command_line == "runc init"
]

Stage 2: network

[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_accepted"]

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.command_lineeqrunc initexcludes:process.parent.command_line field:"process.parent.command_line" value:"runc init"

Spike in Group Membership Events

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

A machine learning job has identified an unusual spike in Okta group membership events, indicating potential privileged access activity. Attackers or malicious insiders might be adding accounts to privileged groups to escalate their access, potentially leading to unauthorized actions or data breaches.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/02/18"
integration = ["pad", "okta"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"

[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job has identified an unusual spike in Okta group membership events, indicating potential privileged
access activity. Attackers or malicious insiders might be adding accounts to privileged groups to escalate their access,
potentially leading to unauthorized actions or data breaches.
"""
from = "now-3h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "pad_okta_spike_in_group_membership_changes_ea"
name = "Spike in Group Membership Events"
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 Spike in Group Membership Events

In modern IT environments, group membership management is crucial for controlling access to resources. Adversaries may exploit this by adding accounts to privileged groups, thereby escalating their access rights. The detection rule leverages machine learning to identify unusual spikes in group membership events, signaling potential unauthorized access attempts. This proactive approach helps in mitigating risks associated with privilege escalation.

### Possible investigation steps

- Review the specific Okta group membership events that triggered the alert to identify which accounts were added to privileged groups.
- Cross-reference the accounts added with known user roles and responsibilities to determine if the changes align with expected access patterns.
- Check recent activity logs for the accounts added to privileged groups to identify any suspicious or unauthorized actions following the group membership change.
- Investigate the source of the group membership changes, including the user or system that initiated the changes, to assess if it was a legitimate administrative action.
- Analyze historical data for similar spikes in group membership events to determine if this is part of a recurring pattern or an isolated incident.
- Consult with the IT or security team to verify if there were any recent changes in access policies or group management procedures that could explain the spike.

### False positive analysis

- Routine administrative tasks may trigger spikes in group membership events, such as scheduled updates or onboarding processes. Users can create exceptions for these known activities to prevent false alerts.
- Automated scripts or tools that manage group memberships for legitimate purposes might cause false positives. Identifying and excluding these scripts from monitoring can reduce unnecessary alerts.
- Changes in group membership due to organizational restructuring or policy updates can appear as spikes. Documenting these changes and adjusting the detection parameters accordingly can help mitigate false positives.
- Frequent legitimate access requests to privileged groups during specific business cycles, like end-of-quarter financial reviews, can be excluded by setting time-based exceptions.
- Regular audits or compliance checks that involve temporary access to privileged groups should be accounted for by creating temporary exceptions during these periods.

### Response and remediation

- Immediately isolate the affected accounts by removing them from any privileged groups to prevent further unauthorized access.
- Conduct a thorough review of recent group membership changes in Okta to identify any other unauthorized additions and remove them as necessary.
- Reset passwords and enforce multi-factor authentication for the affected accounts to secure them against further compromise.
- Notify the security operations team and relevant stakeholders about the incident for awareness and further investigation.
- Implement additional monitoring on the affected accounts and privileged groups to detect any further suspicious activity.
- Review and update access control policies to ensure that only authorized personnel can modify group memberships, reducing the risk of future unauthorized changes.
- Document the incident and response actions taken, and conduct a post-incident review to identify any gaps in the current security posture and improve future response efforts."""
references = [
    "https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
    "https://docs.elastic.co/en/integrations/pad",
]
risk_score = 21
rule_id = "138520d2-11ff-4288-a80e-a45b36dca4b1"
setup = """## Setup

The rule requires the Privileged Access Detection integration assets to be installed, as well as Okta logs collected by integrations such as Okta.

### Privileged Access Detection Setup
The Privileged Access Detection integration detects privileged access activity by identifying abnormalities in Windows, Linux and Okta events. Anomalies are detected using Elastic's Anomaly Detection feature.

#### Prerequisite Requirements:
- Fleet is required for Privileged Access Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Okta events collected by [Okta](https://docs.elastic.co/en/integrations/okta) integration.
- To add the Okta integration to an Elastic Agent policy, refer to [this](https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html) guide.

#### The following steps should be executed to install assets associated with the Privileged Access Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Privileged Access Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
    "Data Source: Okta",
    "Use Case: Privileged Access Detection",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Tactic: Privilege Escalation",
    "Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"

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

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[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 = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

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

Suspicious Content Extracted or Decompressed via Funzip

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

Identifies when suspicious content is extracted from a file and subsequently decompressed using the funzip utility. Malware may execute the tail utility using the "-c" option to read a sequence of bytes from the end of a file. The output from tail can be piped to funzip in order to decompress malicious code before it is executed. This behavior is consistent with malware families such as Bundlore.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/06/26"
integration = ["endpoint", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Identifies when suspicious content is extracted from a file and subsequently decompressed using the funzip utility.
Malware may execute the tail utility using the "-c" option to read a sequence of bytes from the end of a file. The
output from tail can be piped to funzip in order to decompress malicious code before it is executed. This behavior is
consistent with malware families such as Bundlore.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-crowdstrike.fdr*"
]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Content Extracted or Decompressed via Funzip"
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 Content Extracted or Decompressed via Funzip

Funzip is a utility used to decompress files directly from a stream, often employed in legitimate data processing tasks. However, adversaries can exploit this by combining it with the 'tail' command to extract and execute malicious payloads stealthily. The detection rule identifies this misuse by monitoring specific command sequences and excluding benign processes, thus flagging potential threats for further investigation.

### Possible investigation steps

- Review the process details to confirm the presence of the 'tail' and 'funzip' command sequence, focusing on the specific arguments used, such as "-c", to understand the context of the command execution.
- Examine the parent process information to determine if the process was initiated by any known benign executables or scripts, specifically checking against the exclusion list like "/usr/bin/dracut" or "/sbin/dracut".
- Investigate the command line history and execution context of the parent process, especially if it involves "sh" or "sudo", to identify any suspicious patterns or unauthorized script executions.
- Check the file path and content being accessed by the 'tail' command to ensure it is not targeting sensitive or unexpected files, excluding known benign paths like "/var/log/messages".
- Correlate the event with other security alerts or logs from the same host to identify any related suspicious activities or patterns that might indicate a broader compromise.
- Assess the risk and impact by determining if the decompressed content was executed or if it led to any subsequent suspicious processes or network connections.

### False positive analysis

- Legitimate system maintenance tasks may trigger this rule if they involve decompressing logs or data files using funzip. To manage this, identify and exclude specific maintenance scripts or processes that are known to use funzip in a non-threatening manner.
- Automated backup or data processing operations might use funzip in combination with tail for legitimate purposes. Review these operations and add exceptions for known benign processes or scripts that match this pattern.
- Security tools or monitoring solutions like Nessus may inadvertently trigger this rule if they use similar command sequences for scanning or data collection. Exclude these tools by adding exceptions for their specific command lines or parent processes.
- Custom scripts developed in-house for data analysis or processing might use funzip and tail together. Document these scripts and exclude them from the rule to prevent false positives, ensuring they are reviewed and approved by security teams.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further spread of the potential malware.
- Terminate any suspicious processes identified by the detection rule, specifically those involving the 'tail' and 'funzip' command sequence.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any malicious payloads.
- Review and analyze system logs and command history to identify any unauthorized access or additional malicious activities that may have occurred.
- Restore any compromised files or systems from known good backups to ensure integrity and availability of data.
- Implement application whitelisting to prevent unauthorized execution of utilities like 'funzip' and 'tail' by non-administrative users.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the need for broader organizational response measures."""
references = ["https://attack.mitre.org/software/S0482/"]
risk_score = 47
rule_id = "dc0b7782-0df0-47ff-8337-db0d678bdb66"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

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

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

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

[[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 = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"

[[rule.threat.technique.subtechnique]]
id = "T1027.015"
name = "Compression"
reference = "https://attack.mitre.org/techniques/T1027/015/"

[[rule.threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"

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

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
((process.args == "tail" and process.args == "-c" and process.args == "funzip")) and
not process.args : "/var/log/messages" and
not ?process.parent.executable : ("/usr/bin/dracut", "/sbin/dracut", "/usr/bin/xargs") and
not (process.parent.name in ("sh", "sudo") and ?process.parent.command_line : "*nessus_su*")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2
  • exec
  • exec_event
  • start
field:"EventType" kind:in
process.argseq
  • -c
  • funzip
  • tail
field:"process.args" kind:eq

Exclusions

The rule actively suppresses these predicates.

Suspicious Dscl Auth Validation

#
Source
github.com/elastic/protections-artifacts

Detects the execution of the Dscl binary with the '-authonly' option set, via an unsigned or untrusted binary. This allows a username and password to be provided validating that username and password against the directory services on macOS. Many malware samples will execute this after collecting a users password via some type of prompt in order to validate the correct password was provided and authenticate them locally without logging in.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects the execution of the Dscl binary with the '-authonly' option set, via an unsigned or untrusted binary. This
allows a username and password to be provided validating that username and password against the directory services on
macOS. Many malware samples will execute this after collecting a users password via some type of prompt in order to
validate the correct password was provided and authenticate them locally without logging in.
"""
id = "4c0a820c-fe42-400b-8b20-57bc7d256f36"
license = "Elastic License v2"
name = "Suspicious Dscl Auth Validation"
os_list = ["macos"]
version = "1.0.12"

query = '''
process where event.type == "start" and event.action == "exec" and process.name == "dscl" and 
 process.args like~ "-authonly" and ((process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false) or process.parent.name in ("sh", "zsh", "bash")) and
 not process.Ext.effective_parent.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
                                                 "/Library/csdaemon/csdaemon",
                                                 "/Applications/NinjaRMMAgent/programfiles/ninjarmm-macagent",
                                                 "/usr/bin/dscl",
                                                 "/usr/local/jamf/bin/jamf",
                                                 "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
                                                 "/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
                                                 "/Applications/Splashtop Streamer.app/Contents/MacOS/SRStreamerDaemon",
                                                 "/opt/jc/bin/jumpcloud-agent",
                                                 "/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM")
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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 = "T1033"
name = "System Owner/User Discovery"
reference = "https://attack.mitre.org/techniques/T1033/"


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

[internal]
min_endpoint_version = "8.11.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.name == "dscl" and 
 process.args like~ "-authonly" and ((process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false) or process.parent.name in ("sh", "zsh", "bash")) and
 not process.Ext.effective_parent.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
                                                 "/Library/csdaemon/csdaemon",
                                                 "/Applications/NinjaRMMAgent/programfiles/ninjarmm-macagent",
                                                 "/usr/bin/dscl",
                                                 "/usr/local/jamf/bin/jamf",
                                                 "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
                                                 "/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
                                                 "/Applications/Splashtop Streamer.app/Contents/MacOS/SRStreamerDaemon",
                                                 "/opt/jc/bin/jumpcloud-agent",
                                                 "/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.effective_parent.executablein/Applications/NinjaRMMAgent/programfiles/ninjarmm-macagent, /Applications/Splashtop Streamer.app/Contents/MacOS/SRStreamerDaemon, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService, /Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM, /Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon, /Library/csdaemon/csdaemon, /opt/jc/bin/jumpcloud-agent, /usr/bin/dscl, /usr/local/jamf/bin/jamfexcludes:process.Ext.effective_parent.executable

Suspicious Executable Memory Mapping

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to map the whole content of a file in a memory region with execute permissions. This may indicate an attempt to allocate and write malicious code via memory mapping.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies attempts to map the whole content of a file in a memory region with execute permissions. This may indicate an
attempt to allocate and write malicious code via memory mapping.
"""
id = "20a1f655-498a-4a73-8793-9f7ed14b9601"
license = "Elastic License v2"
name = "Suspicious Executable Memory Mapping"
os_list = ["windows"]
reference = [
    "https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile2",
    "https://www.elastic.co/security-labs/dissecting-remcos-rat-part-four",
    "https://www.elastic.co/security-labs/doubling-down-etw-callstacks",
]
version = "1.0.5"

query = '''
api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and
 /* map the whole file to an executable memory region */
 process.Ext.api.parameters.size == 0 and process.Ext.api.behaviors == "allocate_shellcode" and
 _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.exists == false or $entry.status == "errorBadDigest") and
 not process.thread.Ext.call_stack_final_user_module.protection_provenance in ("Kernel", "Unknown", "Undetermined") and
 not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown") and
 not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                                       ("a79bfb466cabfef1a4faaf2eedbf0e823bf372f2a1f6f33e803702ff080f72f3",
                                        "9d3b9a942d4f7573f9f2f8197f3ca9254d483bd12226975476befe1c203544bb",
                                        "69c45175ecfd25af023f96ac0bb2c45e6a95e3ba8a5a50ee7969ccab14825c44",
                                        "2faef17891b413fd63fc34c019a22401cce33e11da3a788de787dccaed1238ec",
                                        "dc98b14cbb25ef1937217da4fde5e2cc13f4702b31a6bc481d8de2bd87ac0525",
                                        "1b5d9cec668335295c8e575bcedf4afcedbc445d8ccf8374c9380188965e78e3",
                                        "18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25",
                                        "d842b440338e59201a4e2d32779768d0f892cd131eeca904e155bd063158f71a",
                                        "9a0c65932e4f71dd850e16c5e2830463745e65c4b25f0d0731fe3fc5b94104f6",
                                        "72d2010ee14567e9d0c68c3411ba1bfee8b875ddbda6b5a467c28c9e83ebf557",
                                        "6ec60215507d4e671f743164a247362da212acd65f9e0cfb676abb0f9a428dfa",
                                        "f11e2c3e87d9f4531fb68664cfea76f7691f26986921f6b83b13d8a0531e673c",
                                        "9709ff9eb1e712145214525d692bd46380099959597cb85bf9716c71385d6446",
                                        "9176d1c98c87da7f22ef6e88b04669b84a952a506745e854bfabe56642ead659",
                                        "c8b1026e1c6dbeab082c587a796e5deffb0e0d04d9be52ff6e445a5d69a4e790",
                                        "a43a04d10b713edbc053a286a329c958b345d713153e52beeac73c99cb44a2c4",
                                        "6016f8944c4f2a47420474792ea88b4c49584529e8b257509249a5b7cb011a78",
                                        "e4494c9e346ab2c96feb4933521a1cbcc8e802b93c379aed2f7d5b2f82fc35f8",
                                        "983b1815934cdcca7fc2af14ba6b199bc1bd591e60e2550c98702efa454b26e5",
                                        "05e6e9c54e4da2adb0482b97bb4bbf1930ec229ea9266df0cbcc0d1847311ace",
                                        "905830b92cb86d3fa457f8f6f9c839aa85f05cc76daaeb0ab1b44b86b2455a85",
                                        "ff225f43ea5fef79d7565533e3e40c78d92c7547ce9c948a817f237ebef96ea3", 
                                        "533b27ac86fd52e44fa98b86cd96b65c60a3c0873eacc0a51a0e748df32131b6", 
                                        "017978d00b820a0cd38cfa904408e4271b0cacd56cfdee0bb7945cf875a2fb1e", 
                                        "59652dc55748c18aba7c575a2b41cd4128d0ab06809deaf553b725bacf13f60f", 
                                        "796494dcea0b9e1b1de25be0a8f6d6e7b1b87401ba606b269443898007a703fe", 
                                        "8b07e35fbd5831d66fe7f424cda4953acd3446917ac58f8469c511e77f0df40e", 
                                        "be8c2d187ebef266f75475c85125a7877acc19e70f4a45dfe14c31bfc349296f", 
                                        "a7d279cbfa959b5621b453c4d84e48033a79aa7da2cb85bb1f436ed2afd156ec", 
                                        "25477c0dad4e07def9d4a693fb410e9bf0b70531883b2dbbcfa7d5d6383deff9", 
                                        "a7d279cbfa959b5621b453c4d84e48033a79aa7da2cb85bb1f436ed2afd156ec", 
                                        "6c53d38e6caa9e1dfb08f2eb52659080611e45949b46627f47ab60fc4fb3a52e", 
                                        "ff20e643e1de23efaad7c274ffb68fa489e896151ec5b21064cfa6500ea62cc2", 
                                        "62dfa53f3ff9247583b48c9d1f431faaa8bceeed5bdf23558f7ce4a39039f5a4", 
                                        "ac36cd643420ab05628f3622de55a23291f77081c50e6ef1337487baea3360d1", 
                                        "df13445949901d9f43575ad8fd5005a490e9a2fa68e27e26e6ea6d4014b83635",
                                        "7f015c5673eec28b83637794b24199fe3b630ac94e49085994435787bac995c4",
                                        "07c69656044fb6ac4f57f0847be8230727f5258235b2106cbb0c15af86ffa444",
                                        "1bba7ad14b8b976dcaf39a004b4c6cf677032648fdf98e4aae9bddc2ccd69c6f",
                                        "afe907b872bbaa92da07b7cfe203763892061fca683637fe4df25666b28e97ee",
                                        "9becd39f90077a5ab064681c0a1be139d15be9ce434bacd48cd1dc894d3911cb",
                                        "7acaa0e07d37cdd814408145b1d0f2137eaf068ff716eee09f39c8e4625550fb",
                                        "e7bedb6d2b70d4685d2cb084f23ac10b44aa2ce112d458f2d8134061a68f0bd9",
                                        "1d1cfd19249c06adefa0ff104d3f5db7f48568993c540576ef1930210793c975") and
 not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files (x86)\\*", "c:\\windows\\assembly\\nativeimages_*.ni.dll", "?:\\program files\\*")
'''

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

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


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

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Stage 1: api

api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and
 process.Ext.api.parameters.size == 0 and process.Ext.api.behaviors == "allocate_shellcode" and
 _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.exists == false or $entry.status == "errorBadDigest") and
 not process.thread.Ext.call_stack_final_user_module.protection_provenance in ("Kernel", "Unknown", "Undetermined") and
 not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown") and
 not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                                       ("a79bfb466cabfef1a4faaf2eedbf0e823bf372f2a1f6f33e803702ff080f72f3",
                                        "9d3b9a942d4f7573f9f2f8197f3ca9254d483bd12226975476befe1c203544bb",
                                        "69c45175ecfd25af023f96ac0bb2c45e6a95e3ba8a5a50ee7969ccab14825c44",
                                        "2faef17891b413fd63fc34c019a22401cce33e11da3a788de787dccaed1238ec",
                                        "dc98b14cbb25ef1937217da4fde5e2cc13f4702b31a6bc481d8de2bd87ac0525",
                                        "1b5d9cec668335295c8e575bcedf4afcedbc445d8ccf8374c9380188965e78e3",
                                        "18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25",
                                        "d842b440338e59201a4e2d32779768d0f892cd131eeca904e155bd063158f71a",
                                        "9a0c65932e4f71dd850e16c5e2830463745e65c4b25f0d0731fe3fc5b94104f6",
                                        "72d2010ee14567e9d0c68c3411ba1bfee8b875ddbda6b5a467c28c9e83ebf557",
                                        "6ec60215507d4e671f743164a247362da212acd65f9e0cfb676abb0f9a428dfa",
                                        "f11e2c3e87d9f4531fb68664cfea76f7691f26986921f6b83b13d8a0531e673c",
                                        "9709ff9eb1e712145214525d692bd46380099959597cb85bf9716c71385d6446",
                                        "9176d1c98c87da7f22ef6e88b04669b84a952a506745e854bfabe56642ead659",
                                        "c8b1026e1c6dbeab082c587a796e5deffb0e0d04d9be52ff6e445a5d69a4e790",
                                        "a43a04d10b713edbc053a286a329c958b345d713153e52beeac73c99cb44a2c4",
                                        "6016f8944c4f2a47420474792ea88b4c49584529e8b257509249a5b7cb011a78",
                                        "e4494c9e346ab2c96feb4933521a1cbcc8e802b93c379aed2f7d5b2f82fc35f8",
                                        "983b1815934cdcca7fc2af14ba6b199bc1bd591e60e2550c98702efa454b26e5",
                                        "05e6e9c54e4da2adb0482b97bb4bbf1930ec229ea9266df0cbcc0d1847311ace",
                                        "905830b92cb86d3fa457f8f6f9c839aa85f05cc76daaeb0ab1b44b86b2455a85",
                                        "ff225f43ea5fef79d7565533e3e40c78d92c7547ce9c948a817f237ebef96ea3",
                                        "533b27ac86fd52e44fa98b86cd96b65c60a3c0873eacc0a51a0e748df32131b6",
                                        "017978d00b820a0cd38cfa904408e4271b0cacd56cfdee0bb7945cf875a2fb1e",
                                        "59652dc55748c18aba7c575a2b41cd4128d0ab06809deaf553b725bacf13f60f",
                                        "796494dcea0b9e1b1de25be0a8f6d6e7b1b87401ba606b269443898007a703fe",
                                        "8b07e35fbd5831d66fe7f424cda4953acd3446917ac58f8469c511e77f0df40e",
                                        "be8c2d187ebef266f75475c85125a7877acc19e70f4a45dfe14c31bfc349296f",
                                        "a7d279cbfa959b5621b453c4d84e48033a79aa7da2cb85bb1f436ed2afd156ec",
                                        "25477c0dad4e07def9d4a693fb410e9bf0b70531883b2dbbcfa7d5d6383deff9",
                                        "a7d279cbfa959b5621b453c4d84e48033a79aa7da2cb85bb1f436ed2afd156ec",
                                        "6c53d38e6caa9e1dfb08f2eb52659080611e45949b46627f47ab60fc4fb3a52e",
                                        "ff20e643e1de23efaad7c274ffb68fa489e896151ec5b21064cfa6500ea62cc2",
                                        "62dfa53f3ff9247583b48c9d1f431faaa8bceeed5bdf23558f7ce4a39039f5a4",
                                        "ac36cd643420ab05628f3622de55a23291f77081c50e6ef1337487baea3360d1",
                                        "df13445949901d9f43575ad8fd5005a490e9a2fa68e27e26e6ea6d4014b83635",
                                        "7f015c5673eec28b83637794b24199fe3b630ac94e49085994435787bac995c4",
                                        "07c69656044fb6ac4f57f0847be8230727f5258235b2106cbb0c15af86ffa444",
                                        "1bba7ad14b8b976dcaf39a004b4c6cf677032648fdf98e4aae9bddc2ccd69c6f",
                                        "afe907b872bbaa92da07b7cfe203763892061fca683637fe4df25666b28e97ee",
                                        "9becd39f90077a5ab064681c0a1be139d15be9ce434bacd48cd1dc894d3911cb",
                                        "7acaa0e07d37cdd814408145b1d0f2137eaf068ff716eee09f39c8e4625550fb",
                                        "e7bedb6d2b70d4685d2cb084f23ac10b44aa2ce112d458f2d8134061a68f0bd9",
                                        "1d1cfd19249c06adefa0ff104d3f5db7f48568993c540576ef1930210793c975") and
 not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files (x86)\\*", "c:\\windows\\assembly\\nativeimages_*.ni.dll", "?:\\program files\\*")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.behaviorseq
  • allocate_shellcode corpus 8 (elastic 8)
field:"process.Ext.api.behaviors" kind:eq value:"allocate_shellcode"
process.Ext.api.namein
  • MapViewOfFile corpus 24 (elastic 24)
  • MapViewOfFile2 corpus 24 (elastic 24)
field:"process.Ext.api.name" kind:in
process.Ext.api.parameters.sizeeq
  • 0 transforms: number corpus 3 (elastic 3)
field:"process.Ext.api.parameters.size" kind:eq value:"0"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stack_final_user_module.hash.sha256in017978d00b820a0cd38cfa904408e4271b0cacd56cfdee0bb7945cf875a2fb1e, 05e6e9c54e4da2adb0482b97bb4bbf1930ec229ea9266df0cbcc0d1847311ace, 07c69656044fb6ac4f57f0847be8230727f5258235b2106cbb0c15af86ffa444, 18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25, 1b5d9cec668335295c8e575bcedf4afcedbc445d8ccf8374c9380188965e78e3, 1bba7ad14b8b976dcaf39a004b4c6cf677032648fdf98e4aae9bddc2ccd69c6f, 1d1cfd19249c06adefa0ff104d3f5db7f48568993c540576ef1930210793c975, 25477c0dad4e07def9d4a693fb410e9bf0b70531883b2dbbcfa7d5d6383deff9, 2faef17891b413fd63fc34c019a22401cce33e11da3a788de787dccaed1238ec, 533b27ac86fd52e44fa98b86cd96b65c60a3c0873eacc0a51a0e748df32131b6, 59652dc55748c18aba7c575a2b41cd4128d0ab06809deaf553b725bacf13f60f, 6016f8944c4f2a47420474792ea88b4c49584529e8b257509249a5b7cb011a78, 62dfa53f3ff9247583b48c9d1f431faaa8bceeed5bdf23558f7ce4a39039f5a4, 69c45175ecfd25af023f96ac0bb2c45e6a95e3ba8a5a50ee7969ccab14825c44, 6c53d38e6caa9e1dfb08f2eb52659080611e45949b46627f47ab60fc4fb3a52e, 6ec60215507d4e671f743164a247362da212acd65f9e0cfb676abb0f9a428dfa, 72d2010ee14567e9d0c68c3411ba1bfee8b875ddbda6b5a467c28c9e83ebf557, 796494dcea0b9e1b1de25be0a8f6d6e7b1b87401ba606b269443898007a703fe, 7acaa0e07d37cdd814408145b1d0f2137eaf068ff716eee09f39c8e4625550fb, 7f015c5673eec28b83637794b24199fe3b630ac94e49085994435787bac995c4, 8b07e35fbd5831d66fe7f424cda4953acd3446917ac58f8469c511e77f0df40e, 905830b92cb86d3fa457f8f6f9c839aa85f05cc76daaeb0ab1b44b86b2455a85, 9176d1c98c87da7f22ef6e88b04669b84a952a506745e854bfabe56642ead659, 9709ff9eb1e712145214525d692bd46380099959597cb85bf9716c71385d6446, 983b1815934cdcca7fc2af14ba6b199bc1bd591e60e2550c98702efa454b26e5, 9a0c65932e4f71dd850e16c5e2830463745e65c4b25f0d0731fe3fc5b94104f6, 9becd39f90077a5ab064681c0a1be139d15be9ce434bacd48cd1dc894d3911cb, 9d3b9a942d4f7573f9f2f8197f3ca9254d483bd12226975476befe1c203544bb, a43a04d10b713edbc053a286a329c958b345d713153e52beeac73c99cb44a2c4, a79bfb466cabfef1a4faaf2eedbf0e823bf372f2a1f6f33e803702ff080f72f3, a7d279cbfa959b5621b453c4d84e48033a79aa7da2cb85bb1f436ed2afd156ec, ac36cd643420ab05628f3622de55a23291f77081c50e6ef1337487baea3360d1, afe907b872bbaa92da07b7cfe203763892061fca683637fe4df25666b28e97ee, be8c2d187ebef266f75475c85125a7877acc19e70f4a45dfe14c31bfc349296f, c8b1026e1c6dbeab082c587a796e5deffb0e0d04d9be52ff6e445a5d69a4e790, d842b440338e59201a4e2d32779768d0f892cd131eeca904e155bd063158f71a, dc98b14cbb25ef1937217da4fde5e2cc13f4702b31a6bc481d8de2bd87ac0525, df13445949901d9f43575ad8fd5005a490e9a2fa68e27e26e6ea6d4014b83635, e4494c9e346ab2c96feb4933521a1cbcc8e802b93c379aed2f7d5b2f82fc35f8, e7bedb6d2b70d4685d2cb084f23ac10b44aa2ce112d458f2d8134061a68f0bd9, f11e2c3e87d9f4531fb68664cfea76f7691f26986921f6b83b13d8a0531e673c, ff20e643e1de23efaad7c274ffb68fa489e896151ec5b21064cfa6500ea62cc2, ff225f43ea5fef79d7565533e3e40c78d92c7547ce9c948a817f237ebef96ea3excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
process.thread.Ext.call_stack_final_user_module.nameinKernel, Unknownexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown"
process.thread.Ext.call_stack_final_user_module.pathwildcard?:\program files (x86)\*, c:\windows\assembly\nativeimages_*.ni.dll, ?:\program files\*excludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files (x86)\*" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\assembly\nativeimages_*.ni.dll" field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files\*"
process.thread.Ext.call_stack_final_user_module.protection_provenanceinKernel, Undetermined, Unknownexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Unknown"

Suspicious Module Loaded by LSASS

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

Identifies LSASS loading an unsigned or untrusted DLL. Windows Security Support Provider (SSP) DLLs are loaded into LSSAS process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that are stored in Windows, such as any logged-on user's Domain password or smart card PINs.

MITRE ATT&CK Coverage

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 7: Image loaded

Rule Body

[metadata]
creation_date = "2022/12/28"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/06"

[rule]
author = ["Elastic"]
description = """
Identifies LSASS loading an unsigned or untrusted DLL. Windows Security Support Provider (SSP) DLLs are loaded into
LSSAS process at system start. Once loaded into the LSA, SSP DLLs have access to encrypted and plaintext passwords that
are stored in Windows, such as any logged-on user's Domain password or smart card PINs.
"""
from = "now-9m"
index = ["logs-endpoint.events.library-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Module Loaded by LSASS"
references = [
  "https://blog.xpnsec.com/exploring-mimikatz-part-2/",
  "https://github.com/jas502n/mimikat_ssp"
]
risk_score = 47
rule_id = "3a6001a0-0939-4bbe-86f4-47d8faeb7b97"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
library where host.os.type == "windows" and event.action == "load" and
  process.executable : "?:\\Windows\\System32\\lsass.exe" and
  not (
        dll.code_signature.subject_name : (
            "Algorithmic Research LTD.",
            "Amazon Web Services, Inc.",
            "Apple Inc.",
            "Audinate Pty Ltd",
            "AuriStor, Inc.",
            "Bit4id",
            "Carbon Black, Inc.",
            "Check Point Software Technologies Ltd.",
            "Citrix Systems, Inc.",
            "CyberArk Software Ltd.",
            "Dell Inc",
            "DigitalPersona, Inc.",
            "EasyAntiCheat Oy",
            "Entrust Corporation",
            "Entrust Datacard Corporation",
            "Entrust, Inc.",
            "F5 Networks Inc",
            "Fortinet, Inc.",
            "Fortinet Technologies (Canada) Inc.",
            "FrontRange Solutions Deutschland GmbH",
            "GEMALTO SA",
            "gemalto",
            "Hewlett-Packard Company",
            "HID Global",
            "HID Global Corporation",
            "HYPR Corp",
            "IDEMIA IDENTITY & SECURITY FRANCE SAS",
            "IDEMIA France SAS",
            "Intel(R) Software Development Products",
            "Istituto Poligrafico e Zecca dello Stato S.p.A.",
            "LogMeIn, Inc.",
            "McAfee, Inc.",
            "McAfeeSysPrep",
            "Micro Focus (US), Inc.",
            "Micro Focus International plc",
            "Microsoft Corporation",
            "Microsoft Windows",
            "Microsoft Windows Hardware Compatibility Publisher",
            "Microsoft Windows Publisher",
            "Microsoft Windows Software Compatibility Publisher",
            "Morphisec Information Security 2014 Ltd",
            "Musarubra US LLC",
            "National Instruments Corporation",
            "Novell, Inc.",
            "Nubeva Technologies Ltd",
            "NVIDIA Corporation PE Sign v2016",
            "Palo Alto Networks (Netherlands) B.V.",
            "Parallels International GmbH",
            "PGP Corporation",
            "QUEST SOFTWARE INC.",
            "SecMaker AB",
            "Secure Endpoints, Inc.",
            "SecureLink, Inc.",
            "SentinelOne Inc.",
            "SentryBay Limited",
            "Sophos Ltd",
            "Symantec Corporation",
            "Thales DIS CPL USA, Inc.",
            "Tidexa OU",
            "Trend Micro, Inc.",
            "VMware, Inc.",
            "Yubico AB"
        ) and
        dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*", "errorChaining")
  ) and

  not dll.hash.sha256 : (
          "811a03a5d7c03802676d2613d741be690b3461022ea925eb6b2651a5be740a4c",
          "1181542d9cfd63fb00c76242567446513e6773ea37db6211545629ba2ecf26a1",
          "ed6e735aa6233ed262f50f67585949712f1622751035db256811b4088c214ce3",
          "26be2e4383728eebe191c0ab19706188f0e9592add2e0bf86b37442083ae5e12",
          "9367e78b84ef30cf38ab27776605f2645e52e3f6e93369c674972b668a444faa",
          "d46cc934765c5ecd53867070f540e8d6f7701e834831c51c2b0552aba871921b",
          "0f77a3826d7a5cd0533990be0269d951a88a5c277bc47cff94553330b715ec61",
          "4aca034d3d85a9e9127b5d7a10882c2ef4c3e0daa3329ae2ac1d0797398695fb",
          "86031e69914d9d33c34c2f4ac4ae523cef855254d411f88ac26684265c981d95",
          "4af1fee3369d9a993a84f54eafb72a661633c33e9e12fb3dd151a6a2cddbd404"
  ) and
  not dll.path : (
        "C:\\Windows\\System32\\CertPolEng.dll",
        "C:\\Windows\\System32\\FWPUCLNT.DLL",
        "C:\\Windows\\System32\\keyiso.dll",
        "C:\\Windows\\System32\\ngcpopkeysrv.dll",
        "C:\\Windows\\System32\\SecureTimeAggregator.dll",
        "C:\\Windows\\System32\\vaultsvc.dll"
  )
'''

setup = """## Setup

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

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

note = """## Triage and analysis

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

### Investigating Suspicious Module Loaded by LSASS

The Local Security Authority Subsystem Service (LSASS) is crucial for managing security policies and handling user authentication in Windows environments. Adversaries exploit LSASS by loading malicious or untrusted DLLs to access sensitive credentials. The detection rule identifies such threats by monitoring LSASS for unsigned or untrusted DLLs, excluding known safe signatures and hashes, thus flagging potential credential dumping activities.

### Possible investigation steps

- Review the process details for lsass.exe to confirm the presence of any unsigned or untrusted DLLs loaded into the process. Pay particular attention to the DLL's code signature status and hash values.
- Cross-reference the identified DLL's hash against known malicious hashes in threat intelligence databases to determine if it is associated with any known threats.
- Investigate the source and path of the suspicious DLL to understand how it was introduced into the system. This may involve checking recent file creation or modification events in the system directories.
- Analyze the system's event logs for any related activities or anomalies around the time the suspicious DLL was loaded, such as unusual user logins or privilege escalation attempts.
- Check for any recent changes in the system's security settings or policies that might have allowed the loading of untrusted DLLs into LSASS.
- If the DLL is confirmed to be malicious, isolate the affected system to prevent further credential access or lateral movement within the network.

### False positive analysis

- Legitimate software from trusted vendors not included in the exclusion list may trigger false positives. Users can update the exclusion list with additional trusted signatures or hashes from verified vendors to prevent these alerts.
- Custom or in-house developed DLLs used within the organization might be flagged as suspicious. Organizations should ensure these DLLs are signed with a trusted certificate and add their signatures to the exclusion list if necessary.
- Security software updates or patches from vendors not currently listed may cause false positives. Regularly review and update the exclusion list to include new trusted signatures from security software providers.
- Temporary or expired certificates for legitimate DLLs can result in false positives. Users should verify the legitimacy of these DLLs and update the exclusion list with their signatures if they are confirmed safe.
- DLLs from newly installed software that are not yet recognized as trusted may be flagged. Users should validate the software's source and add its signatures to the exclusion list if it is deemed secure.

### Response and remediation

- Isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Terminate the LSASS process if it is confirmed to be running a malicious or untrusted DLL, ensuring that this action does not disrupt critical services.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any malicious files or remnants.
- Review and reset credentials for any accounts that may have been compromised, focusing on those with elevated privileges.
- Implement application whitelisting to prevent unauthorized DLLs from being loaded into critical processes like LSASS in the future.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Update security monitoring tools to enhance detection capabilities for similar threats, ensuring that alerts are generated for any future attempts to load untrusted DLLs into LSASS."""


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

[[rule.threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"

[[rule.threat.technique.subtechnique]]
id = "T1003.001"
name = "LSASS Memory"
reference = "https://attack.mitre.org/techniques/T1003/001/"

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

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

[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"

[[rule.threat.technique.subtechnique]]
id = "T1547.005"
name = "Security Support Provider"
reference = "https://attack.mitre.org/techniques/T1547/005/"

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

Stages and Predicates

Stage 1: library

library where host.os.type == "windows" and event.action == "load" and
  process.executable : "?:\\Windows\\System32\\lsass.exe" and
  not (
        dll.code_signature.subject_name : (
            "Algorithmic Research LTD.",
            "Amazon Web Services, Inc.",
            "Apple Inc.",
            "Audinate Pty Ltd",
            "AuriStor, Inc.",
            "Bit4id",
            "Carbon Black, Inc.",
            "Check Point Software Technologies Ltd.",
            "Citrix Systems, Inc.",
            "CyberArk Software Ltd.",
            "Dell Inc",
            "DigitalPersona, Inc.",
            "EasyAntiCheat Oy",
            "Entrust Corporation",
            "Entrust Datacard Corporation",
            "Entrust, Inc.",
            "F5 Networks Inc",
            "Fortinet, Inc.",
            "Fortinet Technologies (Canada) Inc.",
            "FrontRange Solutions Deutschland GmbH",
            "GEMALTO SA",
            "gemalto",
            "Hewlett-Packard Company",
            "HID Global",
            "HID Global Corporation",
            "HYPR Corp",
            "IDEMIA IDENTITY & SECURITY FRANCE SAS",
            "IDEMIA France SAS",
            "Intel(R) Software Development Products",
            "Istituto Poligrafico e Zecca dello Stato S.p.A.",
            "LogMeIn, Inc.",
            "McAfee, Inc.",
            "McAfeeSysPrep",
            "Micro Focus (US), Inc.",
            "Micro Focus International plc",
            "Microsoft Corporation",
            "Microsoft Windows",
            "Microsoft Windows Hardware Compatibility Publisher",
            "Microsoft Windows Publisher",
            "Microsoft Windows Software Compatibility Publisher",
            "Morphisec Information Security 2014 Ltd",
            "Musarubra US LLC",
            "National Instruments Corporation",
            "Novell, Inc.",
            "Nubeva Technologies Ltd",
            "NVIDIA Corporation PE Sign v2016",
            "Palo Alto Networks (Netherlands) B.V.",
            "Parallels International GmbH",
            "PGP Corporation",
            "QUEST SOFTWARE INC.",
            "SecMaker AB",
            "Secure Endpoints, Inc.",
            "SecureLink, Inc.",
            "SentinelOne Inc.",
            "SentryBay Limited",
            "Sophos Ltd",
            "Symantec Corporation",
            "Thales DIS CPL USA, Inc.",
            "Tidexa OU",
            "Trend Micro, Inc.",
            "VMware, Inc.",
            "Yubico AB"
        ) and
        dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*", "errorChaining")
  ) and

  not dll.hash.sha256 : (
          "811a03a5d7c03802676d2613d741be690b3461022ea925eb6b2651a5be740a4c",
          "1181542d9cfd63fb00c76242567446513e6773ea37db6211545629ba2ecf26a1",
          "ed6e735aa6233ed262f50f67585949712f1622751035db256811b4088c214ce3",
          "26be2e4383728eebe191c0ab19706188f0e9592add2e0bf86b37442083ae5e12",
          "9367e78b84ef30cf38ab27776605f2645e52e3f6e93369c674972b668a444faa",
          "d46cc934765c5ecd53867070f540e8d6f7701e834831c51c2b0552aba871921b",
          "0f77a3826d7a5cd0533990be0269d951a88a5c277bc47cff94553330b715ec61",
          "4aca034d3d85a9e9127b5d7a10882c2ef4c3e0daa3329ae2ac1d0797398695fb",
          "86031e69914d9d33c34c2f4ac4ae523cef855254d411f88ac26684265c981d95",
          "4af1fee3369d9a993a84f54eafb72a661633c33e9e12fb3dd151a6a2cddbd404"
  ) and
  not dll.path : (
        "C:\\Windows\\System32\\CertPolEng.dll",
        "C:\\Windows\\System32\\FWPUCLNT.DLL",
        "C:\\Windows\\System32\\keyiso.dll",
        "C:\\Windows\\System32\\ngcpopkeysrv.dll",
        "C:\\Windows\\System32\\SecureTimeAggregator.dll",
        "C:\\Windows\\System32\\vaultsvc.dll"
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • load corpus 23 (elastic 23)
field:"EventType" kind:eq value:"load"
process.executablewildcard
  • ?:\Windows\System32\lsass.exe corpus 2 (elastic 2)
field:"Image" kind:wildcard value:"?:\Windows\System32\lsass.exe"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.statuswildcardtrusted, errorExpired, errorCode_endpoint*, errorChainingexcludes:dll.code_signature.status
dll.code_signature.subject_nameeqAlgorithmic Research LTD., Amazon Web Services, Inc., Apple Inc., Audinate Pty Ltd, AuriStor, Inc., Bit4id, Carbon Black, Inc., Check Point Software Technologies Ltd., Citrix Systems, Inc., CyberArk Software Ltd., Dell Inc, DigitalPersona, Inc., EasyAntiCheat Oy, Entrust Corporation, Entrust Datacard Corporation, Entrust, Inc., F5 Networks Inc, Fortinet, Inc., Fortinet Technologies (Canada) Inc., FrontRange Solutions Deutschland GmbH, GEMALTO SA, gemalto, Hewlett-Packard Company, HID Global, HID Global Corporation, HYPR Corp, IDEMIA IDENTITY & SECURITY FRANCE SAS, IDEMIA France SAS, Intel(R) Software Development Products, Istituto Poligrafico e Zecca dello Stato S.p.A., LogMeIn, Inc., McAfee, Inc., McAfeeSysPrep, Micro Focus (US), Inc., Micro Focus International plc, Microsoft Corporation, Microsoft Windows, Microsoft Windows Hardware Compatibility Publisher, Microsoft Windows Publisher, Microsoft Windows Software Compatibility Publisher, Morphisec Information Security 2014 Ltd, Musarubra US LLC, National Instruments Corporation, Novell, Inc., Nubeva Technologies Ltd, NVIDIA Corporation PE Sign v2016, Palo Alto Networks (Netherlands) B.V., Parallels International GmbH, PGP Corporation, QUEST SOFTWARE INC., SecMaker AB, Secure Endpoints, Inc., SecureLink, Inc., SentinelOne Inc., SentryBay Limited, Sophos Ltd, Symantec Corporation, Thales DIS CPL USA, Inc., Tidexa OU, Trend Micro, Inc., VMware, Inc., Yubico ABexcludes:dll.code_signature.subject_name
dll.hash.sha256eq811a03a5d7c03802676d2613d741be690b3461022ea925eb6b2651a5be740a4c, 1181542d9cfd63fb00c76242567446513e6773ea37db6211545629ba2ecf26a1, ed6e735aa6233ed262f50f67585949712f1622751035db256811b4088c214ce3, 26be2e4383728eebe191c0ab19706188f0e9592add2e0bf86b37442083ae5e12, 9367e78b84ef30cf38ab27776605f2645e52e3f6e93369c674972b668a444faa, d46cc934765c5ecd53867070f540e8d6f7701e834831c51c2b0552aba871921b, 0f77a3826d7a5cd0533990be0269d951a88a5c277bc47cff94553330b715ec61, 4aca034d3d85a9e9127b5d7a10882c2ef4c3e0daa3329ae2ac1d0797398695fb, 86031e69914d9d33c34c2f4ac4ae523cef855254d411f88ac26684265c981d95, 4af1fee3369d9a993a84f54eafb72a661633c33e9e12fb3dd151a6a2cddbd404excludes:dll.hash.sha256
dll.patheqC:\Windows\System32\CertPolEng.dll, C:\Windows\System32\FWPUCLNT.DLL, C:\Windows\System32\keyiso.dll, C:\Windows\System32\ngcpopkeysrv.dll, C:\Windows\System32\SecureTimeAggregator.dll, C:\Windows\System32\vaultsvc.dllexcludes:dll.path

Suspicious Sysctl File Event

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

Monitors file events on sysctl configuration files (e.g., /etc/sysctl.conf, /etc/sysctl.d/*.conf) to identify potential unauthorized access or manipulation of system-level configuration settings. Attackers may tamper with the sysctl configuration files to modify kernel parameters, potentially compromising system stability, performance, or security.

MITRE ATT&CK Coverage

Rule Body

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

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Monitors file events on sysctl configuration files (e.g., /etc/sysctl.conf, /etc/sysctl.d/*.conf) to identify potential
unauthorized access or manipulation of system-level configuration settings. Attackers may tamper with the sysctl
configuration files to modify kernel parameters, potentially compromising system stability, performance, or security.
"""
from = "now-119m"
index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
interval = "60m"
language = "kuery"
license = "Elastic License v2"
name = "Suspicious Sysctl File Event"
risk_score = 21
rule_id = "7592c127-89fb-4209-a8f6-f9944dfd7e02"
setup = """## Setup

This rule requires the use of the `auditd_manager` integration. `Auditd_manager` is a tool designed to simplify and enhance the management of the audit subsystem in Linux systems. It provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system. The following steps should be executed in order to install and deploy `auditd_manager` on a Linux system.

```
Kibana -->
Management -->
Integrations -->
Auditd Manager -->
Add Auditd Manager
```

`Auditd_manager` subscribes to the kernel and receives events as they occur without any additional configuration. However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.

For this detection rule to trigger, the following additional audit rules are required to be added to the integration:

```
-w /etc/sysctl.conf -p wa -k sysctl
-w /etc/sysctl.d -p wa -k sysctl
```

Add the newly installed `auditd manager` to an agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
"""
severity = "low"
tags = [
    "Data Source: Auditd Manager",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
    "Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
host.os.type:linux and event.category:file and event.action:("opened-file" or "read-file" or "wrote-to-file") and
file.path : ("/etc/sysctl.conf" or "/etc/sysctl.d" or /etc/sysctl.d/*) and not (
  process.name:(
    dpkg or dockerd or unattended-upg or systemd-sysctl or python* or auditbeat or dpkg or pool*
  ) or
  process.executable:(
    /opt/sophos-spl/plugins/av/bin/* or /usr/bin/pacman or "/usr/lib/dracut/dracut-install" or /var/lib/elastic-agent/*
  )
)
'''

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

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

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

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

[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"

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

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

[[rule.threat.technique]]
id = "T1565"
name = "Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/"

[[rule.threat.technique.subtechnique]]
id = "T1565.001"
name = "Stored Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/001/"

[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.executable"]

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

Stages and Predicates

Stage 1: new_terms

host.os.type:linux and event.category:file and event.action:("opened-file" or "read-file" or "wrote-to-file") and
file.path : ("/etc/sysctl.conf" or "/etc/sysctl.d" or /etc/sysctl.d/*) and not (
  process.name:(
    dpkg or dockerd or unattended-upg or systemd-sysctl or python* or auditbeat or dpkg or pool*
  ) or
  process.executable:(
    /opt/sophos-spl/plugins/av/bin/* or /usr/bin/pacman or "/usr/lib/dracut/dracut-install" or /var/lib/elastic-agent/*
  )
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Suspicious WMIC XSL Script Execution

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

Identifies Windows Management Instrumentation Command-Line utility (WMIC) whitelisting bypass attempts by alerting on suspicious execution of scripts. When WMIC loads scripting libraries, it may be indicative of an attempt to bypass application whitelisting

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies Windows Management Instrumentation Command-Line utility (WMIC) whitelisting bypass attempts by alerting on
suspicious execution of scripts. When WMIC loads scripting libraries, it may be indicative of an attempt to bypass
application whitelisting
"""
id = "18371ec4-ee2f-465b-8757-ee726914006c"
license = "Elastic License v2"
name = "Suspicious WMIC XSL Script Execution"
os_list = ["windows"]
version = "1.0.32"

query = '''
sequence by process.entity_id with maxspan=2m
[process where event.action == "start" and
   (process.name : "WMIC.exe" or process.pe.original_file_name : "wmic.exe") and
   process.command_line : ("* format*:*", "*/format*:*", "*-format*:*") and
   not process.command_line :
              (
               "*format:list*",
               "*format:table*",
               "*format:htable",
               "*format:texttablewsys*",
               "*format:texttable*",
               "*format:textvaluelist*",
               "*format:TEXTVALUELIST*",
               "*format:csv*",
               "*format:value*"
               ) and
   not process.parent.executable : "?:\\Program Files\\Trend Micro\\Titanium\\plugin\\Pt\\win32\\inspect\\Inspect.exe"]
[library where dll.name : ("jscript.dll", "vbscript.dll")]
'''

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


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1220"
name = "XSL Script Processing"
reference = "https://attack.mitre.org/techniques/T1220/"


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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
   (process.name : "WMIC.exe" or process.pe.original_file_name : "wmic.exe") and
   process.command_line : ("* format*:*", "*/format*:*", "*-format*:*") and
   not process.command_line :
              (
               "*format:list*",
               "*format:table*",
               "*format:htable",
               "*format:texttablewsys*",
               "*format:texttable*",
               "*format:textvaluelist*",
               "*format:TEXTVALUELIST*",
               "*format:csv*",
               "*format:value*"
               ) and
   not process.parent.executable : "?:\\Program Files\\Trend Micro\\Titanium\\plugin\\Pt\\win32\\inspect\\Inspect.exe"]

Stage 2: library

[library where dll.name : ("jscript.dll", "vbscript.dll")]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namewildcard
  • jscript.dll corpus 4 (elastic 4)
  • vbscript.dll corpus 4 (elastic 4)
field:"dll.name" kind:wildcard
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • * format*:*
  • *-format*:*
  • */format*:*
field:"CommandLine" kind:wildcard
process.namewildcard
  • WMIC.exe corpus 66 (elastic 39, splunk 27)
field:"process_basename" kind:wildcard value:"WMIC.exe"
process.pe.original_file_namewildcard
  • wmic.exe corpus 74 (sigma 38, elastic 18, splunk 18)
field:"OriginalFileName" kind:wildcard value:"wmic.exe"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linewildcard*format:list*, *format:table*, *format:htable, *format:texttablewsys*, *format:texttable*, *format:textvaluelist*, *format:TEXTVALUELIST*, *format:csv*, *format:value*excludes:process.command_line
process.parent.executableeq?:\Program Files\Trend Micro\Titanium\plugin\Pt\win32\inspect\Inspect.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Trend Micro\Titanium\plugin\Pt\win32\inspect\Inspect.exe"

Symbolic Link to Shadow Copy Created

#

Trap Signals Execution

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

Identify activity related where adversaries can include a trap command which then allows programs and shells to specify commands that will be executed upon receiving interrupt signals.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2023/08/24"
integration = ["endpoint", "auditd_manager"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Identify activity related where adversaries can include a trap command which then allows programs and shells to specify
commands that will be executed upon receiving interrupt signals.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
language = "eql"
license = "Elastic License v2"
name = "Trap Signals 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 Trap Signals Execution

This rule flags use of the shell built-in trap to bind commands to POSIX signals, enabling automatic execution when interrupts like SIGINT, SIGHUP, or SIGTERM occur. Attackers commonly embed traps in bash, zsh, or service scripts so pressing Ctrl+C (SIGINT) or a daemon reload (SIGHUP) silently runs a payload—adding a user to sudoers, planting a setuid helper, or launching a reverse shell—achieving persistence or escalation without a direct command invocation.

### Possible investigation steps

- Pull the full trap command and its arguments plus the parent script path, then read the script to see which signals map to which payloads and whether they perform user, permission, or network actions.
- Determine execution context by user and privilege, TTY/session versus systemd or cron, and whether the shell was invoked with sudo or as root to gauge impact if the trap triggers.
- Correlate telemetry for signal delivery (kill, hangup, termination) to the same process and for immediate follow-on activity such as child process spawns, edits to /etc files, setuid or chmod events, and outbound connections.
- Search the host for other trap definitions in login and init paths (.bashrc, .zshrc, /etc/profile, /etc/*rc, systemd unit scripts, and cron wrappers) to identify persistence or broader tampering.
- Verify legitimacy by comparing the script to package or repository sources and change records, and preserve artifacts (path, hash, mtime, owner) along with shell history and environment for deeper analysis.

### False positive analysis

- Operations or maintenance scripts legitimately declare trap handlers for SIGTERM or SIGHUP to perform cleanup during routine shutdown or reload, producing trap commands with signal arguments that match this detection.
- Interactive shell customization may set a trap on SIGINT (Ctrl+C) to restore terminal settings or print a message on interruption, resulting in benign trap invocations with SIG* arguments.

### Response and remediation

- Isolate the host or TTY session where a trap binds SIGINT/SIGHUP/SIGTERM to commands that write to /etc or open a socket, kill the offending shell and its parent process, and stop/disable any systemd unit or cron wrapper invoking the implicated script path.
- Edit the identified script or rc file (.bashrc, .zshrc, /etc/profile, systemd unit script) to remove or unset the trap handlers, and delete or quarantine any referenced payload such as a reverse-shell binary, sudoers drop-in, or setuid helper.
- Restore altered files from a known-good baseline (e.g., /etc/sudoers, unit .service files, shell RCs), revalidate file ownership and permissions, restart impacted services cleanly, and rotate credentials for users touched by the payload.
- Sweep the host and peers for additional trap definitions by grepping for "trap SIG" in login/init paths and service scripts, and record script path, hash, mtime, and owner to confirm scope and support cleanup.
- Escalate to incident response if the trap executes as root, modifies /etc/sudoers or PAM files, creates setuid files under /usr/bin or /usr/local/bin, or starts a reverse shell to an external IP/port.
- Harden by restricting write access to /etc/*rc and service scripts, enforcing deployment via signed packages, adding audit rules for changes to /etc/sudoers and /etc/profile.d, blocking shells from egress to untrusted networks, and alerting on traps bound to EXIT/DEBUG or signals that invoke privileged actions.
"""
risk_score = 21
rule_id = "cf6995ec-32a9-4b2d-9340-f8e61acf3f4e"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Privilege Escalation",
    "Data Source: Elastic Defend",
    "Data Source: Elastic Endgame",
    "Data Source: Auditd Manager",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started") and
process.name == "trap" and process.args : "SIG*"
'''

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

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

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

[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 = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"

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

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

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started") and
process.name == "trap" and process.args : "SIG*"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • exec corpus 180 (elastic 180)
  • exec_event corpus 135 (elastic 135)
  • executed corpus 85 (elastic 85)
  • process_started corpus 77 (elastic 77)
field:"EventType" kind:in
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • SIG*
field:"process.args" kind:wildcard value:"SIG*"
process.nameeq
  • trap
field:"process_basename" kind:eq value:"trap"

Unsigned or Untrusted Binary Fork via Python

#
Source
github.com/elastic/protections-artifacts

Detects execution of unsigned or untrusted binaries forked by Python processes when the executable path and arguments point to files within user directories. This pattern may indicate malicious Python scripts executing unsigned binaries from compromised user spaces, as observed in APT campaigns like Lazarus Group attacks.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects execution of unsigned or untrusted binaries forked by Python processes when the executable path and arguments
point to files within user directories. This pattern may indicate malicious Python scripts executing unsigned binaries
from compromised user spaces, as observed in APT campaigns like Lazarus Group attacks.
"""
id = "02e50f28-d5a1-4289-ab49-48ae0e2ca196"
license = "Elastic License v2"
name = "Unsigned or Untrusted Binary Fork via Python"
os_list = ["macos"]
reference = [
    "https://unit42.paloaltonetworks.com/slow-pisces-new-custom-malware/",
    "https://slowmist.medium.com/cryptocurrency-apt-intelligence-unveiling-lazarus-groups-intrusion-techniques-a1a6efda7d34",
]
version = "1.0.4"

query = '''
process where event.type == "start" and event.action == "fork" and process.executable like "/Users/*" and 
 (process.code_signature.trusted == false or process.code_signature.exists == false) and 
 process.args_count == 2 and process.args like "/Users/*" and process.args like "/Users/*" and 
 process.parent.name like~ "python*"  and
 not startswith~(process.executable, process.parent.executable)
'''

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

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

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



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

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "fork" and process.executable like "/Users/*" and 
 (process.code_signature.trusted == false or process.code_signature.exists == false) and 
 process.args_count == 2 and process.args like "/Users/*" and process.args like "/Users/*" and 
 process.parent.name like~ "python*"  and
 not startswith~(process.executable, process.parent.executable)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablestarts_withprocess.parent.executableexcludes:process.executable field:"process.executable" value:"process.parent.executable"

Untrusted Driver Loaded

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

Identifies an untrusted driver loaded by the Windows kernel. Adversaries may modify code signing policies to enable execution of unsigned or self-signed kernel code.

MITRE ATT&CK Coverage

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 6: Driver loaded

Rule Body

[metadata]
creation_date = "2023/01/27"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/02"

[rule]
author = ["Elastic"]
description = """
Identifies an untrusted driver loaded by the Windows kernel. Adversaries may modify code signing policies to
enable execution of unsigned or self-signed kernel code.
"""
from = "now-9m"
index = ["logs-endpoint.events.library-*"]
language = "eql"
license = "Elastic License v2"
name = "Untrusted Driver Loaded"
references = [
    "https://github.com/hfiref0x/TDL",
    "https://docs.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653559(v=vs.85)?redirectedfrom=MSDN",
]
risk_score = 73
rule_id = "d8ab1ec1-feeb-48b9-89e7-c12e189448aa"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
driver where host.os.type == "windows" and process.pid == 4 and
  (dll.code_signature.trusted == false or dll.code_signature.exists == false) and
  /* errorExpired and errorRevoked are handled by d12bac54-ab2a-4159-933f-d7bcefa7b61d */
  not dll.code_signature.status : ("errorExpired", "errorRevoked", "errorCode_endpoint:*") and
  
  not dll.hash.sha256 : (
        /* HP DOT4 printer driver family FPs (Dot4.sys, Dot4Prt.sys, Dot4usb.sys, Dot4Scan.sys) */
        "f21c1d478180bc5e932bb2c2e4618e3ed463ca87acedeb139682d218435f82f1",
        "7e2f2a139e897eae56038b920bda9381094bc0ae9e626f6634e6b444b8b0c91f",
        "12ffdf5f48a79b1b4adbb88ba2cb6c59dd6719554e8ea6beefe99b3e3c66f1ac",
        "dbc6afaf80141e2480e19878f581edfe9c2b018da2ec527c4025ff04d5587afd",
        /* (dc3d.sys, test-signed) */
        "ca8f9564733ded4c3895cf7150bb254995d66889e6be08d6654e4f897e4ff7a4"
  )
'''

note = """## Triage and analysis

### Investigating Untrusted Driver Loaded

#### Possible investigation steps

- What exact kernel driver loaded, and what trust failure made it alert?
  - Focus: `process.pid`, `dll.path`, `dll.code_signature.exists`, `dll.code_signature.trusted`, and `dll.code_signature.status`.
  - Implication: escalate when System loaded an unsigned or untrusted driver from a non-vendor, user-writable, temp, or renamed path; lower concern only when the trust failure fits a controlled driver-development or hardware-validation host class.

- Does the driver identity map to a known vulnerable driver, BYOVD chain, or offensive loader?
  - Why: TDL-style and BYOVD activity may be easier to recognize by stable hash, original PE name, or signer than current file name.
  - Focus: `dll.hash.sha256`, `dll.pe.original_file_name`, `dll.code_signature.subject_name`, and `dll.code_signature.thumbprint_sha256`.
  - Implication: escalate when hash, original name, or signer maps to a vulnerable-driver blocklist, signature-bypass loader, or malicious kernel tooling; lower concern only when the same artifact is tied to a controlled lab or validation cohort.

- Does recency or rename timing show the driver was staged for this load?
  - Focus: `dll.Ext.relative_file_creation_time`, `dll.Ext.relative_file_name_modify_time`, and `dll.path`; if file-event telemetry is available, use the same `host.id` and path to identify who wrote or renamed it. $investigate_0
  - Implication: escalate when the driver appeared just before load, was recently renamed, or was written by an unrelated staging process. Missing file-event telemetry leaves provenance unresolved, not benign.

- What resident service or device identity is tied to the loaded image?
  - Focus: compare `dll.path`, `dll.hash.sha256`, and `dll.code_signature.subject_name` with current Osquery driver inventory and service output.
  - Hint: For non-Microsoft drivers by `image`, `service`, `signed`, `subject_name`, and `VtLink`; use it as current-state context, and keep the alert as the historical load record if no matching image exists.
    - $osquery_0
  - Hint: For unsigned current drivers when the alert shows missing or untrusted signature metadata; current signed or service values do not prove what existed at `@timestamp`.
    - $osquery_1
  - Implication: escalate when current inventory lacks a coherent image or service entry, the service is unexpected for the host, or other unsigned drivers do not fit the host role. Treat osquery as corroboration; do not delay escalation when alert-local identity, trust, or recency evidence is decisive.

- Did signing or code-integrity control activity make this load possible?
  - Why: 64-bit Windows normally enforces kernel-mode driver signing, while test-signing, DSE tampering, or vulnerable-driver loaders can open a path for untrusted kernel code.
  - Focus: same-host process events around the load using `host.id`, `process.name`, `process.executable`, and `process.command_line` for bcdedit test-signing/nointegritychecks changes or known vulnerable-driver loader activity. $investigate_1
  - Implication: escalate when surrounding process evidence shows test-signing changes, code-integrity bypass tooling, or vulnerable-driver loader execution; absent process evidence weakens this corroborator but does not clear an unexplained untrusted driver load.

- Does the host cohort and prevalence fit a controlled driver workflow?
  - Focus: `host.id`, `host.name`, and the smallest stable indicator, usually `dll.hash.sha256`, `dll.path`, or `dll.code_signature.subject_name`.
  - Hint: broaden only when identity, recency, inventory, or tampering evidence remains suspicious or unresolved. $investigate_2
  - Implication: escalate when the driver appears on production systems, user-writable paths, unrelated hosts, or outside the expected lab cohort; lower concern only when artifact, path pattern, signer, and host cohort consistently match a controlled validation workflow.

- Using identity, trust failure, staging/provenance, osquery inventory, signing-control evidence, and host-cohort spread: escalate unauthorized kernel code, BYOVD, or signature-bypass evidence; close only when telemetry binds the load to one controlled driver workflow; preserve artifacts and escalate mixed or incomplete cases.

### False positive analysis

- Controlled driver-development, OEM hardware validation, and authorized security or EDR compatibility testing can load test-signed or unsigned drivers on isolated lab hosts. Confirm first with telemetry: `dll.hash.sha256`, `dll.path`, `dll.code_signature.status` or `dll.code_signature.subject_name`, current osquery image and service output, and `host.id` cohort must align with one workflow. Use build, test, or change records only after telemetry binds the exact artifact and cohort; if unavailable, require prior alerts for the same driver artifact and host cohort before exceptioning. If any evidence dimension contradicts the workflow, do not close as benign.
- Build exceptions only from the minimum confirmed pattern, such as `dll.hash.sha256` plus `dll.path` plus bounded `host.id` cohort or service identity. Avoid exceptions on `dll.name`, signer, or generic unsigned-driver conditions alone.

### Response and remediation

- If confirmed benign:
  - Reverse temporary containment and document the driver artifact, host cohort, current osquery image and service values, and any corroborating external record. Keep exceptions narrow to the confirmed hash, path, host cohort, or service identity.
- If suspicious but unconfirmed:
  - Preserve the driver file if accessible, the alert event export, osquery driver inventory results, surrounding signing-control process events, and the case timeline before containment or cleanup.
  - Apply reversible containment first, such as temporary network restriction or heightened monitoring, while scoping the same `dll.hash.sha256` or `dll.path` across other hosts.
  - Escalate to host isolation before reboot, uninstall, or cleanup only if evidence shows code-integrity tampering, vulnerable-driver loader activity, post-load abuse, or spread outside the expected lab cohort.
- If confirmed malicious:
  - Isolate the host after preserving the driver artifact, service or boot-start context, signing-control evidence, and affected `host.id` or `host.name`. If endpoint response is unavailable, hand off that evidence set to the team that can contain the system.
  - Scope other hosts for the same `dll.hash.sha256`, `dll.path`, or `dll.code_signature.subject_name` before uninstalling the driver, deleting the file, removing the backing service, or rebooting.
  - Remove the malicious driver, related service or boot-start entry, and code-signing or DSE changes identified during investigation, then remediate the loader or vulnerable-driver path that introduced it.
- Post-incident hardening:
  - Re-enable or enforce driver-signing and code-integrity controls on the affected host class, block confirmed malicious or vulnerable `dll.hash.sha256` values and `dll.path` locations, and restrict test-signing to isolated lab systems.
  - Document any BYOVD family, loader service name, or host-cohort pattern uncovered during triage for future response cases.
"""

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
"""

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "host.name",
    "host.id",
    "process.pid",
    "dll.path",
    "dll.name",
    "dll.hash.sha256",
    "dll.pe.original_file_name",
    "dll.code_signature.exists",
    "dll.code_signature.trusted",
    "dll.code_signature.status",
    "dll.code_signature.subject_name",
    "dll.code_signature.thumbprint_sha256",
    "dll.Ext.relative_file_creation_time",
    "dll.Ext.relative_file_name_modify_time",
]

[transform]

[[transform.osquery]]
label = "Osquery - Retrieve All Non-Microsoft Drivers with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, class, description, directory, image,
issuer_name, manufacturer, service, signed, subject_name FROM drivers JOIN authenticode ON drivers.image =
authenticode.path JOIN hash ON drivers.image = hash.path WHERE NOT (provider == "Microsoft" AND signed == "1")
"""

[[transform.osquery]]
label = "Osquery - Retrieve All Unsigned Drivers with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, class, description, directory, image,
issuer_name, manufacturer, service, signed, subject_name FROM drivers JOIN authenticode ON drivers.image =
authenticode.path JOIN hash ON drivers.image = hash.path WHERE signed == "0"
"""

[[transform.investigate]]
label = "File events for the loaded driver path"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "file.path", queryType = "phrase", value = "{{dll.path}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Process events on the driver 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" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

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

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.001"
name = "Invalid Code Signature"
reference = "https://attack.mitre.org/techniques/T1036/001/"

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

Stages and Predicates

Stage 1: driver

driver where host.os.type == "windows" and process.pid == 4 and
  (dll.code_signature.trusted == false or dll.code_signature.exists == false) and
  not dll.code_signature.status : ("errorExpired", "errorRevoked", "errorCode_endpoint:*") and
  not dll.hash.sha256 : (
        "f21c1d478180bc5e932bb2c2e4618e3ed463ca87acedeb139682d218435f82f1",
        "7e2f2a139e897eae56038b920bda9381094bc0ae9e626f6634e6b444b8b0c91f",
        "12ffdf5f48a79b1b4adbb88ba2cb6c59dd6719554e8ea6beefe99b3e3c66f1ac",
        "dbc6afaf80141e2480e19878f581edfe9c2b018da2ec527c4025ff04d5587afd",
        "ca8f9564733ded4c3895cf7150bb254995d66889e6be08d6654e4f897e4ff7a4"
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.code_signature.existseq
  • false transforms: boolean corpus 22 (elastic 22)
field:"dll.code_signature.exists" kind:eq value:"false"
dll.code_signature.trustedeq
  • false transforms: boolean corpus 21 (elastic 21)
field:"dll.code_signature.trusted" kind:eq value:"false"
process.pideq
  • 4 transforms: number corpus 17 (elastic 17)
field:"process_id" kind:eq value:"4"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.statuswildcarderrorExpired, errorRevoked, errorCode_endpoint:*excludes:dll.code_signature.status field:"dll.code_signature.status" value:"errorExpired" field:"dll.code_signature.status" value:"errorRevoked" field:"dll.code_signature.status" value:"errorCode_endpoint:*"
dll.hash.sha256eqf21c1d478180bc5e932bb2c2e4618e3ed463ca87acedeb139682d218435f82f1, 7e2f2a139e897eae56038b920bda9381094bc0ae9e626f6634e6b444b8b0c91f, 12ffdf5f48a79b1b4adbb88ba2cb6c59dd6719554e8ea6beefe99b3e3c66f1ac, dbc6afaf80141e2480e19878f581edfe9c2b018da2ec527c4025ff04d5587afd, ca8f9564733ded4c3895cf7150bb254995d66889e6be08d6654e4f897e4ff7a4excludes:dll.hash.sha256

Unusual AWS Command for a User

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

A machine learning job detected an AWS API command that, while not inherently suspicious or abnormal, is being made by a user context that does not normally use the command. This can be the result of compromised credentials or keys as someone uses a valid account to persist, move laterally, or exfiltrate data.

Known False Positives

  • New or unusual user command activity can be due to manual troubleshooting or reconfiguration; changes in cloud automation scripts or workflows; adoption of new services; or changes in the way services are used.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2020/07/13"
integration = ["aws"]
maturity = "production"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
updated_date = "2026/04/01"

[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job detected an AWS API command that, while not inherently suspicious or abnormal, is being made by a
user context that does not normally use the command. This can be the result of compromised credentials or keys as
someone uses a valid account to persist, move laterally, or exfiltrate data.
"""
false_positives = [
    """
    New or unusual user command activity can be due to manual troubleshooting or reconfiguration; changes in cloud
    automation scripts or workflows; adoption of new services; or changes in the way services are used.
    """,
]
from = "now-2h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "rare_method_for_a_user_id_ea"
name = "Unusual AWS Command for a User"
setup = """## Setup

This rule requires the installation of associated Machine Learning jobs, as well as data coming in from AWS.

### Anomaly Detection Setup

Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).

### AWS Integration Setup
The AWS integration allows you to collect logs and metrics from Amazon Web Services (AWS) with Elastic Agent.

#### The following steps should be executed in order to add the Elastic Agent System integration "aws" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “AWS” and select the integration to see more details about it.
- Click “Add AWS”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “aws” to an existing or a new agent policy, and deploy the agent on your system from which aws log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://www.elastic.co/docs/current/integrations/aws).
"""
note = """## Triage and analysis

### Investigating Unusual AWS Command for a User

CloudTrail logging provides visibility on actions taken within an AWS environment. By monitoring these events and understanding what is considered normal behavior within an organization, you can spot suspicious or malicious activity when deviations occur.

This rule uses a machine learning job to detect an AWS API command that while not inherently suspicious or abnormal, is being made by a user context that does not normally use the command. This can be the result of compromised credentials or keys as someone uses a valid account to persist, move laterally, or exfiltrate data.

Detection alerts from this rule indicate an AWS API command or method call that is rare and unusual for the calling IAM user.

#### Possible investigation steps

- Identify the user account involved and the action performed. Verify whether it should perform this kind of action.
    - Examine the user identity in the `aws.cloudtrail.user_identity.arn` field and the access key ID in the `aws.cloudtrail.user_identity.access_key_id` field, which can help identify the precise user context.
    - The user agent details in the `user_agent.original` field may also indicate what kind of a client made the request.
- Investigate other alerts associated with the user account during the past 48 hours.
- Validate the activity is not related to planned patches, updates, or network administrator activity.
- Examine the request parameters. These might indicate the source of the program or the nature of its tasks.
- Considering the source IP address and geolocation of the user who issued the command:
    - Do they look normal for the calling user?
    - If the source is an EC2 IP address, is it associated with an EC2 instance in one of your accounts or is the source IP from an EC2 instance that's not under your control?
    - If it is an authorized EC2 instance, is the activity associated with normal behavior for the instance role or roles? Are there any other alerts or signs of suspicious activity involving this instance?
- 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?
- Contact the account owner and confirm whether they are aware of this activity if suspicious.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.

### False positive analysis

- Examine the history of the command. If the command only manifested recently, it might be part of a new automation module or script. If it has a consistent cadence (for example, it appears in small numbers on a weekly or monthly cadence), it might be part of a housekeeping or maintenance process. You can find the command in the `event.action field` field.

### Related Rules

- Unusual City For an AWS Command - 809b70d3-e2c3-455e-af1b-2626a5a1a276
- Unusual Country For an AWS Command - dca28dee-c999-400f-b640-50a081cc0fd1
- Rare AWS Error Code - 19de8096-e2b0-4bd8-80c9-34a820813fff
- Spike in AWS Error Messages - 78d3d8d9-b476-451d-a9e0-7a5addd70670

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
    - Identify the account role in the cloud environment.
    - Assess the criticality of affected services and servers.
    - Work with your IT team to identify and minimize the impact on users.
    - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
    - Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
- Identify 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://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "ac706eae-d5ec-4b14-b4fd-e8ba8086f0e1"
severity = "low"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Resources: Investigation Guide",
]
type = "machine_learning"

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

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

[[rule.threat.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 = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"

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

[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.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1041"
name = "Exfiltration Over C2 Channel"
reference = "https://attack.mitre.org/techniques/T1041/"

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

[[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/"

Back to all Elastic rules