Detection rules › Elastic
Elastic rules: 24
AWS Bedrock AgentCore Resource Created with IAM Execution Role
#Detects the creation of an AWS Bedrock AgentCore resource (code interpreter, agent runtime, browser, or harness) with an IAM execution role attached. When an attacker with iam:PassRole permission creates an AgentCore resource and attaches a privileged role, subsequent invocations inside that resource execute as the attached role — enabling privilege escalation to roles that trust bedrock-agentcore.amazonaws.com.
Known False Positives
- Legitimate provisioning of Bedrock AgentCore resources by CI/CD pipelines or platform engineers. Validate the caller identity against expected provisioning principals and verify the attached role is commensurate with the workload's documented requirements.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2026/08/25"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/25"
[rule]
author = ["Elastic"]
description = """
Detects the creation of an AWS Bedrock AgentCore resource (code interpreter, agent runtime, browser, or harness) with an
IAM execution role attached. When an attacker with iam:PassRole permission creates an AgentCore resource and attaches a
privileged role, subsequent invocations inside that resource execute as the attached role — enabling privilege
escalation to roles that trust bedrock-agentcore.amazonaws.com.
"""
false_positives = [
"""
Legitimate provisioning of Bedrock AgentCore resources by CI/CD pipelines or platform engineers. Validate the caller
identity against expected provisioning principals and verify the attached role is commensurate with the workload's
documented requirements.
""",
]
from = "now-9m"
index = ["logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS Bedrock AgentCore Resource Created with IAM Execution Role"
note = """## Triage and analysis
### Investigating AWS Bedrock AgentCore Resource Created with IAM Execution Role
AWS Bedrock AgentCore services (code interpreters, agent runtimes, browsers, harnesses) run user workloads inside isolated MicroVMs. When an IAM role is attached at creation time, all code executing inside the resource assumes that role's identity. An attacker with iam:PassRole and bedrock-agentcore:Create* permissions can attach a privileged role and then invoke the resource to operate as that role.
The four Create* events covered here are management-plane events logged to CloudTrail by default. The subsequent Start*/Invoke* data-plane events are NOT captured by the default management events trail and cannot be detected without enabling data-plane logging.
### Possible investigation steps
- Check the caller identity (`aws.cloudtrail.user_identity.arn`) against expected provisioning principals. Unexpected users or roles creating AgentCore resources should be investigated.
- Examine `aws.cloudtrail.request_parameters` for the attached role ARN (`executionRoleArn` or `roleArn`) and evaluate whether that role has permissions beyond what the AgentCore workload legitimately requires.
- Check for subsequent `StartCodeInterpreterSession`, `StartBrowserSession`, or `InvokeAgentRuntime` events from the same caller against the newly created resource (requires data-plane logging to be enabled).
- Review the IAM PassRole permission of the calling identity and whether it is constrained by `iam:PassedToService` conditions.
### False positive analysis
- Automated provisioning by CDK/CloudFormation/Terraform with a known service account.
- Platform engineering pipelines deploying Bedrock-based AI workloads.
- Filter on `user_agent.original` for known IaC tools.
### Response and remediation
- Suspend the calling identity's iam:PassRole permission while investigating.
- Delete the newly created AgentCore resource to stop active sessions.
- Rotate the attached execution role's credentials if exploitation is confirmed.
- Enable data-plane logging for bedrock-agentcore to detect subsequent session invocations.
"""
references = [
"https://www.beyondtrust.com/blog/entry/aws-agentcore-privilege-escalation",
]
risk_score = 47
rule_id = "2d8f6e1a-4b7c-4f9d-8e3a-1c5d2f8b9a0e"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Platform: AWS",
"Data Source: AWS CloudTrail",
"Service: AWS Bedrock",
"Service: AWS IAM",
"Tactic: Privilege Escalation",
"Tactic: Persistence",
"Rule Type: Custom Query (KQL)",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset: "aws.cloudtrail" and
event.provider: "bedrock-agentcore.amazonaws.com" and
event.action: (
"CreateCodeInterpreter" or
"CreateAgentRuntime" or
"CreateBrowser" or
"CreateHarness"
) and
event.outcome: "success" and
aws.cloudtrail.request_parameters: (*executionRoleArn* or *roleArn*) and
not aws.cloudtrail.user_identity.invoked_by: ("bedrock-agentcore.amazonaws.com" or "cloudformation.amazonaws.com")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[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/"
Stages and Predicates
Stage 1: query
event.dataset: "aws.cloudtrail" and
event.provider: "bedrock-agentcore.amazonaws.com" and
event.action: (
"CreateCodeInterpreter" or
"CreateAgentRuntime" or
"CreateBrowser" or
"CreateHarness"
) and
event.outcome: "success" and
aws.cloudtrail.request_parameters: (*executionRoleArn* or *roleArn*) and
not aws.cloudtrail.user_identity.invoked_by: ("bedrock-agentcore.amazonaws.com" or "cloudformation.amazonaws.com")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.request_parameters | wildcard |
| field:"aws::requestParameters" kind:wildcard |
event.action | in |
| field:"EventType" kind:in |
event.dataset | eq |
| field:"event.dataset" kind:eq value:"aws.cloudtrail" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"bedrock-agentcore.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
aws.cloudtrail.user_identity.invoked_by | in | bedrock-agentcore.amazonaws.com, cloudformation.amazonaws.com | excludes:aws.cloudtrail.user_identity.invoked_by field:"aws.cloudtrail.user_identity.invoked_by" value:"bedrock-agentcore.amazonaws.com" field:"aws.cloudtrail.user_identity.invoked_by" value:"cloudformation.amazonaws.com" |
AWS Bedrock Unauthorized Foundation Model Access Attempt
#Identifies failed, access-denied attempts to enable account-level access to an Amazon Bedrock foundation model, either by granting a foundation-model entitlement, submitting a use case for model access, or creating a foundation-model agreement (accepting the EULA). These account-level "model access" actions unlock a foundation model so that it can subsequently be invoked. A principal that is repeatedly denied when attempting these actions may be a compromised or under-privileged identity probing for the ability to unlock expensive models (LLMjacking) or to establish a durable ability to invoke models. Unlike the companion rule that detects successful model-access grants, this rule surfaces the attempt itself, which is a high-signal indicator of credential boundary-testing even though access was not granted.
Known False Positives
- Access-denied errors can result from benign permission gaps: a newly created role or user whose IAM policy has not yet been provisioned, automation pipelines running ahead of permission grants, or ML teams experimenting in non-production accounts during onboarding. Verify that the principal, source IP, and user agent are expected before escalating. Recurring denials from known onboarding or provisioning workflows can be exempted for specific users or roles.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
creation_date = "2026/06/04"
integration = ["aws"]
maturity = "production"
updated_date = "2026/06/04"
[rule]
author = ["Elastic"]
description = """
Identifies failed, access-denied attempts to enable account-level access to an Amazon Bedrock foundation model, either
by granting a foundation-model entitlement, submitting a use case for model access, or creating a foundation-model
agreement (accepting the EULA). These account-level "model access" actions unlock a foundation model so that it can
subsequently be invoked. A principal that is repeatedly denied when attempting these actions may be a compromised or
under-privileged identity probing for the ability to unlock expensive models (LLMjacking) or to establish a durable
ability to invoke models. Unlike the companion rule that detects successful model-access grants, this rule surfaces the
attempt itself, which is a high-signal indicator of credential boundary-testing even though access was not granted.
"""
false_positives = [
"""
Access-denied errors can result from benign permission gaps: a newly created role or user whose IAM policy has not
yet been provisioned, automation pipelines running ahead of permission grants, or ML teams experimenting in
non-production accounts during onboarding. Verify that the principal, source IP, and user agent are expected before
escalating. Recurring denials from known onboarding or provisioning workflows can be exempted for specific users or
roles.
""",
]
from = "now-6m"
index = ["logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS Bedrock Unauthorized Foundation Model Access Attempt"
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 AWS Bedrock Unauthorized Foundation Model Access Attempt
Amazon Bedrock exposes account-level "model access" controls that determine which foundation models a principal is allowed to invoke. Granting an entitlement (`PutFoundationModelEntitlement`), submitting a use case for model access (`PutUseCaseForModelAccess`), or creating a foundation-model agreement (`CreateFoundationModelAgreement`, which accepts the model EULA) all unlock a model for subsequent `InvokeModel`/`InvokeModelWithResponseStream` calls.
This rule detects Bedrock control-plane calls that enable model access at the account level but were denied (`AccessDenied` / unauthorized). A denial indicates an identity attempting an action it is not permitted to perform, which is a strong signal of boundary-testing by a compromised or under-privileged principal even though no model access was granted.
### Possible investigation steps
- Identify the principal by reviewing `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id`, and determine whether the identity has any legitimate reason to manage Bedrock model access. A denial for an identity that should never touch these APIs is more suspicious than one from an admin with a transient permission gap.
- Inspect `aws.cloudtrail.error_code` and `aws.cloudtrail.error_message` to confirm the denial reason, and review `event.action` to determine which model-access action was attempted.
- Verify the `source.ip` and `user_agent.original` of the request. An unexpected IP, geolocation, or automation user agent is suspicious.
- Confirm the `cloud.account.id` and `cloud.region` are expected for Bedrock usage in your environment.
- Correlate with recent activity from the same principal, such as new access key creation, IAM permission changes, or repeated denials across Bedrock/IAM APIs, which can indicate permission enumeration or escalation attempts.
- Determine whether the identity later succeeded on the same or related actions (e.g., after acquiring new permissions), and check for subsequent `InvokeModel`/`InvokeModelWithResponseStream` activity.
### False positive analysis
- Newly provisioned roles/users or infrastructure-as-code pipelines running before model-access permissions are applied may generate transient denials. Validate against change-management records and known provisioning workflows.
- ML teams exploring model adoption in sandbox accounts may hit denials; confirm the account and identity context.
### Response and remediation
- If the attempt is unexpected, treat the identity as potentially compromised: disable or rotate the credentials (`aws.cloudtrail.user_identity.access_key_id`) and review the actor's recent activity.
- Review all Bedrock and IAM activity from the same identity in the surrounding window for successful access grants, permission changes, or other persistence attempts.
- Review and constrain IAM permissions so that only approved principals can call Bedrock model-access APIs, and alert on both denied and successful calls.
- Implement preventative guardrails (SCPs, IAM conditions) to limit which principals and models can be enabled.
"""
references = [
"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_PutFoundationModelEntitlement.html",
"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_PutUseCaseForModelAccess.html",
"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateFoundationModelAgreement.html"
]
risk_score = 21
rule_id = "3d2e8c90-5be7-4a57-9de4-58be75af933f"
severity = "low"
tags = [
"Domain: Cloud",
"Domain: LLM",
"Data Source: AWS",
"Data Source: AWS CloudTrail",
"Data Source: Amazon Web Services",
"Data Source: Amazon Bedrock",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: "aws.cloudtrail"
and event.provider: "bedrock.amazonaws.com"
and event.action: (
"PutFoundationModelEntitlement" or
"PutUseCaseForModelAccess" or
"CreateFoundationModelAgreement"
)
and event.outcome: "failure"
and aws.cloudtrail.error_code: (
"AccessDenied" or
"AccessDeniedException"
)
'''
[[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.access_key_id",
"event.action",
"event.outcome",
"aws.cloudtrail.error_code",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]
Stages and Predicates
Stage 1: query
data_stream.dataset: "aws.cloudtrail"
and event.provider: "bedrock.amazonaws.com"
and event.action: (
"PutFoundationModelEntitlement" or
"PutUseCaseForModelAccess" or
"CreateFoundationModelAgreement"
)
and event.outcome: "failure"
and aws.cloudtrail.error_code: (
"AccessDenied" or
"AccessDeniedException"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.error_code | in |
| field:"aws::errorCode" kind:in |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"failure" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"bedrock.amazonaws.com" |
AWS IAM Customer-Managed Policy Attached to Role by Rare User
#Detects when an AWS Identity and Access Management (IAM) customer-managed policy is attached to a role by an unusual or unauthorized user. Customer-managed policies are policies created and controlled within an AWS account, granting specific permissions to roles or users when attached. This rule identifies potential privilege escalation by flagging cases where a customer-managed policy is attached to a role by an unexpected actor, which could signal unauthorized access or misuse. Attackers may attach policies to roles to expand permissions and elevate their privileges within the AWS environment. This is a New Terms rule that uses the "cloud.account.id", "user.name" and "entity.target.id" fields to check if the combination of the actor identity and target role name has not been seen before.
Known False Positives
- Legitimate IAM administrators may attach customer-managed policies to roles for various reasons, such as granting temporary permissions or updating existing policies. Ensure that the user attaching the policy is authorized to do so and that the action is expected.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS Compromised IAM Key Quarantine (Panther)
- AWS IAM AdministratorAccess Policy Attached to Role (Elastic)
- AWS IAM Sensitive Operations via Lambda Execution Role (Elastic)
- AWS Sensitive IAM Operations Performed via CloudShell (Elastic)
- AWS SES Full Access Policy Attached to IAM Entity by Unusual User (Elastic)
- IAM Admin Policy Attached (Sigma)
- IAM Policy Attachment Attempt (Sigma)
Rule Body
[metadata]
creation_date = "2024/11/04"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/05"
min_stack_comments = "Changing min stack to 9.3.0, the latest minimum supported version for 9.X releases."
min_stack_version = "9.3.0"
[rule]
author = ["Elastic"]
description = """
Detects when an AWS Identity and Access Management (IAM) customer-managed policy is attached to a role by an unusual or
unauthorized user. Customer-managed policies are policies created and controlled within an AWS account, granting
specific permissions to roles or users when attached. This rule identifies potential privilege escalation by flagging
cases where a customer-managed policy is attached to a role by an unexpected actor, which could signal unauthorized
access or misuse. Attackers may attach policies to roles to expand permissions and elevate their privileges within the
AWS environment. This is a New Terms rule that uses the "cloud.account.id", "user.name" and "entity.target.id" fields to
check if the combination of the actor identity and target role name has not been seen before.
"""
false_positives = [
"""
Legitimate IAM administrators may attach customer-managed policies to roles for various reasons, such as granting
temporary permissions or updating existing policies. Ensure that the user attaching the policy is authorized to do
so and that the action is expected.
""",
]
from = "now-6m"
index = ["logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS IAM Customer-Managed Policy Attached to Role by Rare User"
note = """## Triage and analysis
### Investigating AWS IAM Customer-Managed Policy Attached to Role by Rare User
This rule detects when a customer-managed IAM policy is attached to a role by an unusual or unauthorized user. This activity may indicate a potential privilege escalation attempt within the AWS environment. Adversaries could attach policies to roles to expand permissions, thereby increasing their capabilities and achieving elevated access.
#### Possible Investigation Steps
- **Identify the Initiating User and Target Role**:
- **User Identity**: Examine the `aws.cloudtrail.user_identity.arn` field to determine the user who initiated the policy attachment. Confirm if this user typically has permissions to modify IAM roles and if their activity is consistent with their usual responsibilities.
- **Target Role**: Review `entity.target.id` to identify the role to which the policy was attached. Assess whether modifying this role is expected for this user or if this action is unusual in your environment.
- **Analyze the Attached Policy**:
- **Policy ARN**: Inspect the `aws.cloudtrail.request_parameters` field to identify the specific customer-managed policy attached to the role. Evaluate if this policy grants sensitive permissions, especially permissions that could enable privileged actions or data access.
- **Policy Permissions**: Examine the policy content to determine the scope of permissions granted. Policies enabling actions like `s3:*`, `ec2:*`, or `iam:*` could be leveraged for broader access, persistence, or lateral movement.
- **Review Source and User Agent Details**:
- **Source IP and Location**: Analyze the `source.ip` and `source.geo` fields to confirm the IP address and geographic location where the policy attachment originated. Verify if this matches expected locations for the initiating user.
- **User Agent Analysis**: Examine `user_agent.original` to determine if AWS CLI, SDK, or other tooling was used to perform this action. Tool identifiers like `aws-cli` or `boto3` may indicate automation, while others may suggest interactive sessions.
- **Evaluate Anomalous Behavior Patterns**:
- **User’s Historical Activity**: Check if the initiating user has a history of attaching policies to roles. An unusual pattern in policy attachments could indicate suspicious behavior, especially if the user lacks authorization.
- **Role Modification History**: Investigate if the targeted role is frequently modified by this or other users. Repeated, unauthorized modifications to a role could signal an attempt to maintain elevated access.
- **Correlate with Related CloudTrail Events**:
- **Other IAM or CloudTrail Activities**: Look for recent actions associated with the same user or role by reviewing `event.action` and `event.provider` to identify which AWS services were accessed. This may provide context on the user’s intent or additional actions taken.
- **Broader Suspicious Patterns**: Identify if similar anomalous events have recently occurred, potentially suggesting a coordinated or escalating attack pattern within the AWS account.
### False Positive Analysis
- **Authorized Administrative Actions**: IAM administrators may legitimately attach policies to roles as part of routine role management. Verify if the user is authorized and if the activity aligns with expected administrative tasks.
- **Role-Specific Modifications**: Roles that frequently undergo policy updates may trigger this rule during standard operations. Consider monitoring for patterns or establishing known exceptions for specific users or roles where appropriate.
### Response and Remediation
- **Immediate Access Review**: If the policy attachment is unauthorized, consider detaching the policy and reviewing the permissions granted to the initiating user.
- **Restrict Role Modification Permissions**: Limit which users or roles can attach policies to critical IAM roles. Apply least privilege principles to reduce the risk of unauthorized policy changes.
- **Enhance Monitoring and Alerts**: Enable real-time alerts and monitoring on IAM policy modifications to detect similar actions promptly.
- **Regular Policy Audits**: Conduct periodic audits of IAM policies and role permissions to ensure that unauthorized changes are quickly identified and addressed.
### Additional Information
For more information on managing IAM policies and roles in AWS environments, refer to the [AWS IAM Documentation](https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachRolePolicy.html) and AWS security best practices.
"""
references = ["https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachRolePolicy.html"]
risk_score = 21
rule_id = "f6d07a70-9ad0-11ef-954f-f661ea17fbcd"
severity = "low"
tags = [
"Domain: Cloud",
"Platform: AWS",
"Data Source: AWS CloudTrail",
"Service: AWS IAM",
"Tactic: Privilege Escalation",
"Rule Type: New Terms",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.action: "AttachRolePolicy"
and event.outcome: "success"
and not related.entity: arn\:aws\:iam\:\:aws\:policy*
and not user_agent.original: (*Terraform* or *Pulumi*)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[rule.threat.technique.subtechnique]]
id = "T1548.005"
name = "Temporary Elevated Cloud Access"
reference = "https://attack.mitre.org/techniques/T1548/005/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"entity.target.id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]
[rule.new_terms]
field = "new_terms_fields"
value = ["cloud.account.id", "user.name", "entity.target.id"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.action: "AttachRolePolicy"
and event.outcome: "success"
and not related.entity: arn\:aws\:iam\:\:aws\:policy*
and not user_agent.original: (*Terraform* or *Pulumi*)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | eq |
| field:"EventType" kind:eq value:"AttachRolePolicy" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"iam.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user_agent.original | match | Pulumi | excludes:user_agent.original field:"user_agent.original" value:"Pulumi" |
user_agent.original | match | Terraform | excludes:user_agent.original field:"user_agent.original" value:"Terraform" |
related.entity | starts_with | arn:aws:iam::aws:policy | excludes:related.entity field:"related.entity" value:"arn:aws:iam::aws:policy" |
Connection to Internal Network via Telnet
#Telnet provides a command line interface for communication with a remote device or server. This rule identifies Telnet network connections to non-publicly routable IP addresses.
Known False Positives
- Telnet can be used for both benign or malicious purposes. Telnet is included by default in some Linux distributions, so its presence is not inherently suspicious. The use of Telnet to manage devices remotely has declined in recent years in favor of more secure protocols such as SSH. Telnet usage by non-automated tools or frameworks may be suspicious.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Rule Body
[metadata]
creation_date = "2020/04/23"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2025/12/19"
[rule]
author = ["Elastic"]
description = """
Telnet provides a command line interface for communication with a remote device or server. This rule identifies Telnet
network connections to non-publicly routable IP addresses.
"""
false_positives = [
"""
Telnet can be used for both benign or malicious purposes. Telnet is included by default in some Linux distributions,
so its presence is not inherently suspicious. The use of Telnet to manage devices remotely has declined in recent
years in favor of more secure protocols such as SSH. Telnet usage by non-automated tools or frameworks may be
suspicious.
""",
]
from = "now-9m"
index = ["logs-endpoint.events.network*", "logs-endpoint.events.process*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Connection to Internal Network via Telnet"
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 Connection to Internal Network via Telnet
Telnet is a protocol offering a command-line interface for remote device management, often used in network environments. Adversaries may exploit Telnet to move laterally within a network, accessing non-public IPs to execute commands or exfiltrate data. The detection rule identifies Telnet connections to internal IP ranges, flagging potential unauthorized access attempts, thus aiding in early threat detection and response.
### Possible investigation steps
- Review the process details to confirm the Telnet connection initiation by examining the process.entity_id and process.name fields to ensure the process is indeed Telnet.
- Analyze the destination IP address to determine if it falls within the specified non-public IP ranges, indicating an internal network connection attempt.
- Check the event.type field to verify that the Telnet process event is of type "start", confirming the initiation of a connection.
- Investigate the source host by reviewing host.os.type and other relevant host details to understand the context and legitimacy of the connection attempt.
- Correlate the Telnet activity with any other suspicious network or process activities on the same host to identify potential lateral movement or data exfiltration attempts.
- Consult historical logs and alerts to determine if there have been previous similar Telnet connection attempts from the same source, which might indicate a pattern or ongoing threat.
### False positive analysis
- Routine administrative tasks using Telnet within internal networks can trigger false positives. To manage this, create exceptions for known IP addresses or specific user accounts that regularly perform these tasks.
- Automated scripts or monitoring tools that use Telnet for legitimate purposes may be flagged. Identify these scripts and whitelist their associated processes or IP addresses to prevent unnecessary alerts.
- Internal testing environments often simulate network activities, including Telnet connections. Exclude IP ranges associated with these environments to reduce false positives.
- Legacy systems that rely on Telnet for communication might generate alerts. Document these systems and apply exceptions based on their IP addresses or hostnames to avoid repeated false positives.
- Regularly review and update the list of excluded IPs and processes to ensure that only legitimate activities are exempted, maintaining the effectiveness of the detection rule.
### Response and remediation
- Immediately isolate the affected host from the network to prevent further lateral movement or data exfiltration.
- Terminate any active Telnet sessions on the affected host to stop unauthorized access.
- Conduct a thorough review of the affected host's system logs and Telnet session logs to identify any unauthorized commands executed or data accessed.
- Change all credentials that may have been exposed or used during the unauthorized Telnet sessions to prevent further unauthorized access.
- Apply security patches and updates to the affected host and any other systems that may be vulnerable to similar exploitation.
- Implement network segmentation to limit Telnet access to only necessary systems and ensure that Telnet is disabled on systems where it is not required.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems have been compromised."""
references = ["https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml"]
risk_score = 47
rule_id = "1b21abcc-4d9f-4b08-a7f5-316f5f94b973"
setup = """## Setup
This rule requires data coming in from one of the following integrations:
- Elastic Defend
- Auditbeat
### 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).
### Auditbeat Setup
Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.
#### The following steps should be executed in order to add the Auditbeat on a Linux System:
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html).
- To run Auditbeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html).
- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by process.entity_id
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start") and process.name == "telnet"]
[network where host.os.type == "linux" and process.name == "telnet" and cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8"
)
]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[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, correlated by process.entity_id.
Stage 1: process
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start") and process.name == "telnet"]
Stage 2: network
[network where host.os.type == "linux" and process.name == "telnet" and cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8"
)
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.ip | cidr_match |
| field:"dest_ip" kind:cidr_match |
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | eq |
| field:"process_basename" kind:eq value:"telnet" |
Decoy file Open via Preview App
#Detects the use of the Open binary to open a file from a suspicious location via the Apple Preview application. Threat actors commonly display decoy files or images to appear legitimate and distract users from malicious activities running in the background, often as part of Gatekeeper bypass or initial infection chains.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects the use of the Open binary to open a file from a suspicious location via the Apple Preview application. Threat
actors commonly display decoy files or images to appear legitimate and distract users from malicious activities running
in the background, often as part of Gatekeeper bypass or initial infection chains.
"""
id = "87bbe441-6b10-47b8-bd1b-0732cb4bb7c8"
license = "Elastic License v2"
name = "Decoy file Open via Preview App"
os_list = ["macos"]
reference = [
"https://pberba.github.io/security/2025/11/11/macos-infection-vector-applescript-bypass-gatekeeper/",
]
version = "1.0.1"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "open" and
process.args in ("-a", "-g") and process.args == "/System/Applications/Preview.app" and
process.args like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/var/tmp/*", "/private/var/tmp/*", "/var/root/*", "/private/var/root/*") and
process.args_count <= 4
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name == "open" and
process.args in ("-a", "-g") and process.args == "/System/Applications/Preview.app" and
process.args like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/var/tmp/*", "/private/var/tmp/*", "/var/root/*", "/private/var/root/*") and
process.args_count <= 4
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:"/System/Applications/Preview.app" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.args_count | le |
| field:"process.args_count" kind:le value:"4" |
process.name | eq |
| field:"process_basename" kind:eq value:"open" |
Defense Evasion via Registry Modification
#Identifies modifications to some Windows security related configurations settings via registry changes to disable certain protection or hardening features and performed by a suspicious process.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Defense Impairment |
Rule Body
[rule]
description = """
Identifies modifications to some Windows security related configurations settings via registry changes to disable
certain protection or hardening features and performed by a suspicious process.
"""
id = "e3938d6e-8f66-4871-88c7-442a530f8119"
license = "Elastic License v2"
name = "Defense Evasion via Registry Modification"
os_list = ["windows"]
version = "1.0.23"
query = '''
registry where not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
(process.code_signature.exists == false or
process.name : ("powershell.exe", "reg.exe", "cscript.exe", "wscript.exe", "mshta.exe", "winword.exe", "excel.exe") or
process.executable : ("?:\\Windows\\Microsoft.NET\\*", "?:\\Users\\Public\\*", "?:\\Users\\*\\AppData\\*")) and
registry.path : ("HK*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\*") and
(
(registry.value : ("EnableUA", "ConsentPromptBehaviorAdmin", "PromptOnSecureDesktop") and registry.data.strings : "0") or
(registry.value : ("DisableTaskMgr", "DisableRegistryTools", "DisableArchiveScanning") and registry.data.strings : "1") or
registry.value : "DisableCMD" or
(registry.path : "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Notifications\\Settings\\Windows.SystemToast.SecurityAndMaintenance\\Enabled" and
registry.data.strings : "0")
) and
not (registry.value : "DisableTaskMgr" and
process.executable : ("?:\\Program Files (x86)\\Green's MCI\\MCI.exe",
"?:\\Program Files (x86)\\Green's NV-MSVT\\NV-MSVT.exe",
"?:\\Program Files (x86)\\Green's MSVT\\MSVT.exe")) and
not (process.code_signature.subject_name : ("Barco N.V.", "Advantig Corporation") and process.code_signature.trusted == true)
'''
min_endpoint_version = "8.1.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.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[threat.technique.subtechnique]]
id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.1.0"
Stages and Predicates
Stage 1: registry
registry where not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
(process.code_signature.exists == false or
process.name : ("powershell.exe", "reg.exe", "cscript.exe", "wscript.exe", "mshta.exe", "winword.exe", "excel.exe") or
process.executable : ("?:\\Windows\\Microsoft.NET\\*", "?:\\Users\\Public\\*", "?:\\Users\\*\\AppData\\*")) and
registry.path : ("HK*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\*") and
(
(registry.value : ("EnableUA", "ConsentPromptBehaviorAdmin", "PromptOnSecureDesktop") and registry.data.strings : "0") or
(registry.value : ("DisableTaskMgr", "DisableRegistryTools", "DisableArchiveScanning") and registry.data.strings : "1") or
registry.value : "DisableCMD" or
(registry.path : "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Notifications\\Settings\\Windows.SystemToast.SecurityAndMaintenance\\Enabled" and
registry.data.strings : "0")
) and
not (registry.value : "DisableTaskMgr" and
process.executable : ("?:\\Program Files (x86)\\Green's MCI\\MCI.exe",
"?:\\Program Files (x86)\\Green's NV-MSVT\\NV-MSVT.exe",
"?:\\Program Files (x86)\\Green's MSVT\\MSVT.exe")) and
not (process.code_signature.subject_name : ("Barco N.V.", "Advantig Corporation") and process.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
registry.value | wildcard |
| field:"registry_value_name" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
Entra ID ADRS Token Request by Microsoft Authentication Broker
#Detects suspicious OAuth 2.0 token requests where the Microsoft Authentication Broker (29d9ed98-a469-4536-ade2-f981bc1d605e) requests access to the Device Registration Service (01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9) on behalf of a user principal. The presence of the adrs_access scope in the authentication processing details suggests an attempt to access ADRS, which is atypical for standard user sign-ins. This behavior may reflect an effort to abuse device registration for unauthorized persistence, such as acquiring a Primary Refresh Token (PRT) or establishing a trusted session.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Lateral Movement |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | Target application: Sign-in naming a target application |
Rule Body
[metadata]
creation_date = "2025/06/13"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects suspicious OAuth 2.0 token requests where the Microsoft Authentication Broker
(29d9ed98-a469-4536-ade2-f981bc1d605e) requests access to the Device Registration Service
(01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9) on behalf of a user principal. The presence of the adrs_access scope in the
authentication processing details suggests an attempt to access ADRS, which is atypical for standard user sign-ins. This
behavior may reflect an effort to abuse device registration for unauthorized persistence, such as acquiring a Primary
Refresh Token (PRT) or establishing a trusted session.
"""
from = "now-9m"
index = ["filebeat-*", "logs-azure.signinlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID ADRS Token Request by Microsoft Authentication Broker"
note = """## Triage and analysis
### Investigating Entra ID ADRS Token Request by Microsoft Authentication Broker
Detects suspicious OAuth 2.0 token requests where the Microsoft Authentication Broker (29d9ed98-a469-4536-ade2-f981bc1d605e) requests access to the Device Registration Service (01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9) on behalf of a user principal. The presence of the adrs_access scope in the authentication processing details suggests an attempt to access ADRS, which is atypical for standard user sign-ins. This behavior may reflect an effort to abuse device registration for unauthorized persistence, such as acquiring a Primary Refresh Token (PRT) or establishing a trusted session.
### Possible investigation steps
- Identify the user principal associated with the request by checking `azure.signinlogs.properties.user_principal_name` or `azure.signinlogs.properties.user_id`.
- Review the `azure.signinlogs.properties.app_id` and `azure.signinlogs.properties.resource_id` to confirm the request is made by the Microsoft Authentication Broker and targeting the Device Registration Service.
- Examine the `azure.signinlogs.properties.authentication_processing_details.Oauth Scope Info` for the presence of `adrs_access`, indicating an attempt to access ADRS.
- Check the `azure.signinlogs.properties.incoming_token_type` to confirm the request is made using a refresh token, which is typical for persistent access scenarios.
- Review the `azure.signinlogs.properties.user_type` to ensure it is a "Member" user, as this behavior is unusual for standard user accounts.
- Review the `source.address` and `source.geo.country_name` to identify the origin of the request. Look for any anomalies or unexpected locations.
- Check the `azure.signinlogs.properties.device_detail.operating_system` and `azure.signinlogs.properties.device_detail.browser` to identify the device and browser used for the request. Look for any unusual or unexpected devices for this user.
- Use the `azure.signinlogs.properties.session_id` to correlate this request with other sign-in events for the same user. Look for any patterns of suspicious activity or multiple requests in a short time frame.
- Correlate with Entra ID audit logs to identify any recent device registrations or changes to the user's device registration status.
- Pivot to primary refresh token (PRTs) usage for the same user and/or session ID to identify any potential abuse or unauthorized access attempts.
### False positive analysis
- Legitimate applications or services that require access to the Device Registration Service may trigger this rule. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user accounts.
- Users being onboarded or enrolled in new devices may also trigger this rule, especially if they are using the Microsoft Authentication Broker for the first time.
### Response and remediation
- If the request is confirmed to be suspicious or unauthorized, take immediate action to revoke the access token and prevent further access.
- Disable the user account temporarily to prevent any potential compromise or unauthorized access.
- Review the user's recent sign-in activity and access patterns to identify any potential compromise or unauthorized access.
- If the user account is compromised, initiate a password reset and enforce multi-factor authentication (MFA) for the user.
- Review the conditional access policies in place to ensure they are sufficient to prevent unauthorized access to sensitive resources.
- Consider deactivating any newly registered devices associated with the user account until further investigation is complete.
"""
references = [
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
]
risk_score = 47
rule_id = "d121f0a8-4875-11f0-bb2b-f661ea17fbcd"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-In Logs",
"Use Case: Identity and Access Audit",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: "azure.signinlogs" and
azure.signinlogs.properties.app_id : "29d9ed98-a469-4536-ade2-f981bc1d605e" and
azure.signinlogs.properties.resource_id : "01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9" and
azure.signinlogs.category: "NonInteractiveUserSignInLogs" and
azure.signinlogs.properties.authentication_processing_details: *adrs_access* and
azure.signinlogs.properties.incoming_token_type: "refreshToken" and
azure.signinlogs.properties.user_type: "Member"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.005"
name = "Device Registration"
reference = "https://attack.mitre.org/techniques/T1098/005/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
data_stream.dataset: "azure.signinlogs" and
azure.signinlogs.properties.app_id : "29d9ed98-a469-4536-ade2-f981bc1d605e" and
azure.signinlogs.properties.resource_id : "01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9" and
azure.signinlogs.category: "NonInteractiveUserSignInLogs" and
azure.signinlogs.properties.authentication_processing_details: *adrs_access* and
azure.signinlogs.properties.incoming_token_type: "refreshToken" and
azure.signinlogs.properties.user_type: "Member"
Indicators
These rows show field, operator, and value matches.
Entra ID Device Registration with Phishing Kit Default OS Build
#Identifies a Microsoft Entra ID device registration where the recorded cloud device operating system build is "10.0.19045.2006" and the device display name follows the default "DESKTOP-" pattern. This is the frozen default device profile observed when adversary-in-the-middle (AiTM) phishing kits such as Tycoon2FA and Kali365 register Azure AD-joined devices after capturing a victim session, in order to acquire a Primary Refresh Token (PRT) and establish persistence. The build is hardcoded by the tooling and it is uncommon for the OS build to match this exact value across an environment of otherwise patched hosts, where a current Windows 10 22H2 device reports a far higher "10.0.19045.<revision>" value.
Known False Positives
- Legitimate device registrations may coincidentally use the `10.0.19045.2006` build (Windows 10 22H2) with a default `DESKTOP-` hostname, particularly on imaged or unmanaged Windows hosts that have not been updated. Validate against your device inventory, expected provisioning workflows, and the registering user before escalating.
- Authorized red team or penetration testing engagements that register devices with this OS profile will match this rule. If this is expected, add exceptions for the specific user principal names, source IPs, or device names involved.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Azure | Add device |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure Device No Longer Managed or Compliant (Sigma)
- Azure Device or Configuration Modified or Deleted (Sigma)
- Entra ID AiTM Phishing-Kit Chain Detected (Elastic)
- Entra ID Device Registration with ROADtools Default OS Build (Elastic)
- Entra ID Deviceless Windows Hello Sign-in Followed by Device Registration (Elastic)
- Entra ID Multiple Device Registrations by a Single User (Elastic)
- Entra ID Protection User Alert and Device Registration (Elastic)
- Entra ID Register Device with Unusual User Agent (Azure AD Join) (Elastic)
Rule Body
[metadata]
creation_date = "2026/06/29"
integration = ["azure"]
maturity = "production"
updated_date = "2026/06/29"
[rule]
author = ["Elastic"]
description = """
Identifies a Microsoft Entra ID device registration where the recorded cloud device operating system build is
"10.0.19045.2006" and the device display name follows the default "DESKTOP-" pattern. This is the frozen default device
profile observed when adversary-in-the-middle (AiTM) phishing kits such as Tycoon2FA and Kali365 register Azure
AD-joined devices after capturing a victim session, in order to acquire a Primary Refresh Token (PRT) and establish
persistence. The build is hardcoded by the tooling and it is uncommon for the OS build to match this exact value across
an environment of otherwise patched hosts, where a current Windows 10 22H2 device reports a far higher
"10.0.19045.<revision>" value.
"""
false_positives = [
"""
Legitimate device registrations may coincidentally use the `10.0.19045.2006` build (Windows 10 22H2) with a default
`DESKTOP-` hostname, particularly on imaged or unmanaged Windows hosts that have not been updated. Validate against
your device inventory, expected provisioning workflows, and the registering user before escalating.
""",
"""
Authorized red team or penetration testing engagements that register devices with this OS profile will match this
rule. If this is expected, add exceptions for the specific user principal names, source IPs, or device names
involved.
""",
]
from = "now-9m"
index = ["logs-azure.auditlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID Device Registration with Phishing Kit Default OS Build"
note = """## Triage and analysis
### Investigating Entra ID Device Registration with Phishing Kit Default OS Build
AiTM phishing kits including Tycoon2FA and Kali365 register a device in Entra ID with a frozen default cloud device OS build of `10.0.19045.2006` and a default display name of `DESKTOP-<random characters>`. This build is hardcoded by the tooling and differs from the OS version of legitimate, patched hosts (a current Windows 10 22H2 device reports a much higher `10.0.19045.<revision>` value), making the build a useful indicator of kit-driven device registration. Rogue device registration is typically a precursor to Primary Refresh Token (PRT) acquisition, MFA/Conditional Access bypass, and persistent token-based access.
The matching Entra ID audit event is an `Add device` operation initiated by the `Device Registration Service`, where the modified properties record the registered device characteristics:
- `azure.auditlogs.properties.target_resources.0.modified_properties.3` (`CloudDeviceOSVersion`) = `10.0.19045.2006`
- `azure.auditlogs.properties.target_resources.0.modified_properties.4` (`CloudDisplayName`) = `DESKTOP-*`
### Possible investigation steps
- Confirm the registering identity via `azure.auditlogs.properties.initiated_by.user.userPrincipalName` and determine whether that user is expected to register a new device.
- Review `azure.auditlogs.identity` to confirm the `Device Registration Service` initiated the request, and use `azure.correlation_id` to pivot across the full registration flow (`Add device`, `Add registered users to device`, `Add registered owner to device`).
- Inspect the device name in `azure.auditlogs.properties.target_resources.0.display_name`; kit-registered names are commonly `DESKTOP-` followed by 6 alphanumeric (Tycoon2FA) or 6 hexadecimal (Kali365) characters.
- Inspect the registration user agent on the paired `Register device` event (`azure.auditlogs.properties.userAgent`), which is frequently a spoofed `Dsreg/10.0 (Windows 10.0.19045.2006)` string or a raw HTTP client such as `axios/*` or `python-requests/*`.
- Check whether the same user registered multiple devices in a short window (a single piece of kit infrastructure registering several devices is common for PRT persistence at scale).
- Review `azure.auditlogs.properties.initiated_by.user.ipAddress` and geolocation for the registration source. Flag unexpected IPs, hosting/VPS ASNs (for example Tencent or Alibaba), or impossible-travel relative to the user's normal activity.
- Pivot to `azure.signinlogs` for the same user and timeframe and look for follow-on sign-ins where the incoming token type is a `primaryRefreshToken`, for AiTM sign-ins immediately preceding the registration, or for the broker subsequently minting tokens for other resources such as Microsoft Graph.
### False positive analysis
- Unmanaged or never-patched Windows 10 22H2 hosts may legitimately present the `10.0.19045.2006` build with a default `DESKTOP-` hostname. Validate against device inventory and known provisioning programs.
- Authorized security assessments that register devices with this OS profile will match. Document the engagement and add scoped exceptions.
### Response and remediation
- If confirmed malicious, remove the registered device from Entra ID and revoke the user's refresh tokens and primary refresh tokens. Remove the device BEFORE revoking sessions, because device-bound PRTs survive `revokeSignInSessions`.
- Disable the account or reset credentials per policy and review for additional persistence (attacker-registered MFA methods, added owners, app registrations, or service principal credentials).
- Conduct historical analysis using `azure.correlation_id` and the registering user to determine scope of access.
- Tighten device registration and join controls via Conditional Access (restrict who can register/join devices and require MFA for registration).
"""
references = [
"https://any.run/malware-trends/tycoon/",
"https://www.huntress.com/blog/kali365-device-code-phishing-kit",
"https://any.run/malware-trends/kali365/",
"https://arcticwolf.com/resources/blog/token-bingo-dont-let-your-code-be-the-winner/",
"https://www.ic3.gov/PSA/2026/PSA260521",
]
risk_score = 47
rule_id = "82629eed-5516-446e-ad73-03b8c4f4d571"
severity = "medium"
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",
"Use Case: Threat Detection",
"Threat: Tycoon2FA",
"Threat: Kali365",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:"azure.auditlogs" and event.action:"Add device" and
azure.auditlogs.properties.target_resources.0.modified_properties.3.new_value:*10.0.19045.2006* and
azure.auditlogs.properties.target_resources.0.modified_properties.4.new_value:*DESKTOP-*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.005"
name = "Device Registration"
reference = "https://attack.mitre.org/techniques/T1098/005/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"event.action",
"event.outcome",
"azure.auditlogs.identity",
"azure.auditlogs.operation_name",
"azure.auditlogs.properties.target_resources.0.display_name",
"azure.auditlogs.properties.target_resources.0.modified_properties.3.new_value",
"azure.auditlogs.properties.target_resources.0.modified_properties.4.new_value",
"azure.auditlogs.properties.initiated_by.user.userPrincipalName",
"azure.auditlogs.properties.initiated_by.user.ipAddress",
"azure.correlation_id",
]
Stages and Predicates
Stage 1: query
data_stream.dataset:"azure.auditlogs" and event.action:"Add device" and
azure.auditlogs.properties.target_resources.0.modified_properties.3.new_value:*10.0.19045.2006* and
azure.auditlogs.properties.target_resources.0.modified_properties.4.new_value:*DESKTOP-*
Indicators
These rows show field, operator, and value matches.
Execution via OpenClaw Agent
#Detects suspicious child process execution from the OpenClaw, Moltbot, or Clawdbot AI coding agents running via Node.js. These tools can execute arbitrary shell commands through skills or prompt injection attacks. Malicious skills from public registries like ClawHub have been observed executing obfuscated download-and-execute commands targeting cryptocurrency wallets and credentials. This rule identifies shells, scripting interpreters, and common LOLBins spawned by these AI agents.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2026/02/02"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/04/07"
[rule]
author = ["Elastic"]
description = """
Detects suspicious child process execution from the OpenClaw, Moltbot, or Clawdbot AI coding agents running via Node.js.
These tools can execute arbitrary shell commands through skills or prompt injection attacks. Malicious skills from
public registries like ClawHub have been observed executing obfuscated download-and-execute commands targeting
cryptocurrency wallets and credentials. This rule identifies shells, scripting interpreters, and common LOLBins spawned
by these AI agents.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Execution via OpenClaw Agent"
note = """## Triage and analysis
### Investigating Execution via OpenClaw Agent
OpenClaw (formerly Clawdbot, rebranded to Moltbot) is a personal AI coding assistant that can execute shell commands
and scripts on behalf of users. Malicious actors have weaponized the skill ecosystem (ClawHub) to distribute skills
that execute download-and-execute commands, targeting cryptocurrency wallets and credentials.
### Possible investigation steps
- Verify if OpenClaw/Moltbot is an approved application in your organization.
- Review the child process command line for indicators of malicious activity (encoded payloads, remote downloads, credential access).
- Check the parent Node.js process command line to identify which OpenClaw component initiated the execution.
- Examine recently installed skills from ClawHub for malicious or obfuscated code.
- Correlate with network events to identify data exfiltration or C2 communication.
- Review the user's AI conversation history for prompt injection attempts.
### False positive analysis
- Developers legitimately using OpenClaw/Moltbot for AI-assisted coding may trigger this rule when the AI executes build scripts, curl commands, or other legitimate automation.
- If the tool is approved, consider tuning based on specific command patterns or adding exception lists.
### Response and remediation
- If the child process activity appears malicious, terminate the OpenClaw gateway and investigate the skill that initiated the command.
- Review and remove any suspicious skills from the OpenClaw configuration.
- If credentials may have been accessed, rotate affected secrets and API keys.
- Block known typosquat domains (moltbot.you, clawbot.ai, clawdbot.you) at the network level.
"""
references = [
"https://www.malwarebytes.com/blog/threat-intel/2026/01/clawdbots-rename-to-moltbot-sparks-impersonation-campaign",
"https://www.tomshardware.com/tech-industry/cyber-security/malicious-moltbot-skill-targets-crypto-users-on-clawhub",
"https://blogs.cisco.com/ai/personal-ai-agents-like-openclaw-are-a-security-nightmare",
"https://blog.virustotal.com/2026/02/from-automation-to-infection-how.html",
]
risk_score = 47
rule_id = "a7c3e8f2-4b19-4d6a-9e5c-8f1a2b3c4d5e"
severity = "medium"
tags = [
"Domain: Endpoint",
"Domain: LLM",
"OS: Linux",
"OS: macOS",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Command and Control",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and
process.parent.name : ("node", "node.exe") and
process.parent.command_line : ("*openclaw*", "*moltbot*", "*clawdbot*") and
process.name : ("bash", "sh", "zsh", "bash.exe", "cmd.exe", "powershell.exe", "curl.exe", "curl", "base64", "xattr", "osascript", "python*", "chmod", "certutil.exe", "rundll32.exe") and
not process.args in (
"ip neigh show",
"arp -a -n -l",
"ip neighbor show dev wlan0",
"ip neighbor show dev eth0",
"arp -a | findstr /C:---"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[rule.threat.technique.subtechnique]]
id = "T1059.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[[rule.threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[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.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 = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where event.type == "start" and
process.parent.name : ("node", "node.exe") and
process.parent.command_line : ("*openclaw*", "*moltbot*", "*clawdbot*") and
process.name : ("bash", "sh", "zsh", "bash.exe", "cmd.exe", "powershell.exe", "curl.exe", "curl", "base64", "xattr", "osascript", "python*", "chmod", "certutil.exe", "rundll32.exe") and
not process.args in (
"ip neigh show",
"arp -a -n -l",
"ip neighbor show dev wlan0",
"ip neighbor show dev eth0",
"arp -a | findstr /C:---"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | in | arp -a -n -l, arp -a | findstr /C:---, ip neigh show, ip neighbor show dev eth0, ip neighbor show dev wlan0 | excludes:process.args |
GCP Storage Bucket Configuration Modification
#Identifies when the configuration is modified for a storage bucket in Google Cloud Platform (GCP). An adversary may modify the configuration of a storage bucket in order to weaken the security controls of their target's environment.
Known False Positives
- Storage bucket configuration may be modified by system administrators. Verify that the configuration change was expected. Exceptions can be added to this rule to filter expected behavior.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| GCP | storage.buckets.update: Update bucket metadata |
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
creation_date = "2020/09/22"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies when the configuration is modified for a storage bucket in Google Cloud Platform (GCP). An adversary may
modify the configuration of a storage bucket in order to weaken the security controls of their target's environment.
"""
false_positives = [
"""
Storage bucket configuration may be modified by system administrators. Verify that the configuration change was
expected. Exceptions can be added to this rule to filter expected behavior.
""",
]
index = ["filebeat-*", "logs-gcp*"]
language = "kuery"
license = "Elastic License v2"
name = "GCP Storage Bucket Configuration 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 GCP Storage Bucket Configuration Modification
Google Cloud Platform (GCP) storage buckets are essential for storing and managing data in the cloud. Adversaries may alter bucket configurations to weaken security, enabling unauthorized access or data exfiltration. The detection rule monitors audit logs for successful configuration changes, flagging potential defense evasion attempts by identifying suspicious modifications to storage settings.
### Possible investigation steps
- Review the audit logs for the specific event.action "storage.buckets.update" to identify the user or service account responsible for the configuration change.
- Examine the event.outcome field to confirm the success of the configuration modification and gather details on what specific changes were made to the storage bucket settings.
- Investigate the context of the change by checking the timestamp of the event to determine if it aligns with any known maintenance or deployment activities.
- Assess the permissions and roles of the user or service account involved in the modification to ensure they have the appropriate level of access and determine if any privilege escalation occurred.
- Cross-reference the modified bucket's configuration with security policies and best practices to identify any potential security weaknesses introduced by the change.
- Check for any other recent suspicious activities or alerts related to the same user or service account to identify patterns of potentially malicious behavior.
- If unauthorized changes are suspected, initiate a response plan to revert the configuration to its previous state and strengthen access controls to prevent future incidents.
### False positive analysis
- Routine administrative updates to storage bucket configurations by authorized personnel can trigger alerts. To manage this, maintain a list of known administrators and their typical activities, and create exceptions for these actions in the monitoring system.
- Automated processes or scripts that regularly update bucket configurations for maintenance or compliance purposes may cause false positives. Identify these processes and exclude their actions from triggering alerts by using service accounts or specific identifiers.
- Changes made by cloud management tools or third-party services integrated with GCP might be flagged. Review and whitelist these tools if they are verified and necessary for operations.
- Scheduled updates or configuration changes as part of regular security audits can appear suspicious. Document these schedules and incorporate them into the monitoring system to prevent unnecessary alerts.
- Temporary configuration changes for testing or development purposes might be misinterpreted as threats. Ensure that such activities are logged and communicated to the security team to adjust monitoring rules accordingly.
### Response and remediation
- Immediately revoke any unauthorized access to the affected GCP storage bucket by reviewing and adjusting IAM policies to ensure only legitimate users have access.
- Conduct a thorough review of recent bucket configuration changes to identify any unauthorized modifications and revert them to their original secure state.
- Isolate the affected storage bucket from the network if suspicious activity is detected, to prevent further unauthorized access or data exfiltration.
- Notify the security operations team and relevant stakeholders about the incident for further investigation and to ensure coordinated response efforts.
- Implement additional logging and monitoring on the affected bucket to detect any further unauthorized access attempts or configuration changes.
- Review and update security policies and access controls for all GCP storage buckets to prevent similar incidents in the future.
- Escalate the incident to the cloud security team for a comprehensive analysis and to determine if further action is required, such as involving legal or compliance teams.
## Setup
The GCP Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = ["https://cloud.google.com/storage/docs/key-terms#buckets"]
risk_score = 47
rule_id = "97359fd8-757d-4b1d-9af1-ef29e4a8680e"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Use Case: Identity and Access Audit",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:gcp.audit and event.action:"storage.buckets.update" and event.outcome:success
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1578"
name = "Modify Cloud Compute Infrastructure"
reference = "https://attack.mitre.org/techniques/T1578/"
[[rule.threat.technique.subtechnique]]
id = "T1578.005"
name = "Modify Cloud Compute Configurations"
reference = "https://attack.mitre.org/techniques/T1578/005/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
data_stream.dataset:gcp.audit and event.action:"storage.buckets.update" and event.outcome:success
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"gcp.audit" |
event.action | eq |
| field:"EventType" kind:eq value:"storage.buckets.update" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
GKE Certificate Signing Request API Client Signer Requested
#Detects creation of a GKE CertificateSigningRequest (CSR) that requests the kubernetes.io/kube-apiserver-client signer. This signer issues general API client certificates with few subject restrictions, unlike the restricted kubelet signers used for node certificate rotation. Attackers with CSR permissions use this signer to mint long-lived credentials for privileged identities such as system:kube-controller-manager, enabling persistence and privilege escalation that survives token revocation and RBAC changes.
Known False Positives
- Custom PKI or administrative tooling may legitimately request kubernetes.io/kube-apiserver-client certificates in self-managed clusters. Baseline approved operators and tune exclusions for known automation on GKE.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Kubernetes | create-certificatesigningrequests: create certificatesigningrequests |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure AKS Certificate Signing Request Created or Approved (Elastic)
- GKE Certificate Signing Request for Privileged Identity (Elastic)
- GKE Certificate Signing Request Self-Approved (Elastic)
- GKE Client Certificate Signing Request Created or Approved (Elastic)
- Kubernetes Client Certificate Credential Created (Panther)
- Kubernetes Client Certificate Signing Request Created or Approved (Elastic)
Rule Body
[metadata]
creation_date = "2026/07/10"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/07/10"
[rule]
author = ["Elastic"]
description = """
Detects creation of a GKE CertificateSigningRequest (CSR) that requests the kubernetes.io/kube-apiserver-client signer.
This signer issues general API client certificates with few subject restrictions, unlike the restricted kubelet signers
used for node certificate rotation. Attackers with CSR permissions use this signer to mint long-lived credentials for
privileged identities such as system:kube-controller-manager, enabling persistence and privilege escalation that survives
token revocation and RBAC changes.
"""
false_positives = [
"""
Custom PKI or administrative tooling may legitimately request kubernetes.io/kube-apiserver-client certificates in
self-managed clusters. Baseline approved operators and tune exclusions for known automation on GKE.
""",
]
from = "now-6m"
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE Certificate Signing Request API Client Signer Requested"
note = """## Triage and analysis
### Investigating GKE Certificate Signing Request API Client Signer Requested
Identify the actor (`client.user.email`), `source.ip`, and `user_agent.original`. Legitimate GKE node certificate
rotation uses `kubernetes.io/kube-apiserver-client-kubelet` or `kubernetes.io/kubelet-serving` — not this signer.
Review `gcp.audit.request.spec.signerName` and decode `gcp.audit.request.spec.request` when present to extract the
requested Common Name (CN).
```bash
# Full decoded PEM block
echo "<gcp.audit.request.spec.request>" | base64 -d
# Parsed CSR details (subject, key type/size, extensions, signature)
echo "<gcp.audit.request.spec.request>" | base64 -d | openssl req -noout -text
# Subject only
echo "<gcp.audit.request.spec.request>" | base64 -d | openssl req -noout -subject
```
### Possible investigation steps
- Confirm whether the principal is authorized to request API client certificates and whether the activity aligns with
approved PKI workflows.
- Decode `gcp.audit.request.spec.request` and inspect the CSR subject for privileged identities such as
`system:masters`, `system:kube-controller-manager`, or `system:admin`.
- Correlate with CSR approval or patch activity on the same `gcp.audit.resource_name` and follow-on API access from
unusual networks.
- Review RBAC grants on `certificatesigningrequests` create and `certificatesigningrequests/approval` for the actor.
### False positive analysis
- Custom PKI or admin workflows may legitimately use this signer outside kube-system. Baseline and tune for known
operators.
### Related rules
- GKE Certificate Signing Request Privileged Identity Requested - 4159bec9-76ad-4cdc-a797-4a8572073bbe
- GKE Certificate Signing Request Self-Approved - e155e658-3dcd-4d27-a4e5-1d8da6704b0e
- GKE Client Certificate Signing Request Created or Approved - ec67ab57-945a-4edb-84f8-1d7a51f46544
### Response and remediation
- Deny or delete suspicious CSRs, rotate cluster signing trust if abused, and remove excessive CSR RBAC from untrusted
identities.
"""
setup = "The GCP Fleet integration with GKE audit logs enabled is required. Request body capture for CSR create events (`gcp.audit.request.spec.signerName`) typically requires RequestResponse audit level on CertificateSigningRequest resources."
references = [
"https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/",
"https://kubernetes.io/docs/concepts/security/rbac-good-practices/",
"https://www.aquasec.com/blog/kubernetes-rbac-privilige-escalation/",
"https://stratus-red-team.cloud/attack-techniques/kubernetes/k8s.persistence.create-client-certificate/",
]
risk_score = 73
rule_id = "1e344fba-a2f7-462b-aaec-d6c8f80d5a28"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Kubernetes",
"Data Source: GCP",
"Data Source: GCP Audit Logs",
"Data Source: Google Cloud Platform",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:"gcp.audit" and service.name:"k8s.io" and event.outcome:"success" and
event.action:"io.k8s.certificates.v1.certificatesigningrequests.create" and
gcp.audit.request.spec.signerName:"kubernetes.io/kube-apiserver-client" and
not client.user.email:(
"system:gcp-controller-manager" or
"system:serviceaccount:kube-system:certificate-controller"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.006"
name = "Additional Container Cluster Roles"
reference = "https://attack.mitre.org/techniques/T1098/006/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.006"
name = "Additional Container Cluster Roles"
reference = "https://attack.mitre.org/techniques/T1098/006/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"client.user.email",
"source.ip",
"user_agent.original",
"event.action",
"event.outcome",
"gcp.audit.resource_name",
"gcp.audit.request.spec.signerName",
"gcp.audit.request.spec.request",
"data_stream.namespace",
]
Stages and Predicates
Stage 1: query
data_stream.dataset:"gcp.audit" and service.name:"k8s.io" and event.outcome:"success" and
event.action:"io.k8s.certificates.v1.certificatesigningrequests.create" and
gcp.audit.request.spec.signerName:"kubernetes.io/kube-apiserver-client" and
not client.user.email:(
"system:gcp-controller-manager" or
"system:serviceaccount:kube-system:certificate-controller"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"gcp.audit" |
event.action | eq |
| field:"EventType" kind:eq value:"io.k8s.certificates.v1.certificatesigningrequests.create" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
gcp.audit.request.spec.signerName | eq |
| field:"gcp.audit.request.spec.signerName" kind:eq value:"kubernetes.io/kube-apiserver-client" |
service.name | eq |
| field:"ServiceName" kind:eq value:"k8s.io" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
client.user.email | in | system:gcp-controller-manager, system:serviceaccount:kube-system:certificate-controller | excludes:client.user.email field:"client.user.email" value:"system:gcp-controller-manager" field:"client.user.email" value:"system:serviceaccount:kube-system:certificate-controller" |
Google Workspace 2SV Policy Disabled By User
#Detects when a Google Workspace user disables 2-step verification (2SV) on their account. An adversary with access to a compromised account may remove 2SV to eliminate the second authentication factor, leaving password-only access and making future sign-ins easier to abuse, relay, or maintain without triggering MFA challenges.
Known False Positives
- Administrators may remove 2-step verification (2SV) temporarily for testing or during maintenance. If 2SV was previously enabled, it is not common to disable this policy for extended periods of time.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Credential Access |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- GSuite User Two Step Verification Change (Panther)
Rule Body
[metadata]
creation_date = "2022/08/26"
integration = ["google_workspace"]
maturity = "production"
updated_date = "2026/07/08"
[rule]
author = ["Elastic"]
description = """
Detects when a Google Workspace user disables 2-step verification (2SV) on their account. An adversary with access to a
compromised account may remove 2SV to eliminate the second authentication factor, leaving password-only access and
making future sign-ins easier to abuse, relay, or maintain without triggering MFA challenges.
"""
false_positives = [
"""
Administrators may remove 2-step verification (2SV) temporarily for testing or during maintenance. If 2SV was
previously enabled, it is not common to disable this policy for extended periods of time.
""",
]
from = "now-190m"
index = ["filebeat-*", "logs-google_workspace.login-*", "logs-google_workspace.user_accounts-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "Google Workspace 2SV Policy Disabled By User"
note = """## Triage and analysis
### Investigating Google Workspace 2SV Policy Disabled By User
Threat actors who compromise a Google Workspace account may disable 2-step verification (2SV) on that account to remove
the second authentication factor. With 2SV turned off, the account falls back to password-only authentication, which can
support session abuse, AiTM credential relay, and sustained access without MFA challenges on future sign-ins. This is
especially concerning for administrators, executives, and users with access to sensitive mail, data, or admin functions.
In AiTM and session-hijacking scenarios, an attacker with an active session may disable 2SV before the legitimate user
notices, making it easier to re-enter the account later using stolen credentials alone.
This rule identifies when a user disables 2SV on their account via the `2sv_disable` event. The event appears in
both the `google_workspace.login` and `google_workspace.user_accounts` data streams; alert suppression groups by
`user.email` and `source.ip` within the rule lookback to avoid duplicate alerts when both streams are ingested.
### Possible investigation steps
- Identify the user account that disabled 2SV by reviewing `user.email` or `user.name`, and note the `source.ip` and `event.ingested` timestamps.
- Determine the account's privilege and data access — prioritize triage if the user is an administrator, holds delegated admin roles, or has access to sensitive resources.
- Determine whether the disable is expected or unauthorized:
- Validate with the user or their manager whether they intentionally turned off 2SV (for example, device replacement).
- If the `source.ip`, geolocation, or timing is unusual for the user, treat the alert as higher priority until proven benign.
- Search Kibana for precursor and follow-on account changes for the same `user.email` in the hours before and after the alert:
- `password_edit`, `recovery_email_edit`, `recovery_phone_edit` in `google_workspace.login` or `google_workspace.user_accounts`
- `login_success`, `login_failure`, `suspicious_login`, and `login_challenge` in `google_workspace.login`
- OAuth activity in `google_workspace.token` if token abuse is suspected
- Review `google_workspace.login.challenge_method` on recent sign-ins to determine whether MFA was used, bypassed, or relayed before 2SV was disabled.
### False positive analysis
- Legitimate users may disable 2SV temporarily, but this weakens the account — confirm the change was authorized even when the actor appears benign.
### Response and remediation
- Initiate the incident response process based on triage findings.
- If the disable is not clearly authorized, re-enable 2SV on the affected account, reset the password, and revoke active sessions while the investigation proceeds.
- 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.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://support.google.com/a/answer/7587183) by Google.
- 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 190 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.
- 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) for Filebeat and 3 hours for the Fleet Integration `login` datastream. 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/9176657?hl=en",
"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 = 73
rule_id = "5e161522-2545-11ed-ac47-f661ea17fbce"
severity = "high"
tags = [
"Domain: Cloud",
"Data Source: Google Workspace",
"Use Case: Configuration Audit",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:("google_workspace.login" or "google_workspace.user_accounts") and event.action:"2sv_disable"
'''
[rule.alert_suppression]
group_by = ["user.email", "source.ip"]
duration = {value = 130, unit = "m"}
missing_fields_strategy = "suppress"
[rule.investigation_fields]
field_names = [
"user.name",
"user.email",
"source.ip",
"event.action",
]
[[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 = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
data_stream.dataset:("google_workspace.login" or "google_workspace.user_accounts") and event.action:"2sv_disable"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | in |
| field:"data_stream.dataset" kind:in |
event.action | eq |
| field:"EventType" kind:eq value:"2sv_disable" |
Incoming DCOM Lateral Movement with ShellBrowserWindow or ShellWindows
#Identifies use of Distributed Component Object Model (DCOM) to run commands from a remote host, which are launched via the ShellBrowserWindow or ShellWindows Application COM Object. This behavior may indicate an attacker abusing a DCOM application to stealthily move laterally.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/11/06"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies use of Distributed Component Object Model (DCOM) to run commands from a remote host, which are launched via
the ShellBrowserWindow or ShellWindows Application COM Object. This behavior may indicate an attacker abusing a DCOM
application to stealthily move laterally.
"""
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.process-*",
"logs-endpoint.events.network-*",
"logs-windows.sysmon_operational-*",
]
language = "eql"
license = "Elastic License v2"
name = "Incoming DCOM Lateral Movement with ShellBrowserWindow or ShellWindows"
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 Incoming DCOM Lateral Movement with ShellBrowserWindow or ShellWindows
DCOM enables software components to communicate over a network, often used in Windows environments for legitimate inter-process communication. Adversaries exploit DCOM, particularly ShellBrowserWindow or ShellWindows, to execute commands remotely, facilitating stealthy lateral movement. The detection rule identifies suspicious network activity and process creation patterns, such as incoming TCP connections to high ports and explorer.exe spawning processes, which may indicate DCOM abuse.
### Possible investigation steps
- Review the network activity to identify the source IP address of the incoming TCP connection. Verify if the source IP is known or expected within the network environment.
- Examine the process tree for explorer.exe to identify any unusual or unexpected child processes that were spawned. Investigate these processes for any signs of malicious activity.
- Check the destination port and source port numbers to determine if they are commonly used for legitimate services or if they are unusual for the environment.
- Correlate the event with other security logs or alerts to identify any additional suspicious activities or patterns associated with the same source IP or process entity.
- Investigate the user account associated with the explorer.exe process to determine if there are any signs of compromise or unauthorized access.
- Review historical data for any previous occurrences of similar network connections or process creations to identify potential patterns or repeated attempts.
### False positive analysis
- Legitimate software updates or installations may trigger the rule due to the use of DCOM for remote management tasks. Users can create exceptions for known update processes by identifying their specific network and process patterns.
- Internal IT management tools that utilize DCOM for remote administration might cause false positives. Review and whitelist these tools by confirming their source IP addresses and process behaviors.
- Automated scripts or scheduled tasks that leverage DCOM for legitimate purposes can be mistaken for lateral movement. Document and exclude these tasks by correlating their execution times and process chains.
- Network scanning or monitoring tools that generate high-port TCP connections could be misinterpreted as suspicious activity. Validate and exclude these tools by cross-referencing their network traffic with known benign sources.
- User-initiated remote desktop sessions or file transfers using DCOM may appear as lateral movement. Verify and exclude these activities by checking user authentication logs and session details.
### Response and remediation
- Isolate the affected host immediately from the network to prevent further lateral movement and potential data exfiltration.
- Terminate any suspicious processes spawned by explorer.exe that are not part of normal operations, focusing on those initiated through high TCP ports.
- Conduct a thorough review of recent network connections and process creation logs on the affected host to identify any additional compromised systems or lateral movement attempts.
- Reset credentials for any accounts that were active on the affected host during the time of the alert to prevent unauthorized access.
- Apply patches and updates to the affected systems to address any vulnerabilities that may have been exploited during the attack.
- Enhance monitoring and logging on the network to detect similar DCOM abuse attempts, ensuring that alerts are configured for high TCP port activity and unusual process spawning by explorer.exe.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional containment or remediation actions are necessary."""
references = ["https://enigma0x3.net/2017/01/23/lateral-movement-via-dcom-round-2/"]
risk_score = 47
rule_id = "8f919d4b-a5af-47ca-a594-6be59cd924a4"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id with maxspan=5s
[network where host.os.type == "windows" and event.type == "start" and process.name : "explorer.exe" and
network.direction : ("incoming", "ingress") and network.transport == "tcp" and
source.port > 49151 and destination.port > 49151 and source.ip != "127.0.0.1" and source.ip != "::1"
] by process.entity_id
[process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "explorer.exe"
] by process.parent.entity_id
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Sysmon Event ID 3 - Network Connection](https://ela.st/sysmon-event-3-setup)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[rule.threat.technique.subtechnique]]
id = "T1021.003"
name = "Distributed Component Object Model"
reference = "https://attack.mitre.org/techniques/T1021/003/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1559"
name = "Inter-Process Communication"
reference = "https://attack.mitre.org/techniques/T1559/"
[[rule.threat.technique.subtechnique]]
id = "T1559.001"
name = "Component Object Model"
reference = "https://attack.mitre.org/techniques/T1559/001/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5s, correlated by host.id, process.entity_id, process.parent.entity_id.
Stage 1: network
[network where host.os.type == "windows" and event.type == "start" and process.name : "explorer.exe" and
network.direction : ("incoming", "ingress") and network.transport == "tcp" and
source.port > 49151 and destination.port > 49151 and source.ip != "127.0.0.1" and source.ip != "::1"
] by process.entity_id
Stage 2: process
[process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "explorer.exe"
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | gt |
| field:"DestinationPort" kind:gt value:"49151" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
network.direction | wildcard |
| field:"Initiated" kind:wildcard |
network.transport | eq |
| field:"Protocol" kind:eq value:"tcp" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"explorer.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"explorer.exe" |
source.ip | ne |
| field:"src_ip" kind:ne |
source.port | gt |
| field:"SourcePort" kind:gt value:"49151" |
Network Connections Initiated Through XDG Autostart Entry
#Detects network connections initiated through Cross-Desktop Group (XDG) autostart entries for GNOME and XFCE-based Linux distributions. XDG Autostart entries can be used to execute arbitrary commands or scripts when a user logs in. This rule helps to identify potential malicious activity where an attacker may have modified XDG autostart scripts to establish persistence on the system.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence |
Rule Body
[metadata]
creation_date = "2024/06/03"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects network connections initiated through Cross-Desktop Group (XDG) autostart entries for GNOME and XFCE-based Linux
distributions. XDG Autostart entries can be used to execute arbitrary commands or scripts when a user logs in. This rule
helps to identify potential malicious activity where an attacker may have modified XDG autostart scripts to establish
persistence on the system.
"""
from = "now-9m"
index = ["logs-endpoint.events.network*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Network Connections Initiated Through XDG Autostart Entry"
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 Connections Initiated Through XDG Autostart Entry
XDG Autostart entries are used in GNOME and XFCE Linux environments to automatically execute scripts or applications upon user login, facilitating user convenience. However, adversaries can exploit this feature to maintain persistence by modifying these entries to initiate unauthorized network connections. The detection rule identifies such malicious activity by monitoring processes linked to XDG autostart and subsequent suspicious network connections, excluding known benign processes and internal IP ranges.
### Possible investigation steps
- Review the process details from the alert, focusing on the process.entity_id and process.executable fields to identify the specific application or script that was executed through the XDG autostart entry.
- Examine the parent process information, particularly the process.parent.executable field, to confirm if the process was initiated by a legitimate session manager like /usr/bin/xfce4-session.
- Investigate the network connection details, paying attention to the destination.ip field to determine if the connection was attempted to an external or suspicious IP address not covered by the internal IP ranges specified in the query.
- Check the process.args field for any unusual or unexpected command-line arguments that might indicate malicious intent or unauthorized modifications to the autostart entry.
- Correlate the alert with other security events or logs from the same host.id to identify any additional suspicious activities or patterns that might suggest a broader compromise or persistence mechanism.
- Validate the legitimacy of the process.executable by comparing it against known benign applications listed in the query, such as /usr/lib64/firefox/firefox, to rule out false positives.
### False positive analysis
- Network connections from legitimate applications like Firefox or FortiClient may trigger false positives. To handle this, add these applications to the exclusion list in the detection rule.
- Internal network traffic within known safe IP ranges can be mistakenly flagged. Ensure these IP ranges are included in the exclusion criteria to prevent unnecessary alerts.
- Custom scripts or applications that are part of the user's normal login process might be misidentified. Review and whitelist these processes if they are verified as non-threatening.
- Regular updates or maintenance tasks that initiate network connections during login can cause false alerts. Identify these tasks and adjust the rule to exclude them if they are part of routine operations.
### Response and remediation
- Immediately isolate the affected host from the network to prevent further unauthorized network connections and potential lateral movement.
- Terminate any suspicious processes identified as being initiated through XDG autostart entries to halt any ongoing malicious activity.
- Review and remove any unauthorized or suspicious XDG autostart entries to eliminate persistence mechanisms established by the attacker.
- Conduct a thorough scan of the affected system for additional indicators of compromise, such as unauthorized user accounts or modified system files, to ensure comprehensive remediation.
- Restore any altered system configurations or files from a known good backup to ensure system integrity and functionality.
- Escalate the incident to the security operations team for further analysis and to determine if additional systems may be affected.
- Implement enhanced monitoring and logging for XDG autostart entries and network connections to detect similar threats in the future and improve overall security posture."""
references = [
"https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html",
"https://hadess.io/the-art-of-linux-persistence/",
"https://www.elastic.co/security-labs/primer-on-persistence-mechanisms",
]
risk_score = 47
rule_id = "dd52d45a-4602-4195-9018-ebe0f219c273"
setup = """## Setup
This rule requires data coming in from one of the following integrations:
- Elastic Defend
- Auditbeat
### 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).
### Auditbeat Setup
Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.
#### The following steps should be executed in order to add the Auditbeat on a Linux System:
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html).
- To run Auditbeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html).
- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).
#### Custom Ingest Pipeline
For versions <8.2, you need to add a custom ingest pipeline to populate `event.ingested` with @timestamp for non-elastic-agent indexes, like auditbeats/filebeat/winlogbeat etc. For more details to add a custom ingest pipeline refer to the [guide](https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence by host.id, process.entity_id with maxspan=1s
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
(process.parent.executable == "/usr/bin/xfce4-session") or
(process.executable == "/bin/sh" and process.args == "-e" and process.args == "-u" and
process.args == "-c" and process.args : "export GIO_LAUNCHED_DESKTOP_FILE_PID=$$;*")
)
]
[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.name in (
"telegram-desktop", "firefox", "gnome-calculator", "remmina", "spotify", "librewolf", "fortitraylauncher",
"flameshot", "thunderbird", "update-manager", "warp-terminal", "obs", "transmission-gtk", "telegram",
"mintupdate-launcher", "firefox-bin", "xbrlapi", "gnome-software"
)
)
]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[rule.threat.technique.subtechnique]]
id = "T1547.013"
name = "XDG Autostart Entries"
reference = "https://attack.mitre.org/techniques/T1547/013/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1s, correlated by host.id, process.entity_id.
Stage 1: process
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
(process.parent.executable == "/usr/bin/xfce4-session") or
(process.executable == "/bin/sh" and process.args == "-e" and process.args == "-u" and
process.args == "-c" and process.args : "export GIO_LAUNCHED_DESKTOP_FILE_PID=$$;*")
)
]
Stage 2: network
[network where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.name in (
"telegram-desktop", "firefox", "gnome-calculator", "remmina", "spotify", "librewolf", "fortitraylauncher",
"flameshot", "thunderbird", "update-manager", "warp-terminal", "obs", "transmission-gtk", "telegram",
"mintupdate-launcher", "firefox-bin", "xbrlapi", "gnome-software"
)
)
]
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 | eq |
| field:"process.args" kind:eq |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"export GIO_LAUNCHED_DESKTOP_FILE_PID=$$;*" |
process.executable | eq |
| field:"Image" kind:eq value:"/bin/sh" |
process.parent.executable | eq |
| field:"ParentImage" kind:eq value:"/usr/bin/xfce4-session" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
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.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8, 172.31.0.0/16 | excludes:destination.ip |
destination.ip | eq | 0.0.0.0 | excludes:destination.ip field:"destination.ip" value:"0.0.0.0" |
destination.ip | is_null | excludes:destination.ip | |
process.name | in | firefox, firefox-bin, flameshot, fortitraylauncher, gnome-calculator, gnome-software, librewolf, mintupdate-launcher, obs, remmina, spotify, telegram, telegram-desktop, thunderbird, transmission-gtk, update-manager, warp-terminal, xbrlapi | excludes:process.name |
Potential Kubeletctl Execution Detected via Defend for Containers
#This rule detects the execution of kubeletctl inside a container. Kubeletctl is a command-line tool that can be used to interact with the Kubelet API directly. It allows easy access to this API, making the often undocumented Kubelet API more accessible. It is often used to enumerate the Kubelet API or other resources inside the container, and may indicate an attempt to move laterally within the pod.
Known False Positives
- There is a potential for false positives when the command line arguments looked for in this rule are used for legitimate purposes, such as debugging or troubleshooting. 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 = "2026/02/02"
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 the execution of kubeletctl inside a container. Kubeletctl is a command-line tool that can be used to
interact with the Kubelet API directly. It allows easy access to this API, making the often undocumented Kubelet API
more accessible. It is often used to enumerate the Kubelet API or other resources inside the container, and may indicate
an attempt to move laterally within the pod.
"""
false_positives = [
"""
There is a potential for false positives when the command line arguments looked for in this rule are used for legitimate purposes,
such as debugging or troubleshooting. 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 License v2"
name = "Potential Kubeletctl Execution Detected via Defend for Containers"
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 Kubeletctl Execution Detected via Defend for Containers
This detects execution of kubeletctl within a Linux container, a tool that simplifies direct access to the node’s Kubelet API. It matters because kubeletctl can expose pod and node details and enable actions that support discovery and lateral movement from a compromised container. A common attacker pattern is running `kubeletctl scan` against the Kubelet endpoint, then using `pods` or `exec/attach` to reach other workloads.
### Possible investigation steps
- Determine how an interactive shell was obtained in the container (e.g., kubectl exec, docker exec, or an app RCE) by correlating the timestamp with Kubernetes audit logs and upstream access logs for the initiating user or workload.
- Review the full kubeletctl invocation to identify the intended operation and target Kubelet endpoint (node IP/hostname and port), then validate whether that endpoint should be reachable from this pod in the cluster design.
- Correlate container network activity around the alert for connections to node addresses on Kubelet ports (commonly 10250/10255) and look for scanning patterns across multiple nodes indicating discovery or lateral movement attempts.
- Check for access to Kubernetes credentials within the container (service account token, mounted certificates, kubeconfig, cloud metadata credentials) and verify whether any were used to authenticate to the Kubelet API.
- Hunt for follow-on actions consistent with lateral movement or impact, such as kubeletctl exec/attach/portForward usage, access to other pod namespaces, or subsequent Kubernetes API activity that creates/patches workloads.
### False positive analysis
- An administrator or developer may have executed kubeletctl interactively inside the container during an incident response or troubleshooting session to enumerate pods/runningpods or validate Kubelet API connectivity, which can resemble discovery activity.
- A container image or entrypoint script that includes kubeletctl may be invoked manually for routine diagnostics (e.g., running scan/pods/cri or using --server/-s to target a node), producing an interactive exec event without malicious intent.
### Response and remediation
- Isolate the affected pod by scaling it to zero or applying a deny-all egress policy while preserving the container filesystem and process history needed to reconstruct the kubeletctl command, its target node address, and any output artifacts.
- Block and alert on pod-to-node access to the Kubelet API (typically 10250/10255) at the network layer, and rotate/revoke any Kubernetes service account tokens or kubeconfigs present in the container if kubeletctl attempted authenticated actions like exec/attach/portForward.
- Remove kubeletctl and related tooling from the image and redeploy from a known-good build, then perform node/pod hygiene by evicting/restarting the workload and checking for persistence indicators such as added binaries, modified entrypoints, or unexpected cron/init scripts.
- Recover by re-creating the workload in a clean namespace with least-privilege RBAC, validating no unauthorized pods/replicasets were created and that the service account permissions and mounts match the expected deployment spec.
- Escalate to the incident response team immediately if kubeletctl targeted multiple nodes, invoked exec/attach/portForward/run/scan, or if there is evidence of access to other namespaces or credential material (service account tokens, cloud metadata credentials) from the container.
- Harden by enforcing Pod Security Standards (no privileged pods, hostNetwork/hostPID/hostPath restrictions), restricting interactive exec into production pods, and limiting node API exposure by disabling unauthenticated Kubelet endpoints and requiring authenticated/authorized access.
"""
references = [
"https://www.cyberark.com/resources/threat-research-blog/using-kubelet-client-to-attack-the-kubernetes-cluster",
"https://github.com/cyberark/kubeletctl",
]
risk_score = 73
rule_id = "2572f7e0-7647-4c68-a42b-d3b1973deaae"
severity = "high"
tags = [
"Data Source: Elastic Defend for Containers",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Discovery",
"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 == "kubeletctl" or process.args like "*kubeletctl*") or
(process.args in ("-s", "--server") and process.args in ("run", "portForward", "scan", "attach", "exec", "pods", "runningpods", "cri", "pid2pod"))
) and
container.id like "?*"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique]]
id = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"
[rule.threat.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 == "kubeletctl" or process.args like "*kubeletctl*") or
(process.args in ("-s", "--server") and process.args in ("run", "portForward", "scan", "attach", "exec", "pods", "runningpods", "cri", "pid2pod"))
) and
container.id like "?*"
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.args | wildcard |
| field:"process.args" kind:wildcard value:"*kubeletctl*" |
process.name | eq |
| field:"process_basename" kind:eq value:"kubeletctl" |
ROT Encoded Python Script Execution
#Identifies the execution of a Python script that uses the ROT cipher for letters substitution. Adversaries may use this method to encode and obfuscate part of their malicious code in legit python packages.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2024/09/17"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Identifies the execution of a Python script that uses the ROT cipher for letters substitution. Adversaries may
use this method to encode and obfuscate part of their malicious code in legit python packages.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*", "logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "ROT Encoded Python Script Execution"
references = [
"https://www.elastic.co/security-labs/dprk-code-of-conduct",
"https://www.reversinglabs.com/blog/fake-recruiter-coding-tests-target-devs-with-malicious-python-packages"
]
risk_score = 47
rule_id = "5ab49127-b1b3-46e6-8a38-9e8512a2a363"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by process.entity_id with maxspan=1m
[process where host.os.type in ("windows", "macos") and event.type == "start" and process.name : "python*" and
not (
process.args : ("*gcloud.py", "*conda-script.py", "*compileall.py", "*.lmstudio*") or
process.parent.args : ("*gcloud.py", "*conda-script.py", "*compileall.py", "*.lmstudio*")
)]
[file where host.os.type in ("windows", "macos") and
event.action != "deletion" and process.name : "python*" and file.name : "rot_??.cpython-*.pyc*"]
'''
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 ROT Encoded Python Script Execution
ROT encoding, a simple letter substitution cipher, is often used to obfuscate Python scripts, making them harder to analyze. Adversaries exploit this by embedding ROT-encoded scripts within legitimate packages to evade detection. The detection rule identifies such activities by monitoring Python script executions and the presence of ROT-encoded compiled files, flagging potential misuse on Windows and macOS systems.
### Possible investigation steps
- Review the process entity ID to identify the specific Python process that triggered the alert and gather details such as the process start time and command line arguments.
- Examine the file path and name of the ROT-encoded compiled file (e.g., "rot_??.cpython-*.pyc") to determine its origin and whether it is part of a legitimate package or potentially malicious.
- Check the parent process of the Python script to understand how it was initiated and whether it was executed by a legitimate application or user.
- Investigate the user account associated with the process to determine if the activity aligns with their typical behavior or if it appears suspicious.
- Analyze any network connections or file modifications made by the Python process to identify potential data exfiltration or further malicious activity.
- Correlate this alert with other security events or logs from the same host to identify patterns or additional indicators of compromise.
### False positive analysis
- Legitimate development activities may trigger the rule if developers use ROT encoding for testing or educational purposes. To manage this, create exceptions for known development environments or specific user accounts involved in such activities.
- Automated scripts or tools that use ROT encoding for legitimate data processing tasks can be flagged. Identify these scripts and whitelist their execution paths or associated process names to prevent false alerts.
- Some security tools or software may use ROT encoding as part of their normal operations. Review and document these tools, then configure the detection system to exclude their known file paths or process identifiers.
- Regularly scheduled tasks or cron jobs that involve ROT-encoded files for non-malicious purposes can cause false positives. Exclude these tasks by specifying their unique identifiers or execution schedules in the detection rule settings.
### Response and remediation
- Isolate the affected system from the network to prevent further spread of potentially malicious activity.
- Terminate any running Python processes that are identified as executing ROT-encoded scripts to halt the execution of obfuscated code.
- Conduct a thorough review of the affected system to identify and remove any ROT-encoded Python files, specifically targeting files matching the pattern "rot_??.cpython-*.pyc*".
- Restore any affected systems from a known good backup to ensure the removal of any persistent threats.
- Implement application whitelisting to prevent unauthorized Python scripts from executing, focusing on blocking scripts with ROT encoding patterns.
- Escalate the incident to the security operations team for further analysis and to determine if additional systems are affected.
- Update detection mechanisms to monitor for similar ROT-encoded script activities, enhancing the ability to detect and respond to future threats."""
[[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.013"
name = "Encrypted/Encoded File"
reference = "https://attack.mitre.org/techniques/T1027/013/"
[[rule.threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.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 1m, correlated by process.entity_id.
Stage 1: process
[process where host.os.type in ("windows", "macos") and event.type == "start" and process.name : "python*" and
not (
process.args : ("*gcloud.py", "*conda-script.py", "*compileall.py", "*.lmstudio*") or
process.parent.args : ("*gcloud.py", "*conda-script.py", "*compileall.py", "*.lmstudio*")
)]
Stage 2: file
[file where host.os.type in ("windows", "macos") and
event.action != "deletion" and process.name : "python*" and file.name : "rot_??.cpython-*.pyc*"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.name | wildcard |
| field:"file.name" kind:wildcard value:"rot_??.cpython-*.pyc*" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"python*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | *gcloud.py, *conda-script.py, *compileall.py, *.lmstudio* | excludes:process.args |
process.parent.args | wildcard | *gcloud.py, *conda-script.py, *compileall.py, *.lmstudio* | excludes:process.parent.args |
SeDebugPrivilege Enabled by an Unusual Microsoft Binary
#Identifies an unusual Microsoft signed process enabling the SeDebugPrivilege required to debug and adjust the memory of a process owned by another account. This could be the result of code injection or process hollowing.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies an unusual Microsoft signed process enabling the SeDebugPrivilege required to debug and adjust the memory of
a process owned by another account. This could be the result of code injection or process hollowing.
"""
id = "ad3953d1-072a-4dcd-8d64-47353e2d52e6"
license = "Elastic License v2"
name = "SeDebugPrivilege Enabled by an Unusual Microsoft Binary"
os_list = ["windows"]
reference = [
"https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4703",
]
version = "1.0.4"
query = '''
any where event.category == "iam" and event.action == "token_right_adjusted" and
winlog.event_data.EnabledPrivilegeList == "SeDebugPrivilege" and user.id != "S-1-5-18" and winlog.event_data.EnabledPrivilegeList != "SeLockMemoryPrivilege" and
process.code_signature.subject_name in ("Microsoft Windows", "Microsoft Corporation", "Microsoft Windows Publisher") and
process.executable : "C:\\Windows\\*.exe" and endswith~(process.command_line, process.executable) and
not (process.executable : "C:\\Windows\\System32\\wbem\\WmiPrvSE.exe" and process.parent.executable : "C:\\Windows\\System32\\svchost.exe") and
not process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" and
not (process.executable : "C:\\Windows\\explorer.exe" and process.parent.executable : "C:\\Windows\\System32\\userinit.exe") and
not (process.executable : "C:\\Windows\\System32\\ServerManager.exe" and process.parent.executable : "C:\\Windows\\System32\\ServerManagerLauncher.exe")
'''
min_endpoint_version = "9.0.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "9.0.0"
Stages and Predicates
Stage 1: any
any where event.category == "iam" and event.action == "token_right_adjusted" and
winlog.event_data.EnabledPrivilegeList == "SeDebugPrivilege" and user.id != "S-1-5-18" and winlog.event_data.EnabledPrivilegeList != "SeLockMemoryPrivilege" and
process.code_signature.subject_name in ("Microsoft Windows", "Microsoft Corporation", "Microsoft Windows Publisher") and
process.executable : "C:\\Windows\\*.exe" and endswith~(process.command_line, process.executable) and
not (process.executable : "C:\\Windows\\System32\\wbem\\WmiPrvSE.exe" and process.parent.executable : "C:\\Windows\\System32\\svchost.exe") and
not process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" and
not (process.executable : "C:\\Windows\\explorer.exe" and process.parent.executable : "C:\\Windows\\System32\\userinit.exe") and
not (process.executable : "C:\\Windows\\System32\\ServerManager.exe" and process.parent.executable : "C:\\Windows\\System32\\ServerManagerLauncher.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"token_right_adjusted" |
event.category | eq |
| field:"event.category" kind:eq value:"iam" |
process.code_signature.subject_name | in |
| field:"Signature" kind:in |
process.command_line | ends_with |
| field:"CommandLine" kind:ends_with value:"process.executable" |
process.executable | wildcard |
| field:"Image" kind:wildcard value:"C:\Windows\*.exe" |
user.id | ne |
| field:"user.id" kind:ne value:"S-1-5-18" |
winlog.event_data.EnabledPrivilegeList | eq |
| field:"EnabledPrivilegeList" kind:eq value:"SeDebugPrivilege" |
winlog.event_data.EnabledPrivilegeList | ne |
| field:"EnabledPrivilegeList" kind:ne value:"SeLockMemoryPrivilege" |
Exclusions
The rule actively suppresses these predicates.
Spike in Remote File Transfers
#A machine learning job has detected an abnormal volume of remote files shared on the host indicating potential lateral movement activity. One of the primary goals of attackers after gaining access to a network is to locate and exfiltrate valuable information. Attackers might perform multiple small transfers to match normal egress activity in the network, to evade detection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Rule Body
[metadata]
creation_date = "2023/10/12"
integration = ["lmd", "endpoint"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 70
author = ["Elastic"]
description = """
A machine learning job has detected an abnormal volume of remote files shared on the host indicating potential lateral
movement activity. One of the primary goals of attackers after gaining access to a network is to locate and exfiltrate
valuable information. Attackers might perform multiple small transfers to match normal egress activity in the network,
to evade detection.
"""
from = "now-90m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "lmd_high_count_remote_file_transfer_ea"
name = "Spike in Remote File Transfers"
references = [
"https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
"https://docs.elastic.co/en/integrations/lmd",
"https://www.elastic.co/blog/detecting-lateral-movement-activity-a-new-kibana-integration",
"https://www.elastic.co/blog/remote-desktop-protocol-connections-elastic-security",
]
risk_score = 21
rule_id = "e9b0902b-c515-413b-b80b-a8dcebc81a66"
setup = """## Setup
This rule requires the `host.ip` field to be populated.
For **Elastic Defend** events on versions **8.18 and above**, this field is **disabled by default**.
If you are using **Elastic Defend**, ensure host IP collection is enabled by following the configuration steps in the
[helper guide](https://www.elastic.co/docs/solutions/security/configure-elastic-defend/configure-data-volume-for-elastic-endpoint#host-fields).
The rule requires the Lateral Movement Detection integration assets to be installed, as well as file and Windows RDP process events collected by the Elastic Defend integration.
### Lateral Movement Detection Setup
The Lateral Movement Detection integration detects lateral movement activity by identifying abnormalities in file and Windows RDP events. Anomalies are detected using Elastic's Anomaly Detection feature.
#### Prerequisite Requirements:
- Fleet is required for Lateral Movement Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- File events collected by the [Elastic Defend](https://docs.elastic.co/en/integrations/endpoint) integration.
- To install Elastic Defend, refer to the [documentation](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
#### The following steps should be executed to install assets associated with the Lateral Movement Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Lateral Movement Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
"Data Source: Elastic Defend",
"Use Case: Lateral Movement Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Lateral Movement",
"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 Spike in Remote File Transfers
Remote file transfer technologies facilitate data sharing across networks, essential for collaboration and operations. However, adversaries exploit these to move laterally within a network, often transferring data stealthily to avoid detection. The 'Spike in Remote File Transfers' detection rule leverages machine learning to identify unusual transfer volumes, signaling potential malicious activity by comparing against established network baselines.
### Possible investigation steps
- Review the alert details to identify the specific host and time frame associated with the abnormal file transfer activity.
- Analyze network logs and remote file transfer logs to determine the source and destination of the transfers, focusing on any unusual or unauthorized endpoints.
- Cross-reference the identified host with known assets and user accounts to verify if the activity aligns with expected behavior or if it involves unauthorized access.
- Investigate any associated user accounts for signs of compromise, such as unusual login times or locations, by reviewing authentication logs.
- Check for any recent changes or anomalies in the network baseline that could explain the spike in file transfers, such as new software deployments or legitimate large data migrations.
- Correlate the detected activity with other security alerts or incidents to identify potential patterns or coordinated attacks within the network.
### False positive analysis
- Regularly scheduled data backups or synchronization tasks can trigger false positives. Identify these tasks and create exceptions to prevent them from being flagged.
- Automated software updates or patch management systems may cause spikes in file transfers. Exclude these systems from the rule to reduce false alerts.
- Internal data sharing between departments for legitimate business purposes might be misidentified. Establish a baseline for these activities and adjust the detection thresholds accordingly.
- High-volume data transfers during specific business operations, such as end-of-month reporting, can be mistaken for malicious activity. Temporarily adjust the rule settings during these periods to accommodate expected increases in transfer volumes.
- Frequent file transfers from trusted external partners or vendors should be monitored and, if consistently benign, added to an allowlist to minimize unnecessary alerts.
### Response and remediation
- Isolate the affected host immediately to prevent further lateral movement and potential data exfiltration. Disconnect it from the network to contain the threat.
- Conduct a thorough analysis of the transferred files to determine if sensitive data was involved and assess the potential impact of the data exposure.
- Review and terminate any unauthorized remote access sessions or services on the affected host to prevent further exploitation.
- Reset credentials for any accounts that were used or potentially compromised during the incident to prevent unauthorized access.
- Apply security patches and updates to the affected systems to address any vulnerabilities that may have been exploited by the attackers.
- Monitor network traffic for any additional unusual remote file transfer activities, using enhanced logging and alerting to detect similar threats in the future.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to ensure comprehensive remediation efforts are undertaken."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1210"
name = "Exploitation of Remote Services"
reference = "https://attack.mitre.org/techniques/T1210/"
[[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/"
Startup Persistence from a Browser or Compression Utility Descendant
#Identifies when a process is a descendant of a browser or compression utility is writing to commonly abused persistence locations (registry run keys and startup folder). Adversaries may use this technique to maintain persistence on an endpoint.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Identifies when a process is a descendant of a browser or compression utility is writing to commonly abused persistence
locations (registry run keys and startup folder). Adversaries may use this technique to maintain persistence on an
endpoint.
"""
id = "e05ccd29-43d0-4ae4-a142-2ae4dd7b86e8"
license = "Elastic License v2"
name = "Startup Persistence from a Browser or Compression Utility Descendant"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/previous-versions/technet-magazine/ee851671(v=msdn.10)"]
version = "1.0.19"
query = '''
sequence by process.entity_id with maxspan=5m
[process where event.action == "start" and
(process.Ext.relative_file_creation_time <= 1800 or process.Ext.relative_file_name_modify_time <= 1800) and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.code_signature.status : ("errorExpired", "errorCode_endpoint*") and
/* Direct Child */
(
(process.executable : ("?:\\Users\\*\\Downloads\\*", "*\\AppData\\Local\\Temp\\*") and
process.parent.name: ("explorer.exe", "chrome.exe", "msedge.exe", "firefox.exe", "7zFM.exe", "iexplore.exe", "winrar.exe")) or
/* Descendant */
descendant of [
process where event.action == "start" and
(process.code_signature.trusted == false or process.code_signature.exists==false)
and process.parent.name: ("explorer.exe", "chrome.exe", "msedge.exe", "firefox.exe", "7zFM.exe", "iexplore.exe", "winrar.exe") and
process.executable: ("*\\Downloads\\*", "*\\AppData\\Local\\Temp\\*")
]
) and
not process.hash.sha256 :
("7a6b97bf43453c47d905c6f49e3cc6ee8b70f0e289700aa6145f40577ca7b5d4",
"cc783a04ccbca4edd06564f8ec88fe5a15f1e3bb26cec7de5e090313520d98f3",
"8654a21fb5768efef4f363ecf05399c806e10ee8dfde427cfe6aff84cacacb75",
"8b78f7325d842ad08637192efdbe564651439413a9d2d68684a7e8dcc698cc47",
"a4b66cf2a2d9889ece43f6cc930c3294a6118173b409398853b3063d66a81ec2",
"f535b2088c4d9ad4a81ef505e4e83012d26eeacc510d682ab93b5f2d3e29981a",
"821bd11693bf4b4b2b9f3c196036e1f4902abd95fb26873ea6c43e123b8c9431",
"ada6a50f5095cd88c4a19b7f05a0a6a5c95f6fe7c13731394b807d0686b5acaf",
"3d0041832e8b6f5b95cb33d286c24c53ccc9341549589ae8822c6084e8d2aa5c",
"0a16633bedf096c56cef9199b6da9cdc5cf1c01ee44c821528b92dd5a91cf1bd",
"af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393",
"38669786d00f8e21119fea05167775b3f2035439e2a8374957e42052b6896fe0",
"8eb1e2a08f299b7c7c53e03e2121d5fd073b32791092f783feb5c00a8d6f1781",
"978123c86b1cbc981770fbd8bdfc58ef4030f8d9b3adf06b71b928cc0394c073",
"d06598f2f203cec7a7a3857f727bc2ba457c1c0cef2787b90ce553407fbf8536",
"8a8d94b58aa3443b57c917ca0650ae6befe0bc293a2333ddf9bb45fb2485203c",
"b8416acb067cae9a6a04cf31c5c98c2ef72a4d2efda715b44fb76f62fcddf788",
"13a5adab078ceaefea89d2058e81d6cac41f3732d1f246bd4de6c4a0bd656d0f",
"bae22f27c12bce1faeb64b6eb733302aff5867baa8eed832397a7ce284a86ff4",
"b82eafbcc1a68dd90388d978f97ef49e899ac1d66b9e1fdcaa13404f6d7599c1",
"8a8f4f9d4273aacc25dc552ba10fd7fc17ec28c1a1f184356ae8ae53f651a6b7") and
not process.executable : ("?:\\Program Files (x86)\\*.exe", "?:\\Program Files\\*.exe")
]
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Load",
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell",
"HKEY_USERS\\*\\Environment\\UserInitMprLogonScript",
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\Shell",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Logoff\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Logon\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Shutdown\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Startup\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Ctf\\LangBarAddin\\*\\FilePath",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\*\\Exec",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Command Processor\\Autorun")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)]
'''
min_endpoint_version = "8.4.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 = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
(process.Ext.relative_file_creation_time <= 1800 or process.Ext.relative_file_name_modify_time <= 1800) and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.code_signature.status : ("errorExpired", "errorCode_endpoint*") and
(
(process.executable : ("?:\\Users\\*\\Downloads\\*", "*\\AppData\\Local\\Temp\\*") and
process.parent.name: ("explorer.exe", "chrome.exe", "msedge.exe", "firefox.exe", "7zFM.exe", "iexplore.exe", "winrar.exe")) or
descendant of [
process where event.action == "start" and
(process.code_signature.trusted == false or process.code_signature.exists==false)
and process.parent.name: ("explorer.exe", "chrome.exe", "msedge.exe", "firefox.exe", "7zFM.exe", "iexplore.exe", "winrar.exe") and
process.executable: ("*\\Downloads\\*", "*\\AppData\\Local\\Temp\\*")
]
) and
not process.hash.sha256 :
("7a6b97bf43453c47d905c6f49e3cc6ee8b70f0e289700aa6145f40577ca7b5d4",
"cc783a04ccbca4edd06564f8ec88fe5a15f1e3bb26cec7de5e090313520d98f3",
"8654a21fb5768efef4f363ecf05399c806e10ee8dfde427cfe6aff84cacacb75",
"8b78f7325d842ad08637192efdbe564651439413a9d2d68684a7e8dcc698cc47",
"a4b66cf2a2d9889ece43f6cc930c3294a6118173b409398853b3063d66a81ec2",
"f535b2088c4d9ad4a81ef505e4e83012d26eeacc510d682ab93b5f2d3e29981a",
"821bd11693bf4b4b2b9f3c196036e1f4902abd95fb26873ea6c43e123b8c9431",
"ada6a50f5095cd88c4a19b7f05a0a6a5c95f6fe7c13731394b807d0686b5acaf",
"3d0041832e8b6f5b95cb33d286c24c53ccc9341549589ae8822c6084e8d2aa5c",
"0a16633bedf096c56cef9199b6da9cdc5cf1c01ee44c821528b92dd5a91cf1bd",
"af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393",
"38669786d00f8e21119fea05167775b3f2035439e2a8374957e42052b6896fe0",
"8eb1e2a08f299b7c7c53e03e2121d5fd073b32791092f783feb5c00a8d6f1781",
"978123c86b1cbc981770fbd8bdfc58ef4030f8d9b3adf06b71b928cc0394c073",
"d06598f2f203cec7a7a3857f727bc2ba457c1c0cef2787b90ce553407fbf8536",
"8a8d94b58aa3443b57c917ca0650ae6befe0bc293a2333ddf9bb45fb2485203c",
"b8416acb067cae9a6a04cf31c5c98c2ef72a4d2efda715b44fb76f62fcddf788",
"13a5adab078ceaefea89d2058e81d6cac41f3732d1f246bd4de6c4a0bd656d0f",
"bae22f27c12bce1faeb64b6eb733302aff5867baa8eed832397a7ce284a86ff4",
"b82eafbcc1a68dd90388d978f97ef49e899ac1d66b9e1fdcaa13404f6d7599c1",
"8a8f4f9d4273aacc25dc552ba10fd7fc17ec28c1a1f184356ae8ae53f651a6b7") and
not process.executable : ("?:\\Program Files (x86)\\*.exe", "?:\\Program Files\\*.exe")
]
Stage 2: any
[any where event.category : ("registry", "file") and event.action != "deletion" and
(
(registry.data.strings != null and
registry.path :
("H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
"H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Load",
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Shell",
"HKEY_USERS\\*\\Environment\\UserInitMprLogonScript",
"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\Shell",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Logoff\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Logon\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Shutdown\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Scripts\\Startup\\Script",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Ctf\\LangBarAddin\\*\\FilePath",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\*\\Exec",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Command Processor\\Autorun")) or
(file.name != null and file.path : "?:\\*\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*")
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event.category | wildcard |
| field:"event.category" kind:wildcard |
file.name | is_not_null | field:"file.name" kind:is_not_null | |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"?:\*\Microsoft\Windows\Start Menu\Programs\Startup\*" |
process.Ext.relative_file_creation_time | le |
| field:"process.Ext.relative_file_creation_time" kind:le value:"1800" |
process.Ext.relative_file_name_modify_time | le |
| field:"process.Ext.relative_file_name_modify_time" kind:le value:"1800" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
registry.data.strings | is_not_null | field:"Details" kind:is_not_null | |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.status | wildcard | errorExpired, errorCode_endpoint* | excludes:process.code_signature.status field:"process.code_signature.status" value:"errorExpired" field:"process.code_signature.status" value:"errorCode_endpoint*" |
process.executable | wildcard | ?:\Program Files (x86)\*.exe, ?:\Program Files\*.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files (x86)\*.exe" field:"process.executable" value:"?:\Program Files\*.exe" |
process.hash.sha256 | eq | 7a6b97bf43453c47d905c6f49e3cc6ee8b70f0e289700aa6145f40577ca7b5d4, cc783a04ccbca4edd06564f8ec88fe5a15f1e3bb26cec7de5e090313520d98f3, 8654a21fb5768efef4f363ecf05399c806e10ee8dfde427cfe6aff84cacacb75, 8b78f7325d842ad08637192efdbe564651439413a9d2d68684a7e8dcc698cc47, a4b66cf2a2d9889ece43f6cc930c3294a6118173b409398853b3063d66a81ec2, f535b2088c4d9ad4a81ef505e4e83012d26eeacc510d682ab93b5f2d3e29981a, 821bd11693bf4b4b2b9f3c196036e1f4902abd95fb26873ea6c43e123b8c9431, ada6a50f5095cd88c4a19b7f05a0a6a5c95f6fe7c13731394b807d0686b5acaf, 3d0041832e8b6f5b95cb33d286c24c53ccc9341549589ae8822c6084e8d2aa5c, 0a16633bedf096c56cef9199b6da9cdc5cf1c01ee44c821528b92dd5a91cf1bd, af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393, 38669786d00f8e21119fea05167775b3f2035439e2a8374957e42052b6896fe0, 8eb1e2a08f299b7c7c53e03e2121d5fd073b32791092f783feb5c00a8d6f1781, 978123c86b1cbc981770fbd8bdfc58ef4030f8d9b3adf06b71b928cc0394c073, d06598f2f203cec7a7a3857f727bc2ba457c1c0cef2787b90ce553407fbf8536, 8a8d94b58aa3443b57c917ca0650ae6befe0bc293a2333ddf9bb45fb2485203c, b8416acb067cae9a6a04cf31c5c98c2ef72a4d2efda715b44fb76f62fcddf788, 13a5adab078ceaefea89d2058e81d6cac41f3732d1f246bd4de6c4a0bd656d0f, bae22f27c12bce1faeb64b6eb733302aff5867baa8eed832397a7ce284a86ff4, b82eafbcc1a68dd90388d978f97ef49e899ac1d66b9e1fdcaa13404f6d7599c1, 8a8f4f9d4273aacc25dc552ba10fd7fc17ec28c1a1f184356ae8ae53f651a6b7 | excludes:process.hash.sha256 |
Suspicious Execution via SQL PowerShell
#Detects attempts to execute suspicious powershell commands using the Microsoft SQL Powershell Helper Tools.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[rule]
description = "Detects attempts to execute suspicious powershell commands using the Microsoft SQL Powershell Helper Tools."
id = "d111e88f-c5d2-41b4-b294-1f9cfea93b6c"
license = "Elastic License v2"
name = "Suspicious Execution via SQL PowerShell"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/OtherMSBinaries/Sqltoolsps/"]
version = "1.0.4"
query = '''
process where event.action == "start" and
process.name : ("SQLToolsPS.exe", "sqlps.exe") and
process.args : ("-e", "-enc", "-ep", "-encoded", "*;iex", "*start-process*", "*WebClient*",
"*DownloadFile*", "*DownloadString*", "*BitsTransfer*", "*Reflection.Assembly*")
'''
min_endpoint_version = "7.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "7.16.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.name : ("SQLToolsPS.exe", "sqlps.exe") and
process.args : ("-e", "-enc", "-ep", "-encoded", "*;iex", "*start-process*", "*WebClient*",
"*DownloadFile*", "*DownloadString*", "*BitsTransfer*", "*Reflection.Assembly*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Suspicious Execution via Windows Management Instrumentation
#Identifies suspicious processes executing via the Windows Management Instrumentation (WMI) protocol.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[rule]
description = "Identifies suspicious processes executing via the Windows Management Instrumentation (WMI) protocol."
id = "7e554c18-6435-41ce-b57b-d0ac3b73817f"
license = "Elastic License v2"
name = "Suspicious Execution via Windows Management Instrumentation"
os_list = ["windows"]
version = "1.0.50"
query = '''
process where event.action == "start" and
process.parent.name : "WmiPrvSe.exe" and not user.id : "S-1-5-18" and
(
(process.name : ("rundll32.exe", "regsvr32.exe", "mshta.exe", "wmic.exe", "wscript.exe", "bitsadmin.exe", "certutil.exe", "vssadmin.exe", "curl.exe")) or
(process.name : "schtasks.exe" and process.args : "/create") or
(process.name : "cmd.exe" and process.command_line : ("*powershell*", "*mshta*", "*wmic*", "*msiexec*", "*\\AppData\\Local\\Temp\\*.bat")) or
process.executable : ("?:\\Users\\*\\AppData\\*.exe", "?:\\Users\\Public\\*", "?:\\ProgramData\\*.exe", "?:\\Windows\\Tasks\\*.exe") or
(process.name : ("powershell.exe", "cmd.exe") and
process.command_line :
(
"*^*^*^*^*^*^*^*^*^*",
"*set *set *set *",
"*set *for *call *",
"*set *for *cmd *",
"*$*$*$*$*$*$*$*$*$*$*$*",
"*comspec*",
"*%%*%%*%%*",
"*''*''*''*",
"*`*`*`*`*",
"*+*+*+*+*+*",
"*[char[]](*)*-join",
"*Base64String*",
"*[*Convert]*",
"*.Text.Encoding*",
"*.Compression.*",
"*.replace*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -en* *",
"* -ec *",
"* -e *",
"* /e *",
"* /en* *",
"* /ec *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"*Invoke-Exp*",
"*invoke-web*",
"*iex*",
"*iwr*",
"*Reflection.Assembly*",
"*Assembly.GetType*"
)) or
(process.name : "powershell.exe" and length(process.command_line) > 200 )
) and
/* Noisy FPs */
not (process.name : ("powershell.exe", "cmd.exe") and
process.command_line : ("*Windows\\CCM\\*", "*WINDOWS\\TEMP\\nessus_*", "*%SystemRoot%\\TEMP\\nessus_*",
"*\\admin$\\temp\\cotportal_EAS_SP-SNOW*", "*/latest/dynamic/instance-identity/*", "*Get-NetFirewallProfile*",
"*windows\\temp\\netstatcache_*", "*$ErrorActionPreference*", "*D:\\SMS_DP$\\Ms.Dsp.Do.Inc.Setup\\Install.ps1*",
"*app360edatabase\\Install-360DB.ps1*", "*CgAgACAAIAAgAHQAcgBhAHAAIA*", "*Cert:LocalMachine -Recurse*",
"*\\Program Files\\*", "*\\Program Files (x86)\\*", "*CloudamizeAgentless*", "*Get-AppxP*",
"*Windows\\System32\\AppvClient\\AppvClient.psd1*", "*###break###'} Catch {}*", "*FQARQBNAFAAXABuAGUAcwBzAHUAcwBfA*",
"*AFMAUgBFAEcAXwBVAE4ASwBOAE8AVwBOAF8ASgBPAEkATg*", "*bgBlAHMAcwB1AHMAXwBhAHoAdQByAGUAXwBhA*",
"*EncodedCommand QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQA*", "*\\admeScript.ps1\\*", "*\\\\127.0.0.1\\ADMIN$\\apckscanner-*",
"*QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuAGcAIABTAHkAcwB0AGUAbQA7A*",
"*\\\\127.0.0.1\\admin$\\temp\\unregistered*", "*System.Security.Principal.NTAccount*\\ADMIN$\\d42*",
"*metadata/instance?api-version*", "*C:\\WINDOWS\\Temp\\csat\\*", "*google.internal/computeMetadata/v1/instance/*",
"*/opc/v2/instance*", "*254/opc/v1/instance*", "Powershell.exe Invoke-Expression 'Enable-PSRemoting -Force'",
"*C:\\WINDOWS\\TEMP\\Positive Technologies\\PT-file*", "*LastLogin, BadPasswordAttempts, PasswordAge, Username*")) and
not (process.name : "cmd.exe" and process.command_line : ("*echo*Spiceworks\\spiceworks_upload.vbs*", "*\\psscript_output_*", "*SNC_isWmi*")) and
not (process.name : "cmd.exe" and process.command_line : "*\\127.0.0.1\\ADMIN$\\axonius\\*") and
not (process.name : "powershell.exe" and process.command_line : ("*CodexHealthPoll*", "*CRAMITClientActivity*", "*Get-MECM*")) and
not (process.pe.original_file_name in ("ATMGR.EXE", "git.exe") and process.code_signature.trusted == true) and
not (process.name : ("cscript.exe", "wscript.exe") and
process.args : ("?:\\windows\\CCM\\*", "?:\\windows\\ccmcache\\*") and process.args_count <= 3) and
not (process.pe.original_file_name in ("PinVantageToolbarToast.exe", "Update.exe", "git-credential-manager-core.exe", "DismHost.exe") and
process.code_signature.trusted == true) and
not (process.name : "cmd.exe" and process.working_directory : "?:\\tmp\\smartcheck\\sitetool\\proc\\*" and
process.command_line : "*Citrix.SmartChecks.BlueprintBootstrap*-xdSiteId*") and
not (process.pe.original_file_name == "360se.exe" and process.code_signature.trusted == true and
process.code_signature.subject_name == "Beijing Qihu Technology Co., Ltd.") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Synology Inc.", "Zoom Video Communications, Inc.", "Beijing Qihu Technology Co., Ltd.", "Chocolatey Software, Inc.",
"Autodesk, Inc.", "Thomson Reuters Corporation", "Hornetsecurity GmbH")) and
not (process.name : "regsvr32.exe" and process.args : ("?:\\SMS_DP$\\*\\smsdp.dll", "\\\\*\\smsdp.dll") and process.args : "/s") and
not (process.name : "cmd.exe" and
process.args : ("\\\\127.0.0.1\\ADMIN$\\__*", "DB.name >> %userprofile%\\discoRemote.cmd", "echo SET _cmd=sqlcmd -E -Q SELECT")) and
not process.hash.sha256 :
("0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f",
"4402920c711aba26297de5ea39fcb58448ade9df77e978f1d8cd326fd810c62d",
"0d9c6de8a57443bffe718d3256fdd467b8970124ba65d8accb6f47dc54d46d72",
"fc18fbb2b4e54c25ea3fdcdd9682735a636dd61127da451a2c19fd7e8d154285",
"0d6f7b29a06cb188ce67bd99ec0a3d1fa7dda2d64a69b3279ec90e04d35c8bfb",
"24863db91f7f1222c8310160e78f2c6c8a0ed9b4c18640029e65e3a3a3c1944d",
"2733a27117ec81c7f867c4b1a6a800011fa432e45b7e95656c37ee05ca68c592",
"8e597fdafc174a30633cc470b763f6ba65e79aada99adc394df745913fe41111",
"34c5c838199700dd344b8d606163ce4f05db72397c9aaf129f52b70b38c1d187") and
not process.executable : "?:\\ProgramData\\Microsoft Azure Site Recovery\\Mobility Service\\WMISSH\\*.exe" and
not (process.name : "regsvr32.exe" and process.command_line : "regsvr32.exe ?:\\SMS_DP$\\sms\\bin\\smsdp.dll /s") and
not process.executable : "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCmdRun.exe" and
not (process.name : "rundll32.exe" and
process.command_line : "\"?:\\WINDOWS\\system32\\rundll32.exe\" C:\\WINDOWS\\system32\\eed_ec.dll,SpeedLauncher") and
not (process.name : "schtasks.exe" and process.args : ("cmd /c echo N | gpupdate /force", "shutdown /r /f /t *")) and
not (process.name : "powershell.exe" and
process.args : ("\\\\*.ps1", "\\\\127.0.0.1\\admin$\\temp\\unregistered", "?:\\SMS_DP$\\*",
"QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuA*",
"cwB0AGEAcgB0AC0AcAByAG8AYwBlAHMAcwAgAHAAbwB3AGUAcgBzAGgAZQBsAGwALgBlAHgAZQAgAC0AQQByAGcAdQBtAGUAbgB0AEwAaQBzAHQAIAAnA*"))
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1047"
name = "Windows Management Instrumentation"
reference = "https://attack.mitre.org/techniques/T1047/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.name : "WmiPrvSe.exe" and not user.id : "S-1-5-18" and
(
(process.name : ("rundll32.exe", "regsvr32.exe", "mshta.exe", "wmic.exe", "wscript.exe", "bitsadmin.exe", "certutil.exe", "vssadmin.exe", "curl.exe")) or
(process.name : "schtasks.exe" and process.args : "/create") or
(process.name : "cmd.exe" and process.command_line : ("*powershell*", "*mshta*", "*wmic*", "*msiexec*", "*\\AppData\\Local\\Temp\\*.bat")) or
process.executable : ("?:\\Users\\*\\AppData\\*.exe", "?:\\Users\\Public\\*", "?:\\ProgramData\\*.exe", "?:\\Windows\\Tasks\\*.exe") or
(process.name : ("powershell.exe", "cmd.exe") and
process.command_line :
(
"*^*^*^*^*^*^*^*^*^*",
"*set *set *set *",
"*set *for *call *",
"*set *for *cmd *",
"*$*$*$*$*$*$*$*$*$*$*$*",
"*comspec*",
"*%%*%%*%%*",
"*''*''*''*",
"*`*`*`*`*",
"*+*+*+*+*+*",
"*[char[]](*)*-join",
"*Base64String*",
"*[*Convert]*",
"*.Text.Encoding*",
"*.Compression.*",
"*.replace*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -en* *",
"* -ec *",
"* -e *",
"* /e *",
"* /en* *",
"* /ec *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"*Invoke-Exp*",
"*invoke-web*",
"*iex*",
"*iwr*",
"*Reflection.Assembly*",
"*Assembly.GetType*"
)) or
(process.name : "powershell.exe" and length(process.command_line) > 200 )
) and
not (process.name : ("powershell.exe", "cmd.exe") and
process.command_line : ("*Windows\\CCM\\*", "*WINDOWS\\TEMP\\nessus_*", "*%SystemRoot%\\TEMP\\nessus_*",
"*\\admin$\\temp\\cotportal_EAS_SP-SNOW*", "*/latest/dynamic/instance-identity/*", "*Get-NetFirewallProfile*",
"*windows\\temp\\netstatcache_*", "*$ErrorActionPreference*", "*D:\\SMS_DP$\\Ms.Dsp.Do.Inc.Setup\\Install.ps1*",
"*app360edatabase\\Install-360DB.ps1*", "*CgAgACAAIAAgAHQAcgBhAHAAIA*", "*Cert:LocalMachine -Recurse*",
"*\\Program Files\\*", "*\\Program Files (x86)\\*", "*CloudamizeAgentless*", "*Get-AppxP*",
"*Windows\\System32\\AppvClient\\AppvClient.psd1*", "*###break###'} Catch {}*", "*FQARQBNAFAAXABuAGUAcwBzAHUAcwBfA*",
"*AFMAUgBFAEcAXwBVAE4ASwBOAE8AVwBOAF8ASgBPAEkATg*", "*bgBlAHMAcwB1AHMAXwBhAHoAdQByAGUAXwBhA*",
"*EncodedCommand QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQA*", "*\\admeScript.ps1\\*", "*\\\\127.0.0.1\\ADMIN$\\apckscanner-*",
"*QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuAGcAIABTAHkAcwB0AGUAbQA7A*",
"*\\\\127.0.0.1\\admin$\\temp\\unregistered*", "*System.Security.Principal.NTAccount*\\ADMIN$\\d42*",
"*metadata/instance?api-version*", "*C:\\WINDOWS\\Temp\\csat\\*", "*google.internal/computeMetadata/v1/instance/*",
"*/opc/v2/instance*", "*254/opc/v1/instance*", "Powershell.exe Invoke-Expression 'Enable-PSRemoting -Force'",
"*C:\\WINDOWS\\TEMP\\Positive Technologies\\PT-file*", "*LastLogin, BadPasswordAttempts, PasswordAge, Username*")) and
not (process.name : "cmd.exe" and process.command_line : ("*echo*Spiceworks\\spiceworks_upload.vbs*", "*\\psscript_output_*", "*SNC_isWmi*")) and
not (process.name : "cmd.exe" and process.command_line : "*\\127.0.0.1\\ADMIN$\\axonius\\*") and
not (process.name : "powershell.exe" and process.command_line : ("*CodexHealthPoll*", "*CRAMITClientActivity*", "*Get-MECM*")) and
not (process.pe.original_file_name in ("ATMGR.EXE", "git.exe") and process.code_signature.trusted == true) and
not (process.name : ("cscript.exe", "wscript.exe") and
process.args : ("?:\\windows\\CCM\\*", "?:\\windows\\ccmcache\\*") and process.args_count <= 3) and
not (process.pe.original_file_name in ("PinVantageToolbarToast.exe", "Update.exe", "git-credential-manager-core.exe", "DismHost.exe") and
process.code_signature.trusted == true) and
not (process.name : "cmd.exe" and process.working_directory : "?:\\tmp\\smartcheck\\sitetool\\proc\\*" and
process.command_line : "*Citrix.SmartChecks.BlueprintBootstrap*-xdSiteId*") and
not (process.pe.original_file_name == "360se.exe" and process.code_signature.trusted == true and
process.code_signature.subject_name == "Beijing Qihu Technology Co., Ltd.") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Synology Inc.", "Zoom Video Communications, Inc.", "Beijing Qihu Technology Co., Ltd.", "Chocolatey Software, Inc.",
"Autodesk, Inc.", "Thomson Reuters Corporation", "Hornetsecurity GmbH")) and
not (process.name : "regsvr32.exe" and process.args : ("?:\\SMS_DP$\\*\\smsdp.dll", "\\\\*\\smsdp.dll") and process.args : "/s") and
not (process.name : "cmd.exe" and
process.args : ("\\\\127.0.0.1\\ADMIN$\\__*", "DB.name >> %userprofile%\\discoRemote.cmd", "echo SET _cmd=sqlcmd -E -Q SELECT")) and
not process.hash.sha256 :
("0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f",
"4402920c711aba26297de5ea39fcb58448ade9df77e978f1d8cd326fd810c62d",
"0d9c6de8a57443bffe718d3256fdd467b8970124ba65d8accb6f47dc54d46d72",
"fc18fbb2b4e54c25ea3fdcdd9682735a636dd61127da451a2c19fd7e8d154285",
"0d6f7b29a06cb188ce67bd99ec0a3d1fa7dda2d64a69b3279ec90e04d35c8bfb",
"24863db91f7f1222c8310160e78f2c6c8a0ed9b4c18640029e65e3a3a3c1944d",
"2733a27117ec81c7f867c4b1a6a800011fa432e45b7e95656c37ee05ca68c592",
"8e597fdafc174a30633cc470b763f6ba65e79aada99adc394df745913fe41111",
"34c5c838199700dd344b8d606163ce4f05db72397c9aaf129f52b70b38c1d187") and
not process.executable : "?:\\ProgramData\\Microsoft Azure Site Recovery\\Mobility Service\\WMISSH\\*.exe" and
not (process.name : "regsvr32.exe" and process.command_line : "regsvr32.exe ?:\\SMS_DP$\\sms\\bin\\smsdp.dll /s") and
not process.executable : "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCmdRun.exe" and
not (process.name : "rundll32.exe" and
process.command_line : "\"?:\\WINDOWS\\system32\\rundll32.exe\" C:\\WINDOWS\\system32\\eed_ec.dll,SpeedLauncher") and
not (process.name : "schtasks.exe" and process.args : ("cmd /c echo N | gpupdate /force", "shutdown /r /f /t *")) and
not (process.name : "powershell.exe" and
process.args : ("\\\\*.ps1", "\\\\127.0.0.1\\admin$\\temp\\unregistered", "?:\\SMS_DP$\\*",
"QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuA*",
"cwB0AGEAcgB0AC0AcAByAG8AYwBlAHMAcwAgAHAAbwB3AGUAcgBzAGgAZQBsAGwALgBlAHgAZQAgAC0AQQByAGcAdQBtAGUAbgB0AEwAaQBzAHQAIAAnA*"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"/create" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"WmiPrvSe.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | /s | excludes:process.args field:"process.args" value:"/s" |
process.args | wildcard | ?:\SMS_DP$\*\smsdp.dll, \\*\smsdp.dll | excludes:process.args field:"process.args" value:"?:\SMS_DP$\*\smsdp.dll" field:"process.args" value:"\\*\smsdp.dll" |
process.name | eq | regsvr32.exe | excludes:process.name field:"process.name" value:"regsvr32.exe" |
process.args | starts_with | ?:\windows\CCM\, ?:\windows\ccmcache\ | excludes:process.args field:"process.args" value:"?:\windows\CCM\" field:"process.args" value:"?:\windows\ccmcache\" |
process.args_count | le | 3 | excludes:process.args_count field:"process.args_count" value:"3" |
process.name | eq | cscript.exe, wscript.exe | excludes:process.name field:"process.name" value:"cscript.exe" field:"process.name" value:"wscript.exe" |
process.args | wildcard | \\*.ps1, \\127.0.0.1\admin$\temp\unregistered, ?:\SMS_DP$\*, QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuA*, cwB0AGEAcgB0AC0AcAByAG8AYwBlAHMAcwAgAHAAbwB3AGUAcgBzAGgAZQBsAGwALgBlAHgAZQAgAC0AQQByAGcAdQBtAGUAbgB0AEwAaQBzAHQAIAAnA* | excludes:process.args |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.args | wildcard | \\127.0.0.1\ADMIN$\__*, DB.name >> %userprofile%\discoRemote.cmd, echo SET _cmd=sqlcmd -E -Q SELECT | excludes:process.args field:"process.args" value:"\\127.0.0.1\ADMIN$\__*" field:"process.args" value:"DB.name >> %userprofile%\discoRemote.cmd" field:"process.args" value:"echo SET _cmd=sqlcmd -E -Q SELECT" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.args | wildcard | cmd /c echo N | gpupdate /force, shutdown /r /f /t * | excludes:process.args field:"process.args" value:"cmd /c echo N | gpupdate /force" field:"process.args" value:"shutdown /r /f /t *" |
process.name | eq | schtasks.exe | excludes:process.name field:"process.name" value:"schtasks.exe" |
process.code_signature.subject_name | eq | Beijing Qihu Technology Co., Ltd. | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Beijing Qihu Technology Co., Ltd." |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.pe.original_file_name | eq | 360se.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"360se.exe" |
process.code_signature.subject_name | eq | Synology Inc., Zoom Video Communications, Inc., Beijing Qihu Technology Co., Ltd., Chocolatey Software, Inc., Autodesk, Inc., Thomson Reuters Corporation, Hornetsecurity GmbH | excludes:process.code_signature.subject_name |
process.pe.original_file_name | in | ATMGR.EXE, git.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"ATMGR.EXE" field:"process.pe.original_file_name" value:"git.exe" |
process.pe.original_file_name | in | DismHost.exe, PinVantageToolbarToast.exe, Update.exe, git-credential-manager-core.exe | excludes:process.pe.original_file_name |
process.command_line | eq | "?:\WINDOWS\system32\rundll32.exe" C:\WINDOWS\system32\eed_ec.dll,SpeedLauncher | excludes:process.command_line |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.command_line | eq | regsvr32.exe ?:\SMS_DP$\sms\bin\smsdp.dll /s | excludes:process.command_line field:"process.command_line" value:"regsvr32.exe ?:\SMS_DP$\sms\bin\smsdp.dll /s" |
process.command_line | match | CodexHealthPoll, CRAMITClientActivity, Get-MECM | excludes:process.command_line field:"process.command_line" value:"CodexHealthPoll" field:"process.command_line" value:"CRAMITClientActivity" field:"process.command_line" value:"Get-MECM" |
process.command_line | match | \127.0.0.1\ADMIN$\axonius\ | excludes:process.command_line field:"process.command_line" value:"\127.0.0.1\ADMIN$\axonius\" |
process.command_line | wildcard | *Citrix.SmartChecks.BlueprintBootstrap*-xdSiteId* | excludes:process.command_line field:"process.command_line" value:"*Citrix.SmartChecks.BlueprintBootstrap*-xdSiteId*" |
process.working_directory | starts_with | ?:\tmp\smartcheck\sitetool\proc\ | excludes:process.working_directory field:"process.working_directory" value:"?:\tmp\smartcheck\sitetool\proc\" |
process.command_line | wildcard | *Windows\CCM\*, *WINDOWS\TEMP\nessus_*, *%SystemRoot%\TEMP\nessus_*, *\admin$\temp\cotportal_EAS_SP-SNOW*, */latest/dynamic/instance-identity/*, *Get-NetFirewallProfile*, *windows\temp\netstatcache_*, *$ErrorActionPreference*, *D:\SMS_DP$\Ms.Dsp.Do.Inc.Setup\Install.ps1*, *app360edatabase\Install-360DB.ps1*, *CgAgACAAIAAgAHQAcgBhAHAAIA*, *Cert:LocalMachine -Recurse*, *\Program Files\*, *\Program Files (x86)\*, *CloudamizeAgentless*, *Get-AppxP*, *Windows\System32\AppvClient\AppvClient.psd1*, *###break###'} Catch {}*, *FQARQBNAFAAXABuAGUAcwBzAHUAcwBfA*, *AFMAUgBFAEcAXwBVAE4ASwBOAE8AVwBOAF8ASgBPAEkATg*, *bgBlAHMAcwB1AHMAXwBhAHoAdQByAGUAXwBhA*, *EncodedCommand QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQA*, *\admeScript.ps1\*, *\\127.0.0.1\ADMIN$\apckscanner-*, *QQBkAGQALQBUAHkAcABlACAALQBUAHkAcABlAEQAZQBmAGkAbgBpAHQAaQBvAG4AIABAACcACgB1AHMAaQBuAGcAIABTAHkAcwB0AGUAbQA7A*, *\\127.0.0.1\admin$\temp\unregistered*, *System.Security.Principal.NTAccount*\ADMIN$\d42*, *metadata/instance?api-version*, *C:\WINDOWS\Temp\csat\*, *google.internal/computeMetadata/v1/instance/*, */opc/v2/instance*, *254/opc/v1/instance*, Powershell.exe Invoke-Expression 'Enable-PSRemoting -Force', *C:\WINDOWS\TEMP\Positive Technologies\PT-file*, *LastLogin, BadPasswordAttempts, PasswordAge, Username* | excludes:process.command_line |
process.name | eq | powershell.exe, cmd.exe | excludes:process.name field:"process.name" value:"powershell.exe" field:"process.name" value:"cmd.exe" |
process.command_line | wildcard | *echo*Spiceworks\spiceworks_upload.vbs*, *\psscript_output_*, *SNC_isWmi* | excludes:process.command_line field:"process.command_line" value:"*echo*Spiceworks\spiceworks_upload.vbs*" field:"process.command_line" value:"*\psscript_output_*" field:"process.command_line" value:"*SNC_isWmi*" |
process.executable | wildcard | ?:\ProgramData\Microsoft Azure Site Recovery\Mobility Service\WMISSH\*.exe | excludes:process.executable field:"process.executable" value:"?:\ProgramData\Microsoft Azure Site Recovery\Mobility Service\WMISSH\*.exe" |
process.executable | wildcard | ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MpCmdRun.exe | excludes:process.executable field:"process.executable" value:"?:\ProgramData\Microsoft\Windows Defender\Platform\*\MpCmdRun.exe" |
process.hash.sha256 | eq | 0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f, 4402920c711aba26297de5ea39fcb58448ade9df77e978f1d8cd326fd810c62d, 0d9c6de8a57443bffe718d3256fdd467b8970124ba65d8accb6f47dc54d46d72, fc18fbb2b4e54c25ea3fdcdd9682735a636dd61127da451a2c19fd7e8d154285, 0d6f7b29a06cb188ce67bd99ec0a3d1fa7dda2d64a69b3279ec90e04d35c8bfb, 24863db91f7f1222c8310160e78f2c6c8a0ed9b4c18640029e65e3a3a3c1944d, 2733a27117ec81c7f867c4b1a6a800011fa432e45b7e95656c37ee05ca68c592, 8e597fdafc174a30633cc470b763f6ba65e79aada99adc394df745913fe41111, 34c5c838199700dd344b8d606163ce4f05db72397c9aaf129f52b70b38c1d187 | excludes:process.hash.sha256 |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Suspicious File Download via Google Drive
#Detects a network connection to a Google Drive domain followed immediately by the creation of a suspicious file like a Mach-O binary, Python Script, or Shell script via the same Process. Threat actors, especially the DPRK, have utilized Google Drive heavily in their campaigns in order to host and deliver second-stage payloads. A binary downloading these file types from Google Drive on macOS is highly un-common and unusual.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| macOS | ESF event write (NOTIFY): Fires after a process writes data to a file. |
Rule Body
[rule]
description = """
Detects a network connection to a Google Drive domain followed immediately by the creation of a suspicious file like a
Mach-O binary, Python Script, or Shell script via the same Process. Threat actors, especially the DPRK, have utilized
Google Drive heavily in their campaigns in order to host and deliver second-stage payloads. A binary downloading these
file types from Google Drive on macOS is highly un-common and unusual.
"""
id = "54ba4259-4bc0-4c86-ab7b-a009c6517603"
license = "Elastic License v2"
name = "Suspicious File Download via Google Drive"
os_list = ["macos"]
reference = [
"https://www.sentinelone.com/labs/bluenoroff-hidden-risk-threat-actor-targets-macs-with-fake-crypto-news-and-novel-persistence/",
"https://www.elastic.co/security-labs/elastic-catches-dprk-passing-out-kandykorn",
]
version = "1.0.5"
query = '''
sequence by process.entity_id with maxspan=30s
[network where event.type == "start" and destination.domain in ("drive.usercontent.google.com", "drive.usercontent.google.com.", "drive.google.com", "drive.google.com.", "script.google.com", "script.google.com.")]
[file where event.action == "modification" and (file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") or
file.extension in ("py", "sh", "scpt"))]
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.entity_id.
Stage 1: network
[network where event.type == "start" and destination.domain in ("drive.usercontent.google.com", "drive.usercontent.google.com.", "drive.google.com", "drive.google.com.", "script.google.com", "script.google.com.")]
Stage 2: file
[file where event.action == "modification" and (file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") or
file.extension in ("py", "sh", "scpt"))]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.domain | in |
| field:"DestinationHostname" kind:in |
event.action | eq |
| field:"EventType" kind:eq value:"modification" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.extension | in |
| field:"file.extension" kind:in |
Suspicious PowerShell Execution via Windows Scripts
#Identifies suspicious PowerShell execution spawning from Windows Script Host processes (cscript or wscript.exe).
MITRE ATT&CK Coverage
Rule Body
[rule]
description = "Identifies suspicious PowerShell execution spawning from Windows Script Host processes (cscript or wscript.exe)."
id = "3899dd3b-f31a-4634-8467-55326cd87597"
license = "Elastic License v2"
name = "Suspicious PowerShell Execution via Windows Scripts"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doing-time-with-the-yipphb-dropper"]
version = "1.0.45"
query = '''
process where event.action == "start" and
(process.name : ("powershell.exe", "pwsh.exe") or process.pe.original_file_name : ("powershell.exe", "pwsh.exe")) and
(
process.parent.name : ("wscript.exe", "mshta.exe") or
(process.parent.name : "node.exe" and process.working_directory : ("?:\\Users\\*\\Downloads\\*", "?:\\Users\\*\\Desktop\\*", "?:\\Users\\*\\appdata\\*")) or
(descendant of [process where event.action == "start" and process.name : ("wscript.exe", "mshta.exe")] and
not process.parent.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe"))
) and
(
process.args_count == 1 or
process.command_line :
("*^*^*^*^*^*^*^*^*^*",
"*''*''*''*",
"*`*`*`*`*",
"*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*",
"*+*+*+*+*+*",
"*$*$*$*$*",
"*[char[]](*)*-join",
"*Base64String*",
"*[*Convert]*",
"*.Text.Encoding*",
"*.Compression.*",
"*.replace(*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -en* *",
"* -ec *",
"* -e *",
"* -ep *",
"* /e *",
"* /en* *",
"* /ec *",
"* /ep *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"*BitsTransfer*",
"*Invoke-Exp*",
"*invoke-web*",
"*Invoke-RestMethod*",
"*iex*",
"*iwr*",
"*Reflection.Assembly*",
"*Assembly.GetType*",
"*.Sockets.*",
"*Add-MpPreference*ExclusionPath*",
"*raw.githubusercontent*")
) and
/* false positives */
not process.parent.name: ("gc_worker.exe", "gc_service.exe") and
not process.parent.command_line : "*Windows\\TEMP\\nessus_*" and
/* Issue #247 */
not process.parent.executable :
("?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\CompatTelRunner.exe",
"?:\\Windows\\System32\\taskeng.exe") and
not process.parent.executable : "C:\\FVS\\FVSSoftware\\*\\bin\\x64\\Rscript.exe" and
not process.Ext.token.integrity_level_name == "system" and
/* many legit powershell commands uses those non shortened execution flags excluding Sync-AppvPublishingServer lolbas */
not (process.args : ("-EncodedCommand", "Import-Module*", "-NonInteractive") and
process.args : "-ExecutionPolicy" and not process.args : "Sync-AppvPublishingServer") and
/* third party installation related FPs */
not process.parent.args : "?:\\Windows\\system32\\gatherNetworkInfo.vbs" and
not (process.parent.args : "Microsoft.SystemCenter.ICMPProbe.WithConsecutiveSamples.vbs" and process.args : "Get-SCOMAgent") and
not (process.command_line : "*WEBLOGIC_ARGS_CURRENT_1.DATA*" and process.parent.command_line : "*Impact360*") and
not process.args : "$package = Get-AppxPackage Microsoft.Office.Desktop -allUsers;*" and
not process.command_line : ("*.Access.IdentityReference*win32_SID.SID*", "*AGIAbQB4AC0AYQBwAC4AcwAzAC4AdQBzAC0AZQBhAHMAd*") and
not (process.parent.args : "?:\\Users\\Prestige\\AppData\\Local\\Temp\\Rar$*\\KMS_VL_ALL_AIO.cmd -elevated" and process.command_line : "*KMS_VL_ALL_AIO.cmd*") and
not (process.parent.name : "cmd.exe" and
process.parent.command_line : "*C:\\Program Files\\CheckPoint\\Harmony Connect\\resources\\build\\installation_scripts\\on_install\\on_install.bat*") and
not process.args : "iwr https://*.s3.us-east-1.amazonaws.com/scripts/Start-SpeedTest.ps1 -UserAgent * -UseBasicParsing | invoke-expression" and
not (process.parent.name : "wscript.exe" and
process.parent.args : "C:\\Program Files (x86)\\Telivy\\Telivy Agent\\telivy.js") and
not process.command_line : "c:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -executionpolicy bypass -WindowStyle Hidden -Command \"powershell.exe -executionpolicy bypass -WindowStyle Hidden -Command \\\"iwr bmx-panels-check.s3.us-east-1.amazonaws.com/scripts/Set-BMXFirewallPolicy.ps1 -UserAgent MzEyYTdjNzg1ZWI3 -UseBasicParsing | invoke-expression\\\"\"" and
not (process.parent.name : "cmd.exe" and process.parent.args : "\\\\*\\netlogon\\*" and process.args : "\\\\*\\netlogon\\*.ps1") and
not process.args : "C:\\Program Files\\Common Files\\EETI\\TouchModeXML\\RunRegisterAllUserTask.ps1" and
not (process.parent.name: "cmd.exe" and process.args : ("C:\\PreVeil\\filesync\\PreVeil_Client", "C:\\ProgramData\\recycle\\ISO\\recycle.ps1")) and
not (process.parent.command_line : "wscript //B checkschedule.wsf /baseUrl:https://utilities.pcpitstop.com") and
not (process.parent.name : "cmd.exe" and
process.parent.args : ("C:\\Users\\*\\AppData\\Local\\Temp\\DONDA-NetworkInfo-*.bat ",
"C:\\ProgramData\\Hays\\WallpaperRefresh\\SilentExecute.bat ",
"Files\\Tyco\\SiteServer\\TSP.ISS.WindowsServices.Host\\Command\\ComputerNameScripts\\toolbar.cmd ",
"Files\\Tyco\\SiteServer\\TSP.ISS.WindowsServices.Host\\Command\\ComputerNameScripts\\start.cmd ")) and
/* developer and AI coding tools spawning PowerShell for system queries */
not (
(
(process.parent.name : "node.exe" and
process.parent.code_signature.subject_name : "OpenJS Foundation") or
(process.parent.name : "claude.exe" and
process.parent.code_signature.subject_name : "Anthropic, PBC") or
(process.parent.name : "codex.exe" and
process.parent.code_signature.subject_name : "OpenAI OpCo, LLC")
) and
process.parent.code_signature.trusted == true)
'''
min_endpoint_version = "8.8.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.8.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
(process.name : ("powershell.exe", "pwsh.exe") or process.pe.original_file_name : ("powershell.exe", "pwsh.exe")) and
(
process.parent.name : ("wscript.exe", "mshta.exe") or
(process.parent.name : "node.exe" and process.working_directory : ("?:\\Users\\*\\Downloads\\*", "?:\\Users\\*\\Desktop\\*", "?:\\Users\\*\\appdata\\*")) or
(descendant of [process where event.action == "start" and process.name : ("wscript.exe", "mshta.exe")] and
not process.parent.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe"))
) and
(
process.args_count == 1 or
process.command_line :
("*^*^*^*^*^*^*^*^*^*",
"*''*''*''*",
"*`*`*`*`*",
"*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*{*",
"*+*+*+*+*+*",
"*$*$*$*$*",
"*[char[]](*)*-join",
"*Base64String*",
"*[*Convert]*",
"*.Text.Encoding*",
"*.Compression.*",
"*.replace(*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -en* *",
"* -ec *",
"* -e *",
"* -ep *",
"* /e *",
"* /en* *",
"* /ec *",
"* /ep *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"*BitsTransfer*",
"*Invoke-Exp*",
"*invoke-web*",
"*Invoke-RestMethod*",
"*iex*",
"*iwr*",
"*Reflection.Assembly*",
"*Assembly.GetType*",
"*.Sockets.*",
"*Add-MpPreference*ExclusionPath*",
"*raw.githubusercontent*")
) and
not process.parent.name: ("gc_worker.exe", "gc_service.exe") and
not process.parent.command_line : "*Windows\\TEMP\\nessus_*" and
not process.parent.executable :
("?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\CompatTelRunner.exe",
"?:\\Windows\\System32\\taskeng.exe") and
not process.parent.executable : "C:\\FVS\\FVSSoftware\\*\\bin\\x64\\Rscript.exe" and
not process.Ext.token.integrity_level_name == "system" and
not (process.args : ("-EncodedCommand", "Import-Module*", "-NonInteractive") and
process.args : "-ExecutionPolicy" and not process.args : "Sync-AppvPublishingServer") and
not process.parent.args : "?:\\Windows\\system32\\gatherNetworkInfo.vbs" and
not (process.parent.args : "Microsoft.SystemCenter.ICMPProbe.WithConsecutiveSamples.vbs" and process.args : "Get-SCOMAgent") and
not (process.command_line : "*WEBLOGIC_ARGS_CURRENT_1.DATA*" and process.parent.command_line : "*Impact360*") and
not process.args : "$package = Get-AppxPackage Microsoft.Office.Desktop -allUsers;*" and
not process.command_line : ("*.Access.IdentityReference*win32_SID.SID*", "*AGIAbQB4AC0AYQBwAC4AcwAzAC4AdQBzAC0AZQBhAHMAd*") and
not (process.parent.args : "?:\\Users\\Prestige\\AppData\\Local\\Temp\\Rar$*\\KMS_VL_ALL_AIO.cmd -elevated" and process.command_line : "*KMS_VL_ALL_AIO.cmd*") and
not (process.parent.name : "cmd.exe" and
process.parent.command_line : "*C:\\Program Files\\CheckPoint\\Harmony Connect\\resources\\build\\installation_scripts\\on_install\\on_install.bat*") and
not process.args : "iwr https://*.s3.us-east-1.amazonaws.com/scripts/Start-SpeedTest.ps1 -UserAgent * -UseBasicParsing | invoke-expression" and
not (process.parent.name : "wscript.exe" and
process.parent.args : "C:\\Program Files (x86)\\Telivy\\Telivy Agent\\telivy.js") and
not process.command_line : "c:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -executionpolicy bypass -WindowStyle Hidden -Command \"powershell.exe -executionpolicy bypass -WindowStyle Hidden -Command \\\"iwr bmx-panels-check.s3.us-east-1.amazonaws.com/scripts/Set-BMXFirewallPolicy.ps1 -UserAgent MzEyYTdjNzg1ZWI3 -UseBasicParsing | invoke-expression\\\"\"" and
not (process.parent.name : "cmd.exe" and process.parent.args : "\\\\*\\netlogon\\*" and process.args : "\\\\*\\netlogon\\*.ps1") and
not process.args : "C:\\Program Files\\Common Files\\EETI\\TouchModeXML\\RunRegisterAllUserTask.ps1" and
not (process.parent.name: "cmd.exe" and process.args : ("C:\\PreVeil\\filesync\\PreVeil_Client", "C:\\ProgramData\\recycle\\ISO\\recycle.ps1")) and
not (process.parent.command_line : "wscript //B checkschedule.wsf /baseUrl:https://utilities.pcpitstop.com") and
not (process.parent.name : "cmd.exe" and
process.parent.args : ("C:\\Users\\*\\AppData\\Local\\Temp\\DONDA-NetworkInfo-*.bat ",
"C:\\ProgramData\\Hays\\WallpaperRefresh\\SilentExecute.bat ",
"Files\\Tyco\\SiteServer\\TSP.ISS.WindowsServices.Host\\Command\\ComputerNameScripts\\toolbar.cmd ",
"Files\\Tyco\\SiteServer\\TSP.ISS.WindowsServices.Host\\Command\\ComputerNameScripts\\start.cmd ")) and
not (
(
(process.parent.name : "node.exe" and
process.parent.code_signature.subject_name : "OpenJS Foundation") or
(process.parent.name : "claude.exe" and
process.parent.code_signature.subject_name : "Anthropic, PBC") or
(process.parent.name : "codex.exe" and
process.parent.code_signature.subject_name : "OpenAI OpCo, LLC")
) and
process.parent.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"Sync-AppvPublishingServer" |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"1" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard |
process.working_directory | wildcard |
| field:"CurrentDirectory" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
Suspicious Renaming of ESXI Files
#Identifies instances where VMware-related files, such as those with extensions like ".vmdk", ".vmx", ".vmxf", ".vmsd", ".vmsn", ".vswp", ".vmss", ".nvram", and ".vmem", are renamed on a Linux system. The rule monitors for the "rename" event action associated with these file types, which could indicate malicious activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Impact |
Rule Body
[metadata]
creation_date = "2023/04/11"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Identifies instances where VMware-related files, such as those with extensions like ".vmdk", ".vmx", ".vmxf", ".vmsd",
".vmsn", ".vswp", ".vmss", ".nvram", and ".vmem", are renamed on a Linux system. The rule monitors for the "rename"
event action associated with these file types, which could indicate malicious activity.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Renaming of ESXI Files"
references = [
"https://www.bleepingcomputer.com/news/security/massive-esxiargs-ransomware-attack-targets-vmware-esxi-servers-worldwide/",
]
risk_score = 47
rule_id = "97db8b42-69d8-4bf3-9fd4-c69a1d895d68"
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",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.action == "rename" and (
file.Ext.original.name : ("*.vmdk", "*.vmx", "*.vmxf", "*.vmsd", "*.vmsn", "*.vswp", "*.vmss", "*.nvram", "*.vmem") or
(file.name == "index.html" and file.Ext.original.path like "/usr/lib/vmware/*")
)
and not (
file.name : ("*.vmdk", "*.vmx", "*.vmxf", "*.vmsd", "*.vmsn", "*.vswp", "*.vmss", "*.nvram", "*.vmem") or
process.executable like (
"/usr/sbin/gdm", "/usr/share/dotnet/dotnet", "/usr/bin/dotnet", "/usr/sbin/apache2",
"/var/lib/docker/overlay2/*/usr/bin/dotnet", "/usr/lib/3cxpbx/3cxSystemService"
)
)
'''
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 Renaming of ESXI Files
VMware ESXi files are critical for virtual machine operations, storing configurations and states. Adversaries may rename these files to evade detection or disrupt services, a tactic known as masquerading. The detection rule identifies renaming events of specific VMware file types on Linux systems, flagging potential malicious activity by monitoring deviations from expected file extensions.
### Possible investigation steps
- Review the alert details to identify the specific file that was renamed, including its original and new name, to understand the nature of the change.
- Check the timestamp of the rename event to correlate it with other activities on the system, such as user logins or other file operations, to identify potential patterns or anomalies.
- Investigate the user account or process responsible for the rename action by examining system logs or user activity to determine if the action was authorized or suspicious.
- Analyze the system for any other recent rename events involving VMware-related files to assess if this is an isolated incident or part of a broader pattern.
- Examine the system for signs of compromise or unauthorized access, such as unexpected processes, network connections, or changes in system configurations, to identify potential threats.
- Consult with relevant stakeholders, such as system administrators or security teams, to verify if the rename action was part of a legitimate maintenance or operational task.
### False positive analysis
- Routine maintenance or administrative tasks may involve renaming VMware ESXi files for organizational purposes. To manage this, identify and exclude specific users or processes that regularly perform these tasks from triggering alerts.
- Automated backup or snapshot processes might rename files temporarily as part of their operation. Review and whitelist these processes to prevent unnecessary alerts.
- Development or testing environments often involve frequent renaming of virtual machine files for configuration testing. Consider excluding these environments from the rule or setting up a separate monitoring profile with adjusted thresholds.
- System updates or patches might include scripts that rename files as part of the update process. Verify and exclude these scripts if they are known and trusted.
- Custom scripts or tools used by IT teams for managing virtual machines may rename files as part of their functionality. Ensure these scripts are documented and excluded from triggering the rule.
### Response and remediation
- Immediately isolate the affected Linux system from the network to prevent further unauthorized access or potential spread of malicious activity.
- Verify the integrity of the renamed VMware ESXi files by comparing them with known good backups or snapshots, and restore any altered files from a secure backup if necessary.
- Conduct a thorough review of recent system logs and user activity to identify any unauthorized access or actions that may have led to the file renaming.
- Revert any unauthorized changes to system configurations or permissions that may have facilitated the renaming of critical files.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Implement additional monitoring on the affected system and similar environments to detect any further attempts at file masquerading or other suspicious activities.
- Review and update access controls and permissions for VMware ESXi files to ensure only authorized users have the ability to rename or modify these files."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.003"
name = "Rename Legitimate Utilities"
reference = "https://attack.mitre.org/techniques/T1036/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 = "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
Stage 1: file
file where host.os.type == "linux" and event.action == "rename" and (
file.Ext.original.name : ("*.vmdk", "*.vmx", "*.vmxf", "*.vmsd", "*.vmsn", "*.vswp", "*.vmss", "*.nvram", "*.vmem") or
(file.name == "index.html" and file.Ext.original.path like "/usr/lib/vmware/*")
)
and not (
file.name : ("*.vmdk", "*.vmx", "*.vmxf", "*.vmsd", "*.vmsn", "*.vswp", "*.vmss", "*.nvram", "*.vmem") or
process.executable like (
"/usr/sbin/gdm", "/usr/share/dotnet/dotnet", "/usr/bin/dotnet", "/usr/sbin/apache2",
"/var/lib/docker/overlay2/*/usr/bin/dotnet", "/usr/lib/3cxpbx/3cxSystemService"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"rename" |
file.Ext.original.name | wildcard |
| field:"file.Ext.original.name" kind:wildcard |
file.Ext.original.path | wildcard |
| field:"file.Ext.original.path" kind:wildcard value:"/usr/lib/vmware/*" |
file.name | eq |
| field:"file.name" kind:eq value:"index.html" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.name | ends_with | .vmdk, .vmx, .vmxf, .vmsd, .vmsn, .vswp, .vmss, .nvram, .vmem | excludes:file.name |
process.executable | wildcard | /usr/sbin/gdm, /usr/share/dotnet/dotnet, /usr/bin/dotnet, /usr/sbin/apache2, /var/lib/docker/overlay2/*/usr/bin/dotnet, /usr/lib/3cxpbx/3cxSystemService | excludes:process.executable |
Suspicious Terraform Provider Execution and Network Connection
#Identifies an unsigned or untrusted Terraform provider binary launched by Terraform during init or plan from a user writable path outside the official registry.terraform.io provider cache, followed by an outbound network connection. Attackers may supply malicious provider binaries via typosquatted provider registries to establish access and download additional tooling, as observed in the KelpDAO incident.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Command & Control |
Telemetry Coverage
Rule Body
[rule]
description = """
Identifies an unsigned or untrusted Terraform provider binary launched by Terraform during init or plan from a user
writable path outside the official registry.terraform.io provider cache, followed by an outbound network connection.
Attackers may supply malicious provider binaries via typosquatted provider registries to establish access and download
additional tooling, as observed in the KelpDAO incident.
"""
id = "b4e8a1c3-5d6f-4a7b-9e0c-2d3f8a1b6c7e"
license = "Elastic License v2"
name = "Suspicious Terraform Provider Execution and Network Connection"
os_list = ["macos", "windows"]
reference = [
"https://layerzero.network/publications/kelpdao-incident-report.pdf",
"https://developer.hashicorp.com/terraform/cli/plugins/about-plugins",
]
version = "1.0.2"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "exec" and
process.name like "terraform-provider-*" and process.parent.name in ("terraform", "terraform.exe") and
process.executable like ("/Users/*", "/tmp/*", "/private/tmp/*", "?:\\Users\\*", "?:\\Users\\ProgramData\\*") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
process.parent.command_line like ("* init*", "*plan*") and
not process.command_line like (".terraform/providers/registry.terraform.io/*", ".terraform\\providers\\registry.terraform.io\\*") and
not process.executable like ("*/registry.terraform.io/*",
"*/registry.opentofu.org/*",
"*.terraform.d/plugins/terraform.local/Mastercard/*",
"*\\registry.terraform.io\\*",
"*\\registry.opentofu.org\\*",
"*.terraform.d\\plugins\\terraform.local\\Mastercard\\*")]
[any where
(event.category == "network" and event.action == "connection_attempted" and destination.domain != null and
not (process.name == "terraform-provider-aws" and destination.domain like "*.amazonaws.com") and
not (process.name == "terraform-provider-elasticstate" and destination.domain like "*.elastic.cloud")) or
(event.category == "dns" and dns.question.name != null and
not (process.name == "terraform-provider-aws.exe" and dns.question.name like "*.amazonaws.com") and
not (process.name == "terraform-provider-elasticstate.exe" and dns.question.name like "*.elastic.cloud"))
]
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[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.action == "exec" and
process.name like "terraform-provider-*" and process.parent.name in ("terraform", "terraform.exe") and
process.executable like ("/Users/*", "/tmp/*", "/private/tmp/*", "?:\\Users\\*", "?:\\Users\\ProgramData\\*") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
process.parent.command_line like ("* init*", "*plan*") and
not process.command_line like (".terraform/providers/registry.terraform.io/*", ".terraform\\providers\\registry.terraform.io\\*") and
not process.executable like ("*/registry.terraform.io/*",
"*/registry.opentofu.org/*",
"*.terraform.d/plugins/terraform.local/Mastercard/*",
"*\\registry.terraform.io\\*",
"*\\registry.opentofu.org\\*",
"*.terraform.d\\plugins\\terraform.local\\Mastercard\\*")]
Stage 2: any
[any where
(event.category == "network" and event.action == "connection_attempted" and destination.domain != null and
not (process.name == "terraform-provider-aws" and destination.domain like "*.amazonaws.com") and
not (process.name == "terraform-provider-elasticstate" and destination.domain like "*.elastic.cloud")) or
(event.category == "dns" and dns.question.name != null and
not (process.name == "terraform-provider-aws.exe" and dns.question.name like "*.amazonaws.com") and
not (process.name == "terraform-provider-elasticstate.exe" and dns.question.name like "*.elastic.cloud"))
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.domain | is_not_null | field:"DestinationHostname" kind:is_not_null | |
dns.question.name | is_not_null | field:"QueryName" kind:is_not_null | |
event.action | eq |
| field:"EventType" kind:eq |
event.category | eq |
| field:"event.category" kind:eq |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"terraform-provider-*" |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | starts_with | .terraform/providers/registry.terraform.io/, .terraform\providers\registry.terraform.io\ | excludes:process.command_line field:"process.command_line" value:".terraform/providers/registry.terraform.io/" field:"process.command_line" value:".terraform\providers\registry.terraform.io\" |
process.executable | match | /registry.terraform.io/, /registry.opentofu.org/, .terraform.d/plugins/terraform.local/Mastercard/, \registry.terraform.io\, \registry.opentofu.org\, .terraform.d\plugins\terraform.local\Mastercard\ | excludes:process.executable |
Suspicious which Enumeration
#This rule monitors for the usage of the which command with an unusual amount of process arguments. Attackers may leverage the which command to enumerate the system for useful installed utilities that may be used after compromising a system to escalate privileges or move latteraly across the network.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[metadata]
creation_date = "2023/08/30"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the usage of the which command with an unusual amount of process arguments. Attackers may
leverage the which command to enumerate the system for useful installed utilities that may be used after compromising a
system to escalate privileges or move latteraly across the network.
"""
from = "now-9m"
index = ["endgame-*", "logs-endpoint.events.process*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious which Enumeration"
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 which Enumeration
The `which` command in Linux environments is typically used to locate the executable path of a command. Adversaries may exploit this utility to identify installed software that can aid in privilege escalation or lateral movement. The detection rule flags unusual usage patterns, such as excessive arguments, which may indicate malicious enumeration. It filters out benign scenarios, focusing on potential threats by examining process attributes and parent-child relationships.
### Possible investigation steps
- Review the process details to confirm the command line arguments used with the which command, focusing on whether the args_count is unusually high and if the arguments are related to known enumeration or exploitation tools.
- Examine the parent process of the which command to determine if it is a legitimate process or if it is associated with suspicious activity, especially if it is not one of the excluded parent names or paths.
- Investigate the user account associated with the process to determine if it is a legitimate user or if there are signs of compromise, such as unusual login times or locations.
- Check for any other recent alerts or logs related to the same host or user that might indicate a broader attack pattern or ongoing compromise.
- Assess the network activity from the host to identify any connections to known malicious IP addresses or unusual outbound traffic that could suggest lateral movement or data exfiltration.
### False positive analysis
- Processes initiated by the 'jem' parent process may trigger false positives. To handle this, add 'jem' to the list of exceptions in the rule configuration.
- Executions within containerized environments, such as those under '/vz/root/' or '/var/lib/docker/', are often benign. Exclude these paths from the rule to reduce noise.
- The '--tty-only' argument is typically used in legitimate scenarios. Consider adding this argument to the exception list to prevent unnecessary alerts.
- If the rule is noisy due to common utilities like 'nmap', 'nc', 'gcc', or 'socat' being used with shell interpreters like 'bash' or 'zsh', refine the rule by excluding these combinations.
- Regularly review and update the list of exceptions based on the evolving environment and usage patterns to maintain an effective balance between detection and false positive reduction.
### Response and remediation
- Immediately isolate the affected system from the network to prevent potential lateral movement by the adversary.
- Terminate any suspicious processes associated with the `which` command that have an unusually high number of arguments, as identified by the detection rule.
- Conduct a thorough review of the system's installed software and utilities to identify any unauthorized or suspicious installations that could be leveraged for privilege escalation.
- Analyze the process tree and parent-child relationships of the flagged `which` command execution to identify potential malicious scripts or binaries that initiated the command.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems have been compromised.
- Implement enhanced monitoring and logging for the `which` command and similar enumeration tools to detect future misuse.
- Review and update access controls and permissions to ensure that only authorized users have the ability to execute potentially sensitive commands and utilities."""
risk_score = 21
rule_id = "5b18eef4-842c-4b47-970f-f08d24004bde"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start") and
process.name == "which" and process.args_count >= 10 and not (
process.parent.name == "jem" or
process.parent.executable like ("/vz/root/*", "/var/lib/docker/*") or
process.args == "--tty-only"
)
/* potential tuning if rule would turn out to be noisy
and process.args in ("nmap", "nc", "ncat", "netcat", nc.traditional", "gcc", "g++", "socat") and
process.parent.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
*/
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[[rule.threat.technique]]
id = "T1083"
name = "File and Directory Discovery"
reference = "https://attack.mitre.org/techniques/T1083/"
[[rule.threat.technique]]
id = "T1518"
name = "Software Discovery"
reference = "https://attack.mitre.org/techniques/T1518/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start") and
process.name == "which" and process.args_count >= 10 and not (
process.parent.name == "jem" or
process.parent.executable like ("/vz/root/*", "/var/lib/docker/*") or
process.args == "--tty-only"
)
/* potential tuning if rule would turn out to be noisy
and process.args in ("nmap", "nc", "ncat", "netcat", nc.traditional", "gcc", "g++", "socat") and
process.parent.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
*/
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args_count | ge |
| field:"process.args_count" kind:ge value:"10" |
process.name | eq |
| field:"process_basename" kind:eq value:"which" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | --tty-only | excludes:process.args field:"process.args" value:"--tty-only" |
process.parent.executable | starts_with | /vz/root/, /var/lib/docker/ | excludes:process.parent.executable field:"process.parent.executable" value:"/vz/root/" field:"process.parent.executable" value:"/var/lib/docker/" |
process.parent.name | eq | jem | excludes:process.parent.name field:"process.parent.name" value:"jem" |
System Binary Copied or Moved
#This rule detects the copying or moving of system binaries using common shell commands. Attackers may copy or move system binaries to different locations or rename them to evade detection or maintain persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
This rule detects the copying or moving of system binaries using common shell commands. Attackers may copy or move
system binaries to different locations or rename them to evade detection or maintain persistence.
"""
id = "4daceba6-54be-4dfc-95ab-a4a9c19c77af"
license = "Elastic License v2"
name = "System Binary Copied or Moved"
os_list = ["linux"]
version = "1.0.16"
query = '''
process where event.type == "start" and event.action == "exec" and process.name in ("cp", "mv") and
process.args in (
"/bin/sh", "/usr/bin/sh", "/usr/local/bin/sh",
"/bin/bash", "/usr/bin/bash", "/usr/local/bin/bash",
"/bin/dash", "/usr/bin/dash", "/usr/local/bin/dash",
"/bin/zsh", "/usr/bin/zsh", "/usr/local/bin/zsh",
"/bin/ksh", "/usr/bin/ksh", "/usr/local/bin/ksh",
"/bin/nc", "/usr/bin/nc", "/usr/local/bin/nc",
"/bin/netcat", "/usr/bin/netcat", "/usr/local/bin/netcat",
"/bin/ncat", "/usr/bin/ncat", "/usr/local/bin/ncat",
"/bin/nc.traditional", "/usr/bin/nc.traditional", "/usr/local/bin/nc.traditional",
"/bin/nc.openbsd", "/usr/bin/nc.openbsd", "/usr/local/bin/nc.openbsd",
"/bin/netcat.openbsd", "/usr/bin/netcat.openbsd", "/usr/local/bin/netcat.openbsd",
"/bin/netcat.traditional", "/usr/bin/netcat.traditional", "/usr/local/bin/netcat.traditional",
"/bin/socat", "/usr/bin/socat", "/usr/local/bin/socat",
"/bin/nmap", "/usr/bin/nmap", "/usr/local/bin/nmap",
"/bin/telnet", "/usr/bin/telnet", "/usr/local/bin/telnet",
"/bin/curl", "/usr/bin/curl", "/usr/local/bin/curl",
"/bin/wget", "/usr/bin/wget", "/usr/local/bin/wget",
"/bin/python", "/usr/bin/python", "/usr/local/bin/python",
"/bin/python3", "/usr/bin/python3", "/usr/local/bin/python3",
"/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/awk", "/usr/bin/awk", "/usr/local/bin/awk",
"/bin/busybox", "/usr/bin/busybox", "/usr/local/bin/busybox",
"/bin/find", "/usr/bin/find", "/usr/local/bin/find",
"/bin/xargs", "/usr/bin/xargs", "/usr/local/bin/xargs",
"/bin/env", "/usr/bin/env", "/usr/local/bin/env",
"/bin/cut", "/usr/bin/cut", "/usr/local/bin/cut",
"/bin/tee", "/usr/bin/tee", "/usr/local/bin/tee",
"/bin/ssh", "/usr/bin/ssh", "/usr/local/bin/ssh",
"/bin/sshd", "/usr/bin/sshd", "/usr/local/bin/sshd",
"/bin/scp", "/usr/bin/scp", "/usr/local/bin/scp",
"/bin/ftp", "/usr/bin/ftp", "/usr/local/bin/ftp",
"/bin/tftp", "/usr/bin/tftp", "/usr/local/bin/tftp",
"/bin/kubectl", "/usr/bin/kubectl", "/usr/local/bin/kubectl",
"/bin/crictl", "/usr/bin/crictl", "/usr/local/bin/crictl",
"/bin/dockerd", "/usr/bin/dockerd", "/usr/local/bin/dockerd",
"/bin/docker", "/usr/bin/docker", "/usr/local/bin/docker",
"/bin/containerd", "/usr/bin/containerd", "/usr/local/bin/containerd"
) and process.args_count >= 3 and not (
process.parent.executable like (
"/usr/lib/dracut/dracut-install", "/usr/bin/make", "/bin/make", "/usr/share/initramfs-tools/hooks/*", "/var/lib/dpkg/info/*",
"/usr/local/bin/sigostclsh8.6", "/usr/lib/usrmerge/convert-usrmerge", "/usr/sbin/rear", "/usr/bin/byobu-status", "/sbin/rear",
"/usr/bin/find", "/tmp/newroot/nix/store/*/activate", "/nix/store/*/activate", "/var/lib/containers/storage/overlay/nix/store/*/activate",
"/var/lib/dpkg/tmp.ci/preinst", "/usr/sbin/nv-update-initrd", "/sbin/dracut", "/opt/SIGOS/*", "/tmp/newroot/usr/lib/dracut/dracut-install",
"/usr/libexec/flatpak-session-helper", "/usr/sbin/mkinitramfs", "/var/tmp/portage/*/libtool", "/tmp/newroot/usr/bin/make"
) or
process.working_directory like (
"/etc/localtime/var/lib/rancher", "/run/k3s/containerd/*", "/var/lib/docker/*", "/var/lib/rancher", "/var/tmp/portage/*"
) or
process.args like ("/var/tmp/dracut.*/initramfs/*", "/var/tmp/mkinitramfs_*", "/opt/jail/driver-jail/*") or
process.parent.args like (
"/var/tmp/rpm-tmp*", "/usr/sbin/rear", "/usr/lib/usrmerge/convert-usrmerge", "/usr/share/initramfs-tools/hooks/zz-busybox",
"./libtool", "/var/lib/dpkg/info/dash.postinst", "*./libtool*", "/usr/bin/mkinitcpio", "/sbin/rear"
) or
process.command_line in (
"mv kubectl /usr/bin/kubectl", "mv ./kubectl /usr/bin/kubectl", "cp kubectl /usr/local/bin/kubectl",
"mv kubectl /usr/local/bin/kubectl", "mv ./kubectl /usr/local/bin/kubectl",
"/usr/bin/coreutils --coreutils-prog-shebang=cp /usr/bin/cp /usr/bin/sh /tmp"
) or
(process.parent.command_line like "/nix/store/*" and process.command_line == "mv /bin/.sh.tmp /bin/sh") or
(process.parent.name == "shtool" and process.command_line == "mv /usr/local/bin/#INST@*# /usr/local/bin/php") or
(
process.args like "./curl.leap*.x86_64" and
process.working_directory like "/opt/SIGOS/sitedata/exec/*"
) or
process.parent.command_line == "/usr/bin/runc init"
)
'''
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 = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[threat.technique.subtechnique]]
id = "T1036.003"
name = "Rename Legitimate Utilities"
reference = "https://attack.mitre.org/techniques/T1036/003/"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name in ("cp", "mv") and
process.args in (
"/bin/sh", "/usr/bin/sh", "/usr/local/bin/sh",
"/bin/bash", "/usr/bin/bash", "/usr/local/bin/bash",
"/bin/dash", "/usr/bin/dash", "/usr/local/bin/dash",
"/bin/zsh", "/usr/bin/zsh", "/usr/local/bin/zsh",
"/bin/ksh", "/usr/bin/ksh", "/usr/local/bin/ksh",
"/bin/nc", "/usr/bin/nc", "/usr/local/bin/nc",
"/bin/netcat", "/usr/bin/netcat", "/usr/local/bin/netcat",
"/bin/ncat", "/usr/bin/ncat", "/usr/local/bin/ncat",
"/bin/nc.traditional", "/usr/bin/nc.traditional", "/usr/local/bin/nc.traditional",
"/bin/nc.openbsd", "/usr/bin/nc.openbsd", "/usr/local/bin/nc.openbsd",
"/bin/netcat.openbsd", "/usr/bin/netcat.openbsd", "/usr/local/bin/netcat.openbsd",
"/bin/netcat.traditional", "/usr/bin/netcat.traditional", "/usr/local/bin/netcat.traditional",
"/bin/socat", "/usr/bin/socat", "/usr/local/bin/socat",
"/bin/nmap", "/usr/bin/nmap", "/usr/local/bin/nmap",
"/bin/telnet", "/usr/bin/telnet", "/usr/local/bin/telnet",
"/bin/curl", "/usr/bin/curl", "/usr/local/bin/curl",
"/bin/wget", "/usr/bin/wget", "/usr/local/bin/wget",
"/bin/python", "/usr/bin/python", "/usr/local/bin/python",
"/bin/python3", "/usr/bin/python3", "/usr/local/bin/python3",
"/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/awk", "/usr/bin/awk", "/usr/local/bin/awk",
"/bin/busybox", "/usr/bin/busybox", "/usr/local/bin/busybox",
"/bin/find", "/usr/bin/find", "/usr/local/bin/find",
"/bin/xargs", "/usr/bin/xargs", "/usr/local/bin/xargs",
"/bin/env", "/usr/bin/env", "/usr/local/bin/env",
"/bin/cut", "/usr/bin/cut", "/usr/local/bin/cut",
"/bin/tee", "/usr/bin/tee", "/usr/local/bin/tee",
"/bin/ssh", "/usr/bin/ssh", "/usr/local/bin/ssh",
"/bin/sshd", "/usr/bin/sshd", "/usr/local/bin/sshd",
"/bin/scp", "/usr/bin/scp", "/usr/local/bin/scp",
"/bin/ftp", "/usr/bin/ftp", "/usr/local/bin/ftp",
"/bin/tftp", "/usr/bin/tftp", "/usr/local/bin/tftp",
"/bin/kubectl", "/usr/bin/kubectl", "/usr/local/bin/kubectl",
"/bin/crictl", "/usr/bin/crictl", "/usr/local/bin/crictl",
"/bin/dockerd", "/usr/bin/dockerd", "/usr/local/bin/dockerd",
"/bin/docker", "/usr/bin/docker", "/usr/local/bin/docker",
"/bin/containerd", "/usr/bin/containerd", "/usr/local/bin/containerd"
) and process.args_count >= 3 and not (
process.parent.executable like (
"/usr/lib/dracut/dracut-install", "/usr/bin/make", "/bin/make", "/usr/share/initramfs-tools/hooks/*", "/var/lib/dpkg/info/*",
"/usr/local/bin/sigostclsh8.6", "/usr/lib/usrmerge/convert-usrmerge", "/usr/sbin/rear", "/usr/bin/byobu-status", "/sbin/rear",
"/usr/bin/find", "/tmp/newroot/nix/store/*/activate", "/nix/store/*/activate", "/var/lib/containers/storage/overlay/nix/store/*/activate",
"/var/lib/dpkg/tmp.ci/preinst", "/usr/sbin/nv-update-initrd", "/sbin/dracut", "/opt/SIGOS/*", "/tmp/newroot/usr/lib/dracut/dracut-install",
"/usr/libexec/flatpak-session-helper", "/usr/sbin/mkinitramfs", "/var/tmp/portage/*/libtool", "/tmp/newroot/usr/bin/make"
) or
process.working_directory like (
"/etc/localtime/var/lib/rancher", "/run/k3s/containerd/*", "/var/lib/docker/*", "/var/lib/rancher", "/var/tmp/portage/*"
) or
process.args like ("/var/tmp/dracut.*/initramfs/*", "/var/tmp/mkinitramfs_*", "/opt/jail/driver-jail/*") or
process.parent.args like (
"/var/tmp/rpm-tmp*", "/usr/sbin/rear", "/usr/lib/usrmerge/convert-usrmerge", "/usr/share/initramfs-tools/hooks/zz-busybox",
"./libtool", "/var/lib/dpkg/info/dash.postinst", "*./libtool*", "/usr/bin/mkinitcpio", "/sbin/rear"
) or
process.command_line in (
"mv kubectl /usr/bin/kubectl", "mv ./kubectl /usr/bin/kubectl", "cp kubectl /usr/local/bin/kubectl",
"mv kubectl /usr/local/bin/kubectl", "mv ./kubectl /usr/local/bin/kubectl",
"/usr/bin/coreutils --coreutils-prog-shebang=cp /usr/bin/cp /usr/bin/sh /tmp"
) or
(process.parent.command_line like "/nix/store/*" and process.command_line == "mv /bin/.sh.tmp /bin/sh") or
(process.parent.name == "shtool" and process.command_line == "mv /usr/local/bin/#INST@*# /usr/local/bin/php") or
(
process.args like "./curl.leap*.x86_64" and
process.working_directory like "/opt/SIGOS/sitedata/exec/*"
) or
process.parent.command_line == "/usr/bin/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_count | ge |
| field:"process.args_count" kind:ge value:"3" |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | ./curl.leap*.x86_64 | excludes:process.args field:"process.args" value:"./curl.leap*.x86_64" |
process.working_directory | starts_with | /opt/SIGOS/sitedata/exec/ | excludes:process.working_directory field:"process.working_directory" value:"/opt/SIGOS/sitedata/exec/" |
process.command_line | eq | mv /bin/.sh.tmp /bin/sh | excludes:process.command_line field:"process.command_line" value:"mv /bin/.sh.tmp /bin/sh" |
process.parent.command_line | starts_with | /nix/store/ | excludes:process.parent.command_line field:"process.parent.command_line" value:"/nix/store/" |
process.command_line | eq | mv /usr/local/bin/#INST@*# /usr/local/bin/php | excludes:process.command_line field:"process.command_line" value:"mv /usr/local/bin/#INST@*# /usr/local/bin/php" |
process.parent.name | eq | shtool | excludes:process.parent.name field:"process.parent.name" value:"shtool" |
process.args | wildcard | /var/tmp/dracut.*/initramfs/*, /var/tmp/mkinitramfs_*, /opt/jail/driver-jail/* | excludes:process.args field:"process.args" value:"/var/tmp/dracut.*/initramfs/*" field:"process.args" value:"/var/tmp/mkinitramfs_*" field:"process.args" value:"/opt/jail/driver-jail/*" |
process.command_line | in | /usr/bin/coreutils --coreutils-prog-shebang=cp /usr/bin/cp /usr/bin/sh /tmp, cp kubectl /usr/local/bin/kubectl, mv ./kubectl /usr/bin/kubectl, mv ./kubectl /usr/local/bin/kubectl, mv kubectl /usr/bin/kubectl, mv kubectl /usr/local/bin/kubectl | excludes:process.command_line |
process.parent.args | wildcard | /var/tmp/rpm-tmp*, /usr/sbin/rear, /usr/lib/usrmerge/convert-usrmerge, /usr/share/initramfs-tools/hooks/zz-busybox, ./libtool, /var/lib/dpkg/info/dash.postinst, *./libtool*, /usr/bin/mkinitcpio, /sbin/rear | excludes:process.parent.args |
process.parent.command_line | eq | /usr/bin/runc init | excludes:process.parent.command_line field:"process.parent.command_line" value:"/usr/bin/runc init" |
process.parent.executable | wildcard | /usr/lib/dracut/dracut-install, /usr/bin/make, /bin/make, /usr/share/initramfs-tools/hooks/*, /var/lib/dpkg/info/*, /usr/local/bin/sigostclsh8.6, /usr/lib/usrmerge/convert-usrmerge, /usr/sbin/rear, /usr/bin/byobu-status, /sbin/rear, /usr/bin/find, /tmp/newroot/nix/store/*/activate, /nix/store/*/activate, /var/lib/containers/storage/overlay/nix/store/*/activate, /var/lib/dpkg/tmp.ci/preinst, /usr/sbin/nv-update-initrd, /sbin/dracut, /opt/SIGOS/*, /tmp/newroot/usr/lib/dracut/dracut-install, /usr/libexec/flatpak-session-helper, /usr/sbin/mkinitramfs, /var/tmp/portage/*/libtool, /tmp/newroot/usr/bin/make | excludes:process.parent.executable |
process.working_directory | wildcard | /etc/localtime/var/lib/rancher, /run/k3s/containerd/*, /var/lib/docker/*, /var/lib/rancher, /var/tmp/portage/* | excludes:process.working_directory |
UAC Bypass Attempt via Windows Directory Masquerading
#Identifies an attempt to bypass User Account Control (UAC) by masquerading as a Microsoft trusted Windows directory. Attackers may bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation | |
| Stealth |
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 = "2020/10/26"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Identifies an attempt to bypass User Account Control (UAC) by masquerading as a Microsoft trusted Windows directory.
Attackers may bypass UAC to stealthily execute code with elevated permissions.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "UAC Bypass Attempt via Windows Directory Masquerading"
references = ["https://medium.com/tenable-techblog/uac-bypass-by-mocking-trusted-directories-24a96675f6e"]
risk_score = 73
rule_id = "290aca65-e94d-403b-ba0f-62f320e63f51"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.args : ("C:\\Windows \\system32\\*.exe", "C:\\Windows \\SysWOW64\\*.exe")
'''
note = """## Triage and analysis
### Investigating UAC Bypass Attempt via Windows Directory Masquerading
#### Possible investigation steps
- Does the alert-local path prove execution from a mock trusted Windows directory?
- Why: This technique abuses a trailing-space "C:\\Windows " tree that AppInfo checks can normalize while the fake path still executes.
- Focus: `process.executable` and `process.command_line`, especially "C:\\Windows \\System32\\" or "C:\\Windows \\SysWOW64\\" instead of the canonical Windows path.
- Implication: escalate when executable or argument paths contain the trailing-space trusted-directory clone; lower suspicion only when `process.executable` and `process.command_line` resolve to the canonical Windows path and later evidence does not contradict that.
- Is the binary a copied auto-elevating Windows executable?
- Focus: `process.name`, `process.pe.original_file_name`, `process.code_signature.subject_name`, `process.code_signature.trusted`, and `process.hash.sha256`.
- Implication: escalate when a signed Microsoft auto-elevating binary runs from the fake tree, name or PE metadata imitates one, or the hash is unfamiliar; if not auto-elevating, keep suspicious as path masquerading or staging until lineage and artifacts explain it.
- Do the parent, user, and token context fit a UAC-bypass transition?
- Focus: `process.parent.executable`, `process.parent.command_line`, `user.id`, `process.Ext.token.integrity_level_name`, and `process.Ext.token.elevation_level`.
- Implication: escalate when a browser, document process, script host, installer, or remote-admin parent launches the copied binary with high or full integrity; lower suspicion when parent, user, token state, and host cohort align with confirmed compatibility or security testing.
- Did file events show the fake tree being staged before or by the alerting process?
- Focus: same-`host.id` file events where `file.path` is under "C:\\Windows \\", plus alert-process file events scoped by `process.entity_id` when present. $investigate_2
- Hint: File telemetry is conditional; missing file events leave staging unresolved, not benign. Use `file.Ext.original.path`, `file.origin_url`, and `file.Ext.windows.zone_identifier` only when the fake-tree writer is unclear.
- Implication: escalate when any process creates "C:\\Windows \\", copies the auto-elevating executable, or drops a same-directory DLL; lower suspicion only when fake-tree artifacts are bounded to controlled lab testing with no contradictory DLL or child-process evidence.
- Did the copied binary load a sidecar DLL from the fake tree?
- Focus: library events scoped by `host.id` plus `process.entity_id` when present; review `dll.path`, `dll.hash.sha256`, and `dll.code_signature.subject_name`. $investigate_3
- Hint: Library telemetry is conditional; missing library events leave DLL payload execution unresolved, not benign.
- Implication: escalate when the copied binary loads a same-directory DLL from the fake tree, especially unsigned, unfamiliar, or mismatched; if no DLL evidence appears, continue to child-process review before treating execution as unresolved.
- Did the copied binary spawn elevated follow-on code?
- Focus: same-`host.id` child processes where `process.parent.entity_id` matches `process.entity_id`; review child `process.command_line` and `process.Ext.token.integrity_level_name`. $investigate_4
- Implication: escalate when the copied binary spawns high-integrity shells, scripts, payloads, or unexpected admin tools; if no child appears, treat execution as unresolved unless path, binary, parent, file, and DLL evidence all support controlled lab testing.
- If local evidence is suspicious or incomplete, is the same fake path or host showing related activity?
- Focus: related alerts for the same `process.executable` fake path, especially UAC-bypass, masquerading, or payload-staging detections; check same-host alert history for privilege-escalation, defense-evasion, or suspicious file-staging context.
- $investigate_0
- $investigate_1
- Implication: escalate scope when the same fake path appears across hosts or the same host has surrounding staging, privilege-escalation, or defense-evasion alerts; keep scope local only when local evidence also supports controlled lab testing.
- What disposition do the fake path, binary identity, lineage, artifacts, execution, and scope support?
- Escalate when path, binary identity, lineage, artifacts, execution, or scope show fake-tree UAC bypass; close only when all categories align with controlled lab testing and no contradictions remain; preserve artifacts and escalate when mixed or incomplete.
### False positive analysis
- This behavior is an operational anti-pattern outside explicit testing. Authorized compatibility or security research can trigger it only when a team deliberately constructs a trailing-space Windows tree in a controlled lab. Confirm exact `process.executable`, stable `process.hash.sha256`, Microsoft signer and original file name, `process.parent.executable`, `user.id`, `host.id`, and sidecar-DLL behavior against the same test. If test plans exist, require alignment; otherwise rely on prior alerts for the same path, hash, parent workflow, and lab cohort without unexpected elevated children.
- Do not treat a signed Microsoft binary or lab host as sufficient. Same-directory DLL load, elevated shell, suspicious parent, internet-provenance file event, or recurrence outside the expected cohort keeps the alert suspicious until the exact test scope explains it.
- Before an exception, validate recurrence of the minimum workflow pattern: exact `process.executable`, stable `process.hash.sha256`, `process.parent.executable`, expected sidecar-DLL behavior, and bounded `host.id` or `user.id` cohort. Avoid exceptions on "C:\\Windows " alone, binary name alone, or `host.id` alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and record the exact fake-tree path, copied binary hash, parent workflow, user/host cohort, and sidecar-DLL behavior that proved the recognized workflow. Create an exception only after that same pattern recurs consistently for this rule.
- If suspicious but unconfirmed, preserve a case export for the alert process, parent chain, token context, fake-tree directory, copied binary, sidecar DLLs and hashes, and any elevated child details before containment. Apply reversible containment next, such as restricting execution from the fake tree or isolating the affected host if sidecar loading, elevated children, or broader post-exploitation evidence is active.
- If confirmed malicious, collect the copied auto-elevating binary and sidecar DLLs, preserve process, file, and library telemetry, then isolate the host after weighing business criticality. Scope other hosts for the same fake path, copied binary hash, and DLL pattern before killing processes, deleting the fake "system32" tree, and remediating the launcher or access path that staged it.
- Post-incident hardening: remove the fake trailing-space directory tree, restrict creation or execution of copied Windows binaries from user-writable or fake trusted paths, retain file/library/process telemetry for same-directory DLL hijacking, and record the recovered auto-elevating-binary and DLL pair for future triage.
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [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.investigation_fields]
field_names = [
"@timestamp",
"host.id",
"user.id",
"process.entity_id",
"process.executable",
"process.command_line",
"process.working_directory",
"process.pe.original_file_name",
"process.code_signature.subject_name",
"process.code_signature.trusted",
"process.hash.sha256",
"process.parent.executable",
"process.parent.command_line",
"process.Ext.token.elevation_level",
"process.Ext.token.integrity_level_name",
]
[transform]
[[transform.investigate]]
label = "Alerts associated with the same fake executable path"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "process.executable", queryType = "phrase", value = "{{process.executable}}", 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 = "File events for the suspicious process"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Library events for the suspicious process"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "library", valueType = "string" },
{ 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" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Child processes launched by the copied binary"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[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.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[rule.threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.args : ("C:\\Windows \\system32\\*.exe", "C:\\Windows \\SysWOW64\\*.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
Web Server Local File Inclusion Activity
#This rule detects potential Local File Inclusion (LFI) activity on web servers by identifying HTTP GET requests that attempt to access sensitive local files through directory traversal techniques or known file paths. Attackers may exploit LFI vulnerabilities to read sensitive files, gain system information, or further compromise the server.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Credential Access | |
| Discovery | |
| Collection |
Rule Body
[metadata]
creation_date = "2025/12/02"
integration = ["nginx", "apache", "apache_tomcat", "iis", "traefik"]
maturity = "production"
min_stack_version = "9.3.0"
min_stack_comments = "Changing min stack to 9.3.0, the latest minimum supported version for 9.X releases."
updated_date = "2026/07/20"
[rule]
author = ["Elastic"]
description = """
This rule detects potential Local File Inclusion (LFI) activity on web servers by identifying HTTP GET requests that
attempt to access sensitive local files through directory traversal techniques or known file paths. Attackers may
exploit LFI vulnerabilities to read sensitive files, gain system information, or further compromise the server.
"""
from = "now-11m"
interval = "10m"
language = "esql"
license = "Elastic License v2"
name = "Web Server Local File Inclusion Activity"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Web Server Local File Inclusion Activity
This rule surfaces successful GET requests containing directory traversal or direct access to sensitive paths, signaling Local File Inclusion exploitation that can expose credentials, configuration, and process context and enable further compromise. A common attacker pattern is abusing a vulnerable parameter to fetch ../../../../etc/passwd, then pivoting to /proc/self/environ to harvest secrets and identify execution context for subsequent steps.
### Possible investigation steps
- Retrieve contiguous access logs around the alert to rebuild each request/response pair (URI, parameters, user agent, referer, cookies, X-Forwarded-For) and identify which parameter reflected traversal or wrapper usage and whether the response likely contained file contents.
- Compare response sizes and content-types for the suspicious requests to normal pages and look for signatures such as "root:x:" lines, INI/XML keys, or base64 blobs that indicate disclosure of /etc/passwd, web.config/applicationhost.config, or other sensitive files.
- Review web server and application error logs at the same timestamps for include/open stream warnings, open_basedir or allow_url_fopen messages, and stack traces to confirm the code path handling the input and any mitigations in place.
- Pivot on the same source and timeframe to find adjacent probes (php://filter, data://, expect://, zip://, phar://, /proc/self/environ, traversal into webroots/configs) and any follow-on POSTs to upload endpoints or new script paths, signaling progression toward RCE or webshell placement.
- Determine whether the traffic was authenticated and whether it traversed a WAF or reverse proxy by correlating cookies or session IDs and client IPs with proxy/WAF logs, noting any blocks, rule matches, or bypasses to bound scope and urgency.
### False positive analysis
- A site search or documentation endpoint echoing user-supplied text can include strings like ../../../../etc/passwd, windows/win.ini, or php://filter in the query string and return a normal 200 OK results page rather than performing a file include.
- An authenticated admin feature (such as a log viewer or file browser) may legitimately accept path= or file= parameters referencing local paths like /var/log/nginx or /inetpub/logs/logfiles and return 200 when serving allowed files, producing URLs that match the rule without exploitation.
### Response and remediation
- Immediately block the source IP at the reverse proxy/WAF and deploy deny rules for GET requests using ../../ or ..\\..\\ traversal or wrappers (php://, expect://, data://) that fetch /etc/passwd, /proc/self/environ, wp-config.php, web.config, or applicationhost.config.
- Configure the web server to return 403 for paths resolving to /proc, /etc, /var/log, /inetpub, applicationhost.config, and web.config and to reject wrapper schemes like php:// and expect://, then reload Nginx/Apache/IIS to apply.
- Fix the vulnerable include logic by canonicalizing input with realpath, rejecting any .. segments or absolute paths, enforcing a whitelist of allowed files, and in PHP disabling allow_url_include/allow_url_fopen and setting open_basedir to a safe directory.
- Rotate exposed secrets by changing database and API credentials from wp-config.php, connection strings and machine keys from web.config/applicationhost.config, and any tokens in /proc/self/environ, then invalidate active sessions and cache.
- Escalate to incident leadership and quarantine the host if response bodies contain credential patterns (e.g., "root:x:" from /etc/passwd or XML keys from web.config), if /etc/shadow or windows/system32/config/SAM was requested, or if follow-on POSTs or new .php/.aspx files appear in the webroot.
- Recover by verifying integrity of /var/www and /inetpub/wwwroot, scanning for webshells and unexpected includes, redeploying a known-good build or container image if tampering is found, and adding WAF normalization to double-decode URLs and 403 traversal attempts.
"""
risk_score = 21
rule_id = "90e4ceab-79a5-4f8e-879b-513cac7fcad9"
severity = "low"
tags = [
"Domain: Web",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Data Source: Nginx",
"Data Source: Apache",
"Data Source: Apache Tomcat",
"Data Source: IIS",
"Data Source: Traefik",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from
logs-nginx.access-*,
logs-apache.access-*,
logs-apache_tomcat.access-*,
logs-iis.access-*,
logs-traefik.access-*
| where
http.request.method == "GET" and
http.response.status_code == 200 and
url.original like "*=*"
| eval Esql.url_original_url_decoded_to_lower = to_lower(URL_DECODE(url.original))
| where
/* 1) Relative traversal */
Esql.url_original_url_decoded_to_lower like "*../../../../*" or // Unix-style traversal
Esql.url_original_url_decoded_to_lower like "*..\\\\..\\\\..\\\\..*" or // Windows-style traversal
// Potential security check bypassing (enforcing multiple dots and shortening the pattern)
Esql.url_original_url_decoded_to_lower like "*..././*" or
Esql.url_original_url_decoded_to_lower like "*...\\*" or
Esql.url_original_url_decoded_to_lower like "*....\\*" or
/* 2) Linux system identity / basic info */
Esql.url_original_url_decoded_to_lower like "*etc/passwd*" or
Esql.url_original_url_decoded_to_lower like "*etc/shadow*" or
Esql.url_original_url_decoded_to_lower like "*etc/hosts*" or
Esql.url_original_url_decoded_to_lower like "*etc/os-release*" or
Esql.url_original_url_decoded_to_lower like "*etc/issue*" or
/* 3) Linux /proc enumeration */
Esql.url_original_url_decoded_to_lower like "*proc/self/environ*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/cmdline*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/fd*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/exe*" or
/* 4) Linux webroots, configs & logs */
Esql.url_original_url_decoded_to_lower like "*var/www*" or // generic webroot
Esql.url_original_url_decoded_to_lower like "*wp-config.php*" or // classic WP config
Esql.url_original_url_decoded_to_lower like "*etc/apache2*" or
Esql.url_original_url_decoded_to_lower like "*etc/httpd*" or
Esql.url_original_url_decoded_to_lower like "*etc/nginx*" or
Esql.url_original_url_decoded_to_lower like "*var/log/apache2*" or
Esql.url_original_url_decoded_to_lower like "*var/log/httpd*" or
Esql.url_original_url_decoded_to_lower like "*var/log/nginx*" or
/* 5) Windows core files / identity */
Esql.url_original_url_decoded_to_lower like "*windows/panther/*unattend*" or
Esql.url_original_url_decoded_to_lower like "*windows/debug/netsetup.log*" or
Esql.url_original_url_decoded_to_lower like "*windows/win.ini*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/drivers/etc/hosts*" or
Esql.url_original_url_decoded_to_lower like "*boot.ini*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/config/*" or
Esql.url_original_url_decoded_to_lower like "*windows/repair/sam*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/license.rtf*" or
/* 6) Windows IIS / .NET configs, webroots & logs */
Esql.url_original_url_decoded_to_lower like "*/inetpub/wwwroot*" or
Esql.url_original_url_decoded_to_lower like "*/inetpub/logs/logfiles*" or
Esql.url_original_url_decoded_to_lower like "*applicationhost.config*" or
Esql.url_original_url_decoded_to_lower like "*/microsoft.net/framework64/*/config/web.config*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/inetsrv/*" or
/* 7) PHP & protocol wrappers */
Esql.url_original_url_decoded_to_lower like "*php://*" or
Esql.url_original_url_decoded_to_lower like "*zip://*" or
Esql.url_original_url_decoded_to_lower like "*phar://*" or
Esql.url_original_url_decoded_to_lower like "*expect://*" or
Esql.url_original_url_decoded_to_lower like "*file://*" or
Esql.url_original_url_decoded_to_lower like "*data://text/plain;base64*"
| keep
@timestamp,
Esql.url_original_url_decoded_to_lower,
source.ip,
agent.id,
agent.name,
http.request.method,
http.response.status_code,
data_stream.dataset,
data_stream.namespace
| stats
Esql.event_count = count(),
Esql.url_original_url_decoded_to_lower_count_distinct = count_distinct(Esql.url_original_url_decoded_to_lower),
Esql.agent_name_values = values(agent.name),
Esql.agent_id_values = values(agent.id),
Esql.http_request_method_values = values(http.request.method),
Esql.http_response_status_code_values = values(http.response.status_code),
Esql.url_original_url_decoded_to_lower_values = values(Esql.url_original_url_decoded_to_lower),
Esql.data_stream_dataset_values = values(data_stream.dataset),
Esql.data_stream_namespace_values = values(data_stream.namespace)
by source.ip
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1083"
name = "File and Directory Discovery"
reference = "https://attack.mitre.org/techniques/T1083/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1005"
name = "Data from Local System"
reference = "https://attack.mitre.org/techniques/T1005/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1190"
name = "Exploit Public-Facing Application"
reference = "https://attack.mitre.org/techniques/T1190/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
Stages and Predicates
Stage 1: from
from
logs-nginx.access-*,
logs-apache.access-*,
logs-apache_tomcat.access-*,
logs-iis.access-*,
logs-traefik.access-*
Stage 2: where
| where
http.request.method == "GET" and
http.response.status_code == 200 and
url.original like "*=*"
Stage 3: eval
| eval Esql.url_original_url_decoded_to_lower = to_lower(URL_DECODE(url.original))
Stage 4: where
| where
Esql.url_original_url_decoded_to_lower like "*../../../../*" or
Esql.url_original_url_decoded_to_lower like "*..\\\\..\\\\..\\\\..*" or
Esql.url_original_url_decoded_to_lower like "*..././*" or
Esql.url_original_url_decoded_to_lower like "*...\\*" or
Esql.url_original_url_decoded_to_lower like "*....\\*" or
Esql.url_original_url_decoded_to_lower like "*etc/passwd*" or
Esql.url_original_url_decoded_to_lower like "*etc/shadow*" or
Esql.url_original_url_decoded_to_lower like "*etc/hosts*" or
Esql.url_original_url_decoded_to_lower like "*etc/os-release*" or
Esql.url_original_url_decoded_to_lower like "*etc/issue*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/environ*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/cmdline*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/fd*" or
Esql.url_original_url_decoded_to_lower like "*proc/self/exe*" or
Esql.url_original_url_decoded_to_lower like "*var/www*" or
Esql.url_original_url_decoded_to_lower like "*wp-config.php*" or
Esql.url_original_url_decoded_to_lower like "*etc/apache2*" or
Esql.url_original_url_decoded_to_lower like "*etc/httpd*" or
Esql.url_original_url_decoded_to_lower like "*etc/nginx*" or
Esql.url_original_url_decoded_to_lower like "*var/log/apache2*" or
Esql.url_original_url_decoded_to_lower like "*var/log/httpd*" or
Esql.url_original_url_decoded_to_lower like "*var/log/nginx*" or
Esql.url_original_url_decoded_to_lower like "*windows/panther/*unattend*" or
Esql.url_original_url_decoded_to_lower like "*windows/debug/netsetup.log*" or
Esql.url_original_url_decoded_to_lower like "*windows/win.ini*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/drivers/etc/hosts*" or
Esql.url_original_url_decoded_to_lower like "*boot.ini*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/config/*" or
Esql.url_original_url_decoded_to_lower like "*windows/repair/sam*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/license.rtf*" or
Esql.url_original_url_decoded_to_lower like "*/inetpub/wwwroot*" or
Esql.url_original_url_decoded_to_lower like "*/inetpub/logs/logfiles*" or
Esql.url_original_url_decoded_to_lower like "*applicationhost.config*" or
Esql.url_original_url_decoded_to_lower like "*/microsoft.net/framework64/*/config/web.config*" or
Esql.url_original_url_decoded_to_lower like "*windows/system32/inetsrv/*" or
Esql.url_original_url_decoded_to_lower like "*php://*" or
Esql.url_original_url_decoded_to_lower like "*zip://*" or
Esql.url_original_url_decoded_to_lower like "*phar://*" or
Esql.url_original_url_decoded_to_lower like "*expect://*" or
Esql.url_original_url_decoded_to_lower like "*file://*" or
Esql.url_original_url_decoded_to_lower like "*data://text/plain;base64*"
Stage 5: keep
| keep
@timestamp,
Esql.url_original_url_decoded_to_lower,
source.ip,
agent.id,
agent.name,
http.request.method,
http.response.status_code,
data_stream.dataset,
data_stream.namespace
Stage 6: stats
| stats
Esql.event_count = count(),
Esql.url_original_url_decoded_to_lower_count_distinct = count_distinct(Esql.url_original_url_decoded_to_lower),
Esql.agent_name_values = values(agent.name),
Esql.agent_id_values = values(agent.id),
Esql.http_request_method_values = values(http.request.method),
Esql.http_response_status_code_values = values(http.response.status_code),
Esql.url_original_url_decoded_to_lower_values = values(Esql.url_original_url_decoded_to_lower),
Esql.data_stream_dataset_values = values(data_stream.dataset),
Esql.data_stream_namespace_values = values(data_stream.namespace)
by source.ip
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.url_original_url_decoded_to_lower | wildcard |
| field:"Esql.url_original_url_decoded_to_lower" kind:wildcard |
http.request.method | eq |
| field:"http.request.method" kind:eq value:"GET" |
http.response.status_code | eq |
| field:"http.response.status_code" kind:eq value:"200" |
url.original | wildcard |
| field:"url.original" kind:wildcard value:"*=*" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.event_count | STATS Esql.event_count = count() |
Esql.url_original_url_decoded_to_lower_count_distinct | STATS Esql.url_original_url_decoded_to_lower_count_distinct = count_distinct(Esql.url_original_url_decoded_to_lower) |
Esql.agent_name_values | STATS Esql.agent_name_values = values(agent.name) |
Esql.agent_id_values | STATS Esql.agent_id_values = values(agent.id) |
Esql.http_request_method_values | STATS Esql.http_request_method_values = values(http.request.method) |
Esql.http_response_status_code_values | STATS Esql.http_response_status_code_values = values(http.response.status_code) |
Esql.url_original_url_decoded_to_lower_values | STATS Esql.url_original_url_decoded_to_lower_values = values(Esql.url_original_url_decoded_to_lower) |
Esql.data_stream_dataset_values | STATS Esql.data_stream_dataset_values = values(data_stream.dataset) |
Esql.data_stream_namespace_values | STATS Esql.data_stream_namespace_values = values(data_stream.namespace) |
source.ip | STATS BY |