Detection rules › Elastic
Elastic rules: 3a
Alerts From Multiple Integrations by Source Address
#This rule uses alert data to determine when multiple alerts from different integrations with unique event categories and involving the same source.ip are triggered. Analysts can use this to prioritize triage and response, as these IP addresses are more likely to be related to a compromise.
Rule Body
[metadata]
creation_date = "2025/12/15"
maturity = "production"
updated_date = "2026/02/16"
[rule]
author = ["Elastic"]
description = """
This rule uses alert data to determine when multiple alerts from different integrations with unique event categories and
involving the same source.ip are triggered. Analysts can use this to prioritize triage and response, as these IP addresses
are more likely to be related to a compromise.
"""
from = "now-60m"
interval = "30m"
language = "esql"
license = "Elastic License v2"
name = "Alerts From Multiple Integrations by Source Address"
risk_score = 73
rule_id = "7d02c440-52a8-4854-ad3f-71af7fbb4fc6"
severity = "high"
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from .alerts-security.*
// any alerts excluding low severity and the noisy ones
| where kibana.alert.rule.name is not null and source.ip is not null and kibana.alert.risk_score > 21 and
not kibana.alert.rule.type in ("threat_match", "machine_learning") and
not KQL("""kibana.alert.rule.tags : "Rule Type: Higher-Order Rule" """)
// group alerts by source.ip and extract values of interest for alert triage
| stats Esql.event_module_distinct_count = COUNT_DISTINCT(event.module),
Esql.rule_name_distinct_count = COUNT_DISTINCT(kibana.alert.rule.name),
Esql.event_category_distinct_count = COUNT_DISTINCT(event.category),
Esql.rule_risk_score_distinct_count = COUNT_DISTINCT(kibana.alert.risk_score),
Esql.event_module_values = VALUES(event.module),
Esql.rule_name_values = VALUES(kibana.alert.rule.name),
Esql.message_values = VALUES(message),
Esql.event_category_values = VALUES(event.category),
Esql.event_action_values = VALUES(event.action),
Esql.destination_ip_values = VALUES(destination.ip),
Esql.host_id_values = VALUES(host.id),
Esql.agent_id_values = VALUES(agent.id),
Esql.user_name_values = VALUES(user.name),
Esql.rule_severity_values = VALUES(kibana.alert.risk_score) by source.ip
// filter for alerts from same source.ip reported by different integrations with unique categories and with different severity levels
| where Esql.event_module_distinct_count >= 2 and Esql.event_category_distinct_count >= 2 and (Esql.rule_risk_score_distinct_count >= 2 or Esql.rule_severity_values == 73 or Esql.rule_severity_values == 99)
| keep source.ip, Esql.*
'''
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 Alerts From Multiple Integrations by Source Address
The detection rule uses alert data to determine when multiple alerts from different integrations involving the same source.ip are triggered.
### Possible investigation steps
- Review the alert details to identify the specific host involved and the different modules and rules that triggered the alert.
- Examine the timeline of the alerts to understand the sequence of events and determine if there is a pattern or progression in the tactics used.
- Correlate the alert data with other logs and telemetry from the host, such as process creation, network connections, and file modifications, to gather additional context.
- Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary.
- Check for any indicators of compromise (IOCs) associated with the alerts, such as suspicious IP addresses, domains, or file hashes, and search for these across the network.
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
### False positive analysis
- Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance.
- Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise.
- Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening.
- Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score.
- User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities.
### Response and remediation
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
- Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved.
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
- Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks.
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
- Monitor the host and network for any signs of re-infection or further suspicious activity, using enhanced logging and alerting based on the identified attack patterns.
- Escalate the incident to the appropriate internal or external cybersecurity teams for further investigation and potential legal action if the attack is part of a larger campaign."""
Stages and Predicates
Stage 1: from
from .alerts-security.*
Stage 2: where
| where kibana.alert.rule.name is not null and source.ip is not null and kibana.alert.risk_score > 21 and
not kibana.alert.rule.type in ("threat_match", "machine_learning") and
not KQL("""kibana.alert.rule.tags : "Rule Type: Higher-Order Rule" """)
Stage 3: stats
| stats Esql.event_module_distinct_count = COUNT_DISTINCT(event.module),
Esql.rule_name_distinct_count = COUNT_DISTINCT(kibana.alert.rule.name),
Esql.event_category_distinct_count = COUNT_DISTINCT(event.category),
Esql.rule_risk_score_distinct_count = COUNT_DISTINCT(kibana.alert.risk_score),
Esql.event_module_values = VALUES(event.module),
Esql.rule_name_values = VALUES(kibana.alert.rule.name),
Esql.message_values = VALUES(message),
Esql.event_category_values = VALUES(event.category),
Esql.event_action_values = VALUES(event.action),
Esql.destination_ip_values = VALUES(destination.ip),
Esql.host_id_values = VALUES(host.id),
Esql.agent_id_values = VALUES(agent.id),
Esql.user_name_values = VALUES(user.name),
Esql.rule_severity_values = VALUES(kibana.alert.risk_score) by source.ip
Stage 4: where
| where Esql.event_module_distinct_count >= 2 and Esql.event_category_distinct_count >= 2 and (Esql.rule_risk_score_distinct_count >= 2 or Esql.rule_severity_values == 73 or Esql.rule_severity_values == 99)
Stage 5: keep
| keep source.ip, Esql.*
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
kibana.alert.rule.tags | eq | Rule Type: Higher-Order Rule | excludes:kibana.alert.rule.tags field:"kibana.alert.rule.tags" value:"Rule Type: Higher-Order Rule" |
kibana.alert.rule.type | in | machine_learning, threat_match | excludes:kibana.alert.rule.type field:"kibana.alert.rule.type" value:"machine_learning" field:"kibana.alert.rule.type" value:"threat_match" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
source.ip | KEEP source.ip |
Esql.* | KEEP Esql.* |
Archive File with Unusual Extension
#Identifies the creation of an archive file with an unusual extension. Attackers may attempt to evade detection by masquerading files using the file extension values used by image, audio, or document file types.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2023/09/25"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/05/21"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies the creation of an archive file with an unusual extension. Attackers may attempt to evade detection by
masquerading files using the file extension values used by image, audio, or document file types.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Archive File with Unusual Extension"
risk_score = 21
rule_id = "cffbaf47-9391-4e09-a83c-1f27d7474826"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "windows" and event.action != "deletion" and
/* common archive file headers - Rar, 7z, GZIP, MSCF, XZ, ZIP */
file.Ext.header_bytes : ("52617221*", "377ABCAF271C*", "1F8B*", "4d534346*", "FD377A585A00*", "504B0304*", "504B0708*") and
(
/* common image file extensions */
file.extension : ("jpg", "jpeg", "emf", "tiff", "gif", "png", "bmp", "ico", "fpx", "eps", "inf") or
/* common audio and video file extensions */
file.extension : ("mp3", "wav", "avi", "mpeg", "flv", "wma", "wmv", "mov", "mp4", "3gp") or
/* common document file extensions */
(file.extension : ("doc", "docx", "rtf", "ppt", "pptx", "xls", "xlsx") and
/* exclude ZIP file header values for OPENXML documents */
not file.Ext.header_bytes : ("504B0304*", "504B0708*"))
) and
not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and file.path : "?:\\inetpub\\temp\\IIS Temporary Compressed Files\\*")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.008"
name = "Masquerade File Type"
reference = "https://attack.mitre.org/techniques/T1036/008/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: file
file where host.os.type == "windows" and event.action != "deletion" and
file.Ext.header_bytes : ("52617221*", "377ABCAF271C*", "1F8B*", "4d534346*", "FD377A585A00*", "504B0304*", "504B0708*") and
(
file.extension : ("jpg", "jpeg", "emf", "tiff", "gif", "png", "bmp", "ico", "fpx", "eps", "inf") or
file.extension : ("mp3", "wav", "avi", "mpeg", "flv", "wma", "wmv", "mov", "mp4", "3gp") or
(file.extension : ("doc", "docx", "rtf", "ppt", "pptx", "xls", "xlsx") and
not file.Ext.header_bytes : ("504B0304*", "504B0708*"))
) and
not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and file.path : "?:\\inetpub\\temp\\IIS Temporary Compressed Files\\*")
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 | wildcard |
| field:"file.extension" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | starts_with | ?:\inetpub\temp\IIS Temporary Compressed Files\ | excludes:file.path field:"file.path" value:"?:\inetpub\temp\IIS Temporary Compressed Files\" |
process.executable | eq | ?:\Windows\System32\inetsrv\w3wp.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\inetsrv\w3wp.exe" |
AWS EC2 Multi-Region DescribeInstances API Calls
#Identifies when a single AWS resource is making DescribeInstances API calls in more than 10 regions within a 30-second window. This could indicate a potential threat actor attempting to discover the AWS infrastructure across multiple regions using compromised credentials or a compromised instance. Adversaries may use this information to identify potential targets for further exploitation or to gain a better understanding of the target's infrastructure.
Known False Positives
- Legitimate use of the `DescribeInstances` API call by an AWS resource that requires information about instances in multiple regions.
- Scheduled tasks or scripts that require information about instances in multiple regions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2024/08/26"
integration = ["aws"]
maturity = "production"
updated_date = "2025/12/04"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies when a single AWS resource is making `DescribeInstances` API calls in more than 10 regions within a 30-second
window. This could indicate a potential threat actor attempting to discover the AWS infrastructure across multiple
regions using compromised credentials or a compromised instance. Adversaries may use this information to identify
potential targets for further exploitation or to gain a better understanding of the target's infrastructure.
"""
false_positives = [
"""
Legitimate use of the `DescribeInstances` API call by an AWS resource that requires information about instances in
multiple regions.
""",
"Scheduled tasks or scripts that require information about instances in multiple regions.",
]
from = "now-6m"
language = "esql"
license = "Elastic License v2"
name = "AWS EC2 Multi-Region DescribeInstances API Calls"
note = """## Triage and analysis
### Investigating AWS EC2 Multi-Region DescribeInstances API Calls
This rule flags when the `DescribeInstances` API is executed across multiple AWS regions within a short timeframe. While benign in some cases (e.g., asset inventory, legitimate multi-region management), this pattern can indicate a reconnaissance phase in which an adversary enumerates EC2 instances in all regions to identify potential targets across the environment.
Because the signal can generate significant noise in dynamic or large AWS environments, this rule should be treated as a Building Block Rule (BBR), not a stand-alone alert requiring immediate incident response. Instead, it is best used for hunting, enrichment, correlation, and escalation when combined with other signals.
### How to use this rule (hunting & correlation guide)
This rule is most effective when paired with other detection rules or data sources. Use it to answer questions such as:
- Did a newly created or unknown principal call `DescribeInstances` across many regions? Pair this with a new terms or first-time principal rule (e.g., `GetCallerIdentity`, `AssumeRole`, or `aws.cloudtrail.user_identity.session_context.session_issuer.arn`).
- Was the same principal also observed making other discovery or enumeration calls (e.g., `DescribeSnapshots`, `DescribeVolumes`, `DescribeImages`, `DescribeSecurityGroups`) in a short timeframe?
- Did the multi-region calls precede or coincide with higher-risk actions such as:
- Snapshot creation or shared snapshot modifications (`CreateSnapshot`, `ModifySnapshotAttribute`)
- AMI export/copy operations (`ExportImage`, `CopyImage`)
- Access key creation, role assumption, or IAM permission changes
- Unexpected S3 bucket or data transfer activity (e.g., large data egress, new S3 bucket writes)
- Did the activity span regions normally unused or outside the organization's typical operational footprint?
#### Possible investigation steps:
- **Review the principal and session trace**:
- Identify `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.access_key_id`, and determine whether the principal is known, recently onboarded, or unusual (e.g., a service role used in rare cases).
- Examine `user_agent.original` and `source.ip` for anomalies (e.g., new CLI/SDK versions, IAM roles from unexpected hosts, geolocation outside expected range).
- **Evaluate region distribution and timing**:
- Inspect the regions contacted by `DescribeInstances` within the alert window. Are some regions rarely used in your org?
- Look at the timeline: did the calls occur in rapid succession or spread out? A burst suggests automated reconnaissance rather than manual usage.
- **Correlate with other detection signals & data access patterns**:
- Query for other CloudTrail events by the same principal in the ±30 minutes window: enumeration APIs (`Describe*`), snapshot/AMI events, `CopySnapshot`, `ExportImage`, `StartInstances`, etc.
- Cross-validate with SIEM or data egress logs: did large volumes of data leave the environment after the enumeration?
- Review IAM activity for privilege elevation, new access keys, or role chaining that could support the enumeration action.
- **Assess intent and operational context**:
- Determine whether the enumeration aligns with known asset-inventory or management tasks (Recurring scans, DevOps automation, IT health checks).
- If this principal is known for asset management, verify the timing, region list, and audit logs for existing tickets/change-records.
- If the activity is unexpected, low legitimacy, or tied to other suspicious events, escalate.
### False positive analysis:
Because many organizations have legitimate multi-region cloud operations, this rule may generate false positives. Common benign scenarios include:
- DevOps or cloud-ops automation that inventories EC2 instances across all regions (for cost, compliance, or multi-region deployment verification).
- Large-scale migrations or disaster-recovery tests that touch many regions in a short time.
- Security or audit team enumeration of the environment (e.g., internal red-team, internal asset scanning).
- Cross-account management tools in AWS Organizations that routinely query multiple regions.
To manage these, consider:
- Whitelisting known automation roles/principals (with caution).
- Tagging and excluding known “inventory scan” sessions (based on user agent, IP range, timing).
- Using this rule only as a correlation trigger and not as a direct alert.
### Response and escalation:
Because this rule is a BBR, its detection alone does not usually warrant full incident response. Instead:
- **Document the finding** in your hunt log, noting principal, regions, timestamp, and correlation flags (other events).
- If correlation reveals additional suspicious activity (e.g., snapshot share, data export, IAM privilege change) escalate to full incident response.
- If the enumeration is determined benign (e.g., approved internal scan), add context (ticket number, owner, justification) and suppress/annotate this principal in future hunts for a defined interval.
- Update your detection playbooks to reflect this rule’s role as a recon-indicator, and train analysts to use it as a pivot point.
### Additional information
For further information on AWS `DescribeInstances` permissions and best practices, refer to the [AWS DescribeInstances API documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html).
"""
references = [
"https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html",
]
risk_score = 21
rule_id = "393ef120-63d1-11ef-8e38-f661ea17fbce"
severity = "low"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: AWS EC2",
"Resources: Investigation Guide",
"Rule Type: BBR",
"Use Case: Threat Detection",
"Tactic: Discovery",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-aws.cloudtrail-* metadata _id, _version, _index
// filter for DescribeInstances API calls
| where event.dataset == "aws.cloudtrail"
and event.provider == "ec2.amazonaws.com"
and event.action == "DescribeInstances"
// truncate the timestamp to a 30-second window
| eval Esql.time_window_date_trunc = date_trunc(30 seconds, @timestamp)
// keep only the relevant raw fields
| keep
Esql.time_window_date_trunc,
aws.cloudtrail.user_identity.arn,
cloud.region,
cloud.account.id,
aws.cloudtrail.user_identity.access_key_id,
aws.cloudtrail.user_identity.type,
user_agent.original,
source.as.organization.name,
source.ip,
@timestamp,
data_stream.namespace
// count the number of unique regions and total API calls within the 30-second window
| stats
Esql.cloud_region_count_distinct = count_distinct(cloud.region),
Esql.event_count = count(*),
Esql.event_timestamp_values = VALUES(@timestamp),
Esql.aws_cloudtrail_user_identity_type_values = VALUES(aws.cloudtrail.user_identity.type),
Esql.aws_cloudtrail_user_identity_access_key_id_values = VALUES(aws.cloudtrail.user_identity.access_key_id),
Esql.source_ip_values = VALUES(source.ip),
Esql.user_agent_original_values = VALUES(user_agent.original),
Esql.source_as_organization_name_values = VALUES(source.as.organization.name),
Esql.cloud_account_id_values = VALUES(cloud.account.id),
Esql.cloud_region_values = VALUES(cloud.region),
Esql.data_stream_namespace_values = VALUES(data_stream.namespace)
by Esql.time_window_date_trunc, aws.cloudtrail.user_identity.arn
// filter for resources making DescribeInstances API calls in more than 10 regions within the 30-second window
| where Esql.cloud_region_count_distinct >= 10 and Esql.event_count >= 10
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1580"
name = "Cloud Infrastructure Discovery"
reference = "https://attack.mitre.org/techniques/T1580/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[rule.investigation_fields]
field_names = [
"Esql.cloud_region_count_distinct",
"Esql.event_count",
"Esql.event_timestamp_values",
"aws.cloudtrail.user_identity.arn",
"Esql.aws_cloudtrail_user_identity_type_values",
"Esql.aws_cloudtrail_user_identity_access_key_id_values",
"Esql.source_ip_values",
"Esql.user_agent_original_values",
"Esql.source_as_organization_name_values",
"Esql.cloud_account_id_values",
"Esql.cloud_region_values",
"Esql.data_stream_namespace_values"
]
Stages and Predicates
Stage 1: from
from logs-aws.cloudtrail-* metadata _id, _version, _index
Stage 2: where
| where event.dataset == "aws.cloudtrail"
and event.provider == "ec2.amazonaws.com"
and event.action == "DescribeInstances"
Stage 3: eval
| eval Esql.time_window_date_trunc = date_trunc(30 seconds, @timestamp)
Stage 4: keep
| keep
Esql.time_window_date_trunc,
aws.cloudtrail.user_identity.arn,
cloud.region,
cloud.account.id,
aws.cloudtrail.user_identity.access_key_id,
aws.cloudtrail.user_identity.type,
user_agent.original,
source.as.organization.name,
source.ip,
@timestamp,
data_stream.namespace
Stage 5: stats
| stats
Esql.cloud_region_count_distinct = count_distinct(cloud.region),
Esql.event_count = count(*),
Esql.event_timestamp_values = VALUES(@timestamp),
Esql.aws_cloudtrail_user_identity_type_values = VALUES(aws.cloudtrail.user_identity.type),
Esql.aws_cloudtrail_user_identity_access_key_id_values = VALUES(aws.cloudtrail.user_identity.access_key_id),
Esql.source_ip_values = VALUES(source.ip),
Esql.user_agent_original_values = VALUES(user_agent.original),
Esql.source_as_organization_name_values = VALUES(source.as.organization.name),
Esql.cloud_account_id_values = VALUES(cloud.account.id),
Esql.cloud_region_values = VALUES(cloud.region),
Esql.data_stream_namespace_values = VALUES(data_stream.namespace)
by Esql.time_window_date_trunc, aws.cloudtrail.user_identity.arn
Stage 6: where
| where Esql.cloud_region_count_distinct >= 10 and Esql.event_count >= 10
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.cloud_region_count_distinct | ge |
| field:"Esql.cloud_region_count_distinct" kind:ge value:"10" |
Esql.event_count | ge |
| field:"Esql.event_count" kind:ge value:"10" |
event.action | eq |
| field:"EventType" kind:eq value:"DescribeInstances" |
event.dataset | eq |
| field:"event.dataset" kind:eq value:"aws.cloudtrail" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"ec2.amazonaws.com" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Esql.cloud_region_count_distinct | STATS Esql.cloud_region_count_distinct = count_distinct(cloud.region) |
Esql.event_count | STATS Esql.event_count = count(*) |
Esql.event_timestamp_values | STATS Esql.event_timestamp_values = VALUES(@timestamp) |
Esql.aws_cloudtrail_user_identity_type_values | STATS Esql.aws_cloudtrail_user_identity_type_values = VALUES(aws.cloudtrail.user_identity.type) |
Esql.aws_cloudtrail_user_identity_access_key_id_values | STATS Esql.aws_cloudtrail_user_identity_access_key_id_values = VALUES(aws.cloudtrail.user_identity.access_key_id) |
Esql.source_ip_values | STATS Esql.source_ip_values = VALUES(source.ip) |
Esql.user_agent_original_values | STATS Esql.user_agent_original_values = VALUES(user_agent.original) |
Esql.source_as_organization_name_values | STATS Esql.source_as_organization_name_values = VALUES(source.as.organization.name) |
Esql.cloud_account_id_values | STATS Esql.cloud_account_id_values = VALUES(cloud.account.id) |
Esql.cloud_region_values | STATS Esql.cloud_region_values = VALUES(cloud.region) |
Esql.data_stream_namespace_values | STATS Esql.data_stream_namespace_values = VALUES(data_stream.namespace) |
Esql.time_window_date_trunc | STATS BY |
aws.cloudtrail.user_identity.arn | STATS BY |
AWS RDS DB Instance Restored
#Identifies the restoration of an AWS RDS database instance from a snapshot or S3 backup. Adversaries with access to valid credentials may restore copies of existing databases to bypass logging and monitoring controls or to exfiltrate sensitive data from a duplicated environment. This rule detects successful restoration operations using "RestoreDBInstanceFromDBSnapshot" or "RestoreDBInstanceFromS3", which may indicate unauthorized data access or post-compromise defense evasion.
Known False Positives
- Restoring an RDS DB instance may be performed legitimately during troubleshooting, development refresh processes, migrations, or disaster-recovery drills. Validate the user identity, source IP, automation context, and whether the restoration aligns with a known maintenance or testing workflow before treating the event as suspicious. Expected behavior can be exempted through rule exceptions.
MITRE ATT&CK Coverage
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS Public RDS Restore (Panther)
- Restore Public AWS RDS Instance (Sigma)
Rule Body
[metadata]
creation_date = "2021/06/29"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Austin Songer", "Elastic"]
description = """
Identifies the restoration of an AWS RDS database instance from a snapshot or S3 backup. Adversaries with access to
valid credentials may restore copies of existing databases to bypass logging and monitoring controls or to exfiltrate
sensitive data from a duplicated environment. This rule detects successful restoration operations using
"RestoreDBInstanceFromDBSnapshot" or "RestoreDBInstanceFromS3", which may indicate unauthorized data access or
post-compromise defense evasion.
"""
false_positives = [
"""
Restoring an RDS DB instance may be performed legitimately during troubleshooting, development refresh processes,
migrations, or disaster-recovery drills. Validate the user identity, source IP, automation context, and whether the
restoration aligns with a known maintenance or testing workflow before treating the event as suspicious. Expected
behavior can be exempted through rule exceptions.
""",
]
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS RDS DB Instance Restored"
note = """## Triage and analysis
### Investigating AWS RDS DB Instance Restored
Restoring an RDS DB instance from a snapshot or from S3 is a powerful operation that recreates a full database environment. While legitimate for recovery, migrations, or cloning, adversaries may use restore actions to access historical data, duplicate sensitive environments, evade guardrails, or prepare for data exfiltration.
This rule detects successful invocation of `RestoreDBInstanceFromDBSnapshot` and `RestoreDBInstanceFromS3`, both of which may indicate attempts to rehydrate old datasets, bypass deletion protection, or establish a shadow environment for further malicious actions.
#### Possible investigation steps
- **Identify the actor and execution context**
- Review `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.type`, and `aws.cloudtrail.user_identity.access_key_id`.
- Check `user.name`, `source.ip`, and `user_agent.original` to determine how the restore was executed (console, CLI, automation, SDK).
- **Understand what was restored and why**
- Inspect `aws.cloudtrail.request_parameters` to identify:
- Snapshot identifier or S3 location used as the restore source.
- The new DB instance identifier and configuration parameters.
- Determine:
- Whether the snapshot/backup used for the restore contains sensitive or high-value data.
- Whether this restore created a publicly accessible instance, changed security groups, or used unusual storage/instance classes.
- **Reconstruct the activity flow**
- Use `@timestamp` to correlate the restore event with:
- Snapshot creation, copy, or export events.
- IAM policy changes or privilege escalations.
- Deletion or modification of the original database.
- Other RDS lifecycle actions such as `ModifyDBInstance`, `DeleteDBInstance`, or backup configuration changes.
- Look for signs of attacker staging:
- Prior enumeration activity (`DescribeDBSnapshots`, `DescribeDBInstances`).
- Recent logins from unusual IPs or federated sessions without MFA.
- **Correlate with broader behavior**
- Pivot in CloudTrail on:
- The same snapshot identifier.
- The same actor or access key ID.
- The newly created DB instance identifier.
- Examine:
- Whether the restored DB was modified immediately after (e.g., security groups opened, deletion protection disabled).
- Whether there were large-volume read operations or export actions following the restore.
- Whether the restore is part of a pattern of parallel suspicious activity (snapshot copying, S3 backups, cross-account actions).
- **Validate intent with owners**
- Confirm with the application/database/platform teams:
- Whether the restore was requested or part of an authorized operational workflow.
- Whether this restore corresponds to migration, testing, DR drill, or another planned activity.
- Whether the restored environment should exist (and for how long).
### False positive analysis
- **Legitimate maintenance and DR workflows**
- Many teams restore databases for patch testing, DR validation, schema testing, or migration.
- **Automated restore workflows**
- CI/CD pipelines or internal automation may restore DBs to generate staging or dev environments.
- **Third-party tooling**
- Backup/DR solutions, migration tools, or observability platforms may restore DB instances for operational reasons. Tune based on `user_agent.original` or known service roles.
### Response and remediation
- **Contain the restored environment**
- If unauthorized:
- Apply restrictive security groups to block access.
- Disable public accessibility if enabled.
- Evaluate whether deletion protection or backup retention is misconfigured.
- **Assess data exposure and intent**
- Work with data owners to evaluate:
- The sensitivity of the restored environment.
- Whether any reads, dumps, or exports occurred post-restore.
- Whether the restore enabled the attacker to access older or deleted data.
- **Investigate scope and related activity**
- Review CloudTrail for:
- Additional restores, exports, or copies.
- IAM changes allowing expanded privileges.
- Unusual authentication events or federated sessions without MFA.
- Related destructive actions (snapshot deletion, backup disabled, instance deletion).
- **Hardening and preventive controls**
- Enforce least privilege for `rds:RestoreDBInstanceFromDBSnapshot` and `rds:RestoreDBInstanceFromS3`.
- Use IAM conditions to restrict restore actions by network, principal, or region.
- Add AWS Config and Security Hub controls for monitoring:
- Unapproved restores.
- Public or misconfigured restored instances.
- Consider SCPs that prevent RDS restores in production accounts except through controlled roles.
- **Post-incident improvements**
- Rotate credentials for affected IAM users/roles.
- Update change management processes to ensure restore actions are tracked and approved.
- Adjust rule exceptions sparingly and ensure high-risk restores continue to generate alerts.
### Additional information
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromDBSnapshot.html",
"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromS3.html",
"https://github.com/RhinoSecurityLabs/pacu/blob/master/pacu/modules/rds__explore_snapshots/main.py",
"https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-post-exploitation/aws-rds-post-exploitation#rds-createdbsnapshot-rds-restoredbinstancefromdbsnapshot-rds-modifydbinstance",
]
risk_score = 47
rule_id = "bf1073bf-ce26-4607-b405-ba1ed8e9e204"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS RDS",
"Use Case: Asset Visibility",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: "aws.cloudtrail"
and event.provider: "rds.amazonaws.com"
and event.action: ("RestoreDBInstanceFromDBSnapshot" or "RestoreDBInstanceFromS3")
and event.outcome: "success"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1578"
name = "Modify Cloud Compute Infrastructure"
reference = "https://attack.mitre.org/techniques/T1578/"
[[rule.threat.technique.subtechnique]]
id = "T1578.002"
name = "Create Cloud Instance"
reference = "https://attack.mitre.org/techniques/T1578/002/"
[[rule.threat.technique.subtechnique]]
id = "T1578.004"
name = "Revert Cloud Instance"
reference = "https://attack.mitre.org/techniques/T1578/004/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[[rule.threat.technique.subtechnique]]
id = "T1074.002"
name = "Remote Data Staging"
reference = "https://attack.mitre.org/techniques/T1074/002/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
"aws.cloudtrail.response_elements",
]
Stages and Predicates
Stage 1: query
data_stream.dataset: "aws.cloudtrail"
and event.provider: "rds.amazonaws.com"
and event.action: ("RestoreDBInstanceFromDBSnapshot" or "RestoreDBInstanceFromS3")
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:"aws.cloudtrail" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"rds.amazonaws.com" |
AWS S3 Unauthenticated Bucket Access by Rare Source
#Identifies AWS CloudTrail events where an unauthenticated source is attempting to access an S3 bucket. This activity may indicate a misconfigured S3 bucket policy that allows public access to the bucket, potentially exposing sensitive data to unauthorized users. Adversaries can specify --no-sign-request in the AWS CLI to retrieve objects from an S3 bucket without authentication. This is a New Terms rule, which means it will trigger for each unique combination of the source.address and targeted bucket name that has not been seen making this API request.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery | |
| Collection | |
| Impact |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS S3 Credential File Retrieved from Bucket (Elastic)
- AWS S3 Delete Object Detection (Panther)
- AWS S3 Large Download (Panther)
- AWS S3 Large Download (Panther)
- AWS S3 Static Site JavaScript File Uploaded (Elastic)
- Excessive AWS S3 Object Encryption with SSE-C (Elastic)
- Potential AWS S3 Bucket Ransomware Note Uploaded (Elastic)
- Unusual AWS S3 Object Encryption with SSE-C (Elastic)
Rule Body
[metadata]
creation_date = "2024/12/17"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies AWS CloudTrail events where an unauthenticated source is attempting to access an S3 bucket. This activity may
indicate a misconfigured S3 bucket policy that allows public access to the bucket, potentially exposing sensitive data
to unauthorized users. Adversaries can specify --no-sign-request in the AWS CLI to retrieve objects from an S3 bucket
without authentication. This is a New Terms rule, which means it will trigger for each unique combination of the source.address and targeted bucket name that has not been seen making this API request.
"""
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS S3 Unauthenticated Bucket Access by Rare Source"
note = """## Triage and analysis
### Investigating AWS S3 Unauthenticated Bucket Access by Rare Source
This rule detects requests to an AWS S3 bucket by an unauthenticated source, which could indicate a misconfigured bucket policy allowing public access. Adversaries can exploit this misconfiguration by using tools or AWS CLI options like `--no-sign-request` to access bucket contents.
The rule triggers when an unauthenticated IP address retrieves an object, and that IP has not been seen in the last 7 days.
### Possible Investigation Steps
**Identify the Source of the Request**:
- Review the `source.address` field to determine the IP address of the request source.
- Check `source.geo` fields for geographic details of the originating IP address.
- Analyze the `user_agent.original` field to identify the client or tool used (e.g., `Python Requests`, `aws-cli`, browser).
**Review the Accessed Bucket and Object**:
- Analyze the `aws.cloudtrail.resources.arn` field to identify the S3 bucket and object being accessed.
- Inspect `aws.cloudtrail.request_parameters` for bucket name and object key to determine which file was retrieved.
- Review the `even.action` field to identify which API call was made (e.g., `GetObject`, `ListObjects`, `PutObject`, `ListBucket`).
**Validate the Source IP and Context**:
- Determine if the IP address (`source.address`) has any prior activity in your environment.
- Correlate the IP with threat intelligence or blocklist databases to check for malicious indicators.
- Review CloudTrail logs for other activities originating from the same IP.
**Analyze the S3 Bucket Configuration**:
- Review the S3 bucket's Access Control List (ACL) and bucket policy to check for misconfigurations allowing public or unauthenticated access.
- Look for overly permissive settings, such as `Principal: *` or `Effect: Allow` rules that expose the bucket.
**Investigate Additional Activity**:
- Check if there are subsequent actions, such as:
- **Additional `GetObject` API calls**: Indicating further data exfiltration.
- **ListObjects requests**: Attempting to enumerate the bucket's contents.
- Correlate events within the same timeframe to identify related suspicious activity.
**Assess the Data Exposed**:
- Identify the retrieved object(s) and analyze their content to assess potential data exposure.
- Determine if the file contains sensitive information, such as credentials, intellectual property, or PII.
### False Positive Analysis
- **Public Buckets by Design**: Some S3 buckets may intentionally allow public access. Verify with the bucket owner if the access was expected.
- **Automated Tools**: Security scanners or legitimate services may generate `GetObject` events to validate bucket configurations.
### Response and Remediation
**Immediate Action**:
- Restrict or remove public access to the affected S3 bucket.
- Update the bucket policy to ensure access is restricted to trusted principals.
- Enable **S3 Block Public Access** settings to prevent unintended public access.
**Monitoring and Detection**:
- Enable detailed logging and monitoring for all S3 bucket activities.
- Configure real-time alerts for unauthenticated `GetObject` or `ListObjects` events on sensitive S3 buckets.
**Security Audits**:
- Regularly audit S3 bucket policies and ACLs to ensure they adhere to AWS security best practices.
- Use AWS tools like **Trusted Advisor** or **Access Analyzer** to identify and address misconfigurations.
**Investigate for Data Exfiltration**:
- Analyze historical CloudTrail logs to determine if other sensitive files were accessed or exfiltrated.
- Assess the scope of the exposure and initiate further response if sensitive data was compromised.
### Additional Resources
- [AWS Documentation: S3 Bucket Policy Best Practices](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html)
- [AWS S3 Block Public Access](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html)
"""
references = [
"https://hackingthe.cloud/aws/exploitation/Misconfigured_Resource-Based_Policies/exploting_public_resources_attack_playbook/",
]
risk_score = 47
rule_id = "59bf26c2-bcbe-11ef-a215-f661ea17fbce"
setup = "S3 data events must be enabled in CloudTrail to capture the GetObject, PutObject, ListObjects, and DeleteObject actions. Ensure that the AWS CloudTrail service is configured to log data events for the S3 bucket you'd like to monitor."
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: Amazon S3",
"Use Case: Asset Visibility",
"Resources: Investigation Guide",
"Tactic: Collection",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset: "aws.cloudtrail"
and event.provider: "s3.amazonaws.com"
and event.action: (
"GetObject" or
"PutObject" or
"ListObjects" or
"DeleteObject" or
"ListBucket")
and event.outcome: "success"
and aws.cloudtrail.user_identity.type: ("AWSAccount" or "Unknown")
and cloud.account.id: "anonymous"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1619"
name = "Cloud Storage Object Discovery"
reference = "https://attack.mitre.org/techniques/T1619/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1485"
name = "Data Destruction"
reference = "https://attack.mitre.org/techniques/T1485/"
[[rule.threat.technique]]
id = "T1565"
name = "Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/"
[[rule.threat.technique.subtechnique]]
id = "T1565.001"
name = "Stored Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/001/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user_agent.original",
"source.ip",
"tls.client.server_name",
"aws.cloudtrail.resources.arn",
"aws.cloudtrail.resources.type",
"aws.cloudtrail.resources.account_id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]
[rule.new_terms]
field = "new_terms_fields"
value = ["source.address", "tls.client.server_name"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset: "aws.cloudtrail"
and event.provider: "s3.amazonaws.com"
and event.action: (
"GetObject" or
"PutObject" or
"ListObjects" or
"DeleteObject" or
"ListBucket")
and event.outcome: "success"
and aws.cloudtrail.user_identity.type: ("AWSAccount" or "Unknown")
and cloud.account.id: "anonymous"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.user_identity.type | in |
| field:"aws::userIdentity.type" kind:in |
cloud.account.id | eq |
| field:"aws::recipientAccountId" kind:eq value:"anonymous" |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"s3.amazonaws.com" |
Azure Run Command Script Child Process
#Identifies process start events whose parent matches Azure Virtual Machine Run Command execution patterns on Windows or Linux. On Windows, Run Command often launches PowerShell with -ExecutionPolicy Unrestricted and a script?.ps1 file; on Linux, the Azure Linux Agent (waagent) runs downloaded script.sh under "/var/lib/waagent/run-command/". Child process telemetry exposes the on-guest payload that cloud activity logs do not fully describe.
Known False Positives
- Legitimate configuration management, extension deployment, or automation that uses Azure Run Command with the same PowerShell or shell script paths may match. Baseline approved VM names, script naming, and deployment windows before tuning.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2026/05/20"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/05/20"
[rule]
author = ["Elastic"]
description = """
Identifies process start events whose parent matches Azure Virtual Machine Run Command execution patterns on Windows
or Linux. On Windows, Run Command often launches PowerShell with `-ExecutionPolicy Unrestricted` and a `script?.ps1`
file; on Linux, the Azure Linux Agent (waagent) runs downloaded script.sh under "/var/lib/waagent/run-command/".
Child process telemetry exposes the on-guest payload that cloud activity logs do not fully describe.
"""
false_positives = [
"""
Legitimate configuration management, extension deployment, or automation that uses Azure Run Command with the same
PowerShell or shell script paths may match. Baseline approved VM names, script naming, and deployment windows
before tuning.
""",
]
from = "now-9m"
index = [
"logs-endpoint.events.process*",
"logs-windows.sysmon_operational-*"
]
language = "eql"
license = "Elastic License v2"
name = "Azure Run Command Script Child Process"
note = """## Triage and analysis
### Investigating Azure Run Command Script Child Process
Azure VM Run Command executes scripts on guests without interactive RDP or SSH. On Windows, a parent PowerShell
process with `-ExecutionPolicy Unrestricted -File script?.ps1` often precedes child utilities; on Linux, `waagent`
invokes `/var/lib/waagent/run-command/download/*/script.sh` via `bash`, `sh`, or `dash`.
Correlate with `logs-azure.activitylogs-*` for `MICROSOFT.COMPUTE/VIRTUALMACHINES/RUNCOMMAND/ACTION` when available.
### Possible investigation steps
- Review `process.command_line`, `process.name`, and `process.parent.command_line` or `process.parent.args`.
- Confirm whether the host is an Azure VM and whether Run Command was expected for that asset.
- Pivot on `host.name` or `host.id` for other suspicious process or network activity in the same window.
### False positive analysis
- Extension handlers, guest configuration, and patch orchestration may use the same parent patterns.
- Exclude known automation hosts or script paths after validating with platform teams.
### Response and remediation
- If unauthorized, review Azure RBAC on the VM and subscription, revoke compromised credentials, and isolate the guest.
- Collect endpoint artifacts and Azure activity logs for incident reporting.
"""
references = [
"https://docs.microsoft.com/en-us/azure/virtual-machines/run-command",
"https://hackingthe.cloud/azure/run-command-abuse/"
]
risk_score = 47
rule_id = "cb9554e8-9f31-41a8-b4f5-d82144e6dc33"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Endpoint",
"OS: Linux",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Azure",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type in ("start", "process_started") and
(
(process.parent.name == "powershell.exe" and
process.parent.command_line like "powershell -ExecutionPolicy Unrestricted -File script?.ps1") or
(process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox") and
process.parent.args like "/var/lib/waagent/run-command/download/*/script.sh")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique]]
id = "T1651"
name = "Cloud Administration Command"
reference = "https://attack.mitre.org/techniques/T1651/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: process
process where event.type in ("start", "process_started") and
(
(process.parent.name == "powershell.exe" and
process.parent.command_line like "powershell -ExecutionPolicy Unrestricted -File script?.ps1") or
(process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox") and
process.parent.args like "/var/lib/waagent/run-command/download/*/script.sh")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | in |
| field:"event.type" kind:in |
process.parent.args | wildcard |
| field:"process.parent.args" kind:wildcard value:"/var/lib/waagent/run-command/download/*/script.sh" |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"powershell -ExecutionPolicy Unrestricted -File script?.ps1" |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"powershell.exe" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
Discovery of Internet Capabilities via Built-in Tools
#Identifies the use of built-in tools attackers can use to check for Internet connectivity on compromised systems. These results may be used to determine communication capabilities with C2 servers, or to identify routes, redirectors, and proxy servers.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2023/07/12"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/02/19"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies the use of built-in tools attackers can use to check for Internet connectivity on compromised systems. These
results may be used to determine communication capabilities with C2 servers, or to identify routes, redirectors, and
proxy servers.
"""
from = "now-9m"
index = ["logs-endpoint.events.*"]
language = "kuery"
license = "Elastic License v2"
name = "Discovery of Internet Capabilities via Built-in Tools"
risk_score = 21
rule_id = "7f89afef-9fc5-4e7b-bf16-75ffdf27f8db"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Rule Type: BBR",
"Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
host.os.type:windows and event.category:process and event.type:start and
process.name.caseless:("ping.exe" or "tracert.exe" or "pathping.exe") and
not process.args:("127.0.0.1" or "0.0.0.0" or "localhost" or "::1" or 192.168.*) and
process.command_line:*.*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"
[[rule.threat.technique.subtechnique]]
id = "T1016.001"
name = "Internet Connection Discovery"
reference = "https://attack.mitre.org/techniques/T1016/001/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id", "user.id", "process.command_line"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
host.os.type:windows and event.category:process and event.type:start and
process.name.caseless:("ping.exe" or "tracert.exe" or "pathping.exe") and
not process.args:("127.0.0.1" or "0.0.0.0" or "localhost" or "::1" or 192.168.*) and
process.command_line:*.*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*.*" |
process.name.caseless | in |
| field:"process.name.caseless" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | 0.0.0.0 | excludes:process.args field:"process.args" value:"0.0.0.0" |
process.args | eq | 127.0.0.1 | excludes:process.args field:"process.args" value:"127.0.0.1" |
process.args | eq | ::1 | excludes:process.args field:"process.args" value:"::1" |
process.args | eq | localhost | excludes:process.args field:"process.args" value:"localhost" |
process.args | starts_with | 192.168. | excludes:process.args field:"process.args" value:"192.168." |
Egress Connection by a YUM Package Manager Descendant
#Detects suspicious network events executed by the Yum package manager, potentially indicating persistence through a Yum backdoor. In Linux, Yum (Yellowdog Updater, Modified) is a command-line utility used for handling packages on Fedora-based systems, providing functions for installing, updating, upgrading, and removing software along with managing package repositories. Attackers can backdoor Yum to gain persistence by injecting malicious code into plugins that Yum runs, thereby ensuring continued unauthorized access or control each time Yum is used for package management. For this persistence mechanism to work, plugins need to be enabled in the /etc/dnf/dnf.conf and plugin.conf files.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Stealth |
Rule Body
[rule]
description = """
Detects suspicious network events executed by the Yum package manager, potentially indicating persistence through a Yum
backdoor. In Linux, Yum (Yellowdog Updater, Modified) is a command-line utility used for handling packages on
Fedora-based systems, providing functions for installing, updating, upgrading, and removing software along with managing
package repositories. Attackers can backdoor Yum to gain persistence by injecting malicious code into plugins that Yum
runs, thereby ensuring continued unauthorized access or control each time Yum is used for package management. For this
persistence mechanism to work, plugins need to be enabled in the `/etc/dnf/dnf.conf` and plugin.conf files.
"""
id = "74afd5bc-7d44-4a11-9383-a5e30c3ec8ae"
license = "Elastic License v2"
name = "Egress Connection by a YUM Package Manager Descendant"
os_list = ["linux"]
reference = [
"https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/local/yum_package_manager_persistence.rb",
"https://www.elastic.co/security-labs/sequel-on-persistence-mechanisms",
]
version = "1.0.8"
query = '''
sequence by process.entity_id with maxspan=5s
[process where event.type == "start" and event.action == "exec" and (
process.name : (
"bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "python*", "php*",
"perl", "ruby", "lua*", "openssl", "nc", "ncat", "netcat", "netcat.openbsd",
"netcat.traditional", "nc.openbsd", "nc.traditional", "telnet", "awk"
) or
process.executable : (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*"
)
) and descendant of [process where event.action == "exec" and process.name == "yum"] and not (
process.executable : "/run/user/*/newroot/*" or
process.args : "/usr/local/cpanel/*"
)
]
[network where event.action == "connection_attempted" and event.type == "start" and not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.name in ("yumBackend.py", "urlgrabber-ext-down") or
process.executable in ("/usr/share/logstash/jdk/bin/java", "/opt/java/openjdk/bin/java", "/usr/local/cpanel/scripts/rebuildhttpdconf")
)
]
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and (
process.name : (
"bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "python*", "php*",
"perl", "ruby", "lua*", "openssl", "nc", "ncat", "netcat", "netcat.openbsd",
"netcat.traditional", "nc.openbsd", "nc.traditional", "telnet", "awk"
) or
process.executable : (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*"
)
) and descendant of [process where event.action == "exec" and process.name == "yum"] and not (
process.executable : "/run/user/*/newroot/*" or
process.args : "/usr/local/cpanel/*"
)
]
Stage 2: network
[network where event.action == "connection_attempted" and event.type == "start" and not (
destination.ip == null or destination.ip == "0.0.0.0" or cidrmatch(
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29",
"192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
"192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10",
"192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10",
"FF00::/8", "172.31.0.0/16"
) or
process.name in ("yumBackend.py", "urlgrabber-ext-down") or
process.executable in ("/usr/share/logstash/jdk/bin/java", "/opt/java/openjdk/bin/java", "/usr/local/cpanel/scripts/rebuildhttpdconf")
)
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | starts_with | /usr/local/cpanel/ | excludes:process.args field:"process.args" value:"/usr/local/cpanel/" |
process.executable | wildcard | /run/user/*/newroot/* | excludes:process.executable field:"process.executable" value:"/run/user/*/newroot/*" |
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8, 172.31.0.0/16 | excludes:destination.ip |
destination.ip | eq | 0.0.0.0 | excludes:destination.ip field:"destination.ip" value:"0.0.0.0" |
destination.ip | is_null | excludes:destination.ip | |
process.executable | in | /opt/java/openjdk/bin/java, /usr/local/cpanel/scripts/rebuildhttpdconf, /usr/share/logstash/jdk/bin/java | excludes:process.executable field:"process.executable" value:"/opt/java/openjdk/bin/java" field:"process.executable" value:"/usr/local/cpanel/scripts/rebuildhttpdconf" field:"process.executable" value:"/usr/share/logstash/jdk/bin/java" |
process.name | in | urlgrabber-ext-down, yumBackend.py | excludes:process.name field:"process.name" value:"urlgrabber-ext-down" field:"process.name" value:"yumBackend.py" |
First Seen Network Flow Exporter
#Identifies a NetFlow, IPFIX, or sFlow exporter IP that has not previously sent decoded flow records in the same data stream namespace during the prior 2 hours. This low-risk building-block signal records exporter novelty for correlation with later detection alerts in which the same address is the source of suspicious activity.
Known False Positives
- Newly deployed routers, switches, firewalls, packet brokers, collector migrations, disaster-recovery activation, exporter address changes, and integration re-onboarding can trigger this rule.
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2026/08/20"
integration = ["netflow", "goflow2"]
maturity = "production"
updated_date = "2026/08/20"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies a NetFlow, IPFIX, or sFlow exporter IP that has not previously sent decoded flow records in the same data
stream namespace during the prior 2 hours. This low-risk building-block signal records exporter novelty for correlation
with later detection alerts in which the same address is the source of suspicious activity.
"""
false_positives = [
"""
Newly deployed routers, switches, firewalls, packet brokers, collector migrations, disaster-recovery activation,
exporter address changes, and integration re-onboarding can trigger this rule.
""",
]
from = "now-125m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "First Seen Network Flow Exporter"
note = """## Triage and analysis
### Investigating First Seen Network Flow Exporter
This building-block rule detects a newly observed exporter identity from decoded NetFlow, IPFIX, or sFlow records. In
these datasets, `observer.ip` identifies the exporter or sampler. The `source.ip` and `destination.ip` fields identify
endpoints in the exported flow and must not be treated as the exporter transport connection.
This signal establishes novelty only. It does not prove that the exporter is unauthorized or that the exporter itself
performed the activity represented by the flow records. The signal is intended for correlation with later detection
alerts whose `source.ip` equals this alert's `observer.ip`.
### Possible investigation steps
- Identify the device assigned to `observer.ip` and verify its owner, model, location, and change record.
- Confirm the expected collector, data stream namespace, export protocol, observation domain, and template behavior.
- Compare `netflow.exporter.source_id`, `netflow.exporter.version`, sequence values, interfaces, sampling rate, and flow
volume with established exporters.
- Check for template churn, malformed records, implausible addresses or byte counts, and conflicting telemetry from
independent sensors.
### False positive analysis
- Validate recent network-device onboarding, collector migrations, disaster-recovery activation, NAT changes, and
integration re-onboarding.
### Response and remediation
- If unauthorized, block the exporter at the collector boundary and preserve the received records for investigation.
- Review collector authentication, network ACLs, and exporter configuration to prevent further telemetry injection.
"""
references = [
"https://www.elastic.co/docs/reference/integrations/netflow",
"https://www.elastic.co/docs/reference/integrations/goflow2",
"https://datatracker.ietf.org/doc/html/rfc7011",
"https://sflow.org/sflow_version_5.txt",
]
risk_score = 21
rule_id = "dfe3f626-4224-417e-aff1-8ef9a72c3191"
setup = """## Setup
This rule requires at least one decoded flow-export data source:
- Elastic NetFlow integration (`netflow.log`) for NetFlow or IPFIX records.
- Elastic GoFlow2 integration (`goflow2.sflow`) for sFlow records processed by GoFlow2.
Verify that `observer.ip` contains the exporter or sampler address. Do not broaden this rule to generic firewall or
`network_traffic.flow` events: in those records, `source.ip` and `destination.ip` describe the observed traffic and do
not reliably identify the device exporting telemetry.
"""
severity = "low"
tags = [
"Domain: Network",
"Use Case: Network Security Monitoring",
"Use Case: Threat Detection",
"Rule Type: BBR",
"Data Source: NetFlow",
"Data Source: GoFlow2",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM logs-netflow.log-*, logs-goflow2.sflow-*
| WHERE observer.ip IS NOT NULL AND data_stream.namespace IS NOT NULL
| STATS
Esql.event_count = COUNT(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.data_stream_dataset_values = VALUES(data_stream.dataset)
BY data_stream.namespace, observer.ip
| EVAL Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, NOW())
| WHERE Esql.recent <= 6
| KEEP
data_stream.namespace,
observer.ip,
Esql.event_count,
Esql.first_time_seen,
Esql.data_stream_dataset_values,
Esql.recent
'''
[rule.investigation_fields]
field_names = [
"data_stream.namespace",
"observer.ip",
"Esql.data_stream_dataset_values",
"Esql.event_count",
"Esql.first_time_seen",
"Esql.recent",
]
[rule.alert_suppression]
group_by = ["data_stream.namespace", "observer.ip"]
missing_fields_strategy = "doNotSuppress"
[rule.alert_suppression.duration]
unit = "h"
value = 2
Stages and Predicates
Stage 1: from
FROM logs-netflow.log-*, logs-goflow2.sflow-*
Stage 2: where
| WHERE observer.ip IS NOT NULL AND data_stream.namespace IS NOT NULL
Stage 3: stats
| STATS
Esql.event_count = COUNT(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.data_stream_dataset_values = VALUES(data_stream.dataset)
BY data_stream.namespace, observer.ip
Stage 4: eval
| EVAL Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, NOW())
Stage 5: where
| WHERE Esql.recent <= 6
Stage 6: keep
| KEEP
data_stream.namespace,
observer.ip,
Esql.event_count,
Esql.first_time_seen,
Esql.data_stream_dataset_values,
Esql.recent
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.recent | le |
| field:"Esql.recent" kind:le value:"6" |
data_stream.namespace | is_not_null | field:"data_stream.namespace" kind:is_not_null | |
observer.ip | is_not_null | field:"observer.ip" kind:is_not_null |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
data_stream.namespace | KEEP data_stream.namespace |
observer.ip | KEEP observer.ip |
Esql.event_count | KEEP Esql.event_count |
Esql.first_time_seen | KEEP Esql.first_time_seen |
Esql.data_stream_dataset_values | KEEP Esql.data_stream_dataset_values |
Esql.recent | KEEP Esql.recent |
First Time Seen Memcached Writer
#Identifies the first successful or no-reply Memcached store command from a client to a server. Memcached commonly has no authentication, so an unauthorized writer can overwrite session tokens, poison cached application content, or alter security-sensitive state. This behavior can enable session hijacking such as the exposure described by CVE-2026-29093.
Known False Positives
- New application servers, autoscaled workloads, cache warmers, deployment jobs, administrative tools, and failover systems may legitimately write to Memcached for the first time. Validate the client and server roles, affected keys, deployment context, and application behavior before escalating.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Rule Body
[metadata]
creation_date = "2026/07/30"
integration = ["network_traffic"]
maturity = "production"
updated_date = "2026/07/30"
[rule]
author = ["Elastic"]
description = """
Identifies the first successful or no-reply Memcached store command from a client to a server. Memcached commonly has no
authentication, so an unauthorized writer can overwrite session tokens, poison cached application content, or alter
security-sensitive state. This behavior can enable session hijacking such as the exposure described by CVE-2026-29093.
"""
false_positives = [
"""
New application servers, autoscaled workloads, cache warmers, deployment jobs, administrative tools, and failover
systems may legitimately write to Memcached for the first time. Validate the client and server roles, affected keys,
deployment context, and application behavior before escalating.
""",
]
from = "now-9m"
index = ["logs-network_traffic.memcached-*"]
language = "kuery"
license = "Elastic License v2"
name = "First Time Seen Memcached Writer"
note = """## Triage and analysis
### Investigating First Time Seen Memcached Writer
Memcached permits store commands without authentication by default. A client with network access can use `set`, `add`, `replace`, `append`, `prepend`, or `cas` to overwrite session objects or inject content consumed by an application. This rule uses a seven-day new-terms history window to surface the first observed client, Memcached server, and store command combination performing a successful operation or issuing a store command with `noreply`.
The rule does not inspect cached values and does not prove that a session was hijacked. It identifies an unusual writer relationship that requires application and asset context.
### Possible investigation steps
- Review `client.ip`, `server.ip`, `server.port`, `network.community_id`, `network_traffic.memcached.request.command`, `network_traffic.memcached.request.keys`, `network_traffic.memcached.response.type`, and `network_traffic.memcached.response.status_code`.
- Determine whether the client is an approved application server, cache warmer, administrative host, deployment job, or newly scaled workload.
- Inspect key names for application-specific session prefixes such as `memc.sess.key`, `PHPSESSID`, or `session`. Do not retrieve or ingest cached values unless incident response requires it and access controls permit it.
- Search earlier Memcached events from the same client for `get`, `gets`, `stats`, `lru_crawler`, or key enumeration activity that could indicate discovery before modification.
- Search subsequent events for `flush_all`, delete bursts, privileged web sessions from new source addresses or user agents, and administrative actions without the normal authentication sequence.
- Review application and identity logs to determine whether the write was followed by session reuse or impersonation.
### False positive analysis
- Autoscaling and deployments can introduce legitimate first-time writers.
- NAT or proxies can combine multiple application instances under one client address or make a known writer appear new.
- Add exceptions for validated client and server pairs rather than excluding store commands globally.
### Response and remediation
- Block unauthorized clients and restrict Memcached listeners to approved application and administration networks.
- Invalidate affected sessions and rotate exposed credentials if session manipulation is suspected.
- Bind Memcached to private interfaces, enforce network-layer access controls, and disable UDP unless explicitly needed.
"""
references = [
"https://nvd.nist.gov/vuln/detail/CVE-2026-29093",
"https://attack.mitre.org/techniques/T1565/001/",
"https://www.elastic.co/docs/reference/integrations/network_traffic",
]
risk_score = 47
rule_id = "63c3c736-72e1-4d41-8022-27b5c4935e93"
setup = """## Setup
This rule requires the Elastic Network Packet Capture integration with the Memcached protocol analyzer enabled and
cleartext visibility into client-to-server transactions. The sensor must observe responses to confirm successful
operations, except when the client explicitly uses `noreply`.
Keep value capture disabled unless it is explicitly required and protected. Cached values can contain live session
tokens, credentials, personal data, and other sensitive application content. Key and command metadata are sufficient
for this rule.
"""
severity = "medium"
tags = [
"Domain: Network",
"Use Case: Network Security Monitoring",
"Use Case: Threat Detection",
"Tactic: Impact",
"Data Source: Network Packet Capture",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset:network_traffic.memcached and
client.ip:* and server.ip:* and
network_traffic.memcached.request.command:("set" or "add" or "replace" or "append" or "prepend" or "cas") and
(
network_traffic.memcached.response.type:("Success" or "success") or
network_traffic.memcached.response.status_code:0 or
network_traffic.memcached.request.noreply:true
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1565"
name = "Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/"
[[rule.threat.technique.subtechnique]]
id = "T1565.001"
name = "Stored Data Manipulation"
reference = "https://attack.mitre.org/techniques/T1565/001/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"client.ip",
"server.ip",
"server.port",
"network.community_id",
"network_traffic.memcached.protocol_type",
"network_traffic.memcached.request.command",
"network_traffic.memcached.request.keys",
"network_traffic.memcached.request.noreply",
"network_traffic.memcached.response.type",
"network_traffic.memcached.response.status_code",
]
[rule.new_terms]
field = "new_terms_fields"
value = ["client.ip", "server.ip", "network_traffic.memcached.request.command"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset:network_traffic.memcached and
client.ip:* and server.ip:* and
network_traffic.memcached.request.command:("set" or "add" or "replace" or "append" or "prepend" or "cas") and
(
network_traffic.memcached.response.type:("Success" or "success") or
network_traffic.memcached.response.status_code:0 or
network_traffic.memcached.request.noreply:true
)
Indicators
These rows show field, operator, and value matches.
GCP Logging Sink Modification
#Identifies a modification to a Logging sink in Google Cloud Platform (GCP). 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 update a Logging sink to exfiltrate logs to a different export destination.
Known False Positives
- Logging sink modifications 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. Sink modifications from 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 | |
| Exfiltration |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| GCP | google.logging.ConfigServiceV2.UpdateSink: Update log sink |
Rule Body
[metadata]
creation_date = "2020/09/22"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies a modification to a Logging sink in Google Cloud Platform (GCP). 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 update a Logging sink to exfiltrate logs to a different export destination.
"""
false_positives = [
"""
Logging sink modifications 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. Sink modifications from 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 Modification"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating GCP Logging Sink Modification
In GCP, logging sinks are used to route log entries to specified destinations for storage or analysis. Adversaries may exploit this by altering sink configurations to redirect logs to unauthorized locations, facilitating data exfiltration. The detection rule identifies successful modifications to logging sinks, signaling potential misuse by monitoring specific audit events related to sink updates.
### Possible investigation steps
- Review the event details for the specific `event.action` field value `google.logging.v*.ConfigServiceV*.UpdateSink` to confirm the type of modification made to the logging sink.
- Check the `event.outcome` field to ensure the modification was successful, as indicated by the value `success`.
- Identify the user or service account responsible for the modification by examining the `actor` or `principalEmail` fields in the audit log.
- Investigate the `resource` field to determine which logging sink was modified and assess its intended purpose and usual configuration.
- Analyze the `destination` field in the sink configuration to verify if the new export destination is authorized and aligns with organizational policies.
- Review historical logs for any previous modifications to the same logging sink to identify patterns or repeated unauthorized changes.
- Correlate this event with other security alerts or anomalies in the environment to assess if this modification is part of a broader attack or data exfiltration attempt.
### False positive analysis
- Routine updates to logging sinks by authorized personnel can trigger alerts. To manage this, maintain a list of known and trusted users who regularly perform these updates and create exceptions for their actions.
- Automated processes or scripts that update logging sinks as part of regular maintenance or deployment activities may cause false positives. Identify these processes and exclude their specific actions from triggering alerts.
- Changes to logging sinks during scheduled maintenance windows can be mistaken for unauthorized modifications. Define and exclude these time periods from monitoring to reduce unnecessary alerts.
- Integration with third-party tools that require sink modifications for functionality might generate false positives. Document these integrations and adjust the detection rule to account for their expected behavior.
- Frequent changes in a dynamic environment, such as development or testing environments, can lead to false positives. Consider applying the rule more stringently in production environments while relaxing it in non-production settings.
### Response and remediation
- Immediately review the audit logs to confirm the unauthorized modification of the logging sink and identify the source of the change, including the user account and IP address involved.
- Revert the logging sink configuration to its original state to ensure logs are directed to the intended, secure destination.
- Temporarily disable or restrict access to the user account or service account that made the unauthorized change to prevent further unauthorized actions.
- Notify the security team and relevant stakeholders about the incident, providing details of the unauthorized modification and initial containment actions taken.
- Conduct a thorough investigation to determine if any data was exfiltrated and assess the potential impact on the organization.
- Implement additional monitoring and alerting for changes to logging sink configurations to detect similar unauthorized modifications in the future.
- Review and strengthen access controls and permissions related to logging sink configurations to prevent unauthorized modifications, ensuring that only authorized personnel have the necessary permissions.
## 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#how_sinks_work"]
risk_score = 21
rule_id = "184dfe52-2999-42d9-b9d1-d1ca54495a61"
severity = "low"
tags = [
"Domain: Cloud",
"Data Source: GCP",
"Data Source: Google Cloud Platform",
"Use Case: Log Auditing",
"Tactic: Exfiltration",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:gcp.audit and event.action:google.logging.v*.ConfigServiceV*.UpdateSink and event.outcome:success
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1537"
name = "Transfer Data to Cloud Account"
reference = "https://attack.mitre.org/techniques/T1537/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "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*.UpdateSink 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*.UpdateSink" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
Mount Execution Detected via Defend for Containers
#This rule detects the use of the mount utility from inside a privileged container. The mount command is used to make a device or file system accessible to the system, and then to connect its root directory to a specified mount point on the local file system. When launched inside a privileged container--a container deployed with all the capabilities of the host machine-- an attacker can access sensitive host level files which could be used for further privilege escalation and container escapes to the host machine. Any usage of mount inside a running privileged container should be further investigated.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2023/10/26"
integration = ["cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/07/29"
[rule]
author = ["Elastic"]
description = """
This rule detects the use of the mount utility from inside a privileged container. The mount command is used to make a
device or file system accessible to the system, and then to connect its root directory to a specified mount point on the
local file system. When launched inside a privileged container--a container deployed with all the capabilities of the
host machine-- an attacker can access sensitive host level files which could be used for further privilege escalation
and container escapes to the host machine. Any usage of mount inside a running privileged container should be further
investigated.
"""
from = "now-6m"
index = ["logs-cloud_defend.process*"]
interval = "5m"
language = "eql"
license = "Elastic License v2"
name = "Mount Execution Detected via Defend for Containers"
note = """## Setup
## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Mount Execution Detected via Defend for Containers
In containerized environments, the `mount` utility is crucial for attaching file systems to the system's directory tree. When executed within a privileged container, which has extensive host capabilities, it can be exploited by adversaries to access sensitive host files, potentially leading to privilege escalation or container escapes. The detection rule identifies such misuse by monitoring the execution of `mount` in privileged containers, flagging potential security threats for further investigation.
### Possible investigation steps
- Review the alert details to confirm that the process name is "mount" and that the container's security context is marked as privileged.
- Identify the container involved in the alert by examining the container ID or name, and gather information about its purpose and the applications it runs.
- Check the container's deployment configuration to verify if it was intentionally set as privileged and assess whether this level of privilege is necessary for its function.
- Investigate the user or process that initiated the mount command within the container to determine if it aligns with expected behavior or if it indicates potential malicious activity.
- Examine the mounted file systems and directories to identify any sensitive host files that may have been accessed or exposed.
- Review logs and historical data for any previous suspicious activities associated with the same container or user to identify patterns or repeated attempts at privilege escalation.
### False positive analysis
- Routine maintenance tasks within privileged containers may trigger the rule. Exclude known maintenance scripts or processes by adding them to an exception list based on their unique identifiers or command patterns.
- Backup operations that require mounting file systems might be flagged. Identify and exclude these operations by specifying the backup process names or arguments in the rule exceptions.
- Development or testing environments often use privileged containers for convenience. If these environments are known and controlled, consider excluding them by container IDs or labels to reduce noise.
- Automated deployment tools that use mount commands in privileged containers can be mistaken for threats. Review and whitelist these tools by their process names or specific arguments to prevent false alerts.
- Certain monitoring or logging solutions may use mount operations for data collection. Verify these solutions and exclude their processes if they are legitimate and necessary for system operations.
### Response and remediation
- Immediately isolate the affected container to prevent further access to sensitive host files. This can be done by stopping the container or disconnecting it from the network.
- Review and revoke any unnecessary privileges from the container's security context to prevent similar incidents. Ensure that containers run with the least privileges necessary.
- Conduct a thorough analysis of the container's file system and logs to identify any unauthorized access or modifications to host files.
- If unauthorized access is confirmed, perform a comprehensive audit of the host system to check for any signs of compromise or privilege escalation attempts.
- Patch and update the container image and host system to address any vulnerabilities that may have been exploited.
- Implement stricter access controls and monitoring for privileged containers, ensuring that only trusted users and processes can execute sensitive commands like `mount`.
- Escalate the incident to the security operations team for further investigation and to assess the need for additional security measures or incident response actions."""
references = [
"https://book.hacktricks.xyz/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation#privileged",
]
risk_score = 21
rule_id = "41f7da9e-4e9f-4a81-9b58-40d725d83bc0"
severity = "low"
tags = [
"Data Source: Elastic Defend for Containers",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
process.name == "mount" or
(
/* account for tools that execute utilities as a subprocess, in this case the target utility name will appear as a process arg */
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in (
"mount", "/bin/mount", "/usr/bin/mount", "/usr/local/bin/mount"
) and
/* default exclusion list to not FP on default multi-process commands */
not process.args in (
"which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
"man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
"chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
"chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
)
)
) and container.security_context.privileged == true and container.id like "*"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1611"
name = "Escape to Host"
reference = "https://attack.mitre.org/techniques/T1611/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
process.name == "mount" or
(
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in (
"mount", "/bin/mount", "/usr/bin/mount", "/usr/local/bin/mount"
) and
not process.args in (
"which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
"man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man",
"chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod",
"chown", "/bin/chown", "/usr/bin/chown", "/usr/local/bin/chown"
)
)
) and container.security_context.privileged == true and container.id like "*"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
container.id | wildcard |
| field:"container.id" kind:wildcard value:"*" |
container.security_context.privileged | eq |
| field:"container.security_context.privileged" kind:eq value:"true" |
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.name | eq |
| field:"process_basename" kind:eq value:"mount" |
process.name | in |
| field:"process_basename" kind:in |
Newly Observed High Severity Detection Alert
#This rule detects Elastic SIEM high severity detection alerts that are observed for the first time in the previous 5 days of alert history. It highlights low-volume, newly observed alerts tied to a specific detection rule, analysts can use this to prioritize triage and response.
Rule Body
[metadata]
creation_date = "2026/01/07"
maturity = "production"
updated_date = "2026/04/27"
[rule]
author = ["Elastic"]
description = """
This rule detects Elastic SIEM high severity detection alerts that are observed for the first time in the previous 5 days
of alert history. It highlights low-volume, newly observed alerts tied to a specific detection rule, analysts can use this
to prioritize triage and response.
"""
from = "now-7205m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "Newly Observed High Severity Detection Alert"
risk_score = 73
rule_id = "1a3d5b36-b995-4ace-9b85-8a0af429ccf6"
severity = "high"
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM .alerts-security.*
| where kibana.alert.rule.name is not null and kibana.alert.risk_score >= 73 and
not kibana.alert.rule.type in ("threat_match", "machine_learning", "new_terms") and
not kibana.alert.rule.name like "Deprecated - *" and kibana.alert.rule.name != "My First Rule" and
// covered by 7306ce7d-5c90-4f42-aa6c-12b0dc2fe3b8
event.dataset != "endpoint.alerts" and
not KQL("""kibana.alert.rule.tags : "Rule Type: Higher-Order Rule" """)
| STATS Esql.alerts_count = count(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.last_time_seen = MAX(@timestamp),
Esql.process_executable = VALUES(process.executable),
Esql.process_command_line_values = VALUES(process.command_line),
Esql.process_parent_executable_values = VALUES(process.parent.executable),
Esql.file_path_values = VALUES(file.path),
Esql.dll_path_values = VALUES(dll.path),
Esql.user_id_values = VALUES(user.id),
Esql.user_name_values = VALUES(user.name),
Esql.agent_id_values = VALUES(agent.id),
Esql.host_id_values = VALUES(host.id),
Esql.event_module_values = VALUES(event.module),
Esql.source_ip_values = VALUES(source.ip),
Esql.kibana_alert_rule_name_values = VALUES(kibana.alert.rule.name),
Esql.agent_id_distinct_count = COUNT_DISTINCT(agent.id) by kibana.alert.rule.name
// fist time seen in the last 5 days - defined in the rule schedule Additional look-back time
| eval Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, now())
// first time seen is within 10m of the rule execution time
| where Esql.recent <= 10 and Esql.agent_id_distinct_count == 1 and Esql.alerts_count <= 10 and (Esql.last_time_seen == Esql.first_time_seen)
// Move single values to their corresponding ECS fields for alerts exclusion
| eval host.id = mv_min(Esql.host_id_values)
| keep host.id, kibana.alert.rule.name, Esql.*
'''
note = """## Triage and analysis
### Investigating Newly Observed High Severity Detection Alert
This rule surfaces newly observed, low-frequency behavior high severity alerts affecting a single agent within the current day.
Because the alert has not been seen previously for this rule and host, it should be prioritized for validation to determine
whether it represents a true compromise or rare benign activity.
### Investigation Steps
- Identify the affected host, user and review the associated rule name to understand the behavior that triggered the alert.
- Validate the user context under which the activity occurred and assess whether it aligns with normal behavior for that account.
- Refer to the specific rule investiguation guide for further actions.
### False Positive Considerations
- Newly deployed or updated software may introduce behavior not previously observed on the host.
- Administrative scripts or automation tools can trigger behavior-based detections when first introduced.
- Security tooling, IT management agents, or EDR integrations may generate new behavior alerts during updates or configuration changes.
- Development or testing environments may produce one-off behaviors that resemble malicious techniques.
### Response and Remediation
- If the activity is confirmed malicious, isolate the affected host to prevent further execution or lateral movement.
- Terminate malicious processes and remove any dropped files or persistence mechanisms.
- Collect forensic artifacts to understand initial access and execution flow.
- Patch or remediate any vulnerabilities or misconfigurations that enabled the behavior.
- If benign, document the finding and consider tuning or exception handling to reduce future noise.
- Continue monitoring the host and environment for recurrence of the behavior or related alerts."""
references = ["https://www.elastic.co/docs/solutions/security/detect-and-alert/about-detection-rules"]
Stages and Predicates
Stage 1: from
FROM .alerts-security.*
Stage 2: where
| where kibana.alert.rule.name is not null and kibana.alert.risk_score >= 73 and
not kibana.alert.rule.type in ("threat_match", "machine_learning", "new_terms") and
not kibana.alert.rule.name like "Deprecated - *" and kibana.alert.rule.name != "My First Rule" and
event.dataset != "endpoint.alerts" and
not KQL("""kibana.alert.rule.tags : "Rule Type: Higher-Order Rule" """)
Stage 3: stats
| STATS Esql.alerts_count = count(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.last_time_seen = MAX(@timestamp),
Esql.process_executable = VALUES(process.executable),
Esql.process_command_line_values = VALUES(process.command_line),
Esql.process_parent_executable_values = VALUES(process.parent.executable),
Esql.file_path_values = VALUES(file.path),
Esql.dll_path_values = VALUES(dll.path),
Esql.user_id_values = VALUES(user.id),
Esql.user_name_values = VALUES(user.name),
Esql.agent_id_values = VALUES(agent.id),
Esql.host_id_values = VALUES(host.id),
Esql.event_module_values = VALUES(event.module),
Esql.source_ip_values = VALUES(source.ip),
Esql.kibana_alert_rule_name_values = VALUES(kibana.alert.rule.name),
Esql.agent_id_distinct_count = COUNT_DISTINCT(agent.id) by kibana.alert.rule.name
Stage 4: eval
| eval Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, now())
Stage 5: where
| where Esql.recent <= 10 and Esql.agent_id_distinct_count == 1 and Esql.alerts_count <= 10 and (Esql.last_time_seen == Esql.first_time_seen)
Stage 6: eval
| eval host.id = mv_min(Esql.host_id_values)
Stage 7: keep
| keep host.id, kibana.alert.rule.name, Esql.*
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
kibana.alert.rule.name | starts_with | Deprecated - | excludes:kibana.alert.rule.name field:"kibana.alert.rule.name" value:"Deprecated - " |
kibana.alert.rule.tags | eq | Rule Type: Higher-Order Rule | excludes:kibana.alert.rule.tags field:"kibana.alert.rule.tags" value:"Rule Type: Higher-Order Rule" |
kibana.alert.rule.type | in | machine_learning, new_terms, threat_match | excludes:kibana.alert.rule.type field:"kibana.alert.rule.type" value:"machine_learning" field:"kibana.alert.rule.type" value:"new_terms" field:"kibana.alert.rule.type" value:"threat_match" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
host.id | KEEP host.id |
kibana.alert.rule.name | KEEP kibana.alert.rule.name |
Esql.* | KEEP Esql.* |
Potential CVE-2025-32463 Sudo Chroot Execution Attempt
#Detects suspicious use of sudo's --chroot / -R option consistent with attempts to exploit CVE-2025-32463 (the "sudo chroot" privilege escalation), where an attacker tricks sudo into using attacker-controlled NSS files or libraries to gain root.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Detects suspicious use of sudo's --chroot / -R option consistent with attempts to exploit CVE-2025-32463 (the "sudo
chroot" privilege escalation), where an attacker tricks sudo into using attacker-controlled NSS files or libraries to
gain root.
"""
id = "1ec98de0-3c28-4a56-b4ff-becb13cacb6e"
license = "Elastic License v2"
name = "Potential CVE-2025-32463 Sudo Chroot Execution Attempt"
os_list = ["linux"]
reference = [
"https://www.stratascale.com/vulnerability-alert-CVE-2025-32463-sudo-chroot",
"https://github.com/kh4sh3i/CVE-2025-32463",
]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name == "sudo" and process.args in ("-R", "--chroot") and
// To enforce the -R and --chroot arguments to be for sudo specifically, while wildcarding potential full sudo paths
process.command_line like ("*sudo -R*", "*sudo --chroot*") and
not process.args == "chown"
'''
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 = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[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 == "sudo" and process.args in ("-R", "--chroot") and
process.command_line like ("*sudo -R*", "*sudo --chroot*") and
not process.args == "chown"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"sudo" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | chown | excludes:process.args field:"process.args" value:"chown" |
Potential Machine Account Relay Attack via SMB
#Identifies potential relay attacks against a machine account by identifying network share access events coming from a remote source.ip but using the target server computer account. This may indicate an SMB relay attack.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/06/16"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/04/24"
[rule]
author = ["Elastic"]
description = """
Identifies potential relay attacks against a machine account by identifying network share access events coming from a
remote source.ip but using the target server computer account. This may indicate an SMB relay attack.
"""
from = "now-9m"
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Machine Account Relay Attack via SMB"
references = [
"https://github.com/p0dalirius/windows-coerced-authentication-methods",
"https://www.thehacker.recipes/ad/movement/mitm-and-coerced-authentications/",
"https://attack.mitre.org/techniques/T1187/",
]
risk_score = 73
rule_id = "d84a11c0-eb12-4e7d-8a0a-718e38351e29"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Active Directory",
"Use Case: Active Directory Monitoring",
"Data Source: Windows Security Event Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "windows" and event.code == "5145" and endswith(user.name, "$") and
/* compare computername with user.name and make sure they match (dot-boundary prevents prefix-only matches) */
startswith~(concat(winlog.computer_name, "."), concat(substring(user.name, 0, -1), ".")) and
/* exclude local access */
not endswith(string(source.ip), string(host.ip)) and
source.ip != "::" and source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1"
'''
note = """## Triage and analysis
### Investigating Potential Machine Account Relay Attack via SMB
#### Possible investigation steps
- What does the alert-local 5145 event show about the remote source, target server, machine account, and exact share or pipe path?
- Focus: `source.ip`, `winlog.computer_name`, `user.name`, `winlog.event_data.ShareName`, and `winlog.event_data.RelativeTargetName`, noting "IPC$", "ADMIN$", and coercion-related named pipes in the relative target path.
- Implication: escalate when a remote source reaches relayable pipes or admin shares while `user.name` matches the target server machine account; lower suspicion only when the same source, target, and path are already tied to a known relay-safe infrastructure tier.
- Does the apparent machine-account access really resolve to one target-server identity and one stable infrastructure path?
- Focus: `user.name`, `winlog.computer_name`, `host.name`, `host.ip`, and `source.ip`.
- Implication: relay remains likely when the target server account appears from a `source.ip` that is not one of the target server's `host.ip` values; if hostname aliases or clustering explain the address mismatch, keep validating the share path and auth evidence before closure.
- Do surrounding authentication events show the same source creating machine-account network logons or NTLM fallback on the target?
- Why: 5145 proves share access; 4624 and 4625 show whether the source authenticated with the target machine account and which protocol path was used, while 4648 only adds explicit-credential context.
- Focus: Windows Security events on the target server from the alert source: `winlog.event_data.TargetUserName`, `winlog.logon.type`, `winlog.event_data.AuthenticationPackageName`, and `winlog.event_data.LmPackageName`.
- Hint: pivot on 4624 and 4625 for the alert `source.ip`, target server, and `user.name` to `winlog.event_data.TargetUserName` match; use 4648 only for explicit-credential context. Missing authentication telemetry is unresolved, not benign. $investigate_2
- Implication: escalate when the same source produces machine-account type 3 logons, failures followed by success, NTLM where Kerberos is expected, or weak LM details; lower suspicion only when auth fields match the same stable infrastructure path seen in the 5145 evidence.
- Do surrounding 5145 events show the source revisiting relayable pipes, alternate shares, or more servers with the same machine-account pattern?
- Focus: 5145 events for the same `source.ip` and `user.name`, comparing `winlog.event_data.ShareName`, `winlog.event_data.RelativeTargetName`, and `winlog.event_data.AccessMask` across target servers.
- Hint: start with 5145 events for the same `source.ip` and `user.name` in the alert window, then expand only if the first events show relayable pipe access, admin-share access, or repeated machine-account use. $investigate_3
- Implication: broader pipe, admin-share, or multi-server coverage supports active relay; a bounded single-path pattern lowers urgency only when it stays inside the same recognized infrastructure cohort.
- If local evidence stays suspicious or unresolved, do related alerts expand the source or target scope?
- Focus: related alerts for `source.ip` covering coercion, relay, lateral movement, remote execution, or credential access from the same origin. $investigate_0
- Hint: compare target-server alerts for suspicious authentication, service creation, persistence, or credential access on `host.id`. $investigate_1
- Implication: broaden containment when the same source targets other servers or the target shows follow-on execution or persistence; keep scope local only when related alerts stay confined to the same recognized infrastructure cohort.
- Based on the evidence gathered, what disposition is supported?
- Focus: 5145 share or pipe path, machine-account and target fit, source role, surrounding auth, repeated 5145 scope, and related-alert scope.
- Implication: escalate when relayable access aligns with the target machine account plus NTLM/auth corroboration, repeated 5145 activity, or related alerts; close only when all evidence tightly binds one stable infrastructure workflow with no contradictory auth or scope; preserve and escalate when evidence is mixed or incomplete.
### False positive analysis
- Load balancers, cluster nodes, proxies, management gateways, backup, or orchestration tooling can make a machine account appear to access a share from a different source. Confirm only when the source-target-account tuple, share or pipe path, access mask, and auth method all align with the same stable infrastructure role, with no broader relayable paths or extra machine-account auth. Use topology records only to corroborate that exact telemetry pattern; if unavailable, require the same field pattern across prior alerts.
- Build exceptions from the minimum confirmed workflow: `source.ip`, `winlog.computer_name`, `user.name`, `winlog.event_data.ShareName`, and `winlog.event_data.RelativeTargetName`, plus the stable auth pattern when available. Avoid exceptions on `user.name`, `winlog.event_data.ShareName`, or `source.ip` alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and document the recognized source, target server, machine account, share or pipe path, access mask, and auth pattern. Create an exception only after the same workflow recurs across prior alerts or is corroborated by topology records.
- If suspicious but unconfirmed, preserve the alert, surrounding 5145 and authentication records, case timeline, source and target identities, share or pipe path, access mask, and NTLM/auth details before containment. Apply reversible containment first, such as restricting SMB from the source to the target or tightening access to the exposed relay path; use host isolation only if the source continues suspicious machine-account access and the server role can tolerate interruption.
- If confirmed malicious, contain the source host or block the relay path using the preserved 5145/auth evidence. Record the evidence before terminating processes, blocking access, or rotating secrets.
- After scoping affected source and target systems, rotate the affected computer-account secret when evidence shows credential material was exposed, replayed, or relayed to privileged services; otherwise coordinate identity review before disruptive rotation. Review adjacent systems or delegated credentials exposed through the same relay path.
- Post-incident hardening: enforce SMB signing or Extended Protection, reduce NTLM exposure, restrict relayable services, and audit other servers contacted from the same `source.ip`.
"""
setup = """## Setup
Audit Detailed File Share must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-detailed-file-share
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user.id",
"user.domain",
"source.ip",
"host.name",
"host.id",
"host.ip",
"winlog.computer_name",
"event.code",
"winlog.event_data.SubjectLogonId",
"winlog.event_data.IpAddress",
"winlog.event_data.ShareName",
"winlog.event_data.RelativeTargetName",
"winlog.event_data.AccessMask",
]
[[transform.investigate]]
label = "Alerts associated with this source IP"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "source.ip", queryType = "phrase", value = "{{source.ip}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with this target server"
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 = "Authentication events from this source to the target machine account"
description = ""
providers = [
[
{ excluded = false, field = "event.code", queryType = "phrase", value = "4624", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "source.ip", queryType = "phrase", value = "{{source.ip}}", valueType = "string" },
{ excluded = false, field = "winlog.event_data.TargetUserName", queryType = "phrase", value = "{{user.name}}", valueType = "string" }
],
[
{ excluded = false, field = "event.code", queryType = "phrase", value = "4625", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "source.ip", queryType = "phrase", value = "{{source.ip}}", valueType = "string" },
{ excluded = false, field = "winlog.event_data.TargetUserName", queryType = "phrase", value = "{{user.name}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Detailed file-share events from this source and machine account"
description = ""
providers = [
[
{ excluded = false, field = "event.code", queryType = "phrase", value = "5145", valueType = "string" },
{ excluded = false, field = "source.ip", queryType = "phrase", value = "{{source.ip}}", valueType = "string" },
{ excluded = false, field = "user.name", queryType = "phrase", value = "{{user.name}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1187"
name = "Forced Authentication"
reference = "https://attack.mitre.org/techniques/T1187/"
[[rule.threat.technique]]
id = "T1557"
name = "Adversary-in-the-Middle"
reference = "https://attack.mitre.org/techniques/T1557/"
[[rule.threat.technique.subtechnique]]
id = "T1557.001"
name = "LLMNR/NBT-NS Poisoning and SMB Relay"
reference = "https://attack.mitre.org/techniques/T1557/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 = "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
Stage 1: file
file where host.os.type == "windows" and event.code == "5145" and endswith(user.name, "$") and
startswith~(concat(winlog.computer_name, "."), concat(substring(user.name, 0, -1), ".")) and
not endswith(string(source.ip), string(host.ip)) and
source.ip != "::" and source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.code | eq |
| field:"EventID" kind:eq value:"5145" |
source.ip | is_not_null | field:"src_ip" kind:is_not_null | |
source.ip | ne |
| field:"src_ip" kind:ne |
user.name | ends_with |
| field:"user" kind:ends_with value:"$" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
source.ip | ends_with | string(host.ip) | excludes:source.ip field:"source.ip" value:"string(host.ip)" |
Scheduled Task Creation from Suspicious Parent
#Identifies the creation of a scheduled task from a suspicious parent process. This behavior is consistent with an adversary attempting to establish persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Identifies the creation of a scheduled task from a suspicious parent process. This behavior is consistent with an
adversary attempting to establish persistence.
"""
id = "0ce4faf0-1fe4-4455-a152-bd923e1fbdf6"
license = "Elastic License v2"
name = "Scheduled Task Creation from Suspicious Parent"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd"]
version = "1.0.5"
query = '''
sequence with maxspan=1m
[process where event.action == "start" and
(
(process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and
not process.executable : "C:\\*") or
((process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
not process.code_signature.status : "trusted") or
(process.executable :
("?:\\Users\\*\\AppData\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Users\\*\\Desktop\\*",
"?:\\Users\\Public\\*",
"\\Device\\Mup*") and not process.code_signature.status : "trusted")
) and
not process.executable : "?:\\Program Files\\WinCompose\\wincompose.exe" and
not process.hash.sha256 : "fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478"] by process.entity_id
[process where event.action == "start" and
(process.pe.original_file_name : "schtasks.exe" or process.name : "schtasks.exe") and
not process.Ext.token.integrity_level_name == "system" and
process.args : ("/create", "-create") and process.args : "/tr" and
not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*")] by process.parent.entity_id
'''
min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[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/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "start" and
(
(process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and
not process.executable : "C:\\*") or
((process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
not process.code_signature.status : "trusted") or
(process.executable :
("?:\\Users\\*\\AppData\\*",
"?:\\Users\\*\\Downloads\\*",
"?:\\Users\\*\\Desktop\\*",
"?:\\Users\\Public\\*",
"\\Device\\Mup*") and not process.code_signature.status : "trusted")
) and
not process.executable : "?:\\Program Files\\WinCompose\\wincompose.exe" and
not process.hash.sha256 : "fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478"] by process.entity_id
Stage 2: process
[process where event.action == "start" and
(process.pe.original_file_name : "schtasks.exe" or process.name : "schtasks.exe") and
not process.Ext.token.integrity_level_name == "system" and
process.args : ("/create", "-create") and process.args : "/tr" and
not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*")] 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:"start" |
process.Ext.device.product_id | wildcard |
| field:"process.Ext.device.product_id" kind:wildcard |
process.Ext.relative_file_creation_time | le |
| field:"process.Ext.relative_file_creation_time" kind:le value:"900" |
process.Ext.relative_file_name_modify_time | le |
| field:"process.Ext.relative_file_name_modify_time" kind:le value:"900" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"schtasks.exe" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard value:"schtasks.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Program Files\WinCompose\wincompose.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files\WinCompose\wincompose.exe" |
process.hash.sha256 | eq | fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478 | excludes:process.hash.sha256 field:"process.hash.sha256" value:"fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478" |
process.Ext.token.integrity_level_name | eq | system | excludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system" |
process.command_line | match | :\Program Files\, :\Program Files (x86)\ | excludes:process.command_line field:"process.command_line" value:":\Program Files\" field:"process.command_line" value:":\Program Files (x86)\" |
Segfault Detected
#Monitors kernel logs for segfault messages. A segfault, or segmentation fault, is an error that occurs when a program tries to access a memory location that it's not allowed to access, typically leading to program termination. A segfault can be an indication of malicious behavior if it results from attempts to exploit buffer overflows or other vulnerabilities in software to execute arbitrary code or disrupt its normal operation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2023/10/26"
integration = ["system"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Monitors kernel logs for segfault messages. A segfault, or segmentation fault, is an error that occurs when a program
tries to access a memory location that it's not allowed to access, typically leading to program termination. A segfault
can be an indication of malicious behavior if it results from attempts to exploit buffer overflows or other
vulnerabilities in software to execute arbitrary code or disrupt its normal operation.
"""
from = "now-9m"
index = ["logs-system.syslog-*"]
language = "kuery"
license = "Elastic License v2"
name = "Segfault Detected"
risk_score = 21
rule_id = "5c81fc9d-1eae-437f-ba07-268472967013"
setup = """## Setup
This rule requires data coming in from one of the following integrations:
- Filebeat
### Filebeat Setup
Filebeat is a lightweight shipper for forwarding and centralizing log data. Installed as an agent on your servers, Filebeat monitors the log files or locations that you specify, collects log events, and forwards them either to Elasticsearch or Logstash for indexing.
#### The following steps should be executed in order to add the Filebeat for the Linux System:
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setup-repositories.html).
- To run Filebeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html).
- To run Filebeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-kubernetes.html).
- For quick start information for Filebeat refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/8.11/filebeat-installation-configuration.html).
- For complete Setup and Run Filebeat information refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setting-up-and-running.html).
#### Rule Specific Setup Note
- This rule requires the Filebeat System Module to be enabled.
- The system module collects and parses logs created by the system logging service of common Unix/Linux based distributions.
- To run the system module of Filebeat on Linux follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-system.html).
"""
severity = "low"
tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Execution", "Rule Type: BBR"]
timestamp_override = "event.ingested"
type = "query"
query = '''
host.os.type:linux and event.dataset:"system.syslog" and process.name:kernel and message:segfault
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[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/"
Stages and Predicates
Stage 1: query
host.os.type:linux and event.dataset:"system.syslog" and process.name:kernel and message:segfault
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.dataset | eq |
| field:"event.dataset" kind:eq value:"system.syslog" |
message | eq |
| field:"message" kind:eq value:"segfault" |
process.name | eq |
| field:"process_basename" kind:eq value:"kernel" |
Shell Command Curl Execution via Osascript
#Detects osascript spawning shell interpreters to execute curl commands within 15 seconds. This pattern indicates malicious AppleScript workflows used for payload downloads or C2 communication.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects osascript spawning shell interpreters to execute curl commands within 15 seconds. This pattern indicates
malicious AppleScript workflows used for payload downloads or C2 communication.
"""
id = "92840250-1d07-4e8b-9a72-d2ed03dc6bc6"
license = "Elastic License v2"
name = "Shell Command Curl Execution via Osascript"
os_list = ["macos"]
version = "1.0.3"
query = '''
sequence by process.parent.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and process.args == "-c" and process.name in ("bash", "sh", "zsh") and process.parent.name == "osascript"]
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")]
'''
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.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[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 15s, correlated by process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.args == "-c" and process.name in ("bash", "sh", "zsh") and process.parent.name == "osascript"]
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")]
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.name | in |
| field:"process_basename" kind:in |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"osascript" |
Shellcode Injection with Parent as Provenance
#Identifies when a process attempts to allocate or execute shellcode from an unbacked memory and where the protection provenance of that memory region is coming from the parent process.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies when a process attempts to allocate or execute shellcode from an unbacked memory and where the protection
provenance of that memory region is coming from the parent process.
"""
id = "631df705-0636-4f83-8374-24d61307735e"
license = "Elastic License v2"
name = "Shellcode Injection with Parent as Provenance"
os_list = ["windows"]
version = "1.0.7"
query = '''
api where process.Ext.api.behaviors in ("allocate_shellcode", "shellcode") and
process.Ext.api.behaviors != "cross-process" and process.thread.Ext.call_stack_final_user_module.name == "Unbacked" and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
process.thread.Ext.call_stack_final_user_module.protection_provenance_path != null and
not (process.Ext.api.parameters.size <= 4096 and process.Ext.api.name == "VirtualProtect") and
not process.Ext.api.metadata.target_address_path : ("c:\\windows\\syswow64\\user32.dll", "c:\\windows\\syswow64\\gdi32.dll") and
startswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance_path, process.parent.executable) and
not (process.executable : "C:\\Program Files (x86)\\*.exe" and process.parent.executable : "C:\\Program Files\\*.exe") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("e9b488ad3101d386a3b2248db0c0dfe43c83fd856c55d181264da762f5352f38",
"4ad4ff7561647775372cafe7c52ba85d610dbc901a45f1a576764dfa11a9fa7a",
"10f3e16e8428f3d411f099fc4ff6e5b6f3ece29a0fc8fc606e7148e2f9bfc84b",
"83fecf04fc83a08c78e4f5faad39c4b4ecb806c2b777c58998bfc9ea560f17ca",
"6a31d5d8358cd60014233b39f33f2dda2cf6cc5c4883ba1501dc37644d2b51b4",
"83fecf04fc83a08c78e4f5faad39c4b4ecb806c2b777c58998bfc9ea560f17ca",
"33d3d3b2872d65e0584668d6d4ef1520b9fe25fe55f9e3174696274309ceb3e0",
"36c190fb1081298ca8ed7e9e2a46e9e535a265534a99283bd0ee2d144ddeeba4",
"d94ad7bcd32ec7b48fe76a4293205c6eb17191b7882a631ccb4eeabee2a96bca",
"f6ec8ebfe3ef1f9b74ecfadffa03de8fb23cdefead9cb7c87c59c0e036b85e2f",
"420efa8de496e3cfbc91910ae59f730d253280ddb2ab3daff484afc3eb0c89b6",
"0f7fd870dd2e7272b92ea5dfe88b2662d859818459a3d2c1e9d669aa1a7dddc2",
"ce4d31db584ad5ff31a8e81c735e81a42f87cd37b70cfdf3d3621a794dacf3d1",
"02f9581f9b917ac8535bce97462ad587608fd42227eae4d8ee54ab7a4bf742fd",
"b3d665fa5452b58a2238f57188aa9310a01a1e3c2b884269c2bccb0bdadabd41",
"6d72df875440edd9216e2e3f0fb500776064a6f2e412f8d118e410760dff3685",
"6a31d5d8358cd60014233b39f33f2dda2cf6cc5c4883ba1501dc37644d2b51b4",
"27c7d20101e03ec0850cdd58f89b8d5e8494e8c0790919c778947ca14ee68a0d",
"38e175cd1d4a2acd6ee0f04b2045c6260a7362a1cde2c77bca5887e0811edd2f",
"3ec7799d1f23fc6c0beea6f237f801dbdd59aac6faa7a22ecf88ba54c8fc9a80",
"e54d84398581083d4a4c2ca95056cbfffc1183d54fedfb4cf1b68bf1b4495839",
"43e216dbaf5aaad2d0b7d63dd14a9ce5b060390271e46fedbe59c671cfb28714",
"a8448fdad13341552eddecdbef4225015aa9940abe47d52d358a36f7bae57cc1",
"b18aa0c98922563f5996fb0497446873f7030d0511ffb77388ea882b4f98a924",
"ec673caa0c703cc3084887824b800502cd45b4a365c2f8d6cbc5175f0e938e1e",
"fee37bdeecc597ad9e0f13264e9ac12df3ad41f8d76a41da6e38349ed66ab35e",
"ce00bc44c975337198e7d3d353b8a1789a1221697754957752a63bbf547f1334",
"a87b3f02042de4d655f72af65ed5242fae5c675bebd19e962978c13e6d99ba00",
"85060dfab7e73f3986a4fa6148e7c14b0df55ba812c7367d85bd580837b2f7a4",
"a543689f34083f810e0184ec77d8ee9e57d44ebd6212af444853a3a89a3c82c0",
"9096bba37319bcd1b809a72cd359066788199c859a67a5d872ae1b22ed0dd842",
"b7b98dd681dfea2333a0136ba5788e38010730bb2e42eafa291b16931f00449d",
"a99cd58ec2becb2aaf2625659e42816c45e62297db468767d74f279046d98759",
"a2b2c7eb257e2be7100f735db3a772279c88ee913ffb6111b14d81685fd5f035",
"a99cd58ec2becb2aaf2625659e42816c45e62297db468767d74f279046d98759",
"f1b584d0871d1600528abdf4e6693360237c66e066dac2087e0e565d9d6a3d73",
"eb30a0075cdc0c3ddea9b22b92e4d0f275932f9fdcb10b9d4d4bd8b3c03da0be",
"d5fff843645ab47000738a36b7073f1d0e7c2cd4cc8612ce7325ef4da8cd7412",
"b6cbd6fd5caebf165ef854813a81ff800f98858a1d60cc0b6a401b21d28b622a",
"ea9afbb6e39625961698c86066dfe1ffc8ced0102360c5baa25493408af8c253",
"073453a10735f07728f0226aff69799d23aaac9a8ec9a15baee297cbd5c66cf8",
"36141b686ae3edc68e33bca2b4774539501df365b03c5703d4a74219e869aedb",
"f359110a232e73618eb0af7780d93f7b95dd269e3d12eefa9150784d95f32f91",
"e0af24d54621935df1b9956ed68f46cb92ef8c711101ba1683dfe7f41e7cdcae",
"b894515db9f9e3ad157e11c1f1e558c589c60567033880409874293cca8f8f81",
"8d3f6fe71b24882d9f51e4c298335dfd19c9acfb2473e5e0dcae5b5b4b447c4c",
"79dafa6bf1054b901448a76f7f441d4c458f5eb2b6e9ab87e39632fb313c0d84",
"c10ef947b23cc2ef4f339212123a4ac2c08df8ecb2c19658384a448427adf104",
"0cd9e13dbce7595879d9e972dc04e81da63d1cbf34c99fd3603e2aba68ccf2a5",
"91255773e0347a72a8e33c7d3d1f4ca89939d0bcc88c8c53c12872e2979b13cc",
"bf041dddc12576146b15dfe718c721901c9dfc0c041a62315058a2456a4ee854",
"23a1dde1e71d79ab7d4097c7f997a9f6fe3fd3ddaefeef267bf14554461c9bd7",
"dc2844b3ce298adf6001ce3814f43df73950aa08dda8824173c0ad158d649740",
"ad92c48ec5e6416b0986536236d5c771b63b98b84e5c1f172f1ab7a5779baac6",
"f621aa32815a28d5d1e01647522df9d9c8f5055b318cd3bd303a9cfb7eed5825",
"0801daddddc3bace3ae059513993d306cead3cca0652f7167e870f5a60f48779",
"ec53f8964b89b6e5c01df862734a97798b4eeb7b1e14c557f7c71ee72fe87779",
"da670f3718e4c465eb2382e4b3da25b479ac868056c4f532b526036786a703e9")
'''
min_endpoint_version = "8.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.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.15.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.behaviors in ("allocate_shellcode", "shellcode") and
process.Ext.api.behaviors != "cross-process" and process.thread.Ext.call_stack_final_user_module.name == "Unbacked" and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
process.thread.Ext.call_stack_final_user_module.protection_provenance_path != null and
not (process.Ext.api.parameters.size <= 4096 and process.Ext.api.name == "VirtualProtect") and
not process.Ext.api.metadata.target_address_path : ("c:\\windows\\syswow64\\user32.dll", "c:\\windows\\syswow64\\gdi32.dll") and
startswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance_path, process.parent.executable) and
not (process.executable : "C:\\Program Files (x86)\\*.exe" and process.parent.executable : "C:\\Program Files\\*.exe") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("e9b488ad3101d386a3b2248db0c0dfe43c83fd856c55d181264da762f5352f38",
"4ad4ff7561647775372cafe7c52ba85d610dbc901a45f1a576764dfa11a9fa7a",
"10f3e16e8428f3d411f099fc4ff6e5b6f3ece29a0fc8fc606e7148e2f9bfc84b",
"83fecf04fc83a08c78e4f5faad39c4b4ecb806c2b777c58998bfc9ea560f17ca",
"6a31d5d8358cd60014233b39f33f2dda2cf6cc5c4883ba1501dc37644d2b51b4",
"83fecf04fc83a08c78e4f5faad39c4b4ecb806c2b777c58998bfc9ea560f17ca",
"33d3d3b2872d65e0584668d6d4ef1520b9fe25fe55f9e3174696274309ceb3e0",
"36c190fb1081298ca8ed7e9e2a46e9e535a265534a99283bd0ee2d144ddeeba4",
"d94ad7bcd32ec7b48fe76a4293205c6eb17191b7882a631ccb4eeabee2a96bca",
"f6ec8ebfe3ef1f9b74ecfadffa03de8fb23cdefead9cb7c87c59c0e036b85e2f",
"420efa8de496e3cfbc91910ae59f730d253280ddb2ab3daff484afc3eb0c89b6",
"0f7fd870dd2e7272b92ea5dfe88b2662d859818459a3d2c1e9d669aa1a7dddc2",
"ce4d31db584ad5ff31a8e81c735e81a42f87cd37b70cfdf3d3621a794dacf3d1",
"02f9581f9b917ac8535bce97462ad587608fd42227eae4d8ee54ab7a4bf742fd",
"b3d665fa5452b58a2238f57188aa9310a01a1e3c2b884269c2bccb0bdadabd41",
"6d72df875440edd9216e2e3f0fb500776064a6f2e412f8d118e410760dff3685",
"6a31d5d8358cd60014233b39f33f2dda2cf6cc5c4883ba1501dc37644d2b51b4",
"27c7d20101e03ec0850cdd58f89b8d5e8494e8c0790919c778947ca14ee68a0d",
"38e175cd1d4a2acd6ee0f04b2045c6260a7362a1cde2c77bca5887e0811edd2f",
"3ec7799d1f23fc6c0beea6f237f801dbdd59aac6faa7a22ecf88ba54c8fc9a80",
"e54d84398581083d4a4c2ca95056cbfffc1183d54fedfb4cf1b68bf1b4495839",
"43e216dbaf5aaad2d0b7d63dd14a9ce5b060390271e46fedbe59c671cfb28714",
"a8448fdad13341552eddecdbef4225015aa9940abe47d52d358a36f7bae57cc1",
"b18aa0c98922563f5996fb0497446873f7030d0511ffb77388ea882b4f98a924",
"ec673caa0c703cc3084887824b800502cd45b4a365c2f8d6cbc5175f0e938e1e",
"fee37bdeecc597ad9e0f13264e9ac12df3ad41f8d76a41da6e38349ed66ab35e",
"ce00bc44c975337198e7d3d353b8a1789a1221697754957752a63bbf547f1334",
"a87b3f02042de4d655f72af65ed5242fae5c675bebd19e962978c13e6d99ba00",
"85060dfab7e73f3986a4fa6148e7c14b0df55ba812c7367d85bd580837b2f7a4",
"a543689f34083f810e0184ec77d8ee9e57d44ebd6212af444853a3a89a3c82c0",
"9096bba37319bcd1b809a72cd359066788199c859a67a5d872ae1b22ed0dd842",
"b7b98dd681dfea2333a0136ba5788e38010730bb2e42eafa291b16931f00449d",
"a99cd58ec2becb2aaf2625659e42816c45e62297db468767d74f279046d98759",
"a2b2c7eb257e2be7100f735db3a772279c88ee913ffb6111b14d81685fd5f035",
"a99cd58ec2becb2aaf2625659e42816c45e62297db468767d74f279046d98759",
"f1b584d0871d1600528abdf4e6693360237c66e066dac2087e0e565d9d6a3d73",
"eb30a0075cdc0c3ddea9b22b92e4d0f275932f9fdcb10b9d4d4bd8b3c03da0be",
"d5fff843645ab47000738a36b7073f1d0e7c2cd4cc8612ce7325ef4da8cd7412",
"b6cbd6fd5caebf165ef854813a81ff800f98858a1d60cc0b6a401b21d28b622a",
"ea9afbb6e39625961698c86066dfe1ffc8ced0102360c5baa25493408af8c253",
"073453a10735f07728f0226aff69799d23aaac9a8ec9a15baee297cbd5c66cf8",
"36141b686ae3edc68e33bca2b4774539501df365b03c5703d4a74219e869aedb",
"f359110a232e73618eb0af7780d93f7b95dd269e3d12eefa9150784d95f32f91",
"e0af24d54621935df1b9956ed68f46cb92ef8c711101ba1683dfe7f41e7cdcae",
"b894515db9f9e3ad157e11c1f1e558c589c60567033880409874293cca8f8f81",
"8d3f6fe71b24882d9f51e4c298335dfd19c9acfb2473e5e0dcae5b5b4b447c4c",
"79dafa6bf1054b901448a76f7f441d4c458f5eb2b6e9ab87e39632fb313c0d84",
"c10ef947b23cc2ef4f339212123a4ac2c08df8ecb2c19658384a448427adf104",
"0cd9e13dbce7595879d9e972dc04e81da63d1cbf34c99fd3603e2aba68ccf2a5",
"91255773e0347a72a8e33c7d3d1f4ca89939d0bcc88c8c53c12872e2979b13cc",
"bf041dddc12576146b15dfe718c721901c9dfc0c041a62315058a2456a4ee854",
"23a1dde1e71d79ab7d4097c7f997a9f6fe3fd3ddaefeef267bf14554461c9bd7",
"dc2844b3ce298adf6001ce3814f43df73950aa08dda8824173c0ad158d649740",
"ad92c48ec5e6416b0986536236d5c771b63b98b84e5c1f172f1ab7a5779baac6",
"f621aa32815a28d5d1e01647522df9d9c8f5055b318cd3bd303a9cfb7eed5825",
"0801daddddc3bace3ae059513993d306cead3cca0652f7167e870f5a60f48779",
"ec53f8964b89b6e5c01df862734a97798b4eeb7b1e14c557f7c71ee72fe87779",
"da670f3718e4c465eb2382e4b3da25b479ac868056c4f532b526036786a703e9")
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.api.name | eq | VirtualProtect | excludes:process.Ext.api.name field:"process.Ext.api.name" value:"VirtualProtect" |
process.Ext.api.parameters.size | le | 4096 | excludes:process.Ext.api.parameters.size field:"process.Ext.api.parameters.size" value:"4096" |
process.executable | wildcard | C:\Program Files (x86)\*.exe | excludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\*.exe" |
process.parent.executable | wildcard | C:\Program Files\*.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\*.exe" |
process.Ext.api.metadata.target_address_path | eq | c:\windows\syswow64\user32.dll, c:\windows\syswow64\gdi32.dll | excludes:process.Ext.api.metadata.target_address_path field:"process.Ext.api.metadata.target_address_path" value:"c:\windows\syswow64\user32.dll" field:"process.Ext.api.metadata.target_address_path" value:"c:\windows\syswow64\gdi32.dll" |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | in | 02f9581f9b917ac8535bce97462ad587608fd42227eae4d8ee54ab7a4bf742fd, 073453a10735f07728f0226aff69799d23aaac9a8ec9a15baee297cbd5c66cf8, 0801daddddc3bace3ae059513993d306cead3cca0652f7167e870f5a60f48779, 0cd9e13dbce7595879d9e972dc04e81da63d1cbf34c99fd3603e2aba68ccf2a5, 0f7fd870dd2e7272b92ea5dfe88b2662d859818459a3d2c1e9d669aa1a7dddc2, 10f3e16e8428f3d411f099fc4ff6e5b6f3ece29a0fc8fc606e7148e2f9bfc84b, 23a1dde1e71d79ab7d4097c7f997a9f6fe3fd3ddaefeef267bf14554461c9bd7, 27c7d20101e03ec0850cdd58f89b8d5e8494e8c0790919c778947ca14ee68a0d, 33d3d3b2872d65e0584668d6d4ef1520b9fe25fe55f9e3174696274309ceb3e0, 36141b686ae3edc68e33bca2b4774539501df365b03c5703d4a74219e869aedb, 36c190fb1081298ca8ed7e9e2a46e9e535a265534a99283bd0ee2d144ddeeba4, 38e175cd1d4a2acd6ee0f04b2045c6260a7362a1cde2c77bca5887e0811edd2f, 3ec7799d1f23fc6c0beea6f237f801dbdd59aac6faa7a22ecf88ba54c8fc9a80, 420efa8de496e3cfbc91910ae59f730d253280ddb2ab3daff484afc3eb0c89b6, 43e216dbaf5aaad2d0b7d63dd14a9ce5b060390271e46fedbe59c671cfb28714, 4ad4ff7561647775372cafe7c52ba85d610dbc901a45f1a576764dfa11a9fa7a, 6a31d5d8358cd60014233b39f33f2dda2cf6cc5c4883ba1501dc37644d2b51b4, 6d72df875440edd9216e2e3f0fb500776064a6f2e412f8d118e410760dff3685, 79dafa6bf1054b901448a76f7f441d4c458f5eb2b6e9ab87e39632fb313c0d84, 83fecf04fc83a08c78e4f5faad39c4b4ecb806c2b777c58998bfc9ea560f17ca, 85060dfab7e73f3986a4fa6148e7c14b0df55ba812c7367d85bd580837b2f7a4, 8d3f6fe71b24882d9f51e4c298335dfd19c9acfb2473e5e0dcae5b5b4b447c4c, 9096bba37319bcd1b809a72cd359066788199c859a67a5d872ae1b22ed0dd842, 91255773e0347a72a8e33c7d3d1f4ca89939d0bcc88c8c53c12872e2979b13cc, a2b2c7eb257e2be7100f735db3a772279c88ee913ffb6111b14d81685fd5f035, a543689f34083f810e0184ec77d8ee9e57d44ebd6212af444853a3a89a3c82c0, a8448fdad13341552eddecdbef4225015aa9940abe47d52d358a36f7bae57cc1, a87b3f02042de4d655f72af65ed5242fae5c675bebd19e962978c13e6d99ba00, a99cd58ec2becb2aaf2625659e42816c45e62297db468767d74f279046d98759, ad92c48ec5e6416b0986536236d5c771b63b98b84e5c1f172f1ab7a5779baac6, b18aa0c98922563f5996fb0497446873f7030d0511ffb77388ea882b4f98a924, b3d665fa5452b58a2238f57188aa9310a01a1e3c2b884269c2bccb0bdadabd41, b6cbd6fd5caebf165ef854813a81ff800f98858a1d60cc0b6a401b21d28b622a, b7b98dd681dfea2333a0136ba5788e38010730bb2e42eafa291b16931f00449d, b894515db9f9e3ad157e11c1f1e558c589c60567033880409874293cca8f8f81, bf041dddc12576146b15dfe718c721901c9dfc0c041a62315058a2456a4ee854, c10ef947b23cc2ef4f339212123a4ac2c08df8ecb2c19658384a448427adf104, ce00bc44c975337198e7d3d353b8a1789a1221697754957752a63bbf547f1334, ce4d31db584ad5ff31a8e81c735e81a42f87cd37b70cfdf3d3621a794dacf3d1, d5fff843645ab47000738a36b7073f1d0e7c2cd4cc8612ce7325ef4da8cd7412, d94ad7bcd32ec7b48fe76a4293205c6eb17191b7882a631ccb4eeabee2a96bca, da670f3718e4c465eb2382e4b3da25b479ac868056c4f532b526036786a703e9, dc2844b3ce298adf6001ce3814f43df73950aa08dda8824173c0ad158d649740, e0af24d54621935df1b9956ed68f46cb92ef8c711101ba1683dfe7f41e7cdcae, e54d84398581083d4a4c2ca95056cbfffc1183d54fedfb4cf1b68bf1b4495839, e9b488ad3101d386a3b2248db0c0dfe43c83fd856c55d181264da762f5352f38, ea9afbb6e39625961698c86066dfe1ffc8ced0102360c5baa25493408af8c253, eb30a0075cdc0c3ddea9b22b92e4d0f275932f9fdcb10b9d4d4bd8b3c03da0be, ec53f8964b89b6e5c01df862734a97798b4eeb7b1e14c557f7c71ee72fe87779, ec673caa0c703cc3084887824b800502cd45b4a365c2f8d6cbc5175f0e938e1e, f1b584d0871d1600528abdf4e6693360237c66e066dac2087e0e565d9d6a3d73, f359110a232e73618eb0af7780d93f7b95dd269e3d12eefa9150784d95f32f91, f621aa32815a28d5d1e01647522df9d9c8f5055b318cd3bd303a9cfb7eed5825, f6ec8ebfe3ef1f9b74ecfadffa03de8fb23cdefead9cb7c87c59c0e036b85e2f, fee37bdeecc597ad9e0f13264e9ac12df3ad41f8d76a41da6e38349ed66ab35e | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
Spike in Number of Processes in an RDP Session
#A machine learning job has detected unusually high number of processes started in a single RDP session. Executing a large number of processes remotely on other machines can be an indicator of lateral movement activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Rule Body
[metadata]
creation_date = "2023/10/12"
integration = ["lmd", "endpoint"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 70
author = ["Elastic"]
description = """
A machine learning job has detected unusually high number of processes started in a single RDP session. Executing a
large number of processes remotely on other machines can be an indicator of lateral movement activity.
"""
from = "now-12h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "lmd_high_sum_rdp_number_of_processes_ea"
name = "Spike in Number of Processes in an RDP Session"
references = [
"https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
"https://docs.elastic.co/en/integrations/lmd",
"https://www.elastic.co/blog/detecting-lateral-movement-activity-a-new-kibana-integration",
"https://www.elastic.co/blog/remote-desktop-protocol-connections-elastic-security",
]
risk_score = 21
rule_id = "19e9daf3-f5c5-4bc2-a9af-6b1e97098f03"
setup = """## Setup
This rule requires the `host.ip` field to be populated.
For **Elastic Defend** events on versions **8.18 and above**, this field is **disabled by default**.
If you are using **Elastic Defend**, ensure host IP collection is enabled by following the configuration steps in the
[helper guide](https://www.elastic.co/docs/solutions/security/configure-elastic-defend/configure-data-volume-for-elastic-endpoint#host-fields).
The rule requires the Lateral Movement Detection integration assets to be installed, as well as file and Windows RDP process events collected by the Elastic Defend integration.
### Lateral Movement Detection Setup
The Lateral Movement Detection integration detects lateral movement activity by identifying abnormalities in file and Windows RDP events. Anomalies are detected using Elastic's Anomaly Detection feature.
#### Prerequisite Requirements:
- Fleet is required for Lateral Movement Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Windows RDP process events collected by the [Elastic Defend](https://docs.elastic.co/en/integrations/endpoint) integration.
- To install Elastic Defend, refer to the [documentation](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
#### The following steps should be executed to install assets associated with the Lateral Movement Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Lateral Movement Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
"Data Source: Elastic Defend",
"Use Case: Lateral Movement Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Lateral Movement",
"Resources: Investigation Guide",
]
type = "machine_learning"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Spike in Number of Processes in an RDP Session
Remote Desktop Protocol (RDP) allows users to connect to other computers over a network, facilitating remote work and administration. However, adversaries can exploit RDP for lateral movement by executing numerous processes on a target machine. The detection rule leverages machine learning to identify anomalies in process activity during RDP sessions, flagging potential exploitation attempts indicative of lateral movement tactics.
### Possible investigation steps
- Review the specific RDP session details, including the source and destination IP addresses, to identify the involved machines and users.
- Analyze the list of processes that were started during the RDP session to identify any unusual or suspicious processes that are not typically associated with legitimate remote work activities.
- Check the user account associated with the RDP session for any signs of compromise, such as recent password changes or unusual login times.
- Correlate the detected spike in processes with other security events or logs, such as firewall logs or intrusion detection system alerts, to identify any related suspicious activities.
- Investigate the network traffic between the source and destination machines during the RDP session to detect any anomalies or unauthorized data transfers.
- Review historical data for the involved user and machines to determine if similar spikes in process activity have occurred in the past, which could indicate a pattern of malicious behavior.
### False positive analysis
- High-volume automated tasks or scripts executed during RDP sessions can trigger false positives. Identify and document these tasks, then create exceptions in the detection rule to exclude them from analysis.
- Routine administrative activities, such as software updates or system maintenance, may result in a spike in processes. Regularly review and whitelist these activities to prevent unnecessary alerts.
- Scheduled batch jobs or data processing tasks that run during RDP sessions can be mistaken for lateral movement. Ensure these are logged and excluded from the rule's scope by setting up appropriate filters.
- Development or testing environments where multiple processes are frequently started as part of normal operations can lead to false positives. Clearly define these environments and adjust the rule to ignore such sessions.
### Response and remediation
- Isolate the affected machine from the network to prevent further lateral movement and contain the threat.
- Terminate any suspicious or unauthorized processes identified during the RDP session to halt potential malicious activity.
- Conduct a thorough review of the affected machine's security logs to identify any additional indicators of compromise or related suspicious activity.
- Reset credentials for any accounts that were used during the suspicious RDP session to prevent unauthorized access.
- Apply security patches and updates to the affected machine and any other vulnerable systems to mitigate exploitation of known vulnerabilities.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are compromised.
- Enhance monitoring and detection capabilities for RDP sessions by implementing stricter access controls and logging to detect similar anomalies in the future."""
[[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.001"
name = "Remote Desktop Protocol"
reference = "https://attack.mitre.org/techniques/T1021/001/"
[[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/"
Sudo Command Enumeration Detected
#This rule monitors for the usage of the sudo -l command, which is used to list the allowed and forbidden commands for the invoking user. Attackers may execute this command to enumerate commands allowed to be executed with sudo permissions, potentially allowing to escalate privileges to root.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation | |
| Discovery |
Rule Body
[metadata]
creation_date = "2023/08/30"
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the usage of the sudo -l command, which is used to list the allowed and forbidden commands for
the invoking user. Attackers may execute this command to enumerate commands allowed to be executed with sudo
permissions, potentially allowing to escalate privileges to root.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Sudo Command Enumeration Detected"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Sudo Command Enumeration Detected
The sudo command in Linux environments allows users to execute commands with elevated privileges, typically as the root user. Attackers may exploit this by using the `sudo -l` command to list permissible commands, potentially identifying paths to escalate privileges. The detection rule identifies this behavior by monitoring for the execution of `sudo -l` from common shell environments, flagging potential misuse for privilege escalation.
### Possible investigation steps
- Review the process execution details to confirm the presence of the `sudo -l` command, ensuring the process name is "sudo" and the arguments include "-l" with an argument count of 2.
- Identify the parent process of the `sudo` command to determine the shell environment used, checking if it matches any of the specified shells like "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", or "fish".
- Investigate the user account that executed the `sudo -l` command to assess if the activity aligns with their typical behavior or if it appears suspicious.
- Check for any recent changes in user permissions or sudoers configuration that might indicate unauthorized modifications.
- Correlate this event with other logs or alerts to identify any subsequent suspicious activities that might suggest privilege escalation attempts.
### False positive analysis
- System administrators frequently use the sudo -l command to verify their permissions. To reduce noise, consider excluding specific user accounts or groups known for legitimate use.
- Automated scripts or configuration management tools may execute sudo -l as part of routine checks. Identify these scripts and exclude their execution paths or parent processes from the rule.
- Some software installations or updates might invoke sudo -l to check permissions. Monitor and document these processes, then create exceptions for known benign software.
- Developers or testers might use sudo -l during debugging or testing phases. Coordinate with development teams to identify and exclude these activities when they are part of approved workflows.
### Response and remediation
- Immediately isolate the affected system from the network to prevent potential lateral movement by the attacker.
- Review the sudoers file on the affected system to identify any unauthorized or suspicious entries that may have been added or modified, and revert any changes to their original state.
- Terminate any suspicious processes initiated by the user who executed the `sudo -l` command, especially if they are not part of normal operations.
- Reset the password of the user account involved in the alert to prevent further unauthorized access.
- Conduct a thorough review of system logs to identify any additional suspicious activity or commands executed by the user, and assess the scope of potential compromise.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems may be affected.
- Implement additional monitoring and alerting for similar `sudo -l` command executions across the environment to enhance detection and response capabilities."""
risk_score = 21
rule_id = "28d39238-0c01-420a-b77a-24e5a7378663"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Data Source: Elastic Defend",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
"Data Source: Elastic Endgame",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and process.name == "sudo" and process.args == "-l" and
process.args_count == 2 and process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
not process.args == "dpkg"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1033"
name = "System Owner/User Discovery"
reference = "https://attack.mitre.org/techniques/T1033/"
[[rule.threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"
[[rule.threat.technique.subtechnique]]
id = "T1069.001"
name = "Local Groups"
reference = "https://attack.mitre.org/techniques/T1069/001/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[rule.threat.technique.subtechnique]]
id = "T1548.003"
name = "Sudo and Sudo Caching"
reference = "https://attack.mitre.org/techniques/T1548/003/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and process.name == "sudo" and process.args == "-l" and
process.args_count == 2 and process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
not process.args == "dpkg"
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 | eq |
| field:"process.args" kind:eq value:"-l" |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"2" |
process.name | eq |
| field:"process_basename" kind:eq value:"sudo" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | dpkg | excludes:process.args field:"process.args" value:"dpkg" |
Suspicious Execution via a Mounted Image File
#Identifies the execution of a process from a mounted image file. Attacker may abuse IMG files to deliver malicious programs.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule Body
[rule]
description = """
Identifies the execution of a process from a mounted image file. Attacker may abuse IMG files to deliver malicious
programs.
"""
id = "9401d27c-200a-4d72-ad36-f7051c4b3dcb"
license = "Elastic License v2"
name = "Suspicious Execution via a Mounted Image File"
os_list = ["windows"]
version = "1.0.29"
query = '''
process where event.action == "start" and
process.parent.executable : "\\Device\\CdRom0\\*" and
not process.executable : ("?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"\\Device\\CdRom0\\*") and
not process.code_signature.trusted == true and
not (process.parent.name : "setup.exe" and process.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\*.tmp\\setup.tmp") and
not process.executable : "?:\\WINDOWS\\regtlib.exe" and
not process.hash.sha256 :
("632c8f0313f35fc45daa4471f9c8c32075156bc696fb20cd19a33a8c760b1297",
"5b82b27da9bbaae1abc32095942c60017b275e002cbb2c0cb44580131f4789b4",
"dafb5d89135fa565080c9c6beafbdeb7611089e946a520001a7ef02facb002d3",
"18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25",
"ab9e0291a763efc32e84e7117f9a0fbc99b681c96df0bb27a66433a726667e5c")
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.executable : "\\Device\\CdRom0\\*" and
not process.executable : ("?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"\\Device\\CdRom0\\*") and
not process.code_signature.trusted == true and
not (process.parent.name : "setup.exe" and process.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\*.tmp\\setup.tmp") and
not process.executable : "?:\\WINDOWS\\regtlib.exe" and
not process.hash.sha256 :
("632c8f0313f35fc45daa4471f9c8c32075156bc696fb20cd19a33a8c760b1297",
"5b82b27da9bbaae1abc32095942c60017b275e002cbb2c0cb44580131f4789b4",
"dafb5d89135fa565080c9c6beafbdeb7611089e946a520001a7ef02facb002d3",
"18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25",
"ab9e0291a763efc32e84e7117f9a0fbc99b681c96df0bb27a66433a726667e5c")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard value:"\Device\CdRom0\*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\Users\*\AppData\Local\Temp\*.tmp\setup.tmp | excludes:process.executable field:"process.executable" value:"?:\Users\*\AppData\Local\Temp\*.tmp\setup.tmp" |
process.parent.name | eq | setup.exe | excludes:process.parent.name field:"process.parent.name" value:"setup.exe" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | eq | ?:\WINDOWS\regtlib.exe | excludes:process.executable field:"process.executable" value:"?:\WINDOWS\regtlib.exe" |
process.executable | wildcard | ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, \Device\CdRom0\* | excludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe" field:"process.executable" value:"\Device\CdRom0\*" |
process.hash.sha256 | eq | 632c8f0313f35fc45daa4471f9c8c32075156bc696fb20cd19a33a8c760b1297, 5b82b27da9bbaae1abc32095942c60017b275e002cbb2c0cb44580131f4789b4, dafb5d89135fa565080c9c6beafbdeb7611089e946a520001a7ef02facb002d3, 18d1bae077da62bb5cf5bfa6a6c5c38ac9ade57f098ea2b357fab477e85f1c25, ab9e0291a763efc32e84e7117f9a0fbc99b681c96df0bb27a66433a726667e5c | excludes:process.hash.sha256 |
Unusual Linux Network Port Activity
#Identifies unusual destination port activity that can indicate command-and-control, persistence mechanism, or data exfiltration activity. Rarely used destination port activity is generally unusual in Linux fleets, and can indicate unauthorized access or threat actor activity.
Known False Positives
- A newly installed program or one that rarely uses the network could trigger this alert.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Command & Control | |
| Exfiltration |
Rule Body
[metadata]
creation_date = "2020/03/25"
integration = ["endpoint", "network_traffic"]
maturity = "production"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
updated_date = "2026/07/27"
[rule]
anomaly_threshold = 50
author = ["Elastic"]
description = """
Identifies unusual destination port activity that can indicate command-and-control, persistence mechanism, or data
exfiltration activity. Rarely used destination port activity is generally unusual in Linux fleets, and can indicate
unauthorized access or threat actor activity.
"""
false_positives = ["A newly installed program or one that rarely uses the network could trigger this alert."]
from = "now-45m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = ["v3_linux_anomalous_network_port_activity_ea"]
name = "Unusual Linux Network Port Activity"
setup = """## Setup
This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
- Elastic Defend
- Network Packet Capture
### Anomaly Detection Setup
Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration to your system:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
### Network Packet Capture Integration Setup
The Network Packet Capture integration sniffs network packets on a host and dissects known protocols. Monitoring the network traffic is critical to gaining observability and securing your environment — ensuring high levels of performance and security. The Network Packet Capture integration captures the network traffic between your application servers, decodes common application layer protocols and records the interesting fields for each transaction.
#### The following steps should be executed in order to add the Elastic Agent System integration "network_traffic" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Network Packet Capture” and select the integration to see more details about it.
- Click “Add Network Packet Capture”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “network_traffic” to an existing or a new agent policy, and deploy the agent on your system from which network log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/network_traffic).
"""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "3c7e32e6-6104-46d9-a06e-da0f8b5795a0"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Data Source: Elastic Defend",
"Data Source: Network Packet Capture",
"Use Case: Threat Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Resources: Investigation Guide",
]
type = "machine_learning"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Unusual Linux Network Port Activity
In Linux environments, network ports facilitate communication between applications and services. Adversaries may exploit rarely used ports for covert command-and-control, persistence, or data exfiltration, bypassing standard monitoring. The 'Unusual Linux Network Port Activity' detection rule leverages machine learning to identify anomalies in port usage, flagging potential unauthorized access or threat actor activity by highlighting deviations from typical network behavior.
### Possible investigation steps
- Review the alert details to identify the specific unusual destination port and the associated source and destination IP addresses.
- Check historical network logs to determine if the identified port has been used previously and assess the frequency and context of its usage.
- Investigate the source IP address to determine if it is associated with known internal systems or if it is an external or unexpected source.
- Analyze the destination IP address to verify if it is a legitimate endpoint within the network or an external entity that requires further scrutiny.
- Correlate the unusual port activity with any recent changes or updates in the network environment that might explain the anomaly.
- Examine any related process or application logs on the involved Linux systems to identify the application or service responsible for the network activity.
- Consider reaching out to the system owner or administrator for additional context or to verify if the activity is expected or authorized.
### False positive analysis
- Routine administrative tasks may trigger alerts when using non-standard ports for legitimate purposes. Users can create exceptions for known administrative tools and scripts that consistently use these ports.
- Internal applications or services might use uncommon ports for inter-service communication. Identify these applications and whitelist their port usage to prevent unnecessary alerts.
- Security tools and monitoring solutions sometimes scan or probe network ports as part of their operations. Recognize these tools and exclude their activities from the rule to avoid false positives.
- Development and testing environments often experiment with various port configurations. Establish a separate monitoring profile for these environments to reduce noise in production alerts.
- Custom or legacy applications may operate on non-standard ports due to historical configurations. Document these applications and adjust the rule to accommodate their expected behavior.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Conduct a thorough review of the system's network connections and terminate any suspicious or unauthorized connections.
- Analyze system logs to identify any malicious processes or scripts that may have been executed, and remove or quarantine any identified threats.
- Change all credentials associated with the affected system, especially if there is any indication of credential compromise.
- Restore the system from a known good backup if any unauthorized changes or malware are detected.
- Implement network segmentation to limit the exposure of critical systems to potential threats and reduce the risk of lateral movement.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[rule.threat.technique]]
id = "T1571"
name = "Non-Standard Port"
reference = "https://attack.mitre.org/techniques/T1571/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1205"
name = "Traffic Signaling"
reference = "https://attack.mitre.org/techniques/T1205/"
[[rule.threat.technique.subtechnique]]
id = "T1205.001"
name = "Port Knocking"
reference = "https://attack.mitre.org/techniques/T1205/001/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1041"
name = "Exfiltration Over C2 Channel"
reference = "https://attack.mitre.org/techniques/T1041/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
Unusual Network Activity from a Windows System Binary
#Identifies network activity from unexpected system applications. This may indicate adversarial activity as these applications are often leveraged by adversaries to execute code and evade detection.
MITRE ATT&CK Coverage
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2020/09/02"
integration = ["endpoint", "windows"]
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 network activity from unexpected system applications. This may indicate adversarial activity as these
applications are often leveraged by adversaries to execute code and evade detection.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process-*",
"logs-endpoint.events.network-*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*"
]
language = "eql"
license = "Elastic License v2"
name = "Unusual Network Activity from a Windows System Binary"
note = """## Triage and analysis
### Investigating Unusual Network Activity from a Windows System Binary
Attackers can abuse certain trusted developer utilities to proxy the execution of malicious payloads. Since these utilities are usually signed, they can bypass the security controls that were put in place to prevent or detect direct execution.
This rule identifies network connections established by trusted developer utilities, which can indicate abuse to execute payloads or process masquerading.
> **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 abnormal behaviors observed by the subject process, such as registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- 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.
### False positive analysis
- As trusted developer utilities have dual-use purposes, alerts derived from this rule are not essentially malicious. If these utilities are contacting internal or known trusted domains, review their security and consider creating exceptions if the domain is safe.
### 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.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- If 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.
- If the malicious file was delivered via phishing:
- Block the email sender from sending future emails.
- Block the malicious web pages.
- Remove emails from the sender from mailboxes.
- Consider improvements to the security awareness program.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Sysmon Event ID 22 - DNS Query](https://ela.st/sysmon-event-22-setup)
"""
risk_score = 47
rule_id = "1fe3b299-fbb5-4657-a937-1d746f2c711a"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
]
type = "eql"
query = '''
sequence by process.entity_id with maxspan=1m
[process where host.os.type == "windows" and event.type == "start" and
/* known applocker bypasses */
(process.name : "bginfo.exe" or
process.name : "cdb.exe" or
process.name : "control.exe" or
process.name : "cmstp.exe" or
process.name : "csi.exe" or
process.name : "dnx.exe" or
process.name : "fsi.exe" or
process.name : "ieexec.exe" or
process.name : "iexpress.exe" or
process.name : "installutil.exe" or
process.name : "Microsoft.Workflow.Compiler.exe" or
process.name : "MSBuild.exe" or
process.name : "msdt.exe" or
process.name : "mshta.exe" or
process.name : "wscript.exe" or
process.name : "msiexec.exe" or
process.name : "msxsl.exe" or
process.name : "odbcconf.exe" or
process.name : "rcsi.exe" or
process.name : "regsvr32.exe" or
process.name : "xwizard.exe") and
not (process.name : "mshta.exe" and
process.parent.executable : ("C:\\Program Files (x86)\\Bentley\\*.exe",
"C:\\Program Files\\Bentley\\*.exe",
"C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe",
"C:\\Users\\*\\AppData\\Local\\Temp\\TeamViewer\\TeamViewer.exe"))
]
[network where dns.question.name != null and
not dns.question.name : ("localhost", "setup.officetimeline.com", "us.deployment.endpoint.ingress.rapid7.com",
"ctldl.windowsupdate.com", "crl?.digicert.com", "ocsp.digicert.com", "addon-cms-asl.eu.goskope.com", "crls.ssl.com",
"evcs-ocsp.ws.symantec.com", "s.symcd.com", "s?.symcb.com", "crl.verisign.com", "oneocsp.microsoft.com", "crl.verisign.com",
"aka.ms", "crl.comodoca.com", "acroipm2.adobe.com", "sv.symcd.com", "_ldap._tcp.*", "..localmachine", "secure.globalsign.com",
"acroipm2.adobe.com", "www.ssl.com", "ocsp.digicert.com", "ocsp.verisign.com", "ocsp.comodoca.com", "ocsp.entrust.net", "ocsp.usertrust.com",
"ocsp.godaddy.com", "ocsp.camerfirma.com", "ocsp.globalsign.com", "ocsp.sectigo.com", "*.local") and
not (process.name : "mshta.exe" and
dns.question.name : ("client.teamviewer.com", "www.teamviewer.com", "images-na.ssl-images-amazon.com", "searcherbar.tilda.ws")) and
/* host query itself */
not startswith~(dns.question.name, host.name)
]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[[rule.threat.technique]]
id = "T1127"
name = "Trusted Developer Utilities Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1127/"
[[rule.threat.technique.subtechnique]]
id = "T1127.001"
name = "MSBuild"
reference = "https://attack.mitre.org/techniques/T1127/001/"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.002"
name = "Control Panel"
reference = "https://attack.mitre.org/techniques/T1218/002/"
[[rule.threat.technique.subtechnique]]
id = "T1218.003"
name = "CMSTP"
reference = "https://attack.mitre.org/techniques/T1218/003/"
[[rule.threat.technique.subtechnique]]
id = "T1218.004"
name = "InstallUtil"
reference = "https://attack.mitre.org/techniques/T1218/004/"
[[rule.threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[[rule.threat.technique.subtechnique]]
id = "T1218.007"
name = "Msiexec"
reference = "https://attack.mitre.org/techniques/T1218/007/"
[[rule.threat.technique.subtechnique]]
id = "T1218.008"
name = "Odbcconf"
reference = "https://attack.mitre.org/techniques/T1218/008/"
[[rule.threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
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.name : "bginfo.exe" or
process.name : "cdb.exe" or
process.name : "control.exe" or
process.name : "cmstp.exe" or
process.name : "csi.exe" or
process.name : "dnx.exe" or
process.name : "fsi.exe" or
process.name : "ieexec.exe" or
process.name : "iexpress.exe" or
process.name : "installutil.exe" or
process.name : "Microsoft.Workflow.Compiler.exe" or
process.name : "MSBuild.exe" or
process.name : "msdt.exe" or
process.name : "mshta.exe" or
process.name : "wscript.exe" or
process.name : "msiexec.exe" or
process.name : "msxsl.exe" or
process.name : "odbcconf.exe" or
process.name : "rcsi.exe" or
process.name : "regsvr32.exe" or
process.name : "xwizard.exe") and
not (process.name : "mshta.exe" and
process.parent.executable : ("C:\\Program Files (x86)\\Bentley\\*.exe",
"C:\\Program Files\\Bentley\\*.exe",
"C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe",
"C:\\Users\\*\\AppData\\Local\\Temp\\TeamViewer\\TeamViewer.exe"))
]
Stage 2: network
[network where dns.question.name != null and
not dns.question.name : ("localhost", "setup.officetimeline.com", "us.deployment.endpoint.ingress.rapid7.com",
"ctldl.windowsupdate.com", "crl?.digicert.com", "ocsp.digicert.com", "addon-cms-asl.eu.goskope.com", "crls.ssl.com",
"evcs-ocsp.ws.symantec.com", "s.symcd.com", "s?.symcb.com", "crl.verisign.com", "oneocsp.microsoft.com", "crl.verisign.com",
"aka.ms", "crl.comodoca.com", "acroipm2.adobe.com", "sv.symcd.com", "_ldap._tcp.*", "..localmachine", "secure.globalsign.com",
"acroipm2.adobe.com", "www.ssl.com", "ocsp.digicert.com", "ocsp.verisign.com", "ocsp.comodoca.com", "ocsp.entrust.net", "ocsp.usertrust.com",
"ocsp.godaddy.com", "ocsp.camerfirma.com", "ocsp.globalsign.com", "ocsp.sectigo.com", "*.local") and
not (process.name : "mshta.exe" and
dns.question.name : ("client.teamviewer.com", "www.teamviewer.com", "images-na.ssl-images-amazon.com", "searcherbar.tilda.ws")) and
not startswith~(dns.question.name, host.name)
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | is_not_null | field:"QueryName" kind:is_not_null | |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | eq | mshta.exe | excludes:process.name field:"process.name" value:"mshta.exe" |
process.parent.executable | wildcard | C:\Program Files (x86)\Bentley\*.exe, C:\Program Files\Bentley\*.exe, C:\Program Files (x86)\Amazon\Amazon Assistant\amazonAssistantService.exe, C:\Users\*\AppData\Local\Temp\TeamViewer\TeamViewer.exe | excludes:process.parent.executable |
dns.question.name | eq | client.teamviewer.com, www.teamviewer.com, images-na.ssl-images-amazon.com, searcherbar.tilda.ws | excludes:dns.question.name |
dns.question.name | starts_with | host.name | excludes:dns.question.name field:"dns.question.name" value:"host.name" |
dns.question.name | wildcard | localhost, setup.officetimeline.com, us.deployment.endpoint.ingress.rapid7.com, ctldl.windowsupdate.com, crl?.digicert.com, ocsp.digicert.com, addon-cms-asl.eu.goskope.com, crls.ssl.com, evcs-ocsp.ws.symantec.com, s.symcd.com, s?.symcb.com, crl.verisign.com, oneocsp.microsoft.com, crl.verisign.com, aka.ms, crl.comodoca.com, acroipm2.adobe.com, sv.symcd.com, _ldap._tcp.*, ..localmachine, secure.globalsign.com, acroipm2.adobe.com, www.ssl.com, ocsp.digicert.com, ocsp.verisign.com, ocsp.comodoca.com, ocsp.entrust.net, ocsp.usertrust.com, ocsp.godaddy.com, ocsp.camerfirma.com, ocsp.globalsign.com, ocsp.sectigo.com, *.local | excludes:dns.question.name |
Unusual SSH Parent/Child Execution
#This rule detects the execution of a process from an unusual location, immediately after an SSH process is started. This could indicate an attacker attempting to execute a malicious process in the context of an SSH session, or a successfully planted backdoor within a user shell configuration.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Credential Access | |
| Lateral Movement |
Rule Body
[rule]
description = """
This rule detects the execution of a process from an unusual location, immediately after an SSH process is started. This
could indicate an attacker attempting to execute a malicious process in the context of an SSH session, or a successfully
planted backdoor within a user shell configuration.
"""
id = "94f548c8-cad2-4bc5-bf61-c0e42558ef65"
license = "Elastic License v2"
name = "Unusual SSH Parent/Child Execution"
os_list = ["linux"]
version = "1.0.18"
query = '''
sequence with maxspan=3s
[process where event.type == "start" and event.action == "exec" and process.parent.name in ("sshd", "ssh") and
not process.executable like ("/run/*/newroot/*", "/srv/snp/docker/*", "/tmp/newroot/*")
] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.executable like (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*"
) and process.args_count == 1 and not (
process.executable like~ (
"/tmp/VeeamApp*", "/run/containerd/io.containerd.runtime.v2.task/k8s.io/*", "/tmp/.mount_nvim.*",
"./merged/var/lib/containers/*", "/run/systemd/mount-rootfs/*", "./merged/*/containers/*",
"/run/k3s/containerd/io.containerd.runtime.v2.task/*", "/tmp/.mount_*", "/tmp/usr/bin/groups",
"./merged/usr/bin/clear"
) or
process.parent.executable like (
"./merged/bin/bash", "/tmp/nsjail*", "/run/user/1000/nsjail/*", "/usr/bin/run-parts", "/usr/bin/env"
) or
process.parent.command_line in (
"bash -c /bin/bash; uname -a &> /dev/null",
"sh -c /usr/local/bin/sshd-with-logs"
) or
process.parent.name == "jem" or
process.name == "sestatus" or
(
process.parent.command_line == "sudo true" and
process.command_line == "true"
) or
(
process.parent.executable == "/usr/bin/ctest" and
process.parent.command_line like "ctest --test-dir /tmp/* --output-on-failure*"
)
)
] by process.parent.entity_id
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1037"
name = "Boot or Logon Initialization Scripts"
reference = "https://attack.mitre.org/techniques/T1037/"
[[threat.technique]]
id = "T1554"
name = "Compromise Host Software Binary"
reference = "https://attack.mitre.org/techniques/T1554/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[threat.technique.subtechnique]]
id = "T1021.004"
name = "SSH"
reference = "https://attack.mitre.org/techniques/T1021/004/"
[[threat.technique]]
id = "T1563"
name = "Remote Service Session Hijacking"
reference = "https://attack.mitre.org/techniques/T1563/"
[[threat.technique.subtechnique]]
id = "T1563.001"
name = "SSH Hijacking"
reference = "https://attack.mitre.org/techniques/T1563/001/"
[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 3s, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.parent.name in ("sshd", "ssh") and
not process.executable like ("/run/*/newroot/*", "/srv/snp/docker/*", "/tmp/newroot/*")
] by process.entity_id
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.executable like (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*"
) and process.args_count == 1 and not (
process.executable like~ (
"/tmp/VeeamApp*", "/run/containerd/io.containerd.runtime.v2.task/k8s.io/*", "/tmp/.mount_nvim.*",
"./merged/var/lib/containers/*", "/run/systemd/mount-rootfs/*", "./merged/*/containers/*",
"/run/k3s/containerd/io.containerd.runtime.v2.task/*", "/tmp/.mount_*", "/tmp/usr/bin/groups",
"./merged/usr/bin/clear"
) or
process.parent.executable like (
"./merged/bin/bash", "/tmp/nsjail*", "/run/user/1000/nsjail/*", "/usr/bin/run-parts", "/usr/bin/env"
) or
process.parent.command_line in (
"bash -c /bin/bash; uname -a &> /dev/null",
"sh -c /usr/local/bin/sshd-with-logs"
) or
process.parent.name == "jem" or
process.name == "sestatus" or
(
process.parent.command_line == "sudo true" and
process.command_line == "true"
) or
(
process.parent.executable == "/usr/bin/ctest" and
process.parent.command_line like "ctest --test-dir /tmp/* --output-on-failure*"
)
)
] 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_count | eq |
| field:"process.args_count" kind:eq value:"1" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
User account exposed to Kerberoasting
#Detects when a user account has the servicePrincipalName attribute modified. Attackers can abuse write privileges over a user to configure Service Principle Names (SPNs) so that they can perform Kerberoasting. Administrators can also configure this for legitimate purposes, exposing the account to Kerberoasting.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Credential Access |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Security-Auditing | Event ID 5136: A directory service object was modified. |
Rule Body
[metadata]
creation_date = "2022/02/22"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Detects when a user account has the servicePrincipalName attribute modified. Attackers can abuse write privileges over a
user to configure Service Principle Names (SPNs) so that they can perform Kerberoasting. Administrators can also
configure this for legitimate purposes, exposing the account to Kerberoasting.
"""
from = "now-9m"
index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
language = "kuery"
license = "Elastic License v2"
name = "User account exposed to Kerberoasting"
note = """## Triage and analysis
### Investigating User account exposed to Kerberoasting
Service Principal Names (SPNs) are names by which Kerberos clients uniquely identify service instances for Kerberos target computers.
By default, only computer accounts have SPNs, which creates no significant risk, since machine accounts have a default domain policy that rotates their passwords every 30 days, and the password is composed of 120 random characters, making them invulnerable to Kerberoasting.
A user account with an SPN assigned is considered a service account, and is accessible to the entire domain. If any user in the directory requests a ticket-granting service (TGS), the domain controller will encrypt it with the secret key of the account executing the service. An attacker can potentially perform a Kerberoasting attack with this information, as the human-defined password is likely to be less complex.
For scenarios where SPNs cannot be avoided on user accounts, Microsoft provides the Group Managed Service Accounts (gMSA) feature, which ensures that account passwords are robust and changed regularly and automatically. More information can be found [here](https://docs.microsoft.com/en-us/windows-server/security/group-managed-service-accounts/group-managed-service-accounts-overview).
Attackers can also perform "Targeted Kerberoasting", which consists of adding fake SPNs to user accounts that they have write privileges to, making them potentially vulnerable to Kerberoasting.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate if the target account is a member of privileged groups (Domain Admins, Enterprise Admins, etc.).
- Investigate if tickets have been requested for the target account.
- Investigate other alerts associated with the user/host during the past 48 hours.
### False positive analysis
- The use of user accounts as service accounts is a bad security practice and should not be allowed in the domain. The security team should map and monitor any potential benign true positive (B-TP), especially if the account is privileged. Domain Administrators that define this kind of setting can put the domain at risk as user accounts don't have the same security standards as computer accounts (which have long, complex, random passwords that change frequently), exposing them to credential cracking attacks (Kerberoasting, brute force, etc.).
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services. Prioritize privileged accounts.
- Isolate the involved hosts to prevent further post-compromise behavior.
- 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).
"""
references = [
"https://www.thehacker.recipes/ad/movement/access-controls/targeted-kerberoasting",
"https://www.qomplx.com/qomplx-knowledge-kerberoasting-attacks-explained/",
"https://www.thehacker.recipes/ad/movement/kerberos/kerberoast",
"https://attack.stealthbits.com/cracking-kerberos-tgs-tickets-using-kerberoasting",
"https://adsecurity.org/?p=280",
"https://github.com/OTRF/Set-AuditRule",
]
risk_score = 47
rule_id = "0b2f3da5-b5ec-47d1-908b-6ebb74814289"
setup = """## Setup
Audit Directory Service Changes must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-directory-service-changes
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Active Directory",
"Resources: Investigation Guide",
"Use Case: Active Directory Monitoring",
"Data Source: Windows Security Event Logs",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.code:5136 and host.os.type:"windows" and winlog.event_data.OperationType:"%%14674" and
winlog.event_data.ObjectClass:"user" and
winlog.event_data.AttributeLDAPDisplayName:"servicePrincipalName"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1558"
name = "Steal or Forge Kerberos Tickets"
reference = "https://attack.mitre.org/techniques/T1558/"
[[rule.threat.technique.subtechnique]]
id = "T1558.003"
name = "Kerberoasting"
reference = "https://attack.mitre.org/techniques/T1558/003/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: query
event.code:5136 and host.os.type:"windows" and winlog.event_data.OperationType:"%%14674" and
winlog.event_data.ObjectClass:"user" and
winlog.event_data.AttributeLDAPDisplayName:"servicePrincipalName"
Indicators
These rows show field, operator, and value matches.