Detection rules › Elastic
Elastic rules: 37
AWS S3 Bucket Policy Added to Share with External Account
#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
| Tactic | Techniques |
|---|---|
| Persistence | |
| Collection | |
| Exfiltration |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| AWS | CloudTrail event PutBucketPolicy: Applies a resource-based bucket policy to an S3 bucket. |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.request_parameters | contains |
| field:"aws::requestParameters" kind:contains |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | eq |
| field:"EventType" kind:eq value:"PutBucketPolicy" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"s3.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
aws.cloudtrail.request_parameters | contains | aws.cloudtrail.recipient_account_id | excludes:aws.cloudtrail.request_parameters field:"aws.cloudtrail.request_parameters" value:"aws.cloudtrail.recipient_account_id" |
aws.cloudtrail.request_parameters | contains | arn:aws:cloudfront:: | excludes:aws.cloudtrail.request_parameters field:"aws.cloudtrail.request_parameters" value:"arn:aws:cloudfront::" |
aws.cloudtrail.request_parameters | contains | arn:aws:iam::cloudfront:user | excludes:aws.cloudtrail.request_parameters field:"aws.cloudtrail.request_parameters" value:"arn:aws:iam::cloudfront:user" |
user_agent.original | match | Terraform, Pulumi | excludes:user_agent.original field:"user_agent.original" value:"Terraform" field:"user_agent.original" value:"Pulumi" |
Azure AD Graph Access with Unusual Client and User
#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
| Tactic | Techniques |
|---|---|
| Discovery | |
| Lateral Movement |
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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
azure.aadgraphactivitylogs.properties.app_id | in | 00000006-0000-0ff1-ce00-000000000000, 18ed3507-a475-4ccb-b669-d66bc9f2a36e, 74658136-14ec-4630-ad9b-26e160ff0fc6, bb8f18b0-9c38-48c9-a847-e1ef3af0602d | excludes:azure.aadgraphactivitylogs.properties.app_id |
Binary Proxy Execution via Windows OpenSSH
#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
| Tactic | Techniques |
|---|---|
| Stealth |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.args | eq |
| field:"process.parent.args" kind:eq value:"-o" |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Container Management Utility Execution Detected via Defend for Containers
#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
| Tactic | Techniques |
|---|---|
| Execution | |
| Discovery |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
container.id | wildcard |
| field:"container.id" kind:wildcard value:"*" |
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | eq | kubectl | excludes:process.name field:"process.name" value:"kubectl" |
process.parent.name | eq | busybox | excludes:process.parent.name field:"process.parent.name" value:"busybox" |
process.parent.args | eq | init | excludes:process.parent.args field:"process.parent.args" value:"init" |
process.parent.args | eq | runc | excludes:process.parent.args field:"process.parent.args" value:"runc" |
process.parent.executable | in | /sbin/init, /usr/bin/containerd-shim-runc-v2, /usr/bin/dockerd, /usr/bin/runc | excludes:process.parent.executable |
process.working_directory | eq | /aws | excludes:process.working_directory field:"process.working_directory" value:"/aws" |
Disabling Hypervisor-protected Code Integrity via Registry
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"modification" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard value:"0" |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\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 | excludes:process.executable |
process.thread.Ext.call_stack_summary | in | sysfer.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.dll | excludes: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
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"load" |
process.name | eq |
| field:"process_basename" kind:eq value:"com.apple.dock.external.extra.arm64" |
Early Remote Memory Allocation
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
Target.process.Ext.token.integrity_level_name | ne |
| field:"Target.process.Ext.token.integrity_level_name" kind:ne value:"low" |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.api.behaviors | eq |
| field:"process.Ext.api.behaviors" kind:eq |
process.Ext.api.name | in |
| field:"process.Ext.api.name" kind:in |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | ne |
| field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" kind:ne value:"0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2" |
process.thread.Ext.call_stack_final_user_module.protection_provenance | ne |
| field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" kind:ne value:"Kernel" |
process.thread.Ext.call_stack_summary | is_not_null | field:"process.thread.Ext.call_stack_summary" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature | |
process.thread.Ext.call_stack_final_user_module.name | in | Kernel, Undetermined, Unknown | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" |
process.thread.Ext.call_stack_final_user_module.path | starts_with | ?:\program files\, ?:\program files (x86)\ | excludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files\" field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files (x86)\" |
Elastic Defend Alert from Package Manager Install Ancestry
#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
| Tactic | Techniques |
|---|---|
| Initial Access |
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 =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*"))trueprocess.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*")truefalseStage 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 =is_pkg_installprocess.parent.entity_id"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.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.pkg_ancestor_ids | is_not_null | field:"Esql.pkg_ancestor_ids" kind:is_not_null | |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"endpoint.alerts" |
is_pkg_install | eq |
| field:"is_pkg_install" kind:eq value:"true" |
process.Ext.ancestry | is_not_null | field:"process.Ext.ancestry" kind:is_not_null |
Output Fields
The rule emits every field available at its final step.
Entra ID OAuth Application Redirect URI Modified
#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
| Tactic | Techniques |
|---|---|
| Persistence | |
| Credential Access |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | Update application |
Rules Detecting the Same Action
These rules filter on the same operation.
- [Entra ID] Application Assigned Administrator Permissions Immediately After Obtaining Role Management Permissions (Kusto)
- [Entra ID] Application Granted Administrative Permission to Assign Microsoft Entra ID Roles (Kusto)
- Added Credentials to Existing Application (Sigma)
- Added Owner To Application (Sigma)
- Admin promotion after Role Management Application Permission Grant (Kusto)
- App Granted Microsoft Permissions (Sigma)
- App Granted Privileged Delegated Or App Permissions (Sigma)
- Application AppID Uri Configuration Changes (Sigma)
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
#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
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Google Workspace | ADD_GROUP_MEMBER: Group Member Creation |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"google_workspace.admin" |
event.action | eq |
| field:"EventType" kind:eq value:"ADD_GROUP_MEMBER" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.target.domain | ends_with | user.target.group.domain | excludes:user.target.domain field:"user.target.domain" value:"user.target.group.domain" |
GKE API Request Failure Burst by User
#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
| Tactic | Techniques |
|---|---|
| Discovery |
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.
| Field | Source |
|---|---|
Esql.* | KEEP Esql.* |
user.email | KEEP user.email |
source.ip | KEEP source.ip |
user_agent.original | KEEP user_agent.original |
data_stream.namespace | KEEP data_stream.namespace |
Initial Access via Audio Unit Plug-in
#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
| Tactic | Techniques |
|---|---|
| Execution |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.executable | in | /Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X, /Applications/Logic Pro.app/Contents/MacOS/Logic Pro, /sbin/launchd | excludes: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.ip | cidr_match | 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 | excludes:destination.ip |
Loadable Kernel Module Loaded via Loader
#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
| Tactic | Techniques |
|---|---|
| Persistence | |
| Stealth |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"load_module" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
Network File Unzipped via Unsigned or Untrusted Binary
#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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.name | eq | figma_agent | excludes:process.parent.name field:"process.parent.name" value:"figma_agent" |
Network Traffic to Rare Destination Country
#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
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Command & Control | |
| Exfiltration |
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
#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
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | eq |
| field:"process_basename" kind:eq value:"perl" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | /usr/bin/xpath | excludes:process.args field:"process.args" value:"/usr/bin/xpath" |
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.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 | excludes:destination.ip |
Potential Credential Validation via Sudo from Unusual Parent
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq |
process.args_count | le |
| field:"process.args_count" kind:le value:"8" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*sudo -k -S *" |
process.name | eq |
| field:"process_basename" kind:eq value:"sudo" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"python*" |
Potential Defense Evasion via Doas
#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
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.path | eq |
| field:"TargetFilename" kind:eq value:"/etc/doas.conf" |
Potential Lateral Tool Transfer via SMB Share
#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
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event 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.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | eq |
| field:"DestinationPort" kind:eq value:"445" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
event.type | in |
| field:"event.type" kind:in |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard |
network.direction | wildcard |
| field:"Initiated" kind:wildcard |
network.transport | eq |
| field:"Protocol" kind:eq value:"tcp" |
process.pid | eq |
| field:"process_id" kind:eq value:"4" |
source.ip | ne |
| field:"src_ip" kind:ne |
user.id | wildcard |
| field:"user.id" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | starts_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
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"change" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard value:"?*" |
file.name | wildcard |
| field:"file.name" kind:wildcard |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | in | ./runc, ./usr/bin/qemu-aarch64 | excludes:process.executable field:"process.executable" value:"./runc" field:"process.executable" value:"./usr/bin/qemu-aarch64" |
process.name | wildcard | 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 | excludes:process.name |
Potential Privilege Escalation via Busctl System Call
#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
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.args | eq | /usr/sbin/netplan | excludes:process.parent.args field:"process.parent.args" value:"/usr/sbin/netplan" |
process.parent.args | eq | status | excludes:process.parent.args field:"process.parent.args" value:"status" |
process.parent.executable | starts_with | /usr/bin/python3. | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/python3." |
Privilege Escalation via Microsoft Exchange DLL Hijacking
#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
| Tactic | Techniques |
|---|---|
| Stealth |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard value:"D:\ManagedTools\cmdlets\*" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"w3wp.exe" |
Suspicious Interpreter Execution from Stdin
#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
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-" |
process.args_count | le |
| field:"process.args_count" kind:le value:"2" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.args | in | /sbin/needrestart, /usr/sbin/needrestart | excludes:process.parent.args field:"process.parent.args" value:"/sbin/needrestart" field:"process.parent.args" value:"/usr/sbin/needrestart" |
Suspicious Null Terminated Call Stack
#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
| Tactic | Techniques |
|---|---|
| Stealth |
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.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature | |
process.executable | wildcard | C:\Program Files (x86)\Steam\steamapps\common\*.exe | excludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\Steam\steamapps\common\*.exe" |
process.parent.executable | eq | C:\Program Files (x86)\Steam\steam.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Steam\steam.exe" |
process.Ext.api.metadata.target_address_path | in | c:\program files\asus\aura lighting effect add-on x64\bass.dll, c:\program files\asus\aura lighting effect add-on x64\basswasapi.dll | excludes: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.executable | wildcard | D:\SteamLibrary\steamapps\common\*.exe, E:\Steam\steamapps\common\*.exe | excludes: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.sha256 | in | 016a8cdb4c207947ce2efe00310de94d322c6928ffb664134b23037403c41c0b, 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, fdf036edcd2fc6997a6eeaac4b58e4b533cd6abdf15d18a53621832bff038be0 | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
process.thread.Ext.call_stack_final_user_module.protection_provenance | eq | clr.dll | excludes: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
#Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware installation leveraging PowerShell.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth | |
| Command & Control |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "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.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | wildcard |
| field:"data_stream.dataset" kind:wildcard |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-e" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"powershell.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
data_stream.dataset | eq | windows.sysmon_operational, windows.sysmon | excludes:data_stream.dataset field:"data_stream.dataset" value:"windows.sysmon_operational" field:"data_stream.dataset" value:"windows.sysmon" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
process.command_line | match | Use-Icinga -Minimal, & {$j = sajb {Add-Type -AssemblyName | excludes:process.command_line field:"process.command_line" value:"Use-Icinga -Minimal" field:"process.command_line" value:"& {$j = sajb {Add-Type -AssemblyName" |
process.parent.executable | wildcard | ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\*.exe" field:"process.parent.executable" value:"?:\Program Files (x86)\*.exe" |
System Binary Path File Permission Modification
#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
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Defense Impairment |
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"chmod" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | in | /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.ext5 | excludes:process.args |
process.args | starts_with | /usr/lib/omnissa/ | excludes:process.args field:"process.args" value:"/usr/lib/omnissa/" |
process.parent.args | wildcard | /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_line | eq | runc init | excludes:process.parent.command_line field:"process.parent.command_line" value:"runc init" |
process.parent.executable | wildcard | /tmp/newroot/*, /var/lib/dpkg/*, /usr/libexec/postfix/post-install, /kaniko/executor, ./install_viewagent.sh, /bin/make | excludes:process.parent.executable |
process.parent.name | in | dart, entrypoint, sudo, systemd, udevadm | excludes:process.parent.name |
Unusual File Creation - Alternate Data Stream
#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
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event 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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"creation" |
file.extension | in |
| field:"file.extension" kind:in |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"C:\*:*" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.name | ends_with | :$DATA, PG$Secure, Zone.Identifier, com.apple.lastuseddate#PS, com.apple.provenance | excludes:file.name |
Unusual Kerberos Client Process
#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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | eq |
| field:"DestinationPort" kind:eq value:"88" |
dll.name | wildcard |
| field:"dll.name" kind:wildcard |
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard value:"_ldap._tcp.*" |
event.category | eq |
| field:"event.category" kind:eq value:"library" |
event.category | in |
| field:"event.category" kind:in |
network.direction | eq |
| field:"Initiated" kind:eq value:"egress" |
network.transport | eq |
| field:"Protocol" kind:eq value:"tcp" |
source.port | ge |
| field:"SourcePort" kind:ge value:"49152" |
user.id | wildcard |
| field:"user.id" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.address | wildcard | 127.*, ::1, 66.64.* | excludes:destination.address field:"destination.address" value:"127.*" field:"destination.address" value:"::1" field:"destination.address" value:"66.64.*" |
process.executable | eq | ?:\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 | excludes:process.executable |