Detection rules › Elastic

Elastic rules: 37

AWS S3 Bucket Policy Added to Share with External Account

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

Detects when an Amazon S3 bucket policy is modified to share access with an external AWS account. This rule analyzes PutBucketPolicy events and compares the S3 bucket’s account ID to any account IDs referenced in the policy’s Effect=Allow statements. If the policy includes principals from accounts other than the bucket owner’s, the rule triggers an alert. This behavior may indicate an adversary backdooring a bucket for data exfiltration or cross-account persistence. For example, an attacker who compromises credentials could attach a policy allowing access from an external AWS account they control, enabling continued access even after credentials are rotated. Note: This rule will not alert if the account ID is part of the bucket’s name or appears in the resource ARN. Such cases are common in standardized naming conventions (e.g., “mybucket-123456789012”). To ensure full coverage, use complementary rules to monitor for suspicious PutBucketPolicy API requests targeting buckets with account IDs embedded in their names or resources.

Known False Positives

  • Legitimate changes to share an S3 bucket with an external account may be identified as false positives.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2024/04/17"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/05"

[rule]
author = ["Elastic"]
description = """
Detects when an Amazon S3 bucket policy is modified to share access with an external AWS account. This rule analyzes
PutBucketPolicy events and compares the S3 bucket’s account ID to any account IDs referenced in the policy’s
Effect=Allow statements. If the policy includes principals from accounts other than the bucket owner’s, the rule
triggers an alert. This behavior may indicate an adversary backdooring a bucket for data exfiltration or cross-account
persistence. For example, an attacker who compromises credentials could attach a policy allowing access from an external
AWS account they control, enabling continued access even after credentials are rotated. Note: This rule will not alert
if the account ID is part of the bucket’s name or appears in the resource ARN. Such cases are common in standardized
naming conventions (e.g., “mybucket-123456789012”). To ensure full coverage, use complementary rules to monitor for
suspicious PutBucketPolicy API requests targeting buckets with account IDs embedded in their names or resources.
"""
event_category_override = "event.type"
false_positives = [
    """
    Legitimate changes to share an S3 bucket with an external account may be identified as false positives.
    """,
]
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "eql"
license = "Elastic License v2"
name = "AWS S3 Bucket Policy Added to Share with External Account"
note = """## Triage and analysis

### Investigating AWS S3 Bucket Policy Added to Share with External Account

This rule detects when an S3 bucket policy is modified using the `PutBucketPolicy` API call to include an external AWS account ID.
It compares the bucket’s `recipient_account_id` to any account IDs included in the policy’s `Effect=Allow` statement, triggering
an alert if the two do not match.  

Adversaries may exploit this to backdoor a bucket and exfiltrate sensitive data by granting permissions to another AWS account
they control, enabling ongoing access to the bucket’s contents even if IAM credentials are rotated or revoked.

This detection specifically focuses on policy-based sharing and does not alert when:
- The account ID appears within the bucket or object name being shared.
- The account owner explicitly matches the policy’s condition keys on something other than an ARN or account id (i.e. IP address).
  
To fully monitor for suspicious sharing behavior, use this rule in combination with detections for:
- Unusual PutBucketPolicy requests
- Cross-account object access (e.g., `GetObject`, `PutObject`)
- Changes to bucket ACLs or access points

#### Possible investigation steps

- **Identify the Actor and Context**
  - Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to identify who made the change.
  - Determine if the identity typically manages S3 bucket policies.  
  - Examine `aws.cloudtrail.resources.arn` to determine which bucket is being shared.

- **Analyze the Policy Change**
  - Review `aws.cloudtrail.request_parameters` to extract the policy JSON and identify the external AWS account ID(s) referenced.  
  - Check for `Effect=Allow` statements granting broad permissions such as `"Action": "s3:*"` or `"Resource": "*"`.  
  - Verify if the added principals correspond to known partners or external vendors.
  - If AWS account ID(s) were only part of `Effect=Deny` statements, then this rule can be closed as a false positive. 

- **Review Context and Source**
  - Check `source.ip`, `source.geo`, and `user_agent.original` for anomalies — such as new IP ranges, access from unfamiliar geographies, or use of programmatic clients (`boto3`, `aws-cli`).

- **Correlate with Related Activity**
  - Search CloudTrail for subsequent activity by the external AWS account ID(s):
    - `GetObject`, `ListBucket`, or `PutObject` events that indicate data access or exfiltration.
  - Look for additional configuration changes by the same actor, such as:
    - `PutBucketAcl`, `PutBucketVersioning`, or `PutBucketReplication` — often part of a larger bucket compromise chain.
  - Determine if multiple buckets were modified in quick succession.

- **Validate Intent**
  - Review internal change requests or documentation to confirm whether this external sharing was approved.  
  - If no approval exists, escalate immediately for potential compromise.

### False positive analysis

- **Authorized Cross-Account Access**
  - Some organizations legitimately share S3 buckets across accounts within a trusted AWS Organization or partner accounts.  
  - Validate whether the external account ID belongs to a known entity or service provider and is documented in your allowlist.
- **Automation or Deployment Pipelines**
  - Continuous integration/deployment pipelines may temporarily attach cross-account policies for replication or staging.  
  - Verify the `user_agent.original` or role name — automation often includes identifiable strings.
- **Naming and Rule Logic Limitations**
  - This rule excludes detections where the account ID appears in the bucket resource ARN (e.g., `mybucket-123456789012`).  
  - Such patterns are common in automated provisioning. For those scenarios, rely on complementary rules that directly monitor `PutBucketPolicy` events against those buckets.

### Response and remediation

- **Immediate Review and Containment**
  - If unauthorized sharing is confirmed, use the AWS CLI or Console to delete or revert the modified policy (`aws s3api delete-bucket-policy` or restore from version control).  
  - Remove external principals and reapply the correct bucket policy.  
  - Rotate access keys for the actor involved, especially if API access came from unexpected locations or tools.

- **Investigation and Scoping**
  - Identify whether data was accessed by the external account via `GetObject` or `ListBucket` operations.  
  - Search CloudTrail logs for other buckets modified by the same actor or IP within the same timeframe.
  - Use AWS Config to review version history of affected bucket policies and detect similar cross-account permissions.

- **Recovery and Hardening**
  - Restrict `s3:PutBucketPolicy` to a limited set of administrative roles using least privilege.
  - Enable AWS Config rule `s3-bucket-policy-grantee-check` to monitor for unauthorized policy additions.
  - Use AWS GuardDuty or Security Hub findings to correlate policy changes with data exfiltration or credential compromise events.
  - Apply service control policies (SCPs) to block cross-account sharing unless explicitly approved.

### Additional information
  - **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)** 
  - **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)** 
  - **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
    "https://stratus-red-team.cloud/attack-techniques/AWS/aws.exfiltration.s3-backdoor-bucket-policy/",
    "https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketPolicy.html",
]
risk_score = 47
rule_id = "e8c9ff14-fd1e-11ee-a0df-f661ea17fbce"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Platform: AWS",
    "Data Source: AWS CloudTrail",
    "Service: AWS S3",
    "Tactic: Collection",
    "Tactic: Exfiltration",
    "Rule Type: Event Correlation (EQL)",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
info where data_stream.dataset == "aws.cloudtrail"
    and event.provider == "s3.amazonaws.com"
    and event.action == "PutBucketPolicy" 
    and event.outcome == "success"
    and stringContains(aws.cloudtrail.request_parameters, "Effect=Allow")
    and (
        stringContains(aws.cloudtrail.request_parameters, "AWS=") or 
        stringContains(aws.cloudtrail.request_parameters, "aws:PrincipalAccount=") or
        stringContains(aws.cloudtrail.request_parameters, "aws:SourceAccount=")
        )
and not stringContains(aws.cloudtrail.request_parameters, "arn:aws:cloudfront::")  
and not stringContains(aws.cloudtrail.request_parameters, "arn:aws:iam::cloudfront:user")
and not stringContains(aws.cloudtrail.request_parameters, aws.cloudtrail.recipient_account_id)
    and not user_agent.original like~ ("*Terraform*", "*Pulumi*")
'''


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

[[rule.threat.technique]]
id = "T1537"
name = "Transfer Data to Cloud Account"
reference = "https://attack.mitre.org/techniques/T1537/"

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

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

[[rule.threat.technique]]
id = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"

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

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

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

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user_agent.original",
    "source.ip",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.type",
    "aws.cloudtrail.user_identity.access_key_id",
    "aws.cloudtrail.resources.arn",
    "aws.cloudtrail.resources.type",
    "event.action",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters",
    "aws.cloudtrail.response_elements",
]

Stages and Predicates

Stage 1: info

info where data_stream.dataset == "aws.cloudtrail"
    and event.provider == "s3.amazonaws.com"
    and event.action == "PutBucketPolicy" 
    and event.outcome == "success"
    and stringContains(aws.cloudtrail.request_parameters, "Effect=Allow")
    and (
        stringContains(aws.cloudtrail.request_parameters, "AWS=") or 
        stringContains(aws.cloudtrail.request_parameters, "aws:PrincipalAccount=") or
        stringContains(aws.cloudtrail.request_parameters, "aws:SourceAccount=")
        )
and not stringContains(aws.cloudtrail.request_parameters, "arn:aws:cloudfront::")  
and not stringContains(aws.cloudtrail.request_parameters, "arn:aws:iam::cloudfront:user")
and not stringContains(aws.cloudtrail.request_parameters, aws.cloudtrail.recipient_account_id)
    and not user_agent.original like~ ("*Terraform*", "*Pulumi*")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
aws.cloudtrail.request_parameterscontains
  • AWS=
  • Effect=Allow corpus 2 (elastic 2)
  • aws:PrincipalAccount=
  • aws:SourceAccount=
field:"aws::requestParameters" kind:contains
data_stream.dataseteq
  • aws.cloudtrail corpus 40 (elastic 40)
field:"data_stream.dataset" kind:eq value:"aws.cloudtrail"
event.actioneq
  • PutBucketPolicy corpus 2 (elastic 2)
field:"EventType" kind:eq value:"PutBucketPolicy"
event.outcomeeq
  • success corpus 82 (elastic 82)
field:"event.outcome" kind:eq value:"success"
event.providereq
  • s3.amazonaws.com corpus 8 (elastic 8)
field:"Provider_Name" kind:eq value:"s3.amazonaws.com"

Exclusions

The rule actively suppresses these predicates.

Azure AD Graph Access with Unusual Client and User

#
Status
production
Severity
medium
Time window
9m
Group by
azure.aadgraphactivitylogs.properties.app_id, user.id
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies Azure AD Graph (graph.windows.net) requests where the combination of calling OAuth client ("azure.aadgraphactivitylogs.properties.app_id") and signed-in user ("user.id") has not been observed in the tenant in a historical window. A user appearing against AAD Graph under an OAuth client that has not previously authenticated that user is a sign of a FOCI swap, a phished refresh token being redeemed for a new client, or an adversary running tooling under a client identity the user does not normally use.

Known False Positives

  • First-time use of a legitimate first-party or sanctioned client by the user (newly installed app, first sign-in to a workload, fresh PowerShell module install). Validate by `azure.aadgraphactivitylogs.properties.app_id` and the user's history.
  • Authorized red team or audit activity. Add exceptions on the calling user after review.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/05/22"
integration = ["azure"]
maturity = "production"
updated_date = "2026/05/22"

[rule]
author = ["Elastic"]
description = """
Identifies Azure AD Graph (graph.windows.net) requests where the combination of calling OAuth client
("azure.aadgraphactivitylogs.properties.app_id") and signed-in user ("user.id") has not been observed in the tenant in
a historical window. A user appearing against AAD Graph under an OAuth client that has not previously authenticated
that user is a sign of a FOCI swap, a phished refresh token being redeemed for a new client, or an adversary running
tooling under a client identity the user does not normally use.
"""
false_positives = [
    """
    First-time use of a legitimate first-party or sanctioned client by the user (newly installed app, first sign-in to a
    workload, fresh PowerShell module install). Validate by `azure.aadgraphactivitylogs.properties.app_id` and the
    user's history.
    """,
    """
    Authorized red team or audit activity. Add exceptions on the calling user after review.
    """,
]
from = "now-9m"
index = ["logs-azure.aadgraphactivitylogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Azure AD Graph Access with Unusual Client and User"
note = """## Triage and analysis

### Investigating Azure AD Graph Access with Unusual Client and User

A (client, user) pair appearing on AAD Graph for the first time in 14 days is a high-signal indicator. Legacy
AAD Graph traffic is dominated by a small set of recognised first-party callers per user; new combinations
suggest one of:

- A FOCI refresh-token swap landed under a new client identity.
- The user newly consented to (or was phished into consenting to) an OAuth application.
- An adversary is using stolen tokens / credentials under a client identity the user does not normally use.

### Possible investigation steps

- Identify the calling client and confirm whether the app is sanctioned.
    - `azure.aadgraphactivitylogs.properties.app_id`. Pivot to Azure portal → Enterprise Applications to check whether it is first-party, sanctioned third-party, or unfamiliar.
- Identify the user and check the surrounding auth context.
    - `user.id`, then pivot to sign-in logs (`logs-azure.signinlogs-*`) for the same user around the same time. Look for unusual sign-in geography, MFA bypass, or risky session signals.
- Review source posture.
    - `user_agent.original`, `source.ip`, `source.as.organization.name`. Residential / VPS / anonymising-network egress raises priority.
- Review what was queried.
    - `url.path`. Bulk recon or User-collection access via internal API versions raises triage priority.
- Check tenant-wide blast radius for the client.
    - Is the same client ID hitting AAD Graph for many other users? That pattern points to large-scale consent abuse rather than a single account compromise.
- Confirm the activity is not attributable to authorized testing (red team engagement, penetration test, internal tooling validation) before treating as malicious.

### Response and remediation

- Revoke refresh tokens and active sessions for the calling user.
    - `POST /v1.0/users/{id}/revokeSignInSessions`.
- Temporarily disable the user if the alert is high-confidence or you need to halt further activity while investigation continues.
    - `PATCH /v1.0/users/{id}` with body `{"accountEnabled": false}`.
- If the client is not a sanctioned application, revoke its OAuth consent.
    - `GET /v1.0/oauth2PermissionGrants?$filter=clientId eq '{servicePrincipalId}'`, then `DELETE /v1.0/oauth2PermissionGrants/{grantId}`.
- Check for device registrations created by the user during or around the burst window and remove rogue devices.
    - `GET /v1.0/users/{id}/registeredDevices` and `GET /v1.0/users/{id}/ownedDevices`, then `DELETE /v1.0/devices/{deviceObjectId}`.
    - Do this BEFORE session revocation: device-bound PRTs survive `revokeSignInSessions`.
- If the calling application has no legitimate AAD Graph dependency, block further use by that app.
    - `PATCH /beta/applications/{id}` with body `{"authenticationBehaviors": {"blockAzureADGraphAccess": true}}`.
    - This property lives on the Graph beta endpoint, not v1.0.
"""
references = [
    "https://github.com/secureworks/family-of-client-ids-research",
    "https://learn.microsoft.com/en-us/graph/migrate-azure-ad-graph-overview",
    "https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/",
]
risk_score = 47
rule_id = "fd9d2933-f0f9-4aac-810c-a31f6a4a7890"
setup = """#### Azure AD Graph Activity Logs
Requires Azure AD Graph Activity Logs ingested into `logs-azure.aadgraphactivitylogs-*` via the Elastic Azure
integration. Enable the `AzureADGraphActivityLogs` diagnostic-settings category on Entra ID.
"""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: Azure",
    "Data Source: Azure AD Graph",
    "Data Source: Azure AD Graph Activity Logs",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Tactic: Discovery",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset:"azure.aadgraphactivitylogs" and
    azure.aadgraphactivitylogs.properties.actor_type : "User" and
    azure.aadgraphactivitylogs.properties.app_id: (* and not (
        "74658136-14ec-4630-ad9b-26e160ff0fc6" or
        "bb8f18b0-9c38-48c9-a847-e1ef3af0602d" or
        "00000006-0000-0ff1-ce00-000000000000" or
        "18ed3507-a475-4ccb-b669-d66bc9f2a36e")
    ) and user.id:*
'''

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

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

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"

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


[rule.investigation_fields]
field_names = [
    "user.id",
    "source.ip",
    "source.as.organization.name",
    "user_agent.original",
    "azure.aadgraphactivitylogs.properties.app_id",
    "azure.aadgraphactivitylogs.properties.api_version",
    "url.path",
    "azure.tenant_id",
]

[rule.new_terms]
field = "new_terms_fields"
value = ["azure.aadgraphactivitylogs.properties.app_id", "user.id"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"


Stages and Predicates

Stage 1: new_terms

data_stream.dataset:"azure.aadgraphactivitylogs" and
    azure.aadgraphactivitylogs.properties.actor_type : "User" and
    azure.aadgraphactivitylogs.properties.app_id: (* and not (
        "74658136-14ec-4630-ad9b-26e160ff0fc6" or
        "bb8f18b0-9c38-48c9-a847-e1ef3af0602d" or
        "00000006-0000-0ff1-ce00-000000000000" or
        "18ed3507-a475-4ccb-b669-d66bc9f2a36e")
    ) and user.id:*

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
azure.aadgraphactivitylogs.properties.app_idin00000006-0000-0ff1-ce00-000000000000, 18ed3507-a475-4ccb-b669-d66bc9f2a36e, 74658136-14ec-4630-ad9b-26e160ff0fc6, bb8f18b0-9c38-48c9-a847-e1ef3af0602dexcludes:azure.aadgraphactivitylogs.properties.app_id

Binary Proxy Execution via Windows OpenSSH

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to execute programs via the Windows OpenSSH client. This may indicate an attempt to bypass application control via trusted windows binaries.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies attempts to execute programs via the Windows OpenSSH client. This may indicate an attempt to bypass
application control via trusted windows binaries.
"""
id = "a9b41132-04c7-421e-9aaf-b2c8718a66d0"
license = "Elastic License v2"
name = "Binary Proxy Execution via Windows OpenSSH"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/Binaries/Ssh/"]
version = "1.0.7"

query = '''
process where event.action == "start" and
(
 (process.parent.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
 process.parent.args == "-o" and process.parent.command_line : ("*ProxyCommand=*", "*LocalCommand=*") and
 not process.executable : ("?:\\Windows\\system32\\conhost.exe", "?:\\Program Files\\Amazon\\AWSCLIV2\\aws.exe", "C:\\Windows\\System32\\OpenSSH\\ssh.exe")) or

 (process.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
  process.parent.name : ("explorer.exe", "python.exe", "conhost.exe") and
  process.command_line : ("*Command=*powershell*", "*schtasks*create*", "*LocalCommand=@echo off &&*",
                          "*Command=cmd /c*", "*ProxyCommand=*cmd.exe *", "*Command=\"cmd /c*", "*LocalCommand=scp*&&*", "*LocalCommand=?scp*&&*") )
)
'''

min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

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

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
(
 (process.parent.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
 process.parent.args == "-o" and process.parent.command_line : ("*ProxyCommand=*", "*LocalCommand=*") and
 not process.executable : ("?:\\Windows\\system32\\conhost.exe", "?:\\Program Files\\Amazon\\AWSCLIV2\\aws.exe", "C:\\Windows\\System32\\OpenSSH\\ssh.exe")) or

 (process.executable : ("?:\\windows\\system32\\OpenSSH\\ssh.exe", "C:\\Windows\\System32\\OpenSSH\\sftp.exe") and
  process.parent.name : ("explorer.exe", "python.exe", "conhost.exe") and
  process.command_line : ("*Command=*powershell*", "*schtasks*create*", "*LocalCommand=@echo off &&*",
                          "*Command=cmd /c*", "*ProxyCommand=*cmd.exe *", "*Command=\"cmd /c*", "*LocalCommand=scp*&&*", "*LocalCommand=?scp*&&*") )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *Command="cmd /c* corpus 2 (elastic 2)
  • *Command=*powershell* corpus 2 (elastic 2)
  • *Command=cmd /c*
  • *LocalCommand=?scp*&&* corpus 2 (elastic 2)
  • *LocalCommand=@echo off &&*
  • *LocalCommand=scp*&&* corpus 2 (elastic 2)
  • *ProxyCommand=*cmd.exe *
  • *schtasks*create*
field:"CommandLine" kind:wildcard
process.executablewildcard
  • ?:\windows\system32\OpenSSH\ssh.exe corpus 3 (elastic 3)
  • C:\Windows\System32\OpenSSH\sftp.exe
field:"Image" kind:wildcard
process.parent.argseq
  • -o
field:"process.parent.args" kind:eq value:"-o"
process.parent.command_linewildcard
  • *LocalCommand=*
  • *ProxyCommand=* corpus 2 (elastic 1, splunk 1)
field:"ParentCommandLine" kind:wildcard
process.parent.executablewildcard
  • ?:\windows\system32\OpenSSH\ssh.exe
  • C:\Windows\System32\OpenSSH\sftp.exe
field:"ParentImage" kind:wildcard
process.parent.namewildcard
  • conhost.exe corpus 8 (elastic 8)
  • explorer.exe corpus 50 (elastic 50)
  • python.exe corpus 4 (elastic 4)
field:"parent_process_basename" kind:wildcard

Container Management Utility Execution Detected via Defend for Containers

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

This rule detects when a container management binary is run from inside a container. These binaries are critical components of many containerized environments, and their presence and execution in unauthorized containers could indicate compromise or a misconfiguration.

Known False Positives

  • There is a potential for false positives if the container is used for legitimate administrative tasks that require the use of container management utilities, such as deploying, scaling, or updating containerized applications. It is important to investigate any alerts generated by this rule to determine if they are indicative of malicious activity or part of legitimate container activity.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/04/26"
integration = ["cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/07/29"

[rule]
author = ["Elastic"]
description = """
This rule detects when a container management binary is run from inside a container. These binaries are critical
components of many containerized environments, and their presence and execution in unauthorized containers could
indicate compromise or a misconfiguration.
"""
false_positives = [
    """
    There is a potential for false positives if the container is used for legitimate administrative tasks that require
    the use of container management utilities, such as deploying, scaling, or updating containerized applications. It is
    important to investigate any alerts generated by this rule to determine if they are indicative of malicious activity
    or part of legitimate container activity.
    """,
]
from = "now-6m"
index = ["logs-cloud_defend.process*"]
interval = "5m"
language = "eql"
license = "Elastic Licence v2"
name = "Container Management Utility Execution Detected via Defend for Containers"
note = """## Setup

## 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 Container Management Utility Execution Detected via Defend for Containers

Container management utilities like Docker and Kubernetes are essential for orchestrating and managing containerized applications. They facilitate tasks such as deployment, scaling, and networking. However, adversaries can exploit these tools to execute unauthorized commands within containers, potentially leading to system compromise. The detection rule identifies suspicious execution of these utilities within containers, signaling possible misuse or misconfiguration, by monitoring specific process activities and event types.

### Possible investigation steps

- Review the specific container ID where the suspicious process was executed to determine its purpose and origin.
- Examine the process name and command line arguments to understand the context of the execution and identify any anomalies or unauthorized commands.
- Check the user and permissions associated with the process to assess if it aligns with expected roles and access levels for container management tasks.
- Investigate the container's creation and deployment history to identify any recent changes or deployments that could explain the presence of the management utility.
- Analyze network activity associated with the container to detect any unusual connections or data transfers that might indicate malicious activity.
- Correlate the event with other security alerts or logs to identify patterns or related incidents that could provide additional context or evidence of compromise.

### False positive analysis

- Routine maintenance tasks within containers can trigger the rule. Exclude known maintenance scripts or processes by adding them to an allowlist if they frequently execute container management utilities.
- Development and testing environments often run container management commands for legitimate purposes. Consider excluding these environments from monitoring or adjust the rule to focus on production environments only.
- Automated deployment tools may execute container management commands as part of their workflow. Identify these tools and create exceptions for their activities to prevent false positives.
- System updates or patches might involve running container management utilities. Monitor update schedules and temporarily adjust the rule to avoid unnecessary alerts during these periods.
- Legitimate administrative actions by authorized personnel can trigger the rule. Implement user-based exceptions for known administrators to reduce false positives while maintaining security oversight.

### Response and remediation

- Immediately isolate the affected container to prevent further unauthorized access or execution of commands. This can be done by stopping the container or disconnecting it from the network.
- Review the container's configuration and access controls to identify any misconfigurations or unauthorized access permissions that may have allowed the execution of container management utilities.
- Conduct a thorough analysis of the container's logs and process activities to determine the extent of the compromise and identify any additional malicious activities or lateral movement attempts.
- Remove any unauthorized or suspicious binaries and scripts from the container to prevent further exploitation.
- Patch and update the container image and underlying host system to address any known vulnerabilities that may have been exploited.
- Implement stricter access controls and monitoring on container management utilities to ensure they are only accessible by authorized users and processes.
- Escalate the incident to the security operations team for further investigation and to assess the need for broader security measures across the container environment."""
risk_score = 21
rule_id = "6c6bb7ea-0636-44ca-b541-201478ef6b50"
severity = "low"
tags = [
    "Data Source: Elastic Defend for Containers",
    "Domain: Container",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
  process.name in ("dockerd", "kubelet", "kube-proxy", "kubectl", "containerd", "systemd", "crictl") or
  (
    /* Account for tools that execute utilities as a subprocess, in this case the target utility name will appear as a process arg */
    process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
    process.args in (
      "dockerd", "/bin/dockerd", "/usr/bin/dockerd", "/usr/local/bin/dockerd",
      "kubelet", "/bin/kubelet", "/usr/bin/kubelet", "/usr/local/bin/kubelet",
      "kube-proxy", "/bin/kube-proxy", "/usr/bin/kube-proxy", "/usr/local/bin/kube-proxy",
      "kubectl", "/bin/kubectl", "/usr/bin/kubectl", "/usr/local/bin/kubectl",
      "containerd", "/bin/containerd", "/usr/bin/containerd", "/usr/local/bin/containerd",
      "systemd", "/bin/systemd", "/usr/bin/systemd", "/usr/local/bin/systemd",
      "crictl", "/bin/crictl", "/usr/bin/crictl", "/usr/local/bin/crictl"
    ) and 
    /* default exclusion list to not FP on default multi-process commands */
    not process.args in (
      "which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
      "man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
      "chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
      "chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
    )
  )
) and
container.id like "*" and
not (
  process.parent.executable in ("/sbin/init", "/usr/bin/dockerd", "/usr/bin/runc", "/usr/bin/containerd-shim-runc-v2") or
  process.working_directory == "/aws" or
  (process.parent.args == "init" and process.parent.args == "runc") or
  (process.parent.name == "busybox" and process.name == "kubectl")
)
'''

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

[[rule.threat.technique]]
id = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"

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

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

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

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

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
  process.name in ("dockerd", "kubelet", "kube-proxy", "kubectl", "containerd", "systemd", "crictl") or
  (
    process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
    process.args in (
      "dockerd", "/bin/dockerd", "/usr/bin/dockerd", "/usr/local/bin/dockerd",
      "kubelet", "/bin/kubelet", "/usr/bin/kubelet", "/usr/local/bin/kubelet",
      "kube-proxy", "/bin/kube-proxy", "/usr/bin/kube-proxy", "/usr/local/bin/kube-proxy",
      "kubectl", "/bin/kubectl", "/usr/bin/kubectl", "/usr/local/bin/kubectl",
      "containerd", "/bin/containerd", "/usr/bin/containerd", "/usr/local/bin/containerd",
      "systemd", "/bin/systemd", "/usr/bin/systemd", "/usr/local/bin/systemd",
      "crictl", "/bin/crictl", "/usr/bin/crictl", "/usr/local/bin/crictl"
    ) and
    not process.args in (
      "which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
      "man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
      "chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
      "chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
    )
  )
) and
container.id like "*" and
not (
  process.parent.executable in ("/sbin/init", "/usr/bin/dockerd", "/usr/bin/runc", "/usr/bin/containerd-shim-runc-v2") or
  process.working_directory == "/aws" or
  (process.parent.args == "init" and process.parent.args == "runc") or
  (process.parent.name == "busybox" and process.name == "kubectl")
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
container.idwildcard
  • *
field:"container.id" kind:wildcard value:"*"
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argsin
  • /bin/containerd
  • /bin/crictl
  • /bin/dockerd
  • /bin/kube-proxy
  • /bin/kubectl
  • /bin/kubelet
  • /bin/systemd
  • /usr/bin/containerd
  • /usr/bin/crictl
  • /usr/bin/dockerd
  • /usr/bin/kube-proxy
  • /usr/bin/kubectl
  • /usr/bin/kubelet
  • /usr/bin/systemd
  • /usr/local/bin/containerd
  • /usr/local/bin/crictl
  • /usr/local/bin/dockerd
  • /usr/local/bin/kube-proxy
  • /usr/local/bin/kubectl
  • /usr/local/bin/kubelet
  • /usr/local/bin/systemd
  • containerd
  • crictl
  • dockerd
  • kube-proxy
  • kubectl
  • kubelet
  • systemd
field:"process.args" kind:in
process.namein
  • bash
  • busybox
  • containerd
  • crictl
  • csh
  • dash
  • dockerd
  • fish
  • ksh
  • kube-proxy
  • kubectl
  • kubelet
  • sh
  • systemd
  • tcsh
  • zsh
field:"process_basename" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.nameeqkubectlexcludes:process.name field:"process.name" value:"kubectl"
process.parent.nameeqbusyboxexcludes:process.parent.name field:"process.parent.name" value:"busybox"
process.parent.argseqinitexcludes:process.parent.args field:"process.parent.args" value:"init"
process.parent.argseqruncexcludes:process.parent.args field:"process.parent.args" value:"runc"
process.parent.executablein/sbin/init, /usr/bin/containerd-shim-runc-v2, /usr/bin/dockerd, /usr/bin/runcexcludes:process.parent.executable
process.working_directoryeq/awsexcludes:process.working_directory field:"process.working_directory" value:"/aws"

Disabling Hypervisor-protected Code Integrity via Registry

#
Source
github.com/elastic/protections-artifacts

Identifies registry modifications to disable Hypervisor-protected Code Integrity. HVCI enforces code integrity in the kernel and allows only signed code to be executed.

MITRE ATT&CK Coverage

TacticTechniques
Persistence
Defense Impairment

Rule Body

[rule]
description = """
Identifies registry modifications to disable Hypervisor-protected Code Integrity. HVCI enforces code integrity in the
kernel and allows only signed code to be executed.
"""
id = "6bda13bc-f952-4353-9a97-2c7a38b21010"
license = "Elastic License v2"
name = "Disabling Hypervisor-protected Code Integrity via Registry"
os_list = ["windows"]
reference = [
    "https://www.welivesecurity.com/2023/03/01/blacklotus-uefi-bootkit-myth-confirmed/",
    "https://learn.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity",
]
version = "1.0.22"

query = '''
registry where event.action == "modification" and 
 process.executable != null and 
 registry.path :
       ("HKLM\\SYSTEM\\*ControlSet*\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\\Enabled",
        "HKLM\\SYSTEM\\*ControlSet*\\DeviceGuard\\HypervisorEnforcedCodeIntegrity") and 
 registry.data.strings : "0" and 
 not process.executable :
           ("?:\\Windows\\System32\\DeviceEnroller.exe",
            "?:\\Windows\\System32\\omadmclient.exe",
            "?:\\Windows\\System32\\svchost.exe",
            "?:\\Windows\\System32\\SecurityHealthService.exe",
            "?:\\Program Files\\HONOR\\PCManager\\MBAMessageCenter.exe",
            "?:\\Program Files (x86)\\ASUS\\AI Suite III\\AISuite3.exe",
            "C:\\Program Files\\Tenable\\Nessus Agent\\nessusd.exe",
            "C:\\Program Files (x86)\\Faronics\\Deep Freeze\\Install C-0\\DFServ.exe",
            "C:\\Program Files (x86)\\Common Files\\InstallShield\\engine\\?\\Intel 32\\IKernel.exe",
            "?:\\Windows\\regedit.exe",
            "C:\\Windows\\System32\\provtool.exe",
            "C:\\Windows\\System32\\backgroundTaskHost.exe",
            "C:\\Windows\\UUS\\Packages\\Preview\\amd64\\MoUsoCoreWorker.exe",
            "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe",
            "C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\*\\msedgewebview2.exe",
            "C:\\Windows\\UUS\\amd64\\MoUsoCoreWorker.exe",
            "C:\\Program Files\\Omnilert\\Omnilert.exe") and
 not process.thread.Ext.call_stack_summary in
             ("sysfer.dll|kernelbase.dll|dggpext.dll|policymanagerprecheck.dll|policymanager.dll|deviceenroller.exe|kernel32.dll|ntdll.dll",
              "sysfer.dll|kernelbase.dll|dggpext.dll|enterprisecsps.dll|configmanager2.dll|enterprisecsps.dll|configmanager2.dll|coredpus.dll|omadmclient.exe|kernel32.dll|ntdll.dll")
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"


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

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: registry

registry where event.action == "modification" and 
 process.executable != null and 
 registry.path :
       ("HKLM\\SYSTEM\\*ControlSet*\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\\Enabled",
        "HKLM\\SYSTEM\\*ControlSet*\\DeviceGuard\\HypervisorEnforcedCodeIntegrity") and 
 registry.data.strings : "0" and 
 not process.executable :
           ("?:\\Windows\\System32\\DeviceEnroller.exe",
            "?:\\Windows\\System32\\omadmclient.exe",
            "?:\\Windows\\System32\\svchost.exe",
            "?:\\Windows\\System32\\SecurityHealthService.exe",
            "?:\\Program Files\\HONOR\\PCManager\\MBAMessageCenter.exe",
            "?:\\Program Files (x86)\\ASUS\\AI Suite III\\AISuite3.exe",
            "C:\\Program Files\\Tenable\\Nessus Agent\\nessusd.exe",
            "C:\\Program Files (x86)\\Faronics\\Deep Freeze\\Install C-0\\DFServ.exe",
            "C:\\Program Files (x86)\\Common Files\\InstallShield\\engine\\?\\Intel 32\\IKernel.exe",
            "?:\\Windows\\regedit.exe",
            "C:\\Windows\\System32\\provtool.exe",
            "C:\\Windows\\System32\\backgroundTaskHost.exe",
            "C:\\Windows\\UUS\\Packages\\Preview\\amd64\\MoUsoCoreWorker.exe",
            "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe",
            "C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\*\\msedgewebview2.exe",
            "C:\\Windows\\UUS\\amd64\\MoUsoCoreWorker.exe",
            "C:\\Program Files\\Omnilert\\Omnilert.exe") and
 not process.thread.Ext.call_stack_summary in
             ("sysfer.dll|kernelbase.dll|dggpext.dll|policymanagerprecheck.dll|policymanager.dll|deviceenroller.exe|kernel32.dll|ntdll.dll",
              "sysfer.dll|kernelbase.dll|dggpext.dll|enterprisecsps.dll|configmanager2.dll|enterprisecsps.dll|configmanager2.dll|coredpus.dll|omadmclient.exe|kernel32.dll|ntdll.dll")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • modification corpus 72 (elastic 72)
field:"EventType" kind:eq value:"modification"
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
registry.data.stringswildcard
  • 0 corpus 17 (elastic 14, sigma 3)
field:"Details" kind:wildcard value:"0"
registry.pathwildcard
  • HKLM\SYSTEM\*ControlSet*\DeviceGuard\HypervisorEnforcedCodeIntegrity
  • HKLM\SYSTEM\*ControlSet*\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity\Enabled
field:"TargetObject" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablewildcard?:\Windows\System32\DeviceEnroller.exe, ?:\Windows\System32\omadmclient.exe, ?:\Windows\System32\svchost.exe, ?:\Windows\System32\SecurityHealthService.exe, ?:\Program Files\HONOR\PCManager\MBAMessageCenter.exe, ?:\Program Files (x86)\ASUS\AI Suite III\AISuite3.exe, C:\Program Files\Tenable\Nessus Agent\nessusd.exe, C:\Program Files (x86)\Faronics\Deep Freeze\Install C-0\DFServ.exe, C:\Program Files (x86)\Common Files\InstallShield\engine\?\Intel 32\IKernel.exe, ?:\Windows\regedit.exe, C:\Windows\System32\provtool.exe, C:\Windows\System32\backgroundTaskHost.exe, C:\Windows\UUS\Packages\Preview\amd64\MoUsoCoreWorker.exe, C:\Program Files (x86)\Microsoft\Edge\Application\*\Installer\setup.exe, C:\Program Files (x86)\Microsoft\EdgeWebView\Application\*\msedgewebview2.exe, C:\Windows\UUS\amd64\MoUsoCoreWorker.exe, C:\Program Files\Omnilert\Omnilert.exeexcludes:process.executable
process.thread.Ext.call_stack_summaryinsysfer.dll|kernelbase.dll|dggpext.dll|enterprisecsps.dll|configmanager2.dll|enterprisecsps.dll|configmanager2.dll|coredpus.dll|omadmclient.exe|kernel32.dll|ntdll.dll, sysfer.dll|kernelbase.dll|dggpext.dll|policymanagerprecheck.dll|policymanager.dll|deviceenroller.exe|kernel32.dll|ntdll.dllexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"sysfer.dll|kernelbase.dll|dggpext.dll|enterprisecsps.dll|configmanager2.dll|enterprisecsps.dll|configmanager2.dll|coredpus.dll|omadmclient.exe|kernel32.dll|ntdll.dll" field:"process.thread.Ext.call_stack_summary" value:"sysfer.dll|kernelbase.dll|dggpext.dll|policymanagerprecheck.dll|policymanager.dll|deviceenroller.exe|kernel32.dll|ntdll.dll"

Dock Tile Plug-In Load

#
Source
github.com/elastic/protections-artifacts

Detects when an Application's Dock Tile Plugin gets mapped into memory by the macOS XPC external dock service process. Threat actors can add Dock Tile Plugins to their applications (APP_NAME.app/Contents/PlugIns/DockTile). The plugin will be recognized by launch services, registered, and the plugin will be loaded. These plugins are not visible to the user, can react to various system events, and will be loaded at each login, so persists across reboots, and runs inside a legitimate system process which is not sandboxed.

MITRE ATT&CK Coverage

TacticTechniques
Persistence

Rule Body

[rule]
description = """
Detects when an Application's Dock Tile Plugin gets mapped into memory by the macOS XPC external dock service process.
Threat actors can add Dock Tile Plugins to their applications (APP_NAME.app/Contents/PlugIns/DockTile). The plugin will
be recognized by launch services, registered, and the plugin will be loaded. These plugins are not visible to the user,
can react to various system events, and will be loaded at each login, so persists across reboots, and runs inside a
legitimate system process which is not sandboxed.
"""
id = "6fc9c19f-0315-482c-b056-e20a8d0f1b2e"
license = "Elastic License v2"
name = "Dock Tile Plug-In Load"
os_list = ["macos"]
reference = ["https://theevilbit.github.io/beyond/beyond_0032/"]
version = "1.0.5"

query = '''
library where event.action == "load" and process.name == "com.apple.dock.external.extra.arm64"
'''

min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.executable"
state = 0

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"


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

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: library

library where event.action == "load" and process.name == "com.apple.dock.external.extra.arm64"

Indicators

These rows show field, operator, and value matches.

Early Remote Memory Allocation

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

Identifies attempts to allocate remote memory into a target process early before the start of its initial thread, this behavior is often associated with remote process injection preparation.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies attempts to allocate remote memory into a target process early before the start of its initial thread, this
behavior is often associated with remote process injection preparation.
"""
id = "d0ffac28-7e18-416e-b9f6-d16cc8cdeeb4"
license = "Elastic License v2"
name = "Early Remote Memory Allocation"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.2"

query = '''
sequence with maxspan=1m
 [api where process.Ext.api.behaviors == "cross-process" and process.Ext.api.behaviors =="parent-child" and
  process.Ext.api.name in ("VirtualAllocEx", "MapViewOfFile", "MapViewOfFile2") and
  Target.process.Ext.token.integrity_level_name != "low" and process.thread.Ext.call_stack_summary != null and
  not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
  not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
  not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files\\*", "?:\\program files (x86)\\*") and
  process.thread.Ext.call_stack_final_user_module.protection_provenance != "Kernel" and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != "0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2"] by process.entity_id, Target.process.entity_id
 [process where event.action == "start"] by process.parent.entity_id, process.entity_id
'''

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

[[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.12.0"

Stages and Predicates

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

Stage 1: api

[api where process.Ext.api.behaviors == "cross-process" and process.Ext.api.behaviors =="parent-child" and
  process.Ext.api.name in ("VirtualAllocEx", "MapViewOfFile", "MapViewOfFile2") and
  Target.process.Ext.token.integrity_level_name != "low" and process.thread.Ext.call_stack_summary != null and
  not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
  not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
  not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files\\*", "?:\\program files (x86)\\*") and
  process.thread.Ext.call_stack_final_user_module.protection_provenance != "Kernel" and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != "0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2"] by process.entity_id, Target.process.entity_id

Stage 2: process

[process where event.action == "start"] by process.parent.entity_id, process.entity_id

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Elastic Defend Alert from Package Manager Install Ancestry

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

Detects Elastic Defend alerts (behavior, malicious file, memory signature, shellcode) where the alerted process has a package-manager install context in its ancestry: npm (Node.js), PyPI (pip / Python / uv), or Rust (cargo). Install-time spawn chains are a common path for supply-chain and postinstall abuse; this Higher-Order rule surfaces Defend alerts whose process tree includes such activity for prioritization.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/03/31"
maturity = "production"
min_stack_comments = "ES|QL inline stats became generally available in 9.3.0 and MV_INTERSECTION is in preview since 9.3."
min_stack_version = "9.3.0"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Detects Elastic Defend alerts (behavior, malicious file, memory signature, shellcode) where the alerted process has a
package-manager install context in its ancestry: npm (Node.js), PyPI (pip / Python / uv), or Rust (cargo). Install-time
spawn chains are a common path for supply-chain and postinstall abuse; this Higher-Order rule surfaces Defend alerts
whose process tree includes such activity for prioritization.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Elastic Defend Alert from Package Manager Install Ancestry"
note = """## Triage and analysis

### Investigating Elastic Defend Alert from Package Manager Install Ancestry

Elastic Defend raised an alert on a process whose ancestry includes a parent that was involved in a package install
(npm, pip/PyPI, or cargo/crates.io). That can indicate malicious postinstall scripts, dependency confusion, or
compromised packages.

### Possible investigation steps

- Identify the install context by finding a process whose `entity_id` appears in `Esql.pkg_ancestor_ids` (intersection
  with `process.Ext.ancestry`).
- Review `process.command_line` and `process.parent.command_line` for the install command and any script hooks
  (e.g. `preinstall`, `postinstall`, `setup.py`, build scripts).
- Correlate package name, registry, and lockfile or manifest on the host if available.
- Pivot on host, user, and network for additional alerts or outbound connections from the same tree.

### False positive analysis

- Normal `npm install`, `pip install`, and `cargo build` / `cargo install` during development or CI can produce alerts
  on descendant processes. Tune by excluding known-safe Defend rule names, paths, or command-line patterns.

### Response and remediation

- If abuse is confirmed: remove the suspect package, rotate secrets exposed to that environment, and block related IOCs.
"""
references = [
    "https://attack.mitre.org/techniques/T1195/",
    "https://attack.mitre.org/techniques/T1195/002/",
]
risk_score = 99
rule_id = "344e6c7d-ceb0-4f20-ba04-7c75569a7e38"
severity = "critical"
tags = [
    "Domain: Endpoint",
    "Use Case: Threat Detection",
    "Tactic: Initial Access",
    "Rule Type: Higher-Order Rule",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
FROM logs-endpoint.alerts-*, logs-endpoint.events.process-* METADATA _id, _version, _index

| EVAL is_pkg_install = CASE(
    // npm  npx  yarn  pnpm (Node.js ecosystem)
    process.parent.name IN ("node", "node.exe") AND (
      process.parent.command_line LIKE "*npm install*" OR
      process.parent.command_line LIKE "*npm i *" OR
      ends_with(process.parent.command_line, "npm i") OR
      process.parent.command_line LIKE "*npx *" OR
      process.parent.command_line LIKE "*yarn install*" OR
      process.parent.command_line LIKE "*yarn add*" OR
      process.parent.command_line LIKE "*pnpm install*" OR
      process.parent.command_line LIKE "*pnpm add*" OR
      process.parent.command_line LIKE "*npm-cli.js*install*" OR
      process.parent.command_line LIKE "*setup.js*"
    ), true,

    // pip  pip3 pipx poetry  uv (Python ecosystem)
    ((process.parent.name like "python*" or process.parent.name like "pip*" or process.parent.name IN ("uv", "uv.exe") ) AND (
      process.parent.command_line LIKE "*pip install*" OR
      process.parent.command_line LIKE "*pip3 install*" OR
      process.parent.command_line LIKE "*-m pip install*" OR
      process.parent.command_line LIKE "*setup.py install*" OR
      process.parent.command_line LIKE "*setup.py develop*" OR
      process.parent.command_line LIKE "*pipx install*" OR
      process.parent.command_line LIKE "*poetry install*" OR
      process.parent.command_line LIKE "*poetry add*" OR
      process.parent.command_line LIKE "*uv pip install*" OR
      process.parent.command_line LIKE "*uv add*")), true,

    // cargo (Rust / crates.io ecosystem)
    process.parent.name IN ("cargo", "cargo.exe", "rustc", "rustc.exe") AND (
      process.parent.command_line LIKE "*cargo install*" OR
      process.parent.command_line LIKE "*cargo build*" OR
      process.parent.command_line LIKE "*cargo run*" OR
      process.parent.command_line LIKE "*cargo fetch*"), true,

    false
  )

| WHERE process.Ext.ancestry IS NOT NULL AND (data_stream.dataset == "endpoint.alerts" OR is_pkg_install)

// Capture entity_ids for package install parent processes
| EVAL all_entity_id = CASE(is_pkg_install, process.parent.entity_id, "null")

// Collect all package install entity_ids globally
| INLINE STATS all_pkg_entity_ids = VALUES(all_entity_id) WHERE all_entity_id != "null"

// Find which package install entity_ids appear in this process's ancestry
| EVAL Esql.pkg_ancestor_ids = MV_INTERSECTION(all_pkg_entity_ids, process.Ext.ancestry)

// Elastic Defend alerts descended from a package install process
| WHERE Esql.pkg_ancestor_ids IS NOT NULL AND data_stream.dataset == "endpoint.alerts"

| KEEP *
'''

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

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

Stages and Predicates

Stage 1: from

FROM logs-endpoint.alerts-*, logs-endpoint.events.process-* METADATA _id, _version, _index

Stage 2: eval

| EVAL is_pkg_install = CASE(
    process.parent.name IN ("node", "node.exe") AND (
      process.parent.command_line LIKE "*npm install*" OR
      process.parent.command_line LIKE "*npm i *" OR
      ends_with(process.parent.command_line, "npm i") OR
      process.parent.command_line LIKE "*npx *" OR
      process.parent.command_line LIKE "*yarn install*" OR
      process.parent.command_line LIKE "*yarn add*" OR
      process.parent.command_line LIKE "*pnpm install*" OR
      process.parent.command_line LIKE "*pnpm add*" OR
      process.parent.command_line LIKE "*npm-cli.js*install*" OR
      process.parent.command_line LIKE "*setup.js*"
    ), true,
    ((process.parent.name like "python*" or process.parent.name like "pip*" or process.parent.name IN ("uv", "uv.exe") ) AND (
      process.parent.command_line LIKE "*pip install*" OR
      process.parent.command_line LIKE "*pip3 install*" OR
      process.parent.command_line LIKE "*-m pip install*" OR
      process.parent.command_line LIKE "*setup.py install*" OR
      process.parent.command_line LIKE "*setup.py develop*" OR
      process.parent.command_line LIKE "*pipx install*" OR
      process.parent.command_line LIKE "*poetry install*" OR
      process.parent.command_line LIKE "*poetry add*" OR
      process.parent.command_line LIKE "*uv pip install*" OR
      process.parent.command_line LIKE "*uv add*")), true,
    process.parent.name IN ("cargo", "cargo.exe", "rustc", "rustc.exe") AND (
      process.parent.command_line LIKE "*cargo install*" OR
      process.parent.command_line LIKE "*cargo build*" OR
      process.parent.command_line LIKE "*cargo run*" OR
      process.parent.command_line LIKE "*cargo fetch*"), true,
    false
  )
is_pkg_install =
ifprocess.parent.name IN ("node", "node.exe") AND ( process.parent.command_line LIKE "*npm install*" OR process.parent.command_line LIKE "*npm i *" OR ends_with(process.parent.command_line, "npm i") OR process.parent.command_line LIKE "*npx *" OR process.parent.command_line LIKE "*yarn install*" OR process.parent.command_line LIKE "*yarn add*" OR process.parent.command_line LIKE "*pnpm install*" OR process.parent.command_line LIKE "*pnpm add*" OR process.parent.command_line LIKE "*npm-cli.js*install*" OR process.parent.command_line LIKE "*setup.js*" )true
elif((process.parent.name like "python*" or process.parent.name like "pip*" or process.parent.name IN ("uv", "uv.exe") ) AND ( process.parent.command_line LIKE "*pip install*" OR process.parent.command_line LIKE "*pip3 install*" OR process.parent.command_line LIKE "*-m pip install*" OR process.parent.command_line LIKE "*setup.py install*" OR process.parent.command_line LIKE "*setup.py develop*" OR process.parent.command_line LIKE "*pipx install*" OR process.parent.command_line LIKE "*poetry install*" OR process.parent.command_line LIKE "*poetry add*" OR process.parent.command_line LIKE "*uv pip install*" OR process.parent.command_line LIKE "*uv add*"))true
elifprocess.parent.name IN ("cargo", "cargo.exe", "rustc", "rustc.exe") AND ( process.parent.command_line LIKE "*cargo install*" OR process.parent.command_line LIKE "*cargo build*" OR process.parent.command_line LIKE "*cargo run*" OR process.parent.command_line LIKE "*cargo fetch*")true
elsefalse

Stage 3: where

| WHERE process.Ext.ancestry IS NOT NULL AND (data_stream.dataset == "endpoint.alerts" OR is_pkg_install)

Stage 4: eval

| EVAL all_entity_id = CASE(is_pkg_install, process.parent.entity_id, "null")
all_entity_id =
ifis_pkg_installprocess.parent.entity_id
else"null"

Stage 5: inline_stats

| INLINE STATS all_pkg_entity_ids = VALUES(all_entity_id) WHERE all_entity_id != "null"

Stage 6: eval

| EVAL Esql.pkg_ancestor_ids = MV_INTERSECTION(all_pkg_entity_ids, process.Ext.ancestry)

Stage 7: where

| WHERE Esql.pkg_ancestor_ids IS NOT NULL AND data_stream.dataset == "endpoint.alerts"

Stage 8: keep

| KEEP *

Indicators

These rows show field, operator, and value matches.

Output Fields

The rule emits every field available at its final step.

Entra ID OAuth Application Redirect URI Modified

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

Identifies modifications to OAuth application redirect URIs (ReplyUrls) in Entra ID. Adding an attacker-controlled redirect URI to an existing trusted application allows interception of OAuth authorization codes when users authenticate through that application's normal login flow, enabling token theft without requiring a new application registration or consent event.

Known False Positives

  • Developers adding localhost redirect URIs for local development environments. CI/CD pipelines updating production redirect URIs during deployment. Application owners adding redirect URIs for new platform support.

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 = "2026/05/20"
integration = ["azure"]
maturity = "production"
updated_date = "2026/07/08"

[rule]
author = ["Elastic", "descambiado"]
description = """
Identifies modifications to OAuth application redirect URIs (ReplyUrls) in Entra ID. Adding an
attacker-controlled redirect URI to an existing trusted application allows interception of OAuth
authorization codes when users authenticate through that application's normal login flow, enabling
token theft without requiring a new application registration or consent event.
"""
false_positives = [
    """
    Developers adding localhost redirect URIs for local development environments.
    CI/CD pipelines updating production redirect URIs during deployment.
    Application owners adding redirect URIs for new platform support.
    """,
]
from = "now-9m"
index = ["logs-azure.auditlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID OAuth Application Redirect URI Modified"
note = """## Triage and analysis

### Investigating Entra ID OAuth Application Redirect URI Modified

A redirect URI addition to an existing trusted application does not generate a consent event and does
not require registering a new application -- both of which are commonly monitored. The modified
application retains all existing user consents.

#### Possible investigation steps

- Identify the actor who modified the application (`azure.auditlogs.properties.initiated_by`) and
  verify whether the change was authorized by the application owner or a change management ticket.
- Review the specific URIs added by comparing `modifiedProperties.oldValue` and `newValue` for the
  `ReplyUrls` field in the audit event's `target_resources`.
- Geolocate and WHOIS the domain of any newly added URI -- hosting providers, recently registered
  domains, or URL shorteners are strong indicators of compromise.
- Check whether the actor recently became an owner of this application: look for
  "Add owner to application" events in AuditLogs for the same application object ID.
- Review the application's Graph API permissions -- applications with Mail, Files, or directory
  scopes are the highest-value targets for redirect URI hijacking.

### False positive analysis

- Localhost and loopback URIs (`http://localhost:*`, `http://127.0.0.1:*`) added by developers are
  expected in non-production applications. Verify the application's sensitivity before closing.
- CI/CD-driven URI updates typically originate from service principal actors, not human users.

### Response and remediation

- Remove the unauthorized redirect URI via Entra ID > App registrations > Authentication.
- Revoke all tokens issued to the application since the modification timestamp.
- Review sign-in logs for the application for any sign-ins from unexpected sources after the change.
- If the URI was externally controlled, treat as a full OAuth token compromise for all users of
  the application and initiate token revocation and user notification.
"""
references = [
    "https://learn.microsoft.com/en-us/entra/identity-platform/reply-url",
    "https://www.microsoft.com/en-us/security/blog/2026/03/02/oauth-redirection-abuse-enables-phishing-malware-delivery/",
]
risk_score = 73
rule_id = "8efcd3da-103b-4a65-8ab2-6a3a9df7ba8b"
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: Credential Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: "azure.auditlogs" and
azure.auditlogs.operation_name: "Update application" and
event.outcome: ("Success" or "success") and
azure.auditlogs.properties.target_resources.*.modified_properties.*.display_name: "AppAddress"
'''

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

[[rule.threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"

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

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

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

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

Stages and Predicates

Stage 1: query

data_stream.dataset: "azure.auditlogs" and
azure.auditlogs.operation_name: "Update application" and
event.outcome: ("Success" or "success") and
azure.auditlogs.properties.target_resources.*.modified_properties.*.display_name: "AppAddress"

Indicators

These rows show field, operator, and value matches.

External User Added to Google Workspace Group

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

Detects an external Google Workspace user account being added to an existing group. Adversaries may add external user accounts as a means to intercept shared files or emails with that specific group.

Known False Positives

  • Administrators may add external users to groups to share files and communication with them via the intended recipient be the group they are added to. It is unlikely an external user account would be added to an organization's group where administrators should create a new user account.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2023/02/16"
integration = ["google_workspace"]
maturity = "production"
updated_date = "2026/05/22"

[rule]
author = ["Elastic"]
description = """
Detects an external Google Workspace user account being added to an existing group. Adversaries may add external user
accounts as a means to intercept shared files or emails with that specific group.
"""
false_positives = [
    """
    Administrators may add external users to groups to share files and communication with them via the intended
    recipient be the group they are added to. It is unlikely an external user account would be added to an
    organization's group where administrators should create a new user account.
    """,
]
from = "now-130m"
index = ["filebeat-*", "logs-google_workspace.admin-*"]
interval = "10m"
language = "eql"
license = "Elastic License v2"
name = "External User Added to Google Workspace Group"
note = """## Triage and analysis

### Investigating External User Added to Google Workspace Group

Google Workspace groups allow organizations to assign specific users to a group that can share resources. Application specific roles can be manually set for each group, but if not inherit permissions from the top-level organizational unit.

Threat actors may use phishing techniques and container-bound scripts to add external Google accounts to an organization's groups with editorial privileges. As a result, the user account is unable to manually access the organization's resources, settings and files, but will receive anything shared to the group. As a result, confidential information could be leaked or perhaps documents shared with editorial privileges be weaponized for further intrusion.

This rule identifies when an external user account is added to an organization's groups where the domain name of the target does not match the Google Workspace domain.

### Possible investigation steps
- Identify user account(s) associated by reviewing `user.name` or `user.email` in the alert
  - The `user.target.email` field contains the user added to the groups
  - The `group.name` field contains the group the target user was added to
- Identify specific application settings given to the group which may indicate motive for the external user joining a particular group
- With the user identified, verify administrative privileges are scoped properly to add external users to the group
  - Unauthorized actions may indicate the `user.email` account has been compromised or leveraged to add an external user
- To identify other users in this group, search for `event.action: "ADD_GROUP_MEMBER"`
  - It is important to understand if external users with `@gmail.com` are expected to be added to this group based on historical references
- Review Gmail logs where emails were sent to and from the `group.name` value
  - This may indicate potential internal spearphishing

### False positive analysis
- With the user account whom added the new user, verify this action was intentional
- Verify that the target whom was added to the group is expected to have access to the organization's resources and data
- If other members have been added to groups that are external, this may indicate historically that this action is expected

### 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.
- Reactivate multi-factor authentication for the user.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security defaults [provided by Google](https://cloud.google.com/security-command-center/docs/how-to-investigate-threats).
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

## Setup

The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.

### Important Information Regarding Google Workspace Event Lag Times
- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
- By default, `var.interval` is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m).
- See the following references for further information:
  - https://support.google.com/a/answer/7061566
  - https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-google_workspace.html"""
references = [
    "https://support.google.com/a/answer/33329",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two",
]
risk_score = 47
rule_id = "38f384e0-aef8-11ed-9a38-f661ea17fbcc"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: Google Workspace",
    "Use Case: Identity and Access Audit",
    "Tactic: Initial Access",
    "Tactic: Persistence",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
iam where data_stream.dataset == "google_workspace.admin" and event.action == "ADD_GROUP_MEMBER" and
  not endsWith(user.target.domain, user.target.group.domain)
'''


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


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

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user.email",
    "source.ip",
    "google_workspace.actor.type",
    "user.target.email",
    "google_workspace.admin.group.email",
    "event.action",
    "cloud.account.id",
]

Stages and Predicates

Stage 1: iam

iam where data_stream.dataset == "google_workspace.admin" and event.action == "ADD_GROUP_MEMBER" and
  not endsWith(user.target.domain, user.target.group.domain)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
user.target.domainends_withuser.target.group.domainexcludes:user.target.domain field:"user.target.domain" value:"user.target.group.domain"

GKE API Request Failure Burst by User

#
Status
production
Severity
medium
Time window
11m
Group by
Esql.time_interval, data_stream.namespace, source.ip, user.email, user_agent.original
Author
Elastic
Source
github.com/elastic/detection-rules

Detects bursts of failed GKE API requests from a single user identity within a five-minute window. Repeated authorization failures across multiple actions can indicate credential stuffing, RBAC probing, or reconnaissance with stolen tokens.

MITRE ATT&CK Coverage

Rule Body

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

[rule]
author = ["Elastic"]
description = """
Detects bursts of failed GKE API requests from a single user identity within a five-minute window. Repeated authorization
failures across multiple actions can indicate credential stuffing, RBAC probing, or reconnaissance with stolen tokens.
"""
from = "now-11m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "GKE API Request Failure Burst by User"
note = """## Triage and analysis

### Investigating GKE API Request Failure Burst by User

The rule aggregates failed Kubernetes API calls per `user.email`, source IP, and user agent in five-minute buckets and
alerts when failures reach ten or more.

### Investigation steps

- Review `Esql.actions` and `Esql.resources` for targeted API operations.
- Validate whether the identity should exist and whether the source IP is expected.
- Hunt for later successful calls indicating privilege escalation.

### False positives

- Misconfigured automation or CI jobs with stale credentials may generate bursts; exclude known service accounts.

## Setup

The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."""
references = [
    "https://cloud.google.com/kubernetes-engine/docs/how-to/audit-logging",
    "https://attack.mitre.org/techniques/T1613/",
]
risk_score = 47
rule_id = "94556bc7-e057-4759-9e49-fa79ee366101"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Kubernetes",
    "Data Source: GCP",
    "Data Source: Google Cloud Platform",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-gcp.audit-* metadata _id, _index, _version
| eval Esql.time_interval = date_trunc(5 minutes, @timestamp)
| where data_stream.dataset == "gcp.audit"
    and service.name == "k8s.io"
    and event.outcome == "failure"
    and event.type != "allowed"
    and user.email is not null
    and not to_string(user.email) rlike "(system:serviceaccount:|system:gke-spiffe-controller|system:kube-scheduler|system:node:).*"
| stats
    Esql.unique_actions = count_distinct(event.action),
    Esql.failures_count = count(*),
    Esql.actions = values(event.action),
    Esql.resources = values(orchestrator.resource.name)
  by user.email, source.ip, user_agent.original, data_stream.namespace, Esql.time_interval
| where Esql.failures_count >= 10
| keep Esql.*, user.email, source.ip, user_agent.original, data_stream.namespace
'''

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

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

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

Stages and Predicates

Stage 1: from

from logs-gcp.audit-* metadata _id, _index, _version

Stage 2: eval

| eval Esql.time_interval = date_trunc(5 minutes, @timestamp)

Stage 3: where

| where data_stream.dataset == "gcp.audit"
    and service.name == "k8s.io"
    and event.outcome == "failure"
    and event.type != "allowed"
    and user.email is not null
    and not to_string(user.email) rlike "(system:serviceaccount:|system:gke-spiffe-controller|system:kube-scheduler|system:node:).*"

Stage 4: stats

| stats
    Esql.unique_actions = count_distinct(event.action),
    Esql.failures_count = count(*),
    Esql.actions = values(event.action),
    Esql.resources = values(orchestrator.resource.name)
  by user.email, source.ip, user_agent.original, data_stream.namespace, Esql.time_interval

Stage 5: where

| where Esql.failures_count >= 10

Stage 6: keep

| keep Esql.*, user.email, source.ip, user_agent.original, data_stream.namespace

Indicators

These rows show field, operator, and value matches.

Output Fields

These fields are emitted when the rule matches.

FieldSource
Esql.*KEEP Esql.*
user.emailKEEP user.email
source.ipKEEP source.ip
user_agent.originalKEEP user_agent.original
data_stream.namespaceKEEP data_stream.namespace

Initial Access via Audio Unit Plug-in

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

Detects when an audio plug-in is manually loaded by the auval or auvaltool process followed by an immediate outbound network connection. Applications such as GarageBand 10, Logic Pro X, Audacity, etc., use audio unit plug-ins to create sound effects and virtual instruments. Software developers and sound engineers can create either audio components or virtual studio technology (VST) plug-ins. Threat actors can also create audio components or plug-ins and load them to execute unsigned code via the native auval or auvaltool binaries.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects when an audio plug-in is manually loaded by the auval or auvaltool process followed by an immediate outbound
network connection. Applications such as GarageBand 10, Logic Pro X, Audacity, etc., use audio unit plug-ins to create
sound effects and virtual instruments. Software developers and sound engineers can create either audio components or
virtual studio technology (VST) plug-ins. Threat actors can also create audio components or plug-ins and load them to
execute unsigned code via the native auval or auvaltool binaries.
"""
id = "5faec4a7-c62b-492e-83db-dc7b8eec0878"
license = "Elastic License v2"
name = "Initial Access via Audio Unit Plug-in"
os_list = ["macos"]
reference = ["https://posts.specterops.io/audio-unit-plug-ins-896d3434a882"]
version = "1.0.10"

query = '''
sequence by process.entity_id with maxspan=1m
[process where event.type == "start" and event.action == "exec" and 
  process.name in ("auvaltool", "auval") and
  process.args in ("-a", "-v") and 
  not process.parent.executable in ("/Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X",
                                    "/Applications/Logic Pro.app/Contents/MacOS/Logic Pro", 
                                    "/sbin/launchd")]
[network where event.type == "start" and event.action == "connection_attempted" and
   not cidrmatch(destination.ip, 
       "240.0.0.0/4", "233.252.0.0/24", "224.0.0.0/4", "198.19.0.0/16", "192.18.0.0/15", 
       "192.0.0.0/24", "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", 
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", 
       "100.64.0.0/10", "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24",
       "::1", "FE80::/10", "FF00::/8")]
'''

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

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

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



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

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

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

Stage 1: process

[process where event.type == "start" and event.action == "exec" and 
  process.name in ("auvaltool", "auval") and
  process.args in ("-a", "-v") and 
  not process.parent.executable in ("/Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X",
                                    "/Applications/Logic Pro.app/Contents/MacOS/Logic Pro", 
                                    "/sbin/launchd")]

Stage 2: network

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

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • connection_attempted corpus 72 (elastic 72)
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argsin
  • -a corpus 13 (elastic 13)
  • -v
field:"process.args" kind:in
process.namein
  • auval
  • auvaltool
field:"process_basename" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.executablein/Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X, /Applications/Logic Pro.app/Contents/MacOS/Logic Pro, /sbin/launchdexcludes:process.parent.executable field:"process.parent.executable" value:"/Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X" field:"process.parent.executable" value:"/Applications/Logic Pro.app/Contents/MacOS/Logic Pro" field:"process.parent.executable" value:"/sbin/launchd"
destination.ipcidr_match240.0.0.0/4, 233.252.0.0/24, 224.0.0.0/4, 198.19.0.0/16, 192.18.0.0/15, 192.0.0.0/24, 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, ::1, FE80::/10, FF00::/8excludes:destination.ip

Loadable Kernel Module Loaded via Loader

#
Source
github.com/elastic/protections-artifacts

This rule monitors for the loading of kernel modules via an unusual process, indicating the use of a loader. Loadable kernel modules (LKMs) are pieces of code that can be loaded into the kernel at runtime to extend its functionality. These are commonly abused by rootkits or other malicious software to hide their presence or to gain elevated privileges. These LKMs are normally loaded via a pre-installed utility such as insmod, kmod, or modprobe.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule monitors for the loading of kernel modules via an unusual process, indicating the use of a loader. Loadable
kernel modules (LKMs) are pieces of code that can be loaded into the kernel at runtime to extend its functionality.
These are commonly abused by rootkits or other malicious software to hide their presence or to gain elevated privileges.
These LKMs are normally loaded via a pre-installed utility such as insmod, kmod, or modprobe.
"""
id = "ce304037-0b55-47bd-aa14-140c658ee48a"
license = "Elastic License v2"
name = "Loadable Kernel Module Loaded via Loader"
os_list = ["linux"]
reference = ["https://www.elastic.co/security-labs/continuation-on-persistence-mechanisms"]
version = "1.0.4"

query = '''
process where event.type == "start" and event.action == "load_module" and (
  process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox", "node", "deno", "nodejs", "java") or
  process.name like ("memfd:*", ".*", "python*", "perl*", "php*", "ruby*", "lua*") or
  process.executable like (
    "./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*", "/mnt/*",
    "/srv/*", "/etc/*"
  )
) and
not (
  process.executable like ("/tmp/newroot/*", "/run/systemd/mount-rootfs/sbin/*", "/opt/puppetlabs/puppet/bin/ruby") or
  (
    process.parent.command_line == "bash /var/lib/guardicore/bin/gc-enforcement-wrapper start-agent" and
    process.command_line == "bash /var/lib/guardicore/bin/gc-enforcement-wrapper start-agent" and
    process.working_directory == "/var/lib/guardicore"
  ) or
  (
    process.command_line == "/bin/bash /bin/mst start" and
    process.parent.command_line == "/bin/bash /bin/mst start"
  ) or
  process.command_line in ("sh -c mst start >> /dev/null", "/bin/sh /usr/local/bin/facter -p -j")
)
'''

min_endpoint_version = "9.1.4"
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 = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.006"
name = "Kernel Modules and Extensions"
reference = "https://attack.mitre.org/techniques/T1547/006/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1014"
name = "Rootkit"
reference = "https://attack.mitre.org/techniques/T1014/"


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

[internal]
min_endpoint_version = "9.1.4"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "load_module" and (
  process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox", "node", "deno", "nodejs", "java") or
  process.name like ("memfd:*", ".*", "python*", "perl*", "php*", "ruby*", "lua*") or
  process.executable like (
    "./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*", "/mnt/*",
    "/srv/*", "/etc/*"
  )
) and
not (
  process.executable like ("/tmp/newroot/*", "/run/systemd/mount-rootfs/sbin/*", "/opt/puppetlabs/puppet/bin/ruby") or
  (
    process.parent.command_line == "bash /var/lib/guardicore/bin/gc-enforcement-wrapper start-agent" and
    process.command_line == "bash /var/lib/guardicore/bin/gc-enforcement-wrapper start-agent" and
    process.working_directory == "/var/lib/guardicore"
  ) or
  (
    process.command_line == "/bin/bash /bin/mst start" and
    process.parent.command_line == "/bin/bash /bin/mst start"
  ) or
  process.command_line in ("sh -c mst start >> /dev/null", "/bin/sh /usr/local/bin/facter -p -j")
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • load_module
field:"EventType" kind:eq value:"load_module"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /etc/*
  • /home/*/*
  • /lost+found/*
  • /mnt/*
  • /proc/*
  • /root/*
  • /run/*
  • /srv/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namein
  • bash
  • busybox
  • csh
  • dash
  • deno
  • fish
  • java
  • ksh
  • mksh
  • node
  • nodejs
  • sh
  • tcsh
  • zsh
field:"process_basename" kind:in
process.namewildcard
  • .*
  • lua*
  • memfd:*
  • perl*
  • php*
  • python*
  • ruby*
field:"process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Network File Unzipped via Unsigned or Untrusted Binary

#
Source
github.com/elastic/protections-artifacts

Detects the decompression of a file into a specified folder directly from a network download using unzip via an unsigned or untrusted binary.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects the decompression of a file into a specified folder directly from a network download using unzip via an unsigned
or untrusted binary.
"""
id = "28611239-08e6-47d5-a88b-76136670788c"
license = "Elastic License v2"
name = "Network File Unzipped via Unsigned or Untrusted Binary"
os_list = ["macos"]
version = "1.0.6"

query = '''
process where event.type == "start" and event.action == "exec" and process.name == "unzip" and 
 process.args: "/*/CFNetworkDownload*" and process.args == "-d" and 
 (process.parent.code_signature.trusted == false or process.parent.code_signature.exists == false) and
 not process.parent.name == "figma_agent"
'''

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

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


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

[internal]
min_endpoint_version = "8.12.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.name == "unzip" and 
 process.args: "/*/CFNetworkDownload*" and process.args == "-d" and 
 (process.parent.code_signature.trusted == false or process.parent.code_signature.exists == false) and
 not process.parent.name == "figma_agent"

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.nameeqfigma_agentexcludes:process.parent.name field:"process.parent.name" value:"figma_agent"

Network Traffic to Rare Destination Country

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

A machine learning job detected a rare destination country name in the network logs. This can be due to initial access, persistence, command-and-control, or exfiltration activity. For example, when a user clicks on a link in a phishing email or opens a malicious document, a request may be sent to download and run a payload from a server in a country which does not normally appear in network traffic or business work-flows. Malware instances and persistence mechanisms may communicate with command-and-control (C2) infrastructure in their country of origin, which may be an unusual destination country for the source network.

Known False Positives

  • Business workflows that occur very occasionally, and involve a business relationship with an organization in a country that does not routinely appear in network events, can trigger this alert. A new business workflow with an organization in a country with which no workflows previously existed may trigger this alert - although the model will learn that the new destination country is no longer anomalous as the activity becomes ongoing. Business travelers who roam to many countries for brief periods may trigger this alert.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2021/04/05"
integration = ["endpoint", "network_traffic"]
maturity = "production"
updated_date = "2026/07/27"

[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job detected a rare destination country name in the network logs. This can be due to initial access,
persistence, command-and-control, or exfiltration activity. For example, when a user clicks on a link in a phishing
email or opens a malicious document, a request may be sent to download and run a payload from a server in a country
which does not normally appear in network traffic or business work-flows. Malware instances and persistence mechanisms
may communicate with command-and-control (C2) infrastructure in their country of origin, which may be an unusual
destination country for the source network.
"""
false_positives = [
    """
    Business workflows that occur very occasionally, and involve a business relationship with an organization in a
    country that does not routinely appear in network events, can trigger this alert. A new business workflow with an
    organization in a country with which no workflows previously existed may trigger this alert - although the model
    will learn that the new destination country is no longer anomalous as the activity becomes ongoing. Business
    travelers who roam to many countries for brief periods may trigger this alert.
    """,
]
from = "now-30m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "rare_destination_country"
name = "Network Traffic to Rare Destination Country"
setup = """## Setup

This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
- Elastic Defend
- Network Packet Capture

### Anomaly Detection Setup

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

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

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

#### The following steps should be executed in order to add the Elastic Defend integration to your system:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).

### Network Packet Capture Integration Setup
The Network Packet Capture integration sniffs network packets on a host and dissects known protocols. Monitoring the network traffic is critical to gaining observability and securing your environment — ensuring high levels of performance and security. The Network Packet Capture integration captures the network traffic between your application servers, decodes common application layer protocols and records the interesting fields for each transaction.

#### The following steps should be executed in order to add the Elastic Agent System integration "network_traffic" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Network Packet Capture” and select the integration to see more details about it.
- Click “Add Network Packet Capture”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “network_traffic” to an existing or a new agent policy, and deploy the agent on your system from which network log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/network_traffic).
"""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "35f86980-1fb1-4dff-b311-3be941549c8d"
severity = "low"
tags = [
    "Data Source: Elastic Defend",
    "Data Source: Network Packet Capture",
    "Use Case: Threat Detection",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Resources: Investigation Guide",
]
type = "machine_learning"
note = """## Triage and analysis

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

### Investigating Network Traffic to Rare Destination Country

Machine learning models analyze network logs to identify traffic to uncommon destination countries, which may indicate malicious activities like unauthorized access or data exfiltration. Adversaries exploit this by directing traffic to servers in atypical locations, often linked to command-and-control operations. The detection rule flags such anomalies, aiding in early threat identification and response.

### Possible investigation steps

- Review the network logs to identify the specific destination country flagged as rare and assess its historical presence in the network traffic.
- Analyze the source IP addresses and user accounts associated with the flagged traffic to determine if they are legitimate or potentially compromised.
- Investigate the nature of the traffic, such as the protocols and ports used, to identify any unusual patterns or connections to known malicious infrastructure.
- Check for any recent phishing attempts or suspicious emails that may have led to the initiation of this traffic, focusing on links or attachments that could have been used to download malicious payloads.
- Correlate the flagged traffic with any other security alerts or incidents to identify potential patterns or coordinated attacks involving the rare destination country.
- Consult threat intelligence sources to determine if the destination country or specific IP addresses are associated with known threat actors or command-and-control servers.

### False positive analysis

- Legitimate business communications with partners or clients in rare destination countries may trigger alerts. Users should review and whitelist these known entities to prevent future false positives.
- Routine software updates or patches from international vendors might be flagged. Identify and exclude these update servers from the detection rule to avoid unnecessary alerts.
- Employees traveling abroad and accessing company resources can generate alerts. Implement a process to temporarily whitelist these destinations based on travel schedules.
- Cloud services with global data centers may route traffic through uncommon countries. Verify the service's IP ranges and exclude them if they are part of normal operations.
- Research or market expansion activities targeting new regions might cause alerts. Document and exclude these activities if they align with business objectives.

### Response and remediation

- Isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Conduct a thorough scan of the isolated system for malware or unauthorized software, focusing on identifying any command-and-control (C2) communication channels.
- Block network traffic to and from the identified rare destination country at the firewall or proxy level to prevent further communication with potential malicious servers.
- Review and analyze logs from the affected system and network devices to identify any additional indicators of compromise or related suspicious activities.
- If malware is detected, remove it using appropriate tools and techniques, ensuring that all persistence mechanisms are eradicated.
- Restore the affected system from a clean backup if necessary, ensuring that all security patches and updates are applied.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected."""

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

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

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

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

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

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

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

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

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

[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"

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

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

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

[[rule.threat.technique]]
id = "T1048"
name = "Exfiltration Over Alternative Protocol"
reference = "https://attack.mitre.org/techniques/T1048/"

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

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

[[rule.threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"

[[rule.threat.technique.subtechnique]]
id = "T1204.001"
name = "Malicious Link"
reference = "https://attack.mitre.org/techniques/T1204/001/"

[[rule.threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"

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

Perl Outbound Network Connection

#
Status
production
Severity
medium
Time window
30s
Sequence by
process.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

Detects when Perl makes an outbound network connection to a non-private IP address. Perl is a scripting language that comes pre-installed on macOS and offers extensive capabilities for adversaries. Its use for network connections on macOS systems is uncommon and potentially suspicious.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/01/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Detects when Perl makes an outbound network connection to a non-private IP address. Perl is a scripting 
language that comes pre-installed on macOS and offers extensive capabilities for adversaries. Its use for 
network connections on macOS systems is uncommon and potentially suspicious.
"""
from = "now-9m"
index = ["logs-endpoint.events.network-*", "logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Perl Outbound Network 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 Perl Outbound Network Connection

This rule detects Perl starting on macOS and then initiating an outbound connection to a public (non-private) IP, a pattern that stands out because Perl rarely performs direct network reach-outs in normal macOS workflows. Attackers often abuse Perl as a built-in “living off the land” runtime to beacon to external command-and-control over HTTP/S or to fetch and execute a second-stage payload from an internet host.

### Possible investigation steps

- Review the full command line, parent/child process tree, execution context (user, TTY, working directory), and referenced script/module paths to determine whether the run was expected or suspicious.  
- Pivot on the external destination (IP, port, and any resolved domain from DNS telemetry) to assess reputation, hosting characteristics, and whether other endpoints have recently contacted the same infrastructure.  
- Examine connection characteristics (protocol, TLS SNI/certificate, HTTP headers/user-agent, data volume, and timing) to identify staged downloads or beacon-like periodicity.  
- Correlate nearby file activity for newly created or modified scripts, temp artifacts, or downloaded payloads, and validate them via hashes, signatures, and known-good baselines.  
- Check for follow-on behavior consistent with persistence or lateral movement, such as new launchd/cron items, suspicious login items, or additional interpreters and shells spawned from the same lineage.

### False positive analysis

- A legitimate Perl script run by an administrator or scheduled maintenance task (e.g., log rotation, health checks, or API polling) may connect to a public service endpoint over HTTP/S, matching the Perl exec followed by a non-private destination IP pattern.  
- A developer workflow that uses Perl one-liners or project scripts to fetch dependencies, query internet-hosted resources, or validate external URLs can generate outbound connections to public IPs that appear unusual on endpoints without an established baseline for Perl network use.

### Response and remediation

- Isolate the affected macOS host from the network (or block the specific destination IP/port at the egress firewall) and terminate the suspicious `perl` process to stop any active command-and-control or payload download.  
- Collect and preserve the Perl command line, referenced script paths, current working directory, any newly written files (especially in `/tmp`, `/var/tmp`, and the user’s `~/Library`), and the full process tree for forensic review before cleanup.  
- Remove or quarantine the identified Perl script and any downloaded payloads, then eradicate persistence by deleting malicious `launchd` agents/daemons, cron entries, and suspicious Login Items created around the time of the outbound connection.  
- Reimage or restore the endpoint from a known-good source if integrity cannot be confidently validated, rotate credentials used on the device, and invalidate active sessions/tokens that may have been exposed to the Perl process.  
- Escalate to IR/forensics immediately if the destination infrastructure is contacted by multiple hosts, the Perl process runs under a privileged context, or you observe repeated beacon-like connections or evidence of persistence beyond a single script execution.  
- Harden by restricting interpreter execution (Perl, Python, Ruby) via endpoint controls, enforcing outbound allowlisting/proxying for user endpoints, and adding detections for Perl launching network tools or writing executable content into user-writable directories.
"""
risk_score = 47
rule_id = "aba3bc11-e02f-4a03-8889-d86ea1a44f76"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Command and Control",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by process.entity_id with maxspan=30s
  [process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and
    process.name == "perl" and not process.args like "/usr/bin/xpath"]
  [network where host.os.type == "macos" and event.type == "start" and process.name == "perl" and
    not cidrmatch(destination.ip, 
        "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", 
        "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "192.88.99.0/24",
        "224.0.0.0/4", "240.0.0.0/4", "::1", "FE80::/10", "FF00::/8")]
'''

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

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

Stages and Predicates

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

Stage 1: process

[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and
    process.name == "perl" and not process.args like "/usr/bin/xpath"]

Stage 2: network

[network where host.os.type == "macos" and event.type == "start" and process.name == "perl" and
    not cidrmatch(destination.ip, 
        "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", 
        "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "192.88.99.0/24",
        "224.0.0.0/4", "240.0.0.0/4", "::1", "FE80::/10", "FF00::/8")]

Indicators

These rows show field, operator, and value matches.

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

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq/usr/bin/xpathexcludes:process.args field:"process.args" value:"/usr/bin/xpath"
destination.ipcidr_match10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 240.0.0.0/4, ::1, FE80::/10, FF00::/8excludes:destination.ip

Potential Credential Validation via Sudo from Unusual Parent

#
Source
github.com/elastic/protections-artifacts

Identifies use of sudo with -k (invalidate cached credentials) and -S (read password from stdin) to run a lightweight command such as pwd, whoami, or true. Malware and social-engineering chains often use this pattern to verify a password collected from a fake authentication dialog before proceeding with privileged actions. Parent processes such as osascript, node, or bun, or unsigned binaries from user-writable paths, are uncommon legitimate sources for this behavior.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Telemetry Coverage

Rule Body

[rule]
description = """
Identifies use of sudo with -k (invalidate cached credentials) and -S (read password from stdin) to run a lightweight
command such as pwd, whoami, or true. Malware and social-engineering chains often use this pattern to verify a password
collected from a fake authentication dialog before proceeding with privileged actions. Parent processes such as
osascript, node, or bun, or unsigned binaries from user-writable paths, are uncommon legitimate sources for this
behavior.
"""
id = "3a58bc7d-bc64-4ae1-8b09-16e48e35d968"
license = "Elastic License v2"
name = "Potential Credential Validation via Sudo from Unusual Parent"
os_list = ["linux", "macos"]
reference = ["https://www.wiz.io/blog/threat-actors-target-crypto-orgs"]
version = "1.0.1"

query = '''
process where event.type == "start" and event.action == "exec" and process.args_count <= 8 and
  (
    (process.name == "sudo" and process.args == "-k" and process.args == "-S") or 
    (process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.command_line like "*sudo -k -S *")
   ) and
  (
    (process.parent.name in ("osascript", "node", "bun") or process.parent.name like "python*") or
    
    process.parent.executable like (
      "/Users/*", "/private/tmp/*", "/tmp/*", "/var/tmp/*", "/home/*/*", "/run/user/*",
      "/var/run/user/*", "/dev/shm/*"
    )
   )
'''

min_endpoint_version = "8.10.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 = "T1056"
name = "Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/"
[[threat.technique.subtechnique]]
id = "T1056.002"
name = "GUI Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/002/"



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

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.args_count <= 8 and
  (
    (process.name == "sudo" and process.args == "-k" and process.args == "-S") or 
    (process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.command_line like "*sudo -k -S *")
   ) and
  (
    (process.parent.name in ("osascript", "node", "bun") or process.parent.name like "python*") or
    
    process.parent.executable like (
      "/Users/*", "/private/tmp/*", "/tmp/*", "/var/tmp/*", "/home/*/*", "/run/user/*",
      "/var/run/user/*", "/dev/shm/*"
    )
   )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argseq
  • -S corpus 3 (elastic 3)
  • -k
field:"process.args" kind:eq
process.args_countle
  • 8 transforms: number
field:"process.args_count" kind:le value:"8"
process.command_linewildcard
  • *sudo -k -S *
field:"CommandLine" kind:wildcard value:"*sudo -k -S *"
process.nameeq
  • sudo corpus 14 (elastic 14)
field:"process_basename" kind:eq value:"sudo"
process.namein
  • bash corpus 181 (elastic 181)
  • csh corpus 148 (elastic 148)
  • dash corpus 150 (elastic 150)
  • fish corpus 151 (elastic 151)
  • ksh corpus 149 (elastic 149)
  • sh corpus 180 (elastic 180)
  • tcsh corpus 145 (elastic 145)
  • zsh corpus 180 (elastic 180)
field:"process_basename" kind:in
process.parent.executablewildcard
  • /Users/*
  • /dev/shm/* corpus 12 (elastic 12)
  • /home/*/* corpus 13 (elastic 13)
  • /private/tmp/* corpus 2 (elastic 2)
  • /run/user/* corpus 11 (elastic 11)
  • /tmp/* corpus 13 (elastic 13)
  • /var/run/user/* corpus 11 (elastic 11)
  • /var/tmp/* corpus 13 (elastic 13)
field:"ParentImage" kind:wildcard
process.parent.namein
  • bun corpus 7 (elastic 7)
  • node corpus 14 (elastic 14)
  • osascript corpus 9 (elastic 9)
field:"parent_process_basename" kind:in
process.parent.namewildcard
  • python* corpus 7 (elastic 7)
field:"parent_process_basename" kind:wildcard value:"python*"

Potential Defense Evasion via Doas

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

This rule detects the creation or rename of the Doas configuration file on a Linux system. Adversaries may create or modify the Doas configuration file to elevate privileges and execute commands as other users while attempting to evade detection.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/08/28"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects the creation or rename of the Doas configuration file on a Linux system. Adversaries may create or
modify the Doas configuration file to elevate privileges and execute commands as other users while attempting to evade
detection.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*", "endgame-*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Defense Evasion via Doas"
note = """## Triage and analysis

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

### Investigating Potential Defense Evasion via Doas

Doas is a command-line utility on Linux systems that allows users to execute commands as another user, typically with elevated privileges. Adversaries may exploit this by altering the Doas configuration file to gain unauthorized access or escalate privileges, bypassing security measures. The detection rule identifies suspicious activities by monitoring changes to the Doas configuration file, signaling potential misuse aimed at evading defenses.

### Possible investigation steps

- Review the alert details to confirm the file path involved is "/etc/doas.conf" and the event type is not "deletion", as specified in the query.
- Check the timestamp of the alert to determine when the configuration file was created or modified, and correlate this with any known scheduled changes or maintenance activities.
- Investigate the user account associated with the event to determine if they have legitimate reasons to modify the Doas configuration file, and verify their access permissions.
- Examine system logs and command history around the time of the alert to identify any suspicious activities or commands executed by the user.
- Assess the current Doas configuration file for unauthorized changes or entries that could indicate privilege escalation attempts.
- Cross-reference the alert with other security events or alerts from the same host to identify potential patterns or related activities that could suggest a broader attack.

### False positive analysis

- Routine administrative updates to the Doas configuration file can trigger alerts. To manage this, create exceptions for known maintenance windows or specific user accounts responsible for legitimate updates.
- Automated configuration management tools may modify the Doas configuration file as part of their normal operation. Identify these tools and exclude their activities from triggering alerts by specifying their process names or user accounts.
- System backups or restoration processes might involve creating or renaming the Doas configuration file. Exclude these processes by identifying the backup software and adding it to the exception list.
- Development or testing environments where frequent changes to the Doas configuration file are expected can generate false positives. Consider excluding these environments from monitoring or adjusting the rule to account for their unique activity patterns.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement by the adversary.
- Review and revert any unauthorized changes to the Doas configuration file located at /etc/doas.conf to its last known good state.
- Conduct a thorough audit of user accounts and permissions on the affected system to identify and remove any unauthorized accounts or privilege escalations.
- Implement additional monitoring on the affected system to detect any further attempts to modify the Doas configuration file or other critical system files.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if the threat has spread to other systems.
- Apply patches and updates to the affected system to address any vulnerabilities that may have been exploited by the adversary.
- Review and enhance access controls and authentication mechanisms to prevent unauthorized privilege escalation attempts in the future."""
references = ["https://wiki.archlinux.org/title/Doas"]
risk_score = 47
rule_id = "26a726d7-126e-4267-b43d-e9a70bfdee1e"
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: Defense Evasion",
    "Data Source: Elastic Defend",
    "Data Source: Elastic Endgame",
    "Data Source: SentinelOne",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.type != "deletion" and file.path == "/etc/doas.conf"
'''

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

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

[[rule.threat.technique.subtechnique]]
id = "T1548.003"
name = "Sudo and Sudo Caching"
reference = "https://attack.mitre.org/techniques/T1548/003/"

[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 = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"

[[rule.threat.technique.subtechnique]]
id = "T1548.003"
name = "Sudo and Sudo Caching"
reference = "https://attack.mitre.org/techniques/T1548/003/"

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

Stages and Predicates

Stage 1: file

file where host.os.type == "linux" and event.type != "deletion" and file.path == "/etc/doas.conf"

Indicators

These rows show field, operator, and value matches.

Potential Lateral Tool Transfer via SMB Share

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

Identifies the creation or change of a Windows executable file over network shares. Adversaries may transfer tools or other files between systems in a compromised environment.

MITRE ATT&CK Coverage

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 3: Network connection

Rule Body

[metadata]
creation_date = "2020/11/10"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/08/03"

[rule]
author = ["Elastic"]
description = """
Identifies the creation or change of a Windows executable file over network shares. Adversaries may transfer tools or
other files between systems in a compromised environment.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*", "logs-endpoint.events.network-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Lateral Tool Transfer via SMB Share"
note = """## Triage and analysis

### Investigating Potential Lateral Tool Transfer via SMB Share

Adversaries can use network shares to host tooling to support the compromise of other hosts in the environment. These tools can include discovery utilities, credential dumpers, malware, etc. Attackers can also leverage file shares that employees frequently access to host malicious files to gain a foothold in other machines.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Retrieve the created file and determine if it is malicious:
  - Use a private sandboxed malware analysis system to perform analysis.
    - Observe and collect information about the following activities:
      - Attempts to contact external domains and addresses.
      - File and registry access, modification, and creation activities.
      - Service creation and launch activities.
      - Scheduled task creation.
  - Use the PowerShell `Get-FileHash` cmdlet to get the files' SHA-256 hash values.
    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.

### False positive analysis

- This activity can happen legitimately. Consider adding exceptions if it is expected and noisy in your environment.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
  - Implement temporary network rules, procedures, and segmentation to contain the malware.
  - Stop suspicious processes.
  - Immediately block the identified indicators of compromise (IoCs).
  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Review the privileges needed to write to the network share and restrict write access as needed.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

setup = """## Setup

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

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

references = [
    "https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
    "https://www.elastic.co/security-labs/hunting-for-lateral-movement-using-event-query-language",
]
risk_score = 47
rule_id = "58bc134c-e8d2-4291-a552-b4b3e537c60b"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Lateral Movement",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
]
type = "eql"

query = '''
sequence by host.id with maxspan=30s
  [network where host.os.type == "windows" and event.type == "start" and process.pid == 4 and destination.port == 445 and
   network.direction : ("incoming", "ingress") and
   network.transport == "tcp" and source.ip != "127.0.0.1" and source.ip != "::1"
  ] by process.entity_id
  /* add more executable / script extensions here if they are not noisy in your environment */
  [file where host.os.type == "windows" and event.type in ("creation", "change") and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and 
   (file.Ext.header_bytes : "4d5a*" or file.extension : ("exe", "scr", "pif", "com", "dll", "bat", "cmd", "ps1", "vbs", "vbe", "js", "jse", "wsh", "wsf", "sct", "hta", "cpl")) and
   not file.path : (
     "?:\\Windows\\VeeamVssSupport\\*",
     "?:\\Windows\\VeeamLogShipper\\*"
   )] by process.entity_id
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[rule.threat.technique.subtechnique]]
id = "T1021.002"
name = "SMB/Windows Admin Shares"
reference = "https://attack.mitre.org/techniques/T1021/002/"


[[rule.threat.technique]]
id = "T1570"
name = "Lateral Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1570/"


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

Stages and Predicates

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

Stage 1: network

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

Stage 2: file

[file where host.os.type == "windows" and event.type in ("creation", "change") and process.pid == 4 and user.id like ("S-1-5-21*", "S-1-12-*") and 
   (file.Ext.header_bytes : "4d5a*" or file.extension : ("exe", "scr", "pif", "com", "dll", "bat", "cmd", "ps1", "vbs", "vbe", "js", "jse", "wsh", "wsf", "sct", "hta", "cpl")) and
   not file.path : (
     "?:\\Windows\\VeeamVssSupport\\*",
     "?:\\Windows\\VeeamLogShipper\\*"
   )] by process.entity_id

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.porteq
  • 445 transforms: number corpus 7 (elastic 7)
field:"DestinationPort" kind:eq value:"445"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
event.typein
  • change corpus 18 (elastic 18)
  • creation corpus 17 (elastic 17)
field:"event.type" kind:in
file.Ext.header_byteswildcard
  • 4d5a* corpus 45 (elastic 45)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.extensionwildcard
  • bat corpus 13 (elastic 13)
  • cmd corpus 15 (elastic 15)
  • com corpus 16 (elastic 16)
  • cpl corpus 19 (elastic 19)
  • dll corpus 32 (elastic 32)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • js corpus 22 (elastic 22)
  • jse corpus 18 (elastic 18)
  • pif corpus 18 (elastic 18)
  • ps1 corpus 9 (elastic 9)
  • scr corpus 17 (elastic 17)
  • sct corpus 7 (elastic 7)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • wsf corpus 10 (elastic 10)
  • wsh corpus 16 (elastic 16)
field:"file.extension" kind:wildcard
network.directionwildcard
  • incoming corpus 10 (elastic 10)
  • ingress corpus 12 (elastic 12)
field:"Initiated" kind:wildcard
network.transporteq
  • tcp corpus 16 (elastic 16)
field:"Protocol" kind:eq value:"tcp"
process.pideq
  • 4 transforms: number corpus 17 (elastic 17)
field:"process_id" kind:eq value:"4"
source.ipne
  • 127.0.0.1 corpus 22 (elastic 22)
  • ::1 corpus 20 (elastic 20)
field:"src_ip" kind:ne
user.idwildcard
  • S-1-12-* corpus 25 (elastic 25)
  • S-1-5-21* corpus 26 (elastic 26)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.pathstarts_with?:\Windows\VeeamVssSupport\, ?:\Windows\VeeamLogShipper\excludes:file.path field:"file.path" value:"?:\Windows\VeeamVssSupport\" field:"file.path" value:"?:\Windows\VeeamLogShipper\"

Potential Linux Ransomware Note Creation Detected

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

This rule identifies a sequence of a mass file encryption event in conjunction with the creation of a .txt file with a file name containing ransomware keywords executed by the same process in a 1 second timespan. Ransomware is a type of malware that encrypts a victim's files or systems and demands payment (usually in cryptocurrency) in exchange for the decryption key. One important indicator of a ransomware attack is the mass encryption of the file system, after which a new file extension is added to the file.

MITRE ATT&CK Coverage

TacticTechniques
Impact

Rule Body

[metadata]
creation_date = "2023/03/20"
integration = ["endpoint"]
maturity = "production"
updated_date = "2025/12/19"

[rule]
author = ["Elastic"]
description = """
This rule identifies a sequence of a mass file encryption event in conjunction with the creation of a .txt file with a
file name containing ransomware keywords executed by the same process in a 1 second timespan. Ransomware is a type of
malware that encrypts a victim's files or systems and demands payment (usually in cryptocurrency) in exchange for the
decryption key. One important indicator of a ransomware attack is the mass encryption of the file system, after which a
new file extension is added to the file.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Linux Ransomware Note Creation Detected"
risk_score = 47
rule_id = "c8935a8b-634a-4449-98f7-bb24d3b2c0af"
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: Impact",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by process.entity_id, host.id with maxspan=1s
  [file where host.os.type == "linux" and event.type == "change" and event.action == "rename" and file.extension : "?*"
   and process.executable : ("./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/var/run/*", "/boot/*") and
   file.path : (
     "/home/*/Downloads/*", "/home/*/Documents/*", "/root/*", "/bin/*", "/usr/bin/*", "/var/log/*", "/var/lib/log/*",
     "/var/backup/*", "/var/www/*") and
   not (
     process.name : (
       "dpkg", "yum", "dnf", "rpm", "dockerd", "go", "java", "pip*", "python*", "node", "containerd", "php", "p4d",
       "conda", "chrome", "imap", "cmake", "firefox", "semanage", "semodule", "ansible-galaxy", "fc-cache", "jammy", "git",
       "systemsettings", "vmis-launcher", "bundle", "kudu-tserver", "suldownloader", "rustup-init", "bun"
     ) or
     process.executable in ("./runc", "./usr/bin/qemu-aarch64")
   )
  ] with runs=25
  [file where host.os.type == "linux" and event.action == "creation" and
   file.name : ("*restore*", "*lock*", "*recovery*", "*read*", "*instruction*", "*how_to*", "*ransom*")
  ]
'''
note = """## Triage and analysis

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

### Investigating Potential Linux Ransomware Note Creation Detected

Ransomware encrypts files, demanding payment for decryption. Adversaries exploit Linux systems by executing mass file renaming and creating ransom notes. This detection rule identifies such behavior by monitoring rapid file changes and the creation of text files with ransom-related keywords, indicating potential ransomware activity. It focuses on unusual file operations in critical directories, excluding benign processes, to flag suspicious activities.

### Possible investigation steps

- Review the process.entity_id and host.id to identify the specific process and host involved in the alert. This will help in understanding the scope and potential impact of the activity.
- Examine the process.executable path to determine if the executable is located in a suspicious directory such as /tmp, /var/tmp, or /dev/shm, which are commonly used by adversaries for malicious activities.
- Analyze the file paths involved in the rename events to assess if critical directories like /home/*/Documents, /root, or /var/www are affected, indicating a higher risk of data compromise.
- Check the process.name against the list of excluded benign processes to ensure the activity is not a false positive caused by legitimate software updates or installations.
- Investigate the content and metadata of the created .txt files with names containing keywords like *restore*, *lock*, or *ransom* to confirm if they contain ransom notes or instructions, which would indicate a ransomware attack.
- Correlate the timing of the file rename and creation events to verify if they occurred within the 1-second timespan, supporting the hypothesis of a rapid mass encryption event typical of ransomware behavior.
- Assess the risk score and severity level to prioritize the response and determine if immediate containment actions are necessary to prevent further damage.

### False positive analysis

- Frequent software updates or installations can trigger the rule due to mass file renaming in critical directories. Exclude processes like dpkg, yum, dnf, and rpm if they are part of regular system maintenance.
- Development activities involving compilers or interpreters such as go, java, python, and node may cause false positives. Consider excluding these processes if they are part of routine development work.
- Automated backup or logging processes might create files with names similar to ransom notes. Exclude directories or processes associated with legitimate backup or logging activities to reduce false alerts.
- System administration tasks using tools like ansible-galaxy or semodule can mimic ransomware behavior. Exclude these processes if they are part of scheduled or known administrative operations.
- Web server operations in directories like /var/www/* might involve file creation and renaming. Exclude specific web server processes if they are identified as non-threatening and part of regular operations.

### Response and remediation

- Isolate the affected Linux system from the network immediately to prevent further spread of the ransomware and protect other systems.
- Identify and terminate the malicious process responsible for the mass file renaming and ransom note creation using the process.entity_id and host.id from the alert.
- Backup any unencrypted files and critical data from the affected system to a secure location to prevent data loss.
- Conduct a forensic analysis of the affected system to determine the entry point and scope of the ransomware attack, focusing on the directories and processes identified in the alert.
- Restore the affected system from a known good backup prior to the ransomware attack to ensure system integrity and data recovery.
- Apply security patches and updates to the affected system and any other vulnerable systems to close any exploited vulnerabilities.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to enhance detection capabilities for similar threats in the future."""

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

[[rule.threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"

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

Stages and Predicates

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

Stage 1: file ×25

[file where host.os.type == "linux" and event.type == "change" and event.action == "rename" and file.extension : "?*"
   and process.executable : ("./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/var/run/*", "/boot/*") and
   file.path : (
     "/home/*/Downloads/*", "/home/*/Documents/*", "/root/*", "/bin/*", "/usr/bin/*", "/var/log/*", "/var/lib/log/*",
     "/var/backup/*", "/var/www/*") and
   not (
     process.name : (
       "dpkg", "yum", "dnf", "rpm", "dockerd", "go", "java", "pip*", "python*", "node", "containerd", "php", "p4d",
       "conda", "chrome", "imap", "cmake", "firefox", "semanage", "semodule", "ansible-galaxy", "fc-cache", "jammy", "git",
       "systemsettings", "vmis-launcher", "bundle", "kudu-tserver", "suldownloader", "rustup-init", "bun"
     ) or
     process.executable in ("./runc", "./usr/bin/qemu-aarch64")
   )
  ] with runs=25

Stage 2: file

[file where host.os.type == "linux" and event.action == "creation" and
   file.name : ("*restore*", "*lock*", "*recovery*", "*read*", "*instruction*", "*how_to*", "*ransom*")
  ]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • creation
  • rename
field:"EventType" kind:eq
event.typeeq
  • change
field:"event.type" kind:eq value:"change"
file.extensionwildcard
  • ?*
field:"file.extension" kind:wildcard value:"?*"
file.namewildcard
  • *how_to*
  • *instruction*
  • *lock*
  • *ransom*
  • *read*
  • *recovery*
  • *restore*
field:"file.name" kind:wildcard
file.pathwildcard
  • /bin/*
  • /home/*/Documents/*
  • /home/*/Downloads/*
  • /root/*
  • /usr/bin/*
  • /var/backup/*
  • /var/lib/log/*
  • /var/log/*
  • /var/www/*
field:"TargetFilename" kind:wildcard
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /tmp/*
  • /var/run/*
  • /var/tmp/*
field:"Image" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablein./runc, ./usr/bin/qemu-aarch64excludes:process.executable field:"process.executable" value:"./runc" field:"process.executable" value:"./usr/bin/qemu-aarch64"
process.namewildcarddpkg, yum, dnf, rpm, dockerd, go, java, pip*, python*, node, containerd, php, p4d, conda, chrome, imap, cmake, firefox, semanage, semodule, ansible-galaxy, fc-cache, jammy, git, systemsettings, vmis-launcher, bundle, kudu-tserver, suldownloader, rustup-init, bunexcludes:process.name

Potential Privilege Escalation via Busctl System Call

#
Source
github.com/elastic/protections-artifacts

Detects a potential privilege escalation via the busctl system call. This rule checks for a non-root user executing the busctl command with the --system and call arguments. This may be a sign of a potential local privilege escalation exploit.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects a potential privilege escalation via the busctl system call. This rule checks for a non-root user executing the
busctl command with the --system and call arguments. This may be a sign of a potential local privilege escalation
exploit.
"""
id = "7df49f49-ca9a-4444-8d54-fe657f013621"
license = "Elastic License v2"
name = "Potential Privilege Escalation via Busctl System Call"
os_list = ["linux"]
reference = ["https://github.com/sgkdev/ptrace_may_dream"]
version = "1.0.1"

query = '''
process where event.type == "start" and event.action == "exec" and process.name == "busctl" and
process.args == "--system" and process.args == "call" and user.id != 0 and process.parent.user.id != 0 and
not (process.parent.executable like "/usr/bin/python3.*" and process.parent.args == "/usr/sbin/netplan" and process.parent.args == "status")
'''

min_endpoint_version = "8.2.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.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"


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

[internal]
min_endpoint_version = "8.2.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.name == "busctl" and
process.args == "--system" and process.args == "call" and user.id != 0 and process.parent.user.id != 0 and
not (process.parent.executable like "/usr/bin/python3.*" and process.parent.args == "/usr/sbin/netplan" and process.parent.args == "status")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Potential Unauthorized Access via Wildcard Injection Detected

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

This rule monitors for the execution of the "chown" and "chmod" commands with command line flags that could indicate a wildcard injection attack. Linux wildcard injection is a type of security vulnerability where attackers manipulate commands or input containing wildcards (e.g., *, ?, []) to execute unintended operations or access sensitive data by tricking the system into interpreting the wildcard characters in unexpected ways.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/07/28"
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule monitors for the execution of the "chown" and "chmod" commands with command line flags that could indicate a
wildcard injection attack. Linux wildcard injection is a type of security vulnerability where attackers manipulate
commands or input containing wildcards (e.g., *, ?, []) to execute unintended operations or access sensitive data by
tricking the system into interpreting the wildcard characters in unexpected ways.
"""
from = "now-9m"
index = [
    "auditbeat-*",
    "endgame-*",
    "logs-auditd_manager.auditd-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential Unauthorized Access via Wildcard Injection Detected"
note = """## Triage and analysis

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

### Investigating Potential Unauthorized Access via Wildcard Injection Detected

In Linux environments, commands like `chown` and `chmod` are used to change file ownership and permissions. Adversaries may exploit wildcard characters in these commands to escalate privileges or access sensitive data by executing unintended operations. The detection rule identifies suspicious use of these commands with recursive flags and wildcard references, signaling potential misuse aimed at privilege escalation or unauthorized data access.

### Possible investigation steps

- Review the process execution details to confirm the presence of the "chown" or "chmod" command with the "-R" flag and wildcard usage in the arguments, as indicated by the query fields process.name, process.args, and event.action.
- Examine the user account associated with the process execution to determine if it has the necessary permissions to perform such operations and assess if the account has been compromised.
- Check the command execution history and related logs to identify any preceding or subsequent suspicious activities that might indicate a broader attack pattern or unauthorized access attempts.
- Investigate the source and destination of the command execution by analyzing network logs and connections to determine if the activity originated from a known or unknown IP address or host.
- Correlate this event with other alerts or anomalies in the system to identify potential patterns or coordinated attacks, focusing on privilege escalation or credential access attempts as suggested by the rule's tags and threat information.

### False positive analysis

- Routine administrative tasks using chown or chmod with recursive flags may trigger the rule. To manage this, identify and whitelist specific scripts or users that regularly perform these tasks without security risks.
- Automated system maintenance processes that involve changing file permissions or ownership across directories can be mistaken for malicious activity. Exclude these processes by specifying their command patterns or associated user accounts in the monitoring system.
- Backup operations that involve copying and setting permissions on large sets of files might be flagged. To prevent this, configure exceptions for known backup tools or scripts that use these commands in a controlled manner.
- Development environments where developers frequently change file permissions for testing purposes can generate false positives. Implement user-based exceptions for development teams to reduce unnecessary alerts.
- System updates or package installations that modify file permissions as part of their normal operation may be detected. Create exceptions for trusted package managers or update processes to avoid false alarms.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious processes identified as running the `chown` or `chmod` commands with wildcard injections to halt potential privilege escalation activities.
- Conduct a thorough review of system logs and command histories to identify any unauthorized changes made to file permissions or ownership and revert them to their original state.
- Reset credentials and review access permissions for users on the affected system to ensure no unauthorized access persists.
- Implement file integrity monitoring to detect unauthorized changes to critical files and directories 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 and patch the affected system to address any vulnerabilities that may have been exploited during the attack, ensuring all security updates are applied."""
references = ["https://www.exploit-db.com/papers/33930"]
risk_score = 47
rule_id = "4a99ac6f-9a54-4ba5-a64f-6eb65695841b"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

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

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

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

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

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

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

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

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

[[rule.threat.technique.subtechnique]]
id = "T1003.008"
name = "/etc/passwd and /etc/shadow"
reference = "https://attack.mitre.org/techniques/T1003/008/"

[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 = "T1222"
name = "File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/"

[[rule.threat.technique.subtechnique]]
id = "T1222.002"
name = "Linux and Mac File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/002/"

[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.type == "start" and
  event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
  process.name in ("chown", "chmod") and process.args == "-R" and process.args : "--reference=*"

Indicators

These rows show field, operator, and value matches.

Privilege Escalation via Microsoft Exchange DLL Hijacking

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to load a DLL from a hardcoded path by the Microsoft Exchange IIS worker process (w3wp). This may indicate an attempt to elevate privilege via loading a malicious DLL from a path writable by low-privileged users.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies attempts to load a DLL from a hardcoded path by the Microsoft Exchange IIS worker process (w3wp). This may
indicate an attempt to elevate privilege via loading a malicious DLL from a path writable by low-privileged users.
"""
id = "861b403e-1bbb-4e5f-a19d-f1ea2ded2296"
license = "Elastic License v2"
name = "Privilege Escalation via Microsoft Exchange DLL Hijacking"
os_list = ["windows"]
reference = [
    "https://twitter.com/buffaloverflow/status/1591241996991369217/photo/1",
    "https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
    "https://www.zerodayinitiative.com/blog/2022/11/8/the-november-2022-security-update-review",
]
version = "1.0.24"

query = '''
library where process.name : "w3wp.exe" and dll.path : "D:\\ManagedTools\\cmdlets\\*"
'''

min_endpoint_version = "7.16.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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"



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

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: library

library where process.name : "w3wp.exe" and dll.path : "D:\\ManagedTools\\cmdlets\\*"

Indicators

These rows show field, operator, and value matches.

Suspicious Interpreter Execution from Stdin

#
Source
github.com/elastic/protections-artifacts

Identifies interpreters started with - (stdin) where the command line suggests executing code from stdin. This is a common technique used by attackers to execute code without leaving a trace in the command line.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Identifies interpreters started with - (stdin) where the command line suggests executing code from stdin. This is a
common technique used by attackers to execute code without leaving a trace in the command line.
"""
id = "4aed9b17-873d-48b2-86eb-1af2f695f7fe"
license = "Elastic License v2"
name = "Suspicious Interpreter Execution from Stdin"
os_list = ["linux", "macos"]
reference = [
    "https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/",
    "https://www.virustotal.com/gui/file/71e35aef03099cd1f2d6446734273025a163597de93912df321ef118bf135238",
]
version = "1.0.3"

query = '''
process where event.type == "start" and event.action == "exec" and
process.executable like (
 "/bin/python*", "/usr/bin/python*", "/usr/local/bin/python*",
 "/bin/perl*", "/usr/bin/perl*", "/usr/local/bin/perl*",
 "/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*",
 "/bin/php*", "/usr/bin/php*", "/usr/local/bin/php*",
 "/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*"
 ) and
process.args == "-" and process.args_count <= 2 and
process.parent.executable like (
 "/bin/python*", "/usr/bin/python*", "/usr/local/bin/python*",
 "/bin/perl*", "/usr/bin/perl*", "/usr/local/bin/perl*",
 "/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*",
 "/bin/php*", "/usr/bin/php*", "/usr/local/bin/php*",
 "/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*"
) and
not process.parent.args in ("/usr/sbin/needrestart", "/sbin/needrestart")
'''

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

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

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



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"


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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and
process.executable like (
 "/bin/python*", "/usr/bin/python*", "/usr/local/bin/python*",
 "/bin/perl*", "/usr/bin/perl*", "/usr/local/bin/perl*",
 "/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*",
 "/bin/php*", "/usr/bin/php*", "/usr/local/bin/php*",
 "/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*"
 ) and
process.args == "-" and process.args_count <= 2 and
process.parent.executable like (
 "/bin/python*", "/usr/bin/python*", "/usr/local/bin/python*",
 "/bin/perl*", "/usr/bin/perl*", "/usr/local/bin/perl*",
 "/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*",
 "/bin/php*", "/usr/bin/php*", "/usr/local/bin/php*",
 "/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*"
) and
not process.parent.args in ("/usr/sbin/needrestart", "/sbin/needrestart")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argseq
  • - corpus 3 (elastic 3)
field:"process.args" kind:eq value:"-"
process.args_countle
  • 2 transforms: number corpus 17 (elastic 17)
field:"process.args_count" kind:le value:"2"
process.executablewildcard
  • /bin/lua* corpus 3 (elastic 3)
  • /bin/perl* corpus 3 (elastic 3)
  • /bin/php* corpus 5 (elastic 5)
  • /bin/python* corpus 6 (elastic 6)
  • /bin/ruby* corpus 2 (elastic 2)
  • /usr/bin/lua* corpus 3 (elastic 3)
  • /usr/bin/perl* corpus 3 (elastic 3)
  • /usr/bin/php* corpus 5 (elastic 5)
  • /usr/bin/python* corpus 6 (elastic 6)
  • /usr/bin/ruby* corpus 2 (elastic 2)
  • /usr/local/bin/lua* corpus 3 (elastic 3)
  • /usr/local/bin/perl* corpus 3 (elastic 3)
  • /usr/local/bin/php* corpus 5 (elastic 5)
  • /usr/local/bin/python* corpus 6 (elastic 6)
  • /usr/local/bin/ruby* corpus 2 (elastic 2)
field:"Image" kind:wildcard
process.parent.executablewildcard
  • /bin/lua*
  • /bin/perl*
  • /bin/php*
  • /bin/python* corpus 2 (elastic 2)
  • /bin/ruby*
  • /usr/bin/lua*
  • /usr/bin/perl*
  • /usr/bin/php*
  • /usr/bin/python* corpus 2 (elastic 2)
  • /usr/bin/ruby*
  • /usr/local/bin/lua*
  • /usr/local/bin/perl*
  • /usr/local/bin/php*
  • /usr/local/bin/python* corpus 2 (elastic 2)
  • /usr/local/bin/ruby*
field:"ParentImage" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.argsin/sbin/needrestart, /usr/sbin/needrestartexcludes:process.parent.args field:"process.parent.args" value:"/sbin/needrestart" field:"process.parent.args" value:"/usr/sbin/needrestart"

Suspicious Null Terminated Call Stack

#
Source
github.com/elastic/protections-artifacts

Detects Windows Memory API calls from a null terminated thread call stack. This could be the result of an attempt to conceal the true source of the call.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects Windows Memory API calls from a null terminated thread call stack. This could be the result of an attempt to
conceal the true source of the call.
"""
id = "a4684714-f605-4944-98de-e593246faf15"
license = "Elastic License v2"
name = "Suspicious Null Terminated Call Stack"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.12"

query = '''
api where
   process.Ext.api.name : "VirtualProtect" and process.Ext.token.integrity_level_name != "low" and
   process.thread.Ext.call_stack_summary in ("ntdll.dll|Unbacked", "ntdll.dll|kernelbase.dll|Unbacked") and
   process.thread.Ext.call_stack_final_user_module.name : "Unbacked" and
   process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
   not process.thread.Ext.call_stack_final_user_module.protection_provenance  == "clr.dll" and
   (
    process.thread.Ext.call_stack_final_user_module.protection_provenance : "Unbacked" or

    ((process.code_signature.trusted == false or process.code_signature.exists == false) and
      stringcontains~(process.thread.Ext.call_stack_final_user_module.protection_provenance, process.name)) or

    _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.subject_name in ("Microsoft Windows", "Microsoft Corporation"))
    ) and 
_arraysearch(process.thread.Ext.call_stack, $entry, 
             $entry.callsite_trailing_bytes : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") and 
_arraysearch(process.thread.Ext.call_stack, $entry, 
             $entry.callsite_leading_bytes : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") and
/* Steam and printing related user mode drivers */
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
              ("c434208894f07f604b852f29b8edc3a58c4de63de783373733e72b2b73f33be9",
               "5438c19007ad96da0a969c0c0caaf00aa06375f1a6e85073f91a1392af94d059",
               "2f3b9ba5b769c89297c10c77f50223e9e88737dd3fe56e8c00adeeaa198480f9",
               "fdf036edcd2fc6997a6eeaac4b58e4b533cd6abdf15d18a53621832bff038be0",
               "93f53280052d0f700259b42a62f8658d9b2a741b54063f277e9b83264448fb21",
               "0696e0617a028101d85db50a4f109fac15be3e1ebe122b94f805763d8008ddfc",
               "115d7fdc184219a5cfe13a82d1d193d8dca5e5ccdeaaeed41c157754593aa2c1",
               "68e6c21a97c2a0824ff75961a771605dacbd73f17e33e8e7265741535a3818c3",
               "fa58bd623614e537aeb918300f1e240c1d23eb7a3ec0d61f275568303b0d7aa7",
               "c547ad0c67524371f40db48c998db222f3b75cef21109c62aea28227df8a6f2c",
               "97e0827d64aa6dd145f68102900c47fb3f3ee5a75c346b0fc637359786ec95a7",
               "016a8cdb4c207947ce2efe00310de94d322c6928ffb664134b23037403c41c0b",
               "71fec41b60762106b2cb2bc8e387a7f0126c2f837d0221fa6a3098a79498c466",
               "a083491e4db32f515abe26e63b64f1dc55792c340f054407651377b0c79ac083",
               "fbaeabc33a97afb1ed459962d059527f3c6805afa2004e431e9e3417f1b6e8c5",
               "f1a8099493b789c07a6056a23c9f2c2d8abda3df96a8c7a037e3e80a241736bc",
               "c81ed82168d2c3e71a177b71d1061aeeb1b2629d7444109a3f9b43bf84dcc53b",
               "a4772d4a0495e85f167b2183f7dbee2822b8bf7d2696552ef5501736ae5a80ea",
               "c15ad2661a216a18b44ec356573ca1826081f9547c784ec3e95c93f8c7ff65ae",
               "bcb8f9fe660ef4c33712b873fdc24e5ecbd6a77e629d6419f803c2c09c63eaf2",
               "f35975311ef5dbb27676d53139aea614119ebfbb9aacf3ad0c1c3db2bc0bc750",
               "a468d7d26eddc66f722eded0c643860da4c290b6cd3466c477f7fd39af71d717",
               "045b159c6df007c7bfd65e74ede8a7db2019edd75d46fe87c46d1ab08b85c112",
               "db49a6f421d0df47ee562a99b88d6b57fc5ef4905bd0957122144030d2f24a7f",
               "c6ae64a5f73fdf704d7625a29c3293cd757f3dcc91c7f0a72caacce2d4e06c71",
               "67593729cc35b6cf18431e204fa19730943bac57a9a4216bc2b3a35cd8c37b79",
               "681309fb5768a7e6782dea30405ffcb722d6ce3eab77f8b342c99bf39cdc8e4d",
               "7dd6f9234290591bbeffd20e795cae70cf150e75da03b857b4e7b970dae726f7",
               "fda9250ca73685a1bb717e9a23564bc234a410301110e9d08d2a74b8d29f4eb5") and
not process.Ext.api.metadata.target_address_path in ("c:\\program files\\asus\\aura lighting effect add-on x64\\basswasapi.dll", "c:\\program files\\asus\\aura lighting effect add-on x64\\bass.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
                  $entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher", "Microsoft Windows Software Compatibility Publisher")) and
not (process.executable : "C:\\Program Files (x86)\\Steam\\steamapps\\common\\*.exe" and process.parent.executable : "C:\\Program Files (x86)\\Steam\\steam.exe") and
not process.executable : ("D:\\SteamLibrary\\steamapps\\common\\*.exe", "E:\\Steam\\steamapps\\common\\*.exe")
'''

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

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

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


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

[internal]
min_endpoint_version = "8.14.2"

Stages and Predicates

Stage 1: api

api where
   process.Ext.api.name : "VirtualProtect" and process.Ext.token.integrity_level_name != "low" and
   process.thread.Ext.call_stack_summary in ("ntdll.dll|Unbacked", "ntdll.dll|kernelbase.dll|Unbacked") and
   process.thread.Ext.call_stack_final_user_module.name : "Unbacked" and
   process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
   not process.thread.Ext.call_stack_final_user_module.protection_provenance  == "clr.dll" and
   (
    process.thread.Ext.call_stack_final_user_module.protection_provenance : "Unbacked" or
    ((process.code_signature.trusted == false or process.code_signature.exists == false) and
      stringcontains~(process.thread.Ext.call_stack_final_user_module.protection_provenance, process.name)) or
    _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.subject_name in ("Microsoft Windows", "Microsoft Corporation"))
    ) and
_arraysearch(process.thread.Ext.call_stack, $entry,
             $entry.callsite_trailing_bytes : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") and
_arraysearch(process.thread.Ext.call_stack, $entry,
             $entry.callsite_leading_bytes : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
              ("c434208894f07f604b852f29b8edc3a58c4de63de783373733e72b2b73f33be9",
               "5438c19007ad96da0a969c0c0caaf00aa06375f1a6e85073f91a1392af94d059",
               "2f3b9ba5b769c89297c10c77f50223e9e88737dd3fe56e8c00adeeaa198480f9",
               "fdf036edcd2fc6997a6eeaac4b58e4b533cd6abdf15d18a53621832bff038be0",
               "93f53280052d0f700259b42a62f8658d9b2a741b54063f277e9b83264448fb21",
               "0696e0617a028101d85db50a4f109fac15be3e1ebe122b94f805763d8008ddfc",
               "115d7fdc184219a5cfe13a82d1d193d8dca5e5ccdeaaeed41c157754593aa2c1",
               "68e6c21a97c2a0824ff75961a771605dacbd73f17e33e8e7265741535a3818c3",
               "fa58bd623614e537aeb918300f1e240c1d23eb7a3ec0d61f275568303b0d7aa7",
               "c547ad0c67524371f40db48c998db222f3b75cef21109c62aea28227df8a6f2c",
               "97e0827d64aa6dd145f68102900c47fb3f3ee5a75c346b0fc637359786ec95a7",
               "016a8cdb4c207947ce2efe00310de94d322c6928ffb664134b23037403c41c0b",
               "71fec41b60762106b2cb2bc8e387a7f0126c2f837d0221fa6a3098a79498c466",
               "a083491e4db32f515abe26e63b64f1dc55792c340f054407651377b0c79ac083",
               "fbaeabc33a97afb1ed459962d059527f3c6805afa2004e431e9e3417f1b6e8c5",
               "f1a8099493b789c07a6056a23c9f2c2d8abda3df96a8c7a037e3e80a241736bc",
               "c81ed82168d2c3e71a177b71d1061aeeb1b2629d7444109a3f9b43bf84dcc53b",
               "a4772d4a0495e85f167b2183f7dbee2822b8bf7d2696552ef5501736ae5a80ea",
               "c15ad2661a216a18b44ec356573ca1826081f9547c784ec3e95c93f8c7ff65ae",
               "bcb8f9fe660ef4c33712b873fdc24e5ecbd6a77e629d6419f803c2c09c63eaf2",
               "f35975311ef5dbb27676d53139aea614119ebfbb9aacf3ad0c1c3db2bc0bc750",
               "a468d7d26eddc66f722eded0c643860da4c290b6cd3466c477f7fd39af71d717",
               "045b159c6df007c7bfd65e74ede8a7db2019edd75d46fe87c46d1ab08b85c112",
               "db49a6f421d0df47ee562a99b88d6b57fc5ef4905bd0957122144030d2f24a7f",
               "c6ae64a5f73fdf704d7625a29c3293cd757f3dcc91c7f0a72caacce2d4e06c71",
               "67593729cc35b6cf18431e204fa19730943bac57a9a4216bc2b3a35cd8c37b79",
               "681309fb5768a7e6782dea30405ffcb722d6ce3eab77f8b342c99bf39cdc8e4d",
               "7dd6f9234290591bbeffd20e795cae70cf150e75da03b857b4e7b970dae726f7",
               "fda9250ca73685a1bb717e9a23564bc234a410301110e9d08d2a74b8d29f4eb5") and
not process.Ext.api.metadata.target_address_path in ("c:\\program files\\asus\\aura lighting effect add-on x64\\basswasapi.dll", "c:\\program files\\asus\\aura lighting effect add-on x64\\bass.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
                  $entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher", "Microsoft Windows Software Compatibility Publisher")) and
not (process.executable : "C:\\Program Files (x86)\\Steam\\steamapps\\common\\*.exe" and process.parent.executable : "C:\\Program Files (x86)\\Steam\\steam.exe") and
not process.executable : ("D:\\SteamLibrary\\steamapps\\common\\*.exe", "E:\\Steam\\steamapps\\common\\*.exe")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.namewildcard
  • VirtualProtect corpus 5 (elastic 5)
field:"process.Ext.api.name" kind:wildcard value:"VirtualProtect"
process.Ext.token.integrity_level_namene
  • low corpus 7 (elastic 7)
field:"process.Ext.token.integrity_level_name" kind:ne value:"low"
process.code_signature.existseq
  • false transforms: boolean corpus 118 (elastic 118)
field:"process.code_signature.exists" kind:eq value:"false"
process.code_signature.trustedeq
  • false transforms: boolean corpus 114 (elastic 114)
field:"process.code_signature.trusted" kind:eq value:"false"
process.thread.Ext.call_stack_final_user_module.hash.sha256is_not_null
  • (no value, null check)
field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" kind:is_not_null
process.thread.Ext.call_stack_final_user_module.namewildcard
  • Unbacked corpus 6 (elastic 6)
field:"process.thread.Ext.call_stack_final_user_module.name" kind:wildcard value:"Unbacked"
process.thread.Ext.call_stack_final_user_module.protection_provenancecontains
  • process.name (field reference)
field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" kind:contains value:"process.name"
process.thread.Ext.call_stack_final_user_module.protection_provenancewildcard
  • Unbacked
field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" kind:wildcard value:"Unbacked"
process.thread.Ext.call_stack_summaryin
  • ntdll.dll|Unbacked corpus 8 (elastic 8)
  • ntdll.dll|kernelbase.dll|Unbacked corpus 11 (elastic 11)
field:"process.thread.Ext.call_stack_summary" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stack_final_user_module.code_signaturearray_any(no value, null check)excludes:process.thread.Ext.call_stack_final_user_module.code_signature
process.executablewildcardC:\Program Files (x86)\Steam\steamapps\common\*.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\Steam\steamapps\common\*.exe"
process.parent.executableeqC:\Program Files (x86)\Steam\steam.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Steam\steam.exe"
process.Ext.api.metadata.target_address_pathinc:\program files\asus\aura lighting effect add-on x64\bass.dll, c:\program files\asus\aura lighting effect add-on x64\basswasapi.dllexcludes:process.Ext.api.metadata.target_address_path field:"process.Ext.api.metadata.target_address_path" value:"c:\program files\asus\aura lighting effect add-on x64\bass.dll" field:"process.Ext.api.metadata.target_address_path" value:"c:\program files\asus\aura lighting effect add-on x64\basswasapi.dll"
process.executablewildcardD:\SteamLibrary\steamapps\common\*.exe, E:\Steam\steamapps\common\*.exeexcludes:process.executable field:"process.executable" value:"D:\SteamLibrary\steamapps\common\*.exe" field:"process.executable" value:"E:\Steam\steamapps\common\*.exe"
process.thread.Ext.call_stack_final_user_module.hash.sha256in016a8cdb4c207947ce2efe00310de94d322c6928ffb664134b23037403c41c0b, 045b159c6df007c7bfd65e74ede8a7db2019edd75d46fe87c46d1ab08b85c112, 0696e0617a028101d85db50a4f109fac15be3e1ebe122b94f805763d8008ddfc, 115d7fdc184219a5cfe13a82d1d193d8dca5e5ccdeaaeed41c157754593aa2c1, 2f3b9ba5b769c89297c10c77f50223e9e88737dd3fe56e8c00adeeaa198480f9, 5438c19007ad96da0a969c0c0caaf00aa06375f1a6e85073f91a1392af94d059, 67593729cc35b6cf18431e204fa19730943bac57a9a4216bc2b3a35cd8c37b79, 681309fb5768a7e6782dea30405ffcb722d6ce3eab77f8b342c99bf39cdc8e4d, 68e6c21a97c2a0824ff75961a771605dacbd73f17e33e8e7265741535a3818c3, 71fec41b60762106b2cb2bc8e387a7f0126c2f837d0221fa6a3098a79498c466, 7dd6f9234290591bbeffd20e795cae70cf150e75da03b857b4e7b970dae726f7, 93f53280052d0f700259b42a62f8658d9b2a741b54063f277e9b83264448fb21, 97e0827d64aa6dd145f68102900c47fb3f3ee5a75c346b0fc637359786ec95a7, a083491e4db32f515abe26e63b64f1dc55792c340f054407651377b0c79ac083, a468d7d26eddc66f722eded0c643860da4c290b6cd3466c477f7fd39af71d717, a4772d4a0495e85f167b2183f7dbee2822b8bf7d2696552ef5501736ae5a80ea, bcb8f9fe660ef4c33712b873fdc24e5ecbd6a77e629d6419f803c2c09c63eaf2, c15ad2661a216a18b44ec356573ca1826081f9547c784ec3e95c93f8c7ff65ae, c434208894f07f604b852f29b8edc3a58c4de63de783373733e72b2b73f33be9, c547ad0c67524371f40db48c998db222f3b75cef21109c62aea28227df8a6f2c, c6ae64a5f73fdf704d7625a29c3293cd757f3dcc91c7f0a72caacce2d4e06c71, c81ed82168d2c3e71a177b71d1061aeeb1b2629d7444109a3f9b43bf84dcc53b, db49a6f421d0df47ee562a99b88d6b57fc5ef4905bd0957122144030d2f24a7f, f1a8099493b789c07a6056a23c9f2c2d8abda3df96a8c7a037e3e80a241736bc, f35975311ef5dbb27676d53139aea614119ebfbb9aacf3ad0c1c3db2bc0bc750, fa58bd623614e537aeb918300f1e240c1d23eb7a3ec0d61f275568303b0d7aa7, fbaeabc33a97afb1ed459962d059527f3c6805afa2004e431e9e3417f1b6e8c5, fda9250ca73685a1bb717e9a23564bc234a410301110e9d08d2a74b8d29f4eb5, fdf036edcd2fc6997a6eeaac4b58e4b533cd6abdf15d18a53621832bff038be0excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
process.thread.Ext.call_stack_final_user_module.protection_provenanceeqclr.dllexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"clr.dll"

Suspicious Windows Powershell Arguments

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

Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware installation leveraging PowerShell.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2024/09/06"
integration = ["endpoint", "windows", "system", "sentinel_one_cloud_funnel", "m365_defender", "crowdstrike"]
maturity = "production"
updated_date = "2026/08/03"

[rule]
author = ["Elastic"]
description = """
Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware
installation leveraging PowerShell.
"""
from = "now-9m"
index = [
    "logs-endpoint.events.process-*",
    "logs-crowdstrike.fdr*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-system.security*",
    "logs-windows.forwarded*",
    "logs-windows.sysmon_operational-*",
    "winlogbeat-*",
    "endgame-*",
]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Windows Powershell Arguments"
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 Windows Powershell Arguments

PowerShell is a powerful scripting language and command-line shell used for task automation and configuration management in Windows environments. Adversaries exploit PowerShell's capabilities to execute malicious scripts, download payloads, and obfuscate commands. The detection rule identifies unusual PowerShell arguments indicative of such abuse, focusing on patterns like encoded commands, suspicious downloads, and obfuscation techniques, thereby flagging potential threats for further investigation.

### Possible investigation steps

- Review the process command line and arguments to identify any encoded or obfuscated content, such as Base64 strings or unusual character sequences, which may indicate malicious intent.
- Check the parent process of the PowerShell execution, especially if it is explorer.exe or cmd.exe, to determine if the PowerShell instance was launched from a suspicious or unexpected source.
- Investigate any network activity associated with the PowerShell process, particularly looking for connections to known malicious domains or IP addresses, or the use of suspicious commands like DownloadFile or DownloadString.
- Examine the user account associated with the PowerShell execution to determine if it aligns with expected behavior or if it might be compromised.
- Correlate the event with other security alerts or logs from the same host or user to identify patterns or additional indicators of compromise.
- Assess the risk and impact of the detected activity by considering the context of the environment, such as the presence of sensitive data or critical systems that might be affected.

### False positive analysis

- Legitimate administrative scripts may use encoded commands for obfuscation to protect sensitive data. Review the script's source and purpose to determine if it is authorized. If confirmed, add the script's hash or specific command pattern to an allowlist.
- Automated software deployment tools might use PowerShell to download and execute scripts from trusted internal sources. Verify the source and destination of the download. If legitimate, exclude the specific tool or process from the detection rule.
- System maintenance tasks often involve PowerShell scripts that manipulate files or system settings. Identify routine maintenance scripts and exclude their specific command patterns or file paths from triggering the rule.
- Security software may use PowerShell for scanning or remediation tasks, which can mimic suspicious behavior. Confirm the software's legitimacy and add its processes to an exception list to prevent false alerts.
- Developers might use PowerShell for testing or development purposes, which can include obfuscation techniques. Validate the developer's activities and exclude their specific development environments or scripts from the rule.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further spread or communication with potential command and control servers.
- Terminate any suspicious PowerShell processes identified by the detection rule to halt ongoing malicious activities.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any malicious payloads or scripts.
- Review and clean up any unauthorized changes to system configurations or scheduled tasks that may have been altered by the malicious PowerShell activity.
- Restore any affected files or system components from known good backups to ensure system integrity and functionality.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are compromised.
- Implement additional monitoring and logging for PowerShell activities across the network to enhance detection of similar threats in the future."""
risk_score = 47
rule_id = "83bf249e-4348-47ba-9741-1202a09556ad"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Windows Security Event Logs",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: SentinelOne",
    "Data Source: Microsoft Defender XDR",
    "Data Source: Crowdstrike",
    "Data Source: Elastic Endgame",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and
 process.name : "powershell.exe" and

  not (
    ?user.id == "S-1-5-18" and
    /* Don't apply the user.id exclusion to Sysmon for compatibility */
    not data_stream.dataset : ("windows.sysmon_operational", "windows.sysmon")
  ) and

  not process.parent.executable : (
        "?:\\Program Files\\*.exe",
        "?:\\Program Files (x86)\\*.exe"
  ) and

  (
    process.command_line : (
          "*^*^*^*^*^*^*^*^*^*",
          "*`*`*`*`*",
          "*+*+*+*+*+*+*",
          "*[char[]](*)*-join*",
          "*Base64String*",
          "*[*Convert]*",
          "*.Compression.*",
          "*-join($*",
          "*MemoryStream*",
          "*WriteAllBytes*",
          "* -enc *",
          "* -ec *",
          "* /e *",
          "* /enc *",
          "* /ec *",
          "*WebClient*",
          "*DownloadFile*",
          "*DownloadString*",
          "* iex*",
          "* iwr*",
          "* aQB3AHIAIABpA*",
          "*Reflection.Assembly*",
          "*Assembly.GetType*",
          "*$env:temp\\*start*",
          "*powercat*",
          "*nslookup -q=txt*",
          "*$host.UI.PromptForCredential*",
          "*Net.Sockets.TCPClient*",
          "*curl *;Start*",
          "powershell.exe \"<#*",
          "*ssh -p *",
          "*http*|iex*",
          "*@SSL\\DavWWWRoot\\*.ps1*",
          "*.lnk*.Seek(0x*",
          "*[string]::join(*",
          "*[Array]::Reverse($*",
          "* hidden $(gc *",
          "*=wscri& set*",
          "*http'+'s://*",
          "*.content|i''Ex*",
          "*//:sptth*",
          "*//:ptth*",
          "*h''t''t''p*",
          "*'tp'':''/'*",
          "*$env:T\"E\"MP*",
          "*;cmd /c $?",
          "*s''t''a''r*",
          "*$*=Get-Content*AppData*.SubString(*$*",
          "*=cat *AppData*.substring(*);*$*",
          "*-join'';*|powershell*",
          "*.Content;sleep *|powershell*",
          "*h\''t\''tp:\''*",
          "*-e aQB3AHIAIABp*",
          "*iwr *https*).Content*",
          "*$env:computername*http*",
          "*;InVoKe-ExpRESsIoN $COntent.CONTENt;*",
          "*WebClient*example.com*",
          "*=iwr $*;iex $*",
          "*ServerXmlHttp*IEX*",
          "*XmlDocument*IEX*"
    ) or

    (
      process.command_line : "*.replace*" and
      /* exclude known process and network inventory collection patterns */
      not process.command_line : (
        "*Get-CimInstance -Class Win32_Process*ConvertTo-Csv*Select-Object*$_.Replace*",
        "*function replace_unallowed*$s.replace*Get-Counter*Network Adapter*"
      )
    ) or

    (process.args : "-c" and process.args : "&{'*") or

    (process.args : "-Outfile" and process.args : "Start*") or

    (process.args : "-bxor" and process.args : "0x*") or

    process.args : "$*$*;set-alias" or

    process.args == "-e" or

    // ATHPowerShellCommandLineParameter
    process.args : ("-EncodedCommandParamVariation", "-UseEncodedArguments", "-CommandParamVariation") or

    (
      process.parent.name : ("explorer.exe", "cmd.exe") and
      process.command_line : ("*-encodedCommand*", "*Invoke-webrequest*", "*WebClient*", "*Reflection.Assembly*"))
    ) and
    not process.command_line : (
      "*Use-Icinga -Minimal*",
      "*& {$j = sajb {Add-Type -AssemblyName*"
    )
'''

setup = """## Setup

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

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

### Additional data sources

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

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


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

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

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

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

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

[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"

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

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

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

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

[[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 == "windows" and event.type == "start" and
 process.name : "powershell.exe" and
  not (
    ?user.id == "S-1-5-18" and
    not data_stream.dataset : ("windows.sysmon_operational", "windows.sysmon")
  ) and
  not process.parent.executable : (
        "?:\\Program Files\\*.exe",
        "?:\\Program Files (x86)\\*.exe"
  ) and
  (
    process.command_line : (
          "*^*^*^*^*^*^*^*^*^*",
          "*`*`*`*`*",
          "*+*+*+*+*+*+*",
          "*[char[]](*)*-join*",
          "*Base64String*",
          "*[*Convert]*",
          "*.Compression.*",
          "*-join($*",
          "*MemoryStream*",
          "*WriteAllBytes*",
          "* -enc *",
          "* -ec *",
          "* /e *",
          "* /enc *",
          "* /ec *",
          "*WebClient*",
          "*DownloadFile*",
          "*DownloadString*",
          "* iex*",
          "* iwr*",
          "* aQB3AHIAIABpA*",
          "*Reflection.Assembly*",
          "*Assembly.GetType*",
          "*$env:temp\\*start*",
          "*powercat*",
          "*nslookup -q=txt*",
          "*$host.UI.PromptForCredential*",
          "*Net.Sockets.TCPClient*",
          "*curl *;Start*",
          "powershell.exe \"<#*",
          "*ssh -p *",
          "*http*|iex*",
          "*@SSL\\DavWWWRoot\\*.ps1*",
          "*.lnk*.Seek(0x*",
          "*[string]::join(*",
          "*[Array]::Reverse($*",
          "* hidden $(gc *",
          "*=wscri& set*",
          "*http'+'s://*",
          "*.content|i''Ex*",
          "*//:sptth*",
          "*//:ptth*",
          "*h''t''t''p*",
          "*'tp'':''/'*",
          "*$env:T\"E\"MP*",
          "*;cmd /c $?",
          "*s''t''a''r*",
          "*$*=Get-Content*AppData*.SubString(*$*",
          "*=cat *AppData*.substring(*);*$*",
          "*-join'';*|powershell*",
          "*.Content;sleep *|powershell*",
          "*h\''t\''tp:\''*",
          "*-e aQB3AHIAIABp*",
          "*iwr *https*).Content*",
          "*$env:computername*http*",
          "*;InVoKe-ExpRESsIoN $COntent.CONTENt;*",
          "*WebClient*example.com*",
          "*=iwr $*;iex $*",
          "*ServerXmlHttp*IEX*",
          "*XmlDocument*IEX*"
    ) or
    (
      process.command_line : "*.replace*" and
      not process.command_line : (
        "*Get-CimInstance -Class Win32_Process*ConvertTo-Csv*Select-Object*$_.Replace*",
        "*function replace_unallowed*$s.replace*Get-Counter*Network Adapter*"
      )
    ) or
    (process.args : "-c" and process.args : "&{'*") or
    (process.args : "-Outfile" and process.args : "Start*") or
    (process.args : "-bxor" and process.args : "0x*") or
    process.args : "$*$*;set-alias" or
    process.args == "-e" or
    process.args : ("-EncodedCommandParamVariation", "-UseEncodedArguments", "-CommandParamVariation") or
    (
      process.parent.name : ("explorer.exe", "cmd.exe") and
      process.command_line : ("*-encodedCommand*", "*Invoke-webrequest*", "*WebClient*", "*Reflection.Assembly*"))
    ) and
    not process.command_line : (
      "*Use-Icinga -Minimal*",
      "*& {$j = sajb {Add-Type -AssemblyName*"
    )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.datasetwildcard
  • windows.sysmon corpus 5 (elastic 5)
  • windows.sysmon_operational corpus 5 (elastic 5)
field:"data_stream.dataset" kind:wildcard
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argseq
  • -e corpus 42 (elastic 42)
field:"process.args" kind:eq value:"-e"
process.argswildcard
  • $*$*;set-alias corpus 2 (elastic 2)
  • &{'* corpus 2 (elastic 2)
  • -CommandParamVariation
  • -EncodedCommandParamVariation
  • -Outfile corpus 2 (elastic 2)
  • -UseEncodedArguments
  • -bxor corpus 2 (elastic 2)
  • -c corpus 19 (elastic 19)
  • 0x* corpus 2 (elastic 2)
  • Start* corpus 2 (elastic 2)
field:"process.args" kind:wildcard
process.command_linewildcard
  • * -ec * corpus 6 (elastic 6)
  • * -enc * corpus 4 (elastic 4)
  • * /e * corpus 5 (elastic 5)
  • * /ec * corpus 5 (elastic 5)
  • * /enc * corpus 2 (elastic 2)
  • * aQB3AHIAIABpA* corpus 2 (elastic 2)
  • * hidden $(gc * corpus 2 (elastic 2)
  • * iex* corpus 3 (elastic 3)
  • * iwr* corpus 2 (elastic 2)
  • *$*=Get-Content*AppData*.SubString(*$* corpus 2 (elastic 2)
  • *$env:T"E"MP* corpus 2 (elastic 2)
  • *$env:computername*http* corpus 2 (elastic 2)
  • *$env:temp\*start* corpus 2 (elastic 2)
  • *$host.UI.PromptForCredential* corpus 2 (elastic 2)
  • *'tp'':''/'* corpus 2 (elastic 2)
  • *+*+*+*+*+*+* corpus 2 (elastic 2)
  • *-e aQB3AHIAIABp* corpus 2 (elastic 2)
  • *-encodedCommand* corpus 3 (elastic 2, sigma 1)
  • *-join'';*|powershell* corpus 2 (elastic 2)
  • *-join($* corpus 2 (elastic 2)
  • *.Compression.* corpus 5 (elastic 5)
  • *.Content;sleep *|powershell* corpus 2 (elastic 2)
  • *.content|i''Ex* corpus 2 (elastic 2)
  • *.lnk*.Seek(0x* corpus 2 (elastic 2)
  • *.replace*
  • *//:ptth* corpus 2 (elastic 2)
  • *//:sptth* corpus 2 (elastic 2)
  • *;InVoKe-ExpRESsIoN $COntent.CONTENt;* corpus 2 (elastic 2)
  • *;cmd /c $? corpus 2 (elastic 2)
  • *=cat *AppData*.substring(*);*$* corpus 2 (elastic 2)
  • *=iwr $*;iex $* corpus 2 (elastic 2)
  • *=wscri& set* corpus 2 (elastic 2)
  • *@SSL\DavWWWRoot\*.ps1* corpus 2 (elastic 2)
  • *Assembly.GetType* corpus 5 (elastic 5)
  • *Base64String* corpus 5 (elastic 5)
  • *DownloadFile* corpus 6 (elastic 6)
  • *DownloadString* corpus 6 (elastic 6)
  • *Invoke-webrequest* corpus 13 (sigma 10, elastic 3)
  • *MemoryStream* corpus 5 (elastic 5)
  • *Net.Sockets.TCPClient* corpus 2 (elastic 2)
  • +25 more values (see full rule source)
field:"CommandLine" kind:wildcard
process.namewildcard
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
field:"process_basename" kind:wildcard value:"powershell.exe"
process.parent.namewildcard
  • cmd.exe corpus 37 (elastic 32, splunk 4, kusto 1)
  • explorer.exe corpus 50 (elastic 50)
field:"parent_process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

System Binary Path File Permission Modification

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

This rule identifies file permission modification events on files located in common system binary paths. Adversaries may attempt to hide their payloads in the default Linux system directories, and modify the file permissions of these payloads prior to execution.

MITRE ATT&CK Coverage

Rule Body

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

[rule]
author = ["Elastic"]
description = """
This rule identifies file permission modification events on files located in common system binary paths. Adversaries may attempt to
hide their payloads in the default Linux system directories, and modify the file permissions of these payloads prior to execution.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "System Binary Path File Permission Modification"
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 System Binary Path File Permission Modification

In Linux environments, system binary paths contain critical executables. Adversaries may exploit these by altering file permissions to execute malicious payloads. The detection rule monitors processes like `chmod` and `chown` in key directories, flagging suspicious permission changes. It excludes benign activities, focusing on unauthorized modifications to prevent potential execution of harmful scripts.

### Possible investigation steps

- Review the process details to identify the exact command executed, focusing on the process name and arguments, especially those involving `chmod` or `chown` in critical directories like `/bin`, `/usr/bin`, and `/lib`.
- Examine the parent process information, including the executable path and command line, to determine if the process was initiated by a known or trusted application, excluding those like `udevadm`, `systemd`, or `sudo`.
- Check the user account associated with the process to verify if the action was performed by an authorized user or if there are signs of compromised credentials.
- Investigate the file or directory whose permissions were modified to assess its importance and potential impact, focusing on changes to permissions like `4755`, `755`, or `777`.
- Correlate the event with other security alerts or logs to identify any related suspicious activities, such as unauthorized access attempts or unexpected script executions.
- Review recent changes or updates in the system that might explain the permission modification, ensuring they align with legitimate administrative tasks or software installations.

### False positive analysis

- System updates and package installations often involve legitimate permission changes in system binary paths. Users can exclude processes with parent executables located in directories like /var/lib/dpkg/info to reduce noise from these activities.
- Administrative scripts or automation tools may execute chmod or chown commands as part of routine maintenance. Exclude processes with parent names such as udevadm, systemd, or sudo to prevent these from being flagged.
- Container initialization processes might trigger permission changes. Exclude processes with parent command lines like runc init to avoid false positives related to container setups.
- Temporary script executions during software installations can cause permission modifications. Exclude processes with parent arguments matching patterns like /var/tmp/rpm-tmp.* to filter out these benign events.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or execution of malicious payloads.
- Terminate any suspicious processes identified as executing `chmod` or `chown` commands in critical system binary paths.
- Revert any unauthorized file permission changes to their original state to ensure system integrity and prevent execution of malicious scripts.
- Conduct a thorough review of system logs and process execution history to identify any additional unauthorized activities or related threats.
- Escalate the incident to the security operations team for further investigation and to determine if the threat has spread to other systems.
- Implement additional monitoring on the affected system and similar environments to detect any recurrence of unauthorized permission modifications.
- Review and update access controls and permissions policies to minimize the risk of unauthorized modifications in critical system directories."""
references = ["https://blog.exatrack.com/Perfctl-using-portainer-and-new-persistences/"]
risk_score = 21
rule_id = "0049cf71-fe13-4d79-b767-f7519921ffb5"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

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

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

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name == "chmod" and
process.args like (
  "/bin/*", "/usr/bin/*", "/sbin/*", "/usr/sbin/*", "/usr/local/sbin/*", "/lib/*", "/usr/lib/*", "/lib64/*", "/usr/lib64/*"
) and
process.args in ("4755", "755", "000", "777", "444", "+x") and not (
  process.args in (
    "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod", "/usr/bin/restic", "/usr/local/bin/ack-tool", "/usr/lib/policykit-1/polkit-agent-helper-1",
    "/usr/local/bin/deploy-entrypoint.sh", "/usr/local/bin/mc", "/usr/local/bin/start.sh", "/usr/local/sbin/MySQLBackups/mysql_backup.sh",
    "/usr/bin/coreutils", "/usr/bin/docker-compose", "/usr/bin/cri-dockerd", "/usr/sbin/mkfs.ext5", "/usr/bin/cyclonedx", "/usr/bin/distro",
    "/usr/bin/telegraf", "/usr/bin/jq", "/usr/bin/google-chrome", "/usr/sbin/login_duo"
  ) or
  process.args like "/usr/lib/omnissa/*" or
  process.parent.executable like (
    "/tmp/newroot/*", "/var/lib/dpkg/*", "/usr/libexec/postfix/post-install", "/kaniko/executor", "./install_viewagent.sh", "/bin/make" 
  ) or
  process.parent.args like (
    "/var/lib/dpkg/*", "/usr/lib/postfix/bin/post-install", "/usr/lib/postfix/sbin/post-install", "/usr/libexec/postfix/post-install",
    "./install_viewagent.sh", "/usr/lib/omnissa/*", "/var/tmp/rpm-tmp.*"
  ) or
  process.parent.name in ("udevadm", "systemd", "entrypoint", "sudo", "dart") or
  process.parent.command_line == "runc init"
)
'''

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

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

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

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

[[rule.threat.technique]]
id = "T1222"
name = "File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/"

[[rule.threat.technique.subtechnique]]
id = "T1222.002"
name = "Linux and Mac File and Directory Permissions Modification"
reference = "https://attack.mitre.org/techniques/T1222/002/"

[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 = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"

[[rule.threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"

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

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name == "chmod" and
process.args like (
  "/bin/*", "/usr/bin/*", "/sbin/*", "/usr/sbin/*", "/usr/local/sbin/*", "/lib/*", "/usr/lib/*", "/lib64/*", "/usr/lib64/*"
) and
process.args in ("4755", "755", "000", "777", "444", "+x") and not (
  process.args in (
    "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod", "/usr/bin/restic", "/usr/local/bin/ack-tool", "/usr/lib/policykit-1/polkit-agent-helper-1",
    "/usr/local/bin/deploy-entrypoint.sh", "/usr/local/bin/mc", "/usr/local/bin/start.sh", "/usr/local/sbin/MySQLBackups/mysql_backup.sh",
    "/usr/bin/coreutils", "/usr/bin/docker-compose", "/usr/bin/cri-dockerd", "/usr/sbin/mkfs.ext5", "/usr/bin/cyclonedx", "/usr/bin/distro",
    "/usr/bin/telegraf", "/usr/bin/jq", "/usr/bin/google-chrome", "/usr/sbin/login_duo"
  ) or
  process.args like "/usr/lib/omnissa/*" or
  process.parent.executable like (
    "/tmp/newroot/*", "/var/lib/dpkg/*", "/usr/libexec/postfix/post-install", "/kaniko/executor", "./install_viewagent.sh", "/bin/make" 
  ) or
  process.parent.args like (
    "/var/lib/dpkg/*", "/usr/lib/postfix/bin/post-install", "/usr/lib/postfix/sbin/post-install", "/usr/libexec/postfix/post-install",
    "./install_viewagent.sh", "/usr/lib/omnissa/*", "/var/tmp/rpm-tmp.*"
  ) or
  process.parent.name in ("udevadm", "systemd", "entrypoint", "sudo", "dart") or
  process.parent.command_line == "runc init"
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argsin/bin/chmod, /usr/bin/chmod, /usr/bin/coreutils, /usr/bin/cri-dockerd, /usr/bin/cyclonedx, /usr/bin/distro, /usr/bin/docker-compose, /usr/bin/google-chrome, /usr/bin/jq, /usr/bin/restic, /usr/bin/telegraf, /usr/lib/policykit-1/polkit-agent-helper-1, /usr/local/bin/ack-tool, /usr/local/bin/chmod, /usr/local/bin/deploy-entrypoint.sh, /usr/local/bin/mc, /usr/local/bin/start.sh, /usr/local/sbin/MySQLBackups/mysql_backup.sh, /usr/sbin/login_duo, /usr/sbin/mkfs.ext5excludes:process.args
process.argsstarts_with/usr/lib/omnissa/excludes:process.args field:"process.args" value:"/usr/lib/omnissa/"
process.parent.argswildcard/var/lib/dpkg/*, /usr/lib/postfix/bin/post-install, /usr/lib/postfix/sbin/post-install, /usr/libexec/postfix/post-install, ./install_viewagent.sh, /usr/lib/omnissa/*, /var/tmp/rpm-tmp.*excludes:process.parent.args
process.parent.command_lineeqrunc initexcludes:process.parent.command_line field:"process.parent.command_line" value:"runc init"
process.parent.executablewildcard/tmp/newroot/*, /var/lib/dpkg/*, /usr/libexec/postfix/post-install, /kaniko/executor, ./install_viewagent.sh, /bin/makeexcludes:process.parent.executable
process.parent.nameindart, entrypoint, sudo, systemd, udevadmexcludes:process.parent.name

Unusual File Creation - Alternate Data Stream

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

Identifies suspicious creation of Alternate Data Streams on highly targeted files using a script or command interpreter. This is uncommon for legitimate files and sometimes done by adversaries to hide malware.

MITRE ATT&CK Coverage

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 11: FileCreate

Rule Body

[metadata]
creation_date = "2021/01/21"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/04/30"

[rule]
author = ["Elastic"]
description = """
Identifies suspicious creation of Alternate Data Streams on highly targeted files using a script or command interpreter.
This is uncommon for legitimate files and sometimes done by adversaries to hide malware.
"""
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.file-*",
    "logs-windows.sysmon_operational-*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "endgame-*",
]
language = "eql"
license = "Elastic License v2"
name = "Unusual File Creation - Alternate Data Stream"
risk_score = 73
rule_id = "71bccb61-e19b-452f-b104-79a60e546a95"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: Microsoft Defender XDR",
    "Data Source: SentinelOne",
    "Data Source: Elastic Endgame",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type == "windows" and event.type == "creation" and
   process.name : ("cmd.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "wscript.exe", "cscript.exe", "node.exe", "python*.exe") and
   file.extension in~ (
    "pdf", "dll", "exe", "dat", "com", "bat", "cmd", "sys", "vbs", "vbe", "ps1", "hta", "txt", "js", "jse",
    "wsh", "wsf", "sct", "docx", "doc", "xlsx", "xls", "pptx", "ppt", "rtf", "gif", "jpg", "png", "bmp", "img", "iso"
  ) and
  file.path : "C:\\*:*" and
  not file.name :("*:$DATA", "*PG$Secure", "*Zone.Identifier", "*com.apple.lastuseddate#PS", "*com.apple.provenance")
'''

note = """## Triage and analysis

### Investigating Unusual File Creation - Alternate Data Stream
#### Possible investigation steps

- What ADS target did the alert create?
  - Focus: `file.path`, `file.extension`, `file.size`, and the stream suffix after the base file.
  - Implication: escalate when a command or script interpreter writes ADS on an executable, script, user document, or disk-image host file with a payload-like, DLL-like, or config-like stream name; lower concern only when stream name and file class match a narrow classification, tagging, or packaging marker.

- Does stream metadata or collected content look like payload material?
  - Focus: `file.size`, `file.Ext.header_bytes`, `file.Ext.entropy`, and collected ADS content when available.
  - Hint: retrieve raw ADS content with "Get-Content -Path <host_file> -Stream <stream_name>" or collect the host file before cleanup; without content, do not close from absence.
  - Implication: escalate for script text, encoded blobs, PE bytes, launcher syntax, or execution configuration; if content cannot be recovered, keep unresolved unless lineage, staging, or reuse proves the answer. Lower concern requires small, readable classification, package, validation, or test metadata.

- How was the creating interpreter launched?
  - Focus: `process.executable`, `process.command_line`, `process.parent.executable`, `process.parent.command_line`, and `process.code_signature.subject_name`. $investigate_2
  - Implication: escalate when launched by a document, browser, user-writable binary, unusual parent command, or command line that writes hidden content; lower concern when identity, parent, command line, and user-host scope match a recognized tagging, packaging, or validation workflow.

- Did the creating process stage, rename, or clean up supporting files?
  - Focus: same-process file events on `host.id` and `process.entity_id`: `file.path`, `file.extension`, and `file.size`. $investigate_3
  - Implication: escalate when the same process drops executables or scripts, renames content into a deceptive path, deletes staging material, or writes related ADS artifacts; lower concern when file activity stays limited to the expected file set and stream metadata pattern.

- Did later commands reuse the ADS path or base file?
  - Why: ADS creation becomes decisive when a later command uses file:path:stream syntax or a helper consumes hidden content.
  - Focus: later process events on `host.id` and `user.id` where `process.command_line` references the ADS path, base path, or stream name; include `process.executable` and `process.parent.executable`. $investigate_4
  - Hint: search first for the literal ADS path, then the base path and stream name separately if quoting or escaping differs.
  - Implication: escalate when later commands read, execute, copy, extract, or persist from ADS; if no reuse appears, keep unresolved unless content and lineage prove benign metadata use.

- Does the ADS pattern recur broadly enough to change scope?
  - Focus: smallest stable suspicious indicator, such as stream name, `file.path` pattern, `process.executable`, or `process.command_line`, plus `host.id` and `user.id` scope.
  - Hint: review host-related alerts for matching ADS or interpreter patterns. $investigate_1
  - Hint: review user-related alerts before treating activity as one-host. $investigate_0
  - Implication: broaden containment and scoping when unrelated hosts or users share the ADS pattern; keep scope local only when local content, lineage, and reuse are resolved or the pattern remains confined to one unresolved host.

- Escalate for hidden payload staging, ADS execution, suspicious cleanup, or spread beyond the first host; close only when ADS path/content, command lines, parent lineage, same-process file activity, and `host.id`/`user.id` scope prove one exact marker-writing or lab workflow with no contradictory reuse; preserve artifacts and escalate when answers stay mixed or incomplete.

### False positive analysis

- Data-classification, packaging, or validation tools can legitimately create small ADS markers on fixed file classes. Confirm identity (`process.executable`, `process.code_signature.subject_name`, parent command line), artifacts (`file.path`, stream name, readable marker content), and scope (`host.id`, `user.id`, host cohort) all align with one exact workflow; if workflow records are unavailable, require prior alerts with the same process identity, parent command line, stream name, file class, and host cohort.
- Controlled security testing or forensic labs can place samples or markers in ADS on isolated systems. Confirm the same `process.executable`, `process.command_line`, `file.path`, stream name, and lab host cohort, and no later execution or persistence from ADS; if test plans are unavailable, require repeated bounded testing patterns. Do not create exceptions on `process.name` or `file.extension` alone.

### Response and remediation

- If confirmed benign:
  - Document the evidence that established the workflow before changing response state: `process.executable`, `process.command_line`, parent command line, `file.path` pattern, stream name, stream content type, and the `host.id` or `host.name` cohort. Then reverse temporary containment. Build exceptions only from the minimum confirmed pattern, not from a generic interpreter or file-extension condition.
- If suspicious but unconfirmed:
  - Preserve the exact ADS path, base host file, recovered stream content or computed hash, process timeline, `process.entity_id`, `process.pid`, `process.command_line`, `process.parent.command_line`, and same-process file events before cleanup.
  - Apply reversible containment tied to the findings, such as heightened monitoring, execution restrictions for the affected interpreter, or temporary containment of the affected `host.id`; avoid deleting the stream or base file until evidence is collected.
  - Escalate to host isolation only if ADS reuse, payload-like content, suspicious cleanup, or continued staging shows active risk and the asset can tolerate isolation.
- If confirmed malicious:
  - Use endpoint response to isolate the host after preserving the ADS path, base file, stream content, process timeline, command lines, parent lineage, and related file artifacts. If direct endpoint response is unavailable, hand off that evidence set to the team that can contain the host.
  - Review other hosts and users for the same stream name, ADS path pattern, `process.executable`, or `process.command_line` before deleting the stream, removing the base file, or terminating related processes.
  - Remove the malicious stream, launched payloads, staging files, and the entry vector that created them, then remediate any persistence or delivery path identified during the investigation.
- Post-incident hardening:
  - Keep process and file telemetry enabled for the affected host class, and record recurring ADS naming or interpreter patterns for future triage.
  - Restrict or monitor interpreter workflows that create ADS on high-value file types when that behavior is not required for the host role.
"""

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 15 - FileCreateStreamHash](https://ela.st/sysmon-event-15-setup)
"""

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "host.name",
    "host.id",
    "user.name",
    "user.id",
    "process.parent.executable",
    "process.entity_id",
    "process.pid",
    "process.name",
    "process.executable",
    "process.command_line",
    "file.path",
    "file.name",
    "file.extension",
    "file.size",
]

[transform]

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

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

[[transform.investigate]]
label = "Process events for the same process"
description = ""
providers = [
  [
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

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

[[transform.investigate]]
label = "Process events for the same host and user"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[rule.threat.technique.subtechnique]]
id = "T1564.004"
name = "NTFS File Attributes"
reference = "https://attack.mitre.org/techniques/T1564/004/"

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

Stages and Predicates

Stage 1: file

file where host.os.type == "windows" and event.type == "creation" and
   process.name : ("cmd.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "wscript.exe", "cscript.exe", "node.exe", "python*.exe") and
   file.extension in~ (
    "pdf", "dll", "exe", "dat", "com", "bat", "cmd", "sys", "vbs", "vbe", "ps1", "hta", "txt", "js", "jse",
    "wsh", "wsf", "sct", "docx", "doc", "xlsx", "xls", "pptx", "ppt", "rtf", "gif", "jpg", "png", "bmp", "img", "iso"
  ) and
  file.path : "C:\\*:*" and
  not file.name :("*:$DATA", "*PG$Secure", "*Zone.Identifier", "*com.apple.lastuseddate#PS", "*com.apple.provenance")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • creation corpus 48 (elastic 48)
field:"event.type" kind:eq value:"creation"
file.extensionin
  • bat corpus 2 (elastic 2)
  • bmp corpus 4 (elastic 4)
  • cmd corpus 2 (elastic 2)
  • com
  • dat
  • dll
  • doc corpus 3 (elastic 3)
  • docx corpus 2 (elastic 2)
  • exe
  • gif corpus 3 (elastic 3)
  • hta corpus 3 (elastic 3)
  • img
  • iso
  • jpg corpus 4 (elastic 4)
  • js corpus 7 (elastic 7)
  • jse corpus 2 (elastic 2)
  • pdf corpus 4 (elastic 4)
  • png corpus 4 (elastic 4)
  • ppt corpus 2 (elastic 2)
  • pptx corpus 2 (elastic 2)
  • ps1 corpus 2 (elastic 2)
  • rtf corpus 2 (elastic 2)
  • sct corpus 2 (elastic 2)
  • sys
  • txt corpus 3 (elastic 3)
  • vbe corpus 2 (elastic 2)
  • vbs corpus 2 (elastic 2)
  • wsf corpus 2 (elastic 2)
  • wsh corpus 2 (elastic 2)
  • xls corpus 2 (elastic 2)
  • xlsx corpus 2 (elastic 2)
field:"file.extension" kind:in
file.pathwildcard
  • C:\*:*
field:"TargetFilename" kind:wildcard value:"C:\*:*"
process.namewildcard
  • cmd.exe corpus 8 (elastic 8)
  • cscript.exe corpus 4 (elastic 4)
  • mshta.exe corpus 6 (elastic 6)
  • node.exe corpus 8 (elastic 8)
  • powershell.exe corpus 12 (elastic 12)
  • pwsh.exe corpus 6 (elastic 6)
  • python*.exe corpus 4 (elastic 4)
  • wscript.exe corpus 9 (elastic 9)
field:"process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.nameends_with:$DATA, PG$Secure, Zone.Identifier, com.apple.lastuseddate#PS, com.apple.provenanceexcludes:file.name

Unusual Kerberos Client Process

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

Identifies network connections to the standard Kerberos port from an unusual process. On Windows, the only native system process that normally performs Kerberos traffic from a domain joined host is lsass.exe.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Rule Body

[rule]
description = """
Identifies network connections to the standard Kerberos port from an unusual process. On Windows, the only native system
process that normally performs Kerberos traffic from a domain joined host is lsass.exe.
"""
id = "b5c91c3e-9d2d-4df6-afb7-c9d236b5ebe2"
license = "Elastic License v2"
name = "Unusual Kerberos Client Process"
os_list = ["windows"]
version = "1.0.32"

query = '''
sequence by process.entity_id with maxspan=1m
 [any where user.id like ("S-1-5-21*", "S-1-12-*") and
  (
   (event.category =="library" and dll.name : ("System.DirectoryServices.*.dll", "Wldap32.dll")) or
   (event.category in ("network", "dns") and dns.question.name : "_ldap._tcp.*")
  )]
 [network where destination.port == 88 and source.port >= 49152 and
  network.direction == "egress" and network.transport == "tcp" and
  not destination.address : ("127.*", "::1", "66.64.*") and
  not process.executable : 
         ("?:\\Program Files (x86)\\GFI\\LanGuard 12 Agent\\lnsscomm.exe",
          "?:\\Program Files\\Microsoft Azure Active Directory Connect\\AzureADConnect.exe",
          "?:\\Program Files (x86)\\GalacticAgent\\bin\\GalacticScan.exe",
          "?:\\Xelis Dental Trainer\\Bin-x64\\XelisDental.exe")]
'''

min_endpoint_version = "7.16.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 = "T1558"
name = "Steal or Forge Kerberos Tickets"
reference = "https://attack.mitre.org/techniques/T1558/"


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

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

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

Stage 1: any

[any where user.id like ("S-1-5-21*", "S-1-12-*") and
  (
   (event.category =="library" and dll.name : ("System.DirectoryServices.*.dll", "Wldap32.dll")) or
   (event.category in ("network", "dns") and dns.question.name : "_ldap._tcp.*")
  )]

Stage 2: network

[network where destination.port == 88 and source.port >= 49152 and
  network.direction == "egress" and network.transport == "tcp" and
  not destination.address : ("127.*", "::1", "66.64.*") and
  not process.executable : 
         ("?:\\Program Files (x86)\\GFI\\LanGuard 12 Agent\\lnsscomm.exe",
          "?:\\Program Files\\Microsoft Azure Active Directory Connect\\AzureADConnect.exe",
          "?:\\Program Files (x86)\\GalacticAgent\\bin\\GalacticScan.exe",
          "?:\\Xelis Dental Trainer\\Bin-x64\\XelisDental.exe")]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.porteq
  • 88 transforms: number corpus 4 (elastic 4)
field:"DestinationPort" kind:eq value:"88"
dll.namewildcard
  • System.DirectoryServices.*.dll
  • Wldap32.dll corpus 3 (elastic 3)
field:"dll.name" kind:wildcard
dns.question.namewildcard
  • _ldap._tcp.*
field:"QueryName" kind:wildcard value:"_ldap._tcp.*"
event.categoryeq
  • library corpus 11 (elastic 11)
field:"event.category" kind:eq value:"library"
event.categoryin
  • dns corpus 2 (elastic 2)
  • network corpus 5 (elastic 5)
field:"event.category" kind:in
network.directioneq
  • egress corpus 13 (elastic 13)
field:"Initiated" kind:eq value:"egress"
network.transporteq
  • tcp corpus 16 (elastic 16)
field:"Protocol" kind:eq value:"tcp"
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"
user.idwildcard
  • S-1-12-* corpus 21 (elastic 21)
  • S-1-5-21* corpus 21 (elastic 21)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
destination.addresswildcard127.*, ::1, 66.64.*excludes:destination.address field:"destination.address" value:"127.*" field:"destination.address" value:"::1" field:"destination.address" value:"66.64.*"
process.executableeq?:\Program Files (x86)\GFI\LanGuard 12 Agent\lnsscomm.exe, ?:\Program Files\Microsoft Azure Active Directory Connect\AzureADConnect.exe, ?:\Program Files (x86)\GalacticAgent\bin\GalacticScan.exe, ?:\Xelis Dental Trainer\Bin-x64\XelisDental.exeexcludes:process.executable

Back to all Elastic rules