Detection rules › Elastic
Elastic rules: 11
Attempt to Modify an Okta Application
#Detects attempts to modify an Okta application. An adversary may attempt to modify, deactivate, or delete an Okta application in order to weaken an organization's security controls or disrupt their business operations.
Known False Positives
- Consider adding exceptions to this rule to filter false positives if your organization's Okta applications are regularly modified and the behavior is expected.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact | No specific technique |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Okta | System Log event type application.lifecycle.update: Application updated |
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
creation_date = "2020/11/06"
integration = ["okta"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects attempts to modify an Okta application. An adversary may attempt to modify, deactivate, or delete an Okta
application in order to weaken an organization's security controls or disrupt their business operations.
"""
false_positives = [
"""
Consider adding exceptions to this rule to filter false positives if your organization's Okta applications are
regularly modified and the behavior is expected.
""",
]
index = ["filebeat-*", "logs-okta*"]
language = "kuery"
license = "Elastic License v2"
name = "Attempt to Modify an Okta Application"
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 Attempt to Modify an Okta Application
Okta is a widely used identity management service that helps organizations manage user access to applications securely. Adversaries may target Okta applications to alter, deactivate, or delete them, aiming to compromise security controls or disrupt operations. The detection rule monitors system events for application lifecycle updates, flagging unauthorized modification attempts to preempt potential security breaches.
### Possible investigation steps
- Review the event logs for entries with event.dataset:okta.system and event.action:application.lifecycle.update to identify the specific application and user involved in the modification attempt.
- Verify the user's role and permissions within Okta to determine if they have legitimate access to modify the application.
- Check for any recent changes in user permissions or roles that might explain the modification attempt.
- Investigate the history of the application in question to see if there have been any previous unauthorized modification attempts or related security incidents.
- Correlate the event timestamp with other security logs and alerts to identify any concurrent suspicious activities or patterns that might indicate a broader attack.
### False positive analysis
- Routine administrative updates to Okta applications by authorized personnel can trigger alerts. To manage this, create exceptions for specific user accounts or roles known to perform regular maintenance.
- Scheduled application updates or maintenance activities may be flagged. Document these activities and adjust the monitoring schedule to avoid unnecessary alerts during these periods.
- Integration or testing environments often undergo frequent changes. Exclude these environments from monitoring or adjust the rule to focus on production environments only.
- Automated scripts or tools used for application management might generate false positives. Identify these tools and whitelist their actions to prevent unnecessary alerts.
- Changes made by third-party vendors or partners with legitimate access can be mistaken for unauthorized attempts. Ensure these entities are properly documented and their actions are accounted for in the monitoring setup.
### Response and remediation
- Immediately isolate the affected Okta application to prevent further unauthorized modifications. This can be done by temporarily disabling the application or restricting access to it.
- Review and revoke any unauthorized changes made to the application settings. Restore the application to its last known good configuration using backup or audit logs.
- Conduct a thorough audit of recent access logs to identify any unauthorized users or suspicious activities related to the application lifecycle updates.
- Escalate the incident to the security operations team for further investigation and to determine if there are any broader security implications or related incidents.
- Implement additional monitoring on the affected application and similar applications to detect any further unauthorized modification attempts.
- Review and update access controls and permissions for Okta applications to ensure that only authorized personnel have the ability to modify application settings.
- Communicate with relevant stakeholders, including IT and security teams, to inform them of the incident and any changes made to the application settings as part of the remediation process.
## Setup
The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = [
"https://help.okta.com/en/prod/Content/Topics/Apps/Apps_Apps.htm",
"https://developer.okta.com/docs/reference/api/system-log/",
"https://developer.okta.com/docs/reference/api/event-types/",
"https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
"https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
"https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
]
risk_score = 21
rule_id = "c74fd275-ab2c-4d49-8890-e2943fa65c09"
severity = "low"
tags = [
"Use Case: Identity and Access Audit",
"Data Source: Okta",
"Tactic: Impact",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:okta.system and event.action:application.lifecycle.update
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
Stages and Predicates
Stage 1: query
data_stream.dataset:okta.system and event.action:application.lifecycle.update
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"okta.system" |
event.action | eq |
| field:"EventType" kind:eq value:"application.lifecycle.update" |
AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session
#Identifies multiple violations of AWS Bedrock guardrails by the same user in the same account over a session. Multiple violations implies that a user may be intentionally attempting to cirvumvent security controls, access sensitive information, or possibly exploit a vulnerability in the system.
Known False Positives
- Legitimate misunderstanding by users or overly strict policies
MITRE ATLAS Coverage
Adversarial-ML threat framework (not MITRE ATT&CK).
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Defense Evasion |
Rule Body
[metadata]
creation_date = "2024/05/02"
integration = ["aws_bedrock"]
maturity = "production"
updated_date = "2025/09/25"
[rule]
author = ["Elastic"]
description = """
Identifies multiple violations of AWS Bedrock guardrails by the same user in the same account over a session. Multiple
violations implies that a user may be intentionally attempting to cirvumvent security controls, access sensitive
information, or possibly exploit a vulnerability in the system.
"""
false_positives = ["Legitimate misunderstanding by users or overly strict policies"]
from = "now-60m"
interval = "10m"
language = "esql"
license = "Elastic License v2"
name = "AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session"
note = """## Triage and analysis
### Investigating AWS Bedrock Guardrails Detected Multiple Violations by a Single User Over a Session
Amazon Bedrock Guardrail is a set of features within Amazon Bedrock designed to help businesses apply robust safety and privacy controls to their generative AI applications.
It enables users to set guidelines and filters that manage content quality, relevancy, and adherence to responsible AI practices.
Through Guardrail, organizations can define "denied topics" to prevent the model from generating content on specific, undesired subjects,
and they can establish thresholds for harmful content categories, including hate speech, violence, or offensive language.
#### Possible investigation steps
- Identify the user account that caused multiple policy violations over a session and whether it should perform this kind of action.
- Investigate the user activity that might indicate a potential brute force attack.
- Investigate other alerts associated with the user account during the past 48 hours.
- Consider the time of day. If the user is a human (not a program or script), did the activity take place during a normal time of day?
- Examine the account's prompts and responses in the last 24 hours.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking Amazon Bedrock model access, prompts generated, and responses to the prompts by the account in the last 24 hours.
### False positive analysis
- Verify the user account that caused multiple policy violations by a single user over session, is not testing any new model deployments or updated compliance policies in Amazon Bedrock guardrails.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Identify if the attacker is moving laterally and compromising other Amazon Bedrock Services.
- Identify any regulatory or legal ramifications related to this activity.
- Review the permissions assigned to the implicated user group or role behind these requests to ensure they are authorized and expected to access bedrock and ensure that the least privilege principle is being followed.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
references = [
"https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-components.html",
"https://atlas.mitre.org/techniques/AML.T0051",
"https://atlas.mitre.org/techniques/AML.T0054",
"https://www.elastic.co/security-labs/elastic-advances-llm-security",
]
risk_score = 47
rule_id = "0cd2f3e6-41da-40e6-b28b-466f688f00a6"
setup = """## Setup
This rule requires that guardrails are configured in AWS Bedrock. For more information, see the AWS Bedrock documentation:
https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-create.html
"""
severity = "medium"
tags = [
"Domain: LLM",
"Data Source: AWS Bedrock",
"Data Source: AWS S3",
"Resources: Investigation Guide",
"Use Case: Policy Violation",
"Mitre Atlas: T0051",
"Mitre Atlas: T0054",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-aws_bedrock.invocation-*
// Filter for compliance violations detected
| where gen_ai.compliance.violation_detected
// keep relevant ECS + model fields
| keep
user.id,
gen_ai.request.model.id,
cloud.account.id
// count violations by user, model, and account
| stats
Esql.ml_violations_count = count(*)
by
user.id,
gen_ai.request.model.id,
cloud.account.id
// Filter for repeated violations
| where Esql.ml_violations_count > 1
// sort descending by violation volume
| sort Esql.ml_violations_count desc
'''
Stages and Predicates
Stage 1: from
from logs-aws_bedrock.invocation-*
Stage 2: where
| where gen_ai.compliance.violation_detected
Stage 3: keep
| keep
user.id,
gen_ai.request.model.id,
cloud.account.id
Stage 4: stats
| stats
Esql.ml_violations_count = count(*)
by
user.id,
gen_ai.request.model.id,
cloud.account.id
Stage 5: where
| where Esql.ml_violations_count > 1
Stage 6: sort
| sort Esql.ml_violations_count desc
Indicators
These rows show field, operator, and value matches.
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.ml_violations_count | STATS Esql.ml_violations_count = count(*) |
user.id | STATS BY |
gen_ai.request.model.id | STATS BY |
cloud.account.id | STATS BY |
AWS Credentials Searched For Inside A Container
#This rule detects the use of system search utilities like grep and find to search for AWS credentials inside a container. Unauthorized access to these sensitive files could lead to further compromise of the container environment or facilitate a container breakout to the underlying cloud environment.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Discovery | |
| Collection |
Rule Body
[metadata]
creation_date = "2025/03/12"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule detects the use of system search utilities like grep and find to search for AWS credentials inside a
container. Unauthorized access to these sensitive files could lead to further compromise of the container environment or
facilitate a container breakout to the underlying cloud environment.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "AWS Credentials Searched For Inside A Container"
references = ["https://sysdig.com/blog/threat-detection-aws-cloud-containers/"]
risk_score = 73
rule_id = "5749282b-7524-4c9d-af9a-e2b3e814e5d4"
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 = "high"
tags = [
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.entry_leader.entry_meta.type == "container" and
process.name in ("grep", "egrep", "fgrep", "find", "locate", "mlocate", "cat", "sed", "awk") and
process.command_line like~ (
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*access_key*", "*.aws/credentials*"
)
'''
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 Credentials Searched For Inside A Container
Containers often house applications that interact with AWS services, necessitating the storage of AWS credentials. Adversaries may exploit this by using search utilities to locate these credentials, potentially leading to unauthorized access. The detection rule identifies suspicious use of search tools within containers, flagging attempts to locate AWS credentials by monitoring specific process names and arguments, thus helping to prevent credential theft and subsequent attacks.
### Possible investigation steps
- Review the process details to identify the specific search utility used (e.g., grep, find) and the arguments passed, focusing on those related to AWS credentials such as aws_access_key_id or aws_secret_access_key.
- Check the user context under which the suspicious process was executed to assess whether it aligns with expected behavior for that user or role within the container.
- Investigate the source of the container image to ensure it is from a trusted repository and has not been tampered with, which could indicate a supply chain compromise.
- Analyze recent activity logs for the container to identify any other suspicious behavior or anomalies that might correlate with the search for AWS credentials, such as unexpected network connections or file modifications.
- Review access logs for AWS services to detect any unauthorized or unusual access patterns that might suggest the use of compromised credentials.
### False positive analysis
- Routine maintenance scripts or automated processes may use search utilities to verify the presence of AWS credentials for legitimate configuration checks. To handle this, identify and whitelist these specific scripts or processes by their unique identifiers or execution paths.
- Developers or system administrators might manually search for AWS credentials during debugging or configuration tasks. Implement a policy to log and review these activities, and consider excluding known user accounts or roles from triggering alerts during specific time windows or in designated environments.
- Security audits or compliance checks often involve searching for sensitive information, including AWS credentials, to ensure proper security measures are in place. Coordinate with audit teams to schedule these activities and temporarily suppress alerts during these periods, or exclude specific audit tools from detection.
- Continuous integration and deployment (CI/CD) pipelines might include steps that search for AWS credentials to validate environment configurations. Identify these pipelines and exclude their associated processes or container environments from triggering alerts, ensuring that only authorized CI/CD tools are used.
### Response and remediation
- Immediately isolate the affected container to prevent further unauthorized access or data exfiltration. This can be done by stopping the container or disconnecting it from the network.
- Revoke any AWS credentials that were potentially exposed or accessed. This includes rotating keys and updating any services or applications that rely on these credentials.
- Conduct a thorough review of the container's file system to identify any unauthorized changes or additional malicious files that may have been introduced.
- Implement stricter access controls and monitoring on AWS credentials within containers, ensuring they are stored securely and accessed only by authorized processes.
- Escalate the incident to the cloud security team to assess the potential impact on the broader cloud environment and determine if further investigation or response is needed.
- Enhance logging and monitoring for similar activities across other containers and cloud environments to detect and respond to future attempts promptly.
- Review and update container security policies to include best practices for credential management and access control, reducing the risk of similar incidents."""
[[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 = "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 = "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/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.entry_leader.entry_meta.type == "container" and
process.name in ("grep", "egrep", "fgrep", "find", "locate", "mlocate", "cat", "sed", "awk") and
process.command_line like~ (
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*access_key*", "*.aws/credentials*"
)
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.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.entry_leader.entry_meta.type | eq |
| field:"process.entry_leader.entry_meta.type" kind:eq value:"container" |
process.name | in |
| field:"process_basename" kind:in |
Command Execution via Screen Session
#Detects the execution of the screen binary to execute a command or commands via a shell. Threat actors have used this technique via interactive sessions to execute commands on the host and avoid standard detections.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects the execution of the screen binary to execute a command or commands via a shell. Threat actors have used this
technique via interactive sessions to execute commands on the host and avoid standard detections.
"""
id = "232c03d2-ff5d-4ec5-88b5-5926dc491e91"
license = "Elastic License v2"
name = "Command Execution via Screen Session"
os_list = ["macos"]
version = "1.0.6"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name == "screen" and
process.args in ("/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/zsh", "/usr/bin/zsh", "bash", "sh", "zsh") and
process.args == "-c" and
not process.Ext.effective_parent.executable == "/Applications/kitty.app/Contents/MacOS/kitty"
'''
min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.name == "screen" and
process.args in ("/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/zsh", "/usr/bin/zsh", "bash", "sh", "zsh") and
process.args == "-c" and
not process.Ext.effective_parent.executable == "/Applications/kitty.app/Contents/MacOS/kitty"
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:"-c" |
process.args | in |
| field:"process.args" kind:in |
process.name | eq |
| field:"process_basename" kind:eq value:"screen" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | eq | /Applications/kitty.app/Contents/MacOS/kitty | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Applications/kitty.app/Contents/MacOS/kitty" |
Entra ID Concurrent Sign-in with Suspicious Properties
#Identifies concurrent azure signin events for the same user and from multiple sources, and where one of the authentication event has some suspicious properties often associated to DeviceCode and OAuth phishing. Adversaries may steal Refresh Tokens (RTs) via phishing to bypass multi-factor authentication (MFA) and gain unauthorized access to Azure resources.
Known False Positives
- Users authenticating from multiple devices and using the deviceCode protocol or the Visual Studio Code client.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth | |
| Credential Access | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/04/28"
integration = ["azure"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies concurrent azure signin events for the same user and from multiple sources, and where one of the
authentication event has some suspicious properties often associated to DeviceCode and OAuth phishing. Adversaries may
steal Refresh Tokens (RTs) via phishing to bypass multi-factor authentication (MFA) and gain unauthorized access to
Azure resources.
"""
false_positives = [
"""
Users authenticating from multiple devices and using the deviceCode protocol or the Visual Studio Code client.
""",
]
from = "now-60m"
language = "esql"
license = "Elastic License v2"
name = "Entra ID Concurrent Sign-in with Suspicious Properties"
note = """## Triage and analysis
### Investigating Entra ID Concurrent Sign-in with Suspicious Properties
### Possible investigation steps
- Review the sign-in logs to assess the context and reputation of the source.ip address.
- Investigate the user account associated with the successful sign-in to determine if the activity aligns with expected behavior or if it appears suspicious.
- Check for any recent changes or anomalies in the user's account settings or permissions that could indicate compromise.
- Review the history of sign-ins for the user to identify any patterns or unusual access times that could suggest unauthorized access.
- Assess the device from which the sign-in was attempted to ensure it is a recognized and authorized device for the user.
### Response and remediation
- Immediately revoke the compromised Primary Refresh Tokens (PRTs) to prevent further unauthorized access. This can be done through the Azure portal by navigating to the user's account and invalidating all active sessions.
- Enforce a password reset for the affected user accounts to ensure that any credentials potentially compromised during the attack are no longer valid.
- Implement additional Conditional Access policies that require device compliance checks and restrict access to trusted locations or devices only, to mitigate the risk of future PRT abuse.
- Conduct a thorough review of the affected accounts' recent activity logs to identify any unauthorized actions or data access that may have occurred during the compromise.
- Escalate the incident to the security operations team for further investigation and to determine if there are any broader implications or additional compromised accounts.
- Enhance monitoring by configuring alerts for unusual sign-in patterns or device code authentication attempts from unexpected locations or devices, to improve early detection of similar threats.
- Coordinate with the incident response team to perform a post-incident analysis and update the incident response plan with lessons learned from this event."""
references = [
"https://learn.microsoft.com/en-us/entra/identity/",
"https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins",
"https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/reference-azure-monitor-sign-ins-log-schema",
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
]
risk_score = 73
rule_id = "e3bd85e9-7aff-46eb-b60e-20dfc9020d98"
setup = """#### Required Azure Entra Sign-In Logs
This rule requires the Azure logs integration be enabled and configured to collect all logs, including sign-in logs from Entra. In Entra, sign-in logs must be enabled and streaming to the Event Hub used for the Azure logs integration.
"""
severity = "high"
tags = [
"Domain: Cloud",
"Domain: SaaS",
"Data Source: Azure",
"Data Source: Entra ID",
"Data Source: Entra ID Sign-in",
"Use Case: Identity and Access Audit",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-azure.signinlogs-* metadata _id, _version, _index
// Scheduled to run every hour, reviewing events from past hour
| where
@timestamp > now() - 1 hours
and data_stream.dataset == "azure.signinlogs"
and source.ip is not null
and azure.signinlogs.identity is not null
and to_lower(event.outcome) == "success"
// keep relevant raw fields
| keep
@timestamp,
azure.signinlogs.identity,
source.ip,
azure.signinlogs.properties.authentication_requirement,
azure.signinlogs.properties.app_id,
azure.signinlogs.properties.resource_display_name,
azure.signinlogs.properties.authentication_protocol,
azure.signinlogs.properties.app_display_name
// case classifications for identity usage
| eval
Esql.azure_signinlogs_properties_authentication_device_code_case = case(
azure.signinlogs.properties.authentication_protocol == "deviceCode"
and azure.signinlogs.properties.authentication_requirement != "multiFactorAuthentication",
azure.signinlogs.identity,
null),
Esql.azure_signinlogs_auth_visual_studio_case = case(
azure.signinlogs.properties.app_id == "aebc6443-996d-45c2-90f0-388ff96faa56"
and azure.signinlogs.properties.resource_display_name == "Microsoft Graph",
azure.signinlogs.identity,
null),
Esql.azure_signinlogs_auth_other_case = case(
azure.signinlogs.properties.authentication_protocol != "deviceCode"
and azure.signinlogs.properties.app_id != "aebc6443-996d-45c2-90f0-388ff96faa56",
azure.signinlogs.identity,
null)
// Aggregate metrics by user identity
| stats
Esql.event_count = count(*),
Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct = count_distinct(Esql.azure_signinlogs_properties_authentication_device_code_case),
Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct = count_distinct(Esql.azure_signinlogs_auth_visual_studio_case),
Esql.azure_signinlogs_properties_auth_other_count_distinct = count_distinct(Esql.azure_signinlogs_auth_other_case),
Esql.azure_signinlogs_properties_source_ip_count_distinct = count_distinct(source.ip),
Esql.azure_signinlogs_properties_source_ip_values = values(source.ip),
Esql.azure_signinlogs_properties_client_app_values = values(azure.signinlogs.properties.app_display_name),
Esql.azure_signinlogs_properties_resource_display_name_values = values(azure.signinlogs.properties.resource_display_name),
Esql.azure_signinlogs_properties_auth_requirement_values = values(azure.signinlogs.properties.authentication_requirement)
by azure.signinlogs.identity
// Detect multiple unique IPs for one user with signs of deviceCode or VSC OAuth usage
| where
Esql.azure_signinlogs_properties_source_ip_count_distinct >= 2
and (
Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct > 0
or Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct > 0
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[rule.threat.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: from
from logs-azure.signinlogs-* metadata _id, _version, _index
Stage 2: where
| where
@timestamp > now() - 1 hours
and data_stream.dataset == "azure.signinlogs"
and source.ip is not null
and azure.signinlogs.identity is not null
and to_lower(event.outcome) == "success"
Stage 3: keep
| keep
@timestamp,
azure.signinlogs.identity,
source.ip,
azure.signinlogs.properties.authentication_requirement,
azure.signinlogs.properties.app_id,
azure.signinlogs.properties.resource_display_name,
azure.signinlogs.properties.authentication_protocol,
azure.signinlogs.properties.app_display_name
Stage 4: eval
| eval
Esql.azure_signinlogs_properties_authentication_device_code_case = case(
azure.signinlogs.properties.authentication_protocol == "deviceCode"
and azure.signinlogs.properties.authentication_requirement != "multiFactorAuthentication",
azure.signinlogs.identity,
null),
Esql.azure_signinlogs_auth_visual_studio_case = case(
azure.signinlogs.properties.app_id == "aebc6443-996d-45c2-90f0-388ff96faa56"
and azure.signinlogs.properties.resource_display_name == "Microsoft Graph",
azure.signinlogs.identity,
null),
Esql.azure_signinlogs_auth_other_case = case(
azure.signinlogs.properties.authentication_protocol != "deviceCode"
and azure.signinlogs.properties.app_id != "aebc6443-996d-45c2-90f0-388ff96faa56",
azure.signinlogs.identity,
null)
Esql.azure_signinlogs_auth_other_case =azure.signinlogs.properties.authentication_protocol != "deviceCode"
and azure.signinlogs.properties.app_id != "aebc6443-996d-45c2-90f0-388ff96faa56"azure.signinlogs.identitynullEsql.azure_signinlogs_auth_visual_studio_case =azure.signinlogs.properties.app_id == "aebc6443-996d-45c2-90f0-388ff96faa56"
and azure.signinlogs.properties.resource_display_name == "Microsoft Graph"azure.signinlogs.identitynullEsql.azure_signinlogs_properties_authentication_device_code_case =azure.signinlogs.properties.authentication_protocol == "deviceCode"
and azure.signinlogs.properties.authentication_requirement != "multiFactorAuthentication"azure.signinlogs.identitynullStage 5: stats
| stats
Esql.event_count = count(*),
Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct = count_distinct(Esql.azure_signinlogs_properties_authentication_device_code_case),
Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct = count_distinct(Esql.azure_signinlogs_auth_visual_studio_case),
Esql.azure_signinlogs_properties_auth_other_count_distinct = count_distinct(Esql.azure_signinlogs_auth_other_case),
Esql.azure_signinlogs_properties_source_ip_count_distinct = count_distinct(source.ip),
Esql.azure_signinlogs_properties_source_ip_values = values(source.ip),
Esql.azure_signinlogs_properties_client_app_values = values(azure.signinlogs.properties.app_display_name),
Esql.azure_signinlogs_properties_resource_display_name_values = values(azure.signinlogs.properties.resource_display_name),
Esql.azure_signinlogs_properties_auth_requirement_values = values(azure.signinlogs.properties.authentication_requirement)
by azure.signinlogs.identity
Stage 6: where
| where
Esql.azure_signinlogs_properties_source_ip_count_distinct >= 2
and (
Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct > 0
or Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct > 0
)
Indicators
These rows show field, operator, and value matches.
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.event_count | STATS Esql.event_count = count(*) |
Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct | STATS Esql.azure_signinlogs_properties_authentication_device_code_case_count_distinct = count_distinct(Esql.azure_signinlogs_properties_authentication_device_code_case) |
Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct | STATS Esql.azure_signinlogs_properties_auth_visual_studio_count_distinct = count_distinct(Esql.azure_signinlogs_auth_visual_studio_case) |
Esql.azure_signinlogs_properties_auth_other_count_distinct | STATS Esql.azure_signinlogs_properties_auth_other_count_distinct = count_distinct(Esql.azure_signinlogs_auth_other_case) |
Esql.azure_signinlogs_properties_source_ip_count_distinct | STATS Esql.azure_signinlogs_properties_source_ip_count_distinct = count_distinct(source.ip) |
Esql.azure_signinlogs_properties_source_ip_values | STATS Esql.azure_signinlogs_properties_source_ip_values = values(source.ip) |
Esql.azure_signinlogs_properties_client_app_values | STATS Esql.azure_signinlogs_properties_client_app_values = values(azure.signinlogs.properties.app_display_name) |
Esql.azure_signinlogs_properties_resource_display_name_values | STATS Esql.azure_signinlogs_properties_resource_display_name_values = values(azure.signinlogs.properties.resource_display_name) |
Esql.azure_signinlogs_properties_auth_requirement_values | STATS Esql.azure_signinlogs_properties_auth_requirement_values = values(azure.signinlogs.properties.authentication_requirement) |
azure.signinlogs.identity | STATS BY |
GCP Logging Sink Deletion
#Identifies a Logging sink deletion in Google Cloud Platform (GCP). Every time a log entry arrives, Logging compares the log entry to the sinks in that resource. Each sink whose filter matches the log entry writes a copy of the log entry to the sink's export destination. An adversary may delete a Logging sink to evade detection.
Known False Positives
- Logging sink deletions may be done by a system or network administrator. Verify whether the user email, resource name, and/or hostname should be making changes in your environment. Logging sink deletions by unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| GCP | google.logging.ConfigServiceV2.DeleteSink: Delete log sink |
Rule Body
[metadata]
creation_date = "2020/09/18"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies a Logging sink deletion in Google Cloud Platform (GCP). Every time a log entry arrives, Logging compares the
log entry to the sinks in that resource. Each sink whose filter matches the log entry writes a copy of the log entry to
the sink's export destination. An adversary may delete a Logging sink to evade detection.
"""
false_positives = [
"""
Logging sink deletions may be done by a system or network administrator. Verify whether the user email, resource
name, and/or hostname should be making changes in your environment. Logging sink deletions by unfamiliar users or
hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
""",
]
index = ["filebeat-*", "logs-gcp*"]
language = "kuery"
license = "Elastic License v2"
name = "GCP Logging Sink Deletion"
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 Logging Sink Deletion
In GCP, logging sinks are crucial for exporting log entries to designated destinations for analysis and storage. Adversaries may delete these sinks to prevent logs from being exported, thereby evading detection. The detection rule identifies successful deletion events by monitoring specific audit logs, helping security teams quickly respond to potential defense evasion tactics.
### Possible investigation steps
- Review the audit logs for the specific event.action: google.logging.v*.ConfigServiceV*.DeleteSink to identify the user or service account responsible for the deletion.
- Check the event.dataset:gcp.audit logs for any preceding or subsequent suspicious activities by the same user or service account, which might indicate a pattern of malicious behavior.
- Investigate the event.outcome:success to confirm the deletion was successful and determine the impact on log monitoring and export capabilities.
- Assess the context and timing of the deletion event to see if it coincides with other security alerts or incidents, which might suggest a coordinated attack.
- Verify the permissions and roles assigned to the user or service account involved in the deletion to ensure they align with the principle of least privilege and identify any potential misconfigurations.
### False positive analysis
- Routine maintenance or configuration changes by authorized personnel can trigger false positives. To manage this, create exceptions for known maintenance windows or specific user accounts responsible for these tasks.
- Automated scripts or tools used for managing logging configurations might inadvertently delete sinks as part of their operation. Identify these scripts and exclude their actions from triggering alerts by using specific identifiers or service accounts.
- Changes in project ownership or restructuring within the organization can lead to legitimate sink deletions. Document these organizational changes and adjust the monitoring rules to account for them, ensuring that alerts are only generated for unexpected deletions.
- Test environments often undergo frequent changes, including sink deletions, which can result in false positives. Implement separate monitoring rules or exceptions for test environments to reduce noise in alerting.
### Response and remediation
- Immediately revoke access to the affected GCP project for any suspicious or unauthorized users identified in the audit logs to prevent further malicious activity.
- Restore the deleted logging sink by recreating it with the original configuration to ensure that log entries are once again exported to the designated destination.
- Conduct a thorough review of recent log entries and audit logs to identify any other unauthorized changes or suspicious activities that may have occurred around the time of the sink deletion.
- Implement additional monitoring and alerting for any future attempts to delete logging sinks, focusing on the specific event action and outcome fields used in the detection query.
- Escalate the incident to the security operations team for further investigation and to determine if the sink deletion is part of a larger attack campaign.
- Review and update access controls and permissions for logging sink management to ensure that only authorized personnel have the ability to modify or delete sinks.
- Consider enabling additional security features such as VPC Service Controls or Organization Policy constraints to provide an extra layer of protection against unauthorized modifications to logging configurations.
## Setup
The GCP Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = ["https://cloud.google.com/logging/docs/export"]
risk_score = 47
rule_id = "51859fa0-d86b-4214-bf48-ebb30ed91305"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Use Case: Log Auditing",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:gcp.audit and event.action:google.logging.v*.ConfigServiceV*.DeleteSink and event.outcome:success
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[rule.threat.technique.subtechnique]]
id = "T1562.008"
name = "Disable or Modify Cloud Logs"
reference = "https://attack.mitre.org/techniques/T1562/008/"
[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:google.logging.v*.ConfigServiceV*.DeleteSink 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 | wildcard |
| field:"EventType" kind:wildcard value:"google.logging.v*.ConfigServiceV*.DeleteSink" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
GCP Pub/Sub Subscription Creation
#Identifies the creation of a subscription in Google Cloud Platform (GCP). In GCP, the publisher-subscriber relationship (Pub/Sub) is an asynchronous messaging service that decouples event-producing and event-processing services. A subscription is a named resource representing the stream of messages to be delivered to the subscribing application.
Known False Positives
- Subscription creations may be done by a system or network administrator. Verify whether the user email, resource name, and/or hostname should be making changes in your environment. Subscription creations by unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Collection |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| GCP | google.pubsub.Subscriber.CreateSubscription: Create subscription |
Rule Body
[metadata]
creation_date = "2020/09/23"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies the creation of a subscription in Google Cloud Platform (GCP). In GCP, the publisher-subscriber relationship
(Pub/Sub) is an asynchronous messaging service that decouples event-producing and event-processing services. A
subscription is a named resource representing the stream of messages to be delivered to the subscribing application.
"""
false_positives = [
"""
Subscription creations may be done by a system or network administrator. Verify whether the user email, resource
name, and/or hostname should be making changes in your environment. Subscription creations by unfamiliar users or
hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
""",
]
index = ["filebeat-*", "logs-gcp*"]
language = "kuery"
license = "Elastic License v2"
name = "GCP Pub/Sub Subscription Creation"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating GCP Pub/Sub Subscription Creation
Google Cloud Pub/Sub is a messaging service that enables asynchronous communication between applications by decoupling event producers and consumers. Adversaries might exploit this by creating unauthorized subscriptions to intercept or exfiltrate sensitive data streams. The detection rule monitors audit logs for successful subscription creation events, helping identify potential misuse by flagging unexpected or suspicious activity.
### Possible investigation steps
- Review the audit log entry associated with the alert to identify the user or service account responsible for the subscription creation by examining the `event.dataset` and `event.action` fields.
- Verify the legitimacy of the subscription by checking the associated project and topic details to ensure they align with expected configurations and business needs.
- Investigate the history of the user or service account involved in the subscription creation to identify any unusual or unauthorized activities, focusing on recent changes or access patterns.
- Assess the permissions and roles assigned to the user or service account to determine if they have the necessary privileges for subscription creation and whether these permissions are appropriate.
- Consult with relevant stakeholders or application owners to confirm whether the subscription creation was authorized and necessary for operational purposes.
### False positive analysis
- Routine subscription creation by automated deployment tools or scripts can trigger false positives. Identify and whitelist these tools by excluding their service accounts from the detection rule.
- Development and testing environments often create and delete subscriptions frequently. Exclude these environments by filtering out specific project IDs associated with non-production use.
- Scheduled maintenance or updates might involve creating new subscriptions temporarily. Coordinate with the operations team to understand regular maintenance schedules and adjust the rule to ignore these activities during known maintenance windows.
- Internal monitoring or logging services that create subscriptions for legitimate data collection purposes can be excluded by identifying their specific patterns or naming conventions and adding them to an exception list.
### Response and remediation
- Immediately review the audit logs to confirm the unauthorized subscription creation and identify the source, including the user or service account responsible for the action.
- Revoke access for the identified user or service account to prevent further unauthorized actions. Ensure that the principle of least privilege is enforced.
- Delete the unauthorized subscription to stop any potential data interception or exfiltration.
- Conduct a thorough review of all existing subscriptions to ensure no other unauthorized subscriptions exist.
- Notify the security team and relevant stakeholders about the incident for awareness and further investigation.
- Implement additional monitoring and alerting for subscription creation events to detect similar activities in the future.
- If applicable, report the incident to Google Cloud support for further assistance and to understand if there are any broader implications or vulnerabilities.
## Setup
The GCP Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = ["https://cloud.google.com/pubsub/docs/overview"]
risk_score = 21
rule_id = "d62b64a8-a7c9-43e5-aee3-15a725a794e7"
severity = "low"
tags = [
"Domain: Cloud",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Use Case: Log Auditing",
"Tactic: Collection",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:gcp.audit and event.action:google.pubsub.v*.Subscriber.CreateSubscription and event.outcome:success
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1119"
name = "Automated Collection"
reference = "https://attack.mitre.org/techniques/T1119/"
[[rule.threat.technique]]
id = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
Stages and Predicates
Stage 1: query
data_stream.dataset:gcp.audit and event.action:google.pubsub.v*.Subscriber.CreateSubscription 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 | wildcard |
| field:"EventType" kind:wildcard value:"google.pubsub.v*.Subscriber.CreateSubscription" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
GKE Pod Exec Sensitive File or Credential Path Access
#Detects successful GKE pod exec sessions where the executed command references high-value host or in-cluster paths: mounted service account or platform tokens, kubelet and control-plane configuration areas, host identity stores, root or home credential directories, common private-key and keystore extensions, process environment dumps, and configuration filenames suggestive of embedded secrets. Attackers with pods/exec often use these one-liners to steal credentials before lateral movement or privilege escalation. A narrow exclusion ignores benign resolv.conf reads. GKE records the command in gcp.audit.labels.command.gke.io/command when an explicit command is passed to exec.
Known False Positives
- Break-glass debugging or vendor diagnostics may cat credential-adjacent paths. Baseline approved operators and automation identities, then expand client.user.email exclusions as needed.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Credential Access |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Kubernetes | get-pods-exec: get pods/exec |
| Kubernetes | create-pods-exec: create pods/exec |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure AKS Attempted User Exec into Pod (Elastic)
- Container With A hostPath Mount Created (Sigma)
- Creation Of Pod In System Namespace (Sigma)
- Direct Interactive Kubernetes API Request by Unusual Utilities (Elastic)
- Exec into Pod (Panther)
- GCP Break-glass Container Workload Deployed (Sigma)
- GCP K8s Pod Attached To Node Host Network (Panther)
- GCP K8S Pod Create Or Modify Host Path Volume Mount (Panther)
Rule Body
[metadata]
creation_date = "2026/07/15"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/07/15"
[rule]
author = ["Elastic"]
description = """
Detects successful GKE pod exec sessions where the executed command references high-value host or in-cluster paths:
mounted service account or platform tokens, kubelet and control-plane configuration areas, host identity stores, root
or home credential directories, common private-key and keystore extensions, process environment dumps, and configuration
filenames suggestive of embedded secrets. Attackers with pods/exec often use these one-liners to steal credentials
before lateral movement or privilege escalation. A narrow exclusion ignores benign resolv.conf reads. GKE records the
command in gcp.audit.labels.command.gke.io/command when an explicit command is passed to exec.
"""
false_positives = [
"""
Break-glass debugging or vendor diagnostics may cat credential-adjacent paths. Baseline approved operators and
automation identities, then expand client.user.email exclusions as needed.
""",
]
from = "now-6m"
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE Pod Exec Sensitive File or Credential Path Access"
note = """## Triage and analysis
### Investigating GKE Pod Exec Sensitive File or Credential Path Access
This alert fires when a successful pods/exec API call includes a command matching sensitive path or filename
patterns. Review `gcp.audit.labels.command.gke.io/command` for the reconstructed command string.
### Possible investigation steps
- Identify the actor (`client.user.email`), source IP, and user agent for the exec caller.
- Map `gcp.audit.resource_name` (namespace/pod) to a workload owner, image, and change history.
- Correlate adjacent activity from the same identity: secret reads, TokenRequest, RBAC writes, or additional execs.
- If host-level paths appear, determine whether the workload is privileged, uses hostPath, or runs on break-glass nodes.
### False positive analysis
- Diagnostic images and vendor agents sometimes read kubeconfig-like or credential paths; baseline stable automation.
- Training containers that deliberately demonstrate passwd reads can trigger; scope exceptions to those namespaces.
### Response and remediation
- If malicious, end the exec session, isolate the pod or node, rotate credentials that could have been read, and
tighten pods/exec RBAC and admission controls.
"""
setup = "The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."
references = [
"https://stratus-red-team.cloud/attack-techniques/kubernetes/k8s.credential-access.steal-serviceaccount-token/",
]
risk_score = 73
rule_id = "0fc705f5-544e-4786-8acc-c73cd74e77cf"
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: Credential Access",
"Tactic: Execution",
"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.type:start and
event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
gcp.audit.labels.command.gke.io/command:(
(
*.jks* or *.key* or *.keystore* or *.p12* or *.pem* or
*/etc/kubernetes/* or */etc/passwd* or */etc/shadow* or */etc/sudoers* or
*/home/*/.aws* or */home/*/.azure* or */home/*/.config/gcloud* or */home/*/.kube* or */home/*/.ssh* or
*/proc/*/environ* or
*/root/.aws* or */root/.azure* or */root/.config/gcloud* or */root/.kube* or */root/.ssh* or
*/var/lib/kubelet/* or */var/run/secrets/* or
*/etc/*.conf* and (*credential* or *key* or *password* or *secret* or *token*)
) and not */etc/resolv.conf*
)
'''
[[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.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"client.user.email",
"source.ip",
"user_agent.original",
"event.action",
"event.outcome",
"event.type",
"gcp.audit.labels.command.gke.io/command",
"gcp.audit.resource_name",
"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.type:start and
event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
gcp.audit.labels.command.gke.io/command:(
(
*.jks* or *.key* or *.keystore* or *.p12* or *.pem* or
*/etc/kubernetesetc/passwd* or */etc/shadow* or */etc/sudoers* or
*/homehomehomehomehome/*/.ssh* or
*/proc/*/environ* or
*/root/.aws* or */root/.azure* or */root/.config/gcloud* or */root/.kube* or */root/.ssh* or
*/var/lib/kubeletvar/run/secrets/* or
*/etc/*.conf* and (*credential* or *key* or *password* or *secret* or *token*)
) and not */etc/resolv.conf*
)
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 | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
gcp.audit.labels.command.gke.io/command | wildcard |
| field:"gcp.audit.labels.command.gke.io/command" kind:wildcard |
service.name | eq |
| field:"ServiceName" kind:eq value:"k8s.io" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
gcp.audit.labels.command.gke.io/command | match | /etc/resolv.conf | excludes:gcp.audit.labels.command.gke.io/command field:"gcp.audit.labels.command.gke.io/command" value:"/etc/resolv.conf" |
Multiple Cloud Secrets Accessed by Source Address
#This rule detects authenticated sessions accessing secret stores across multiple environments from the same source address within a short period of time, including cloud providers (AWS, GCP, Azure) and Kubernetes clusters. Adversaries with access to compromised credentials or session tokens may attempt to retrieve secrets from services such as AWS Secrets Manager, Google Secret Manager, Azure Key Vault, or Kubernetes Secrets in rapid succession to expand their access or exfiltrate sensitive information.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS Lateral Movement from Kubernetes SA via AssumeRoleWithWebIdentity (Elastic)
- Azure AKS Secret get or list with Suspicious User Agent (Elastic)
- Direct Interactive Kubernetes API Request by Unusual Utilities (Elastic)
- EC2 Secrets Manager Retrieve Secrets (Panther)
- GKE Rapid Secret GET Activity Against Multiple Objects (Elastic)
- GKE Secret Access from Node or Denied Service Account (Elastic)
- GKE Secret Access via Unusual User Agent (Elastic)
- GKE Secret get or list with Suspicious User Agent (Elastic)
Rule Body
[metadata]
creation_date = "2025/12/01"
integration = ["aws", "gcp", "azure", "kubernetes"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
This rule detects authenticated sessions accessing secret stores across multiple environments from the same source
address within a short period of time, including cloud providers (AWS, GCP, Azure) and Kubernetes clusters.
Adversaries with access to compromised credentials or session tokens may attempt to retrieve secrets from services such
as AWS Secrets Manager, Google Secret Manager, Azure Key Vault, or Kubernetes Secrets in rapid succession to expand
their access or exfiltrate sensitive information.
"""
from = "now-9m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "Multiple Cloud Secrets Accessed by Source Address"
note = """## Triage and analysis
### Multiple Cloud Secrets Accessed by Source Address
This alert identifies a single source IP address accessing secret-management APIs across **multiple cloud providers**
(e.g., AWS Secrets Manager, Google Secret Manager, Azure Key Vault) within a short timeframe.
This behavior is strongly associated with **credential theft, session hijacking, or token replay**, where an adversary
uses stolen authenticated sessions to harvest secrets across cloud environments.
Unexpected cross-cloud secret retrieval is uncommon and typically indicates automation misuse or malicious activity.
### Possible investigation steps
- Validate the principal
- Identify the user, service account, workload identity, or application making the requests.
- Confirm whether this identity is expected to operate across more than one cloud provider.
- Review related activity
- Look for additional alerts involving the same identity, source IP, or token over the last 24–48 hours.
- Identify whether the source IP has been observed performing unusual authentication, privilege escalation,
or reconnaissance.
- Check application or service context
- Determine whether any workload legitimately pulls secrets from multiple cloud providers.
- Review deployment pipelines or integration layers that might legitimately bridge AWS, Azure, and GCP.
- Analyze user agent and invocation patterns
- Compare `user_agent.original` or equivalent fields against expected SDKs or automation tools.
- Suspicious indicators include CLI tools, unknown libraries, browser user agents, or custom scripts.
- Inspect IP reputation and origin
- Determine whether the source IP corresponds to a managed workload (EC2, GCE, Azure VM) or an unexpected host.
- Validate that the associated instance or host is under your control and behaving normally.
- Review IAM permissions and accessed secrets
- Check the policies attached to the identity.
- Verify whether the accessed secrets are sensitive, unused, or unrelated to the identity’s purpose.
- Assess potential compromise scope
- If compromise is suspected, enumerate other assets accessed by the same identity in the last 24 hours.
- Look for lateral movement, privilege escalation, or abnormal API usage.
- Review Kubernetes activity
- Identify the Kubernetes user, service account, or workload performing the secret access.
- Determine whether the access originated from a pod, node, or external client.
- Validate whether the identity is expected to access secrets in the affected namespaces.
- Investigate whether the activity corresponds to application behavior or manual/API access.
### False positive analysis
- Validate whether the source IP is associated with a legitimate multi-cloud orchestration tool, automation pipeline,
or shared CI/CD system.
- Confirm that the identity is authorized to access secrets across multiple cloud services.
- If activity is expected, consider adding exceptions that pair account identity, source IP, and expected user agent
to reduce noise.
- Determine whether the source IP is associated with Kubernetes nodes, controllers, or internal workloads
that legitimately retrieve secrets alongside cloud provider integrations.
### Response and remediation
- Initiate incident response** if the activity is unauthorized or suspicious.
- Restrict or disable** the affected credentials or service accounts.
- Rotate all accessed secrets** and review other secrets the identity can access.
- Analyze systems** that may have leaked credentials, such as compromised hosts or exposed tokens.
- Harden identity security:
- Enforce MFA for users where applicable.
- Reduce permissions to least privilege.
- Review trust relationships, workload identities, and cross-cloud integrations.
- Search for persistence mechanisms** such as newly created keys, roles, or service accounts.
- If Kubernetes access is involved:
- Rotate Kubernetes secrets and service account tokens.
- Review RBAC permissions and restrict secret access to least privilege.
- Inspect affected pods or nodes for compromise.
- Improve monitoring and audit visibility** by ensuring logging is enabled across all cloud environments.
- Determine root cause** (phishing, malware, token replay, exposed credential, etc.) and close the vector to prevent recurrence.
"""
references = [
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html",
"https://docs.cloud.google.com/secret-manager/docs/samples/secretmanager-access-secret-version",
"https://learn.microsoft.com/en-us/azure/key-vault/secrets/about-secrets",
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
]
risk_score = 73
rule_id = "472b4944-d810-43cf-83dc-7d080ae1b8dd"
setup = """
This multi-datasource rule relies on additional configurations from each hyperscaler.
- GCP Audit: [Enable DATA_READ for the Secret Manager API service](https://docs.cloud.google.com/logging/docs/audit/configure-data-access)
- Azure: [Enable Diagnostic Logging for the Key Vault Service](https://learn.microsoft.com/en-us/azure/key-vault/general/howto-logging?tabs=azure-cli)
- AWS: Secrets Manager read access is automatically logged by CloudTrail.
"""
severity = "high"
tags = [
"Domain: Cloud",
"Domain: IAM",
"Domain: Storage",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS Secrets Manager",
"Data Source: Azure",
"Data Source: Azure Activity Logs",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Data Source: Kubernetes",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM logs-azure.platformlogs-*, logs-aws.cloudtrail-*, logs-gcp.audit-*, logs-kubernetes.audit_logs-* METADATA _id, _version, _index
| WHERE
(
/* AWS Secrets Manager */
(data_stream.dataset == "aws.cloudtrail" AND event.action == "GetSecretValue") OR
// Azure Key Vault (platform logs)
(data_stream.dataset == "azure.platformlogs" AND event.action IN ("SecretGet", "KeyGet")) or
/* Google Secret Manager */
(data_stream.dataset IN ("googlecloud.audit", "gcp.audit") AND
event.action IN ("google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "google.cloud.secretmanager.v1.SecretManagerService.GetSecretRequest")) OR
/* Kubernetes Secrets */
(data_stream.dataset == "kubernetes.audit_logs" AND kubernetes.audit.objectRef.resource == "secrets" AND kubernetes.audit.verb IN ("get", "list"))
) AND source.ip IS NOT NULL
// Cloud vendor label based on dataset
| EVAL Esql.cloud_vendor = CASE(
data_stream.dataset == "aws.cloudtrail", "aws",
data_stream.dataset == "azure.platformlogs", "azure",
data_stream.dataset IN ("googlecloud.audit","gcp.audit"), "gcp",
data_stream.dataset == "kubernetes.audit_logs", "k8s",
"unknown"
)
// Vendor+tenant label, e.g. aws:123456789012, azure:tenant, gcp:project
| EVAL Esql.tenant_label = CASE(
Esql.cloud_vendor == "aws", CONCAT("aws:", cloud.account.id),
Esql.cloud_vendor == "azure", CONCAT("azure:", cloud.account.id),
Esql.cloud_vendor == "gcp", CONCAT("gcp:", cloud.account.id),
Esql.cloud_vendor == "k8s", CONCAT("k8s:", orchestrator.cluster.name),
"unknown"
)
| WHERE Esql.cloud_vendor != "unknown"
| STATS
// Core counts
Esql.events_count = COUNT(*),
Esql.vendor_count_distinct = COUNT_DISTINCT(Esql.cloud_vendor),
// Action & data source context
Esql.event_action_values = VALUES(event.action),
Esql.data_source_values = VALUES(data_stream.dataset),
// Cloud vendor + tenant context
Esql.cloud_vendor_values = VALUES(Esql.cloud_vendor),
Esql.tenant_label_values = VALUES(Esql.tenant_label),
// Hyperscaler-specific IDs
Esql.aws_account_id_values = VALUES(CASE(Esql.cloud_vendor == "aws", cloud.account.id, "unknown")),
Esql.azure_tenant_id_values = VALUES(CASE(Esql.cloud_vendor == "azure", cloud.account.id, "unknown")),
Esql.gcp_project_id_values = VALUES(CASE(Esql.cloud_vendor == "gcp", cloud.account.id, "unknown")),
// Generic cloud metadata
Esql.cloud_region_values = VALUES(cloud.region),
Esql.k8s_namespace_values = VALUES(kubernetes.audit.objectRef.namespace),
// Namespace values
Esql.data_stream_namespace_values = VALUES(data_stream.namespace),
Esql_priv.user_name_values = VALUES(user.name)
BY source.ip
// Require multi-vendor cred-access from same source IP
| WHERE Esql.vendor_count_distinct >= 2
| SORT Esql.events_count DESC
| KEEP Esql.*, Esql_priv.*, source.ip
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[rule.threat.technique.subtechnique]]
id = "T1555.006"
name = "Cloud Secrets Management Stores"
reference = "https://attack.mitre.org/techniques/T1555/006/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: from
FROM logs-azure.platformlogs-*, logs-aws.cloudtrail-*, logs-gcp.audit-*, logs-kubernetes.audit_logs-* METADATA _id, _version, _index
Stage 2: where
| WHERE
(
(data_stream.dataset == "aws.cloudtrail" AND event.action == "GetSecretValue") OR
(data_stream.dataset == "azure.platformlogs" AND event.action IN ("SecretGet", "KeyGet")) or
(data_stream.dataset IN ("googlecloud.audit", "gcp.audit") AND
event.action IN ("google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "google.cloud.secretmanager.v1.SecretManagerService.GetSecretRequest")) OR
(data_stream.dataset == "kubernetes.audit_logs" AND kubernetes.audit.objectRef.resource == "secrets" AND kubernetes.audit.verb IN ("get", "list"))
) AND source.ip IS NOT NULL
Stage 3: eval
| EVAL Esql.cloud_vendor = CASE(
data_stream.dataset == "aws.cloudtrail", "aws",
data_stream.dataset == "azure.platformlogs", "azure",
data_stream.dataset IN ("googlecloud.audit","gcp.audit"), "gcp",
data_stream.dataset == "kubernetes.audit_logs", "k8s",
"unknown"
)
Esql.cloud_vendor =data_stream.dataset == "aws.cloudtrail""aws"data_stream.dataset == "azure.platformlogs""azure"data_stream.dataset IN ("googlecloud.audit","gcp.audit")"gcp"data_stream.dataset == "kubernetes.audit_logs""k8s""unknown"Stage 4: eval
| EVAL Esql.tenant_label = CASE(
Esql.cloud_vendor == "aws", CONCAT("aws:", cloud.account.id),
Esql.cloud_vendor == "azure", CONCAT("azure:", cloud.account.id),
Esql.cloud_vendor == "gcp", CONCAT("gcp:", cloud.account.id),
Esql.cloud_vendor == "k8s", CONCAT("k8s:", orchestrator.cluster.name),
"unknown"
)
Esql.tenant_label =Esql.cloud_vendor == "aws"CONCAT("aws:", cloud.account.id)Esql.cloud_vendor == "azure"CONCAT("azure:", cloud.account.id)Esql.cloud_vendor == "gcp"CONCAT("gcp:", cloud.account.id)Esql.cloud_vendor == "k8s"CONCAT("k8s:", orchestrator.cluster.name)"unknown"Stage 5: where
| WHERE Esql.cloud_vendor != "unknown"
Stage 6: stats
| STATS
Esql.events_count = COUNT(*),
Esql.vendor_count_distinct = COUNT_DISTINCT(Esql.cloud_vendor),
Esql.event_action_values = VALUES(event.action),
Esql.data_source_values = VALUES(data_stream.dataset),
Esql.cloud_vendor_values = VALUES(Esql.cloud_vendor),
Esql.tenant_label_values = VALUES(Esql.tenant_label),
Esql.aws_account_id_values = VALUES(CASE(Esql.cloud_vendor == "aws", cloud.account.id, "unknown")),
Esql.azure_tenant_id_values = VALUES(CASE(Esql.cloud_vendor == "azure", cloud.account.id, "unknown")),
Esql.gcp_project_id_values = VALUES(CASE(Esql.cloud_vendor == "gcp", cloud.account.id, "unknown")),
Esql.cloud_region_values = VALUES(cloud.region),
Esql.k8s_namespace_values = VALUES(kubernetes.audit.objectRef.namespace),
Esql.data_stream_namespace_values = VALUES(data_stream.namespace),
Esql_priv.user_name_values = VALUES(user.name)
BY source.ip
Stage 7: where
| WHERE Esql.vendor_count_distinct >= 2
Stage 8: sort
| SORT Esql.events_count DESC
Stage 9: keep
| KEEP Esql.*, Esql_priv.*, source.ip
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.cloud_vendor | ne |
| field:"Esql.cloud_vendor" kind:ne value:"unknown" |
Esql.vendor_count_distinct | ge |
| field:"Esql.vendor_count_distinct" kind:ge value:"2" |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq |
data_stream.dataset | in |
| field:"data_stream.dataset" kind:in |
event.action | eq |
| field:"EventType" kind:eq value:"GetSecretValue" |
event.action | in |
| field:"EventType" kind:in |
kubernetes.audit.objectRef.resource | eq |
| field:"kubernetes.audit.objectRef.resource" kind:eq value:"secrets" |
kubernetes.audit.verb | in |
| field:"kubernetes.audit.verb" kind:in |
source.ip | is_not_null | field:"src_ip" kind:is_not_null |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.* | KEEP Esql.* |
Esql_priv.* | KEEP Esql_priv.* |
source.ip | KEEP source.ip |
MySQL User-Defined Function Injection
#Identifies MySQL statements that create a user-defined function backed by a shared library. Adversaries with sufficient database privileges can place a malicious library in the MySQL plugin directory and register it with "CREATE FUNCTION ... SONAME", establishing a database-resident primitive for operating-system command execution.
Known False Positives
- Database administrators may install approved native MySQL user-defined functions during planned maintenance. Validate the function and library names, the client address, the maintenance window, and whether the shared library was supplied through an approved software deployment process.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[metadata]
creation_date = "2026/07/30"
integration = ["network_traffic"]
maturity = "production"
updated_date = "2026/07/30"
[rule]
author = ["Elastic"]
description = """
Identifies MySQL statements that create a user-defined function backed by a shared library. Adversaries with sufficient
database privileges can place a malicious library in the MySQL plugin directory and register it with "CREATE FUNCTION
... SONAME", establishing a database-resident primitive for operating-system command execution.
"""
false_positives = [
"""
Database administrators may install approved native MySQL user-defined functions during planned maintenance.
Validate the function and library names, the client address, the maintenance window, and whether the shared library
was supplied through an approved software deployment process.
""",
]
from = "now-9m"
index = ["logs-network_traffic.mysql-*"]
language = "eql"
license = "Elastic License v2"
name = "MySQL User-Defined Function Injection"
note = """## Triage and analysis
### Investigating MySQL User-Defined Function Injection
MySQL can load native user-defined functions from shared libraries. Attackers who obtain the `FILE` privilege and write access to the plugin directory can write a malicious `.so` or `.dll`, register it with `CREATE FUNCTION ... SONAME`, and invoke operating-system commands as the MySQL service account.
### Possible investigation steps
- Review `client.ip`, `server.ip`, `network.community_id`, `network_traffic.mysql.query`, `network_traffic.mysql.path`, and any response error fields.
- Extract the function and library names and verify whether they belong to an approved MySQL extension.
- Search prior queries on the same connection for `INTO DUMPFILE`, `INTO OUTFILE`, `LOAD_FILE`, plugin-directory discovery, or hexadecimal payload construction.
- On the database host, inspect the MySQL plugin directory for newly created `.so`, `.dll`, or other unexpected files.
- Correlate with child processes spawned by `mysqld` and with outbound connections from the database host.
### False positive analysis
- Approved native UDF installation is uncommon but legitimate. Confirm the package source and change record.
- Do not exclude all DBA clients permanently; a compromised DBA workstation can perform the same operation.
### Response and remediation
- Terminate unauthorized database sessions and isolate the database host if command execution is suspected.
- Remove the malicious function and library only after preserving evidence.
- Rotate database credentials, review grants containing `FILE`, and restrict writes to the plugin directory.
"""
references = [
"https://legalhackers.com/advisories/MySQL-Exploit-Remote-Root-Code-Execution-Privesc-CVE-2016-6662.html",
"https://attack.mitre.org/techniques/T1505/001/",
]
risk_score = 73
rule_id = "c375532d-069d-41e0-af70-8ca032eb58f5"
setup = """## Setup
This rule requires the Elastic Network Packet Capture integration with the MySQL protocol analyzer enabled and
cleartext visibility into MySQL query traffic. TLS-encrypted sessions and incomplete or asymmetric capture can hide
query text. Use MySQL audit logs and endpoint telemetry for authoritative user attribution and proof of library
creation or command execution.
"""
severity = "high"
tags = [
"Domain: Network",
"Use Case: Network Security Monitoring",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Network Packet Capture",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
any where data_stream.dataset == "network_traffic.mysql" and
network_traffic.mysql.query like~ "*create*function*soname*"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[rule.threat.technique.subtechnique]]
id = "T1505.001"
name = "SQL Stored Procedures"
reference = "https://attack.mitre.org/techniques/T1505/001/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: any
any where data_stream.dataset == "network_traffic.mysql" and
network_traffic.mysql.query like~ "*create*function*soname*"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"network_traffic.mysql" |
network_traffic.mysql.query | wildcard |
| field:"network_traffic.mysql.query" kind:wildcard value:"*create*function*soname*" |
Potential DLL Hijack via Directory Spoofing
#Identifies attempt to perform DLL hijacking using System32 executables or others in non-user-writable folders by spoofing the the directory from which the application is loaded to an arbitrary user-specified one.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies attempt to perform DLL hijacking using System32 executables or others in non-user-writable folders by
spoofing the the directory from which the application is loaded to an arbitrary user-specified one.
"""
id = "4c0b962c-b46c-4ac3-9f20-a1cf44ec8fdc"
license = "Elastic License v2"
name = "Potential DLL Hijack via Directory Spoofing"
os_list = ["windows"]
reference = ["https://github.com/Octoberfest7/DropSpawn_BOF"]
version = "1.0.5"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
_arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info: "*RtlCreateUserProcessEx*") and
process.parent.thread.Ext.call_stack_summary : "ntdll.dll*" and
not process.parent.thread.Ext.call_stack_summary : ("*kernel32*", "*kernelbase*", "ntdll.dll|smss.exe|ntdll.dll") and
not _arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info: "*RtlCloneUserProcess*")]
[library where not dll.code_signature.status : "trusted" and not startswith~(dll.name, process.name) and
process.thread.Ext.call_stack_summary : "ntdll.dll|kernel32.dll|ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*LdrLoadDll*", "*LoadLibrary*")) and
not dll.path :
("?:\\Windows\\System32\\*",
"?:\\Windows\\SysWOW64\\*",
"?:\\Windows\\WinSxS\\*",
"?:\\Windows\\assembly\\*",
"?:\\Windows\\assembly\\NativeImages_v*",
"?:\\Windows\\SoftwareDistribution\\Download\\*",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
/* DLL not loaded from the process.executable current directory */
not endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1)))]
'''
min_endpoint_version = "8.8.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.8.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
_arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info: "*RtlCreateUserProcessEx*") and
process.parent.thread.Ext.call_stack_summary : "ntdll.dll*" and
not process.parent.thread.Ext.call_stack_summary : ("*kernel32*", "*kernelbase*", "ntdll.dll|smss.exe|ntdll.dll") and
not _arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info: "*RtlCloneUserProcess*")]
Stage 2: library
[library where not dll.code_signature.status : "trusted" and not startswith~(dll.name, process.name) and
process.thread.Ext.call_stack_summary : "ntdll.dll|kernel32.dll|ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*LdrLoadDll*", "*LoadLibrary*")) and
not dll.path :
("?:\\Windows\\System32\\*",
"?:\\Windows\\SysWOW64\\*",
"?:\\Windows\\WinSxS\\*",
"?:\\Windows\\assembly\\*",
"?:\\Windows\\assembly\\NativeImages_v*",
"?:\\Windows\\SoftwareDistribution\\Download\\*",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
not endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1)))]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.parent.thread.Ext.call_stack_summary | wildcard |
| field:"process.parent.thread.Ext.call_stack_summary" kind:wildcard value:"ntdll.dll*" |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"ntdll.dll|kernel32.dll|ntdll.dll" |
Exclusions
The rule actively suppresses these predicates.
Potential Initial Access via DLL Search Order Hijacking
#Identifies attempts to create a DLL file to a known desktop application dependencies folder such as Slack, Teams or OneDrive and by an unusual process. This may indicate an attempt to load a malicious module via DLL search order hijacking.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to create a DLL file to a known desktop application dependencies folder such as Slack, Teams or
OneDrive and by an unusual process. This may indicate an attempt to load a malicious module via DLL search order
hijacking.
"""
id = "ddc4fa22-4675-44c0-a813-e786e638d7e0"
license = "Elastic License v2"
name = "Potential Initial Access via DLL Search Order Hijacking"
os_list = ["windows"]
reference = [
"https://posts.specterops.io/automating-dll-hijack-discovery-81c4295904b0",
"https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.32"
query = '''
file where event.action != "deletion" and
file.extension : "dll" and
file.path :
("?:\\Users\\*\\AppData\\*\\Microsoft\\OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft\\Teams\\*.dll",
"?:\\Users\\*\\AppData\\Local\\slack\\app-*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\*",
"?:\\Users\\*\\AppData\\Local\\*\\Well Known Domains\\*\\well_known_domains.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Domain Actions\\*\\domain_actions.dll") and
process.name : ("winword.exe", "excel.exe", "powerpnt.exe", "MSACCESS.EXE", "MSPUB.EXE", "fltldr.exe", "cmd.exe",
"certutil.exe", "mshta.exe", "cscript.exe", "wscript.exe", "curl.exe", "powershell.exe", "pwsh.exe",
"mstsc.exe", "explorer.exe", "dllhost.exe", "xcopy.exe", "expand.exe") and
not file.path : ("?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\resources\\meeting-addin\\*",
"?:\\Users\\*\\Teams\\current\\*")
'''
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 = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and
file.extension : "dll" and
file.path :
("?:\\Users\\*\\AppData\\*\\Microsoft\\OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft\\Teams\\*.dll",
"?:\\Users\\*\\AppData\\Local\\slack\\app-*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\*",
"?:\\Users\\*\\AppData\\Local\\*\\Well Known Domains\\*\\well_known_domains.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Domain Actions\\*\\domain_actions.dll") and
process.name : ("winword.exe", "excel.exe", "powerpnt.exe", "MSACCESS.EXE", "MSPUB.EXE", "fltldr.exe", "cmd.exe",
"certutil.exe", "mshta.exe", "cscript.exe", "wscript.exe", "curl.exe", "powershell.exe", "pwsh.exe",
"mstsc.exe", "explorer.exe", "dllhost.exe", "xcopy.exe", "expand.exe") and
not file.path : ("?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\resources\\meeting-addin\\*",
"?:\\Users\\*\\Teams\\current\\*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard value:"dll" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | wildcard | ?:\Users\*\AppData\Local\Microsoft\OneDrive\*\*.dll, ?:\Users\*\AppData\Local\Microsoft\Teams\current\resources\meeting-addin\*, ?:\Users\*\Teams\current\* | excludes:file.path field:"file.path" value:"?:\Users\*\AppData\Local\Microsoft\OneDrive\*\*.dll" field:"file.path" value:"?:\Users\*\AppData\Local\Microsoft\Teams\current\resources\meeting-addin\*" field:"file.path" value:"?:\Users\*\Teams\current\*" |
Potential Polyglot Bypass File Created by Web Server
#This rule detects when a web server process creates a file with a file extension that does not match the file content based on the file header bytes. This is a common technique used by attackers to bypass security measures and to hide the true nature of the file.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence | |
| Lateral Movement |
Rule Body
[metadata]
creation_date = "2026/09/07"
integration = ["endpoint"]
maturity = "production"
min_stack_version = "9.3.0"
min_stack_comments = "The file.Ext.* fields for file events were introduced in 9.3.0, and are required for this rule to function."
updated_date = "2026/09/07"
[rule]
author = ["Elastic"]
description = """
This rule detects when a web server process creates a file with a file extension that does not
match the file content based on the file header bytes. This is a common technique used by attackers
to bypass security measures and to hide the true nature of the file.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Polyglot Bypass File Created by Web Server"
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 Polyglot Bypass File Created by Web Server
This rule identifies Linux web server processes creating files with script or executable extensions whose header bytes indicate a different format, which may expose an upload-validation bypass or concealed malicious payload. An attacker could upload a JPEG/PHP polyglot named `avatar.php`, pass image-type validation using valid JPEG header bytes, and later execute appended PHP code as a web shell.
### Possible investigation steps
- Preserve the file and record its path, owner, permissions, timestamps, hash, and web-accessibility before quarantining it for static analysis.
- Compare the declared extension, detected file type, and full contents to identify appended server-side code, embedded executables, obfuscation, or multiple valid file formats.
- Correlate the creation time with reverse-proxy, web access, application, authentication, and upload logs to identify the source IP, account, request URI, user agent, and response status.
- Review related process activity and network connections for execution of the file, shell or interpreter launches, persistence changes, credential access, or outbound command-and-control traffic.
- Determine whether the application legitimately creates this file type and, if malicious or unexplained, isolate the host, block the artifact and source indicators, remove exposed files, and remediate the upload-validation weakness.
### False positive analysis
- A legitimate upload or media-processing workflow may save an image, document, or RIFF file with a script-like extension because of application naming logic, so verify the originating request, expected application behavior, and absence of appended executable code.
- A deployment, testing, or packaging process running under a web server account may create a valid ELF or archive-derived artifact with a monitored extension, so confirm the change against authorized deployment records and validate the file hash, contents, path, and owner.
### Response and remediation
- Isolate the affected web server and any systems contacted by the malicious file while preserving the polyglot artifact, relevant logs, and volatile evidence.
- Quarantine the file, block its hash and associated source addresses, and remove related web shells, dropped payloads, unauthorized accounts, and altered application files.
- Eliminate persistence from cron jobs, systemd units, startup scripts, SSH `authorized_keys`, web server modules, application plugins, and writable web-root directories.
- Rebuild the server from a known-good image, restore validated application content and configuration, patch exploited components, and rotate credentials or secrets accessible to the web server account.
- Escalate immediately to incident response and expand scoping if the file executed, spawned a shell or interpreter, initiated outbound connections, accessed credentials, or enabled lateral movement.
- Prevent recurrence by validating complete file content rather than extensions or headers, renaming uploads, storing them outside executable web paths, disabling script execution in upload directories, and enforcing least-privilege permissions.
"""
risk_score = 73
rule_id = "82f6fa8d-ea35-4329-b334-f1a557dc58c7"
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).
Elastic Defend integration does not collect advanced file information (such as the different file.Ext.* fields) by default.
In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
#### To set up advanced file information capture for an Elastic Agent policy:
- Go to “Security → Manage → Policies”.
- Select an “Elastic Agent policy”.
- Click “Show advanced settings”.
- Scroll down or search for “linux.advanced.events.populate_file_data”.
- For this rule the linux.advanced.events.populate_file_data variable should be set to "true".
- Click “Save”.
After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
"""
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Use Case: Vulnerability",
"Tactic: Persistence",
"Tactic: Initial Access",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Rule Type: Event Correlation (EQL)",
"Resources: Investigation Guide"
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.action != "deletion" and
(
process.name in (
"nginx", "apache2", "httpd", "caddy", "lighttpd", "httpd.worker", "httpd-worker", "httpd-prefork",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "frankenphp", "lshttpd", "litespeed", "openlitespeed",
"fcgiwrap", "uwsgi", "daphne", "uvicorn", "hypercorn", "granian", "waitress-serve", "flask", "puma",
"unicorn", "unicorn_rails", "thin", "rackup", "mongrel_rails", "starman", "plackup", "twiggy",
"hypnotoad", "starlet", "unitd", "unitd-debug", "java", "node", "nodejs"
) or
process.name like (
"php-fpm*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi", "mono*", "xsp*", "mod-mono-server*",
"fastcgi-mono-server*", "python*", "ruby*", "perl*", "lua*"
)
) and
file.extension in~ (
"php", "phtml", "pht", "php3", "php4", "php5", "php7", "phar",
"asp", "aspx", "ashx", "asmx", "ascx", "cshtml",
"jsp", "jspx", "jsx", "jspf", "tag", "tagx", "war", "ear",
"js", "mjs", "cjs", "ts", "mts", "cts", "tsx",
"razor",
"py", "wsgi", "cgi", "fcgi", "pyc",
"erb", "ru",
"psgi",
"lua", "luac",
"sh", "elf"
) and
file.Ext.header_bytes like (
"ffd8ff*", // JPEG / JPG
"89504e470d0a1a0a*", // PNG
"47494638*", // GIF (GIF87a / GIF89a)
"00000100*", // ICO
"00000200*", // CUR
"424d*", // BMP
"49492a00*", // TIFF (little endian)
"4d4d002a*", // TIFF (big endian)
"52494646*", // RIFF container (WEBP/AVI/etc)
"255044462d*", // PDF
"7f454c46*" // ELF
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
name = "Persistence"
id = "TA0003"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[rule.threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
name = "Initial Access"
id = "TA0001"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat.technique]]
name = "Exploit Public-Facing Application"
id = "T1190"
reference = "https://attack.mitre.org/techniques/T1190/"
[[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.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
Stages and Predicates
Stage 1: file
file where host.os.type == "linux" and event.action != "deletion" and
(
process.name in (
"nginx", "apache2", "httpd", "caddy", "lighttpd", "httpd.worker", "httpd-worker", "httpd-prefork",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "frankenphp", "lshttpd", "litespeed", "openlitespeed",
"fcgiwrap", "uwsgi", "daphne", "uvicorn", "hypercorn", "granian", "waitress-serve", "flask", "puma",
"unicorn", "unicorn_rails", "thin", "rackup", "mongrel_rails", "starman", "plackup", "twiggy",
"hypnotoad", "starlet", "unitd", "unitd-debug", "java", "node", "nodejs"
) or
process.name like (
"php-fpm*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi", "mono*", "xsp*", "mod-mono-server*",
"fastcgi-mono-server*", "python*", "ruby*", "perl*", "lua*"
)
) and
file.extension in~ (
"php", "phtml", "pht", "php3", "php4", "php5", "php7", "phar",
"asp", "aspx", "ashx", "asmx", "ascx", "cshtml",
"jsp", "jspx", "jsx", "jspf", "tag", "tagx", "war", "ear",
"js", "mjs", "cjs", "ts", "mts", "cts", "tsx",
"razor",
"py", "wsgi", "cgi", "fcgi", "pyc",
"erb", "ru",
"psgi",
"lua", "luac",
"sh", "elf"
) and
file.Ext.header_bytes like (
"ffd8ff*",
"89504e470d0a1a0a*",
"47494638*",
"00000100*",
"00000200*",
"424d*",
"49492a00*",
"4d4d002a*",
"52494646*",
"255044462d*",
"7f454c46*"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.extension | in |
| field:"file.extension" kind:in |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Potential Shadow File Read via Command Line Utilities
#Identifies access to the /etc/shadow file via the commandline using standard system utilities. After elevating privileges to root, threat actors may attempt to read or dump this file in order to gain valid credentials. They may utilize these to move laterally undetected and access additional resources.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation | |
| Credential Access |
Rule Body
[metadata]
creation_date = "2022/09/01"
integration = ["endpoint"]
maturity = "production"
updated_date = "2025/12/23"
[rule]
author = ["Elastic"]
description = """
Identifies access to the /etc/shadow file via the commandline using standard system utilities. After elevating
privileges to root, threat actors may attempt to read or dump this file in order to gain valid credentials. They may
utilize these to move laterally undetected and access additional resources.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*"]
language = "kuery"
license = "Elastic License v2"
name = "Potential Shadow File Read via Command Line Utilities"
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 Shadow File Read via Command Line Utilities
In Linux environments, the `/etc/shadow` file stores hashed passwords, making it a prime target for attackers seeking credential access. Adversaries with elevated privileges may exploit command-line utilities to read this file, aiming to extract credentials for lateral movement. The detection rule identifies suspicious access attempts by monitoring process activities related to the file, excluding legitimate operations, thus highlighting potential unauthorized access attempts.
### Possible investigation steps
- Review the process details to identify the executable and arguments used, focusing on the process.args field to confirm access attempts to /etc/shadow.
- Check the process.parent.name field to determine the parent process and assess if it is associated with known legitimate activities or suspicious behavior.
- Investigate the user context under which the process was executed to verify if the user had legitimate reasons to access the /etc/shadow file.
- Examine the host's recent activity logs for any privilege escalation events that might have preceded the access attempt, indicating potential unauthorized privilege elevation.
- Correlate the event with other alerts or logs from the same host to identify patterns or sequences of actions that suggest lateral movement or further credential access attempts.
- Assess the environment for any recent changes or deployments that might explain the access attempt, such as updates or configuration changes involving user management.
### False positive analysis
- System maintenance tasks may trigger alerts when legitimate processes like chown or chmod access the /etc/shadow file. To handle these, consider excluding these specific processes when they are executed by trusted system administrators during scheduled maintenance.
- Containerized environments might generate false positives if processes within containers access the /etc/shadow file. Exclude paths such as /var/lib/docker/* or /run/containerd/* to reduce noise from container operations.
- Security tools like wazuh-modulesd or custom scripts (e.g., gen_passwd_sets) that legitimately interact with the /etc/shadow file for monitoring or compliance checks can be excluded by adding them to the process.parent.name exclusion list.
- Automated scripts or cron jobs that perform routine checks or updates on system files, including /etc/shadow, should be reviewed and, if deemed safe, excluded from triggering alerts by specifying their process names or paths in the exclusion criteria.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement.
- Terminate any suspicious processes identified in the alert that are attempting to access the /etc/shadow file.
- Conduct a thorough review of user accounts and privileges on the affected system to identify any unauthorized privilege escalations or account creations.
- Change all passwords for accounts on the affected system, especially those with elevated privileges, to mitigate the risk of credential compromise.
- Review and update access controls and permissions for sensitive files like /etc/shadow to ensure they are restricted to only necessary users and processes.
- Monitor for any further attempts to access the /etc/shadow file across the network, using enhanced logging and alerting mechanisms to detect similar threats.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems have been compromised."""
references = ["https://www.cyberciti.biz/faq/unix-linux-password-cracking-john-the-ripper/"]
risk_score = 47
rule_id = "9a3a3689-8ed1-4cdb-83fb-9506db54c61f"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Credential Access",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type : "linux" and event.category : "process" and event.action : ("exec" or "exec_event") and
(
process.args : "/etc/shadow" or
(process.working_directory: "/etc" and process.args: "shadow")
) and not (
(process.executable : ("/bin/chown" or "/usr/bin/chown") and process.args : "root:shadow") or
(process.executable : ("/bin/chmod" or "/usr/bin/chmod") and process.args : "640") or
process.executable:(
/vz/* or /var/lib/docker/* or /run/containerd/* or /tmp/.criu* or /tmp/newroot/* or
"/etc/cron.daily/passwd" or "/usr/sbin/lynis" or "/usr/bin/rkhunter" or
"/usr/local/hestia/bin/v-check-user-password" or "/usr/sbin/setroubleshootd" or
"/usr/lib/tiger/scripts/check_passwdformat"
) or
process.parent.name:(gen_passwd_sets or scc_* or wazuh-modulesd)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.008"
name = "/etc/passwd and /etc/shadow"
reference = "https://attack.mitre.org/techniques/T1003/008/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[rule.new_terms]
field = "new_terms_fields"
value = ["process.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
host.os.type : "linux" and event.category : "process" and event.action : ("exec" or "exec_event") and
(
process.args : "/etc/shadow" or
(process.working_directory: "/etc" and process.args: "shadow")
) and not (
(process.executable : ("/bin/chown" or "/usr/bin/chown") and process.args : "root:shadow") or
(process.executable : ("/bin/chmod" or "/usr/bin/chmod") and process.args : "640") or
process.executable:(
/vz/* or /var/lib/docker/* or /run/containerd/* or /tmp/.criu* or /tmp/newroot/* or
"/etc/cron.daily/passwd" or "/usr/sbin/lynis" or "/usr/bin/rkhunter" or
"/usr/local/hestia/bin/v-check-user-password" or "/usr/sbin/setroubleshootd" or
"/usr/lib/tiger/scripts/check_passwdformat"
) or
process.parent.name:(gen_passwd_sets or scc_* or wazuh-modulesd)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.category | eq |
| field:"event.category" kind:eq value:"process" |
process.args | eq |
| field:"process.args" kind:eq |
process.working_directory | eq |
| field:"CurrentDirectory" kind:eq value:"/etc" |
Exclusions
The rule actively suppresses these predicates.
Potential User Authentication Prompt Phishing
#Identifies attempts to coerce the victim to enter their credentials via spawning a browser child process from an unusual parent process pointing to a URL that resembles a legitimate authentication prompt.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Rule Body
[rule]
description = """
Identifies attempts to coerce the victim to enter their credentials via spawning a browser child process from an unusual
parent process pointing to a URL that resembles a legitimate authentication prompt.
"""
id = "7a3b422a-9223-4c6e-8545-d6eac3c2b7d8"
license = "Elastic License v2"
name = "Potential User Authentication Prompt Phishing"
os_list = ["linux"]
reference = ["https://www.wiz.io/blog/threat-actors-target-crypto-orgs"]
version = "1.0.2"
query = '''
process where event.type == "start" and event.action == "exec" and process.name in (
"zenity", "kdialog", "yad",
"ssh-askpass", "ssh-askpass-gnome", "gnome-ssh-askpass",
"ksshaskpass", "lxqt-openssh-askpass",
"pinentry", "pinentry-gnome3", "pinentry-gtk-2", "pinentry-qt"
) and
process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*", "/home/*/*", "/root/*") and
process.command_line like~ (
"*password*", "*passwd*", "*credential*", "*login*", "*authentication*", "*sudo*", "*ssh*", "*wallet*", "*keyring*",
"*token*", "*2fa*", "*mfa*", "*pin*", "*secret*"
) and not (
(
process.name in ("pinentry", "pinentry-gnome3", "pinentry-gtk-2", "pinentry-qt") and
process.args == "pinentry"
) or
(
process.name in ("ssh-askpass", "ssh-askpass-gnome", "gnome-ssh-askpass", "ksshaskpass", "lxqt-openssh-askpass") and
process.parent.executable in ("/tmp/newroot/usr/bin/ssh-agent", "/tmp/newroot/usr/lib/git-core/git-remote-https", "/tmp/newroot/usr/bin/ssh")
)
)
'''
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 = "T1056"
name = "Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/"
[[threat.technique.subtechnique]]
id = "T1056.002"
name = "GUI Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/002/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name in (
"zenity", "kdialog", "yad",
"ssh-askpass", "ssh-askpass-gnome", "gnome-ssh-askpass",
"ksshaskpass", "lxqt-openssh-askpass",
"pinentry", "pinentry-gnome3", "pinentry-gtk-2", "pinentry-qt"
) and
process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*", "/home/*/*", "/root/*") and
process.command_line like~ (
"*password*", "*passwd*", "*credential*", "*login*", "*authentication*", "*sudo*", "*ssh*", "*wallet*", "*keyring*",
"*token*", "*2fa*", "*mfa*", "*pin*", "*secret*"
) and not (
(
process.name in ("pinentry", "pinentry-gnome3", "pinentry-gtk-2", "pinentry-qt") and
process.args == "pinentry"
) or
(
process.name in ("ssh-askpass", "ssh-askpass-gnome", "gnome-ssh-askpass", "ksshaskpass", "lxqt-openssh-askpass") and
process.parent.executable in ("/tmp/newroot/usr/bin/ssh-agent", "/tmp/newroot/usr/lib/git-core/git-remote-https", "/tmp/newroot/usr/bin/ssh")
)
)
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.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | pinentry | excludes:process.args field:"process.args" value:"pinentry" |
process.name | in | pinentry, pinentry-gnome3, pinentry-gtk-2, pinentry-qt | excludes:process.name |
process.name | in | gnome-ssh-askpass, ksshaskpass, lxqt-openssh-askpass, ssh-askpass, ssh-askpass-gnome | excludes:process.name |
process.parent.executable | in | /tmp/newroot/usr/bin/ssh, /tmp/newroot/usr/bin/ssh-agent, /tmp/newroot/usr/lib/git-core/git-remote-https | excludes:process.parent.executable field:"process.parent.executable" value:"/tmp/newroot/usr/bin/ssh" field:"process.parent.executable" value:"/tmp/newroot/usr/bin/ssh-agent" field:"process.parent.executable" value:"/tmp/newroot/usr/lib/git-core/git-remote-https" |
Shell Configuration Creation
#This rule monitors the creation of a shell configuration file. Unix systems use shell configuration files to set environment variables, create aliases, and customize the user's environment. Adversaries may modify or add a shell configuration file to execute malicious code and gain persistence in the system.
Known False Positives
- Legitimate user shell modification activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2024/04/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule monitors the creation of a shell configuration file. Unix systems use shell configuration files to
set environment variables, create aliases, and customize the user's environment. Adversaries may modify or add a shell
configuration file to execute malicious code and gain persistence in the system.
"""
false_positives = ["Legitimate user shell modification activity."]
from = "now-9m"
index = ["logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Shell Configuration Creation"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Shell Configuration Creation
Shell configuration files in Unix-like systems are crucial for setting up user environments by defining variables, aliases, and startup scripts. Adversaries exploit these files to execute malicious code persistently. The detection rule identifies suspicious creation or modification of these files, excluding benign processes, to flag potential threats, aligning with tactics like persistence and event-triggered execution.
### Possible investigation steps
- Review the specific file path involved in the alert to determine if it is a system-wide or user-specific shell configuration file, as listed in the query.
- Identify the process executable that triggered the alert and verify if it is part of the excluded benign processes. If not, investigate the process's origin and purpose.
- Check the creation timestamp of the file to correlate with any known user activities or scheduled tasks that might explain the change.
- Examine the contents of the newly created shell configuration file for any suspicious or unauthorized entries, such as unexpected scripts or commands.
- Investigate the user account associated with the file creation to determine if the activity aligns with their typical behavior or if the account may have been compromised.
- Cross-reference the alert with other security logs or alerts to identify any related suspicious activities or patterns that could indicate a broader attack campaign.
### False positive analysis
- System package managers like dpkg, rpm, and yum often modify shell configuration files during software installations or updates. To handle these, exclude processes with executables such as /bin/dpkg or /usr/bin/rpm from triggering alerts.
- Automated system management tools like Puppet and Chef may alter shell configuration files as part of their routine operations. Exclude these processes by adding exceptions for executables like /opt/puppetlabs/puppet/bin/puppet or /usr/bin/chef-client.
- User account management activities, such as adding new users, can lead to shell configuration file modifications. Exclude processes like /usr/sbin/adduser or /sbin/useradd to prevent false positives in these scenarios.
- Temporary files created by text editors (e.g., .swp files) during editing sessions can trigger alerts. Exclude file extensions such as swp, swpx, and swx to avoid these false positives.
- Virtualization and containerization tools like Docker and Podman may modify shell configuration files as part of their operations. Exclude executables like /usr/bin/dockerd or /usr/bin/podman to manage these cases.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further malicious activity and lateral movement.
- Review the modified or newly created shell configuration files to identify and remove any unauthorized or malicious code.
- Restore the affected shell configuration files from a known good backup to ensure the system's environment is clean and secure.
- Conduct a thorough scan of the system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any additional malware or persistence mechanisms.
- Monitor the system and network for any signs of re-infection or related suspicious activity, focusing on the indicators of compromise (IOCs) associated with the Kaiji malware family.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected.
- Implement additional monitoring and alerting for changes to shell configuration files to enhance detection of similar threats in the future."""
references = [
"https://intezer.com/blog/research/kaiji-new-chinese-linux-malware-turning-to-golang/",
"https://www.elastic.co/security-labs/primer-on-persistence-mechanisms",
]
risk_score = 47
rule_id = "28f6f34b-8e16-487a-b5fd-9d22eb903db8"
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: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.action == "creation" and file.path : (
// system-wide configurations
"/etc/profile", "/etc/profile.d/*", "/etc/bash.bashrc", "/etc/bash.bash_logout", "/etc/zsh/*",
"/etc/csh.cshrc", "/etc/csh.login", "/etc/fish/config.fish", "/etc/ksh.kshrc",
// root and user configurations
"/home/*/.profile", "/home/*/.bashrc", "/home/*/.bash_login", "/home/*/.bash_logout", "/home/*/.bash_profile",
"/root/.profile", "/root/.bashrc", "/root/.bash_login", "/root/.bash_logout", "/root/.bash_profile",
"/root/.bash_aliases", "/home/*/.bash_aliases", "/home/*/.zprofile", "/home/*/.zshrc", "/root/.zprofile",
"/root/.zshrc", "/home/*/.cshrc", "/home/*/.login", "/home/*/.logout", "/root/.cshrc", "/root/.login",
"/root/.logout", "/home/*/.config/fish/config.fish", "/root/.config/fish/config.fish", "/home/*/.kshrc",
"/root/.kshrc"
) and not (
process.executable in (
"/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
"/usr/bin/microdnf", "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum",
"/bin/dnf", "/usr/bin/dnf", "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic",
"/bin/pacman", "/usr/bin/pacman", "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk",
"/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
"/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
"/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/usr/bin/pamac-daemon",
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/sbin/adduser", "/usr/sbin/useradd", "/usr/local/bin/dockerd",
"/usr/sbin/gdm", "/usr/bin/unzip", "/usr/bin/gnome-shell", "/sbin/mkhomedir_helper", "/usr/sbin/sshd",
"/opt/puppetlabs/puppet/bin/ruby", "/usr/bin/xfce4-session", "/usr/libexec/oddjob/mkhomedir", "/sbin/useradd",
"/usr/lib/systemd/systemd", "/usr/sbin/crond", "/usr/bin/pamac-daemon", "/usr/sbin/mkhomedir_helper",
"/opt/pbis/sbin/lwsmd", "/usr/sbin/oddjobd", "./usr/bin/podman", "/usr/bin/dnf5", "/bin/dnf5",
"/usr/libexec/gnome-terminal-server", "/usr/bin/buildah", "/usr/lib/venv-salt-minion/bin/python.original"
) or
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
file.Ext.original.extension == "dpkg-new" or
process.executable like (
"/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*",
"/usr/libexec/platform-python*", "./snap/snapd/*/usr/lib/snapd/snap-update-ns", "/opt/alt/python*/bin/python*"
) or
process.executable == null or
process.name in ("adclient", "mkhomedir_helper", "teleport", "mkhomedir", "adduser", "desktopDaemon", "executor", "crio") or
(process.name == "sed" and file.name like "sed*") or
(process.name == "perl" and file.name like "e2scrub_all.tmp*")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.004"
name = "Unix Shell Configuration Modification"
reference = "https://attack.mitre.org/techniques/T1546/004/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.004"
name = "Unix Shell Configuration Modification"
reference = "https://attack.mitre.org/techniques/T1546/004/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: file
file where host.os.type == "linux" and event.action == "creation" and file.path : (
"/etc/profile", "/etc/profile.d/*", "/etc/bash.bashrc", "/etc/bash.bash_logout", "/etc/zsh/*",
"/etc/csh.cshrc", "/etc/csh.login", "/etc/fish/config.fish", "/etc/ksh.kshrc",
"/home/*/.profile", "/home/*/.bashrc", "/home/*/.bash_login", "/home/*/.bash_logout", "/home/*/.bash_profile",
"/root/.profile", "/root/.bashrc", "/root/.bash_login", "/root/.bash_logout", "/root/.bash_profile",
"/root/.bash_aliases", "/home/*/.bash_aliases", "/home/*/.zprofile", "/home/*/.zshrc", "/root/.zprofile",
"/root/.zshrc", "/home/*/.cshrc", "/home/*/.login", "/home/*/.logout", "/root/.cshrc", "/root/.login",
"/root/.logout", "/home/*/.config/fish/config.fish", "/root/.config/fish/config.fish", "/home/*/.kshrc",
"/root/.kshrc"
) and not (
process.executable in (
"/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
"/usr/bin/microdnf", "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum",
"/bin/dnf", "/usr/bin/dnf", "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic",
"/bin/pacman", "/usr/bin/pacman", "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk",
"/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
"/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
"/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/usr/bin/pamac-daemon",
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/sbin/adduser", "/usr/sbin/useradd", "/usr/local/bin/dockerd",
"/usr/sbin/gdm", "/usr/bin/unzip", "/usr/bin/gnome-shell", "/sbin/mkhomedir_helper", "/usr/sbin/sshd",
"/opt/puppetlabs/puppet/bin/ruby", "/usr/bin/xfce4-session", "/usr/libexec/oddjob/mkhomedir", "/sbin/useradd",
"/usr/lib/systemd/systemd", "/usr/sbin/crond", "/usr/bin/pamac-daemon", "/usr/sbin/mkhomedir_helper",
"/opt/pbis/sbin/lwsmd", "/usr/sbin/oddjobd", "./usr/bin/podman", "/usr/bin/dnf5", "/bin/dnf5",
"/usr/libexec/gnome-terminal-server", "/usr/bin/buildah", "/usr/lib/venv-salt-minion/bin/python.original"
) or
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
file.Ext.original.extension == "dpkg-new" or
process.executable like (
"/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*",
"/usr/libexec/platform-python*", "./snap/snapd/*/usr/lib/snapd/snap-update-ns", "/opt/alt/python*/bin/python*"
) or
process.executable == null or
process.name in ("adclient", "mkhomedir_helper", "teleport", "mkhomedir", "adduser", "desktopDaemon", "executor", "crio") or
(process.name == "sed" and file.name like "sed*") or
(process.name == "perl" and file.name like "e2scrub_all.tmp*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"creation" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.name | starts_with | e2scrub_all.tmp | excludes:file.name field:"file.name" value:"e2scrub_all.tmp" |
process.name | eq | perl | excludes:process.name field:"process.name" value:"perl" |
file.name | starts_with | sed | excludes:file.name field:"file.name" value:"sed" |
process.name | eq | sed | excludes:process.name field:"process.name" value:"sed" |
file.Ext.original.extension | eq | dpkg-new | excludes:file.Ext.original.extension field:"file.Ext.original.extension" value:"dpkg-new" |
file.extension | in | dpkg-remove, swp, swpx, swx | excludes:file.extension |
process.executable | in | ./usr/bin/podman, /bin/autossl_check, /bin/chef-client, /bin/dnf, /bin/dnf-automatic, /bin/dnf5, /bin/dockerd, /bin/dpkg, /bin/dpkg-divert, /bin/microdnf, /bin/pacman, /bin/pamac-daemon, /bin/podman, /bin/puppet, /bin/rpm, /bin/snapd, /bin/yum, /opt/pbis/sbin/lwsmd, /opt/puppetlabs/puppet/bin/puppet, /opt/puppetlabs/puppet/bin/ruby, /proc/self/exe, /sbin/apk, /sbin/mkhomedir_helper, /sbin/useradd, /usr/bin/apt, /usr/bin/autossl_check, /usr/bin/buildah, /usr/bin/chef-client, /usr/bin/dnf, /usr/bin/dnf-automatic, /usr/bin/dnf5, /usr/bin/dockerd, /usr/bin/dpkg, /usr/bin/dpkg-divert, /usr/bin/gnome-shell, /usr/bin/microdnf, /usr/bin/pacman, /usr/bin/pamac-daemon, /usr/bin/podman, /usr/bin/puppet, /usr/bin/rpm, /usr/bin/snapd, /usr/bin/unzip, /usr/bin/xfce4-session, /usr/bin/yum, /usr/lib/snapd/snapd, /usr/lib/systemd/systemd, /usr/lib/venv-salt-minion/bin/python.original, /usr/libexec/gnome-terminal-server, /usr/libexec/oddjob/mkhomedir, /usr/local/bin/dockerd, /usr/local/sbin/apk, /usr/sbin/adduser, /usr/sbin/apk, /usr/sbin/crond, /usr/sbin/dockerd, /usr/sbin/gdm, /usr/sbin/mkhomedir_helper, /usr/sbin/oddjobd, /usr/sbin/pacman, /usr/sbin/sshd, /usr/sbin/useradd | excludes:process.executable |
process.executable | is_null | excludes:process.executable | |
process.executable | wildcard | /nix/store/*, /var/lib/dpkg/*, /tmp/vmis.*, /snap/*, /dev/fd/*, /usr/lib/virtualbox/*, /usr/libexec/platform-python*, ./snap/snapd/*/usr/lib/snapd/snap-update-ns, /opt/alt/python*/bin/python* | excludes:process.executable |
process.name | in | adclient, adduser, crio, desktopDaemon, executor, mkhomedir, mkhomedir_helper, teleport | excludes:process.name |
Signed Binary Execution via Microsoft Office
#Identifies the execution of a signed file written or modified by a Microsoft Office process. This may indicate an attempt to side-load a DLL or execute signed malware.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth |
Rule Body
[rule]
description = """
Identifies the execution of a signed file written or modified by a Microsoft Office process. This may indicate an
attempt to side-load a DLL or execute signed malware.
"""
id = "321e7877-075a-4582-8eff-777dde15e787"
license = "Elastic License v2"
name = "Signed Binary Execution via Microsoft Office"
os_list = ["windows"]
version = "1.0.37"
query = '''
sequence by user.id with maxspan=1m
[file where event.action != "deletion" and
(file.extension : ("exe", "com") or file.Ext.header_bytes : "4d5a*") and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
not file.path : (
"?:\\Users\\*\\Desktop\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Users\\*\\Documents\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\*-*-*-*\\*",
"?:\\Program Files (x86)\\*",
"?:\\Program Files\\*"
)
] by file.path
[process where event.action == "start" and
process.parent.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE", "Cmd.exe") and
process.code_signature.trusted == true and
not (
(
process.pe.original_file_name in ("ZoomIt.exe", "setup.exe", "Setup.exe", "SFXCAB.EXE") and
process.code_signature.subject_name == "Microsoft Corporation"
) or
process.code_signature.subject_name in
(
"Add-in Express",
"Adaptive Insights LLC",
"Adaptive Insights, Inc.",
"Beijing Yundong Zhixiao Network Technology Co. , Ltd.",
"Dynamo Software, Inc.",
"Environmental Systems Research Institute Inc.",
"Essential Objects, Inc.",
"iSpring Solutions, Inc.",
"Insightsoftware.Com, Inc.",
"JPMorgan Chase and Co.",
"KNOWLEDGE MANAGEMENT ASSOCIATES, LLC",
"Poll Everywhere, Inc.",
"PitchBook Data, Inc.",
"Tagetik Software Srl",
"SAS Institute, Inc.",
"Thomson Reuters Corporation",
"TEAMDEV LTD.",
"Vena Solutions Canada Inc.",
"Zhuhai Kingsoft Office Software Co., Ltd.",
"Citrix Systems, Inc.",
"Grammarly, Inc.",
"Planful, Inc.",
"Orpheus Technology Ltd",
"Taralex LLC",
"Code Systems Corporation",
"ACCES EDITIONS SAS",
"PC SOFT INFORMATIQUE",
"Vena Solutions Inc.",
"International Business Machines Corporation",
"Vena Solutions Inc"
)
)
] by process.executable
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by file.path, process.executable, user.id.
Stage 1: file
[file where event.action != "deletion" and
(file.extension : ("exe", "com") or file.Ext.header_bytes : "4d5a*") and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
not file.path : (
"?:\\Users\\*\\Desktop\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Users\\*\\Documents\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\*-*-*-*\\*",
"?:\\Program Files (x86)\\*",
"?:\\Program Files\\*"
)
] by file.path
Stage 2: process
[process where event.action == "start" and
process.parent.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE", "Cmd.exe") and
process.code_signature.trusted == true and
not (
(
process.pe.original_file_name in ("ZoomIt.exe", "setup.exe", "Setup.exe", "SFXCAB.EXE") and
process.code_signature.subject_name == "Microsoft Corporation"
) or
process.code_signature.subject_name in
(
"Add-in Express",
"Adaptive Insights LLC",
"Adaptive Insights, Inc.",
"Beijing Yundong Zhixiao Network Technology Co. , Ltd.",
"Dynamo Software, Inc.",
"Environmental Systems Research Institute Inc.",
"Essential Objects, Inc.",
"iSpring Solutions, Inc.",
"Insightsoftware.Com, Inc.",
"JPMorgan Chase and Co.",
"KNOWLEDGE MANAGEMENT ASSOCIATES, LLC",
"Poll Everywhere, Inc.",
"PitchBook Data, Inc.",
"Tagetik Software Srl",
"SAS Institute, Inc.",
"Thomson Reuters Corporation",
"TEAMDEV LTD.",
"Vena Solutions Canada Inc.",
"Zhuhai Kingsoft Office Software Co., Ltd.",
"Citrix Systems, Inc.",
"Grammarly, Inc.",
"Planful, Inc.",
"Orpheus Technology Ltd",
"Taralex LLC",
"Code Systems Corporation",
"ACCES EDITIONS SAS",
"PC SOFT INFORMATIQUE",
"Vena Solutions Inc.",
"International Business Machines Corporation",
"Vena Solutions Inc"
)
)
] by process.executable
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" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"true" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | wildcard | ?:\Users\*\Desktop\*, ?:\Users\*\Downloads\*, ?:\Users\*\Documents\*, ?:\Users\*\AppData\Local\Temp\*-*-*-*\*, ?:\Program Files (x86)\*, ?:\Program Files\* | excludes:file.path |
process.code_signature.subject_name | eq | Microsoft Corporation | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Corporation" |
process.pe.original_file_name | in | SFXCAB.EXE, Setup.exe, ZoomIt.exe, setup.exe | excludes:process.pe.original_file_name |
process.code_signature.subject_name | in | ACCES EDITIONS SAS, Adaptive Insights LLC, Adaptive Insights, Inc., Add-in Express, Beijing Yundong Zhixiao Network Technology Co. , Ltd., Citrix Systems, Inc., Code Systems Corporation, Dynamo Software, Inc., Environmental Systems Research Institute Inc., Essential Objects, Inc., Grammarly, Inc., Insightsoftware.Com, Inc., International Business Machines Corporation, JPMorgan Chase and Co., KNOWLEDGE MANAGEMENT ASSOCIATES, LLC, Orpheus Technology Ltd, PC SOFT INFORMATIQUE, PitchBook Data, Inc., Planful, Inc., Poll Everywhere, Inc., SAS Institute, Inc., TEAMDEV LTD., Tagetik Software Srl, Taralex LLC, Thomson Reuters Corporation, Vena Solutions Canada Inc., Vena Solutions Inc, Vena Solutions Inc., Zhuhai Kingsoft Office Software Co., Ltd., iSpring Solutions, Inc. | excludes:process.code_signature.subject_name |
SMB Connections via LOLBin or Untrusted Process
#Identifies potentially suspicious processes that are not trusted or living-off-the-land binaries (LOLBin) making Server Message Block (SMB) network connections over port 445. Windows File Sharing is typically implemented over SMB, which communicates between hosts using port 445. Legitimate connections are generally established by the kernel (PID 4). This rule helps to detect processes that might be port scanners, exploits, or user-level processes attempting lateral movement within the network by leveraging SMB connections.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/02/18"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"
[transform]
[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"
[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""
[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""
[rule]
author = ["Elastic"]
description = """
Identifies potentially suspicious processes that are not trusted or living-off-the-land binaries (LOLBin) making Server
Message Block (SMB) network connections over port 445. Windows File Sharing is typically implemented over SMB, which
communicates between hosts using port 445. Legitimate connections are generally established by the kernel (PID 4). This
rule helps to detect processes that might be port scanners, exploits, or user-level processes attempting lateral
movement within the network by leveraging SMB connections.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*", "logs-endpoint.events.network-*"]
language = "eql"
license = "Elastic License v2"
name = "SMB Connections via LOLBin or Untrusted Process"
note = """## Triage and analysis
### Performance
This rule may have low to medium performance impact due to filtering for LOLBins processes starting, followed by network connections over port 445. Additional filtering is applied to reduce the volume of matching events and improve performance.
### Investigating SMB Connections via LOLBin or Untrusted Process
This rule looks for unexpected processes or LOLBins making network connections over port 445. Windows file sharing is typically implemented over Server Message Block (SMB), which communicates between hosts using port 445. When legitimate, these network connections are established by the kernel (PID 4). Occurrences of non-system processes using this port can indicate port scanners, exploits, and tools used to move laterally on the environment.
> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
#### Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate any abnormal behavior by the subject process such as network connections, registry or file modifications, and any spawned child processes.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the process executable using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
- Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
### False positive analysis
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.
- In hybrid environments, SMB may be used for legitimate purposes if operations are performed in Azure. In such cases, consider adding exceptions for known Azure services and operations.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
"""
references = [
"https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
"https://www.elastic.co/security-labs/hunting-for-lateral-movement-using-event-query-language"
]
risk_score = 47
rule_id = "c82c7d8f-fb9e-4874-a4bd-fd9e3f9becf1"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
]
type = "eql"
query = '''
sequence by process.entity_id with maxspan=1m
/* first sequence to capture the start of Windows processes */
[process where host.os.type == "windows" and event.type == "start" and process.pid != 4 and
/* ignore NT Authority and Network Service accounts */
not user.id in ("S-1-5-19", "S-1-5-20") and
/* filter out anything trusted but not from Microsoft */
/* LOLBins will be inherently trusted and signed, so ignore everything else trusted */
not (process.code_signature.trusted == true and not startsWith(process.code_signature.subject_name, "Microsoft")) and
/* filter out PowerShell scripts from Windows Defender ATP */
not (
process.name : "powershell.exe" and
process.args :"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\PSScript_*.ps1")]
/* second sequence to capture network connections over port 445 related to SMB */
[network where host.os.type == "windows" and destination.port == 445 and process.pid != 4]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[rule.threat.technique.subtechnique]]
id = "T1021.002"
name = "SMB/Windows Admin Shares"
reference = "https://attack.mitre.org/techniques/T1021/002/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where host.os.type == "windows" and event.type == "start" and process.pid != 4 and
not user.id in ("S-1-5-19", "S-1-5-20") and
not (process.code_signature.trusted == true and not startsWith(process.code_signature.subject_name, "Microsoft")) and
not (
process.name : "powershell.exe" and
process.args :"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\PSScript_*.ps1")]
Stage 2: network
[network where host.os.type == "windows" and destination.port == 445 and process.pid != 4]
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | starts_with | Microsoft | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.args | wildcard | ?:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Downloads\PSScript_*.ps1 | excludes:process.args field:"process.args" value:"?:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Downloads\PSScript_*.ps1" |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
user.id | in | S-1-5-19, S-1-5-20 | excludes:user.id field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20" |
Suspicious Child Process from WinGet Configuration Remoting Server
#Identifies high-risk interpreters and LOLBins spawned by ConfigurationRemotingServer.exe, the WinGet Configuration remoting worker. Legitimate WinGet configuration may invoke some of these rarely; unexpected children can indicate abuse of the WinGet Configuration COM API to run attacker-controlled actions through Microsoft-signed plumbing, as described in public research on DSCourier.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies high-risk interpreters and LOLBins spawned by ConfigurationRemotingServer.exe, the WinGet Configuration
remoting worker. Legitimate WinGet configuration may invoke some of these rarely; unexpected children can indicate abuse
of the WinGet Configuration COM API to run attacker-controlled actions through Microsoft-signed plumbing, as described
in public research on DSCourier.
"""
id = "a3c7e9b1-2d4f-5a6c-8e0b-1f3d5a7c9e0b"
license = "Elastic License v2"
name = "Suspicious Child Process from WinGet Configuration Remoting Server"
os_list = ["windows"]
reference = ["https://github.com/DylanDavis1/DSCourier"]
version = "1.0.1"
query = '''
process where event.action == "start" and
process.parent.name : "ConfigurationRemotingServer.exe" and
process.name : ("powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe", "cscript.exe",
"bash.exe", "wsl.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe",
"msbuild.exe", "installutil.exe", "regasm.exe", "regsvcs.exe", "curl.exe", "openssh.exe")
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.name : "ConfigurationRemotingServer.exe" and
process.name : ("powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe", "cscript.exe",
"bash.exe", "wsl.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe",
"msbuild.exe", "installutil.exe", "regasm.exe", "regsvcs.exe", "curl.exe", "openssh.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"ConfigurationRemotingServer.exe" |
Suspicious Curl Execution via Automator Workflow
#Detects Automator spawning shell interpreters to execute curl with file output arguments within 10 seconds. This indicates abuse of trusted Automator workflows for malicious file downloads.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects Automator spawning shell interpreters to execute curl with file output arguments within 10 seconds. This
indicates abuse of trusted Automator workflows for malicious file downloads.
"""
id = "45d8fbd2-f441-4d0b-a575-613591d45738"
license = "Elastic License v2"
name = "Suspicious Curl Execution via Automator Workflow"
os_list = ["macos"]
version = "1.0.3"
query = '''
sequence with maxspan=10s
[process where event.type == "start" and event.action == "exec" and process.name in ("bash", "zsh", "sh") and process.args == "-c" and process.parent.name == "Automator"] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and process.args in ("-o", "--output", "-O", "--remote-name")] by process.parent.entity_id
'''
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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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 10s, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.name in ("bash", "zsh", "sh") and process.args == "-c" and process.parent.name == "Automator"] by process.entity_id
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and process.args in ("-o", "--output", "-O", "--remote-name")] by process.parent.entity_id
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:"-c" |
process.args | in |
| field:"process.args" kind:in |
process.name | in |
| field:"process_basename" kind:in |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"Automator" |
Suspicious Scheduled Task Registry Modification
#Identifies the modification of a scheduled task registry key by an unusual process. This behavior is consistent with an adversary attempting to persist or execute via scheduled tasks while avoiding generating event logs.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Identifies the modification of a scheduled task registry key by an unusual process. This behavior is consistent with an
adversary attempting to persist or execute via scheduled tasks while avoiding generating event logs.
"""
id = "817af31e-a360-44eb-9019-e694395627d1"
license = "Elastic License v2"
name = "Suspicious Scheduled Task Registry Modification"
os_list = ["windows"]
reference = ["https://github.com/netero1010/GhostTask/"]
version = "1.0.7"
query = '''
registry where event.action == "modification" and registry.data.strings != "null" and process.executable != null and
process.thread.Ext.call_stack_summary : "?*" and
registry.path : "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tasks\\*Actions*" and
not (process.executable : ("?:\\Windows\\system32\\svchost.exe", "\\Device\\HarddiskVolume*\\Windows\\System32\\svchost.exe") and
process.thread.Ext.call_stack_summary : ("*schedsvc.dll*", "*Unknown*")) and
not process.executable : "C:\\Windows\\WinSxS\\amd64_microsoft-windows-servicingstack_*\\TiWorker.exe"
'''
min_endpoint_version = "8.7.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Stage 1: registry
registry where event.action == "modification" and registry.data.strings != "null" and process.executable != null and
process.thread.Ext.call_stack_summary : "?*" and
registry.path : "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\Tasks\\*Actions*" and
not (process.executable : ("?:\\Windows\\system32\\svchost.exe", "\\Device\\HarddiskVolume*\\Windows\\System32\\svchost.exe") and
process.thread.Ext.call_stack_summary : ("*schedsvc.dll*", "*Unknown*")) and
not process.executable : "C:\\Windows\\WinSxS\\amd64_microsoft-windows-servicingstack_*\\TiWorker.exe"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"modification" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"?*" |
registry.data.strings | ne |
| field:"Details" kind:ne value:"null" |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard value:"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\*Actions*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\Windows\system32\svchost.exe, \Device\HarddiskVolume*\Windows\System32\svchost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\system32\svchost.exe" field:"process.executable" value:"\Device\HarddiskVolume*\Windows\System32\svchost.exe" |
process.thread.Ext.call_stack_summary | match | schedsvc.dll, Unknown | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"schedsvc.dll" field:"process.thread.Ext.call_stack_summary" value:"Unknown" |
process.executable | wildcard | C:\Windows\WinSxS\amd64_microsoft-windows-servicingstack_*\TiWorker.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\WinSxS\amd64_microsoft-windows-servicingstack_*\TiWorker.exe" |
Suspicious Windows Command Shell Execution
#Identifies the execution of the Windows Command Shell process (cmd.exe) with suspicious argument values. This behavior is often observed during malware installation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[rule]
description = """
Identifies the execution of the Windows Command Shell process (cmd.exe) with suspicious argument values. This behavior
is often observed during malware installation.
"""
id = "8dd7588d-fc28-40c0-adfb-14789c763984"
license = "Elastic License v2"
name = "Suspicious Windows Command Shell Execution"
os_list = ["windows"]
version = "1.0.57"
query = '''
process where event.action == "start" and
(process.name : "cmd.exe" or process.pe.original_file_name == "Cmd.Exe") and not user.id : "S-1-5-18" and
process.parent.executable != null and
(
process.command_line : ("*).Run(*", "*GetObject*", "* curl*regsvr32*", "*echo*wscript*", "*echo*ZONE.identifier*",
"*ActiveXObject*", "*dir /s /b *echo*", "*unescape(*", "*findstr*TVNDRgAAAA*", "*findstr*passw*", "*start*\\\\*\\DavWWWRoot\\*",
"* explorer*%CD%*", "*%cd%\\*.js*", "*attrib*%CD%*", "*/?cMD<*", "*/AutoIt3ExecuteScript*..*", "*&cls&cls&cls&cls&cls&*",
"**;*;*;*;*", "* &&s^eT*", "*& ChrW(*", "*&explorer /root*", "*start __ & __\\*", "*findstr /V /L *forfiles*",
"*=wscri& set *", "*http*!COmpUternaME!*", "*start *.pdf * start /min cmd.exe /c *\\\\*", "*pip install*System.Net.WebClient*",
"*Invoke-WebRequest*Start-Process*", "*iwr *saps *", "*-command (Invoke-webrequest*", "*copy /b *\\\\* ping *-n*", "*echo*.ToCharArray*",
"*curl --ntlm -u*", "*bat'; iwr $*", "*http*.Content;*", "*&(gcm i?x)*", "*!*!*!*!*!*!*", "*&& !*!!*", "*for %? in (?) do @set*",
"*QUIT>>?&FTP/s:*", "*iwr *Start-Process*", "*irm https*| iex*", "*^S^T^a*", "*javascript:alert*",
"* /v /c *&&set *&&set *&&set *&&set *&&set*", "*net use *@ssl*rundll32*", "*echo F | xcopy*/h /y &&*",
"* if /i \"%cd%\"==\"C:\\Windows\\System32\" ( echo *", "* if /i \"%cd%\"==\"C:\\Windows\\System32\" ( msg*",
"* if /i \"%cd%\"==\"C:\\Windows\\System32\" (mshta *", "*/c*start*.doc&exit*", "*/k*start msedge*http*&*", "*)) | Invoke-Expression\"",
"*/c *.bat&*.pdf*", "*/c *.bat&*.mp4*", "*set \"*& set \"*& set \"* call %*") or
(process.args_count == 3 and process.args : "%*%" and process.args:"/c") or
process.args : ("1>?:\\*.vbs", "1>?:\\*.js") or
(process.args : "explorer.exe" and process.args : "type" and process.args : ">" and process.args : "start") or
(process.parent.name : ("explorer.exe", "python.exe") and
process.command_line :
("*&&S^eT *",
"*&& set *&& set *&& set *&& set *&& set *&& call*",
"**\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??*",
"*sTArT /MiN *POWeRsheLl -WiNdowStYlE hIddeN*",
"*cURL -O *HtTP*.bat*")) or
(process.parent.name : ("explorer.exe", "python.exe") and process.args : "copy" and
process.args : "&&" and process.args : "\\\\*@*\\*")
) and
/* false positives */
not (process.args : "%TEMP%\\Spiceworks\\*" and process.parent.name : "wmiprvse.exe") and
not (process.parent.name : "cmd.exe" and process.command_line : "*!iodp.wapps!PitaLogger*") and
not process.working_directory like "C:\\Jenkins\\_Workspace\\*" and
not process.parent.executable :
("?:\\Perl64\\bin\\perl.exe",
"?:\\Program Files\\nodejs\\node.exe",
"E:\\eGov\\eGovXtract.exe",
"?:\\Program Files\\HP\\RS\\pgsql\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\64 bit\\PRTG Server.exe",
"?:\\Program Files (x86)\\Spiceworks\\bin\\spiceworks-finder.exe",
"?:\\Program Files (x86)\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files\\Tripwire\\Agent\\Plugins\\twexec\\twexec.exe",
"D:\\Agents\\?\\_work\\_tasks\\*\\SonarScanner.MSBuild.exe",
"?:\\reps\\inventory\\.nodejs\\node\\node.exe",
"?:\\Program Files\\Microsoft VS Code\\Code.exe",
"?:\\Users\\*\\node.exe",
"?:\\nodejs\\node.exe",
"?:\\*\\.nodejs\\node\\node.exe",
"C:\\xampp\\php\\php.exe",
"C:\\officelauncher\\OfficeInstaller.exe",
"C:\\Program Files (x86)\\mRemoteNG\\mRemoteNG.exe",
"D:\\PROGRAMS\\Siebel\\siebsrvr\\BIN\\siebmtshmw.exe",
"C:\\Program Files (x86)\\NetDocuments\\ndOffice\\ndOffice.exe",
"C:\\Program Files\\Waves Central\\Waves Central.exe",
"C:\\Users\\*\\AppData\\Local\\MyASUS Update Messenger\\UpdateMessenger.exe",
"C:\\Program Files\\Microsoft SQL Server\\MSSQL??.MSSQLSERVER\\MSSQL\\Binn\\sqlservr.exe",
"?:\\programmiweb\\NetBeans-*\\netbeans\\bin\\netbeans64.exe",
"?:\\Users\\*\\AppData\\Local\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files\\NetBeans-*\\netbeans\\bin\\netbeans*.exe",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\20??\\Enterprise\\Common?\\IDE\\devenv.exe",
"?:\\Program Files (x86)\\Helpdesk Button\\button_gui.exe",
"?:\\VTSPortable\\VTS\\jre\\bin\\javaw.exe",
"?:\\Program Files\\Bot Framework Composer\\Bot Framework Composer.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\*electron\\AXIS Device Manager Extend.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Arduino IDE\\Arduino IDE.exe",
"?:\\Program Files\\KMSYS Worldwide\\eQuate\\*\\SessionMgr.exe",
"?:\\Program Files (x86)\\Craneware\\Pricing Analyzer\\Craneware.Pricing.Shell.exe",
"?:\\sonarqube\\MSBuild\\SonarScanner.MSBuild.exe",
"?:\\Program Files (x86)\\jumpcloud-agent-app\\jumpcloud-agent-app.exe",
"?:\\Program Files\\PostgreSQL\\*\\bin\\pg_dumpall.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
"?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\ISServerExec.exe",
"?:\\Program Files\\Microsoft SQL Server\\MSSQL*\\MSSQL\\Binn\\sqlservr.exe",
"?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\IDE\\devenv.exe",
"C:\\Program Files\\Microsoft Visual Studio\\*\\Common?\\IDE\\devenv.exe",
"?:\\Program Files (x86)\\Vim\\vim*\\vimrun.exe",
"C:\\Program Files\\NetBeans-28\\bin\\netbeans64.exe",
"C:\\Program Files\\Microsoft Visual Studio\\*\\DtsDebugHost.exe",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\*\\DtsDebugHost.exe",
"C:\\Program Files (x86)\\Quest Software\\*\\Toad.exe",
"?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\ISServerExec.exe") and
not (process.args : "console|findstr" and process.parent.name : "cmd.exe") and
not process.working_directory : "?:\\Program Files (x86)\\Spiceworks\\" and
not (process.parent.name : "wscript.exe" and
process.parent.args : ("D:\\intersystems\\hsfoundation\\databases\\data\\ELSAInfoServer.vbs", "\\\\*")) and
not (process.parent.name : ("pwsh.exe", "powershell.exe") and process.args : "start" and
process.args : "https://login.microsoftonline.com/*") and
not (process.args : "?:\\Program Files\\Citrix\\Secure Access Client\\nsauto.exe" and process.parent.name : "userinit.exe") and
not process.args :
("?:\\Program Files (x86)\\PCMatic\\PCPitstopScheduleService.exe",
"?:\\Program Files (x86)\\AllesTechnologyAgent\\*",
"https://auth.axis.com/oauth2/oauth-authorize*",
"D:\\GitHub\\lilitech-cloud-app\\node_modules\\.bin\\*",
"C:\\ProgramData\\santesocial\\commun\\adm\\produits",
"*--flat-playlist^*--no-cache-dir^*",
"/DIR=C:\\Program Files (x86)\\Zeiss\\Zeiss PDF Printer",
"*plugins\\org.eclipse.birt.doc_*",
"database.*password",
"usebackq delims=: tokens=2") and
not process.command_line :
("\"cmd\" /c %NETBEANS_MAVEN_COMMAND_LINE%",
"cmd /c %NETBEANS_MAVEN_COMMAND_LINE%",
"/c echo %TERM%",
"*RunAsync.vbs*",
"?:\\Windows\\system32\\cmd.exe /q /d /s /c \"npm.cmd ^\"install^\" ^\"--no-bin-links^\" ^\"--production^\"\"") and
not (process.name : "cmd.exe" and process.args : "%TEMP%\\Spiceworks\\*" and process.args : "http*/dataloader/persist_netstat_data") and
not process.parent.command_line : "cmd /q /k prompt MAM:Remote$G" and
not process.parent.args like "C:\\WINDOWS\\Runtime\\utility\\wrapper.vbs" and
not (process.args : "C:\\Windows\\TEMP\\nessus_*.TMP" and process.parent.name : "WmiPrvSE.exe") and
not (process.parent.name : "WmiPrvSe.exe" and
process.args : "& {$j = sajb {$ErrorActionPreference = 'SilentlyContinue';$ErrorActionPreference = 'SilentlyContinue';$jars = $(Get-ChildItem -Path 'C:\\*' -Recurse -Include '*.jar','*.war','*.ear'*") and
not (process.parent.name : "wscript.exe" and
process.parent.args : ("C:\\IBM\\ITM\\TMAITM6_x64\\K06_uninstall.vbs",
"C:\\Windows\\System32\\gatherNetworkInfo.vbs",
"C:\\Program Files\\Arcserve\\Unified Data Protection\\Engine\\BIN\\AStartupRun.vbs")) and
not (process.args == "echo" and process.args == "GEQ" and process.args == "1073741824") and
not (process.parent.name : "wscript.exe" and process.parent.args : "C:\\Program Files (x86)\\CaseWare\\Template\\FinancialsIFRS\\Packager\\After\\0\\FinancialsIFRSCreateShortcuts.js") and
not (process.name : "cmd.exe" and process.parent.name : ("javaw.exe", "udt.exe") and
process.command_line : ("cmd /C %JENV_0%", "/c echo %MENU_SYSTEM%", "/c echo %NJSEXIT7%", "%OPENER% %f%")) and
not (process.parent.executable : "C:\\Users\\*\\AppData\\Local\\Temp\\is-*.tmp\\RublonForWindows-?.?.?.tmp" and
process.command_line : "*https://core.rublon.net/api/app/init*") and
not process.command_line : ("cmd /c echo AMD64", "cmd /c echo x86", "C:\\Windows\\system32\\cmd.exe /c mshta \"javascript:code(close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write*")
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[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.name : "cmd.exe" or process.pe.original_file_name == "Cmd.Exe") and not user.id : "S-1-5-18" and
process.parent.executable != null and
(
process.command_line : ("*).Run(*", "*GetObject*", "* curl*regsvr32*", "*echo*wscript*", "*echo*ZONE.identifier*",
"*ActiveXObject*", "*dir /s /b *echo*", "*unescape(*", "*findstr*TVNDRgAAAA*", "*findstr*passw*", "*start*\\\\*\\DavWWWRoot\\*",
"* explorer*%CD%*", "*%cd%\\*.js*", "*attrib*%CD%*", "*/?cMD<*", "*/AutoIt3ExecuteScript*..*", "*&cls&cls&cls&cls&cls&*",
"**;*;*;*;*", "* &&s^eT*", "*& ChrW(*", "*&explorer /root*", "*start __ & __\\*", "*findstr /V /L *forfiles*",
"*=wscri& set *", "*http*!COmpUternaME!*", "*start *.pdf * start /min cmd.exe /c *\\\\*", "*pip install*System.Net.WebClient*",
"*Invoke-WebRequest*Start-Process*", "*iwr *saps *", "*-command (Invoke-webrequest*", "*copy /b *\\\\* ping *-n*", "*echo*.ToCharArray*",
"*curl --ntlm -u*", "*bat'; iwr $*", "*http*.Content;*", "*&(gcm i?x)*", "*!*!*!*!*!*!*", "*&& !*!!*", "*for %? in (?) do @set*",
"*QUIT>>?&FTP/s:*", "*iwr *Start-Process*", "*irm https*| iex*", "*^S^T^a*", "*javascript:alert*",
"* /v /c *&&set *&&set *&&set *&&set *&&set*", "*net use *@ssl*rundll32*", "*echo F | xcopy*/h /y &&*",
"* if /i \"%cd%\"==\"C:\\Windows\\System32\" ( echo *", "* if /i \"%cd%\"==\"C:\\Windows\\System32\" ( msg*",
"* if /i \"%cd%\"==\"C:\\Windows\\System32\" (mshta *", "*/c*start*.doc&exit*", "*/k*start msedge*http*&*", "*)) | Invoke-Expression\"",
"*/c *.bat&*.pdf*", "*/c *.bat&*.mp4*", "*set \"*& set \"*& set \"* call %*") or
(process.args_count == 3 and process.args : "%*%" and process.args:"/c") or
process.args : ("1>?:\\*.vbs", "1>?:\\*.js") or
(process.args : "explorer.exe" and process.args : "type" and process.args : ">" and process.args : "start") or
(process.parent.name : ("explorer.exe", "python.exe") and
process.command_line :
("*&&S^eT *",
"*&& set *&& set *&& set *&& set *&& set *&& call*",
"**\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??\\u00??*",
"*sTArT /MiN *POWeRsheLl -WiNdowStYlE hIddeN*",
"*cURL -O *HtTP*.bat*")) or
(process.parent.name : ("explorer.exe", "python.exe") and process.args : "copy" and
process.args : "&&" and process.args : "\\\\*@*\\*")
) and
not (process.args : "%TEMP%\\Spiceworks\\*" and process.parent.name : "wmiprvse.exe") and
not (process.parent.name : "cmd.exe" and process.command_line : "*!iodp.wapps!PitaLogger*") and
not process.working_directory like "C:\\Jenkins\\_Workspace\\*" and
not process.parent.executable :
("?:\\Perl64\\bin\\perl.exe",
"?:\\Program Files\\nodejs\\node.exe",
"E:\\eGov\\eGovXtract.exe",
"?:\\Program Files\\HP\\RS\\pgsql\\bin\\pg_dumpall.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\64 bit\\PRTG Server.exe",
"?:\\Program Files (x86)\\Spiceworks\\bin\\spiceworks-finder.exe",
"?:\\Program Files (x86)\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files\\Tripwire\\Agent\\Plugins\\twexec\\twexec.exe",
"D:\\Agents\\?\\_work\\_tasks\\*\\SonarScanner.MSBuild.exe",
"?:\\reps\\inventory\\.nodejs\\node\\node.exe",
"?:\\Program Files\\Microsoft VS Code\\Code.exe",
"?:\\Users\\*\\node.exe",
"?:\\nodejs\\node.exe",
"?:\\*\\.nodejs\\node\\node.exe",
"C:\\xampp\\php\\php.exe",
"C:\\officelauncher\\OfficeInstaller.exe",
"C:\\Program Files (x86)\\mRemoteNG\\mRemoteNG.exe",
"D:\\PROGRAMS\\Siebel\\siebsrvr\\BIN\\siebmtshmw.exe",
"C:\\Program Files (x86)\\NetDocuments\\ndOffice\\ndOffice.exe",
"C:\\Program Files\\Waves Central\\Waves Central.exe",
"C:\\Users\\*\\AppData\\Local\\MyASUS Update Messenger\\UpdateMessenger.exe",
"C:\\Program Files\\Microsoft SQL Server\\MSSQL??.MSSQLSERVER\\MSSQL\\Binn\\sqlservr.exe",
"?:\\programmiweb\\NetBeans-*\\netbeans\\bin\\netbeans64.exe",
"?:\\Users\\*\\AppData\\Local\\Zuercher Suite\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Public Safety Suite Professional\\production\\leds\\leds.exe",
"?:\\Program Files (x86)\\Tier2Tickets\\button_gui.exe",
"?:\\Program Files\\NetBeans-*\\netbeans\\bin\\netbeans*.exe",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\20??\\Enterprise\\Common?\\IDE\\devenv.exe",
"?:\\Program Files (x86)\\Helpdesk Button\\button_gui.exe",
"?:\\VTSPortable\\VTS\\jre\\bin\\javaw.exe",
"?:\\Program Files\\Bot Framework Composer\\Bot Framework Composer.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\*electron\\AXIS Device Manager Extend.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Arduino IDE\\Arduino IDE.exe",
"?:\\Program Files\\KMSYS Worldwide\\eQuate\\*\\SessionMgr.exe",
"?:\\Program Files (x86)\\Craneware\\Pricing Analyzer\\Craneware.Pricing.Shell.exe",
"?:\\sonarqube\\MSBuild\\SonarScanner.MSBuild.exe",
"?:\\Program Files (x86)\\jumpcloud-agent-app\\jumpcloud-agent-app.exe",
"?:\\Program Files\\PostgreSQL\\*\\bin\\pg_dumpall.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
"?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\ISServerExec.exe",
"?:\\Program Files\\Microsoft SQL Server\\MSSQL*\\MSSQL\\Binn\\sqlservr.exe",
"?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\IDE\\devenv.exe",
"C:\\Program Files\\Microsoft Visual Studio\\*\\Common?\\IDE\\devenv.exe",
"?:\\Program Files (x86)\\Vim\\vim*\\vimrun.exe",
"C:\\Program Files\\NetBeans-28\\bin\\netbeans64.exe",
"C:\\Program Files\\Microsoft Visual Studio\\*\\DtsDebugHost.exe",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\*\\DtsDebugHost.exe",
"C:\\Program Files (x86)\\Quest Software\\*\\Toad.exe",
"?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\ISServerExec.exe") and
not (process.args : "console|findstr" and process.parent.name : "cmd.exe") and
not process.working_directory : "?:\\Program Files (x86)\\Spiceworks\\" and
not (process.parent.name : "wscript.exe" and
process.parent.args : ("D:\\intersystems\\hsfoundation\\databases\\data\\ELSAInfoServer.vbs", "\\\\*")) and
not (process.parent.name : ("pwsh.exe", "powershell.exe") and process.args : "start" and
process.args : "https://login.microsoftonline.com/*") and
not (process.args : "?:\\Program Files\\Citrix\\Secure Access Client\\nsauto.exe" and process.parent.name : "userinit.exe") and
not process.args :
("?:\\Program Files (x86)\\PCMatic\\PCPitstopScheduleService.exe",
"?:\\Program Files (x86)\\AllesTechnologyAgent\\*",
"https://auth.axis.com/oauth2/oauth-authorize*",
"D:\\GitHub\\lilitech-cloud-app\\node_modules\\.bin\\*",
"C:\\ProgramData\\santesocial\\commun\\adm\\produits",
"*--flat-playlist^*--no-cache-dir^*",
"/DIR=C:\\Program Files (x86)\\Zeiss\\Zeiss PDF Printer",
"*plugins\\org.eclipse.birt.doc_*",
"database.*password",
"usebackq delims=: tokens=2") and
not process.command_line :
("\"cmd\" /c %NETBEANS_MAVEN_COMMAND_LINE%",
"cmd /c %NETBEANS_MAVEN_COMMAND_LINE%",
"/c echo %TERM%",
"*RunAsync.vbs*",
"?:\\Windows\\system32\\cmd.exe /q /d /s /c \"npm.cmd ^\"install^\" ^\"--no-bin-links^\" ^\"--production^\"\"") and
not (process.name : "cmd.exe" and process.args : "%TEMP%\\Spiceworks\\*" and process.args : "http*/dataloader/persist_netstat_data") and
not process.parent.command_line : "cmd /q /k prompt MAM:Remote$G" and
not process.parent.args like "C:\\WINDOWS\\Runtime\\utility\\wrapper.vbs" and
not (process.args : "C:\\Windows\\TEMP\\nessus_*.TMP" and process.parent.name : "WmiPrvSE.exe") and
not (process.parent.name : "WmiPrvSe.exe" and
process.args : "& {$j = sajb {$ErrorActionPreference = 'SilentlyContinue';$ErrorActionPreference = 'SilentlyContinue';$jars = $(Get-ChildItem -Path 'C:\\*' -Recurse -Include '*.jar','*.war','*.ear'*") and
not (process.parent.name : "wscript.exe" and
process.parent.args : ("C:\\IBM\\ITM\\TMAITM6_x64\\K06_uninstall.vbs",
"C:\\Windows\\System32\\gatherNetworkInfo.vbs",
"C:\\Program Files\\Arcserve\\Unified Data Protection\\Engine\\BIN\\AStartupRun.vbs")) and
not (process.args == "echo" and process.args == "GEQ" and process.args == "1073741824") and
not (process.parent.name : "wscript.exe" and process.parent.args : "C:\\Program Files (x86)\\CaseWare\\Template\\FinancialsIFRS\\Packager\\After\\0\\FinancialsIFRSCreateShortcuts.js") and
not (process.name : "cmd.exe" and process.parent.name : ("javaw.exe", "udt.exe") and
process.command_line : ("cmd /C %JENV_0%", "/c echo %MENU_SYSTEM%", "/c echo %NJSEXIT7%", "%OPENER% %f%")) and
not (process.parent.executable : "C:\\Users\\*\\AppData\\Local\\Temp\\is-*.tmp\\RublonForWindows-?.?.?.tmp" and
process.command_line : "*https://core.rublon.net/api/app/init*") and
not process.command_line : ("cmd /c echo AMD64", "cmd /c echo x86", "C:\\Windows\\system32\\cmd.exe /c mshta \"javascript:code(close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write*")
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.args_count | eq |
| field:"process.args_count" kind:eq value:"3" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"cmd.exe" |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null | |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"Cmd.Exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | 1073741824 | excludes:process.args field:"process.args" value:"1073741824" |
process.args | eq | GEQ | excludes:process.args field:"process.args" value:"GEQ" |
process.args | eq | echo | excludes:process.args field:"process.args" value:"echo" |
process.args | eq | ?:\Program Files\Citrix\Secure Access Client\nsauto.exe | excludes:process.args field:"process.args" value:"?:\Program Files\Citrix\Secure Access Client\nsauto.exe" |
process.parent.name | eq | userinit.exe | excludes:process.parent.name field:"process.parent.name" value:"userinit.exe" |
process.args | eq | console|findstr | excludes:process.args field:"process.args" value:"console|findstr" |
process.parent.name | eq | cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"cmd.exe" |
process.args | eq | start | excludes:process.args field:"process.args" value:"start" |
process.args | starts_with | https://login.microsoftonline.com/ | excludes:process.args field:"process.args" value:"https://login.microsoftonline.com/" |
process.parent.name | eq | pwsh.exe, powershell.exe | excludes:process.parent.name field:"process.parent.name" value:"pwsh.exe" field:"process.parent.name" value:"powershell.exe" |
process.args | starts_with | %TEMP%\Spiceworks\ | excludes:process.args field:"process.args" value:"%TEMP%\Spiceworks\" |
process.args | wildcard | http*/dataloader/persist_netstat_data | excludes:process.args field:"process.args" value:"http*/dataloader/persist_netstat_data" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.parent.name | eq | wmiprvse.exe | excludes:process.parent.name field:"process.parent.name" value:"wmiprvse.exe" |
process.args | wildcard | & {$j = sajb {$ErrorActionPreference = 'SilentlyContinue';$ErrorActionPreference = 'SilentlyContinue';$jars = $(Get-ChildItem -Path 'C:\*' -Recurse -Include '*.jar','*.war','*.ear'* | excludes:process.args field:"process.args" value:"& {$j = sajb {$ErrorActionPreference = 'SilentlyContinue';$ErrorActionPreference = 'SilentlyContinue';$jars = $(Get-ChildItem -Path 'C:\*' -Recurse -Include '*.jar','*.war','*.ear'*" |
process.parent.name | eq | WmiPrvSe.exe | excludes:process.parent.name field:"process.parent.name" value:"WmiPrvSe.exe" |
process.args | wildcard | C:\Windows\TEMP\nessus_*.TMP | excludes:process.args field:"process.args" value:"C:\Windows\TEMP\nessus_*.TMP" |
process.parent.name | eq | WmiPrvSE.exe | excludes:process.parent.name field:"process.parent.name" value:"WmiPrvSE.exe" |
process.command_line | eq | cmd /C %JENV_0%, /c echo %MENU_SYSTEM%, /c echo %NJSEXIT7%, %OPENER% %f% | excludes:process.command_line |
process.parent.name | eq | javaw.exe, udt.exe | excludes:process.parent.name field:"process.parent.name" value:"javaw.exe" field:"process.parent.name" value:"udt.exe" |
process.command_line | match | !iodp.wapps!PitaLogger | excludes:process.command_line field:"process.command_line" value:"!iodp.wapps!PitaLogger" |
process.command_line | match | https://core.rublon.net/api/app/init | excludes:process.command_line field:"process.command_line" value:"https://core.rublon.net/api/app/init" |
process.parent.executable | wildcard | C:\Users\*\AppData\Local\Temp\is-*.tmp\RublonForWindows-?.?.?.tmp | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Users\*\AppData\Local\Temp\is-*.tmp\RublonForWindows-?.?.?.tmp" |
process.parent.args | eq | C:\IBM\ITM\TMAITM6_x64\K06_uninstall.vbs, C:\Windows\System32\gatherNetworkInfo.vbs, C:\Program Files\Arcserve\Unified Data Protection\Engine\BIN\AStartupRun.vbs | excludes:process.parent.args field:"process.parent.args" value:"C:\IBM\ITM\TMAITM6_x64\K06_uninstall.vbs" field:"process.parent.args" value:"C:\Windows\System32\gatherNetworkInfo.vbs" field:"process.parent.args" value:"C:\Program Files\Arcserve\Unified Data Protection\Engine\BIN\AStartupRun.vbs" |
process.parent.name | eq | wscript.exe | excludes:process.parent.name field:"process.parent.name" value:"wscript.exe" |
process.parent.args | eq | C:\Program Files (x86)\CaseWare\Template\FinancialsIFRS\Packager\After\0\FinancialsIFRSCreateShortcuts.js | excludes:process.parent.args field:"process.parent.args" value:"C:\Program Files (x86)\CaseWare\Template\FinancialsIFRS\Packager\After\0\FinancialsIFRSCreateShortcuts.js" |
process.parent.args | wildcard | D:\intersystems\hsfoundation\databases\data\ELSAInfoServer.vbs, \\* | excludes:process.parent.args field:"process.parent.args" value:"D:\intersystems\hsfoundation\databases\data\ELSAInfoServer.vbs" field:"process.parent.args" value:"\\*" |
process.args | wildcard | ?:\Program Files (x86)\PCMatic\PCPitstopScheduleService.exe, ?:\Program Files (x86)\AllesTechnologyAgent\*, https://auth.axis.com/oauth2/oauth-authorize*, D:\GitHub\lilitech-cloud-app\node_modules\.bin\*, C:\ProgramData\santesocial\commun\adm\produits, *--flat-playlist^*--no-cache-dir^*, /DIR=C:\Program Files (x86)\Zeiss\Zeiss PDF Printer, *plugins\org.eclipse.birt.doc_*, database.*password, usebackq delims=: tokens=2 | excludes:process.args |
process.command_line | wildcard | "cmd" /c %NETBEANS_MAVEN_COMMAND_LINE%, cmd /c %NETBEANS_MAVEN_COMMAND_LINE%, /c echo %TERM%, *RunAsync.vbs*, ?:\Windows\system32\cmd.exe /q /d /s /c "npm.cmd ^"install^" ^"--no-bin-links^" ^"--production^"" | excludes:process.command_line |
process.command_line | wildcard | cmd /c echo AMD64, cmd /c echo x86, C:\Windows\system32\cmd.exe /c mshta "javascript:code(close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write* | excludes:process.command_line |
process.parent.args | eq | C:\WINDOWS\Runtime\utility\wrapper.vbs | excludes:process.parent.args field:"process.parent.args" value:"C:\WINDOWS\Runtime\utility\wrapper.vbs" |
process.parent.command_line | eq | cmd /q /k prompt MAM:Remote$G | excludes:process.parent.command_line field:"process.parent.command_line" value:"cmd /q /k prompt MAM:Remote$G" |
process.parent.executable | wildcard | ?:\Perl64\bin\perl.exe, ?:\Program Files\nodejs\node.exe, E:\eGov\eGovXtract.exe, ?:\Program Files\HP\RS\pgsql\bin\pg_dumpall.exe, ?:\Program Files (x86)\PRTG Network Monitor\64 bit\PRTG Server.exe, ?:\Program Files (x86)\Spiceworks\bin\spiceworks-finder.exe, ?:\Program Files (x86)\Zuercher Suite\production\leds\leds.exe, ?:\Program Files\Tripwire\Agent\Plugins\twexec\twexec.exe, D:\Agents\?\_work\_tasks\*\SonarScanner.MSBuild.exe, ?:\reps\inventory\.nodejs\node\node.exe, ?:\Program Files\Microsoft VS Code\Code.exe, ?:\Users\*\node.exe, ?:\nodejs\node.exe, ?:\*\.nodejs\node\node.exe, C:\xampp\php\php.exe, C:\officelauncher\OfficeInstaller.exe, C:\Program Files (x86)\mRemoteNG\mRemoteNG.exe, D:\PROGRAMS\Siebel\siebsrvr\BIN\siebmtshmw.exe, C:\Program Files (x86)\NetDocuments\ndOffice\ndOffice.exe, C:\Program Files\Waves Central\Waves Central.exe, C:\Users\*\AppData\Local\MyASUS Update Messenger\UpdateMessenger.exe, C:\Program Files\Microsoft SQL Server\MSSQL??.MSSQLSERVER\MSSQL\Binn\sqlservr.exe, ?:\programmiweb\NetBeans-*\netbeans\bin\netbeans64.exe, ?:\Users\*\AppData\Local\Zuercher Suite\production\leds\leds.exe, ?:\Program Files (x86)\Public Safety Suite Professional\production\leds\leds.exe, ?:\Program Files (x86)\Tier2Tickets\button_gui.exe, ?:\Program Files\NetBeans-*\netbeans\bin\netbeans*.exe, C:\Program Files (x86)\Microsoft Visual Studio\20??\Enterprise\Common?\IDE\devenv.exe, ?:\Program Files (x86)\Helpdesk Button\button_gui.exe, ?:\VTSPortable\VTS\jre\bin\javaw.exe, ?:\Program Files\Bot Framework Composer\Bot Framework Composer.exe, ?:\Users\*\AppData\Local\Programs\*electron\AXIS Device Manager Extend.exe, ?:\Users\*\AppData\Local\Programs\Arduino IDE\Arduino IDE.exe, ?:\Program Files\KMSYS Worldwide\eQuate\*\SessionMgr.exe, ?:\Program Files (x86)\Craneware\Pricing Analyzer\Craneware.Pricing.Shell.exe, ?:\sonarqube\MSBuild\SonarScanner.MSBuild.exe, ?:\Program Files (x86)\jumpcloud-agent-app\jumpcloud-agent-app.exe, ?:\Program Files\PostgreSQL\*\bin\pg_dumpall.exe, ?:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe, ?:\Program Files\Microsoft SQL Server\*\DTS\Binn\ISServerExec.exe, ?:\Program Files\Microsoft SQL Server\MSSQL*\MSSQL\Binn\sqlservr.exe, ?:\Program Files (x86)\Microsoft Visual Studio\*\IDE\devenv.exe, C:\Program Files\Microsoft Visual Studio\*\Common?\IDE\devenv.exe, ?:\Program Files (x86)\Vim\vim*\vimrun.exe, C:\Program Files\NetBeans-28\bin\netbeans64.exe, C:\Program Files\Microsoft Visual Studio\*\DtsDebugHost.exe, C:\Program Files (x86)\Microsoft Visual Studio\*\DtsDebugHost.exe, C:\Program Files (x86)\Quest Software\*\Toad.exe, ?:\Program Files\Microsoft SQL Server\*\DTS\Binn\ISServerExec.exe | excludes:process.parent.executable |
process.working_directory | eq | ?:\Program Files (x86)\Spiceworks\ | excludes:process.working_directory field:"process.working_directory" value:"?:\Program Files (x86)\Spiceworks\" |
process.working_directory | starts_with | C:\Jenkins\_Workspace\ | excludes:process.working_directory field:"process.working_directory" value:"C:\Jenkins\_Workspace\" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Tampering of Shell Command-Line History
#Adversaries may attempt to clear or disable the Bash command-line history in an attempt to evade detection or forensic investigations.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/05/04"
integration = ["endpoint", "auditd_manager"]
maturity = "production"
updated_date = "2025/12/23"
[rule]
author = ["Elastic"]
description = """
Adversaries may attempt to clear or disable the Bash command-line history in an attempt to evade detection or forensic
investigations.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
language = "eql"
license = "Elastic License v2"
name = "Tampering of Shell Command-Line History"
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 Tampering of Shell Command-Line History
Shell command-line history is a crucial feature in Unix-like systems, recording user commands for convenience and auditing. Adversaries may manipulate this history to hide their tracks, using commands to delete or redirect history files, clear history buffers, or disable history logging. The detection rule identifies such tampering by monitoring for suspicious command patterns and arguments indicative of history manipulation attempts.
### Possible investigation steps
- Review the process execution details to identify the user account associated with the suspicious command, focusing on the process.args field to determine the specific command and arguments used.
- Check the process execution timeline to correlate the suspicious activity with other events on the system, such as logins or file modifications, to understand the context of the tampering attempt.
- Investigate the command history files (.bash_history, .zsh_history) for the affected user accounts to assess the extent of tampering and identify any commands that may have been executed prior to the history manipulation.
- Examine system logs and audit records for any additional indicators of compromise or related suspicious activities, such as unauthorized access attempts or privilege escalation events.
- Verify the current configuration of the HISTFILE and HISTFILESIZE environment variables for the affected user accounts to ensure they have not been altered to disable history logging.
### False positive analysis
- System administrators or automated scripts may clear command-line history as part of routine maintenance or privacy measures. To handle this, identify and whitelist known scripts or user accounts that perform these actions regularly.
- Developers or power users might redirect or unset history files to manage disk space or for personal preference. Consider excluding specific user accounts or directories from monitoring if these actions are verified as non-malicious.
- Security tools or compliance scripts may execute commands that resemble history tampering to ensure systems are in a desired state. Review and exclude these tools from triggering alerts by adding them to an exception list.
- Temporary testing environments or sandboxed systems might frequently clear history as part of their reset processes. Exclude these environments from the rule to prevent unnecessary alerts.
- Users with privacy concerns might intentionally disable history logging. Engage with these users to understand their needs and adjust monitoring policies accordingly, possibly by excluding their sessions from the rule.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further tampering or data exfiltration.
- Conduct a thorough review of the affected user's recent command history and system logs to identify any unauthorized or suspicious activities that may have occurred prior to the tampering.
- Restore the tampered history files from a secure backup, if available, to aid in further forensic analysis and ensure continuity of auditing.
- Re-enable and secure shell history logging by resetting the HISTFILE and HISTFILESIZE environment variables to their default values and ensuring they are not set to null or zero.
- Implement stricter access controls and monitoring on the affected system to prevent unauthorized users from modifying shell history files in the future.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems may have been compromised.
- Review and update endpoint detection and response (EDR) configurations to enhance monitoring for similar tampering attempts, ensuring alerts are generated for any future suspicious command patterns."""
references = ["https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security"]
risk_score = 47
rule_id = "7bcbb3ac-e533-41ad-a612-d6c3bf666aba"
setup = """## Setup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
`event.ingested` to @timestamp.
For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Auditd Manager",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.action in ("exec", "exec_event", "executed", "process_started") and event.type == "start" and
(
(
(process.args : ("rm", "echo") or
(process.args : "ln" and process.args : "-sf" and process.args : "/dev/null") or
(process.args : "truncate" and process.args : "-s0")
)
and process.args : (
".bash_history", "/root/.bash_history", "/home/*/.bash_history","/Users/.bash_history", "/Users/*/.bash_history",
".zsh_history", "/root/.zsh_history", "/home/*/.zsh_history", "/Users/.zsh_history", "/Users/*/.zsh_history"
)
) or
(process.args : "history" and process.args : "-c") or
(process.args : "export" and process.args : ("HISTFILE=/dev/null", "HISTFILESIZE=0")) or
(process.args : "unset" and process.args : "HISTFILE") or
(process.args : "set" and process.args : "history" and process.args : "+o")
) and not (
process.executable like (
"/usr/bin/timeout", "/usr/bin/kubectl", "/usr/bin/psql", "/usr/lib/postgresql/*/bin/psql", "/usr/bin/bazel", "/usr/bin/git", "/usr/bin/jq", "/bin/grep"
) or
process.command_line == "stat -c %s history"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"
[[rule.threat.technique.subtechnique]]
id = "T1070.003"
name = "Clear Command History"
reference = "https://attack.mitre.org/techniques/T1070/003/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where event.action in ("exec", "exec_event", "executed", "process_started") and event.type == "start" and
(
(
(process.args : ("rm", "echo") or
(process.args : "ln" and process.args : "-sf" and process.args : "/dev/null") or
(process.args : "truncate" and process.args : "-s0")
)
and process.args : (
".bash_history", "/root/.bash_history", "/home/*/.bash_history","/Users/.bash_history", "/Users/*/.bash_history",
".zsh_history", "/root/.zsh_history", "/home/*/.zsh_history", "/Users/.zsh_history", "/Users/*/.zsh_history"
)
) or
(process.args : "history" and process.args : "-c") or
(process.args : "export" and process.args : ("HISTFILE=/dev/null", "HISTFILESIZE=0")) or
(process.args : "unset" and process.args : "HISTFILE") or
(process.args : "set" and process.args : "history" and process.args : "+o")
) and not (
process.executable like (
"/usr/bin/timeout", "/usr/bin/kubectl", "/usr/bin/psql", "/usr/lib/postgresql/*/bin/psql", "/usr/bin/bazel", "/usr/bin/git", "/usr/bin/jq", "/bin/grep"
) or
process.command_line == "stat -c %s history"
)
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 | wildcard |
| field:"process.args" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | eq | stat -c %s history | excludes:process.command_line field:"process.command_line" value:"stat -c %s history" |
process.executable | wildcard | /usr/bin/timeout, /usr/bin/kubectl, /usr/bin/psql, /usr/lib/postgresql/*/bin/psql, /usr/bin/bazel, /usr/bin/git, /usr/bin/jq, /bin/grep | excludes:process.executable |
WPS Office Exploitation via DLL Hijack
#Identifies the load of a remote library by the WPS Office promecefpluginhost.exe executable. This may indicate the successful exploitation of CVE-2024-7262 or CVE-2024-7263 via DLL hijack abusing the ksoqing custom protocol handler.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Stealth |
Rule Body
[metadata]
creation_date = "2024/08/29"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/01"
[rule]
author = ["Elastic"]
description = """
Identifies the load of a remote library by the WPS Office promecefpluginhost.exe executable. This may indicate the
successful exploitation of CVE-2024-7262 or CVE-2024-7263 via DLL hijack abusing the ksoqing custom protocol handler.
"""
from = "now-9m"
index = ["logs-endpoint.events.library-*", "logs-windows.sysmon_operational-*"]
language = "eql"
license = "Elastic License v2"
name = "WPS Office Exploitation via DLL Hijack"
references = [
"https://www.welivesecurity.com/en/eset-research/analysis-of-two-arbitrary-code-execution-vulnerabilities-affecting-wps-office/",
"https://mp.weixin.qq.com/s/F8hNyESBdKhwXkQPgtGpew",
]
risk_score = 73
rule_id = "ac6bc744-e82b-41ad-b58d-90654fa4ebfb"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
any where host.os.type == "windows" and process.name : "promecefpluginhost.exe" and
(
(event.category == "library" and
?dll.path :
("?:\\Users\\*\\AppData\\Local\\Temp\\wps\\INetCache\\*",
"\\Device\\Mup\\**", "\\\\*")) or
((event.category == "process" and event.action : "Image loaded*") and
?file.path :
("?:\\Users\\*\\AppData\\Local\\Temp\\wps\\INetCache\\*",
"\\Device\\Mup\\**", "\\\\*"))
)
'''
note = """## Triage and analysis
### Investigating WPS Office Exploitation via DLL Hijack
#### Possible investigation steps
- What WPS library-load path did the alert capture?
- Why: WPS loading from cache, device, or UNC paths defines the likely abuse route before identity checks.
- Focus: `process.name`, `process.executable`, `process.command_line`, `dll.path`, and `dll.name`.
- Implication: escalate when "promecefpluginhost.exe" loads from "Temp\\wps\\INetCache", "\\Device\\Mup\\", or a UNC path outside the WPS install tree; lower suspicion only when normalized `dll.path` resolves to the same Kingsoft-controlled component path as the loader and no protocol-abuse arguments appear.
- Is the WPS loader the expected Kingsoft component?
- Focus: `process.executable`, `process.pe.original_file_name`, `process.hash.sha256`, `process.code_signature.subject_name`, and `process.code_signature.trusted`.
- Implication: escalate when the loader is unsigned, renamed, outside the installed WPS Office directory, or signed by an unexpected publisher; lower suspicion when identity matches a stable Kingsoft WPS component, but continue because a trusted loader can still load an attacker DLL.
- Does the command line and parentage show "ksoqing" protocol abuse?
- Focus: loader process events for `host.id` and `process.entity_id`, then `process.command_line`, `process.parent.executable`, and `process.parent.command_line`. $investigate_2
- Implication: escalate when "wps.exe" or "et.exe" opens user content with arguments exposing "ksoqing", plugin-service paths, encoded paths, or remote paths; lower suspicion only when parentage and arguments match a recognized controlled-share launch without document-driven protocol handling.
- Does the loaded DLL identity fit a legitimate WPS dependency?
- Focus: `dll.hash.sha256`, `dll.pe.original_file_name`, `dll.code_signature.subject_name`, `dll.code_signature.trusted`, and `dll.Ext.relative_file_creation_time`.
- Hint: if endpoint file telemetry is available, use `host.id` and `dll.path` to identify the writer or rename event. Missing file telemetry is unresolved, not benign. $investigate_4
- Implication: escalate when the DLL is unsigned, non-Kingsoft, recently created, recently renamed in `dll.Ext.relative_file_name_modify_time`, or loaded as an unexpected WPS dependency from a remote share; if recency metadata is absent, rely on path, hash, signer, and parentage.
- If local evidence is suspicious or incomplete, do related alerts show follow-on activity?
- Focus: child process events from the WPS loader and related alerts for `user.id`, especially WPS document execution, additional library loads, downloader behavior, or child-process alerts from the same workstation.
- $investigate_3
- $investigate_0
- Hint: if user context is missing or ambiguous, review same-host alerts for `host.id` across the last 48 hours. $investigate_1
- Implication: broaden scope when the same user or host shows repeated WPS-triggered loads, the same `dll.hash.sha256`, the same suspicious path pattern, or follow-on execution; lower urgency when isolated, but do not close if local path or DLL identity remains unresolved.
- Escalate when load path, loader identity, protocol or parentage, DLL signer/hash/recency, or related-alert evidence supports attacker-controlled DLL loading from INetCache, a device path, or UNC path; close only when the same evidence binds to one authorized validation, sandbox, or controlled-share workflow with no contradictory artifacts; preserve artifacts and escalate if evidence is mixed or incomplete.
### False positive analysis
- Authorized vulnerability validation or sandbox detonation can reproduce this load pattern. Confirm scope with outside records when available, and require telemetry alignment on `host.id`, `user.id`, `process.executable`, `process.command_line`, `dll.path`, `dll.hash.sha256`, and `dll.code_signature.subject_name`. If not a known test, default to suspicious.
- Controlled software distribution or application virtualization can serve WPS components from a managed share. Confirm `dll.path` stays on that exact share, `dll.hash.sha256` and `dll.code_signature.subject_name` match the expected Kingsoft component, and parentage lacks document-driven protocol or plugin-path arguments. Without inventories, use recurrence only to validate the same stable share, hash, signer, `process.executable`, `host.id`, and `user.id` workflow before exceptioning.
- Build exceptions only from the minimum confirmed workflow: stable `process.executable`, `process.code_signature.subject_name`, `dll.path`, `dll.hash.sha256`, `dll.code_signature.subject_name`, and bounded `host.id` or `user.id` scope. Avoid exceptions on `process.name` alone for "promecefpluginhost.exe", "Temp\\wps\\INetCache", or UNC prefixes.
### Response and remediation
- If confirmed benign, record the exact workflow evidence first: loader identity, `process.command_line`, DLL path/hash/signer, and bounded `host.id` or `user.id` scope. Then reverse temporary containment and create an exception only for that bounded workflow.
- If suspicious but unconfirmed, preserve the alert, host/user scope, `process.entity_id`, parent lineage, `dll.path`, `dll.hash.sha256`, and DLL signer/recency evidence before containment. Use reversible actions first, such as restricting a non-business remote share named in `dll.path`, quarantining a recovered lure document, or temporarily restricting WPS on the affected host; isolate only when follow-on execution or repeated malicious loads justify the interruption.
- If confirmed malicious, isolate the host through endpoint response after evidence preservation, then terminate the WPS loader chain if it is still active and block confirmed malicious `dll.hash.sha256` values and remote shares from `dll.path`. If endpoint response is unavailable, hand off the preserved process, DLL, host, and user identifiers to the team that can contain the system or share.
- Eradicate only artifacts tied to the investigation: remove the malicious DLL, recovered lure document, and staged WPS abuse files after scope review for the same `dll.hash.sha256`, `dll.path`, WPS parentage, `host.id`, and `user.id`. Upgrade WPS Office to a vendor-supported release that remediates both CVE-2024-7262 and CVE-2024-7263.
- Post-incident hardening: restrict WPS Office library loads from user-writable and UNC paths where feasible, retain process and library-load telemetry, and document any adjacent variant observed during triage, such as alternate WPS protocol arguments or related "promecefpluginhost.exe" load paths.
"""
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 7 - Image Loaded](https://ela.st/sysmon-event-7-setup)
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"host.name",
"host.id",
"user.id",
"process.executable",
"process.command_line",
"process.entity_id",
"process.code_signature.subject_name",
"process.code_signature.trusted",
"process.parent.executable",
"process.parent.command_line",
"dll.path",
"dll.hash.sha256",
"dll.code_signature.subject_name",
"dll.code_signature.trusted",
]
[transform]
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events for the WPS loader"
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.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Child process events from the WPS loader"
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"
[[transform.investigate]]
label = "File events for the loaded DLL path"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "file.path", queryType = "phrase", value = "{{dll.path}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1129"
name = "Shared Modules"
reference = "https://attack.mitre.org/techniques/T1129/"
[[rule.threat.technique]]
id = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1189"
name = "Drive-by Compromise"
reference = "https://attack.mitre.org/techniques/T1189/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[rule.threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: any
any where host.os.type == "windows" and process.name : "promecefpluginhost.exe" and
(
(event.category == "library" and
?dll.path :
("?:\\Users\\*\\AppData\\Local\\Temp\\wps\\INetCache\\*",
"\\Device\\Mup\\**", "\\\\*")) or
((event.category == "process" and event.action : "Image loaded*") and
?file.path :
("?:\\Users\\*\\AppData\\Local\\Temp\\wps\\INetCache\\*",
"\\Device\\Mup\\**", "\\\\*"))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"Image loaded*" |
event.category | eq |
| field:"event.category" kind:eq |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"promecefpluginhost.exe" |
WriteProcessMemory to Suspicious Memory Location
#Identifies attempt to write a suspicious memory location. This behavior is consistent with remote code injection attacks.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies attempt to write a suspicious memory location. This behavior is consistent with remote code injection
attacks.
"""
id = "1a1c26bb-7fe5-4683-9b94-bc1d89782873"
license = "Elastic License v2"
name = "WriteProcessMemory to Suspicious Memory Location"
os_list = ["windows"]
version = "1.0.9"
query = '''
api where process.Ext.api.name == "WriteProcessMemory" and process.Ext.api.behaviors == "cross-process" and
process.Ext.api.metadata.target_address_name == "ProcessStartupInfo" and process.Ext.api.parameters.size >= 100000 and
process.thread.Ext.call_stack_final_user_module.name like "?*" and
not process.thread.Ext.call_stack_final_user_module.name in ("Unknown", "Kernel", "Undetermined") and
/* WPM triggers multiple times at process creation */
not (_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*\\kernelbase.dll!CreateProcess*", "*\\kernelbase.dll+0x*"))
and process.Ext.api.summary like ("*PEB*", "*PEB32*", "*ProcessStartupInfo*")) and
not (process.Ext.api.summary like ("*PEB*", "*PEB32*", "*ProcessStartupInfo*") and process.thread.Ext.call_stack_summary like "*Unknown*") and
not process.thread.Ext.call_stack_final_user_module.path like
("?:\\program files\\*.dll",
"?:\\program files (x86)\\*.dll",
"\\program files\\*.dll",
"\\program files (x86)\\*.dll",
"?:\\windows\\system32\\*.dll",
"?:\\windows\\syswow64\\*.dll",
"\\windows\\system32\\*.dll",
"\\windows\\syswow64\\*.dll",
"?:\\windows\\fireeye\\appmonitordll*.dll*",
"?:\\windows\\apppatch\\appPatch*\\exploitblocker.dll*") and
not (process.name : "rundll32.exe" and process.parent.executable : "?:\\Program Files (x86)\\Astria Solutions Group\\Eclipse Client Service\\Astria.Client.Systray.exe") and
not (process.code_signature.subject_name in ("GIE Sesam Vitale", "Epicor Software Corporation") and process.code_signature.trusted == true) and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.callsite_trailing_bytes in
("85c0750732c0e9de0100008b45f88b80b43e00008945f08b45f88b80b43e00008b4df003413c8945f46a0468002000008b45f4ff70508b45f4ff70348b45f8ff",
"41c644240c01833d15c8005f007406ff1561e5ff5e8bf0e8b2df825e85f60f95c00fb6c00fb6c041c644240c01488b55884989542410488d65c85b5e5f415c41")) and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("2fec0c389dd0932c59eee19ca24c720b6521603e5ead78e3e070aa561b73be32",
"f41ca285f5069e68a6ba9128338fec93412efadcc5225a5c3261e0e07c3723fd",
"7c82d4fce5e9e41e5654362bcb6d0486ec39f0ff1f6df0e899d14b7c055009d6",
"ec363d03afa97033dc91cbf7c9a491fc693189f7a0a19bffc631bcb7dc715b47") and
not (process.thread.Ext.call_stack_final_user_module.protection_provenance in ("clr.dll", "mscorwks.dll", "coreclr.dll") and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name in ("Microsoft Corporation", "Microsoft Corporation", ".NET"))) and
not (process.name : "rundll32.exe" and process.command_line : "*--enable-speech-input*" and
process.thread.Ext.call_stack_final_user_module.protection_provenance_path like "c:\\windows\\microsoft.net\\framework*\\clr.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
$entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher",
"Microsoft Windows Software Compatibility Publisher",
"SentinelOne Inc.",
"Admin By Request ApS",
"Sophos Limited",
"Promon AS"))
'''
min_endpoint_version = "8.14.2"
[[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 = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.14.2"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "WriteProcessMemory" and process.Ext.api.behaviors == "cross-process" and
process.Ext.api.metadata.target_address_name == "ProcessStartupInfo" and process.Ext.api.parameters.size >= 100000 and
process.thread.Ext.call_stack_final_user_module.name like "?*" and
not process.thread.Ext.call_stack_final_user_module.name in ("Unknown", "Kernel", "Undetermined") and
not (_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*\\kernelbase.dll!CreateProcess*", "*\\kernelbase.dll+0x*"))
and process.Ext.api.summary like ("*PEB*", "*PEB32*", "*ProcessStartupInfo*")) and
not (process.Ext.api.summary like ("*PEB*", "*PEB32*", "*ProcessStartupInfo*") and process.thread.Ext.call_stack_summary like "*Unknown*") and
not process.thread.Ext.call_stack_final_user_module.path like
("?:\\program files\\*.dll",
"?:\\program files (x86)\\*.dll",
"\\program files\\*.dll",
"\\program files (x86)\\*.dll",
"?:\\windows\\system32\\*.dll",
"?:\\windows\\syswow64\\*.dll",
"\\windows\\system32\\*.dll",
"\\windows\\syswow64\\*.dll",
"?:\\windows\\fireeye\\appmonitordll*.dll*",
"?:\\windows\\apppatch\\appPatch*\\exploitblocker.dll*") and
not (process.name : "rundll32.exe" and process.parent.executable : "?:\\Program Files (x86)\\Astria Solutions Group\\Eclipse Client Service\\Astria.Client.Systray.exe") and
not (process.code_signature.subject_name in ("GIE Sesam Vitale", "Epicor Software Corporation") and process.code_signature.trusted == true) and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.callsite_trailing_bytes in
("85c0750732c0e9de0100008b45f88b80b43e00008945f08b45f88b80b43e00008b4df003413c8945f46a0468002000008b45f4ff70508b45f4ff70348b45f8ff",
"41c644240c01833d15c8005f007406ff1561e5ff5e8bf0e8b2df825e85f60f95c00fb6c00fb6c041c644240c01488b55884989542410488d65c85b5e5f415c41")) and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("2fec0c389dd0932c59eee19ca24c720b6521603e5ead78e3e070aa561b73be32",
"f41ca285f5069e68a6ba9128338fec93412efadcc5225a5c3261e0e07c3723fd",
"7c82d4fce5e9e41e5654362bcb6d0486ec39f0ff1f6df0e899d14b7c055009d6",
"ec363d03afa97033dc91cbf7c9a491fc693189f7a0a19bffc631bcb7dc715b47") and
not (process.thread.Ext.call_stack_final_user_module.protection_provenance in ("clr.dll", "mscorwks.dll", "coreclr.dll") and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name in ("Microsoft Corporation", "Microsoft Corporation", ".NET"))) and
not (process.name : "rundll32.exe" and process.command_line : "*--enable-speech-input*" and
process.thread.Ext.call_stack_final_user_module.protection_provenance_path like "c:\\windows\\microsoft.net\\framework*\\clr.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
$entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher",
"Microsoft Windows Software Compatibility Publisher",
"SentinelOne Inc.",
"Admin By Request ApS",
"Sophos Limited",
"Promon AS"))
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.