Detection rules › Elastic
Elastic rules: 2q
AWS EC2 Export Task
#Identifies successful export tasks of EC2 instances via the APIs CreateInstanceExportTask, ExportImage, or CreateStoreImageTask. These exports can be used by administrators for legitimate VM migration or backup workflows however, an attacker with access to an EC2 instance or AWS credentials can export a VM or its image and then transfer it off-account for exfiltration of data.
Known False Positives
- VM export and EC2 image creation may be done by system administrators, DevOps or migration teams as part of planned maintenance, disaster-recovery or known backup methods. Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Exports 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
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS EC2 Image Monitoring (Panther)
- AWS EC2 VM Export Failure (Sigma)
- AWS Modify Cloud Compute Infrastructure (Panther)
Rule Body
[metadata]
creation_date = "2025/10/23"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Identifies successful export tasks of EC2 instances via the APIs CreateInstanceExportTask, ExportImage, or
CreateStoreImageTask. These exports can be used by administrators for legitimate VM migration or backup workflows
however, an attacker with access to an EC2 instance or AWS credentials can export a VM or its image and then transfer it
off-account for exfiltration of data.
"""
false_positives = [
"""
VM export and EC2 image creation may be done by system administrators, DevOps or migration teams as part of planned
maintenance, disaster-recovery or known backup methods. Verify whether the user identity, user agent, and/or
hostname should be making changes in your environment. Exports from unfamiliar users or hosts should be
investigated. If known behavior is causing false positives, it can be exempted from the rule.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS EC2 Export Task"
note = """## Triage and analysis
### Investigating AWS EC2 Export Task
The APIs `CreateInstanceExportTask`, `ExportImage`, and `CreateStoreImageTask` allow the export of a running or stopped EC2 instance (or its AMI/image) to external storage (e.g., S3) or image formats. While often used for migration, cloning or backup, adversaries can leverage these actions to copy full VM state or images out of the environment for exfiltration.
#### Possible investigation steps
**Identify the actor and context**
- Check `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.type`, `aws.cloudtrail.user_identity.access_key_id` to identify who made the call.
- Verify `user_agent.original`, `source.ip` and `@timestamp` to determine whether the action is by known automation, trusted operator, or an unexpected identity or location.
- Confirm `cloud.account.id` and `cloud.region` match the expected account/region for export tasks.
**Examine the specific export/image task details**
- Review `aws.cloudtrail.request_parameters` for details such as the `InstanceId`, `TargetEnvironment`, `S3Bucket`, `S3Key`, `DiskImageFormat`, `ContainerFormat`.
- Check `aws.cloudtrail.response_elements` for the resulting export task ID and status.
- Determine whether the exported instance or image contained sensitive workloads (e.g., production databases, critical systems) via instance tags or asset inventory.
**Pivot to related API calls/events**
- Look for follow-on tasks such as:
- S3 bucket writes or cross-account bucket ACL changes (`PutBucketAcl`/`PutBucketPolicy`) referencing the export S3 bucket or key.
- `CopyImage`, `ModifyImageAttribute`, or `ShareImage` events if the exported image is copied or shared.
- Network or usage anomalies in the region or from the S3 bucket (large downloads from the exported object).
- Check for preceding suspicious actions that could indicate compromise: `AssumeRole`, `CreateAccessKey`, `AttachUserPolicy`, or unusual `Describe*` operations.
**Assess legitimacy and risk**
- Confirm whether this export was authorized (via change ticket or migration workflow) and whether the principal has a documented justification for VM export.
- If unauthorized, assess what was exported, where it is stored, how it may be transferred or used externally, and the data risk exposure.
### False positive analysis
- Legitimate migration or backup workflows may trigger these export/image APIs.
- Development/test environments may export VM images or instances for sandbox cloning.
- Known automation tools may create exports at scheduled times.
### Response and remediation
- Immediately identify and disable or isolate any object/resource created by the export (e.g., the S3 bucket/object, image ID) that is suspected of unauthorized use.
- Revoke the access credentials (`aws.cloudtrail.user_identity.access_key_id`) used if they show unusual activity.
- Rotate keys, enforce MFA, and review IAM permissions for the principal.
- Audit the exported VM/image: review its contents if possible, check whether it has been moved off-account.
- Strengthen monitoring: set alerts for subsequent large data transfers from the S3 export location, cross-account sharing of exported images, or anomalous AMI imports.
- Update policy: restrict who can perform exports, monitor export actions via AWS Config or CloudTrail, tag and track export tasks and their destinations.
"""
references = [
"https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport.html",
"https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport_image.html",
"https://cloud.hacktricks.wiki/en/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ami-store-s3-exfiltration.html,",
]
risk_score = 47
rule_id = "deee5856-25ba-438d-ae53-09d66f41b127"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS EC2",
"Use Case: Asset Visibility",
"Tactic: Exfiltration",
"Tactic: Collection",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: "aws.cloudtrail" and
event.provider: "ec2.amazonaws.com" and
event.action: ("CreateInstanceExportTask" or "ExportImage" or "CreateStoreImageTask") 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.technique]]
id = "T1567"
name = "Exfiltration Over Web Service"
reference = "https://attack.mitre.org/techniques/T1567/"
[[rule.threat.technique.subtechnique]]
id = "T1567.002"
name = "Exfiltration to Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1567/002/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1005"
name = "Data from Local System"
reference = "https://attack.mitre.org/techniques/T1005/"
[[rule.threat.technique]]
id = "T1119"
name = "Automated Collection"
reference = "https://attack.mitre.org/techniques/T1119/"
[[rule.threat.technique]]
id = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[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: "ec2.amazonaws.com" and
event.action: ("CreateInstanceExportTask" or "ExportImage" or "CreateStoreImageTask") 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:"ec2.amazonaws.com" |
Credential Manipulation - Detected - Elastic Endgame
#Elastic Endgame detected Credential Manipulation. Click the Elastic Endgame icon in the event.module column or the link in the rule.reference column for additional information.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2020/02/18"
maturity = "production"
promotion = true
updated_date = "2025/03/21"
[rule]
author = ["Elastic"]
description = """
Elastic Endgame detected Credential Manipulation. Click the Elastic Endgame icon in the event.module column or the link
in the rule.reference column for additional information.
"""
from = "now-2m"
index = ["endgame-*"]
interval = "1m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "Credential Manipulation - Detected - Elastic Endgame"
risk_score = 73
rule_id = "c0be5f31-e180-48ed-aa08-96b36899d48f"
setup = """## Setup
### Additional notes
For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "high"
tags = ["Data Source: Elastic Endgame", "Use Case: Threat Detection", "Tactic: Privilege Escalation", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.kind:alert and event.module:endgame and endgame.metadata.type:detection and (event.action:token_manipulation_event or endgame.event_subtype_full:token_manipulation_event)
'''
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 Credential Manipulation - Detected - Elastic Endgame
Elastic Endgame is a security solution that monitors and detects suspicious activities, such as credential manipulation, which adversaries exploit to escalate privileges by altering access tokens. This detection rule identifies such threats by analyzing alerts for token manipulation events, leveraging its high-risk score and severity to prioritize investigation. The rule aligns with MITRE ATT&CK's framework, focusing on privilege escalation tactics.
### Possible investigation steps
- Review the alert details to confirm the presence of event.kind:alert and event.module:endgame, ensuring the alert is relevant to Elastic Endgame's detection capabilities.
- Examine the event.action and endgame.event_subtype_full fields for token_manipulation_event to understand the specific type of credential manipulation detected.
- Check the associated user account and system involved in the alert to determine if the activity aligns with expected behavior or if it indicates potential unauthorized access.
- Investigate the timeline of events leading up to and following the token manipulation event to identify any additional suspicious activities or patterns.
- Correlate the alert with other security events or logs to assess if this incident is part of a broader attack or isolated.
- Evaluate the risk score and severity to prioritize the response and determine if immediate action is required to mitigate potential threats.
### False positive analysis
- Routine administrative tasks involving token manipulation can trigger alerts. Review the context of the event to determine if it aligns with expected administrative behavior.
- Automated scripts or software updates that require token changes might be flagged. Identify and whitelist these processes if they are verified as safe and necessary for operations.
- Security tools or monitoring solutions that interact with access tokens for legitimate purposes may cause false positives. Ensure these tools are recognized and excluded from triggering alerts.
- User behavior analytics might misinterpret legitimate user actions as suspicious. Regularly update user profiles and behavior baselines to minimize these occurrences.
- Scheduled maintenance activities that involve access token modifications should be documented and excluded from detection rules during their execution time.
### Response and remediation
- Isolate the affected system immediately to prevent further unauthorized access or lateral movement within the network.
- Revoke and reset any compromised credentials or access tokens identified in the alert to prevent further misuse.
- Conduct a thorough review of recent access logs and token usage to identify any unauthorized access or actions taken by the adversary.
- Apply security patches and updates to the affected system and any related systems to close vulnerabilities that may have been exploited.
- Implement enhanced monitoring on the affected system and related accounts to detect any further suspicious activity or attempts at credential manipulation.
- Notify the security team and relevant stakeholders about the incident, providing details of the threat and actions taken, and escalate to higher management if the threat level increases.
- Review and update access control policies and token management practices to prevent similar incidents in the future, ensuring that least privilege principles are enforced."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: query
event.kind:alert and event.module:endgame and endgame.metadata.type:detection and (event.action:token_manipulation_event or endgame.event_subtype_full:token_manipulation_event)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
endgame.event_subtype_full | eq |
| field:"endgame.event_subtype_full" kind:eq value:"token_manipulation_event" |
endgame.metadata.type | eq |
| field:"endgame.metadata.type" kind:eq value:"detection" |
event.action | eq |
| field:"EventType" kind:eq value:"token_manipulation_event" |
event.kind | eq |
| field:"event.kind" kind:eq value:"alert" |
event.module | eq |
| field:"event.module" kind:eq value:"endgame" |
Domain Trust and Schema Enumeration via LDAP
#Identifies a list of LDAP search queries to enumerate domain policies and trusts. Adversaries attempt to enumerate information on the Active Directory structure by using various LDAP-based discovery queries to identify targets for attack.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies a list of LDAP search queries to enumerate domain policies and trusts. Adversaries attempt to enumerate
information on the Active Directory structure by using various LDAP-based discovery queries to identify targets for
attack.
"""
id = "9c928393-2aeb-4143-8ed6-c9704c094f76"
license = "Elastic License v2"
name = "Domain Trust and Schema Enumeration via LDAP"
os_list = ["windows"]
reference = ["https://attack.mitre.org/techniques/T1482/"]
version = "1.0.3"
query = '''
api where process.Ext.api.name == "ldap_search" and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
not process.executable :
("?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
"?:\\Windows\\System32\\lsass.exe",
"?:\\Windows\\ADWS\\Microsoft.ActiveDirectory.WebServices.exe",
"?:\\Windows\\ADFS\\Microsoft.IdentityServer.ServiceHost.exe",
"?:\\Program Files\\Fortinet\\FortiAuthenticator Agent\\FAC_Agent.Configuration.exe") and
(
(process.Ext.api.parameters.search_filter : "(objectclass=trusteddomain)" and process.Ext.api.parameters.distinguished_name like "dc=*") or
(process.Ext.api.parameters.search_filter : "(schemaIDGUID=?)" and process.Ext.api.parameters.distinguished_name like "cn=schema,cn=configuration,dc=*")
) and
not (process.code_signature.subject_name == "Fortinet, Inc." and process.code_signature.trusted == true)
'''
min_endpoint_version = "9.1.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"
[[threat.technique.subtechnique]]
id = "T1069.002"
name = "Domain Groups"
reference = "https://attack.mitre.org/techniques/T1069/002/"
[[threat.technique]]
id = "T1087"
name = "Account Discovery"
reference = "https://attack.mitre.org/techniques/T1087/"
[[threat.technique.subtechnique]]
id = "T1087.002"
name = "Domain Account"
reference = "https://attack.mitre.org/techniques/T1087/002/"
[[threat.technique]]
id = "T1482"
name = "Domain Trust Discovery"
reference = "https://attack.mitre.org/techniques/T1482/"
[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[internal]
min_endpoint_version = "9.1.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "ldap_search" and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
not process.executable :
("?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
"?:\\Windows\\System32\\lsass.exe",
"?:\\Windows\\ADWS\\Microsoft.ActiveDirectory.WebServices.exe",
"?:\\Windows\\ADFS\\Microsoft.IdentityServer.ServiceHost.exe",
"?:\\Program Files\\Fortinet\\FortiAuthenticator Agent\\FAC_Agent.Configuration.exe") and
(
(process.Ext.api.parameters.search_filter : "(objectclass=trusteddomain)" and process.Ext.api.parameters.distinguished_name like "dc=*") or
(process.Ext.api.parameters.search_filter : "(schemaIDGUID=?)" and process.Ext.api.parameters.distinguished_name like "cn=schema,cn=configuration,dc=*")
) and
not (process.code_signature.subject_name == "Fortinet, Inc." and process.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"ldap_search" |
process.Ext.api.parameters.distinguished_name | wildcard |
| field:"process.Ext.api.parameters.distinguished_name" kind:wildcard |
process.Ext.api.parameters.search_filter | wildcard |
| field:"process.Ext.api.parameters.search_filter" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | eq | Fortinet, Inc. | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Fortinet, Inc." |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | ?:\Program Files\Azure Advanced Threat Protection Sensor\*\Microsoft.Tri.Sensor.exe, ?:\Windows\System32\lsass.exe, ?:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe, ?:\Windows\ADFS\Microsoft.IdentityServer.ServiceHost.exe, ?:\Program Files\Fortinet\FortiAuthenticator Agent\FAC_Agent.Configuration.exe | excludes:process.executable |
user.id | in | S-1-5-18, S-1-5-19, S-1-5-20 | excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20" |
Elevation via Common Log File System Exploitation
#Identifies unlevated attempt to create a BLF file using the Common Log File System (CLFS) API followed by spawning a child process with System privileges. This may indicate a successful CLFS vulnerability exploitation for privilege escalation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies unlevated attempt to create a BLF file using the Common Log File System (CLFS) API followed by spawning a
child process with System privileges. This may indicate a successful CLFS vulnerability exploitation for privilege
escalation.
"""
id = "54cff348-106e-42bf-bf94-ce8e3ed68440"
license = "Elastic License v2"
name = "Elevation via Common Log File System Exploitation"
os_list = ["windows"]
reference = ["https://securelist.com/windows-clfs-exploits-ransomware/111560/"]
version = "1.0.2"
query = '''
sequence with maxspan=2m
[file where event.action != "deletion" and not user.id : "S-1-5-18" and user.id != null and
_arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info: ("*clfsw32.dll!CreateLogFile*", "*clfsw32.dll!AddLogContainerSet*"))] by process.entity_id
[process where event.action == "start" and user.id : "S-1-5-18"] by process.parent.entity_id
'''
min_endpoint_version = "8.7.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 = "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 = "8.7.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 2m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: file
[file where event.action != "deletion" and not user.id : "S-1-5-18" and user.id != null and
_arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info: ("*clfsw32.dll!CreateLogFile*", "*clfsw32.dll!AddLogContainerSet*"))] by process.entity_id
Stage 2: process
[process where event.action == "start" and user.id : "S-1-5-18"] 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" |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
user.id | is_not_null | field:"user.id" kind:is_not_null | |
user.id | wildcard |
| field:"user.id" kind:wildcard value:"S-1-5-18" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Executable File Access or Modification via Osascript
#Detects when a executable file is accessed or modified by Osascript on macOS. This activity should be considered malicious or highly suspicious and is indicative of initial access or tool ingress.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
Detects when a executable file is accessed or modified by Osascript on macOS. This activity should be considered
malicious or highly suspicious and is indicative of initial access or tool ingress.
"""
id = "cb3fe671-de31-41f4-bf71-3a39b024fd0e"
license = "Elastic License v2"
name = "Executable File Access or Modification via Osascript"
os_list = ["macos"]
version = "1.0.8"
query = '''
file where event.action != "deletion" and
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and
process.name == "osascript"
'''
min_endpoint_version = "8.10.2"
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.10.2"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and
process.name == "osascript"
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 |
process.name | eq |
| field:"process_basename" kind:eq value:"osascript" |
First Time Python Accessed Sensitive Credential Files
#Detects the first time a Python process accesses sensitive credential files on a given host. This behavior may indicate post-exploitation credential theft via a malicious Python script, compromised dependency, or malicious model file deserialization. Legitimate Python processes do not typically access credential files such as SSH keys, AWS credentials, browser cookies, Kerberos tickets, or keychain databases, so a first occurrence is a strong indicator of compromise.
MITRE ATT&CK Coverage
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| macOS | ESF event open (NOTIFY): Fires after the kernel grants a process access to open a file. |
Rule Body
[metadata]
creation_date = "2026/02/23"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects the first time a Python process accesses sensitive credential files on a given host. This behavior may indicate
post-exploitation credential theft via a malicious Python script, compromised dependency, or malicious model file
deserialization. Legitimate Python processes do not typically access credential files such as SSH keys, AWS credentials,
browser cookies, Kerberos tickets, or keychain databases, so a first occurrence is a strong indicator of compromise.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "kuery"
license = "Elastic License v2"
name = "First Time Python Accessed Sensitive Credential Files"
note = """## Triage and analysis
### Investigating First Time Python Accessed Sensitive Credential Files
Attackers who achieve Python code execution — whether through malicious scripts, compromised dependencies, or model file deserialization (e.g., pickle/PyTorch `__reduce__`) — often target sensitive credential files such as SSH keys, cloud provider credentials, browser session cookies, and macOS keychain data. Since legitimate Python processes do not typically access these files, a first occurrence from a Python process is highly suspicious.
This rule leverages the Elastic Defend sensitive file `open` event, which is only collected for known sensitive file paths, combined with the New Terms rule type to alert on the first time a specific credential file is accessed by Python on a given host within a 7-day window.
### Possible investigation steps
- Examine the Python process command line and arguments to identify the script or command that triggered the file access.
- Determine if the Python process was loading a model file (look for `torch.load`, `pickle.load`), running a standalone script, or executing via a compromised dependency.
- Review the specific credential file that was accessed and assess the potential impact (SSH keys enable lateral movement, AWS credentials enable cloud access, browser cookies enable session hijacking).
- Check for outbound network connections from the same process tree that may indicate credential exfiltration.
- Investigate the origin of any recently downloaded scripts, packages, or model files on the host.
- Look for file creation events in `/tmp/` or other staging directories that may contain copies of the stolen credentials.
### False positive analysis
- Python-based secret management tools (e.g., `aws-cli`, `gcloud`) legitimately access credential files. Consider excluding known trusted executables by process path.
- SSH automation scripts using `paramiko` or `fabric` may read SSH keys. Evaluate whether the access pattern matches known automation workflows.
- Security scanning tools running Python may enumerate credential files as part of their assessment.
### Response and remediation
- Immediately rotate any credentials that were potentially accessed (SSH keys, AWS access keys, cloud tokens).
- Quarantine the Python process and investigate the source script, package, or model file that triggered the access.
- If a malicious file is confirmed, identify all hosts where it may have been distributed.
- Review outbound network connections from the host around the time of the credential access to check for exfiltration.
- Consider implementing `weights_only=True` enforcement for PyTorch model loading across the environment.
"""
references = [
"https://blog.trailofbits.com/2024/06/11/exploiting-ml-models-with-pickle-file-attacks-part-1/",
"https://github.com/trailofbits/fickling",
]
risk_score = 47
rule_id = "03b150d9-9280-4eb8-9906-38cfb6184666"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
"Domain: LLM",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:file and host.os.type:macos and event.action:open and
process.name:python*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1539"
name = "Steal Web Session Cookie"
reference = "https://attack.mitre.org/techniques/T1539/"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[rule.threat.technique.subtechnique]]
id = "T1555.001"
name = "Keychain"
reference = "https://attack.mitre.org/techniques/T1555/001/"
[[rule.threat.technique]]
id = "T1558"
name = "Steal or Forge Kerberos Tickets"
reference = "https://attack.mitre.org/techniques/T1558/"
[[rule.threat.technique.subtechnique]]
id = "T1558.005"
name = "Ccache Files"
reference = "https://attack.mitre.org/techniques/T1558/005/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id", "file.path"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
event.category:file and host.os.type:macos and event.action:open and
process.name:python*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"open" |
event.category | eq |
| field:"event.category" kind:eq value:"file" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"python*" |
Image Loaded with Invalid Signature
#Identifies binaries that are loaded and with an invalid code signature. This may indicate an attempt to masquerade as a signed binary.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 7: Image loaded |
Rule Body
[metadata]
creation_date = "2023/09/27"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/05/21"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies binaries that are loaded and with an invalid code signature. This may indicate an attempt to masquerade as a
signed binary.
"""
from = "now-119m"
index = ["logs-endpoint.events.library-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Image Loaded with Invalid Signature"
risk_score = 21
rule_id = "fd9484f2-1c56-44ae-8b28-dc1354e3a0e8"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Rule Type: BBR",
"Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
library where host.os.type == "windows" and event.action == "load" and
dll.code_signature.status : ("errorUntrustedRoot", "errorBadDigest", "errorUntrustedRoot") and
(dll.Ext.relative_file_creation_time <= 500 or dll.Ext.relative_file_name_modify_time <= 500) and
not startswith~(dll.name, process.name) and
not dll.path : (
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*"
)
'''
[[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.001"
name = "Invalid Code Signature"
reference = "https://attack.mitre.org/techniques/T1036/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: library
library where host.os.type == "windows" and event.action == "load" and
dll.code_signature.status : ("errorUntrustedRoot", "errorBadDigest", "errorUntrustedRoot") and
(dll.Ext.relative_file_creation_time <= 500 or dll.Ext.relative_file_name_modify_time <= 500) and
not startswith~(dll.name, process.name) and
not dll.path : (
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.Ext.relative_file_creation_time | le |
| field:"dll.Ext.relative_file_creation_time" kind:le value:"500" |
dll.Ext.relative_file_name_modify_time | le |
| field:"dll.Ext.relative_file_name_modify_time" kind:le value:"500" |
dll.code_signature.status | wildcard |
| field:"dll.code_signature.status" kind:wildcard |
event.action | eq |
| field:"EventType" kind:eq value:"load" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dll.name | starts_with | process.name | excludes:dll.name field:"dll.name" value:"process.name" |
dll.path | starts_with | ?:\Windows\System32\DriverStore\FileRepository\ | excludes:dll.path field:"dll.path" value:"?:\Windows\System32\DriverStore\FileRepository\" |
Indirect Command Execution via Forfiles/Pcalua
#Identifies indirect command execution via Program Compatibility Assistant (pcalua.exe) or forfiles.exe.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2023/08/24"
integration = ["endpoint", "windows", "system"]
maturity = "production"
updated_date = "2025/03/20"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = "Identifies indirect command execution via Program Compatibility Assistant (pcalua.exe) or forfiles.exe.\n"
from = "now-119m"
index = [
"endgame-*",
"logs-endpoint.events.process-*",
"logs-system.security*",
"logs-windows.*",
"winlogbeat-*",
]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Indirect Command Execution via Forfiles/Pcalua"
risk_score = 21
rule_id = "98843d35-645e-4e66-9d6a-5049acd96ce1"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Rule Type: BBR",
"Data Source: Elastic Endgame",
"Data Source: Windows Security Event Logs",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : ("pcalua.exe", "forfiles.exe")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1202"
name = "Indirect Command Execution"
reference = "https://attack.mitre.org/techniques/T1202/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : ("pcalua.exe", "forfiles.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Long Base64 Command Execution via Interactive Shell
#Identifies attempts to execute commands with long base64 encoded command lines via an interactive shell. Adversaries may abuse this technique to execute malicious commands.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to execute commands with long base64 encoded command lines via an interactive shell. Adversaries may
abuse this technique to execute malicious commands.
"""
id = "e7b95c3e-9640-4836-85f9-2aaf6c14cebc"
license = "Elastic License v2"
name = "Long Base64 Command Execution via Interactive Shell"
os_list = ["linux"]
version = "1.0.6"
query = '''
process where event.type == "start" and event.action == "exec" and
process.parent.interactive == true and process.interactive == true and
(
(
process.name like~ "python*" and
(
process.command_line like~ "*b64decode*" or
(
process.command_line like "*-c *" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ ("powershell*", "pwsh*") and
process.command_line like~ (
"* -e *", "* -en *", "* -enc *", "* -enco *", "* -encod *", "* -encode *", "* -encoded *",
"* -encodedcommand *", "*frombase64string*"
)
) or
(
process.name like~ ("node*", "deno*") and
(
process.command_line like~ ("*atob(*", "*eval(*") or
(
process.command_line like~ "*buffer.from*" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ "php*" and
process.command_line like~ ("*base64_decode(*", "*convert.base64-decode*")
) or
(
process.name like~ "perl*" and
process.command_line like~ ("*MIME::Base64*", "*decode_base64(*")
) or
(
process.name like~ "ruby*" and
process.command_line like~ ("*require*base64*", "*Base64.decode64(*")
) or
(
process.name like~ "java*" and
process.command_line like~ "*base64*decode(*"
) or
(
process.name like~ "lua*" and
process.command_line like~ ("*mime.decode(*base64*", "*mime.unb64(*")
) or
(
process.name like~ "openssl*" and
process.command_line like~ ("*base64 -d*", "*-base64*")
) or
(
process.name in ("base64", "basez", "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16") and
process.command_line like~ ("* -d*", "* --decode*")
) or
(
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.command_line like~ ("*base64 -d*", "*base64 --decode*")
)
) and length(process.command_line) >= 4000 and
not (
process.parent.executable like (
"/usr/bin/claude-bin", "/home/*/.local/share/claude/versions/*", "/opt/tm/gemini/node/bin/node",
"/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby",
"/usr/bin/sudo", "/usr/local/xars/standalone-tools/claude/*", "/usr/bin/su", "/mnt/fast/nobackup/users/*",
"/opt/local/share/claude/versions/*", "/home/*/.nvm/versions/node/*", "/usr/share/devin-desktop/devin-desktop",
"/opt/linuxbrew/.linuxbrew/Homebrew/*", "/usr/bin/bwrap", "/root/.local/share/claude/versions/*",
"/tmp/.mount_*/usr/share/cursor/cursor", "/home/*/.local/share/cursor-agent/versions/*/node",
"/usr/local/lib/claude-code/claude-bin", "/opt/local/*/dotfolders/.local/share/claude/versions/*",
"/scratch/user/*/.local/bin/claude-science", "/usr/bin/make", "/home/*/.cache/JetBrains/*/dist-package/node",
"/home/*/.aimee-code/bin/*", "/opt/*/.local/share/claude/versions/*", "*/.codex/packages/standalone/releases/*/bin/codex",
"/home/linuxbrew/.linuxbrew/Caskroom/codex/*/bin/codex", "*/node_modules/@openai/codex-linux-x64/vendor/*/bin/codex",
"*/.local/share/claude/versions/*"
) or
process.parent.name in ("claude", "claude.exe", "cursor") or
process.parent.args like (
"/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py", "source /home/*/.claude/shell-snapshots/snapshot-*", "claude",
"/home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py", "/tmp/cmdickens/tmp/eb-*", "/tmp/thangha/tmp/eb-*"
) or
process.parent.command_line like "*mitogen:ansible*" or
(process.parent.executable == "/usr/bin/timeout" and process.working_directory == "/workspace") or
(
process.parent.executable like "/tools/eb/build/*/bazel-root/install/*/process-wrapper" and
process.executable like "/cvmfs/*/software/Python/*/bin/python3*"
) or
process.working_directory in ("/workspace/race/codex", "/workspace/race/claude")
)
'''
min_endpoint_version = "8.3.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[[threat.technique.subtechnique]]
id = "T1059.011"
name = "Lua"
reference = "https://attack.mitre.org/techniques/T1059/011/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.3.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.parent.interactive == true and process.interactive == true and
(
(
process.name like~ "python*" and
(
process.command_line like~ "*b64decode*" or
(
process.command_line like "*-c *" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ ("powershell*", "pwsh*") and
process.command_line like~ (
"* -e *", "* -en *", "* -enc *", "* -enco *", "* -encod *", "* -encode *", "* -encoded *",
"* -encodedcommand *", "*frombase64string*"
)
) or
(
process.name like~ ("node*", "deno*") and
(
process.command_line like~ ("*atob(*", "*eval(*") or
(
process.command_line like~ "*buffer.from*" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ "php*" and
process.command_line like~ ("*base64_decode(*", "*convert.base64-decode*")
) or
(
process.name like~ "perl*" and
process.command_line like~ ("*MIME::Base64*", "*decode_base64(*")
) or
(
process.name like~ "ruby*" and
process.command_line like~ ("*require*base64*", "*Base64.decode64(*")
) or
(
process.name like~ "java*" and
process.command_line like~ "*base64*decode(*"
) or
(
process.name like~ "lua*" and
process.command_line like~ ("*mime.decode(*base64*", "*mime.unb64(*")
) or
(
process.name like~ "openssl*" and
process.command_line like~ ("*base64 -d*", "*-base64*")
) or
(
process.name in ("base64", "basez", "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16") and
process.command_line like~ ("* -d*", "* --decode*")
) or
(
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.command_line like~ ("*base64 -d*", "*base64 --decode*")
)
) and length(process.command_line) >= 4000 and
not (
process.parent.executable like (
"/usr/bin/claude-bin", "/home/*/.local/share/claude/versions/*", "/opt/tm/gemini/node/bin/node",
"/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby",
"/usr/bin/sudo", "/usr/local/xars/standalone-tools/claude/*", "/usr/bin/su", "/mnt/fast/nobackup/users/*",
"/opt/local/share/claude/versions/*", "/home/*/.nvm/versions/node/*", "/usr/share/devin-desktop/devin-desktop",
"/opt/linuxbrew/.linuxbrew/Homebrew/*", "/usr/bin/bwrap", "/root/.local/share/claude/versions/*",
"/tmp/.mount_*/usr/share/cursor/cursor", "/home/*/.local/share/cursor-agent/versions/*/node",
"/usr/local/lib/claude-code/claude-bin", "/opt/local/*/dotfolders/.local/share/claude/versions/*",
"/scratch/user/*/.local/bin/claude-science", "/usr/bin/make", "/home/*/.cache/JetBrains/*/dist-package/node",
"/home/*/.aimee-code/bin/*", "/opt/*/.local/share/claude/versions/*", "*/.codex/packages/standalone/releases/*/bin/codex",
"/home/linuxbrew/.linuxbrew/Caskroom/codex/*/bin/codex", "*/node_modules/@openai/codex-linux-x64/vendor/*/bin/codex",
"*/.local/share/claude/versions/*"
) or
process.parent.name in ("claude", "claude.exe", "cursor") or
process.parent.args like (
"/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py", "source /home/*/.claude/shell-snapshots/snapshot-*", "claude",
"/home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py", "/tmp/cmdickens/tmp/eb-*", "/tmp/thangha/tmp/eb-*"
) or
process.parent.command_line like "*mitogen:ansible*" or
(process.parent.executable == "/usr/bin/timeout" and process.working_directory == "/workspace") or
(
process.parent.executable like "/tools/eb/build/*/bazel-root/install/*/process-wrapper" and
process.executable like "/cvmfs/*/software/Python/*/bin/python3*"
) or
process.working_directory in ("/workspace/race/codex", "/workspace/race/claude")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.interactive | eq |
| field:"process.interactive" kind:eq value:"true" |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.interactive | eq |
| field:"process.parent.interactive" kind:eq value:"true" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | /cvmfs/*/software/Python/*/bin/python3* | excludes:process.executable field:"process.executable" value:"/cvmfs/*/software/Python/*/bin/python3*" |
process.parent.executable | wildcard | /tools/eb/build/*/bazel-root/install/*/process-wrapper | excludes:process.parent.executable field:"process.parent.executable" value:"/tools/eb/build/*/bazel-root/install/*/process-wrapper" |
process.parent.executable | eq | /usr/bin/timeout | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/timeout" |
process.working_directory | eq | /workspace | excludes:process.working_directory field:"process.working_directory" value:"/workspace" |
process.parent.args | wildcard | /root/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py, source /home/*/.claude/shell-snapshots/snapshot-*, claude, /home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_command.py, /tmp/cmdickens/tmp/eb-*, /tmp/thangha/tmp/eb-* | excludes:process.parent.args |
process.parent.command_line | match | mitogen:ansible | excludes:process.parent.command_line field:"process.parent.command_line" value:"mitogen:ansible" |
process.parent.executable | wildcard | /usr/bin/claude-bin, /home/*/.local/share/claude/versions/*, /opt/tm/gemini/node/bin/node, /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby, /usr/bin/sudo, /usr/local/xars/standalone-tools/claude/*, /usr/bin/su, /mnt/fast/nobackup/users/*, /opt/local/share/claude/versions/*, /home/*/.nvm/versions/node/*, /usr/share/devin-desktop/devin-desktop, /opt/linuxbrew/.linuxbrew/Homebrew/*, /usr/bin/bwrap, /root/.local/share/claude/versions/*, /tmp/.mount_*/usr/share/cursor/cursor, /home/*/.local/share/cursor-agent/versions/*/node, /usr/local/lib/claude-code/claude-bin, /opt/local/*/dotfolders/.local/share/claude/versions/*, /scratch/user/*/.local/bin/claude-science, /usr/bin/make, /home/*/.cache/JetBrains/*/dist-package/node, /home/*/.aimee-code/bin/*, /opt/*/.local/share/claude/versions/*, */.codex/packages/standalone/releases/*/bin/codex, /home/linuxbrew/.linuxbrew/Caskroom/codex/*/bin/codex, */node_modules/@openai/codex-linux-x64/vendor/*/bin/codex, */.local/share/claude/versions/* | excludes:process.parent.executable |
process.parent.name | in | claude, claude.exe, cursor | excludes:process.parent.name field:"process.parent.name" value:"claude" field:"process.parent.name" value:"claude.exe" field:"process.parent.name" value:"cursor" |
process.working_directory | in | /workspace/race/claude, /workspace/race/codex | excludes:process.working_directory field:"process.working_directory" value:"/workspace/race/claude" field:"process.working_directory" value:"/workspace/race/codex" |
Modification of AmsiEnable Registry Key
#Identifies modifications of the AmsiEnable registry key to 0, which disables Windows Script AMSI scanning for the affected user. Adversaries can modify this key to bypass AMSI protections for Windows Script Host or JScript execution.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Defense Impairment |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2021/06/01"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/04/27"
[rule]
author = ["Elastic"]
description = """
Identifies modifications of the AmsiEnable registry key to 0, which disables Windows Script AMSI scanning for the
affected user. Adversaries can modify this key to bypass AMSI protections for Windows Script Host or JScript execution.
"""
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.registry-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Modification of AmsiEnable Registry Key"
references = [
"https://hackinparis.com/data/slides/2019/talks/HIP2019-Dominic_Chell-Cracking_The_Perimeter_With_Sharpshooter.pdf",
"https://docs.microsoft.com/en-us/windows/win32/amsi/antimalware-scan-interface-portal",
]
risk_score = 73
rule_id = "f874315d-5188-4b4a-8521-d1c73093a7e4"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where host.os.type == "windows" and event.type in ("creation", "change") and
registry.value : "AmsiEnable" and registry.data.strings: ("0", "0x00000000")
/*
Full registry key path omitted due to data source variations:
HKEY_USERS\\*\\Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable"
*/
'''
note = """## Triage and analysis
### Investigating Modification of AmsiEnable Registry Key
#### Possible investigation steps
- Does the registry event prove Windows Script AMSI was disabled for a user hive?
- Focus: `registry.path`, `registry.value`, `registry.data.type`, and `registry.data.strings` for "Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable" under "HKEY_USERS\\<SID>".
- Implication: escalate true disablement when `registry.path` resolves to that user-hive value and `registry.data.strings` is "0" or "0x00000000"; lower suspicion only when the path or data does not disable AMSI, or same-host evidence proves controlled validation or image-build deliberately toggled Windows Script AMSI.
- Is the writing process a recognized validation tool or an abuse launcher?
- Focus: writer identity: `process.entity_id`, `process.executable`, `process.command_line`, `process.code_signature.subject_name`, and `process.code_signature.trusted`. $investigate_0
- Hint: reconstruct activity with `host.id` plus `process.entity_id`; if missing, use `host.id`, `process.pid`, and a tight time window.
- Implication: escalate when the writer is unsigned, untrusted, user-writable, renamed, script-launched, or writes "AmsiEnable" outside a recognized validation or image-build command line. Identity alone never clears the registry change.
- Does lineage and session explain the AMSI disablement?
- Focus: `process.parent.executable`, `process.parent.command_line`, `process.Ext.session_info.logon_type`, and `user.id`.
- Implication: escalate when lineage involves Office, a browser, script host, remote shell, scheduled task, unexpected service account, or a standard user context that does not fit script-control testing; lower suspicion only when parent, session, and `user.id` match controlled validation or image-build launch context.
- Did follow-on process activity use the disablement path?
- Focus: post-write process activity in the recovered process scope, especially `process.executable`, `process.command_line`, and `process.parent.command_line`. $investigate_1
- Implication: escalate when the same lineage later launches or reopens "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "wmic.exe", "regsvr32.exe", or Office-child script execution. A write followed by a second script open matches SharpShooter-style AMSI-stub behavior; activity confined to recognized validation is lower risk.
- Did the same process change related registry state for evasion, persistence, or cleanup?
- Focus: same-process registry activity in the recovered process scope, with `registry.path`, `registry.value`, and `registry.data.strings`. $investigate_2
- Implication: escalate when the process also weakens script policy, security-control, Run, Startup, COM, or other persistence-relevant keys, or quickly restores `registry.path` after script execution. Risk is narrower when surrounding registry writes stay limited to the Windows Script validation task and return to baseline.
- If local evidence stays suspicious or unresolved, do related alerts broaden scope?
- Focus: related alerts for the same `user.id` that show execution, persistence, delivery, or defense evasion. $investigate_3
- Hint: query related alerts for the same `host.id` to find adjacent script execution, persistence, related registry tampering, or other AMSI-bypass alerts. $investigate_4
- Implication: broaden scope and urgency when either pivot shows related execution, persistence, or defense evasion; quiet related-alert pivots only lower urgency when local registry, process, and user evidence already supports one exact benign workflow.
- Escalate when true AMSI disablement combines with suspicious writer, lineage, script follow-on, related registry weakening, or related alerts; close only when same-host registry and process evidence proves one controlled workflow, with outside confirmation when telemetry cannot prove legitimacy; preserve and escalate mixed or incomplete evidence.
### False positive analysis
- Controlled security validation or golden-image build validation can legitimately toggle AMSI on lab, build, or pre-production assets. Confirm `registry.path`, `registry.value`, and `registry.data.strings` match the intended user hive; `process.executable`, `process.code_signature.subject_name`, `process.code_signature.trusted`, `process.command_line`, `process.parent.command_line`, `user.id`, and `host.id` align with that workflow; and surrounding process plus registry activity stays inside the task. Use change records, testing plans, owner confirmation, or toolchain confirmation only to verify telemetry-proven workflow, not override unresolved telemetry.
- Base exceptions on the minimum confirmed workflow pattern: `process.executable`, `process.code_signature.subject_name`, `process.command_line`, `process.parent.executable`, `registry.path`, `user.id`, and `host.id`. Use prior alerts, when available, to validate stability. Avoid exceptions on the AmsiEnable value alone, on `user.name` alone, or on a host alone.
### Response and remediation
- If confirmed benign, reverse any temporary containment and document the exact registry, process, parent, user, and host evidence that justified closure. Create an exception only when that confirmed pattern is specific enough to avoid suppressing lookalike AMSI tampering; use recurrence as supporting evidence when it exists.
- If suspicious but unconfirmed, preserve the registry event, same-host process timeline, parent command line, related registry changes, and affected user and host before containment. Apply reversible containment first, such as heightened monitoring, temporary network restriction, or carefully scoped endpoint isolation based on host role; escalate to account action or stronger host isolation only if follow-on execution, related registry tampering, or broader alert scope is confirmed.
- If confirmed malicious, preserve the registry, process, user, host, and related-alert evidence plus any recovered script or payload identifiers before destructive action. Use endpoint isolation to stop follow-on execution while retaining telemetry, then terminate malicious processes or suspend accounts only after recording the process and user evidence needed for follow-up.
- After scoping related `host.id`, `user.id`, `process.executable`, and `registry.path` evidence across affected assets, restore `registry.value` to the expected baseline and remove only the scripts, binaries, Run keys, COM changes, scheduled tasks, or other persistence artifacts identified during the investigation.
- Post-incident hardening: restrict who can modify the Windows Script settings path, review controls around script hosts and Office macro execution, and retain the registry and process telemetry that proved the case.
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Registry Events](https://ela.st/sysmon-event-reg-setup)
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"host.name",
"host.id",
"user.name",
"user.id",
"process.executable",
"process.command_line",
"process.entity_id",
"process.code_signature.subject_name",
"process.code_signature.trusted",
"process.parent.executable",
"process.parent.command_line",
"registry.path",
"registry.value",
"registry.data.strings",
]
[transform]
[[transform.investigate]]
label = "Process events for the writer"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Child process events for the writer"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Registry events for the writer"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "registry", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[rule.threat.technique.subtechnique]]
id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: registry
registry where host.os.type == "windows" and event.type in ("creation", "change") and
registry.value : "AmsiEnable" and registry.data.strings: ("0", "0x00000000")
/*
Full registry key path omitted due to data source variations:
HKEY_USERS\\*\\Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable"
*/
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | in |
| field:"event.type" kind:in |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard |
registry.value | wildcard |
| field:"registry_value_name" kind:wildcard value:"AmsiEnable" |
Multiple Okta Sessions Detected for a Single User
#Detects when a user has started multiple Okta sessions with the same user account and different session IDs. This may indicate that an attacker has stolen the user's session cookie and is using it to access the user's account from a different location.
Known False Positives
- A user may have multiple sessions open at the same time, such as on a mobile device and a laptop.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Okta | System Log event type user.session.start: User logged in to Okta |
Rules Detecting the Same Action
These rules filter on the same operation.
- Failed Logins from Unknown or Invalid User (Kusto)
- First Occurrence of Okta User Session Started via Proxy (Elastic)
- High-Risk Admin Activity (Kusto)
- Multiple Okta User Authentication Events with Same Device Token Hash (Elastic)
- New Device/Location sign-in along with critical operation (Kusto)
- Okta AiTM Session Cookie Replay (Elastic)
- Okta Login From CrowdStrike Unmanaged Device (Panther)
- Okta Login From CrowdStrike Unmanaged Device (Panther)
Rule Body
[metadata]
creation_date = "2023/11/07"
integration = ["okta"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects when a user has started multiple Okta sessions with the same user account and different session IDs. This may
indicate that an attacker has stolen the user's session cookie and is using it to access the user's account from a
different location.
"""
false_positives = ["A user may have multiple sessions open at the same time, such as on a mobile device and a laptop."]
from = "now-35m"
index = ["filebeat-*", "logs-okta*"]
interval = "30m"
language = "kuery"
license = "Elastic License v2"
name = "Multiple Okta Sessions Detected for a Single User"
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 Multiple Okta Sessions Detected for a Single User
Okta is a widely used identity management service that facilitates secure user authentication and access control. Adversaries may exploit Okta by hijacking session cookies, allowing unauthorized access to user accounts from different locations. The detection rule identifies anomalies by flagging multiple session initiations with distinct session IDs for the same user, excluding legitimate Okta system actors, thus highlighting potential unauthorized access attempts.
### Possible investigation steps
- Review the Okta logs to identify the specific user account associated with the multiple session initiations and note the distinct session IDs.
- Check the geographic locations and IP addresses associated with each session initiation to determine if there are any unusual or unexpected locations.
- Investigate the timestamps of the session initiations to see if they align with the user's typical login patterns or if they suggest simultaneous logins from different locations.
- Examine the okta.actor.id and okta.actor.display_name fields to ensure that the sessions were not initiated by legitimate Okta system actors.
- Contact the user to verify if they recognize the session activity and if they have recently logged in from multiple devices or locations.
- Assess if there are any other related security alerts or incidents involving the same user account that could indicate a broader compromise.
### False positive analysis
- Legitimate multiple device usage: Users may legitimately access their accounts from multiple devices, leading to multiple session initiations. To handle this, create exceptions for users who frequently use multiple devices for work.
- Frequent travel or remote work: Users who travel often or work remotely may trigger this rule due to accessing Okta from various locations. Consider setting up location-based exceptions for these users.
- Shared accounts: In environments where account sharing is common, multiple sessions may be expected. Implement policies to discourage account sharing or create exceptions for known shared accounts.
- Automated scripts or integrations: Some users may have automated processes that initiate multiple sessions. Identify these scripts and exclude them from the rule by their specific session patterns.
- Testing and development environments: Users involved in testing or development may generate multiple sessions as part of their work. Exclude these environments from the rule to prevent false positives.
### Response and remediation
- Immediately terminate all active sessions for the affected user account to prevent further unauthorized access.
- Reset the user's password and invalidate any existing session cookies to ensure that any stolen session cookies are rendered useless.
- Conduct a thorough review of recent login activity and session logs for the affected user to identify any suspicious or unauthorized access patterns.
- Notify the user of the potential compromise and advise them to verify any recent account activity for unauthorized actions.
- Escalate the incident to the security operations team for further investigation and to determine if additional accounts or systems may be affected.
- Implement multi-factor authentication (MFA) for the affected user account if not already in place, to add an additional layer of security against unauthorized access.
- Update and enhance monitoring rules to detect similar anomalies in the future, focusing on unusual session patterns and access from unexpected locations.
## Setup
The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = [
"https://developer.okta.com/docs/reference/api/system-log/",
"https://developer.okta.com/docs/reference/api/event-types/",
"https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
"https://sec.okta.com/articles/2023/08/cross-tenant-impersonation-prevention-and-detection",
"https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
"https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
]
risk_score = 47
rule_id = "621e92b6-7e54-11ee-bdc0-f661ea17fbcd"
severity = "medium"
tags = [
"Use Case: Identity and Access Audit",
"Data Source: Okta",
"Tactic: Lateral Movement",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "threshold"
query = '''
data_stream.dataset:okta.system
and okta.event_type:user.session.start
and okta.authentication_context.external_session_id:*
and not (okta.actor.id: okta* or okta.actor.display_name: okta*)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.004"
name = "Web Session Cookie"
reference = "https://attack.mitre.org/techniques/T1550/004/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[rule.threshold]
field = ["okta.actor.id"]
value = 1
[[rule.threshold.cardinality]]
field = "okta.authentication_context.external_session_id"
value = 3
Stages and Predicates
Stage 1: query
data_stream.dataset:okta.system
and okta.event_type:user.session.start
and okta.authentication_context.external_session_id:*
and not (okta.actor.id: okta* or okta.actor.display_name: okta*)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"okta.system" |
okta.authentication_context.external_session_id | is_not_null | field:"okta::authenticationContext.externalSessionId" kind:is_not_null | |
okta.event_type | eq |
| field:"okta::eventType" kind:eq value:"user.session.start" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
okta.actor.display_name | starts_with | okta | excludes:okta.actor.display_name field:"okta.actor.display_name" value:"okta" |
okta.actor.id | starts_with | okta | excludes:okta.actor.id field:"okta.actor.id" value:"okta" |
Payload Downloaded and Piped to Interpreter
#This rule detects when a payload is downloaded by an interpreter, and piped to an interpreter. Attackers may use this technique to download and execute payloads for various malicious purposes, such as establishing persistence or exfiltrating data.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
This rule detects when a payload is downloaded by an interpreter, and piped to an interpreter. Attackers may use this
technique to download and execute payloads for various malicious purposes, such as establishing persistence or
exfiltrating data.
"""
id = "0369a845-9383-4be6-8102-5e5688b8253b"
license = "Elastic License v2"
name = "Payload Downloaded and Piped to Interpreter"
os_list = ["linux"]
version = "1.0.4"
query = '''
sequence by process.parent.entity_id with maxspan=1s
[network where event.type == "start" and event.action == "connection_attempted" and (
process.name like (
"bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish",
"mksh", "busybox", "rscript", "r", "julia", "mono", "dotnet", "groovy", "kotlin",
"scala", "erlang", "escript", "ocaml", "ocamlopt", "ld.so", "ld-linux-x86-64.so.2",
"ld-musl-x86_64.so.1", "awk", "gawk", "mawk", "nawk", "node", "nodejs", "deno",
"env", "timeout", "nice", "stdbuf", "setsid", "setarch", "unshare", "nsenter", "flock",
"runuser", "sudo", "snap"
) or
process.name like ("python*", "perl*", "ruby*", "lua*", "php*", "qemu-*-static")
) 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"
)
)]
[process where event.type == "start" and event.action == "exec" and process.interactive == true and (
process.name like (
"bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish",
"mksh", "busybox", "rscript", "r", "julia", "mono", "dotnet", "groovy", "kotlin",
"scala", "erlang", "escript", "ocaml", "ocamlopt", "ld.so", "ld-linux-x86-64.so.2",
"ld-musl-x86_64.so.1", "awk", "gawk", "mawk", "nawk", "node", "nodejs", "deno"
) or
process.name like ("python*", "perl*", "ruby*", "lua*", "php*")
) and (
stringcontains(process.executable, process.command_line) or
stringcontains(process.name, process.command_line)
) and
process.args_count == 1 and
/* Prevent FPs from long single argument strings due to parsing */
length(process.command_line) < 50 and
not (
process.parent.executable like (
"/usr/sbin/univention-directory-listener", "/home/*/.local/zed.app/libexec/zed-editor",
"/home/*/nvim-linux-x86_64/bin/nvim"
) or
process.executable like (
"/usr/local/php*/bin/php-cgi", "/opt/plesk/php/*/bin/php-cgi", "/opt/cpanel/ea-php*/root/usr/bin/php-cgi", "/usr/bin/php-cgi",
"/opt/universal/python/bin/python3*", "/opt/remi/php*/root/usr/bin/php-cgi", "/oracle/app/oracle/*/perl/bin/perl",
"/mnt/Xilinx/PetaLinux/*/usr/bin/python3.*.real", "/usr/bin/php-cgi*", "/oracle_agent/*/agent/*/perl/bin/perl",
"/home/*/anaconda3/envs/pnid_env/bin/python*", "/tmp/newroot/home/*/.nvm/versions/node/*/bin/node"
) or
(
process.name like "python*" and
process.args in ("/usr/bin/pip", "/usr/local/bin/pip")
)
)]
'''
min_endpoint_version = "8.6.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.6.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1s, correlated by process.parent.entity_id.
Stage 1: network
[network where event.type == "start" and event.action == "connection_attempted" and (
process.name like (
"bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish",
"mksh", "busybox", "rscript", "r", "julia", "mono", "dotnet", "groovy", "kotlin",
"scala", "erlang", "escript", "ocaml", "ocamlopt", "ld.so", "ld-linux-x86-64.so.2",
"ld-musl-x86_64.so.1", "awk", "gawk", "mawk", "nawk", "node", "nodejs", "deno",
"env", "timeout", "nice", "stdbuf", "setsid", "setarch", "unshare", "nsenter", "flock",
"runuser", "sudo", "snap"
) or
process.name like ("python*", "perl*", "ruby*", "lua*", "php*", "qemu-*-static")
) 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"
)
)]
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.interactive == true and (
process.name like (
"bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish",
"mksh", "busybox", "rscript", "r", "julia", "mono", "dotnet", "groovy", "kotlin",
"scala", "erlang", "escript", "ocaml", "ocamlopt", "ld.so", "ld-linux-x86-64.so.2",
"ld-musl-x86_64.so.1", "awk", "gawk", "mawk", "nawk", "node", "nodejs", "deno"
) or
process.name like ("python*", "perl*", "ruby*", "lua*", "php*")
) and (
stringcontains(process.executable, process.command_line) or
stringcontains(process.name, process.command_line)
) and
process.args_count == 1 and
length(process.command_line) < 50 and
not (
process.parent.executable like (
"/usr/sbin/univention-directory-listener", "/home/*/.local/zed.app/libexec/zed-editor",
"/home/*/nvim-linux-x86_64/bin/nvim"
) or
process.executable like (
"/usr/local/php*/bin/php-cgi", "/opt/plesk/php/*/bin/php-cgi", "/opt/cpanel/ea-php*/root/usr/bin/php-cgi", "/usr/bin/php-cgi",
"/opt/universal/python/bin/python3*", "/opt/remi/php*/root/usr/bin/php-cgi", "/oracle/app/oracle/*/perl/bin/perl",
"/mnt/Xilinx/PetaLinux/*/usr/bin/python3.*.real", "/usr/bin/php-cgi*", "/oracle_agent/*/agent/*/perl/bin/perl",
"/home/*/anaconda3/envs/pnid_env/bin/python*", "/tmp/newroot/home/*/.nvm/versions/node/*/bin/node"
) or
(
process.name like "python*" and
process.args in ("/usr/bin/pip", "/usr/local/bin/pip")
)
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"1" |
process.executable | contains |
| field:"Image" kind:contains value:"process.command_line" |
process.interactive | eq |
| field:"process.interactive" kind:eq value:"true" |
process.name | contains |
| field:"process_basename" kind:contains value:"process.command_line" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8 | 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.args | in | /usr/bin/pip, /usr/local/bin/pip | excludes:process.args field:"process.args" value:"/usr/bin/pip" field:"process.args" value:"/usr/local/bin/pip" |
process.name | starts_with | python | excludes:process.name field:"process.name" value:"python" |
process.executable | wildcard | /usr/local/php*/bin/php-cgi, /opt/plesk/php/*/bin/php-cgi, /opt/cpanel/ea-php*/root/usr/bin/php-cgi, /usr/bin/php-cgi, /opt/universal/python/bin/python3*, /opt/remi/php*/root/usr/bin/php-cgi, /oracle/app/oracle/*/perl/bin/perl, /mnt/Xilinx/PetaLinux/*/usr/bin/python3.*.real, /usr/bin/php-cgi*, /oracle_agent/*/agent/*/perl/bin/perl, /home/*/anaconda3/envs/pnid_env/bin/python*, /tmp/newroot/home/*/.nvm/versions/node/*/bin/node | excludes:process.executable |
process.parent.executable | wildcard | /usr/sbin/univention-directory-listener, /home/*/.local/zed.app/libexec/zed-editor, /home/*/nvim-linux-x86_64/bin/nvim | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/sbin/univention-directory-listener" field:"process.parent.executable" value:"/home/*/.local/zed.app/libexec/zed-editor" field:"process.parent.executable" value:"/home/*/nvim-linux-x86_64/bin/nvim" |
Potential CVE-2025-32463 Nsswitch File Creation
#Detects suspicious creation of the nsswitch.conf file, outside of the regular /etc/nsswitch.conf path, 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 creation of the nsswitch.conf file, outside of the regular /etc/nsswitch.conf path, 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 = "cc81a704-da59-4baf-9b93-c9d893f17ab0"
license = "Elastic License v2"
name = "Potential CVE-2025-32463 Nsswitch File Creation"
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.6"
query = '''
file where event.type == "creation" and file.path like "/*/etc/nsswitch.conf" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not
(
process.name in ("bash", "dash") and file.path like (
"/var/tmp/mkinitramfs_*", "/tmp/tmp.*/mkinitramfs_*", "/tmp/petalinux*/etc/nsswitch.conf",
"/tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf", "/var/tmp/dracut.*/initramfs/etc/nsswitch.conf",
"/tmp/user/0/mkinitramfs_*/etc/nsswitch.conf", "/opt/mkinitramfs_*/etc/nsswitch.conf",
"/opt/dumpling-nxp/*/etc/nsswitch.conf", "/tmp/store/vfs/dir/*", "/opt/tmp/mkinitramfs_*",
"/opt/nvidia_tmpfs/mkinitramfs*"
)
)
'''
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: file
file where event.type == "creation" and file.path like "/*/etc/nsswitch.conf" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not
(
process.name in ("bash", "dash") and file.path like (
"/var/tmp/mkinitramfs_*", "/tmp/tmp.*/mkinitramfs_*", "/tmp/petalinux*/etc/nsswitch.conf",
"/tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf", "/var/tmp/dracut.*/initramfs/etc/nsswitch.conf",
"/tmp/user/0/mkinitramfs_*/etc/nsswitch.conf", "/opt/mkinitramfs_*/etc/nsswitch.conf",
"/opt/dumpling-nxp/*/etc/nsswitch.conf", "/tmp/store/vfs/dir/*", "/opt/tmp/mkinitramfs_*",
"/opt/nvidia_tmpfs/mkinitramfs*"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"creation" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"/*/etc/nsswitch.conf" |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | wildcard | /var/tmp/mkinitramfs_*, /tmp/tmp.*/mkinitramfs_*, /tmp/petalinux*/etc/nsswitch.conf, /tmp/selfextract.*/mkinitramfs_*/etc/nsswitch.conf, /var/tmp/dracut.*/initramfs/etc/nsswitch.conf, /tmp/user/0/mkinitramfs_*/etc/nsswitch.conf, /opt/mkinitramfs_*/etc/nsswitch.conf, /opt/dumpling-nxp/*/etc/nsswitch.conf, /tmp/store/vfs/dir/*, /opt/tmp/mkinitramfs_*, /opt/nvidia_tmpfs/mkinitramfs* | excludes:file.path |
process.name | in | bash, dash | excludes:process.name field:"process.name" value:"bash" field:"process.name" value:"dash" |
Potential Shellcode Injection by a Browser Process
#Identifies suspicious memory allocations by a browser process. This may indicate an attempt to exploit a vulnerability for initial access and execution.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies suspicious memory allocations by a browser process. This may indicate an attempt to exploit a vulnerability
for initial access and execution.
"""
id = "d5fb2972-bf70-42a8-ad42-4db62491f2ad"
license = "Elastic License v2"
name = "Potential Shellcode Injection by a Browser Process"
os_list = ["windows"]
version = "1.0.3"
query = '''
api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.name == "VirtualAlloc" and process.Ext.api.parameters.size >= 10000 and
process.Ext.api.summary like "*COMMIT*" and process.thread.Ext.call_stack_final_user_module.name == "Unbacked" and
process.name in~ ("iexplore.exe", "chrome.exe", "msedge.exe") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like ("Kernel", "Kernel|*")) and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*", "chrome.exe", "chrome.exe|*", "msedge.exe", "msedge.exe|*") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("1a9ca25a7d7f11f6be10dee684505ee4b3340a0d3cbc22d959e69322e7cf0848",
"d09f0ed19b426b1f78de9b736f6c1f667b3e689c1927e6a3466423ddf88fd4a4") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("chrome.exe", "chrome.exe|*", "msedge.exe", "msedge.exe|*") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true)
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1189"
name = "Drive-by Compromise"
reference = "https://attack.mitre.org/techniques/T1189/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[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.10.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.name == "VirtualAlloc" and process.Ext.api.parameters.size >= 10000 and
process.Ext.api.summary like "*COMMIT*" and process.thread.Ext.call_stack_final_user_module.name == "Unbacked" and
process.name in~ ("iexplore.exe", "chrome.exe", "msedge.exe") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like ("Kernel", "Kernel|*")) and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*", "chrome.exe", "chrome.exe|*", "msedge.exe", "msedge.exe|*") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("1a9ca25a7d7f11f6be10dee684505ee4b3340a0d3cbc22d959e69322e7cf0848",
"d09f0ed19b426b1f78de9b736f6c1f667b3e689c1927e6a3466423ddf88fd4a4") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("chrome.exe", "chrome.exe|*", "msedge.exe", "msedge.exe|*") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq |
process.Ext.api.parameters.size | ge |
| field:"process.Ext.api.parameters.size" kind:ge value:"10000" |
process.Ext.api.summary | wildcard |
| field:"process.Ext.api.summary" kind:wildcard value:"*COMMIT*" |
process.name | in |
| field:"process_basename" kind:in |
process.thread.Ext.call_stack_final_user_module.name | eq |
| field:"process.thread.Ext.call_stack_final_user_module.name" kind:eq value:"Unbacked" |
Exclusions
The rule actively suppresses these predicates.
Potential TCC Bypass via Electron Web Inspector API
#Adversaries can abuse Electron default configuration which allows executing code in the context of those Electron apps and thus inherit their TCC permissions. It’s a technique that doesn’t touch files of those apps so it also bypasses the new macOS Ventura App Protection mechanism.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
Rule Body
[rule]
description = """
Adversaries can abuse Electron default configuration which allows executing code in the context of those Electron apps
and thus inherit their TCC permissions. It’s a technique that doesn’t touch files of those apps so it also bypasses the
new macOS Ventura App Protection mechanism.
"""
id = "f150809c-5f4b-4715-b4a6-4bc8b9929d65"
license = "Elastic License v2"
name = "Potential TCC Bypass via Electron Web Inspector API"
os_list = ["macos"]
reference = [
"https://infocondb.org/con/def-con/def-con-31/electronizing-macos-privacy-a-new-weapon-in-your-red-teaming-armory",
"https://github.com/r3ggi/electroniz3r",
]
version = "1.0.7"
query = '''
process where event.type == "start" and event.action == "exec" and
(
(process.executable like ("/Applications/*", "/Volumes/*") and process.command_line like~ "*--inspect=13337*") or
(process.parent.executable like ("/Applications/*", "/Volumes/*") and process.command_line like~ "*--inspect=13337*")
)
'''
min_endpoint_version = "8.6.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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.6.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
(
(process.executable like ("/Applications/*", "/Volumes/*") and process.command_line like~ "*--inspect=13337*") or
(process.parent.executable like ("/Applications/*", "/Volumes/*") and process.command_line like~ "*--inspect=13337*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*--inspect=13337*" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
Process Capability Enumeration
#Identifies recursive process capability enumeration of the entire filesystem through the getcap command. Malicious users may manipulate identified capabilities to gain root privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[metadata]
creation_date = "2024/01/09"
integration = ["endpoint", "crowdstrike"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Identifies recursive process capability enumeration of the entire filesystem through the getcap command. Malicious users
may manipulate identified capabilities to gain root privileges.
"""
from = "now-9m"
index = ["endgame-*", "logs-crowdstrike.fdr*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Process Capability Enumeration"
risk_score = 47
rule_id = "5c351f54-4187-4ad8-abc8-29b0cfbef8b1"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Crowdstrike",
"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", "ProcessRollup2") and
process.name == "getcap" and process.args == "-r" and process.args == "/" and
process.args_count == 3 and user.id != "0"
'''
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 Process Capability Enumeration
In Linux environments, the `getcap` command is used to list file capabilities, which define specific privileges for executables. Adversaries may exploit this by recursively scanning the filesystem to identify and manipulate capabilities, potentially escalating privileges. The detection rule identifies suspicious use of `getcap` by monitoring for its execution with specific arguments, especially by non-root users, indicating potential misuse.
### Possible investigation steps
- Review the alert details to confirm the execution of the `getcap` command with the arguments `-r` and `/`, ensuring the process was initiated by a non-root user (user.id != "0").
- Identify the user account associated with the process execution to determine if the user has a legitimate reason to perform such actions.
- Examine the process execution history for the identified user to check for any other suspicious activities or commands executed around the same time.
- Investigate the system logs for any signs of privilege escalation attempts or unauthorized access following the execution of the `getcap` command.
- Check for any recent changes to file capabilities on the system that could indicate manipulation by the adversary.
- Assess the system for any other indicators of compromise or related alerts that might suggest a broader attack campaign.
### False positive analysis
- System administrators or automated scripts may use the getcap command for legitimate auditing purposes. To handle this, create exceptions for known administrative accounts or scripts that regularly perform capability checks.
- Security tools or monitoring solutions might trigger the rule during routine scans. Identify these tools and exclude their processes from triggering alerts by adding them to an allowlist.
- Developers or testing environments may execute getcap as part of software testing or development processes. Exclude specific user IDs or groups associated with these environments to prevent unnecessary alerts.
- Scheduled maintenance tasks might involve capability enumeration. Document and exclude these tasks by specifying the time frames or user accounts involved in the maintenance activities.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further exploitation or lateral movement by the adversary.
- Terminate any unauthorized or suspicious processes associated with the `getcap` command to halt potential privilege escalation activities.
- Conduct a thorough review of the system's file capabilities using a trusted method to identify any unauthorized changes or suspicious capabilities that may have been set.
- Revert any unauthorized capability changes to their original state to ensure that no elevated privileges are retained by malicious users.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
- Implement monitoring for similar `getcap` command executions across the environment to detect and respond to future attempts promptly.
- Review and update access controls and user permissions to ensure that only authorized users have the necessary privileges to execute potentially sensitive commands like `getcap`."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1057"
name = "Process Discovery"
reference = "https://attack.mitre.org/techniques/T1057/"
[[rule.threat.technique]]
id = "T1083"
name = "File and Directory Discovery"
reference = "https://attack.mitre.org/techniques/T1083/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "ProcessRollup2") and
process.name == "getcap" and process.args == "-r" and process.args == "/" and
process.args_count == 3 and user.id != "0"
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 |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"3" |
process.name | eq |
| field:"process_basename" kind:eq value:"getcap" |
user.id | ne |
| field:"user.id" kind:ne value:"0" |
Service Account Namespace Read Detected via Defend for Containers
#This rule detects the reading of the service account namespace file inside a container. The service account namespace file is used to identify the namespace of the container in which it is running, and may be used by an adversary to get a better understanding of the container and the services running inside it.
Known False Positives
- There is a potential for false positives if the reading of the service account namespace file is used for legitimate purposes, such as debugging or troubleshooting. It is important to investigate any alerts generated by this rule to determine if they are indicative of malicious activity or part of legitimate container activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery | |
| Collection |
Rule Body
[metadata]
creation_date = "2026/01/21"
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 reading of the service account namespace file inside a container. The service account namespace file
is used to identify the namespace of the container in which it is running, and may be used by an adversary to get a better
understanding of the container and the services running inside it.
"""
false_positives = [
"""
There is a potential for false positives if the reading of the service account namespace file is used for legitimate purposes,
such as debugging or troubleshooting. It is important to investigate any alerts generated by this rule to determine
if they are indicative of malicious activity or part of legitimate container activity.
""",
]
from = "now-6m"
index = ["logs-cloud_defend.file*", "logs-cloud_defend.process*"]
interval = "5m"
language = "eql"
license = "Elastic License v2"
name = "Service Account Namespace Read Detected via Defend for Containers"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Service Account Namespace Read Detected via Defend for Containers
This rule flags a process inside a container opening /var/run/secrets/kubernetes.io/serviceaccount/namespace, which reveals the pod’s Kubernetes namespace; adversaries use this quick check to orient themselves and scope discovery. A common pattern is: after landing a shell in a pod, the attacker reads the namespace file, then issues namespace-scoped kubectl or direct API calls to list Deployments, Secrets, and ServiceAccounts, map privileges and service endpoints, and plan targeted lateral movement within that namespace.
### Possible investigation steps
- Build the process tree and shell session timeline around the event to identify the parent and child processes, interactive TTY, and exact commands executed before and after.
- Map the container to its pod, namespace, node, image, owner, and service account, and verify whether any kubectl exec/attach or debug container activity targeting this pod is expected at that time.
- Correlate Kubernetes audit logs for that service account and pod around the timestamp to spot list/get calls, Secrets or ServiceAccounts enumeration, and the user/IP that initiated any exec/attach.
- Inspect network flows and DNS from the container to the Kubernetes API server immediately after the event to confirm follow-on API access or token validation attempts.
- Review the service account’s RBAC bindings and search the container for reads of the token/ca.crt or the presence of kubectl/kubeconfig or scripts that could leverage the token.
### False positive analysis
- During legitimate troubleshooting, a user opens an interactive shell in the container and the shell’s profile or prompt customization reads /var/run/secrets/kubernetes.io/serviceaccount/namespace to display the current namespace.
- A documented operational check or training exercise instructs staff to manually open the service account namespace file inside a container to confirm the environment before changes, producing a benign detection.
### Response and remediation
- Immediately kill the interactive shell process inside the container (e.g., bash/sh attached via kubectl exec) and quarantine the pod/namespace by applying a deny-all NetworkPolicy and pausing the owning Deployment/StatefulSet.
- Escalate to a major incident and page the on-call cluster security team if you observe subsequent reads of /var/run/secrets/kubernetes.io/serviceaccount/token or ca.crt or API calls from the pod to the Kubernetes API (443) that list Secrets or ServiceAccounts.
- Rotate the service account credentials by deleting the pod to force a new projected token, set automountServiceAccountToken: false on the workload if not needed, and remove pods/exec and pods/attach privileges from users or roles that accessed this pod.
- Redeploy the workload from a trusted, signed image without embedded shells/kubectl, verify image digest on rollout, and only lift quarantine after confirming no unauthorized containers, cronjobs, or startup scripts were added.
- Enforce least-privilege RBAC for the service account (deny list/get on Secrets, ConfigMaps, and Pods in the namespace), enable Pod Security Admission restricted with readOnlyRootFilesystem and dropped Linux capabilities, and require approvals for kubectl exec using ephemeral containers for debugging.
"""
risk_score = 21
rule_id = "f7c64a1b-9d00-4b92-9042-d3bb4196899a"
severity = "low"
tags = [
"Data Source: Elastic Defend for Containers",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
any where host.os.type == "linux" and container.id like "*" and (
(event.category == "file" and event.type == "change" and event.action == "open" and
file.path in (
"/var/run/secrets/kubernetes.io/serviceaccount/namespace",
"/run/secrets/kubernetes.io/serviceaccount/namespace"
)) or
(event.category == "process" and event.type == "start" and event.action == "exec" and
(
process.name in ("cat", "head", "tail", "more", "less", "sed", "awk") or
process.args in (
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"head", "/bin/head", "/usr/bin/head", "/usr/local/bin/head",
"tail", "/bin/tail", "/usr/bin/tail", "/usr/local/bin/tail",
"more", "/bin/more", "/usr/bin/more", "/usr/local/bin/more",
"less", "/bin/less", "/usr/bin/less", "/usr/local/bin/less",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
)
) and process.args like "*/run/secrets/kubernetes.io/serviceaccount/namespace*"
)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[[rule.threat.technique]]
id = "T1613"
name = "Container and Resource Discovery"
reference = "https://attack.mitre.org/techniques/T1613/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1005"
name = "Data from Local System"
reference = "https://attack.mitre.org/techniques/T1005/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
Stages and Predicates
Stage 1: any
any where host.os.type == "linux" and container.id like "*" and (
(event.category == "file" and event.type == "change" and event.action == "open" and
file.path in (
"/var/run/secrets/kubernetes.io/serviceaccount/namespace",
"/run/secrets/kubernetes.io/serviceaccount/namespace"
)) or
(event.category == "process" and event.type == "start" and event.action == "exec" and
(
process.name in ("cat", "head", "tail", "more", "less", "sed", "awk") or
process.args in (
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"head", "/bin/head", "/usr/bin/head", "/usr/local/bin/head",
"tail", "/bin/tail", "/usr/bin/tail", "/usr/local/bin/tail",
"more", "/bin/more", "/usr/bin/more", "/usr/local/bin/more",
"less", "/bin/less", "/usr/bin/less", "/usr/local/bin/less",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
)
) and process.args like "*/run/secrets/kubernetes.io/serviceaccount/namespace*"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
container.id | wildcard |
| field:"container.id" kind:wildcard value:"*" |
event.action | eq |
| field:"EventType" kind:eq |
event.category | eq |
| field:"event.category" kind:eq |
event.type | eq |
| field:"event.type" kind:eq |
file.path | in |
| field:"TargetFilename" kind:in |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"*/run/secrets/kubernetes.io/serviceaccount/namespace*" |
process.name | in |
| field:"process_basename" kind:in |
Suspicious Memory Protection Fluctuation
#Identifies mutiple calls to change the memory protection of a memory address to avoid leaving suspicious allocation properties.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies mutiple calls to change the memory protection of a memory address to avoid leaving suspicious allocation
properties.
"""
id = "78165d05-f1d6-4c5c-bb4d-b618df979868"
license = "Elastic License v2"
name = "Suspicious Memory Protection Fluctuation"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.15"
query = '''
sequence by process.entity_id, process.Ext.api.parameters.address with maxspan=30s
[api where process.Ext.api.name in ("VirtualAlloc", "VirtualAllocEx") and process.Ext.api.parameters.protection == "R-X" and
process.executable != null and process.thread.Ext.call_stack_summary : "?*" and process.thread.Ext.call_stack_final_user_module.name != null and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance in ("Unknown", "Kernel", "Undetermined") and
not (process.code_signature.subject_name in ("Mozilla Corporation", "Google LLC", "WATERFOX LIMITED", "TRACKER SOFTWARE PRODUCTS (CANADA) LIMITED", "Tracker Software Products (Canada) Ltd.") and
process.code_signature.trusted == true) and
not process.thread.Ext.call_stack_final_user_module.name == "xul.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("*\\xul.dll!worker*", "*\\xul.dll!XRE_GetBootstrap*", "*\\mozjs*.dll!?SetJitExceptionHandler*", "*xul.dll!?JS_NondeterministicGetWeakSetKeys*")) and
not process.thread.Ext.call_stack_final_user_module.path :
("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"\\program files\\*",
"\\program files (x86)\\*",
"?:\\windows\\microsoft.net\\framework*.dll",
"\\windows\\microsoft.net\\framework*.dll",
"?:\\windows\\system32\\*",
"\\windows\\system32\\*",
"?:\\windows\\winsxs\\*",
"\\windows\\winsxs\\*",
"?:\\windows\\syswow64\\*",
"\\windows\\syswow64\\*",
"?:\\Windows\\assembly\\*",
"\\Windows\\assembly\\*",
"\\device\\mup\\*\\firefox64\\xul.dll") and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("a0d649241c61e72592a78effcece1557a07548fda6ac1741a53e69ee3e02946b",
"649ede91f00d784ed1e397ece6e5f13dbe6cd9d86c06b424834c443c32727bae",
"adde1c4ba76c8e63844fac145f097002cbfc4b1af63656fb8cfbb8ebebc4375a",
"ecc94be9f5e799870165d3e4c1020dc63bb09be5b08d3dfda5d1c42274a5139f",
"8ccea1ef9db1d0632b7c1ac2c102d04510ff4c174ec4ae74c31103718aad2c93",
"5cdf6b8fa6b2e42335817bc76154f4368836c8312e0347dee2d9ff7dc9957eac",
"65b5fe209d52b979ee4fd0b13400c99e042ccb29d6bae5b4e06499a285f00a38",
"10cc18de06e6da9f9f50e631517574a1cda426c763ac6d32ce9dc7aa318a12a2",
"c58928c71946618d3cb398e11de5479b72425d94fa79c1610162d86446164b46",
"701f7cfedf760bddfe5f6bd612a98c6f213566e2cde77498ee858aa3b21db1f2",
"e2fb31b99ac5b3ef4b89f6164ad9dddbe59854bc6f7b557ce6f8a2e4378343fd",
"99d3cdd904235ca722af98aa009f0551cbe92d25d1a332fe7bca85a6f38448bf",
"2bda92ee609ccfa0458615fd1362f8f247fe5e4b8d4c52b08188f21b165c8573",
"22e25bd041fcf81df167432a1f2dc5135aa3adb0b037bb52dbd92a189cba2be8",
"692686ecf173d8d584ceb6c02530fa03740b6a9b9966a11286c73635b629a7ba",
"c0f87e6cac3fe794d4af73a5e168a6a888524ac85dc0a5cdcf4e76b4813194c6",
"a02e79ac860a2d9692ae28a02612fcdc6aa6aba6d6cc1be4872675ab4707ff17",
"46f44971b785b0d6a855872160ae1089ea8aa8f6528f25c545787a5d182cc15e",
"ea7930ed7ddc763c25df5897dfd8ed4ea34c07a5ddbf398bbeccf10361cf4229",
"5124b3a0bd20b3b5e84dea626a11db69c28a96953dea0862e719e12222bff417",
"e30aabb518361fbeaf8068ffc786845ee84abbf1f71ae7d2733a11286531595a",
"29a4795452cb3d618edcbdc02790d8026b75197d220b2904091802c08c515aee",
"0f4029d738d76ac51cec9eacefd35fc18fa1f4a9a98e6f18f050694c925dc464",
"6af8cd66ac54c6615a3b7b8ddc0913f0e2c182ecaf38e8f8c2ed7330e80c0660")
]
[api where process.Ext.api.name : "VirtualProtect*" and process.Ext.api.parameters.protection : "RW-"]
[api where process.Ext.api.name : "VirtualProtect*" and process.Ext.api.parameters.protection : "R-X"]
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[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.10.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.Ext.api.parameters.address, process.entity_id.
Stage 1: api
[api where process.Ext.api.name in ("VirtualAlloc", "VirtualAllocEx") and process.Ext.api.parameters.protection == "R-X" and
process.executable != null and process.thread.Ext.call_stack_summary : "?*" and process.thread.Ext.call_stack_final_user_module.name != null and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance in ("Unknown", "Kernel", "Undetermined") and
not (process.code_signature.subject_name in ("Mozilla Corporation", "Google LLC", "WATERFOX LIMITED", "TRACKER SOFTWARE PRODUCTS (CANADA) LIMITED", "Tracker Software Products (Canada) Ltd.") and
process.code_signature.trusted == true) and
not process.thread.Ext.call_stack_final_user_module.name == "xul.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("*\\xul.dll!worker*", "*\\xul.dll!XRE_GetBootstrap*", "*\\mozjs*.dll!?SetJitExceptionHandler*", "*xul.dll!?JS_NondeterministicGetWeakSetKeys*")) and
not process.thread.Ext.call_stack_final_user_module.path :
("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"\\program files\\*",
"\\program files (x86)\\*",
"?:\\windows\\microsoft.net\\framework*.dll",
"\\windows\\microsoft.net\\framework*.dll",
"?:\\windows\\system32\\*",
"\\windows\\system32\\*",
"?:\\windows\\winsxs\\*",
"\\windows\\winsxs\\*",
"?:\\windows\\syswow64\\*",
"\\windows\\syswow64\\*",
"?:\\Windows\\assembly\\*",
"\\Windows\\assembly\\*",
"\\device\\mup\\*\\firefox64\\xul.dll") and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("a0d649241c61e72592a78effcece1557a07548fda6ac1741a53e69ee3e02946b",
"649ede91f00d784ed1e397ece6e5f13dbe6cd9d86c06b424834c443c32727bae",
"adde1c4ba76c8e63844fac145f097002cbfc4b1af63656fb8cfbb8ebebc4375a",
"ecc94be9f5e799870165d3e4c1020dc63bb09be5b08d3dfda5d1c42274a5139f",
"8ccea1ef9db1d0632b7c1ac2c102d04510ff4c174ec4ae74c31103718aad2c93",
"5cdf6b8fa6b2e42335817bc76154f4368836c8312e0347dee2d9ff7dc9957eac",
"65b5fe209d52b979ee4fd0b13400c99e042ccb29d6bae5b4e06499a285f00a38",
"10cc18de06e6da9f9f50e631517574a1cda426c763ac6d32ce9dc7aa318a12a2",
"c58928c71946618d3cb398e11de5479b72425d94fa79c1610162d86446164b46",
"701f7cfedf760bddfe5f6bd612a98c6f213566e2cde77498ee858aa3b21db1f2",
"e2fb31b99ac5b3ef4b89f6164ad9dddbe59854bc6f7b557ce6f8a2e4378343fd",
"99d3cdd904235ca722af98aa009f0551cbe92d25d1a332fe7bca85a6f38448bf",
"2bda92ee609ccfa0458615fd1362f8f247fe5e4b8d4c52b08188f21b165c8573",
"22e25bd041fcf81df167432a1f2dc5135aa3adb0b037bb52dbd92a189cba2be8",
"692686ecf173d8d584ceb6c02530fa03740b6a9b9966a11286c73635b629a7ba",
"c0f87e6cac3fe794d4af73a5e168a6a888524ac85dc0a5cdcf4e76b4813194c6",
"a02e79ac860a2d9692ae28a02612fcdc6aa6aba6d6cc1be4872675ab4707ff17",
"46f44971b785b0d6a855872160ae1089ea8aa8f6528f25c545787a5d182cc15e",
"ea7930ed7ddc763c25df5897dfd8ed4ea34c07a5ddbf398bbeccf10361cf4229",
"5124b3a0bd20b3b5e84dea626a11db69c28a96953dea0862e719e12222bff417",
"e30aabb518361fbeaf8068ffc786845ee84abbf1f71ae7d2733a11286531595a",
"29a4795452cb3d618edcbdc02790d8026b75197d220b2904091802c08c515aee",
"0f4029d738d76ac51cec9eacefd35fc18fa1f4a9a98e6f18f050694c925dc464",
"6af8cd66ac54c6615a3b7b8ddc0913f0e2c182ecaf38e8f8c2ed7330e80c0660")
]
Stage 2: api
[api where process.Ext.api.name : "VirtualProtect*" and process.Ext.api.parameters.protection : "RW-"]
Stage 3: api
[api where process.Ext.api.name : "VirtualProtect*" and process.Ext.api.parameters.protection : "R-X"]
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | in | Google LLC, Mozilla Corporation, TRACKER SOFTWARE PRODUCTS (CANADA) LIMITED, Tracker Software Products (Canada) Ltd., WATERFOX LIMITED | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | in | 0f4029d738d76ac51cec9eacefd35fc18fa1f4a9a98e6f18f050694c925dc464, 10cc18de06e6da9f9f50e631517574a1cda426c763ac6d32ce9dc7aa318a12a2, 22e25bd041fcf81df167432a1f2dc5135aa3adb0b037bb52dbd92a189cba2be8, 29a4795452cb3d618edcbdc02790d8026b75197d220b2904091802c08c515aee, 2bda92ee609ccfa0458615fd1362f8f247fe5e4b8d4c52b08188f21b165c8573, 46f44971b785b0d6a855872160ae1089ea8aa8f6528f25c545787a5d182cc15e, 5124b3a0bd20b3b5e84dea626a11db69c28a96953dea0862e719e12222bff417, 5cdf6b8fa6b2e42335817bc76154f4368836c8312e0347dee2d9ff7dc9957eac, 649ede91f00d784ed1e397ece6e5f13dbe6cd9d86c06b424834c443c32727bae, 65b5fe209d52b979ee4fd0b13400c99e042ccb29d6bae5b4e06499a285f00a38, 692686ecf173d8d584ceb6c02530fa03740b6a9b9966a11286c73635b629a7ba, 6af8cd66ac54c6615a3b7b8ddc0913f0e2c182ecaf38e8f8c2ed7330e80c0660, 701f7cfedf760bddfe5f6bd612a98c6f213566e2cde77498ee858aa3b21db1f2, 8ccea1ef9db1d0632b7c1ac2c102d04510ff4c174ec4ae74c31103718aad2c93, 99d3cdd904235ca722af98aa009f0551cbe92d25d1a332fe7bca85a6f38448bf, a02e79ac860a2d9692ae28a02612fcdc6aa6aba6d6cc1be4872675ab4707ff17, a0d649241c61e72592a78effcece1557a07548fda6ac1741a53e69ee3e02946b, adde1c4ba76c8e63844fac145f097002cbfc4b1af63656fb8cfbb8ebebc4375a, c0f87e6cac3fe794d4af73a5e168a6a888524ac85dc0a5cdcf4e76b4813194c6, c58928c71946618d3cb398e11de5479b72425d94fa79c1610162d86446164b46, e2fb31b99ac5b3ef4b89f6164ad9dddbe59854bc6f7b557ce6f8a2e4378343fd, e30aabb518361fbeaf8068ffc786845ee84abbf1f71ae7d2733a11286531595a, ea7930ed7ddc763c25df5897dfd8ed4ea34c07a5ddbf398bbeccf10361cf4229, ecc94be9f5e799870165d3e4c1020dc63bb09be5b08d3dfda5d1c42274a5139f | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
process.thread.Ext.call_stack_final_user_module.name | eq | xul.dll | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"xul.dll" |
process.thread.Ext.call_stack_final_user_module.name | in | Kernel, Undetermined, Unknown | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" |
process.thread.Ext.call_stack_final_user_module.path | wildcard | ?:\Program Files\*, ?:\Program Files (x86)\*, \program files\*, \program files (x86)\*, ?:\windows\microsoft.net\framework*.dll, \windows\microsoft.net\framework*.dll, ?:\windows\system32\*, \windows\system32\*, ?:\windows\winsxs\*, \windows\winsxs\*, ?:\windows\syswow64\*, \windows\syswow64\*, ?:\Windows\assembly\*, \Windows\assembly\*, \device\mup\*\firefox64\xul.dll | excludes:process.thread.Ext.call_stack_final_user_module.path |
process.thread.Ext.call_stack_final_user_module.protection_provenance | in | Kernel, Undetermined, Unknown | excludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Unknown" |
Suspicious Outlook Child Process
#Identifies suspicious child processes spawned by MS Outlook, which can indicate a potential masquerading or the exploitation of a vulnerability on the application causing it to execute code.
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]
bypass_bbr_timing = true
creation_date = "2025/01/10"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies suspicious child processes spawned by MS Outlook, which can indicate a potential masquerading or the
exploitation of a vulnerability on the application causing it to execute code.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Outlook Child Process"
risk_score = 21
rule_id = "6cf17149-a8e3-44ec-9ec9-fdc8535547a1"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Tactic: Persistence",
"Rule Type: BBR",
"Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "outlook.exe" and
not (
(
process.executable : (
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\system32\\wermgr.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\Users\\*\\AppData\\Local\\Temp\\NewOutlookInstall\\NewOutlookInstaller.exe",
"?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
"?:\\Users\\*\\AppData\\Local\\Island\\Island\\Application\\Island.exe",
"?:\\Users\\*\\AppData\\Local\\Mozilla Firefox\\firefox.exe",
"?:\\Users\\*\\AppData\\Roaming\\Zoom\\bin\\Zoom.exe",
"?:\\Windows\\System32\\IME\\SHARED\\IMEWDBLD.EXE",
"?:\\Windows\\System32\\spool\\drivers\\x64\\*",
"?:\\Windows\\System32\\prevhost.exe",
"?:\\Windows\\System32\\dwwin.exe",
"?:\\Windows\\System32\\mspaint.exe",
"?:\\Windows\\SysWOW64\\mspaint.exe",
"?:\\Windows\\System32\\notepad.exe",
"?:\\Windows\\SysWOW64\\notepad.exe",
"?:\\Windows\\System32\\smartscreen.exe",
"?:\\Windows\\explorer.exe",
"?:\\Windows\\splwow64.exe"
) and process.code_signature.trusted == true
) or
(
process.name : "rundll32.exe" and
process.args : "*hpmsn???.dll,MonitorPrintJobStatus*"
)
)
'''
[[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.001"
name = "Invalid Code Signature"
reference = "https://attack.mitre.org/techniques/T1036/001/"
[[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 = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[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 = "T1554"
name = "Compromise Host Software Binary"
reference = "https://attack.mitre.org/techniques/T1554/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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: process
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : "outlook.exe" and
not (
(
process.executable : (
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\system32\\wermgr.exe",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe",
"?:\\Users\\*\\AppData\\Local\\Temp\\NewOutlookInstall\\NewOutlookInstaller.exe",
"?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
"?:\\Users\\*\\AppData\\Local\\Island\\Island\\Application\\Island.exe",
"?:\\Users\\*\\AppData\\Local\\Mozilla Firefox\\firefox.exe",
"?:\\Users\\*\\AppData\\Roaming\\Zoom\\bin\\Zoom.exe",
"?:\\Windows\\System32\\IME\\SHARED\\IMEWDBLD.EXE",
"?:\\Windows\\System32\\spool\\drivers\\x64\\*",
"?:\\Windows\\System32\\prevhost.exe",
"?:\\Windows\\System32\\dwwin.exe",
"?:\\Windows\\System32\\mspaint.exe",
"?:\\Windows\\SysWOW64\\mspaint.exe",
"?:\\Windows\\System32\\notepad.exe",
"?:\\Windows\\SysWOW64\\notepad.exe",
"?:\\Windows\\System32\\smartscreen.exe",
"?:\\Windows\\explorer.exe",
"?:\\Windows\\splwow64.exe"
) and process.code_signature.trusted == true
) or
(
process.name : "rundll32.exe" and
process.args : "*hpmsn???.dll,MonitorPrintJobStatus*"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"outlook.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | match | hpmsn???.dll,MonitorPrintJobStatus | excludes:process.args field:"process.args" value:"hpmsn???.dll,MonitorPrintJobStatus" |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | ?:\Program Files\*, ?:\Program Files (x86)\*, ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\system32\wermgr.exe, ?:\Users\*\AppData\Local\Microsoft\Teams\current\Teams.exe, ?:\Users\*\AppData\Local\Temp\NewOutlookInstall\NewOutlookInstaller.exe, ?:\Users\*\AppData\Local\Google\Chrome\Application\chrome.exe, ?:\Users\*\AppData\Local\Island\Island\Application\Island.exe, ?:\Users\*\AppData\Local\Mozilla Firefox\firefox.exe, ?:\Users\*\AppData\Roaming\Zoom\bin\Zoom.exe, ?:\Windows\System32\IME\SHARED\IMEWDBLD.EXE, ?:\Windows\System32\spool\drivers\x64\*, ?:\Windows\System32\prevhost.exe, ?:\Windows\System32\dwwin.exe, ?:\Windows\System32\mspaint.exe, ?:\Windows\SysWOW64\mspaint.exe, ?:\Windows\System32\notepad.exe, ?:\Windows\SysWOW64\notepad.exe, ?:\Windows\System32\smartscreen.exe, ?:\Windows\explorer.exe, ?:\Windows\splwow64.exe | excludes:process.executable |
Suspicious PowerShell Execution
#Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware installation leveraging PowerShell.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[rule]
description = """
Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware
installation leveraging PowerShell.
"""
id = "65784f6e-247a-466b-bbfb-cd92024f7e82"
license = "Elastic License v2"
name = "Suspicious PowerShell Execution"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/dipping-into-danger",
"https://www.elastic.co/security-labs/doing-time-with-the-yipphb-dropper",
"https://www.elastic.co/security-labs/unmasking-financial-services-intrusion-ref0657",
]
version = "1.0.53"
query = '''
process where event.action == "start" and process.name : "powershell.exe" and process.parent.executable != null and
not user.id : "S-1-5-18" and
/*
following exclusions are covered by other rules
- Suspicious Execution via Windows Management Instrumentation
- Suspicious Windows Schedule Child Process
- PowerShell Obfuscation Spawned via Microsoft Office
- Suspicious PowerShell Execution via Windows Scripts
*/
not (process.parent.executable :
("?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\wbem\\WmiPrvSe.exe",
"?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Users\\*\\AppData\\Local\\gitkraken\\app-*\\gitkraken.exe",
"?:\\Windows\\System32\\taskeng.exe",
"?:\\Windows\\cybercnsagent\\cybercnsagent.exe",
"?:\\Windows\\SysWOW64\\WindowsPowerShell\\*\\powershell_ise.exe",
"?:\\Windows\\System32\\WindowsPowerShell\\*\\powershell_ise.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*\\SenseIR.exe") and not process.parent.name : "java.exe") and
not process.parent.name : ("wscript.exe", "cscript.exe") and
not (process.args:"-NonInteractive" and process.args :"-InputFormat") and
not (process.args : ("RemoteSigned", "-ExecutionPolicy", "write-host") and
not process.parent.name : ("explorer.exe", "python.exe", "cmd.exe")) and
not process.args : "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('cGFzc3dvcmQ='))" and
not (process.command_line : "*echo ~/.ansible/tmp/ansible-tmp*" and process.parent.executable : "C:\\Windows\\System32\\OpenSSH\\sshd.exe") and
not (process.args : "$OutputEncoding = [System.Text.Encoding]::UTF8; $b64='eyJjb252ZXJzYXRpb25faWQiOiJ*" and process.parent.name : "Cursor.exe") and
not process.command_line :
("*ConvertTo-Json*Write-Host*",
"*BrowserExtension.dll*WebCompanion.BrowserExtension*",
"*-ExecutionPolicy*Write-Verbose*",
"*webClient.Headers.add*",
"*System.Management.Automation.Host.Size*",
"*JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQ*",
"*chocolatey.org*",
"*Get-WmiObject*",
"*artifacts.elastic.co*",
"*officecdn.microsoft.com*",
"*CgAgACAAIAAgACAAIAAgACAAJABTAGMAcgBpAHAAdAAgACA*",
"*Program Files*",
"*).Access.IdentityReference;$defaults*",
"*https://repo.maven.apache.org*",
"*\\CSIWorking\\system\\WinSCP\\winscp.com*",
"*@Files.onetech.cc*",
"*Register-AzureADConnectHealthADDSAgent*",
"*\\ProgramData\\Microsoft\\LogConverter\\*",
"*WinSCP.com*",
"*SNC_isWmi*",
"*--app-id=memtime-*",
"*BkAGEAdABhAGIAYQBzAGUALgB3AGkAbgBkAG8AdwBzAC4AbgBlAHQA*",
"*FsAdgBlAHIAcwBpAG8AbgBdACQAbQBpAG4AaQBtAHUAbQBWAGUAcgBzAGkAbwBuACAAPQAgACcAMgAuADIALgAwACcA*",
"*https://tshf.sas.com/techsup/download/hotfix/*",
"*scripts\\buildsystems\\msbuild*",
"*.vscode\\extensions\\ms-dynamics-smb*",
"*$ErrorActionPreference*$adsiMember*",
"*$ErrorActionPreference*$rgx_log4j*",
"*$env:APPDATA\"+'\\Browser Assistant\\*",
"*APPDATA\"+'/Browser Extension/BE.txt*",
"*$env:APPDATA\"+'/BBWC/*",
"*ReadAllBytes($w+'Newtonsoft.Json.dll*",
"*https://go.microsoft.com/fwlink*",
"*krsfile:////LOBCS*",
"*ProgramData\\VinitySoft Data\\MariaDb\\*",
"*\\Temp\\claude\\claude-pwd-ps-*",
"*https://10.55.138.214:443/downloads/*",
"\"C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe\" -noexit -command \"[reflection.assembly]::loadFrom('.\\RD-PSAPI.dll') | import-module\"",
"*-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAfABUAHIAZQBsAGwAaQB4ACIA*",
"*-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAIABBAGcAZQBuAHQAIgA=*",
"*JABjAGwAcwA9ACcATQBvAHUAcwBlACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*",
"*JABjAGwAcwA9ACcASwBlAHkAYgBvAGEAcgBkACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*",
"*JABjAHYAIAA9ACAARwBlAHQALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgACcASABLAEwATQA6AFwAUwBPAEYAVABXAEEAUgBFAFwATQBpAGMAcgBvAHMAbwBmAHQAXABXAGkAbgBkAG8AdwBzACAATgBUAFwAQwB1AHIAcgBlAG4AdABWAGUAcgBzAGkAbwBuACcACgAiACQAKAAkAGMAdgAuAFAAcgBvAGQAdQBjAHQATgBhAG0AZQApAHwAJAAoACQAYwB2AC4ARABpAHMAcABsAGEAeQBWAGUAcgBzAGkAbwBuACkAf*",
/* inventory tooling checking the installed Chrome version: $ErrorActionPreference='silentlycontinue'; $tmp = (Get-Item -Path "$env:PROGRAMFILES\Google\Chrome\Application\chrome.exe") */
"*JABFAHIAcgBvAHIAQQBjAHQAaQBvAG4AUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAcwBpAGwAZQBuAHQAbAB5AGMAbwBuAHQAaQBuAHUAZQAnADsAIAAkAHQAbQBwACAAPQAgACgARwBlAHQALQBJAHQAZQBtACAALQBQAGEAdABoACAAIgAkAGUAbgB2ADoAUABSAE8ARwBSAEEATQBGAEkATABFAFMAXABHAG8AbwBnAGwAZQBcAEMAaAByAG8AbQBlAFwA*",
/* base64 alignment variant of the Az.Accounts minimum version check already excluded above: \n$ErrorActionPreference = 'Stop'\n[version]$minimumVersion = '2.2.0' */
"*CgAkAEUAcgByAG8AcgBBAGMAdABpAG8AbgBQAHIAZQBmAGUAcgBlAG4AYwBlACAAPQAgACcAUwB0AG8AcAAnAAoAWwB2AGUAcgBzAGkAbwBuAF0AJABtAGkAbgBpAG0AdQBtAFYAZQByAHMAaQBvAG4A*") and
not process.parent.args : "([Datetime]::ParseExact($_.InstalledOn," and
not process.command_line : ("PowerShell*hkguTzSCb75g7sJ9ChMcmAOPpeBL9ZJy/tejnoCjT+E=*", "*.LastWriteTime.ToFileTime*", "*New-Object*Net.Mail.SmtpClien*") and
not (process.parent.name : "cmd.exe" and
(process.parent.command_line : "*\\WindowsPowershell\\*\\powershell*" or process.parent.args : ("-Command", "-OutputFormat", "-InputFormat"))) and
not process.parent.name : "powershell.exe" and
not (process.parent.name : "cmd.exe" and process.parent.args : ("*.cmd", "*.bat") and process.command_line: "*Get-Content*Set-Content*") and
not (process.args : "NT\\CurrentVersion').InstallationType;" and process.args : "[System.Text.Encoding]::UTF8.GetBytes($OutStr);") and
not (process.parent.code_signature.trusted == true and process.parent.code_signature.subject_name in ("ControlCase LLC", "HashiCorp, Inc.", "JetBrains s.r.o.", "Johannes Schindelin", "Anomaly Innovations, Inc https://anoma.ly/", "Anthropic, PBC", "Anysphere, Inc.", "Denver Technologies, Inc. dba Warp")) and
not process.parent.command_line : "\"C:\\Windows\\system32\\cmd.exe\" " and
not (process.parent.name : "Cursor.exe" and process.command_line : "* dotnet csharpier format*") and
not (process.parent.name : "codex*.exe" and process.args : "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;*") and
not process.working_directory : "C:\\ProgramData\\VinitySoft Data\\MariaDb\\" and
not process.parent.executable : ("C:\\Users\\*\node_modules\\@openai\\codex\\bin\\codex-x86_64-pc-windows-msvc.exe",
"C:\\Users\\*\\extensions\\openai.chatgpt-*\\bin\\windows-x86_64\\codex.exe",
"C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
"C:\\Users\\*\\@openai\\*\\x86_64-pc-windows-msvc\\codex\\codex.exe",
"C:\\Python312\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Antigravity\\resources\\app\\extensions\\antigravity\\bin\\language_server_windows_x64.exe",
"?:\\Users\\*\\AppData\\Local\\Python\\bin\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Python\\Python*\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Python\\pythoncore-*\\python.exe",
"D:\\Antigravity\\resources\\app\\extensions\\antigravity\\bin\\language_server_windows_x64.exe",
"?:\\Users\\*\\.codex\\.sandbox-bin\\codex-command-runner-*.exe") and
not process.args : ("$w=$env:LOCALAPPDATA+'/OPWC/';[Reflection.Assembly]::Load([System.IO.File]::ReadAllBytes($w+'OperaSharpDLL.dll'));[OperaSharpDLL.Helper]::Startup()",
"IEX (New-Object Net.WebClient).DownloadString('https://install.demo-toolkit.de/dtkupdater.ps1?apikey=*",
"D:\\PowerShell\\webclient.cmd",
"Invoke-WebRequest -Uri https://www.7-zip.org/a/7zr.exe -o '7zr.exe';",
"\"& 'C:\\Program Files (x86)\\combit\\*",
"Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorID | *",
"& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory*") and
not (process.parent.name : "cmd.exe" and
process.parent.args : ("D:\\PowerShell\\webclient.cmd",
"C:\\Temp\\FST-Robocopy-wEmailNotif.cmd",
"C:\\istip-installation\\install.bat",
"'C:\\ProgramData\\PatchBot\\data\\windows-health-after.json';",
"'C:\\ProgramData\\PatchBot\\data\\windows-updates.json';",
"'C:\\ProgramData\\PatchBot\\data\\windows-updates.json')")) and
not (process.parent.executable : "C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" and process.command_line : "*Windows.UI.Notifications*") and
not (process.parent.executable : "C:\\Users\\*\\.vscode\\extensions\\openai.chatgpt*-win32-x64\\bin\\windows-x86_64\\codex.exe" and process.parent.args == "mcp") and
not (process.parent.executable : "C:\\Windows\\System32\\msiexec.exe" and process.args : "https://go.microsoft.com/fwlink/p/?LinkId=*" and
process.args :"$env:TEMP\\MicrosoftEdgeWebview2Setup.exe") and
not process.args : "chcp 65001;[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing');(New-Object System.Drawing.Text.InstalledFontCollection).Families" and
(
process.command_line :
(
"*^*^*^*^*^*^*^*^*^*",
"*`*`*`*`*",
"*+*+*+*+*+*+*",
"*[char[]](*)*-join*",
"*Base64String*",
"*[*Convert]*",
"*.Compression.*",
"*-join($*",
"*.replace*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -enc *",
"* -ec *",
"* /e *",
"* /enc *",
"* /ec *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"* iex*",
"*;iex*",
"* iwr*",
"*;iwr *",
"*;saps *",
"* aQB3AHIAIABpA*",
"*Reflection.Assembly*",
"*Assembly.GetType*",
"*$env:temp\\*start*",
"*powercat*",
"*nslookup -q=txt*",
"*$host.UI.PromptForCredential*",
"*Net.Sockets.TCPClient*",
"*curl *;Start*",
"powershell.exe \"<#*",
"*ssh -p *",
"*http*|iex*",
"*@SSL\\DavWWWRoot\\*.ps1*",
"*.lnk*.Seek(0x*",
"*[string]::join(*",
"*[Array]::Reverse($*",
"* hidden $(gc *",
"*=wscri& set*",
"*http'+'s://*",
"*.content|i''Ex*",
"*//:sptth*",
"*//:ptth*",
"*h''t''t''p*",
"*'tp'':''/'*",
"*$env:T\"E\"MP*",
"*;cmd /c $?",
"*s''t''a''r*",
"*$*=Get-Content*AppData*.SubString(*$*",
"*=cat *AppData*.substring(*);*$*",
"*-join'';*|powershell*",
"*.Content;sleep *|powershell*",
"*h\''t\''tp:\''*",
"*-e aQB3AHIAIABp*",
"*iwr *https*).Content*",
"*$env:computername*http*",
"*;InVoKe-ExpRESsIoN $COntent.CONTENt;*",
"*WebClient*example.com*",
"*=iwr $*;iex $*",
"*gc *:*|sc *",
"*gci *-Recurse*start*",
"*Invoke-WebRequest*Start-Process*Hidden*",
"*Invoke-WebRequest*msiexec*"
) or
(process.command_line regex~ """.*p\"?o\"?w\"?e\"?r\"?s\"?h\"?e\"?l\"?l.*""" and not process.command_line : "*powershell*") or
(process.args: "bypass" and process.args : "hidden" and process.command_line : "*start-process*appdata*") or
(process.args : "-c" and process.args : "&{'*") or
(process.args : "-Outfile" and process.args : "Start*") or
(process.args : "-bxor" and process.args : "0x*") or
process.args : "$*$*;set-alias" or
(process.command_line : ("*-encodedCommand*", "*Invoke-webrequest*", "*WebClient*", "*Reflection.Assembly*") and
(process.parent.name : ("explorer.exe", "python*.exe") or
(process.parent.name : "cmd.exe" and
descendant of [process where event.action == "start" and process.name : ("explorer.exe", "python*.exe")])))
)
'''
min_endpoint_version = "8.10.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and process.name : "powershell.exe" and process.parent.executable != null and
not user.id : "S-1-5-18" and
/*
following exclusions are covered by other rules
- Suspicious Execution via Windows Management Instrumentation
- Suspicious Windows Schedule Child Process
- PowerShell Obfuscation Spawned via Microsoft Office
- Suspicious PowerShell Execution via Windows Scripts
*/
not (process.parent.executable :
("?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\wbem\\WmiPrvSe.exe",
"?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Users\\*\\AppData\\Local\\gitkraken\\app-*\\gitkraken.exe",
"?:\\Windows\\System32\\taskeng.exe",
"?:\\Windows\\cybercnsagent\\cybercnsagent.exe",
"?:\\Windows\\SysWOW64\\WindowsPowerShell\\*\\powershell_ise.exe",
"?:\\Windows\\System32\\WindowsPowerShell\\*\\powershell_ise.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*\\SenseIR.exe") and not process.parent.name : "java.exe") and
not process.parent.name : ("wscript.exe", "cscript.exe") and
not (process.args:"-NonInteractive" and process.args :"-InputFormat") and
not (process.args : ("RemoteSigned", "-ExecutionPolicy", "write-host") and
not process.parent.name : ("explorer.exe", "python.exe", "cmd.exe")) and
not process.args : "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('cGFzc3dvcmQ='))" and
not (process.command_line : "*echo ~/.ansible/tmp/ansible-tmp*" and process.parent.executable : "C:\\Windows\\System32\\OpenSSH\\sshd.exe") and
not (process.args : "$OutputEncoding = [System.Text.Encoding]::UTF8; $b64='eyJjb252ZXJzYXRpb25faWQiOiJ*" and process.parent.name : "Cursor.exe") and
not process.command_line :
("*ConvertTo-Json*Write-Host*",
"*BrowserExtension.dll*WebCompanion.BrowserExtension*",
"*-ExecutionPolicy*Write-Verbose*",
"*webClient.Headers.add*",
"*System.Management.Automation.Host.Size*",
"*JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQ*",
"*chocolatey.org*",
"*Get-WmiObject*",
"*artifacts.elastic.co*",
"*officecdn.microsoft.com*",
"*CgAgACAAIAAgACAAIAAgACAAJABTAGMAcgBpAHAAdAAgACA*",
"*Program Files*",
"*).Access.IdentityReference;$defaults*",
"*https://repo.maven.apache.org*",
"*\\CSIWorking\\system\\WinSCP\\winscp.com*",
"*@Files.onetech.cc*",
"*Register-AzureADConnectHealthADDSAgent*",
"*\\ProgramData\\Microsoft\\LogConverter\\*",
"*WinSCP.com*",
"*SNC_isWmi*",
"*--app-id=memtime-*",
"*BkAGEAdABhAGIAYQBzAGUALgB3AGkAbgBkAG8AdwBzAC4AbgBlAHQA*",
"*FsAdgBlAHIAcwBpAG8AbgBdACQAbQBpAG4AaQBtAHUAbQBWAGUAcgBzAGkAbwBuACAAPQAgACcAMgAuADIALgAwACcA*",
"*https://tshf.sas.com/techsup/download/hotfix/*",
"*scripts\\buildsystems\\msbuild*",
"*.vscode\\extensions\\ms-dynamics-smb*",
"*$ErrorActionPreference*$adsiMember*",
"*$ErrorActionPreference*$rgx_log4j*",
"*$env:APPDATA\"+'\\Browser Assistant\\*",
"*APPDATA\"+'/Browser Extension/BE.txt*",
"*$env:APPDATA\"+'/BBWC/*",
"*ReadAllBytes($w+'Newtonsoft.Json.dll*",
"*https://go.microsoft.com/fwlink*",
"*krsfile:////LOBCS*",
"*ProgramData\\VinitySoft Data\\MariaDb\\*",
"*\\Temp\\claude\\claude-pwd-ps-*",
"*https://10.55.138.214:443/downloads/*",
"\"C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe\" -noexit -command \"[reflection.assembly]::loadFrom('.\\RD-PSAPI.dll') | import-module\"",
"*-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAfABUAHIAZQBsAGwAaQB4ACIA*",
"*-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAIABBAGcAZQBuAHQAIgA=*",
"*JABjAGwAcwA9ACcATQBvAHUAcwBlACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*",
"*JABjAGwAcwA9ACcASwBlAHkAYgBvAGEAcgBkACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*",
"*JABjAHYAIAA9ACAARwBlAHQALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgACcASABLAEwATQA6AFwAUwBPAEYAVABXAEEAUgBFAFwATQBpAGMAcgBvAHMAbwBmAHQAXABXAGkAbgBkAG8AdwBzACAATgBUAFwAQwB1AHIAcgBlAG4AdABWAGUAcgBzAGkAbwBuACcACgAiACQAKAAkAGMAdgAuAFAAcgBvAGQAdQBjAHQATgBhAG0AZQApAHwAJAAoACQAYwB2AC4ARABpAHMAcABsAGEAeQBWAGUAcgBzAGkAbwBuACkAf*",
"*JABFAHIAcgBvAHIAQQBjAHQAaQBvAG4AUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAcwBpAGwAZQBuAHQAbAB5AGMAbwBuAHQAaQBuAHUAZQAnADsAIAAkAHQAbQBwACAAPQAgACgARwBlAHQALQBJAHQAZQBtACAALQBQAGEAdABoACAAIgAkAGUAbgB2ADoAUABSAE8ARwBSAEEATQBGAEkATABFAFMAXABHAG8AbwBnAGwAZQBcAEMAaAByAG8AbQBlAFwA*",
"*CgAkAEUAcgByAG8AcgBBAGMAdABpAG8AbgBQAHIAZQBmAGUAcgBlAG4AYwBlACAAPQAgACcAUwB0AG8AcAAnAAoAWwB2AGUAcgBzAGkAbwBuAF0AJABtAGkAbgBpAG0AdQBtAFYAZQByAHMAaQBvAG4A*") and
not process.parent.args : "([Datetime]::ParseExact($_.InstalledOn," and
not process.command_line : ("PowerShell*hkguTzSCb75g7sJ9ChMcmAOPpeBL9ZJy/tejnoCjT+E=*", "*.LastWriteTime.ToFileTime*", "*New-Object*Net.Mail.SmtpClien*") and
not (process.parent.name : "cmd.exe" and
(process.parent.command_line : "*\\WindowsPowershell\\*\\powershell*" or process.parent.args : ("-Command", "-OutputFormat", "-InputFormat"))) and
not process.parent.name : "powershell.exe" and
not (process.parent.name : "cmd.exe" and process.parent.args : ("*.cmd", "*.bat") and process.command_line: "*Get-Content*Set-Content*") and
not (process.args : "NT\\CurrentVersion').InstallationType;" and process.args : "[System.Text.Encoding]::UTF8.GetBytes($OutStr);") and
not (process.parent.code_signature.trusted == true and process.parent.code_signature.subject_name in ("ControlCase LLC", "HashiCorp, Inc.", "JetBrains s.r.o.", "Johannes Schindelin", "Anomaly Innovations, Inc https://anoma.ly/", "Anthropic, PBC", "Anysphere, Inc.", "Denver Technologies, Inc. dba Warp")) and
not process.parent.command_line : "\"C:\\Windows\\system32\\cmd.exe\" " and
not (process.parent.name : "Cursor.exe" and process.command_line : "* dotnet csharpier format*") and
not (process.parent.name : "codex*.exe" and process.args : "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;*") and
not process.working_directory : "C:\\ProgramData\\VinitySoft Data\\MariaDb\\" and
not process.parent.executable : ("C:\\Users\\*\node_modules\\@openai\\codex\\bin\\codex-x86_64-pc-windows-msvc.exe",
"C:\\Users\\*\\extensions\\openai.chatgpt-*\\bin\\windows-x86_64\\codex.exe",
"C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
"C:\\Users\\*\\@openai\\*\\x86_64-pc-windows-msvc\\codex\\codex.exe",
"C:\\Python312\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Antigravity\\resources\\app\\extensions\\antigravity\\bin\\language_server_windows_x64.exe",
"?:\\Users\\*\\AppData\\Local\\Python\\bin\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Programs\\Python\\Python*\\python.exe",
"?:\\Users\\*\\AppData\\Local\\Python\\pythoncore-*\\python.exe",
"D:\\Antigravity\\resources\\app\\extensions\\antigravity\\bin\\language_server_windows_x64.exe",
"?:\\Users\\*\\.codex\\.sandbox-bin\\codex-command-runner-*.exe") and
not process.args : ("$w=$env:LOCALAPPDATA+'/OPWC/';[Reflection.Assembly]::Load([System.IO.File]::ReadAllBytes($w+'OperaSharpDLL.dll'));[OperaSharpDLL.Helper]::Startup()",
"IEX (New-Object Net.WebClient).DownloadString('https://install.demo-toolkit.de/dtkupdater.ps1?apikey=*",
"D:\\PowerShell\\webclient.cmd",
"Invoke-WebRequest -Uri https://www.7-zip.org/a/7zr.exe -o '7zr.exe';",
"\"& 'C:\\Program Files (x86)\\combit\\*",
"Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorID | *",
"& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory*") and
not (process.parent.name : "cmd.exe" and
process.parent.args : ("D:\\PowerShell\\webclient.cmd",
"C:\\Temp\\FST-Robocopy-wEmailNotif.cmd",
"C:\\istip-installation\\install.bat",
"'C:\\ProgramData\\PatchBot\\data\\windows-health-after.json';",
"'C:\\ProgramData\\PatchBot\\data\\windows-updates.json';",
"'C:\\ProgramData\\PatchBot\\data\\windows-updates.json')")) and
not (process.parent.executable : "C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" and process.command_line : "*Windows.UI.Notifications*") and
not (process.parent.executable : "C:\\Users\\*\\.vscode\\extensions\\openai.chatgpt*-win32-x64\\bin\\windows-x86_64\\codex.exe" and process.parent.args == "mcp") and
not (process.parent.executable : "C:\\Windows\\System32\\msiexec.exe" and process.args : "https://go.microsoft.com/fwlink/p/?LinkId=*" and
process.args :"$env:TEMP\\MicrosoftEdgeWebview2Setup.exe") and
not process.args : "chcp 65001;[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing');(New-Object System.Drawing.Text.InstalledFontCollection).Families" and
(
process.command_line :
(
"*^*^*^*^*^*^*^*^*^*",
"*`*`*`*`*",
"*+*+*+*+*+*+*",
"*[char[]](*)*-join*",
"*Base64String*",
"*[*Convert]*",
"*.Compression.*",
"*-join($*",
"*.replace*",
"*MemoryStream*",
"*WriteAllBytes*",
"* -enc *",
"* -ec *",
"* /e *",
"* /enc *",
"* /ec *",
"*WebClient*",
"*DownloadFile*",
"*DownloadString*",
"* iex*",
"*;iex*",
"* iwr*",
"*;iwr *",
"*;saps *",
"* aQB3AHIAIABpA*",
"*Reflection.Assembly*",
"*Assembly.GetType*",
"*$env:temp\\*start*",
"*powercat*",
"*nslookup -q=txt*",
"*$host.UI.PromptForCredential*",
"*Net.Sockets.TCPClient*",
"*curl *;Start*",
"powershell.exe \"<#*",
"*ssh -p *",
"*http*|iex*",
"*@SSL\\DavWWWRoot\\*.ps1*",
"*.lnk*.Seek(0x*",
"*[string]::join(*",
"*[Array]::Reverse($*",
"* hidden $(gc *",
"*=wscri& set*",
"*http'+'s://*",
"*.content|i''Ex*",
"*//:sptth*",
"*//:ptth*",
"*h''t''t''p*",
"*'tp'':''/'*",
"*$env:T\"E\"MP*",
"*;cmd /c $?",
"*s''t''a''r*",
"*$*=Get-Content*AppData*.SubString(*$*",
"*=cat *AppData*.substring(*);*$*",
"*-join'';*|powershell*",
"*.Content;sleep *|powershell*",
"*h\''t\''tp:\''*",
"*-e aQB3AHIAIABp*",
"*iwr *https*).Content*",
"*$env:computername*http*",
"*;InVoKe-ExpRESsIoN $COntent.CONTENt;*",
"*WebClient*example.com*",
"*=iwr $*;iex $*",
"*gc *:*|sc *",
"*gci *-Recurse*start*",
"*Invoke-WebRequest*Start-Process*Hidden*",
"*Invoke-WebRequest*msiexec*"
) or
(process.command_line regex~ """.*p\"?o\"?w\"?e\"?r\"?s\"?h\"?e\"?l\"?l.*""" and not process.command_line : "*powershell*") or
(process.args: "bypass" and process.args : "hidden" and process.command_line : "*start-process*appdata*") or
(process.args : "-c" and process.args : "&{'*") or
(process.args : "-Outfile" and process.args : "Start*") or
(process.args : "-bxor" and process.args : "0x*") or
process.args : "$*$*;set-alias" or
(process.command_line : ("*-encodedCommand*", "*Invoke-webrequest*", "*WebClient*", "*Reflection.Assembly*") and
(process.parent.name : ("explorer.exe", "python*.exe") or
(process.parent.name : "cmd.exe" and
descendant of [process where event.action == "start" and process.name : ("explorer.exe", "python*.exe")])))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.command_line | regex_match |
| field:"CommandLine" kind:regex_match |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"powershell.exe" |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null | |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.args | eq | -Command, -OutputFormat, -InputFormat | excludes:process.parent.args field:"process.parent.args" value:"-Command" field:"process.parent.args" value:"-OutputFormat" field:"process.parent.args" value:"-InputFormat" |
process.parent.command_line | wildcard | *\WindowsPowershell\*\powershell* | excludes:process.parent.command_line field:"process.parent.command_line" value:"*\WindowsPowershell\*\powershell*" |
process.parent.name | eq | cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"cmd.exe" |
process.parent.name | eq | explorer.exe, python.exe, cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"explorer.exe" field:"process.parent.name" value:"python.exe" field:"process.parent.name" value:"cmd.exe" |
process.args | eq | RemoteSigned, -ExecutionPolicy, write-host | excludes:process.args field:"process.args" value:"RemoteSigned" field:"process.args" value:"-ExecutionPolicy" field:"process.args" value:"write-host" |
process.parent.name | eq | java.exe | excludes:process.parent.name field:"process.parent.name" value:"java.exe" |
process.parent.executable | wildcard | ?:\Windows\System32\svchost.exe, ?:\Windows\System32\wbem\WmiPrvSe.exe, ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Users\*\AppData\Local\gitkraken\app-*\gitkraken.exe, ?:\Windows\System32\taskeng.exe, ?:\Windows\cybercnsagent\cybercnsagent.exe, ?:\Windows\SysWOW64\WindowsPowerShell\*\powershell_ise.exe, ?:\Windows\System32\WindowsPowerShell\*\powershell_ise.exe, ?:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Platform\*\SenseIR.exe | excludes:process.parent.executable |
process.args | eq | $env:TEMP\MicrosoftEdgeWebview2Setup.exe | excludes:process.args field:"process.args" value:"$env:TEMP\MicrosoftEdgeWebview2Setup.exe" |
process.args | starts_with | https://go.microsoft.com/fwlink/p/?LinkId= | excludes:process.args field:"process.args" value:"https://go.microsoft.com/fwlink/p/?LinkId=" |
process.parent.executable | eq | C:\Windows\System32\msiexec.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\msiexec.exe" |
process.args | eq | -InputFormat | excludes:process.args field:"process.args" value:"-InputFormat" |
process.args | eq | -NonInteractive | excludes:process.args field:"process.args" value:"-NonInteractive" |
process.args | eq | NT\CurrentVersion').InstallationType; | excludes:process.args field:"process.args" value:"NT\CurrentVersion').InstallationType;" |
process.args | eq | [System.Text.Encoding]::UTF8.GetBytes($OutStr); | excludes:process.args field:"process.args" value:"[System.Text.Encoding]::UTF8.GetBytes($OutStr);" |
process.args | starts_with | $OutputEncoding = [System.Text.Encoding]::UTF8; $b64='eyJjb252ZXJzYXRpb25faWQiOiJ | excludes:process.args field:"process.args" value:"$OutputEncoding = [System.Text.Encoding]::UTF8; $b64='eyJjb252ZXJzYXRpb25faWQiOiJ" |
process.parent.name | eq | Cursor.exe | excludes:process.parent.name field:"process.parent.name" value:"Cursor.exe" |
process.args | starts_with | [Console]::OutputEncoding=[System.Text.Encoding]::UTF8; | excludes:process.args field:"process.args" value:"[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" |
process.parent.name | wildcard | codex*.exe | excludes:process.parent.name field:"process.parent.name" value:"codex*.exe" |
process.command_line | match | dotnet csharpier format | excludes:process.command_line field:"process.command_line" value:" dotnet csharpier format" |
process.command_line | match | Windows.UI.Notifications | excludes:process.command_line field:"process.command_line" value:"Windows.UI.Notifications" |
process.parent.executable | wildcard | C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe" |
process.command_line | match | echo ~/.ansible/tmp/ansible-tmp | excludes:process.command_line field:"process.command_line" value:"echo ~/.ansible/tmp/ansible-tmp" |
process.parent.executable | eq | C:\Windows\System32\OpenSSH\sshd.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\OpenSSH\sshd.exe" |
process.command_line | wildcard | *Get-Content*Set-Content* | excludes:process.command_line field:"process.command_line" value:"*Get-Content*Set-Content*" |
process.parent.args | ends_with | .cmd, .bat | excludes:process.parent.args field:"process.parent.args" value:".cmd" field:"process.parent.args" value:".bat" |
process.parent.args | eq | mcp | excludes:process.parent.args field:"process.parent.args" value:"mcp" |
process.parent.executable | wildcard | C:\Users\*\.vscode\extensions\openai.chatgpt*-win32-x64\bin\windows-x86_64\codex.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Users\*\.vscode\extensions\openai.chatgpt*-win32-x64\bin\windows-x86_64\codex.exe" |
process.parent.args | eq | D:\PowerShell\webclient.cmd, C:\Temp\FST-Robocopy-wEmailNotif.cmd, C:\istip-installation\install.bat, 'C:\ProgramData\PatchBot\data\windows-health-after.json';, 'C:\ProgramData\PatchBot\data\windows-updates.json';, 'C:\ProgramData\PatchBot\data\windows-updates.json') | excludes:process.parent.args |
process.parent.code_signature.subject_name | in | Anomaly Innovations, Inc https://anoma.ly/, Anthropic, PBC, Anysphere, Inc., ControlCase LLC, Denver Technologies, Inc. dba Warp, HashiCorp, Inc., JetBrains s.r.o., Johannes Schindelin | excludes:process.parent.code_signature.subject_name |
process.parent.code_signature.trusted | eq | true | excludes:process.parent.code_signature.trusted field:"process.parent.code_signature.trusted" value:"true" |
process.args | eq | [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('cGFzc3dvcmQ=')) | excludes:process.args field:"process.args" value:"[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('cGFzc3dvcmQ='))" |
process.args | eq | chcp 65001;[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing');(New-Object System.Drawing.Text.InstalledFontCollection).Families | excludes:process.args field:"process.args" value:"chcp 65001;[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing');(New-Object System.Drawing.Text.InstalledFontCollection).Families" |
process.args | wildcard | $w=$env:LOCALAPPDATA+'/OPWC/';[Reflection.Assembly]::Load([System.IO.File]::ReadAllBytes($w+'OperaSharpDLL.dll'));[OperaSharpDLL.Helper]::Startup(), IEX (New-Object Net.WebClient).DownloadString('https://install.demo-toolkit.de/dtkupdater.ps1?apikey=*, D:\PowerShell\webclient.cmd, Invoke-WebRequest -Uri https://www.7-zip.org/a/7zr.exe -o '7zr.exe';, "& 'C:\Program Files (x86)\combit\*, Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | *, & { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory* | excludes:process.args |
process.command_line | wildcard | *ConvertTo-Json*Write-Host*, *BrowserExtension.dll*WebCompanion.BrowserExtension*, *-ExecutionPolicy*Write-Verbose*, *webClient.Headers.add*, *System.Management.Automation.Host.Size*, *JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQ*, *chocolatey.org*, *Get-WmiObject*, *artifacts.elastic.co*, *officecdn.microsoft.com*, *CgAgACAAIAAgACAAIAAgACAAJABTAGMAcgBpAHAAdAAgACA*, *Program Files*, *).Access.IdentityReference;$defaults*, *https://repo.maven.apache.org*, *\CSIWorking\system\WinSCP\winscp.com*, *@Files.onetech.cc*, *Register-AzureADConnectHealthADDSAgent*, *\ProgramData\Microsoft\LogConverter\*, *WinSCP.com*, *SNC_isWmi*, *--app-id=memtime-*, *BkAGEAdABhAGIAYQBzAGUALgB3AGkAbgBkAG8AdwBzAC4AbgBlAHQA*, *FsAdgBlAHIAcwBpAG8AbgBdACQAbQBpAG4AaQBtAHUAbQBWAGUAcgBzAGkAbwBuACAAPQAgACcAMgAuADIALgAwACcA*, *https://tshf.sas.com/techsup/download/hotfix/*, *scripts\buildsystems\msbuild*, *.vscode\extensions\ms-dynamics-smb*, *$ErrorActionPreference*$adsiMember*, *$ErrorActionPreference*$rgx_log4j*, *$env:APPDATA"+'\Browser Assistant\*, *APPDATA"+'/Browser Extension/BE.txt*, *$env:APPDATA"+'/BBWC/*, *ReadAllBytes($w+'Newtonsoft.Json.dll*, *https://go.microsoft.com/fwlink*, *krsfile:////LOBCS*, *ProgramData\VinitySoft Data\MariaDb\*, *\Temp\claude\claude-pwd-ps-*, *https://10.55.138.214:443/downloads/*, "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" -noexit -command "[reflection.assembly]::loadFrom('.\RD-PSAPI.dll') | import-module", *-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAfABUAHIAZQBsAGwAaQB4ACIA*, *-noni -nop -w 1 -enc *AEUAbABhAHMAdABpAGMAIABBAGcAZQBuAHQAIgA=*, *JABjAGwAcwA9ACcATQBvAHUAcwBlACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*, *JABjAGwAcwA9ACcASwBlAHkAYgBvAGEAcgBkACcAOwAKACAAIABHAGUAdAAtAEMAaQBtAEkAbgBzAHQAYQBuAGMAZQAgAFcAaQBuADMAMgBfAFAAbgBQAEUAbgB0AGkAdAB5ACAALQBGAGkAb*, *JABjAHYAIAA9ACAARwBlAHQALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgACcASABLAEwATQA6AFwAUwBPAEYAVABXAEEAUgBFAFwATQBpAGMAcgBvAHMAbwBmAHQAXABXAGkAbgBkAG8AdwBzACAATgBUAFwAQwB1AHIAcgBlAG4AdABWAGUAcgBzAGkAbwBuACcACgAiACQAKAAkAGMAdgAuAFAAcgBvAGQAdQBjAHQATgBhAG0AZQApAHwAJAAoACQAYwB2AC4ARABpAHMAcABsAGEAeQBWAGUAcgBzAGkAbwBuACkAf*, *JABFAHIAcgBvAHIAQQBjAHQAaQBvAG4AUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAcwBpAGwAZQBuAHQAbAB5AGMAbwBuAHQAaQBuAHUAZQAnADsAIAAkAHQAbQBwACAAPQAgACgARwBlAHQALQBJAHQAZQBtACAALQBQAGEAdABoACAAIgAkAGUAbgB2ADoAUABSAE8ARwBSAEEATQBGAEkATABFAFMAXABHAG8AbwBnAGwAZQBcAEMAaAByAG8AbQBlAFwA*, *CgAkAEUAcgByAG8AcgBBAGMAdABpAG8AbgBQAHIAZQBmAGUAcgBlAG4AYwBlACAAPQAgACcAUwB0AG8AcAAnAAoAWwB2AGUAcgBzAGkAbwBuAF0AJABtAGkAbgBpAG0AdQBtAFYAZQByAHMAaQBvAG4A* | excludes:process.command_line |
process.command_line | wildcard | PowerShell*hkguTzSCb75g7sJ9ChMcmAOPpeBL9ZJy/tejnoCjT+E=*, *.LastWriteTime.ToFileTime*, *New-Object*Net.Mail.SmtpClien* | excludes:process.command_line field:"process.command_line" value:"PowerShell*hkguTzSCb75g7sJ9ChMcmAOPpeBL9ZJy/tejnoCjT+E=*" field:"process.command_line" value:"*.LastWriteTime.ToFileTime*" field:"process.command_line" value:"*New-Object*Net.Mail.SmtpClien*" |
process.parent.args | eq | ([Datetime]::ParseExact($_.InstalledOn, | excludes:process.parent.args field:"process.parent.args" value:"([Datetime]::ParseExact($_.InstalledOn," |
process.parent.command_line | eq | "C:\Windows\system32\cmd.exe" | excludes:process.parent.command_line |
process.parent.executable | wildcard | C:\Users\*
ode_modules\@openai\codex\bin\codex-x86_64-pc-windows-msvc.exe, C:\Users\*\extensions\openai.chatgpt-*\bin\windows-x86_64\codex.exe, C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe, C:\Users\*\@openai\*\x86_64-pc-windows-msvc\codex\codex.exe, C:\Python312\python.exe, ?:\Users\*\AppData\Local\Programs\Antigravity\resources\app\extensions\antigravity\bin\language_server_windows_x64.exe, ?:\Users\*\AppData\Local\Python\bin\python.exe, ?:\Users\*\AppData\Local\Programs\Python\Python*\python.exe, ?:\Users\*\AppData\Local\Python\pythoncore-*\python.exe, D:\Antigravity\resources\app\extensions\antigravity\bin\language_server_windows_x64.exe, ?:\Users\*\.codex\.sandbox-bin\codex-command-runner-*.exe | excludes:process.parent.executable |
process.parent.name | eq | powershell.exe | excludes:process.parent.name field:"process.parent.name" value:"powershell.exe" |
process.parent.name | eq | wscript.exe, cscript.exe | excludes:process.parent.name field:"process.parent.name" value:"wscript.exe" field:"process.parent.name" value:"cscript.exe" |
process.working_directory | eq | C:\ProgramData\VinitySoft Data\MariaDb\ | excludes:process.working_directory field:"process.working_directory" value:"C:\ProgramData\VinitySoft Data\MariaDb\" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Suspicious Proc Pseudo File System Enumeration
#This rule monitors for a rapid enumeration of 25 different proc cmd, stat, and exe files, which suggests an abnormal activity pattern. Such behavior could be an indicator of a malicious process scanning or gathering information about running processes, potentially for reconnaissance, privilege escalation, or identifying vulnerable targets.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[metadata]
creation_date = "2023/06/09"
integration = ["auditd_manager"]
maturity = "production"
updated_date = "2024/05/21"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
This rule monitors for a rapid enumeration of 25 different proc cmd, stat, and exe files, which suggests an abnormal
activity pattern. Such behavior could be an indicator of a malicious process scanning or gathering information about
running processes, potentially for reconnaissance, privilege escalation, or identifying vulnerable targets.
"""
from = "now-119m"
index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
interval = "60m"
language = "kuery"
license = "Elastic License v2"
name = "Suspicious Proc Pseudo File System Enumeration"
risk_score = 21
rule_id = "0787daa6-f8c5-453b-a4ec-048037f6c1cd"
setup = """## Setup
This rule requires the use of the `auditd_manager` integration. `Auditd_manager` is a tool designed to simplify and enhance the management of the audit subsystem in Linux systems. It provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system. The following steps should be executed in order to install and deploy `auditd_manager` on a Linux system.
```
Kibana -->
Management -->
Integrations -->
Auditd Manager -->
Add Auditd Manager
```
`Auditd_manager` subscribes to the kernel and receives events as they occur without any additional configuration. However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
For this detection rule to trigger, the following additional audit rules are required to be added to the integration:
```
-w /proc/ -p r -k audit_proc
```
Add the newly installed `auditd manager` to an agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
"""
severity = "low"
tags = [
"Data Source: Auditd Manager",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "threshold"
query = '''
host.os.type:linux and event.category:file and event.action:"opened-file" and
file.path : (/proc/*/cmdline or /proc/*/stat or /proc/*/exe) and not process.name : (
ps or netstat or landscape-sysin or w or pgrep or pidof or needrestart or apparmor_status
) and not process.parent.pid : 1
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1057"
name = "Process Discovery"
reference = "https://attack.mitre.org/techniques/T1057/"
[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[rule.threshold]
field = ["host.id", "process.pid", "process.name"]
value = 1
[[rule.threshold.cardinality]]
field = "file.path"
value = 100
Stages and Predicates
Stage 1: query
host.os.type:linux and event.category:file and event.action:"opened-file" and
file.path : (/procstat or /proc/*/exe) and not process.name : (
ps or netstat or landscape-sysin or w or pgrep or pidof or needrestart or apparmor_status
) and not process.parent.pid : 1
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"opened-file" |
event.category | eq |
| field:"event.category" kind:eq value:"file" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | in | apparmor_status, landscape-sysin, needrestart, netstat, pgrep, pidof, ps, w | excludes:process.name |
process.parent.pid | eq | 1 | excludes:process.parent.pid field:"process.parent.pid" value:"1" |
Suspicious Shell Execution via Java Application
#This rule detects behavior linked to potential Java application exploitation, where a Java process makes an outbound connection to a public IP and, within a minute, spawns a shell (sh, bash, etc.) with -c. This sequence is a strong indicator of payload retrieval and command execution, consistent with remote code execution.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
This rule detects behavior linked to potential Java application exploitation, where a Java process makes an outbound
connection to a public IP and, within a minute, spawns a shell (sh, bash, etc.) with -c. This sequence is a strong
indicator of payload retrieval and command execution, consistent with remote code execution.
"""
id = "b7cb162f-75d8-43f3-9fb4-498215980533"
license = "Elastic License v2"
name = "Suspicious Shell Execution via Java Application"
os_list = ["linux"]
reference = [
"https://www.oracle.com/security-alerts/alert-cve-2025-61882.html",
"https://www.crowdstrike.com/en-us/blog/crowdstrike-identifies-campaign-targeting-oracle-e-business-suite-zero-day-CVE-2025-61882/",
]
version = "1.0.9"
query = '''
sequence with maxspan=1m
[network where event.type == "start" and event.action == "connection_attempted" and process.name == "java" and
not (
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"
)
)
] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c" and process.parent.name == "java" and process.command_line like~ (
"*|*sh *", "*/dev/shm/*", "*/var/www/*", "*/run/*", "*/var/run/*", "* netcat *", "* ncat *", "*python*", "* nc *",
"* php*", "*perl*", "*ruby*", "*echo *", "*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*", "*import*subprocess*call*",
"*TCPSocket.new*", "*TCPSocket.open*", "*io.popen*", "*os.execute*", "*fsockopen*", "*disown*", "*/etc/cron*",
"*/etc/rc.local*", "*/etc/init.d*", "*/etc/update-motd.d*", "*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", "*base32 *",
"*/etc/profile*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*nohup*", "*xxd *", "*/etc/shadow*", "*chattr *"
) and
not (
process.args like (
"for f in*", "id*", "[*", "/usr/bin/mpstat*", "(cp*jenkins-result.txt*", "cat /application/*nohup_*.out*", "test*", "export*"
) or
process.command_line in (
"/bin/bash -c echo ping", "bash -c echo $$",
"/bin/sh -c export LC_ALL=en_US.UTF-8;if [ -e /tmp ]; then /usr/bin/echo /tmp ; fi ; ",
"sh -c stty -echo < /dev/tty",
"/bin/sh -c which perl",
"""/bin/sh -c if (which rpm >/dev/null 2>&1 && rpm -qa | grep 'gtk3' >/dev/null 2>&1) || (which dpkg >/dev/null 2>&1 && dpkg -l | grep 'libgtk-3' >/dev/null 2>&1); then echo "true";else echo "false";fi"""
) or
process.command_line like "*executeXauthorityCommandWithTimeoutIfPossible*" or
process.working_directory like ("/var/opt/oracle/dbaastools_base/pilot*", "/opt/wn/service/agents/esfclient") or
process.parent.executable like (
"/opt/pycharm*/bin/java", "/tdst/java/*/bin/java", "/crm/java/*/bin/java", "/*/java/jdk1.8.0_151/bin/java",
"/home/*/BurpSuitePro/jre/bin/java", "/opt/Tanium/TaniumClient/extensions/comply/jre/bin/java",
"/opt/oracle/dcs/java/dcs-agent/*/bin/java"
) or
process.parent.args == "/usr/share/jenkins/agent.jar"
)] 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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[threat.technique]]
id = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[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 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: network
[network where event.type == "start" and event.action == "connection_attempted" and process.name == "java" and
not (
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"
)
)
] by process.entity_id
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args == "-c" and process.parent.name == "java" and process.command_line like~ (
"*|*sh *", "*/dev/shm/*", "*/var/www/*", "*/run/*", "*/var/run/*", "* netcat *", "* ncat *", "*python*", "* nc *",
"* php*", "*perl*", "*ruby*", "*echo *", "*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*", "*import*subprocess*call*",
"*TCPSocket.new*", "*TCPSocket.open*", "*io.popen*", "*os.execute*", "*fsockopen*", "*disown*", "*/etc/cron*",
"*/etc/rc.local*", "*/etc/init.d*", "*/etc/update-motd.d*", "*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", "*base32 *",
"*/etc/profile*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*nohup*", "*xxd *", "*/etc/shadow*", "*chattr *"
) and
not (
process.args like (
"for f in*", "id*", "[*", "/usr/bin/mpstat*", "(cp*jenkins-result.txt*", "cat /application/*nohup_*.out*", "test*", "export*"
) or
process.command_line in (
"/bin/bash -c echo ping", "bash -c echo $$",
"/bin/sh -c export LC_ALL=en_US.UTF-8;if [ -e /tmp ]; then /usr/bin/echo /tmp ; fi ; ",
"sh -c stty -echo < /dev/tty",
"/bin/sh -c which perl",
"""/bin/sh -c if (which rpm >/dev/null 2>&1 && rpm -qa | grep 'gtk3' >/dev/null 2>&1) || (which dpkg >/dev/null 2>&1 && dpkg -l | grep 'libgtk-3' >/dev/null 2>&1); then echo "true";else echo "false";fi"""
) or
process.command_line like "*executeXauthorityCommandWithTimeoutIfPossible*" or
process.working_directory like ("/var/opt/oracle/dbaastools_base/pilot*", "/opt/wn/service/agents/esfclient") or
process.parent.executable like (
"/opt/pycharm*/bin/java", "/tdst/java/*/bin/java", "/crm/java/*/bin/java", "/*/java/jdk1.8.0_151/bin/java",
"/home/*/BurpSuitePro/jre/bin/java", "/opt/Tanium/TaniumClient/extensions/comply/jre/bin/java",
"/opt/oracle/dcs/java/dcs-agent/*/bin/java"
) or
process.parent.args == "/usr/share/jenkins/agent.jar"
)] 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 |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | eq |
| field:"process_basename" kind:eq value:"java" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"java" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
destination.ip | cidr_match | 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.168.0.0/16, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8 | excludes:destination.ip |
destination.ip | eq | 0.0.0.0 | excludes:destination.ip field:"destination.ip" value:"0.0.0.0" |
process.args | wildcard | for f in*, id*, [*, /usr/bin/mpstat*, (cp*jenkins-result.txt*, cat /application/*nohup_*.out*, test*, export* | excludes:process.args |
process.command_line | in | /bin/bash -c echo ping, /bin/sh -c export LC_ALL=en_US.UTF-8;if [ -e /tmp ]; then /usr/bin/echo /tmp ; fi ; , /bin/sh -c if (which rpm >/dev/null 2>&1 && rpm -qa | grep 'gtk3' >/dev/null 2>&1) || (which dpkg >/dev/null 2>&1 && dpkg -l | grep 'libgtk-3' >/dev/null 2>&1); then echo "true";else echo "false";fi, /bin/sh -c which perl, bash -c echo $$, sh -c stty -echo < /dev/tty | excludes:process.command_line |
process.command_line | match | executeXauthorityCommandWithTimeoutIfPossible | excludes:process.command_line field:"process.command_line" value:"executeXauthorityCommandWithTimeoutIfPossible" |
process.parent.args | eq | /usr/share/jenkins/agent.jar | excludes:process.parent.args field:"process.parent.args" value:"/usr/share/jenkins/agent.jar" |
process.parent.executable | wildcard | /opt/pycharm*/bin/java, /tdst/java/*/bin/java, /crm/java/*/bin/java, /*/java/jdk1.8.0_151/bin/java, /home/*/BurpSuitePro/jre/bin/java, /opt/Tanium/TaniumClient/extensions/comply/jre/bin/java, /opt/oracle/dcs/java/dcs-agent/*/bin/java | excludes:process.parent.executable |
process.working_directory | wildcard | /var/opt/oracle/dbaastools_base/pilot*, /opt/wn/service/agents/esfclient | excludes:process.working_directory field:"process.working_directory" value:"/var/opt/oracle/dbaastools_base/pilot*" field:"process.working_directory" value:"/opt/wn/service/agents/esfclient" |
Untrusted or Unsigned Binary Executed via Launch Service
#Detects when a Launch Agent or Launch Daemon is created in a common way by moving the plist into one of the two directories using the native cp or mv binaries and the plist arguments contain a common application path followed immediately by the execution of an untrusted or unsigned binary from that path. Threat actors will regularly get users to install untrusted or unsigned applications, usually impersonating a valid application, in a normal system location and the application will install a launch services persistence that looks generic and won't generally raise suspicion.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects when a Launch Agent or Launch Daemon is created in a common way by moving the plist into one of the two
directories using the native cp or mv binaries and the plist arguments contain a common application path followed
immediately by the execution of an untrusted or unsigned binary from that path. Threat actors will regularly get users
to install untrusted or unsigned applications, usually impersonating a valid application, in a normal system location
and the application will install a launch services persistence that looks generic and won't generally raise suspicion.
"""
id = "74d77df0-c4ef-41d8-a07a-c37ef2ea91ad"
license = "Elastic License v2"
name = "Untrusted or Unsigned Binary Executed via Launch Service"
os_list = ["macos"]
version = "1.0.8"
query = '''
sequence with maxspan=30s
[persistence where event.action == "launch_daemon" and (process.name in ("cp", "mv", "sed") or (process.code_signature.trusted == false or process.code_signature.exists == false)) and
Persistence.args like~ ("/Library/Application Support/*", "/Applications/*", "/Users/*/Library/Application Support/*") and
not Effective_process.executable like "/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager"] as event0
[process where event.type == "start" and event.action == "exec" and startswith~(event0.Persistence.args, process.executable) and
(process.code_signature.exists == false or process.code_signature.trusted == false) and
not (process.parent.code_signature.team_id == "5C3VHX9RG5" and process.parent.code_signature.trusted == true) and
not process.Ext.effective_parent.executable like "/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager"]
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[threat.technique.subtechnique]]
id = "T1546.016"
name = "Installer Packages"
reference = "https://attack.mitre.org/techniques/T1546/016/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: persistence
[persistence where event.action == "launch_daemon" and (process.name in ("cp", "mv", "sed") or (process.code_signature.trusted == false or process.code_signature.exists == false)) and
Persistence.args like~ ("/Library/Application Support/*", "/Applications/*", "/Users/*/Library/Application Support/*") and
not Effective_process.executable like "/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager"] as event0
Stage 2: process
[process where event.type == "start" and event.action == "exec" and startswith~(event0.Persistence.args, process.executable) and
(process.code_signature.exists == false or process.code_signature.trusted == false) and
not (process.parent.code_signature.team_id == "5C3VHX9RG5" and process.parent.code_signature.trusted == true) and
not process.Ext.effective_parent.executable like "/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Persistence.args | wildcard |
| field:"Persistence.args" kind:wildcard |
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
event0.Persistence.args | starts_with |
| field:"event0.Persistence.args" kind:starts_with value:"process.executable" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
Unusual User Privilege Enumeration via id
#This rule monitors for a sequence of 20 "id" command executions within 1 second by the same parent process. This behavior is unusual, and may be indicative of the execution of an enumeration script such as LinPEAS or LinEnum. These scripts leverage the "id" command to enumerate the privileges of all users present on the system.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2023/08/29"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule monitors for a sequence of 20 "id" command executions within 1 second by the same parent process. This
behavior is unusual, and may be indicative of the execution of an enumeration script such as LinPEAS or LinEnum. These
scripts leverage the "id" command to enumerate the privileges of all users present on the system.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Unusual User Privilege Enumeration via id"
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 User Privilege Enumeration via id
The `id` command in Linux environments is used to display user identity information, including user and group IDs. Adversaries may exploit this command in enumeration scripts to gather extensive user privilege data rapidly, which can aid in lateral movement or privilege escalation. The detection rule identifies suspicious activity by flagging rapid, repeated executions of the `id` command, suggesting potential misuse by scripts like LinPEAS or LinEnum.
### Possible investigation steps
- Review the alert details to identify the specific host.id and process.parent.entity_id associated with the suspicious activity.
- Examine the parent process of the 'id' command executions to determine if it is a known or legitimate process, and check for any unusual or unexpected parent process names or arguments.
- Investigate the timeline of events on the affected host around the time of the alert to identify any other suspicious activities or related processes that may indicate a broader attack or script execution.
- Check the user account associated with the process executions to verify if it has legitimate access and if there are any signs of compromise or misuse.
- Look for any additional indicators of compromise on the host, such as unauthorized file modifications, network connections, or other unusual command executions, to assess the scope of potential malicious activity.
### False positive analysis
- System management scripts or automated tasks may execute the id command frequently for legitimate purposes. Review the parent process to determine if it is a known management tool or script.
- Software installation or update processes might trigger the rule if they use the id command to verify user permissions. Consider excluding processes with parent names like rpm or similar package managers.
- Custom scripts developed in-house for system monitoring or auditing could inadvertently match the rule's criteria. Identify these scripts and add exceptions for their parent process entity IDs.
- Security tools or compliance checks that perform regular user enumeration might cause false positives. Verify the source of these tools and exclude them if they are part of a trusted security suite.
- In environments with high user account turnover, scripts that manage user accounts might execute the id command in rapid succession. Evaluate these scripts and exclude them if they are part of routine account management.
### Response and remediation
- Immediately isolate the affected host from the network to prevent potential lateral movement by the adversary.
- Terminate any suspicious processes associated with the parent process identified in the alert to halt further enumeration activities.
- Conduct a thorough review of the parent process and its associated scripts to determine if they are legitimate or malicious.
- If malicious activity is confirmed, perform a comprehensive scan of the system for additional indicators of compromise, such as unauthorized user accounts or altered system files.
- Reset credentials for any user accounts that may have been exposed or compromised during the enumeration activity.
- Escalate the incident to the security operations team for further investigation and to assess the potential impact on other systems within the network.
- Implement enhanced monitoring and logging for similar enumeration activities to improve detection and response capabilities for future incidents."""
risk_score = 47
rule_id = "afa135c0-a365-43ab-aa35-fd86df314a47"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id, process.parent.entity_id with maxspan=1s
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.name == "id" and process.args_count == 2 and
not (
process.parent.name in ("rpm", "snarftmp", "quota_copy", "java") or
process.parent.args like (
"/var/tmp/rpm-tmp*", "/tmp/netdata-kickstart.sh", "./k8s-certifikator.sh", "/usr/local/bin/docker-entrypoint.sh",
"./set_quota.sh"
) or
(process.parent.name == "java" and process.args == "oracle")
)] with runs=20
'''
[[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.technique]]
id = "T1087"
name = "Account Discovery"
reference = "https://attack.mitre.org/techniques/T1087/"
[[rule.threat.technique.subtechnique]]
id = "T1087.001"
name = "Local Account"
reference = "https://attack.mitre.org/techniques/T1087/001/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
Stages and Predicates
Stage 1: process ×20
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.name == "id" and process.args_count == 2 and
not (
process.parent.name in ("rpm", "snarftmp", "quota_copy", "java") or
process.parent.args like (
"/var/tmp/rpm-tmp*", "/tmp/netdata-kickstart.sh", "./k8s-certifikator.sh", "/usr/local/bin/docker-entrypoint.sh",
"./set_quota.sh"
) or
(process.parent.name == "java" and process.args == "oracle")
)] with runs=20
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | oracle | excludes:process.args field:"process.args" value:"oracle" |
process.parent.name | eq | java | excludes:process.parent.name field:"process.parent.name" value:"java" |
process.parent.args | wildcard | /var/tmp/rpm-tmp*, /tmp/netdata-kickstart.sh, ./k8s-certifikator.sh, /usr/local/bin/docker-entrypoint.sh, ./set_quota.sh | excludes:process.parent.args |
process.parent.name | in | java, quota_copy, rpm, snarftmp | excludes:process.parent.name |
Virtual Private Network Connection Attempt
#Identifies the execution of macOS built-in commands to connect to an existing Virtual Private Network (VPN). Adversaries may use VPN connections to laterally move and control remote systems on a network.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Lateral Movement |
Rule Body
[metadata]
creation_date = "2020/01/25"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Identifies the execution of macOS built-in commands to connect to an existing Virtual Private Network (VPN). Adversaries
may use VPN connections to laterally move and control remote systems on a network.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Virtual Private Network Connection Attempt"
references = [
"https://github.com/rapid7/metasploit-framework/blob/master/modules/post/osx/manage/vpn.rb",
"https://www.unix.com/man-page/osx/8/networksetup/",
"https://superuser.com/questions/358513/start-configured-vpn-from-command-line-osx",
]
risk_score = 21
rule_id = "15dacaa0-5b90-466b-acab-63435a59701a"
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 macOS 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, for MacOS it is recommended to select "Traditional Endpoints".
- 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).
"""
severity = "low"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "macos" and event.type in ("start", "process_started") and
(
(process.name == "networksetup" and process.args like~ "-connectpppoeservice") or
(process.name == "scutil" and process.args like~ "--nc" and process.args like~ "start") or
(process.name == "osascript" and process.command_line : "osascript*set VPN to service*")
)
'''
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 Virtual Private Network Connection Attempt
Virtual Private Networks (VPNs) are used to securely connect to remote networks, encrypting data and masking IP addresses. Adversaries may exploit VPNs to move laterally within a network, gaining unauthorized access to systems. The detection rule identifies suspicious VPN connection attempts on macOS by monitoring specific command executions, helping to flag potential misuse for further investigation.
### Possible investigation steps
- Review the process details to confirm the legitimacy of the VPN connection attempt by examining the process name and arguments, such as "networksetup" with "-connectpppoeservice", "scutil" with "--nc start", or "osascript" with "osascript*set VPN to service*".
- Check the user account associated with the process to determine if the activity aligns with their typical behavior or if it appears suspicious.
- Investigate the source IP address and destination network to assess if the connection is to a known and trusted network or if it is unusual for the environment.
- Analyze historical data for similar VPN connection attempts from the same user or device to identify patterns or repeated unauthorized access attempts.
- Correlate the VPN connection attempt with other security events or alerts to identify potential lateral movement or further malicious activity within the network.
### False positive analysis
- Legitimate VPN usage by IT staff or network administrators may trigger the rule. To manage this, create exceptions for known user accounts or specific times when VPN maintenance is scheduled.
- Automated scripts or applications that use macOS built-in commands for VPN connections can cause false positives. Identify these scripts and whitelist their process names or command lines.
- Frequent VPN connections from trusted devices or IP addresses might be flagged. Exclude these devices or IPs from the rule to reduce noise.
- Users who frequently travel and connect to corporate networks via VPN may trigger alerts. Consider excluding these users or implementing a separate monitoring strategy for their activities.
- Regularly review and update the exclusion list to ensure it reflects current network policies and user behaviors, minimizing unnecessary alerts.
### Response and remediation
- Immediately isolate the affected macOS device from the network to prevent further lateral movement by the adversary.
- Terminate any suspicious VPN connections identified by the detection rule to cut off unauthorized access.
- Conduct a thorough review of the affected system's VPN configuration and logs to identify any unauthorized changes or connections.
- Reset credentials and update authentication methods for VPN access to ensure that compromised credentials are not reused.
- Escalate the incident to the security operations center (SOC) for further analysis and to determine if other systems have been affected.
- Implement additional monitoring on the network for unusual VPN connection attempts or related suspicious activities to enhance detection capabilities.
- Review and update VPN access policies to ensure they align with current security best practices and limit access to only necessary users and systems."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1133"
name = "External Remote Services"
reference = "https://attack.mitre.org/techniques/T1133/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
Stages and Predicates
Stage 1: process
process where host.os.type == "macos" and event.type in ("start", "process_started") and
(
(process.name == "networksetup" and process.args like~ "-connectpppoeservice") or
(process.name == "scutil" and process.args like~ "--nc" and process.args like~ "start") or
(process.name == "osascript" and process.command_line : "osascript*set VPN to service*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | in |
| field:"event.type" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"osascript*set VPN to service*" |
process.name | eq |
| field:"process_basename" kind:eq |
VirtualAlloc API Call from an Unsigned DLL
#Identifies the load of an unsigned or untrusted DLL by a trusted binary followed by calling VirtualAlloc API to allocate executable memory. This may indicate execution via DLL sideloading to perform code injection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies the load of an unsigned or untrusted DLL by a trusted binary followed by calling VirtualAlloc API to allocate
executable memory. This may indicate execution via DLL sideloading to perform code injection.
"""
id = "96ffa829-b9fc-4456-be96-2b59b8facaed"
license = "Elastic License v2"
name = "VirtualAlloc API Call from an Unsigned DLL"
os_list = ["windows"]
version = "1.0.15"
query = '''
sequence by process.entity_id
[library where process.name != null and
(dll.Ext.relative_file_creation_time <= 900 or
dll.Ext.relative_file_name_modify_time <= 900 or
(dll.Ext.device.product_id like ("Virtual DVD-ROM", "Virtual Disk","USB *") and not dll.path : "C:\\*") or
dll.path : ("\\Device\\Mup\\*", "?:\\Users\\Public\\*", "?:\\Windows\\Tasks\\*", "?:\\ProgramData\\*")) and
not dll.code_signature.status like ("trusted", "errorCode_endpoint*") and dll.hash.sha256 != null and
not dll.path : ("?:\\Windows\\Installer\\*",
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
"?:\\Windows\\SysWOW64\\DriverStore\\FileRepository\\*",
"?:\\Windows\\assembly\\*",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name in
("PFU LIMITED", "Sky UK Limited", "Genetec inc", "Sky International AG",
"EFI Software (Electronics for Imaging, Inc.)", "Amazon.com Services LLC",
"VICON INDUSTRIES, INC.", "Altium LLC")) and
not (dll.name : "ISSetup.dll" and dll.pe.original_file_name : "iKernel.dll") and
not dll.hash.sha256 :
("624bf5fbf96b6399fe0a624c8da7122cc207dba4273d6373fac7796d2dc1bed9",
"dfa6e54b8c5659abcf7f1ac605379afcde27f713ca6a071e9da1367c5f5098ea",
"4b3d1f4ec733afa5c593be64f251560515b91cb328e5c741ff877455aff0d453",
"b950c9f7fb8e9b558d9caf634d7463fb4bf0aaf69a501d8f922763f8837b0ad2",
"6eed2886728608f1b3f4a54a7a7d338ef1b1669f6f53a5d38bcd352f0ec755c9",
"139a3fba0e2035830021d50bd24b73dc6d5b8b0520ee6d946ebef1ec2f602ff0",
"127ebabd8e20267bdd26165cd26398bd9225d89b2977ff8de2b5f9da8a231e67",
"4a23537d3523441a06b705bca6a7bd601c450b17a0586d669b07fd86c1dc0962",
"3ed846264d5003acbd0dd624cbe4ca84606fe897fd8caa29350621906a3e28c0",
"b211c61e1fa89cbaf4570ee5f9712772582b2f4bb23597549ec32ea066a20b76",
"deaf71807722382d05244160ee35b1a14c0e621d7caf74c863475669e5c95b35",
"7bafd0da58d427bbe8a2d34c953a53809bcbb3ff6c6f90b8acbe6c2b3ab8fa08",
"8747dc251af9c3192bad2001786c626ad03903c3afaadb8c6a8c2627c66730bd",
"5c45a7439d127c09b74fa16a0b300fb290ba15d316397579985464be484b8e17",
"e51e7a2667b8b78ab32a7fe458d0fa498764721367ca4cc5d6fa7c05976f4bf0",
"7c173cdaea8e3a3cc95b7196681cb904f3996f81289d5890b30f38c99eba45ae",
"3dfa92d9a0ecefbb95a6b73dc15e8ae424725b2ddafe33a3e0b8d97b49a36be0",
"0ec17d0e628cd5c9475c88164c642c6fe62322ca62facb0c3937029a39099d31",
"ad9b9dd4f424e50bbdf126ed94fdaa75b122889766420c56ebbca1b7622af746",
"db3477572af5b5f353e723db1e7e8de9b743a120a145c3c26851e969ac34044d",
"864cf2c41bb85ec2e5b461ce4e04df53381a35a7f7c61a16078bee2a82bcedc4",
"0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70",
"5ada6b6a5802d17c6cc599907542b231f15d9b39f79dc6693b32cee308a12e5c",
"17ddddc4b4d3a6e902b3e84dcd4d3eb4f349efc3c207bb99cd65d71549802b63",
"0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70",
"b4e472f5655222f431944c8cd6b3f5dd8e3932c99259639b35bf3b09e673a4f9",
"8480cbc7f6f3c6be4d9e03fa14f58f1efd0dca08f660296725f212594d10a700",
"f3b161fc18a12b0cfd8f41964b3b17577c121359ca656329a14378149f3e42de",
"98cd02d52cd1d255cf68eaee946eff807d9d9f1ddcd01f9317f28d22f76db871",
"f9037911ad2cb5570a61af5ec1549c33fb131eccc3d6da93de556ae7952adf9f",
"3885dbec9db4d8a3a1f6ad12ff0055e64de63d351424b954369e7828950f7fa7",
"2ff67993f53becab7fa167138e6f2749378afe87beb81949913c9731fc14d95e",
"e5bb896d9e05d81b143bc517dc2d8b5f3900a6e336edac7ff79b5ac34ba6c9e0",
"e3048d233fa257f242ccb05279898cf5490d1708cca91113bbb365b39364dcfa",
"0c9df43d26b8e672b602aa061fec13fad1a01d2b8116042f3854712471097e0e",
"e61c231e1c3d895f1adbce70075a79ac79a556132ac35c73849d0c19815897b2")
] as event0
[api where
process.Ext.api.name in ("VirtualAlloc", "VirtualAllocEx","MapViewOfFile", "MapViewOfFile2") and
process.Ext.api.parameters.protection like "RWX*" and
process.Ext.api.parameters.size > 4524 and
_arraysearch(process.thread.Ext.call_stack, $entry, stringcontains~($entry.protection_provenance, event0.dll.name)) and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance : ("issetup.dll", "is_*.tmp", "bdhkm32.dll", "msi*.tmp")) and
not process.thread.Ext.call_stack_summary: ("ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll|*", "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll*") and
not (process.name : ("msiexec.exe", "setup.exe") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes : "8985271f001056e8f60300008d8dbd1d001085c00f859400000056e84003000056e85502000056e85301000090909090909090908b4e3485c90f848900000003"))
]
until [process where event.action:"end"]
'''
min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Ordered sequence: each step below must occur in order, correlated by process.entity_id.
Stage 1: library
[library where process.name != null and
(dll.Ext.relative_file_creation_time <= 900 or
dll.Ext.relative_file_name_modify_time <= 900 or
(dll.Ext.device.product_id like ("Virtual DVD-ROM", "Virtual Disk","USB *") and not dll.path : "C:\\*") or
dll.path : ("\\Device\\Mup\\*", "?:\\Users\\Public\\*", "?:\\Windows\\Tasks\\*", "?:\\ProgramData\\*")) and
not dll.code_signature.status like ("trusted", "errorCode_endpoint*") and dll.hash.sha256 != null and
not dll.path : ("?:\\Windows\\Installer\\*",
"?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
"?:\\Windows\\SysWOW64\\DriverStore\\FileRepository\\*",
"?:\\Windows\\assembly\\*",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name in
("PFU LIMITED", "Sky UK Limited", "Genetec inc", "Sky International AG",
"EFI Software (Electronics for Imaging, Inc.)", "Amazon.com Services LLC",
"VICON INDUSTRIES, INC.", "Altium LLC")) and
not (dll.name : "ISSetup.dll" and dll.pe.original_file_name : "iKernel.dll") and
not dll.hash.sha256 :
("624bf5fbf96b6399fe0a624c8da7122cc207dba4273d6373fac7796d2dc1bed9",
"dfa6e54b8c5659abcf7f1ac605379afcde27f713ca6a071e9da1367c5f5098ea",
"4b3d1f4ec733afa5c593be64f251560515b91cb328e5c741ff877455aff0d453",
"b950c9f7fb8e9b558d9caf634d7463fb4bf0aaf69a501d8f922763f8837b0ad2",
"6eed2886728608f1b3f4a54a7a7d338ef1b1669f6f53a5d38bcd352f0ec755c9",
"139a3fba0e2035830021d50bd24b73dc6d5b8b0520ee6d946ebef1ec2f602ff0",
"127ebabd8e20267bdd26165cd26398bd9225d89b2977ff8de2b5f9da8a231e67",
"4a23537d3523441a06b705bca6a7bd601c450b17a0586d669b07fd86c1dc0962",
"3ed846264d5003acbd0dd624cbe4ca84606fe897fd8caa29350621906a3e28c0",
"b211c61e1fa89cbaf4570ee5f9712772582b2f4bb23597549ec32ea066a20b76",
"deaf71807722382d05244160ee35b1a14c0e621d7caf74c863475669e5c95b35",
"7bafd0da58d427bbe8a2d34c953a53809bcbb3ff6c6f90b8acbe6c2b3ab8fa08",
"8747dc251af9c3192bad2001786c626ad03903c3afaadb8c6a8c2627c66730bd",
"5c45a7439d127c09b74fa16a0b300fb290ba15d316397579985464be484b8e17",
"e51e7a2667b8b78ab32a7fe458d0fa498764721367ca4cc5d6fa7c05976f4bf0",
"7c173cdaea8e3a3cc95b7196681cb904f3996f81289d5890b30f38c99eba45ae",
"3dfa92d9a0ecefbb95a6b73dc15e8ae424725b2ddafe33a3e0b8d97b49a36be0",
"0ec17d0e628cd5c9475c88164c642c6fe62322ca62facb0c3937029a39099d31",
"ad9b9dd4f424e50bbdf126ed94fdaa75b122889766420c56ebbca1b7622af746",
"db3477572af5b5f353e723db1e7e8de9b743a120a145c3c26851e969ac34044d",
"864cf2c41bb85ec2e5b461ce4e04df53381a35a7f7c61a16078bee2a82bcedc4",
"0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70",
"5ada6b6a5802d17c6cc599907542b231f15d9b39f79dc6693b32cee308a12e5c",
"17ddddc4b4d3a6e902b3e84dcd4d3eb4f349efc3c207bb99cd65d71549802b63",
"0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70",
"b4e472f5655222f431944c8cd6b3f5dd8e3932c99259639b35bf3b09e673a4f9",
"8480cbc7f6f3c6be4d9e03fa14f58f1efd0dca08f660296725f212594d10a700",
"f3b161fc18a12b0cfd8f41964b3b17577c121359ca656329a14378149f3e42de",
"98cd02d52cd1d255cf68eaee946eff807d9d9f1ddcd01f9317f28d22f76db871",
"f9037911ad2cb5570a61af5ec1549c33fb131eccc3d6da93de556ae7952adf9f",
"3885dbec9db4d8a3a1f6ad12ff0055e64de63d351424b954369e7828950f7fa7",
"2ff67993f53becab7fa167138e6f2749378afe87beb81949913c9731fc14d95e",
"e5bb896d9e05d81b143bc517dc2d8b5f3900a6e336edac7ff79b5ac34ba6c9e0",
"e3048d233fa257f242ccb05279898cf5490d1708cca91113bbb365b39364dcfa",
"0c9df43d26b8e672b602aa061fec13fad1a01d2b8116042f3854712471097e0e",
"e61c231e1c3d895f1adbce70075a79ac79a556132ac35c73849d0c19815897b2")
] as event0
Stage 2: api
[api where
process.Ext.api.name in ("VirtualAlloc", "VirtualAllocEx","MapViewOfFile", "MapViewOfFile2") and
process.Ext.api.parameters.protection like "RWX*" and
process.Ext.api.parameters.size > 4524 and
_arraysearch(process.thread.Ext.call_stack, $entry, stringcontains~($entry.protection_provenance, event0.dll.name)) and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance : ("issetup.dll", "is_*.tmp", "bdhkm32.dll", "msi*.tmp")) and
not process.thread.Ext.call_stack_summary: ("ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll|*", "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll*") and
not (process.name : ("msiexec.exe", "setup.exe") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes : "8985271f001056e8f60300008d8dbd1d001085c00f859400000056e84003000056e85502000056e85301000090909090909090908b4e3485c90f848900000003"))
]
Until: process
until [process where event.action:"end"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.Ext.device.product_id | wildcard |
| field:"dll.Ext.device.product_id" kind:wildcard |
dll.Ext.relative_file_creation_time | le |
| field:"dll.Ext.relative_file_creation_time" kind:le value:"900" |
dll.Ext.relative_file_name_modify_time | le |
| field:"dll.Ext.relative_file_name_modify_time" kind:le value:"900" |
dll.hash.sha256 | is_not_null | field:"Hashes" kind:is_not_null | |
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"end" |
process.Ext.api.name | in |
| field:"process.Ext.api.name" kind:in |
process.Ext.api.parameters.protection | wildcard |
| field:"process.Ext.api.parameters.protection" kind:wildcard value:"RWX*" |
process.Ext.api.parameters.size | gt |
| field:"process.Ext.api.parameters.size" kind:gt value:"4524" |
process.name | is_not_null | field:"process_basename" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dll.name | eq | ISSetup.dll | excludes:dll.name field:"dll.name" value:"ISSetup.dll" |
dll.pe.original_file_name | eq | iKernel.dll | excludes:dll.pe.original_file_name field:"dll.pe.original_file_name" value:"iKernel.dll" |
process.code_signature.subject_name | in | Altium LLC, Amazon.com Services LLC, EFI Software (Electronics for Imaging, Inc.), Genetec inc, PFU LIMITED, Sky International AG, Sky UK Limited, VICON INDUSTRIES, INC. | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
dll.code_signature.status | wildcard | trusted, errorCode_endpoint* | excludes:dll.code_signature.status field:"dll.code_signature.status" value:"trusted" field:"dll.code_signature.status" value:"errorCode_endpoint*" |
dll.hash.sha256 | eq | 624bf5fbf96b6399fe0a624c8da7122cc207dba4273d6373fac7796d2dc1bed9, dfa6e54b8c5659abcf7f1ac605379afcde27f713ca6a071e9da1367c5f5098ea, 4b3d1f4ec733afa5c593be64f251560515b91cb328e5c741ff877455aff0d453, b950c9f7fb8e9b558d9caf634d7463fb4bf0aaf69a501d8f922763f8837b0ad2, 6eed2886728608f1b3f4a54a7a7d338ef1b1669f6f53a5d38bcd352f0ec755c9, 139a3fba0e2035830021d50bd24b73dc6d5b8b0520ee6d946ebef1ec2f602ff0, 127ebabd8e20267bdd26165cd26398bd9225d89b2977ff8de2b5f9da8a231e67, 4a23537d3523441a06b705bca6a7bd601c450b17a0586d669b07fd86c1dc0962, 3ed846264d5003acbd0dd624cbe4ca84606fe897fd8caa29350621906a3e28c0, b211c61e1fa89cbaf4570ee5f9712772582b2f4bb23597549ec32ea066a20b76, deaf71807722382d05244160ee35b1a14c0e621d7caf74c863475669e5c95b35, 7bafd0da58d427bbe8a2d34c953a53809bcbb3ff6c6f90b8acbe6c2b3ab8fa08, 8747dc251af9c3192bad2001786c626ad03903c3afaadb8c6a8c2627c66730bd, 5c45a7439d127c09b74fa16a0b300fb290ba15d316397579985464be484b8e17, e51e7a2667b8b78ab32a7fe458d0fa498764721367ca4cc5d6fa7c05976f4bf0, 7c173cdaea8e3a3cc95b7196681cb904f3996f81289d5890b30f38c99eba45ae, 3dfa92d9a0ecefbb95a6b73dc15e8ae424725b2ddafe33a3e0b8d97b49a36be0, 0ec17d0e628cd5c9475c88164c642c6fe62322ca62facb0c3937029a39099d31, ad9b9dd4f424e50bbdf126ed94fdaa75b122889766420c56ebbca1b7622af746, db3477572af5b5f353e723db1e7e8de9b743a120a145c3c26851e969ac34044d, 864cf2c41bb85ec2e5b461ce4e04df53381a35a7f7c61a16078bee2a82bcedc4, 0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70, 5ada6b6a5802d17c6cc599907542b231f15d9b39f79dc6693b32cee308a12e5c, 17ddddc4b4d3a6e902b3e84dcd4d3eb4f349efc3c207bb99cd65d71549802b63, 0e1c7395639deafecf99e79d394ff29f7399ccb4cde50b1e5e19861d2ea3aa70, b4e472f5655222f431944c8cd6b3f5dd8e3932c99259639b35bf3b09e673a4f9, 8480cbc7f6f3c6be4d9e03fa14f58f1efd0dca08f660296725f212594d10a700, f3b161fc18a12b0cfd8f41964b3b17577c121359ca656329a14378149f3e42de, 98cd02d52cd1d255cf68eaee946eff807d9d9f1ddcd01f9317f28d22f76db871, f9037911ad2cb5570a61af5ec1549c33fb131eccc3d6da93de556ae7952adf9f, 3885dbec9db4d8a3a1f6ad12ff0055e64de63d351424b954369e7828950f7fa7, 2ff67993f53becab7fa167138e6f2749378afe87beb81949913c9731fc14d95e, e5bb896d9e05d81b143bc517dc2d8b5f3900a6e336edac7ff79b5ac34ba6c9e0, e3048d233fa257f242ccb05279898cf5490d1708cca91113bbb365b39364dcfa, 0c9df43d26b8e672b602aa061fec13fad1a01d2b8116042f3854712471097e0e, e61c231e1c3d895f1adbce70075a79ac79a556132ac35c73849d0c19815897b2 | excludes:dll.hash.sha256 |
dll.path | starts_with | ?:\Windows\Installer\, ?:\Windows\System32\DriverStore\FileRepository\, ?:\Windows\SysWOW64\DriverStore\FileRepository\, ?:\Windows\assembly\, ?:\Program Files\, ?:\Program Files (x86)\ | excludes:dll.path |
process.executable | starts_with | ?:\Program Files\, ?:\Program Files (x86)\ | excludes:process.executable field:"process.executable" value:"?:\Program Files\" field:"process.executable" value:"?:\Program Files (x86)\" |
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.name | eq | msiexec.exe, setup.exe | excludes:process.name field:"process.name" value:"msiexec.exe" field:"process.name" value:"setup.exe" |
process.thread.Ext.call_stack_summary | wildcard | ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll|*, ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll* | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll|*" field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|*|ntdll.dll|kernelbase.dll|jvm.dll|java.dll*" |