Detection rules › Elastic
Elastic rules: 0t
AdminSDHolder Backdoor
#Detects modifications in the AdminSDHolder object. Attackers can abuse the SDProp process to implement a persistent backdoor in Active Directory. SDProp compares the permissions on protected objects with those defined on the AdminSDHolder object. If the permissions on any of the protected accounts and groups do not match, the permissions on the protected accounts and groups are reset to match those of the domain's AdminSDHolder object, regaining their Administrative Privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Security-Auditing | Event ID 5136: A directory service object was modified. |
Rule Body
[metadata]
creation_date = "2022/01/31"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Detects modifications in the AdminSDHolder object. Attackers can abuse the SDProp process to implement a persistent
backdoor in Active Directory. SDProp compares the permissions on protected objects with those defined on the
AdminSDHolder object. If the permissions on any of the protected accounts and groups do not match, the permissions on
the protected accounts and groups are reset to match those of the domain's AdminSDHolder object, regaining their
Administrative Privileges.
"""
from = "now-9m"
index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
language = "kuery"
license = "Elastic License v2"
name = "AdminSDHolder Backdoor"
references = [
"https://adsecurity.org/?p=1906",
"https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/appendix-c--protected-accounts-and-groups-in-active-directory",
]
risk_score = 73
rule_id = "6e9130a5-9be6-48e5-943a-9628bfc74b18"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Use Case: Active Directory Monitoring",
"Data Source: Active Directory",
"Data Source: Windows Security Event Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.code:5136 and host.os.type:"windows" and winlog.event_data.ObjectDN:CN=AdminSDHolder,CN=System*
'''
note = """## Triage and analysis
### Investigating AdminSDHolder Backdoor
#### Possible investigation steps
- What AdminSDHolder change did the alert preserve?
- Focus: confirm `winlog.event_data.ObjectDN` under AdminSDHolder, then read `winlog.event_data.AttributeLDAPDisplayName`, `winlog.event_data.OperationType`, `winlog.event_data.AttributeValue`, and `winlog.event_data.AttributeSyntaxOID`.
- Implication: escalate on "nTSecurityDescriptor", ownership data, or any value that can alter control of protected objects; lower concern only for non-security metadata tied to a recognized tier-0 maintenance workflow.
- What did the correlated 5136 operation contain?
- Why: one alert document may show only part of a logical directory change; `winlog.event_data.OpCorrelationID` reconstructs the rest of the operation.
- Focus: review same-controller `5136` events for the same `host.id`, `winlog.computer_name`, and `winlog.event_data.OpCorrelationID`; compare attribute, value, and operation type. $investigate_0
- Implication: escalate when the operation adds multiple ACL changes, touches unrelated sensitive attributes, or suggests a staged AdminSDHolder template rewrite; lower concern only when bounded to one expected non-security update on the same object.
- Does the recovered value grant or preserve access that SDProp can stamp onto protected identities?
- Why: AdminSDHolder is the ACL template for protected accounts and groups, so a small template edit can become persistent privileged access after SDProp runs.
- Focus: interpret attribute name, value, and syntax for a new trustee, ACE, owner reference, or delegated right rather than non-security metadata.
- Implication: escalate when the value adds a SID, DN, ACE, owner path, Full Control, Modify, WriteDacl, WriteOwner, or GenericAll outside the expected tier-0 admin set; truncated or opaque values keep permission impact unresolved and require preserving raw change data.
- Who initiated the modification, and where did the session originate?
- Focus: identify the writer and controller with `user.id`, `winlog.event_data.SubjectUserSid`, `winlog.event_data.SubjectLogonId`, and `winlog.computer_name`.
- Hint: on the same `winlog.computer_name`, match `5136` `winlog.event_data.SubjectLogonId` to `4624` `winlog.event_data.TargetLogonId`; search `4648` for the same `winlog.event_data.SubjectLogonId` when explicit credentials matter, then read `source.ip` and `winlog.event_data.AuthenticationPackageName`. Missing linked authentication records or `source.ip` leaves origin unresolved, not benign.
- $investigate_1
- $investigate_2
- Implication: escalate when the writer is unexpected, source or auth method does not fit tier-0 administration, or origin remains unresolved with a security-relevant change; do not wait on auth pivots when the attribute/value and change set already prove unauthorized rights.
- Did the template change propagate or get forced onto protected objects?
- Why: SDProp can apply the AdminSDHolder template to protected accounts and groups, so impact may appear after the initial directory-change event.
- Focus: on the same `winlog.event_data.DSName` or `winlog.computer_name`, review later `5136` events for object, attribute, writer, and time on protected users or groups.
- Hint: if the logging controller has no follow-on records, search the same `winlog.event_data.DSName` across domain controllers; absence on one controller does not clear propagation. $investigate_3
- Implication: escalate when later events show security-descriptor, owner, or trustee changes on protected identities after the AdminSDHolder edit; no follow-on `5136` visibility leaves propagation unresolved, not benign.
- Escalate when object, security-relevant attribute/value, `winlog.event_data.OpCorrelationID`, writer/session origin, or propagation evidence shows unauthorized control; close only when the exact change, bounded `5136` set, actor/session origin, and available change or baseline record all point to one recognized tier-0 workflow; preserve directory-change evidence and escalate mixed or incomplete answers. If local answers stay suspicious or unresolved, review alerts for the modifying `user.id`; use controller `host.id` alert history only when actor evidence is sparse or controller compromise is plausible.
- $investigate_4
- $investigate_5
### False positive analysis
- AdminSDHolder ACL hardening, delegated-directory cleanup, security-baseline tooling, or migration automation are narrow tier-0 exceptions, not routine administration. Confirm the exact attribute/value/operation for `winlog.event_data.ObjectDN`, expected admin or service-account session, bounded `winlog.event_data.OpCorrelationID`, matching controller/template rollout, and no unrelated actor or controller alerts. If change records, automation inventory, or deployment records exist, require alignment; otherwise prove the current actor/action or service-account/template fit from telemetry first, then use prior recurrence only to support exception stability.
- Before creating an exception, validate recurrence of the same `user.id` or `winlog.event_data.SubjectUserSid`, specific attribute, object, `winlog.event_data.DSName`, bounded operation shape, and controller pattern across prior alerts from this rule. Build the exception from that minimum confirmed workflow only after the current event is fully explained, and avoid exceptions on AdminSDHolder changes, Windows Security event "5136", or the rule name alone.
### Response and remediation
- If confirmed benign, reverse any temporary containment and record the exact actor, session, AdminSDHolder object, changed attribute, operation-correlation, and controller pattern that proved the recognized workflow. Do not keep a broad exception unless the same workflow recurs.
- If suspicious but unconfirmed, preserve the triggering `5136` event, the correlated `winlog.event_data.OpCorrelationID` change set, the current AdminSDHolder security descriptor, linked `4624` or `4648` session records, and case exports before containment. Apply reversible containment first, such as temporarily restricting the modifying account's directory-write path or increasing monitoring on the recovered actor and controller. Use broader account disablement or domain-controller isolation only if related alerts or follow-on directory abuse show active compromise and the AD response owner accepts the operational impact.
- If confirmed malicious, export the current AdminSDHolder security descriptor, recovered `5136` change set, replication context, implicated object identity, actor SID, logon session, and source-origin evidence before rollback or account action. Contain the modifying account and any recovered source endpoint or IP through identity-response or endpoint-response tooling; if direct response is unavailable, escalate that preserved evidence set to the AD or incident-response team that can act.
- After containment, review protected users and groups for unauthorized ACEs, owner changes, or delegated rights that may have been restamped from the tampered template before removing them. Restore the AdminSDHolder ACL to a known-good state, verify clean replication across domain controllers, then reset or rotate privileged credentials exposed or newly granted through the unauthorized template.
- Post-incident hardening: restrict AdminSDHolder write access to dedicated tier-0 administration paths, baseline the expected AdminSDHolder security descriptor, keep directory-service change auditing for `5136` and linked authentication logging enabled on domain controllers, and record telemetry gaps that limited the investigation.
"""
setup = """## Setup
Audit Directory Service Changes must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-directory-service-changes
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.id",
"winlog.event_data.SubjectUserName",
"winlog.event_data.SubjectUserSid",
"winlog.event_data.SubjectLogonId",
"winlog.event_data.ObjectDN",
"winlog.event_data.ObjectClass",
"winlog.event_data.AttributeLDAPDisplayName",
"winlog.event_data.AttributeValue",
"winlog.event_data.OperationType",
"winlog.event_data.OpCorrelationID",
"winlog.event_data.DSName",
"host.id",
"winlog.computer_name",
]
[transform]
[[transform.investigate]]
label = "All 5136 events in this AdminSDHolder change set"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "winlog.event_data.OpCorrelationID", queryType = "phrase", value = "{{winlog.event_data.OpCorrelationID}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "5136", valueType = "string" }
]
]
relativeFrom = "now-24h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Linked logon for the modifying session"
description = ""
providers = [
[
{ excluded = false, field = "winlog.computer_name", queryType = "phrase", value = "{{winlog.computer_name}}", valueType = "string" },
{ excluded = false, field = "winlog.event_data.TargetLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4624", valueType = "string" }
]
]
relativeFrom = "now-24h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Explicit credential events for the modifying session"
description = ""
providers = [
[
{ excluded = false, field = "winlog.computer_name", queryType = "phrase", value = "{{winlog.computer_name}}", valueType = "string" },
{ excluded = false, field = "winlog.event_data.SubjectLogonId", queryType = "phrase", value = "{{winlog.event_data.SubjectLogonId}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4648", valueType = "string" }
]
]
relativeFrom = "now-24h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Later 5136 changes in the same directory service"
description = ""
providers = [
[
{ excluded = false, field = "winlog.event_data.DSName", queryType = "phrase", value = "{{winlog.event_data.DSName}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "5136", valueType = "string" }
],
[
{ excluded = false, field = "winlog.computer_name", queryType = "phrase", value = "{{winlog.computer_name}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "5136", valueType = "string" }
]
]
relativeFrom = "now"
relativeTo = "now"
[[transform.investigate]]
label = "Recent alerts tied to this modifying identity"
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 = "Recent alerts on this domain controller"
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 = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.002"
name = "Domain Accounts"
reference = "https://attack.mitre.org/techniques/T1078/002/"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: query
event.code:5136 and host.os.type:"windows" and winlog.event_data.ObjectDN:CN=AdminSDHolder,CN=System*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
winlog.event_data.ObjectDN | wildcard |
| field:"ObjectDN" kind:wildcard value:"CN=AdminSDHolder,CN=System*" |
Attempt to Deactivate an Okta Application
#Detects attempts to deactivate an Okta application. An adversary may attempt to modify, deactivate, or delete an Okta application in order to weaken an organization's security controls or disrupt their business operations.
Known False Positives
- Consider adding exceptions to this rule to filter false positives if your organization's Okta applications are regularly deactivated and the behavior is expected.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Okta | System Log event type application.lifecycle.deactivate: Application deactivated |
Rule Body
[metadata]
creation_date = "2020/11/06"
integration = ["okta"]
maturity = "production"
updated_date = "2026/04/10"
[rule]
author = ["Elastic"]
description = """
Detects attempts to deactivate an Okta application. An adversary may attempt to modify, deactivate, or delete an Okta
application in order to weaken an organization's security controls or disrupt their business operations.
"""
false_positives = [
"""
Consider adding exceptions to this rule to filter false positives if your organization's Okta applications are
regularly deactivated and the behavior is expected.
""",
]
index = ["filebeat-*", "logs-okta*"]
language = "kuery"
license = "Elastic License v2"
name = "Attempt to Deactivate an Okta Application"
note = """## Triage and analysis
### Investigating Attempt to Deactivate an Okta Application
This rule detects attempts to deactivate an Okta application. Unauthorized deactivation could lead to disruption of services and pose a significant risk to the organization.
#### Possible investigation steps:
- Identify the actor associated with the deactivation attempt by examining the `okta.actor.id`, `okta.actor.type`, `okta.actor.alternate_id`, and `okta.actor.display_name` fields.
- Determine the client used by the actor. Review the `okta.client.ip`, `okta.client.user_agent.raw_user_agent`, `okta.client.zone`, `okta.client.device`, and `okta.client.id` fields.
- If the client is a device, check the `okta.device.id`, `okta.device.name`, `okta.device.os_platform`, `okta.device.os_version`, and `okta.device.managed` fields.
- Understand the context of the event from the `okta.debug_context.debug_data` and `okta.authentication_context` fields.
- Check the `okta.outcome.result` and `okta.outcome.reason` fields to see if the attempt was successful or failed.
- Review the past activities of the actor involved in this action by checking their previous actions logged in the `okta.target` field.
- Analyze the `okta.transaction.id` and `okta.transaction.type` fields to understand the context of the transaction.
- Evaluate the actions that happened just before and after this event in the `okta.event_type` field to help understand the full context of the activity.
### False positive analysis:
- It might be a false positive if the action was part of a planned activity, performed by an authorized person, or if the `okta.outcome.result` field shows a failure.
- An unsuccessful attempt might also indicate an authorized user having trouble rather than a malicious activity.
### Response and remediation:
- If unauthorized deactivation attempts are confirmed, initiate the incident response process.
- Block the IP address or device used in the attempts if they appear suspicious, using the data from the `okta.client.ip` and `okta.device.id` fields.
- Reset the user's password and enforce MFA re-enrollment, if applicable.
- Conduct a review of Okta policies and ensure they are in accordance with security best practices.
- If the deactivated application was crucial for business operations, coordinate with the relevant team to reactivate it and minimize the impact.
## Setup
The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
"""
references = [
"https://help.okta.com/en/prod/Content/Topics/Apps/Apps_Apps.htm",
"https://developer.okta.com/docs/reference/api/system-log/",
"https://developer.okta.com/docs/reference/api/event-types/",
"https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
"https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
"https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
]
risk_score = 21
rule_id = "edb91186-1c7e-4db8-b53e-bfa33a1a0a8a"
severity = "low"
tags = [
"Use Case: Identity and Access Audit",
"Data Source: Okta",
"Tactic: Impact",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:okta.system and event.action:application.lifecycle.deactivate
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1489"
name = "Service Stop"
reference = "https://attack.mitre.org/techniques/T1489/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
Stages and Predicates
Stage 1: query
data_stream.dataset:okta.system and event.action:application.lifecycle.deactivate
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"okta.system" |
event.action | eq |
| field:"EventType" kind:eq value:"application.lifecycle.deactivate" |
AWS RDS DB Instance or Cluster Deleted
#Identifies the deletion of an Amazon RDS DB instance, Aurora cluster, or global database cluster. Deleting these resources permanently destroys stored data and can cause major service disruption. Adversaries with sufficient permissions may delete RDS resources to impede recovery, destroy evidence, or inflict operational impact on the environment.
Known False Positives
- RDS instances or clusters may be intentionally deleted by database administrators or during planned decommissioning activities. Verify the user identity, source IP, and change context to ensure the deletion is expected. CloudFormation stack removals and automated cleanup workflows may also trigger these events and can be exempted if known and authorized.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
creation_date = "2020/05/21"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/05"
[rule]
author = ["Elastic"]
description = """
Identifies the deletion of an Amazon RDS DB instance, Aurora cluster, or global database cluster. Deleting these
resources permanently destroys stored data and can cause major service disruption. Adversaries with sufficient
permissions may delete RDS resources to impede recovery, destroy evidence, or inflict operational impact on the
environment.
"""
false_positives = [
"""
RDS instances or clusters may be intentionally deleted by database administrators or during planned decommissioning
activities. Verify the user identity, source IP, and change context to ensure the deletion is expected.
CloudFormation stack removals and automated cleanup workflows may also trigger these events and can be exempted if
known and authorized.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS RDS DB Instance or Cluster Deleted"
note = """## Triage and analysis
### Investigating AWS RDS DB Instance or Cluster Deleted
This rule detects the deletion of an RDS DB instance, Aurora DB cluster, or global database cluster. These operations permanently remove stored data and backups unless final snapshots are explicitly retained. Adversaries may delete RDS resources as part of a destructive attack, to eliminate forensic evidence, or to disrupt critical workloads. Because deletions are irreversible without backups, immediate review is required to determine whether the action was authorized and assess potential data loss.
#### Possible investigation steps
**Identify the Actor**
- Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine who performed the action.
- Validate:
- Is this user/role authorized to delete DB instances or clusters?
- Does this action align with past behavior?
**Review the Deletion Event**
- Confirm which action was invoked: `DeleteDBInstance`, `DeleteDBCluster` or `DeleteGlobalCluster`
- Examine `aws.cloudtrail.request_parameters`. Identify which resource was deleted and whether a final snapshot was created before deletion.
**Analyze Source and Access Context**
- Check `source.ip`, `source.geo` fields and `user_agent.original`
- Validate whether:
- The request originated from a known network or VPN.
- The user normally logs in from this location.
- The call was made via AWS Console vs CLI vs SDK.
**Correlate Surrounding Activity**
Search CloudTrail for:
- Recent IAM role or policy changes.
- Privilege escalation events (STS AssumeRole, CreateAccessKey, AttachUserPolicy).
- Disablement of related safety controls:
- deletionProtection modified to `false`
- backupRetentionPeriod set to `0`
- Suspicious sequencing:
- Snapshots deleted before the instance/cluster deletion.
- Network security group modifications enabling broader access before deletion.
**Validate Organizational Intent**
- Contact the service owner or DB administrator to confirm whether the deletion is expected.
**Assess Impact and Data Recovery Path**
- Identify which DB instance or cluster was deleted
- Evaluate:
- Whether automated backups existed.
- Whether point-in-time recovery is still possible.
- Whether a final snapshot was created.
### False positive analysis
- **Planned decommissioning**:
- Confirm if this action aligns with a scheduled removal or environment cleanup.
- **CloudFormation stack deletion**:
- Stack teardown often deletes RDS resources; confirm if this occurred.
- **Automated testing or ephemeral environments**:
- Test/dev pipelines may frequently create and delete clusters.
- **Infrastructure-as-code workflows**:
- Terraform destroys or GitOps cleanup jobs can generate legitimate deletion events.
### Response and remediation
**If the deletion was unauthorized:**
**Immediately restrict the actor**
- Disable or revoke the user’s access keys.
- Revoke active session tokens.
**Attempt recovery**
- Restore from:
- Final snapshot (if created)
- Automated backups
- Rebuild cluster/instance configurations based on IaC or documented templates.
**Perform full log review**
- CloudTrail, RDS Enhanced Monitoring, and VPC Flow Logs
- Identify lateral movement or privilege escalation preceding the deletion.
**Scope and contain the incident**
- Determine whether:
- Additional RDS resources were targeted
- IAM permissions were modified
- Other destructive API calls were made
**Hardening actions**
- Enable deletionProtection on all critical instances/clusters.
- Require final snapshot creation for all deletion operations.
- Enforce MFA for IAM users with RDS privileges.
- Limit RDS modification/deletion permissions to specific IAM roles.
**Documentation and Follow-Up**
- Update incident response runbooks.
- Communicate with service owners and leadership.
- Add enhanced monitoring rules around:
- Snapshot deletions
- Backup retention modifications
- RDS role changes
- DeletionProtection disable events
### Additional information
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteDBCluster.html",
"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteGlobalCluster.html",
"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteDBInstance.html",
]
risk_score = 47
rule_id = "9055ece6-2689-4224-a0e0-b04881e1f8ad"
severity = "medium"
tags = [
"Domain: Cloud",
"Platform: AWS",
"Data Source: AWS CloudTrail",
"Service: AWS RDS",
"Tactic: Impact",
"Rule Type: Custom Query (KQL)",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset: aws.cloudtrail
and event.provider: rds.amazonaws.com
and event.action: (DeleteDBCluster or DeleteGlobalCluster or DeleteDBInstance)
and event.outcome: success
and not user_agent.original: (*Terraform* or *Pulumi*)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1485"
name = "Data Destruction"
reference = "https://attack.mitre.org/techniques/T1485/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
"aws.cloudtrail.response_elements",
]
Stages and Predicates
Stage 1: query
data_stream.dataset: aws.cloudtrail
and event.provider: rds.amazonaws.com
and event.action: (DeleteDBCluster or DeleteGlobalCluster or DeleteDBInstance)
and event.outcome: success
and not user_agent.original: (*Terraform* or *Pulumi*)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"rds.amazonaws.com" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user_agent.original | match | Pulumi | excludes:user_agent.original field:"user_agent.original" value:"Pulumi" |
user_agent.original | match | Terraform | excludes:user_agent.original field:"user_agent.original" value:"Terraform" |
Azure Compute VM Command Executed
#Identifies synchronous command execution on a virtual machine (VM) or virtual machine scale set (VMSS) in Azure via the action-based Run Command ("runCommand/action"). A Virtual Machine Contributor role lets you manage virtual machines, but not access them, nor access the virtual network or storage account they’re connected to. However, commands can be run on the VM via the Run Command feature, which execute as System (Windows) or root (Linux). Other roles, such as certain Administrator roles, may be able to execute commands on a VM as well.
Known False Positives
- Command execution on a virtual machine may be done by a system or network administrator. Verify whether the username, hostname, and/or resource name should be making changes in your environment. Command execution from unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/08/17"
integration = ["azure"]
maturity = "production"
updated_date = "2026/06/10"
[rule]
author = ["Elastic"]
description = """
Identifies synchronous command execution on a virtual machine (VM) or virtual machine scale set (VMSS) in Azure via the
action-based Run Command ("runCommand/action"). A Virtual Machine Contributor role lets you manage virtual machines, but
not access them, nor access the virtual network or storage account they’re connected to. However, commands can be run on
the VM via the Run Command feature, which execute as System (Windows) or root (Linux). Other roles, such as certain
Administrator roles, may be able to execute commands on a VM as well.
"""
false_positives = [
"""
Command execution on a virtual machine may be done by a system or network administrator. Verify whether the
username, hostname, and/or resource name should be making changes in your environment. Command execution from
unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted
from the rule.
""",
]
from = "now-9m"
index = ["logs-azure.activitylogs-*", "filebeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "Azure Compute VM Command Executed"
note = """## Triage and analysis
### Investigating Azure Compute VM Command Executed
Azure Virtual Machines (VMs) allow users to run applications and services in the cloud. While roles like Virtual Machine Contributor can manage VMs, they typically can't access them directly. However, commands can be executed remotely via PowerShell, running as System. Adversaries may exploit this to execute unauthorized commands. The detection rule monitors Azure activity logs for command execution events, flagging successful operations to identify potential misuse.
### Possible investigation steps
- Review the Azure activity logs to identify the specific user or service principal that initiated the command execution event, focusing on the operation_name values "MICROSOFT.COMPUTE/VIRTUALMACHINES/RUNCOMMAND/ACTION" and "MICROSOFT.COMPUTE/VIRTUALMACHINESCALESETS/VIRTUALMACHINES/RUNCOMMAND/ACTION".
- Identify the VM in question via the `azure.resource.name` field. This can aid with pivoting into endpoint analysis of the commands executed.
- Check the event.outcome field to confirm the success of the command execution and gather details about the command executed.
- Investigate the role and permissions of the user or service principal involved to determine if they have legitimate reasons to execute commands on the VM.
- Analyze the context of the command execution, including the time and frequency of the events, to identify any unusual patterns or anomalies.
- Correlate the command execution event with other logs or alerts from the same time period to identify any related suspicious activities or potential lateral movement.
- If unauthorized access is suspected, review the VM's security settings and access controls to identify and mitigate any vulnerabilities or misconfigurations.
### False positive analysis
- Routine maintenance tasks executed by IT administrators can trigger the rule. To manage this, create exceptions for known maintenance scripts or scheduled tasks that are regularly executed.
- Automated deployment processes that use PowerShell scripts to configure or update VMs may be flagged. Identify these processes and exclude them from the rule to prevent unnecessary alerts.
- Security tools or monitoring solutions that perform regular checks on VMs might execute commands that are benign. Whitelist these tools by identifying their specific command patterns and excluding them from detection.
- Development and testing environments often involve frequent command executions for testing purposes. Consider excluding these environments from the rule or setting up a separate monitoring policy with adjusted thresholds.
- Ensure that any exclusion or exception is documented and reviewed periodically to maintain security posture and adapt to any changes in the environment or processes.
### Response and remediation
- Immediately isolate the affected virtual machine from the network to prevent further unauthorized command execution and potential lateral movement.
- Review the Azure activity logs to identify the source of the command execution and determine if it was authorized or part of a larger attack pattern.
- Revoke any unnecessary permissions from users or roles that have the ability to execute commands on virtual machines, focusing on those with Virtual Machine Contributor roles.
- Conduct a thorough investigation of the executed commands to assess any changes or impacts on the system, and restore the VM to a known good state if necessary.
- Implement additional monitoring and alerting for similar command execution activities, ensuring that any future unauthorized attempts are detected promptly.
- Escalate the incident to the security operations team for further analysis and to determine if additional systems or data may have been compromised.
- Review and update access control policies and role assignments to ensure that only necessary permissions are granted, reducing the risk of similar incidents in the future.
"""
references = [
"https://adsecurity.org/?p=4277",
"https://posts.specterops.io/attacking-azure-azure-ad-and-introducing-powerzure-ca70b330511a",
"https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#virtual-machine-contributor",
"https://www.netspi.com/blog/technical-blog/adversary-simulation/7-ways-to-execute-command-on-azure-virtual-machine-virtual-machine-scale-sets/",
"https://hackingthe.cloud/azure/run-command-abuse/",
"https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command-managed",
]
risk_score = 47
rule_id = "60884af6-f553-4a6c-af13-300047455491"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Endpoint",
"Data Source: Azure",
"Data Source: Azure Activity Logs",
"Use Case: Threat Detection",
"Tactic: Execution",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset:azure.activitylogs and
azure.activitylogs.operation_name:(
"MICROSOFT.COMPUTE/VIRTUALMACHINES/RUNCOMMAND/ACTION" or
"MICROSOFT.COMPUTE/VIRTUALMACHINESCALESETS/VIRTUALMACHINES/RUNCOMMAND/ACTION"
) and event.outcome:(Success or success) and
azure.activitylogs.identity.authorization.evidence.principal_id: * and
source.as.number: * and
azure.resource.name: *
'''
[rule.new_terms]
field = "new_terms_fields"
value = [
"azure.activitylogs.identity.authorization.evidence.principal_id",
"azure.resource.name",
"source.as.number"
]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1651"
name = "Cloud Administration Command"
reference = "https://attack.mitre.org/techniques/T1651/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset:azure.activitylogs and
azure.activitylogs.operation_name:(
"MICROSOFT.COMPUTE/VIRTUALMACHINES/RUNCOMMAND/ACTION" or
"MICROSOFT.COMPUTE/VIRTUALMACHINESCALESETS/VIRTUALMACHINES/RUNCOMMAND/ACTION"
) and event.outcome:(Success or success) and
azure.activitylogs.identity.authorization.evidence.principal_id: * and
source.as.number: * and
azure.resource.name: *
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
azure.activitylogs.identity.authorization.evidence.principal_id | is_not_null | field:"azure.activitylogs.identity.authorization.evidence.principal_id" kind:is_not_null | |
azure.activitylogs.operation_name | in |
| field:"azure.activitylogs.operation_name" kind:in |
azure.resource.name | is_not_null | field:"azure.resource.name" kind:is_not_null | |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"azure.activitylogs" |
event.outcome | in |
| field:"event.outcome" kind:in |
source.as.number | is_not_null | field:"source.as.number" kind:is_not_null |
Connection to WebService by a Signed Binary Proxy
#Identifies DNS queries to common web services by a signed Microsoft binary execution proxy. Adversaries may implement command and control communications that use common web services in order to hide their activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Command & Control |
Rule Body
[rule]
description = """
Identifies DNS queries to common web services by a signed Microsoft binary execution proxy. Adversaries may implement
command and control communications that use common web services in order to hide their activity.
"""
id = "c567240c-445b-4000-9612-b5531e21e050"
license = "Elastic License v2"
name = "Connection to WebService by a Signed Binary Proxy"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/doing-time-with-the-yipphb-dropper",
"https://www.elastic.co/security-labs/globally-distributed-stealers",
]
version = "1.0.70"
query = '''
sequence by process.entity_id with maxspan=5m
[process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
(
process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
"msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe", "installutil.exe","RegSvcs.exe",
"msxsl.exe", "xwizard.exe", "csc.exe", "net.exe", "certutil.exe", "ssh.exe",
"scp.exe", "msiexec.exe", "bitsadmin.exe") or
process.pe.original_file_name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe",
"vbc.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe", "installutil.exe",
"RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "net.exe",
"certutil.exe", "ssh.exe", "scp.exe", "msiexec.exe", "bitsadmin.exe") or
process.code_signature.subject_name == "OpenJS Foundation" or
process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
"?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe",
"?:\\Users\\*\\AppData\\*\\jre\\bin\\javaw.exe",
"?:\\ProgramData\\*\\javaw.exe",
"?:\\ProgramData\\javaw.exe",
"?:\\Users\\Public\\*\\javaw.exe",
"?:\\Windows\\Microsoft.NET\\*.exe") or
((process.name : "powershell.exe" or process.pe.original_file_name == "PowerShell.EXE") and process.args_count >= 2)
) and
not (process.name : "rundll32.exe" and process.command_line : "*davclnt.dll,DavSetCookie*") and
not (process.parent.executable : ("?:\\Program Files\\Microsoft SQL Server\\MSSQL*.EXE", "?:\\Program Files\\WindowsApps\\Microsoft.*.exe") and
process.name : ("powershell.exe", "pwsh.exe")) and
not (process.name : "java.exe" and process.parent.executable : "?:\\Program Files\\OWASP\\Zed Attack Proxy\\ZAP.exe") and
not (process.name : "java.exe" and process.args_count >= 5) and
not process.executable : ("?:\\Program Files\\Microsoft Visual Studio\\*\\MSBuild.exe", "?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\MSBuild.exe") and
not (process.name : "javaw.exe" and
process.parent.executable : ("?:\\Program Files\\QZ Tray\\qz-tray.exe", "?:\\Program Files (x86)\\PGP Tool\\pgptool.exe", "?:\\Program Files\\OWASP\\Zed Attack Proxy\\ZAP.exe")) and
not (process.name : "rundll32.exe" and process.args : "?:\\WINDOWS\\Installer\\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc") and
/* BlueIris - Camera IOT monitoring sw using telegram to upload pictures */
not (process.name : "curl.exe" and process.parent.name : "cmd.exe" and process.parent.args : "C:\\BlueIris\\Telegram-Upload\\upload.cmd ") and
not (process.name : "curl.exe" and process.parent.executable : "?:\\Program Files\\Neovim\\bin\\nvim.exe") and
not (process.code_signature.subject_name in ("EFI Software (Electronics for Imaging, Inc.)", "Fiery, LLC", "EFI Software (Electronics for Imaging Inc.)") and
process.code_signature.trusted == true) and
not process.hash.sha256 in ("4337adaa6b26ea9ad6d7bd0871d49531442ba3d8a24aecc1a5a0f26378de4f78", "56b1c3941b781a00e3cd0df0c523242a4521930964f889c4b8baecd282c419b3") and
not process.executable :
("?:\\Program Files\\Git\\mingw64\\bin\\curl.exe",
"?:\\Program Files\\Fiery\\Components\\Common files\\curl.exe",
"?:\\Program Files\\Fiery\\Fiery Command WorkStation\\curl.exe",
"?:\\Program Files\\Microsoft Visual Studio\\*\\node.exe") and
not (process.name : "rundll32.exe" and
process.args : ("?:\\Program Files\\Microsoft Office\\root\\*",
"?:\\PROGRA~2\\MICROS~1\\Office*.CPL*",
"?:\\Program Files (x86)\\F5 VPN\\*",
"?:\\Program Files\\F5 VPN\\*",
"?:\\Program Files (x86)\\Microsoft Office\\root\\*",
"?:\\Windows\\system32\\shell32.dll,Control_RunDLL",
"?:\\WINDOWS\\SYSTEM32\\EDGEHTML.dll,#141",
"?:\\WINDOWS\\System32\\shell32.dll,SHCreateLocalServerRunDll",
"C:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll,",
"?:\\PROGRA~2\\MICROS~2\\Office*\\*.CPL*",
"?:\\Windows\\System32\\mshtml.dll,PrintHTML",
"?:\\PROGRA~?\\MICROS~?\\Office??\\MLCFG32.CPL,@0",
"AppXDeploymentExtensions.OneCore.dll,ShellRefresh",
"C:\\Windows\\System32\\LogiLDA.dll,LogiFetch",
"C:\\Windows\\System32\\mshtml.dll,PrintHTML*")) and
not process.parent.executable : "C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn\\ISServerExec.exe" and
not process.parent.executable : ("C:\\Program Files\\Logi\\LogiBolt\\LogiBolt.exe",
"C:\\Program Files (x86)\\Avaya\\Avaya one-X Agent\\OneXAgentUI.exe",
"C:\\Program Files (x86)\\HP\\StatusAlerts\\bin\\HPStatusAlerts.exe",
"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64.exe",
"C:\\Program Files\\Microsoft VS Code\\Code.exe") and
not (process.name : "powershell.exe" and process.parent.name : "wsmprovhost.exe" and
process.command_line : "\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -Version 5.1 -s -NoLogo -NoProfile") and
not (process.name : "curl.exe" and process.parent.name : "powershell.exe" and
process.command_line : "\"C:\\Windows\\System32\\curl.exe\" -L -s -H \"User-Agent: PowerShell\" -H \"Accept: application/vnd.github+json\" https://api.github.com/repos/PowerShell/PowerShell/releases") and
not (process.name : "curl.exe" and process.args : ("DNS: %{time_namelookup}s\\nConnect: %{time_connect}s\\nStartTransfer: %{time_starttransfer}s\\nTotal: %{time_total}s\\n", "https://login.microsoftonline.com/*"))
]
[dns where
dns.question.name :
(
"raw.githubusercontent.*",
"pastebin.*",
"paste.ee",
"ghostbin.com",
"drive.google.com",
"?.docs.live.net",
"api.dropboxapi.*",
"content.dropboxapi.*",
"*dl.dropboxusercontent.*",
"api.onedrive.com",
"*.onedrive.org",
"onedrive.live.com",
"storage.googleapis.com",
"www.googleapis.com",
"filebin.net",
"*.ngrok.io",
"ngrok.com",
"*.portmap.*",
"*serveo.net",
"*localtunnel.me",
"*pagekite.me",
"*localxpose.io",
"*notabug.org",
"rawcdn.githack.*",
"paste.nrecom.net",
"zerobin.net",
"controlc.com",
"requestbin.net",
"slack.com",
"api.slack.com",
"slack-redir.net",
"slack-files.com",
"cdn.discordapp.com",
"discordapp.com",
"discord.com",
"apis.azureedge.net",
"cdn.sql.gg",
"?.top4top.io",
"top4top.io",
"www.uplooder.net",
"*.cdnmegafiles.com",
"transfer.sh",
"updates.peer2profit.com",
"api.telegram.org",
"t.me",
"meacz.gq",
"rwrd.org",
"*.publicvm.com",
"*.blogspot.com",
"api.mylnikov.org",
"script.google.com",
"script.googleusercontent.com",
"paste4btc.com",
"workupload.com",
"temp.sh",
"filetransfer.io",
"gofile.io",
"store?.gofile.io",
"tiny.one",
"api.notion.com",
"graph.microsoft.com",
"*.sharepoint.com",
"*upload.ee",
"bit.ly",
"t.ly",
"cutt.ly",
"mbasic.facebook.com",
"login.live.com",
"login.microsoftonline.com",
"api.gofile.io",
"file.io",
"api.anonfiles.com",
"api.trello.com",
"api.notion.com",
"gist.githubusercontent.com",
"dpaste.com",
"*azurewebsites.net",
"*.zulipchat.com",
"*.4shared.com",
"filecloud.me",
"i.ibb.co",
"files.catbox.moe",
"*.getmyip.com",
"files.pythonhosted.org",
"mockbin.org",
"webhook.site",
"run.mocky.io",
"*infinityfreeapp.com",
"free.keep.sh",
"tinyurl.com",
"ftpupload.net",
"lobfile.com",
"*.ngrok-free.app",
"www.myexternalip.com",
"*.aternos.me",
"cdn??.space",
"*.pcloud.com",
"mediafire.zip",
"urlz.fr",
"api.github.com",
"rentry.co",
"*.b-cdn.net",
"pastecode.dev",
"the.earth.li",
"*.trycloudflare.com",
"shorturl.at",
"bitly.cx",
"*.netlify.app",
"*.supabase.co",
"envs.sh"
) and
/* common to use powershell script by Microsoft Cloud sysadmins */
not (process.name : ("powershell.exe", "pwsh.exe", "javaw.exe", "node.exe", "dfsvc.exe", "rundll32.exe") and
dns.question.name : ("graph.microsoft.com", "*.sharepoint.com", "login.microsoftonline.com", "login.live.com",
"raw.githubusercontent.com", "api.github.com", "storage.googleapis.com")) and
not (dns.question.name : "rev-resolve.azurewebsites.net" and process.name : "wscript.exe") and
not (process.name : "powershell.exe" and dns.question.name like "*.azurewebsites.net") and
not (process.name == "dfsvc.exe" and dns.question.name in ("innateclient.azurewebsites.net", "hybridconfigwizard.azurewebsites.net", "tmtdist.azurewebsites.net")) and
not (process.executable : ("?:\\Program Files\\Git\\mingw64\\bin\\curl.exe", "C:\\Users\\*\\.babun\\cygwin\\bin\\curl.exe", "C:\\Users\\*\\Git\\mingw64\\bin\\curl.exe", "C:\\curl\\bin\\curl.exe") and
dns.question.name in ("api.github.com", "raw.githubusercontent.com", "graph.microsoft.com"))
]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.004"
name = "DNS"
reference = "https://attack.mitre.org/techniques/T1071/004/"
[[threat.technique]]
id = "T1102"
name = "Web Service"
reference = "https://attack.mitre.org/techniques/T1102/"
[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 5m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
(
process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
"msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe", "installutil.exe","RegSvcs.exe",
"msxsl.exe", "xwizard.exe", "csc.exe", "net.exe", "certutil.exe", "ssh.exe",
"scp.exe", "msiexec.exe", "bitsadmin.exe") or
process.pe.original_file_name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe",
"vbc.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe", "installutil.exe",
"RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "net.exe",
"certutil.exe", "ssh.exe", "scp.exe", "msiexec.exe", "bitsadmin.exe") or
process.code_signature.subject_name == "OpenJS Foundation" or
process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
"?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe",
"?:\\Users\\*\\AppData\\*\\jre\\bin\\javaw.exe",
"?:\\ProgramData\\*\\javaw.exe",
"?:\\ProgramData\\javaw.exe",
"?:\\Users\\Public\\*\\javaw.exe",
"?:\\Windows\\Microsoft.NET\\*.exe") or
((process.name : "powershell.exe" or process.pe.original_file_name == "PowerShell.EXE") and process.args_count >= 2)
) and
not (process.name : "rundll32.exe" and process.command_line : "*davclnt.dll,DavSetCookie*") and
not (process.parent.executable : ("?:\\Program Files\\Microsoft SQL Server\\MSSQL*.EXE", "?:\\Program Files\\WindowsApps\\Microsoft.*.exe") and
process.name : ("powershell.exe", "pwsh.exe")) and
not (process.name : "java.exe" and process.parent.executable : "?:\\Program Files\\OWASP\\Zed Attack Proxy\\ZAP.exe") and
not (process.name : "java.exe" and process.args_count >= 5) and
not process.executable : ("?:\\Program Files\\Microsoft Visual Studio\\*\\MSBuild.exe", "?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\MSBuild.exe") and
not (process.name : "javaw.exe" and
process.parent.executable : ("?:\\Program Files\\QZ Tray\\qz-tray.exe", "?:\\Program Files (x86)\\PGP Tool\\pgptool.exe", "?:\\Program Files\\OWASP\\Zed Attack Proxy\\ZAP.exe")) and
not (process.name : "rundll32.exe" and process.args : "?:\\WINDOWS\\Installer\\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc") and
not (process.name : "curl.exe" and process.parent.name : "cmd.exe" and process.parent.args : "C:\\BlueIris\\Telegram-Upload\\upload.cmd ") and
not (process.name : "curl.exe" and process.parent.executable : "?:\\Program Files\\Neovim\\bin\\nvim.exe") and
not (process.code_signature.subject_name in ("EFI Software (Electronics for Imaging, Inc.)", "Fiery, LLC", "EFI Software (Electronics for Imaging Inc.)") and
process.code_signature.trusted == true) and
not process.hash.sha256 in ("4337adaa6b26ea9ad6d7bd0871d49531442ba3d8a24aecc1a5a0f26378de4f78", "56b1c3941b781a00e3cd0df0c523242a4521930964f889c4b8baecd282c419b3") and
not process.executable :
("?:\\Program Files\\Git\\mingw64\\bin\\curl.exe",
"?:\\Program Files\\Fiery\\Components\\Common files\\curl.exe",
"?:\\Program Files\\Fiery\\Fiery Command WorkStation\\curl.exe",
"?:\\Program Files\\Microsoft Visual Studio\\*\\node.exe") and
not (process.name : "rundll32.exe" and
process.args : ("?:\\Program Files\\Microsoft Office\\root\\*",
"?:\\PROGRA~2\\MICROS~1\\Office*.CPL*",
"?:\\Program Files (x86)\\F5 VPN\\*",
"?:\\Program Files\\F5 VPN\\*",
"?:\\Program Files (x86)\\Microsoft Office\\root\\*",
"?:\\Windows\\system32\\shell32.dll,Control_RunDLL",
"?:\\WINDOWS\\SYSTEM32\\EDGEHTML.dll,#141",
"?:\\WINDOWS\\System32\\shell32.dll,SHCreateLocalServerRunDll",
"C:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll,",
"?:\\PROGRA~2\\MICROS~2\\Office*\\*.CPL*",
"?:\\Windows\\System32\\mshtml.dll,PrintHTML",
"?:\\PROGRA~?\\MICROS~?\\Office??\\MLCFG32.CPL,@0",
"AppXDeploymentExtensions.OneCore.dll,ShellRefresh",
"C:\\Windows\\System32\\LogiLDA.dll,LogiFetch",
"C:\\Windows\\System32\\mshtml.dll,PrintHTML*")) and
not process.parent.executable : "C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn\\ISServerExec.exe" and
not process.parent.executable : ("C:\\Program Files\\Logi\\LogiBolt\\LogiBolt.exe",
"C:\\Program Files (x86)\\Avaya\\Avaya one-X Agent\\OneXAgentUI.exe",
"C:\\Program Files (x86)\\HP\\StatusAlerts\\bin\\HPStatusAlerts.exe",
"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64.exe",
"C:\\Program Files\\Microsoft VS Code\\Code.exe") and
not (process.name : "powershell.exe" and process.parent.name : "wsmprovhost.exe" and
process.command_line : "\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -Version 5.1 -s -NoLogo -NoProfile") and
not (process.name : "curl.exe" and process.parent.name : "powershell.exe" and
process.command_line : "\"C:\\Windows\\System32\\curl.exe\" -L -s -H \"User-Agent: PowerShell\" -H \"Accept: application/vnd.github+json\" https://api.github.com/repos/PowerShell/PowerShell/releases") and
not (process.name : "curl.exe" and process.args : ("DNS: %{time_namelookup}s\\nConnect: %{time_connect}s\\nStartTransfer: %{time_starttransfer}s\\nTotal: %{time_total}s\\n", "https://login.microsoftonline.com/*"))
]
Stage 2: dns
[dns where
dns.question.name :
(
"raw.githubusercontent.*",
"pastebin.*",
"paste.ee",
"ghostbin.com",
"drive.google.com",
"?.docs.live.net",
"api.dropboxapi.*",
"content.dropboxapi.*",
"*dl.dropboxusercontent.*",
"api.onedrive.com",
"*.onedrive.org",
"onedrive.live.com",
"storage.googleapis.com",
"www.googleapis.com",
"filebin.net",
"*.ngrok.io",
"ngrok.com",
"*.portmap.*",
"*serveo.net",
"*localtunnel.me",
"*pagekite.me",
"*localxpose.io",
"*notabug.org",
"rawcdn.githack.*",
"paste.nrecom.net",
"zerobin.net",
"controlc.com",
"requestbin.net",
"slack.com",
"api.slack.com",
"slack-redir.net",
"slack-files.com",
"cdn.discordapp.com",
"discordapp.com",
"discord.com",
"apis.azureedge.net",
"cdn.sql.gg",
"?.top4top.io",
"top4top.io",
"www.uplooder.net",
"*.cdnmegafiles.com",
"transfer.sh",
"updates.peer2profit.com",
"api.telegram.org",
"t.me",
"meacz.gq",
"rwrd.org",
"*.publicvm.com",
"*.blogspot.com",
"api.mylnikov.org",
"script.google.com",
"script.googleusercontent.com",
"paste4btc.com",
"workupload.com",
"temp.sh",
"filetransfer.io",
"gofile.io",
"store?.gofile.io",
"tiny.one",
"api.notion.com",
"graph.microsoft.com",
"*.sharepoint.com",
"*upload.ee",
"bit.ly",
"t.ly",
"cutt.ly",
"mbasic.facebook.com",
"login.live.com",
"login.microsoftonline.com",
"api.gofile.io",
"file.io",
"api.anonfiles.com",
"api.trello.com",
"api.notion.com",
"gist.githubusercontent.com",
"dpaste.com",
"*azurewebsites.net",
"*.zulipchat.com",
"*.4shared.com",
"filecloud.me",
"i.ibb.co",
"files.catbox.moe",
"*.getmyip.com",
"files.pythonhosted.org",
"mockbin.org",
"webhook.site",
"run.mocky.io",
"*infinityfreeapp.com",
"free.keep.sh",
"tinyurl.com",
"ftpupload.net",
"lobfile.com",
"*.ngrok-free.app",
"www.myexternalip.com",
"*.aternos.me",
"cdn??.space",
"*.pcloud.com",
"mediafire.zip",
"urlz.fr",
"api.github.com",
"rentry.co",
"*.b-cdn.net",
"pastecode.dev",
"the.earth.li",
"*.trycloudflare.com",
"shorturl.at",
"bitly.cx",
"*.netlify.app",
"*.supabase.co",
"envs.sh"
) and
not (process.name : ("powershell.exe", "pwsh.exe", "javaw.exe", "node.exe", "dfsvc.exe", "rundll32.exe") and
dns.question.name : ("graph.microsoft.com", "*.sharepoint.com", "login.microsoftonline.com", "login.live.com",
"raw.githubusercontent.com", "api.github.com", "storage.googleapis.com")) and
not (dns.question.name : "rev-resolve.azurewebsites.net" and process.name : "wscript.exe") and
not (process.name : "powershell.exe" and dns.question.name like "*.azurewebsites.net") and
not (process.name == "dfsvc.exe" and dns.question.name in ("innateclient.azurewebsites.net", "hybridconfigwizard.azurewebsites.net", "tmtdist.azurewebsites.net")) and
not (process.executable : ("?:\\Program Files\\Git\\mingw64\\bin\\curl.exe", "C:\\Users\\*\\.babun\\cygwin\\bin\\curl.exe", "C:\\Users\\*\\Git\\mingw64\\bin\\curl.exe", "C:\\curl\\bin\\curl.exe") and
dns.question.name in ("api.github.com", "raw.githubusercontent.com", "graph.microsoft.com"))
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args_count | ge |
| field:"process.args_count" kind:ge value:"2" |
process.code_signature.subject_name | eq |
| field:"Signature" kind:eq value:"OpenJS Foundation" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.pe.original_file_name | eq |
| field:"OriginalFileName" kind:eq value:"PowerShell.EXE" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard |
user.id | wildcard |
| field:"user.id" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | ?:\Program Files\Microsoft Office\root\*, ?:\PROGRA~2\MICROS~1\Office*.CPL*, ?:\Program Files (x86)\F5 VPN\*, ?:\Program Files\F5 VPN\*, ?:\Program Files (x86)\Microsoft Office\root\*, ?:\Windows\system32\shell32.dll,Control_RunDLL, ?:\WINDOWS\SYSTEM32\EDGEHTML.dll,#141, ?:\WINDOWS\System32\shell32.dll,SHCreateLocalServerRunDll, C:\Program Files\Windows Photo Viewer\PhotoViewer.dll,, ?:\PROGRA~2\MICROS~2\Office*\*.CPL*, ?:\Windows\System32\mshtml.dll,PrintHTML, ?:\PROGRA~?\MICROS~?\Office??\MLCFG32.CPL,@0, AppXDeploymentExtensions.OneCore.dll,ShellRefresh, C:\Windows\System32\LogiLDA.dll,LogiFetch, C:\Windows\System32\mshtml.dll,PrintHTML* | excludes:process.args |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.args | wildcard | ?:\WINDOWS\Installer\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc | excludes:process.args field:"process.args" value:"?:\WINDOWS\Installer\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc" |
process.args | wildcard | DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nStartTransfer: %{time_starttransfer}s\nTotal: %{time_total}s\n, https://login.microsoftonline.com/* | excludes:process.args field:"process.args" value:"DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nStartTransfer: %{time_starttransfer}s\nTotal: %{time_total}s\n" field:"process.args" value:"https://login.microsoftonline.com/*" |
process.name | eq | curl.exe | excludes:process.name field:"process.name" value:"curl.exe" |
process.args_count | ge | 5 | excludes:process.args_count field:"process.args_count" value:"5" |
process.name | eq | java.exe | excludes:process.name field:"process.name" value:"java.exe" |
process.code_signature.subject_name | in | EFI Software (Electronics for Imaging Inc.), EFI Software (Electronics for Imaging, Inc.), Fiery, LLC | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"EFI Software (Electronics for Imaging Inc.)" field:"process.code_signature.subject_name" value:"EFI Software (Electronics for Imaging, Inc.)" field:"process.code_signature.subject_name" value:"Fiery, LLC" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.command_line | eq | "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Version 5.1 -s -NoLogo -NoProfile | excludes:process.command_line |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.parent.name | eq | wsmprovhost.exe | excludes:process.parent.name field:"process.parent.name" value:"wsmprovhost.exe" |
process.command_line | eq | "C:\Windows\System32\curl.exe" -L -s -H "User-Agent: PowerShell" -H "Accept: application/vnd.github+json" https://api.github.com/repos/PowerShell/PowerShell/releases | excludes:process.command_line |
process.parent.name | eq | powershell.exe | excludes:process.parent.name field:"process.parent.name" value:"powershell.exe" |
process.command_line | match | davclnt.dll,DavSetCookie | excludes:process.command_line field:"process.command_line" value:"davclnt.dll,DavSetCookie" |
process.parent.args | eq | C:\BlueIris\Telegram-Upload\upload.cmd | excludes:process.parent.args field:"process.parent.args" value:"C:\BlueIris\Telegram-Upload\upload.cmd " |
process.parent.name | eq | cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"cmd.exe" |
process.parent.executable | eq | ?:\Program Files\Neovim\bin\nvim.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Neovim\bin\nvim.exe" |
process.parent.executable | eq | ?:\Program Files\OWASP\Zed Attack Proxy\ZAP.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\OWASP\Zed Attack Proxy\ZAP.exe" |
process.name | eq | javaw.exe | excludes:process.name field:"process.name" value:"javaw.exe" |
process.parent.executable | eq | ?:\Program Files\QZ Tray\qz-tray.exe, ?:\Program Files (x86)\PGP Tool\pgptool.exe, ?:\Program Files\OWASP\Zed Attack Proxy\ZAP.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\QZ Tray\qz-tray.exe" field:"process.parent.executable" value:"?:\Program Files (x86)\PGP Tool\pgptool.exe" field:"process.parent.executable" value:"?:\Program Files\OWASP\Zed Attack Proxy\ZAP.exe" |
process.name | eq | powershell.exe, pwsh.exe | excludes:process.name field:"process.name" value:"powershell.exe" field:"process.name" value:"pwsh.exe" |
process.parent.executable | wildcard | ?:\Program Files\Microsoft SQL Server\MSSQL*.EXE, ?:\Program Files\WindowsApps\Microsoft.*.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Microsoft SQL Server\MSSQL*.EXE" field:"process.parent.executable" value:"?:\Program Files\WindowsApps\Microsoft.*.exe" |
process.executable | wildcard | ?:\Program Files\Git\mingw64\bin\curl.exe, ?:\Program Files\Fiery\Components\Common files\curl.exe, ?:\Program Files\Fiery\Fiery Command WorkStation\curl.exe, ?:\Program Files\Microsoft Visual Studio\*\node.exe | excludes:process.executable |
process.executable | wildcard | ?:\Program Files\Microsoft Visual Studio\*\MSBuild.exe, ?:\Program Files (x86)\Microsoft Visual Studio\*\MSBuild.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files\Microsoft Visual Studio\*\MSBuild.exe" field:"process.executable" value:"?:\Program Files (x86)\Microsoft Visual Studio\*\MSBuild.exe" |
process.hash.sha256 | in | 4337adaa6b26ea9ad6d7bd0871d49531442ba3d8a24aecc1a5a0f26378de4f78, 56b1c3941b781a00e3cd0df0c523242a4521930964f889c4b8baecd282c419b3 | excludes:process.hash.sha256 field:"process.hash.sha256" value:"4337adaa6b26ea9ad6d7bd0871d49531442ba3d8a24aecc1a5a0f26378de4f78" field:"process.hash.sha256" value:"56b1c3941b781a00e3cd0df0c523242a4521930964f889c4b8baecd282c419b3" |
process.parent.executable | eq | C:\Program Files\Logi\LogiBolt\LogiBolt.exe, C:\Program Files (x86)\Avaya\Avaya one-X Agent\OneXAgentUI.exe, C:\Program Files (x86)\HP\StatusAlerts\bin\HPStatusAlerts.exe, C:\Program Files\AutoHotkey\AutoHotkeyU64.exe, C:\Program Files\Microsoft VS Code\Code.exe | excludes:process.parent.executable |
process.parent.executable | eq | C:\Program Files\Microsoft SQL Server\150\DTS\Binn\ISServerExec.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Microsoft SQL Server\150\DTS\Binn\ISServerExec.exe" |
dns.question.name | ends_with | .azurewebsites.net | excludes:dns.question.name field:"dns.question.name" value:".azurewebsites.net" |
dns.question.name | eq | rev-resolve.azurewebsites.net | excludes:dns.question.name field:"dns.question.name" value:"rev-resolve.azurewebsites.net" |
process.name | eq | wscript.exe | excludes:process.name field:"process.name" value:"wscript.exe" |
dns.question.name | in | api.github.com, graph.microsoft.com, raw.githubusercontent.com | excludes:dns.question.name field:"dns.question.name" value:"api.github.com" field:"dns.question.name" value:"graph.microsoft.com" field:"dns.question.name" value:"raw.githubusercontent.com" |
process.executable | wildcard | ?:\Program Files\Git\mingw64\bin\curl.exe, C:\Users\*\.babun\cygwin\bin\curl.exe, C:\Users\*\Git\mingw64\bin\curl.exe, C:\curl\bin\curl.exe | excludes:process.executable |
dns.question.name | in | hybridconfigwizard.azurewebsites.net, innateclient.azurewebsites.net, tmtdist.azurewebsites.net | excludes:dns.question.name field:"dns.question.name" value:"hybridconfigwizard.azurewebsites.net" field:"dns.question.name" value:"innateclient.azurewebsites.net" field:"dns.question.name" value:"tmtdist.azurewebsites.net" |
process.name | eq | dfsvc.exe | excludes:process.name field:"process.name" value:"dfsvc.exe" |
dns.question.name | wildcard | graph.microsoft.com, *.sharepoint.com, login.microsoftonline.com, login.live.com, raw.githubusercontent.com, api.github.com, storage.googleapis.com | excludes:dns.question.name |
process.name | eq | powershell.exe, pwsh.exe, javaw.exe, node.exe, dfsvc.exe, rundll32.exe | excludes:process.name |
Dylib Load via SSH-Keygen
#Detects when the ssh-keygen binary is executed with the -D argument which can be used to load a malicious dylib into memory.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Detects when the ssh-keygen binary is executed with the -D argument which can be used to load a malicious dylib into
memory.
"""
id = "53a6460a-a204-42e0-9c92-c3bef161b6c1"
license = "Elastic License v2"
name = "Dylib Load via SSH-Keygen"
os_list = ["macos"]
reference = ["https://medium.com/@D00MFist/generate-keys-or-generate-dylib-loads-c99ed48f323d"]
version = "1.0.9"
query = '''
process where event.type == "start" and process.name == "ssh-keygen" and process.args == "-D"
'''
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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: process
process where event.type == "start" and process.name == "ssh-keygen" and process.args == "-D"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-D" |
process.name | eq |
| field:"process_basename" kind:eq value:"ssh-keygen" |
Execution from Unusual Directory - Command Line
#Identifies process execution from suspicious default Windows directories. This may be abused by adversaries to hide malware in trusted paths.
MITRE ATT&CK Coverage
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2020/10/30"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/04"
[transform]
[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"
[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""
[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""
[rule]
author = ["Elastic"]
description = """
Identifies process execution from suspicious default Windows directories. This may be abused by adversaries to hide
malware in trusted paths.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Execution from Unusual Directory - Command Line"
note = """## Triage and analysis
### Investigating Execution from Unusual Directory - Command Line
This rule looks for the execution of scripts from unusual directories. Attackers can use system or application paths to hide malware and make the execution less suspicious.
> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
#### Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Examine the command line to determine which commands or scripts were executed.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the script using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
- Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
### False positive analysis
- If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of parent process executable and command line conditions.
### Related rules
- Process Execution from an Unusual Directory - ebfe1448-7fac-4d59-acea-181bd89b1f7f
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""
references = [
"https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
"https://www.elastic.co/security-labs/hunting-for-lateral-movement-using-event-query-language",
]
risk_score = 47
rule_id = "cff92c41-2225-4763-b4ce-6f71e5bda5e6"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : ("wscript.exe",
"cscript.exe",
"rundll32.exe",
"regsvr32.exe",
"cmstp.exe",
"RegAsm.exe",
"installutil.exe",
"mshta.exe",
"RegSvcs.exe",
"powershell.exe",
"pwsh.exe",
"cmd.exe") and
/* add suspicious execution paths here */
process.args : ("C:\\PerfLogs\\*",
"C:\\Users\\Public\\*",
"C:\\Windows\\Tasks\\*",
"C:\\Intel\\*",
"C:\\AMD\\Temp\\*",
"C:\\Windows\\AppReadiness\\*",
"C:\\Windows\\ServiceState\\*",
"C:\\Windows\\security\\*",
"C:\\Windows\\IdentityCRL\\*",
"C:\\Windows\\Branding\\*",
"C:\\Windows\\csc\\*",
"C:\\Windows\\DigitalLocker\\*",
"C:\\Windows\\en-US\\*",
"C:\\Windows\\wlansvc\\*",
"C:\\Windows\\Prefetch\\*",
"C:\\Windows\\Fonts\\*",
"C:\\Windows\\diagnostics\\*",
"C:\\Windows\\TAPI\\*",
"C:\\Windows\\INF\\*",
"C:\\Windows\\System32\\Speech\\*",
"C:\\windows\\tracing\\*",
"c:\\windows\\IME\\*",
"c:\\Windows\\Performance\\*",
"c:\\windows\\intel\\*",
"c:\\windows\\ms\\*",
"C:\\Windows\\dot3svc\\*",
"C:\\Windows\\panther\\*",
"C:\\Windows\\RemotePackages\\*",
"C:\\Windows\\OCR\\*",
"C:\\Windows\\appcompat\\*",
"C:\\Windows\\apppatch\\*",
"C:\\Windows\\addins\\*",
"C:\\Windows\\Setup\\*",
"C:\\Windows\\Help\\*",
"C:\\Windows\\SKB\\*",
"C:\\Windows\\Vss\\*",
"C:\\Windows\\servicing\\*",
"C:\\Windows\\CbsTemp\\*",
"C:\\Windows\\Logs\\*",
"C:\\Windows\\WaaS\\*",
"C:\\Windows\\twain_32\\*",
"C:\\Windows\\ShellExperiences\\*",
"C:\\Windows\\ShellComponents\\*",
"C:\\Windows\\PLA\\*",
"C:\\Windows\\Migration\\*",
"C:\\Windows\\debug\\*",
"C:\\Windows\\Cursors\\*",
"C:\\Windows\\Containers\\*",
"C:\\Windows\\Boot\\*",
"C:\\Windows\\bcastdvr\\*",
"C:\\Windows\\TextInput\\*",
"C:\\Windows\\security\\*",
"C:\\Windows\\schemas\\*",
"C:\\Windows\\SchCache\\*",
"C:\\Windows\\Resources\\*",
"C:\\Windows\\rescache\\*",
"C:\\Windows\\Provisioning\\*",
"C:\\Windows\\PrintDialog\\*",
"C:\\Windows\\PolicyDefinitions\\*",
"C:\\Windows\\media\\*",
"C:\\Windows\\Globalization\\*",
"C:\\Windows\\L2Schemas\\*",
"C:\\Windows\\LiveKernelReports\\*",
"C:\\Windows\\ModemLogs\\*",
"C:\\Windows\\ImmersiveControlPanel\\*",
"C:\\$Recycle.Bin\\*") and
/* noisy FP patterns */
not process.parent.executable : ("C:\\WINDOWS\\System32\\DriverStore\\FileRepository\\*\\igfxCUIService*.exe",
"C:\\Windows\\System32\\spacedeskService.exe",
"C:\\Program Files\\Dell\\SupportAssistAgent\\SRE\\SRE.exe") and
not (process.name : "rundll32.exe" and
process.args : ("uxtheme.dll,#64",
"PRINTUI.DLL,PrintUIEntry",
"?:\\Windows\\System32\\FirewallControlPanel.dll,ShowNotificationDialog",
"?:\\WINDOWS\\system32\\Speech\\SpeechUX\\sapi.cpl",
"?:\\Windows\\system32\\shell32.dll,OpenAs_RunDLL")) and
not (process.name : "cscript.exe" and process.args : "?:\\WINDOWS\\system32\\calluxxprovider.vbs") and
not (process.name : "cmd.exe" and process.args : "?:\\WINDOWS\\system32\\powercfg.exe" and process.args : "?:\\WINDOWS\\inf\\PowerPlan.log") and
not (process.name : "regsvr32.exe" and process.args : "?:\\Windows\\Help\\OEM\\scripts\\checkmui.dll") and
not (process.name : "cmd.exe" and
process.parent.executable : ("?:\\Windows\\System32\\oobe\\windeploy.exe",
"?:\\Program Files (x86)\\ossec-agent\\wazuh-agent.exe",
"?:\\Windows\\System32\\igfxCUIService.exe",
"?:\\Windows\\Temp\\IE*.tmp\\IE*-support\\ienrcore.exe"))
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[rule.threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.003"
name = "CMSTP"
reference = "https://attack.mitre.org/techniques/T1218/003/"
[[rule.threat.technique.subtechnique]]
id = "T1218.004"
name = "InstallUtil"
reference = "https://attack.mitre.org/techniques/T1218/004/"
[[rule.threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[[rule.threat.technique.subtechnique]]
id = "T1218.009"
name = "Regsvcs/Regasm"
reference = "https://attack.mitre.org/techniques/T1218/009/"
[[rule.threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"
[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.name : ("wscript.exe",
"cscript.exe",
"rundll32.exe",
"regsvr32.exe",
"cmstp.exe",
"RegAsm.exe",
"installutil.exe",
"mshta.exe",
"RegSvcs.exe",
"powershell.exe",
"pwsh.exe",
"cmd.exe") and
process.args : ("C:\\PerfLogs\\*",
"C:\\Users\\Public\\*",
"C:\\Windows\\Tasks\\*",
"C:\\Intel\\*",
"C:\\AMD\\Temp\\*",
"C:\\Windows\\AppReadiness\\*",
"C:\\Windows\\ServiceState\\*",
"C:\\Windows\\security\\*",
"C:\\Windows\\IdentityCRL\\*",
"C:\\Windows\\Branding\\*",
"C:\\Windows\\csc\\*",
"C:\\Windows\\DigitalLocker\\*",
"C:\\Windows\\en-US\\*",
"C:\\Windows\\wlansvc\\*",
"C:\\Windows\\Prefetch\\*",
"C:\\Windows\\Fonts\\*",
"C:\\Windows\\diagnostics\\*",
"C:\\Windows\\TAPI\\*",
"C:\\Windows\\INF\\*",
"C:\\Windows\\System32\\Speech\\*",
"C:\\windows\\tracing\\*",
"c:\\windows\\IME\\*",
"c:\\Windows\\Performance\\*",
"c:\\windows\\intel\\*",
"c:\\windows\\ms\\*",
"C:\\Windows\\dot3svc\\*",
"C:\\Windows\\panther\\*",
"C:\\Windows\\RemotePackages\\*",
"C:\\Windows\\OCR\\*",
"C:\\Windows\\appcompat\\*",
"C:\\Windows\\apppatch\\*",
"C:\\Windows\\addins\\*",
"C:\\Windows\\Setup\\*",
"C:\\Windows\\Help\\*",
"C:\\Windows\\SKB\\*",
"C:\\Windows\\Vss\\*",
"C:\\Windows\\servicing\\*",
"C:\\Windows\\CbsTemp\\*",
"C:\\Windows\\Logs\\*",
"C:\\Windows\\WaaS\\*",
"C:\\Windows\\twain_32\\*",
"C:\\Windows\\ShellExperiences\\*",
"C:\\Windows\\ShellComponents\\*",
"C:\\Windows\\PLA\\*",
"C:\\Windows\\Migration\\*",
"C:\\Windows\\debug\\*",
"C:\\Windows\\Cursors\\*",
"C:\\Windows\\Containers\\*",
"C:\\Windows\\Boot\\*",
"C:\\Windows\\bcastdvr\\*",
"C:\\Windows\\TextInput\\*",
"C:\\Windows\\security\\*",
"C:\\Windows\\schemas\\*",
"C:\\Windows\\SchCache\\*",
"C:\\Windows\\Resources\\*",
"C:\\Windows\\rescache\\*",
"C:\\Windows\\Provisioning\\*",
"C:\\Windows\\PrintDialog\\*",
"C:\\Windows\\PolicyDefinitions\\*",
"C:\\Windows\\media\\*",
"C:\\Windows\\Globalization\\*",
"C:\\Windows\\L2Schemas\\*",
"C:\\Windows\\LiveKernelReports\\*",
"C:\\Windows\\ModemLogs\\*",
"C:\\Windows\\ImmersiveControlPanel\\*",
"C:\\$Recycle.Bin\\*") and
not process.parent.executable : ("C:\\WINDOWS\\System32\\DriverStore\\FileRepository\\*\\igfxCUIService*.exe",
"C:\\Windows\\System32\\spacedeskService.exe",
"C:\\Program Files\\Dell\\SupportAssistAgent\\SRE\\SRE.exe") and
not (process.name : "rundll32.exe" and
process.args : ("uxtheme.dll,#64",
"PRINTUI.DLL,PrintUIEntry",
"?:\\Windows\\System32\\FirewallControlPanel.dll,ShowNotificationDialog",
"?:\\WINDOWS\\system32\\Speech\\SpeechUX\\sapi.cpl",
"?:\\Windows\\system32\\shell32.dll,OpenAs_RunDLL")) and
not (process.name : "cscript.exe" and process.args : "?:\\WINDOWS\\system32\\calluxxprovider.vbs") and
not (process.name : "cmd.exe" and process.args : "?:\\WINDOWS\\system32\\powercfg.exe" and process.args : "?:\\WINDOWS\\inf\\PowerPlan.log") and
not (process.name : "regsvr32.exe" and process.args : "?:\\Windows\\Help\\OEM\\scripts\\checkmui.dll") and
not (process.name : "cmd.exe" and
process.parent.executable : ("?:\\Windows\\System32\\oobe\\windeploy.exe",
"?:\\Program Files (x86)\\ossec-agent\\wazuh-agent.exe",
"?:\\Windows\\System32\\igfxCUIService.exe",
"?:\\Windows\\Temp\\IE*.tmp\\IE*-support\\ienrcore.exe"))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | ?:\WINDOWS\inf\PowerPlan.log | excludes:process.args field:"process.args" value:"?:\WINDOWS\inf\PowerPlan.log" |
process.args | eq | ?:\WINDOWS\system32\powercfg.exe | excludes:process.args field:"process.args" value:"?:\WINDOWS\system32\powercfg.exe" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.args | eq | ?:\WINDOWS\system32\calluxxprovider.vbs | excludes:process.args field:"process.args" value:"?:\WINDOWS\system32\calluxxprovider.vbs" |
process.name | eq | cscript.exe | excludes:process.name field:"process.name" value:"cscript.exe" |
process.args | eq | ?:\Windows\Help\OEM\scripts\checkmui.dll | excludes:process.args field:"process.args" value:"?:\Windows\Help\OEM\scripts\checkmui.dll" |
process.name | eq | regsvr32.exe | excludes:process.name field:"process.name" value:"regsvr32.exe" |
process.args | eq | uxtheme.dll,#64, PRINTUI.DLL,PrintUIEntry, ?:\Windows\System32\FirewallControlPanel.dll,ShowNotificationDialog, ?:\WINDOWS\system32\Speech\SpeechUX\sapi.cpl, ?:\Windows\system32\shell32.dll,OpenAs_RunDLL | excludes:process.args |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.parent.executable | wildcard | ?:\Windows\System32\oobe\windeploy.exe, ?:\Program Files (x86)\ossec-agent\wazuh-agent.exe, ?:\Windows\System32\igfxCUIService.exe, ?:\Windows\Temp\IE*.tmp\IE*-support\ienrcore.exe | excludes:process.parent.executable |
process.parent.executable | wildcard | C:\WINDOWS\System32\DriverStore\FileRepository\*\igfxCUIService*.exe, C:\Windows\System32\spacedeskService.exe, C:\Program Files\Dell\SupportAssistAgent\SRE\SRE.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\WINDOWS\System32\DriverStore\FileRepository\*\igfxCUIService*.exe" field:"process.parent.executable" value:"C:\Windows\System32\spacedeskService.exe" field:"process.parent.executable" value:"C:\Program Files\Dell\SupportAssistAgent\SRE\SRE.exe" |
File Creation by Cups or Foomatic-rip Child
#This detection rule addresses multiple vulnerabilities in the CUPS printing system, including CVE-2024-47176, CVE-2024-47076, CVE-2024-47175, and CVE-2024-47177. Specifically, this rule detects suspicious file creation events executed by child processes of foomatic-rip. These flaws impact components like cups-browsed, libcupsfilters, libppd, and foomatic-rip, allowing remote unauthenticated attackers to manipulate IPP URLs or inject malicious data through crafted UDP packets or network spoofing. This can result in arbitrary command execution when a print job is initiated.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[metadata]
creation_date = "2024/09/27"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This detection rule addresses multiple vulnerabilities in the CUPS printing system, including CVE-2024-47176,
CVE-2024-47076, CVE-2024-47175, and CVE-2024-47177. Specifically, this rule detects suspicious file creation events
executed by child processes of foomatic-rip. These flaws impact components like cups-browsed, libcupsfilters, libppd,
and foomatic-rip, allowing remote unauthenticated attackers to manipulate IPP URLs or inject malicious data through
crafted UDP packets or network spoofing. This can result in arbitrary command execution when a print job is initiated.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*", "logs-endpoint.events.process*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "File Creation by Cups or Foomatic-rip Child"
note = """## Triage and analysis
### Investigating File Creation by Cups or Foomatic-rip Child
This rule identifies potential exploitation attempts of several vulnerabilities in the CUPS printing system (CVE-2024-47176, CVE-2024-47076, CVE-2024-47175, CVE-2024-47177). These vulnerabilities allow attackers to send crafted IPP requests or manipulate UDP packets to execute arbitrary commands or modify printer configurations. Attackers can exploit these flaws to inject malicious data, leading to Remote Code Execution (RCE) on affected systems.
#### Possible Investigation Steps
- Investigate the incoming IPP requests or UDP packets targeting port 631.
- Examine the printer configurations on the system to determine if any unauthorized printers or URLs have been added.
- Investigate the process tree to check if any unexpected processes were triggered as a result of IPP activity. Review the executable files for legitimacy.
- Check for additional alerts related to the compromised system or user within the last 48 hours.
- Investigate network traffic logs for suspicious outbound connections to unrecognized domains or IP addresses.
- Check if any of the contacted domains or addresses are newly registered or have a suspicious reputation.
- Retrieve any scripts or executables dropped by the attack for further analysis in a private sandbox environment:
- Analyze potential malicious activity, including:
- Attempts to communicate with external servers.
- File access or creation of unauthorized executables.
- Cron jobs, services, or other persistence mechanisms.
### Related Rules
- Cupsd or Foomatic-rip Shell Execution - 476267ff-e44f-476e-99c1-04c78cb3769d
- Printer User (lp) Shell Execution - f86cd31c-5c7e-4481-99d7-6875a3e31309
- Network Connection by Cups or Foomatic-rip Child - e80ee207-9505-49ab-8ca8-bc57d80e2cab
- Suspicious Execution from Foomatic-rip or Cupsd Parent - 986361cd-3dac-47fe-afa1-5c5dd89f2fb4
### False Positive Analysis
- This activity is rarely legitimate. However, verify the context to rule out non-malicious printer configuration changes or legitimate IPP requests.
### Response and Remediation
- Initiate the incident response process based on the triage outcome.
- Isolate the compromised host to prevent further exploitation.
- If the investigation confirms malicious activity, search the environment for additional compromised hosts.
- Implement network segmentation or restrictions to contain the attack.
- Stop suspicious processes or services tied to CUPS exploitation.
- Block identified Indicators of Compromise (IoCs), including IP addresses, domains, or hashes of involved files.
- Review compromised systems for backdoors, such as reverse shells or persistence mechanisms like cron jobs.
- Investigate potential credential exposure on compromised systems and reset passwords for any affected accounts.
- Restore the original printer configurations or uninstall unauthorized printer entries.
- Perform a thorough antimalware scan to identify any lingering threats or artifacts from the attack.
- Investigate how the attacker gained initial access and address any weaknesses to prevent future exploitation.
- Use insights from the incident to improve detection and response times in future incidents (MTTD and MTTR).
"""
references = [
"https://www.elastic.co/security-labs/cups-overflow",
"https://www.evilsocket.net/2024/09/26/Attacking-UNIX-systems-via-CUPS-Part-I/",
"https://gist.github.com/stong/c8847ef27910ae344a7b5408d9840ee1",
"https://github.com/RickdeJager/cupshax/blob/main/cupshax.py",
]
risk_score = 47
rule_id = "b9b14be7-b7f4-4367-9934-81f07d2f63c4"
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",
"Use Case: Vulnerability",
"Tactic: Execution",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id with maxspan=10s
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start") and
process.parent.name == "foomatic-rip" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")] by process.entity_id
[file where host.os.type == "linux" and event.type != "deletion" and
not (
(process.name == "gs" and file.path like ("/tmp/gs_*", "/var/spool/cups/tmp/gs_*")) or
(process.name == "pdftops" and file.path like "/tmp/0*")
)] by process.parent.entity_id
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique]]
id = "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
Ordered sequence: each step below must occur in order within 10s, correlated by host.id, process.entity_id, process.parent.entity_id.
Stage 1: process
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start") and
process.parent.name == "foomatic-rip" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")] by process.entity_id
Stage 2: file
[file where host.os.type == "linux" and event.type != "deletion" and
not (
(process.name == "gs" and file.path like ("/tmp/gs_*", "/var/spool/cups/tmp/gs_*")) or
(process.name == "pdftops" and file.path like "/tmp/0*")
)] by process.parent.entity_id
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" |
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"foomatic-rip" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | starts_with | /tmp/0 | excludes:file.path field:"file.path" value:"/tmp/0" |
process.name | eq | pdftops | excludes:process.name field:"process.name" value:"pdftops" |
file.path | starts_with | /tmp/gs_, /var/spool/cups/tmp/gs_ | excludes:file.path field:"file.path" value:"/tmp/gs_" field:"file.path" value:"/var/spool/cups/tmp/gs_" |
process.name | eq | gs | excludes:process.name field:"process.name" value:"gs" |
GitHub User Blocked From Organization
#A GitHub user was blocked from access to an organization.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| GitHub | Audit log action org.block_user: User blocked from organization repositories |
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
[metadata]
bypass_bbr_timing = true
creation_date = "2023/10/11"
integration = ["github"]
maturity = "production"
updated_date = "2025/03/20"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = "A GitHub user was blocked from access to an organization.\n"
from = "now-9m"
index = ["logs-github.audit-*"]
language = "eql"
license = "Elastic License v2"
name = "GitHub User Blocked From Organization"
risk_score = 21
rule_id = "4030c951-448a-4017-a2da-ed60f6d14f4f"
severity = "low"
tags = [
"Domain: Cloud",
"Use Case: Threat Detection",
"Use Case: UEBA",
"Tactic: Impact",
"Rule Type: BBR",
"Data Source: Github",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
configuration where event.dataset == "github.audit" and event.action == "org.block_user"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1531"
name = "Account Access Removal"
reference = "https://attack.mitre.org/techniques/T1531/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
Stages and Predicates
Stage 1: configuration
configuration where event.dataset == "github.audit" and event.action == "org.block_user"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"org.block_user" |
event.dataset | eq |
| field:"event.dataset" kind:eq value:"github.audit" |
Kubernetes Direct API Request via Curl or Wget
#This rule monitors for the execution of curl or wget commands that directly access Kubernetes API endpoints, which may indicate an attempt to interact with Kubernetes resources in a potentially unauthorized manner. This technique is often used by adversaries to gather information about the Kubernetes environment, such as secrets, config maps, and other sensitive data, without using the official Kubernetes client tools such as "kubectl".
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Credential Access | |
| Discovery |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/06/23"
integration = ["endpoint", "windows", "system", "crowdstrike", "sentinel_one_cloud_funnel", "auditd_manager", "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/03/30"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the execution of curl or wget commands that directly access Kubernetes API endpoints,
which may indicate an attempt to interact with Kubernetes resources in a potentially unauthorized manner. This
technique is often used by adversaries to gather information about the Kubernetes environment, such as secrets,
config maps, and other sensitive data, without using the official Kubernetes client tools such as "kubectl".
"""
from = "now-9m"
index = [
"auditbeat-*",
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
"logs-auditd_manager.auditd-*",
"logs-cloud_defend.process*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*"
]
language = "eql"
license = "Elastic License v2"
name = "Kubernetes Direct API Request via Curl or Wget"
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 Kubernetes Direct API Request via Curl or Wget
Kubernetes API endpoints are crucial for managing cluster resources. Adversaries may exploit tools like curl or wget to directly query these endpoints, bypassing standard clients like kubectl, to extract sensitive data such as secrets or config maps. The detection rule identifies such unauthorized access attempts by monitoring command executions that target specific API paths, flagging potential security threats.
### Possible investigation steps
- Review the process details to confirm the execution of curl or wget, focusing on the process.name and process.args fields to understand the exact command used and the specific Kubernetes API endpoint targeted.
- Check the user context under which the curl or wget command was executed, including user ID and group ID, to determine if the action was performed by a legitimate user or an unauthorized entity.
- Investigate the source IP address and host information to identify the origin of the request and assess whether it aligns with expected network activity within the Kubernetes environment.
- Examine recent authentication and authorization logs for any anomalies or failed attempts that might indicate unauthorized access attempts to the Kubernetes API.
- Correlate the alert with other security events or logs from the same timeframe to identify any related suspicious activities, such as unusual network traffic or access patterns.
- Assess the potential impact by reviewing the specific Kubernetes resources targeted, such as secrets or config maps, to determine if sensitive data might have been exposed or compromised.
### False positive analysis
- Routine monitoring scripts or health checks that use curl or wget to verify the availability of Kubernetes API endpoints may trigger this rule. To manage this, identify and whitelist the specific scripts or IP addresses that are known to perform these checks regularly.
- Automated backup processes that access Kubernetes secrets or config maps using curl or wget could be flagged. Exclude these processes by specifying their unique command patterns or execution contexts in the detection rule.
- Developers or administrators using curl or wget for legitimate troubleshooting or testing purposes might inadvertently trigger the rule. Implement user-based exceptions for known and trusted personnel who require such access for their roles.
- Integration tools or CI/CD pipelines that interact with Kubernetes APIs using curl or wget for deployment or configuration tasks may cause false positives. Create exceptions for these tools by identifying their process names or execution environments.
- Security scanners or vulnerability assessment tools that probe Kubernetes API endpoints as part of their scanning routines can be mistaken for unauthorized access attempts. Whitelist these tools by their known signatures or execution patterns to prevent false alerts.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access to Kubernetes API endpoints.
- Revoke any potentially compromised credentials or tokens that may have been used in the unauthorized API requests.
- Conduct a thorough review of Kubernetes audit logs to identify the scope of the unauthorized access and determine if any sensitive data was exfiltrated.
- Reset and rotate all secrets and config maps that may have been accessed during the incident to ensure they are no longer valid.
- Implement network segmentation and access controls to restrict direct access to Kubernetes API endpoints, ensuring only authorized clients can communicate with the API.
- Escalate the incident to the security operations team for further investigation and to assess the need for additional security measures or incident response actions.
- Enhance monitoring and alerting for similar unauthorized access attempts by integrating additional threat intelligence and refining detection capabilities.
"""
risk_score = 47
rule_id = "b53f1d73-150d-484d-8f02-222abeb5d5fa"
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",
"Domain: Container",
"Domain: Kubernetes",
"OS: Linux",
"OS: macOS",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Discovery",
"Data Source: Sysmon",
"Data Source: Windows Security Event Logs",
"Data Source: Auditd Manager",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
"Data Source: Elastic Defend for Containers",
"Resources: Investigation Guide"
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and
event.action in ("exec", "exec_event", "start", "executed", "process_started", "ProcessRollup2") and
process.name : ("curl", "wget", "curl.exe", "wget.exe") and process.command_line like~ (
"*http*//*/apis/authorization.k8s.io/*",
"*http*//*/apis/rbac.authorization.k8s.io/*",
"*http*//*/api/v1/secrets*",
"*http*//*/api/v1/namespaces/*/secrets*",
"*http*//*/api/v1/configmaps*",
"*http*//*/api/v1/pods*",
"*http*//*/apis/apps/v1/deployments*"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"
[[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 = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: process
process where event.type == "start" and
event.action in ("exec", "exec_event", "start", "executed", "process_started", "ProcessRollup2") and
process.name : ("curl", "wget", "curl.exe", "wget.exe") and process.command_line like~ (
"*http*//*/apis/authorization.k8s.io/*",
"*http*//*/apis/rbac.authorization.k8s.io/*",
"*http*//*/api/v1/secrets*",
"*http*//*/api/v1/namespaces/*/secrets*",
"*http*//*/api/v1/configmaps*",
"*http*//*/api/v1/pods*",
"*http*//*/apis/apps/v1/deployments*"
)
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.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Multi-Layered Deobfuscation via Unusual Parent
#Detects multiple base64/xxd deobfuscation processes spawned by scripting interpreters within 5 seconds. This pattern indicates multi-layered payload decoding commonly used by malware and scripted attacks.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
Rule Body
[rule]
description = """
Detects multiple base64/xxd deobfuscation processes spawned by scripting interpreters within 5 seconds. This pattern
indicates multi-layered payload decoding commonly used by malware and scripted attacks.
"""
id = "0a9e507e-e2a7-4e35-8a7e-93a54dc167e3"
license = "Elastic License v2"
name = "Multi-Layered Deobfuscation via Unusual Parent"
os_list = ["macos"]
reference = ["https://x.com/MsftSecIntel/status/1891410993265123662"]
version = "1.0.10"
query = '''
sequence with maxspan=5s
[process where event.type == "start" and event.action == "exec" and (process.name in ("osascript", "bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.args_count <= 3 and
process.args in ("-c", "-e") and
process.args like "echo*" and
not process.Ext.effective_parent.executable like "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon"] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name in ("base64", "xxd")] by process.parent.entity_id
[process where event.type == "start" and event.action == "exec" and process.name in ("base64", "xxd")] by process.parent.entity_id
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "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.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and (process.name in ("osascript", "bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.args_count <= 3 and
process.args in ("-c", "-e") and
process.args like "echo*" and
not process.Ext.effective_parent.executable like "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon"] by process.entity_id
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.name in ("base64", "xxd")] by process.parent.entity_id
Stage 3: process
[process where event.type == "start" and event.action == "exec" and process.name in ("base64", "xxd")] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"echo*" |
process.args_count | le |
| field:"process.args_count" kind:le value:"3" |
process.name | in |
| field:"process_basename" kind:in |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"tclsh*" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | eq | /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon" |
Payload Execution by Web Server
#This rule detects when a web server executes a payload. Attackers may exploit RCE or file upload vulnerabilities to execute malicious payloads on web servers to gain/maintain access and to establish a command and control channel.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Persistence | |
| Lateral Movement | |
| Command & Control |
Rule Body
[rule]
description = """
This rule detects when a web server executes a payload. Attackers may exploit RCE or file upload vulnerabilities to
execute malicious payloads on web servers to gain/maintain access and to establish a command and control channel.
"""
id = "7d4b0dfc-d305-4761-94f4-ab2ed221b3ee"
license = "Elastic License v2"
name = "Payload Execution by Web Server"
os_list = ["linux"]
version = "1.0.11"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.interactive == false and (
process.parent.name in (
"nginx", "apache2", "httpd", "caddy", "mongrel_rails", "uwsgi", "daphne", "httpd.worker", "flask",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "lswsctrl", "varnishd", "uvicorn", "waitress-serve", "starman",
"frankenphp", "zabbix_server", "asterisk", "sw-engine-fpm"
) or
process.parent.name like ("php-fpm*", "gunicorn*", "*.cgi", "*.fcgi") or
(
process.parent.name like "ruby*" and
process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*") and
not process.parent.command_line == "sh -c /usr/bin/lsb_release -cidvr 2>/dev/null"
) or
(
process.parent.name like "python*" and
process.parent.command_line like~ (
"*hypercorn*", "*flask*", "*uvicorn*", "*django*", "*app.py*", "*server.py*", "*wsgi.py*", "*asgi.py*"
)
) or
(process.parent.name like "perl*" and process.parent.command_line like~ "*plackup*") or
(process.parent.name == "java" and process.parent.args like~ (
/* Tomcat */
"org.apache.catalina.startup.Bootstrap", "-Dcatalina.base=*",
/* Jetty */
"org.eclipse.jetty.start.Main", "-Djetty.home=*",
/* WildFly / JBoss */
"org.jboss.modules.Main", "-Djboss.home.dir=*",
/* WebLogic */
"weblogic.Server", "-Dweblogic.Name=*", "*weblogic-launcher.jar*",
/* WebSphere traditional + Liberty */
"com.ibm.ws.runtime.WsServer", "com.ibm.ws.kernel.boot.cmdline.Bootstrap",
/* GlassFish */
"com.sun.enterprise.glassfish.bootstrap.ASMain",
/* Resin */
"com.caucho.server.resin.Resin",
/* Spring Boot */
"org.springframework.boot.loader.*",
/* Quarkus */
"*quarkus-run.jar*", "io.quarkus.runner.GeneratedMain",
/* Micronaut */
"io.micronaut.runtime.Micronaut",
/* Dropwizard */
"io.dropwizard.cli.ServerCommand",
/* Play */
"play.core.server.ProdServerStart",
/* Helidon */
"io.helidon.microprofile.server.Main", "io.helidon.webserver*",
/* Vert.x */
"io.vertx.core.Launcher",
/* Keycloak */
"org.keycloak*",
/* Apereo CAS */
"org.apereo.cas*",
/* Elasticsearch */
"org.elasticsearch.bootstrap.Elasticsearch",
/* Atlassian / Gerrit */
"com.atlassian.jira.startup.Launcher", "*BitbucketServerLauncher*", "com.google.gerrit.pgm.Daemon",
/* Solr */
"*-Dsolr.solr.home=*",
/* Jenkins */
"*jenkins.war*"
)
)
) and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in ("-c", "-cl", "-lc") and (
process.command_line like~ (
/* Suspicious Paths */
"* /tmp/* ", "* /var/tmp/* ", "* /dev/shm/*", "* /run/*", "* /var/run/*",
/* Encoding, Decoding & Piping */
"*|sh", "*| sh *", "*| sh ", "*|bash*", "*| bash*", "*|zsh*", "*| zsh*", "*|dash*", "*| dash*",
"*|python*", "*| python*", "*|php*", "*| php*", "*|perl*", "*| perl*", "*|ruby*", "*| ruby*",
"*|node*", "*| node*", "*|lua*", "*| lua*", "*|busybox*", "*| busybox*", "*|*base64 -d*", "*|*base64 --decode*",
"*|*base64 --decode*", "*|*openssl base64 -d*", "*xxd *", "*| openssl*enc * -d *", "*b64decode -r*",
/* Interpreter Execution */
"*python -c*", "*python3 -c*", "*php -r*", "*perl -e*", "*ruby -e*", "*lua -e*", "*node -e *",
/* Reverse Shells */
"*netcat *", "* nc *", "*ncat *", "*/dev/tcp*", "*/dev/udp/*", "*socat *", "*openssl*s_client *", "*stty*raw*-echo*",
"*mkfifo /tmp/*",
/* File Access */
"*>*/etc/cron*", "*crontab*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*/etc/shadow*",
"*/etc/passwd*", "*/etc/master.passwd*",
/* Enumeration & Discovery */
"*/etc/hosts*", "*/etc/resolv.conf*", "*/etc/hostname*", "*/etc/issue*", "*/etc/os-release*", "*lsb_release*",
"*/proc/*/environ*", "*sudo -l*", "*/proc/*/cgroup*", "*dockerenv*", "*/proc/*/mountinfo*", "*printenv*",
"*cat*.env *", "*getcap*", "*capsh*", "*find / *", "*netstat *",
/* AWS Credentials */
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*.aws/credentials*", "*/.aws/config*",
/* Azure Credentials */
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*", "*/.azure/*",
"*/run/secrets/azure/*",
/* GCP Credentials */
"*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*",
"*client_email*", "*private_key_id*", "*/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*",
/* Misc. Cloud */
"*/.docker/config.json*", "*/.npmrc*", "*/secrets/kubernetes.io/serviceaccount/*",
/* Helpers */
"*timeout *sh -c *", "*env *sh *-c*", "*exec -a*",
/* Miscellaneous */
"*chattr *", "*busybox *", "*#!*", "*chmod +x *", "*chmod 777*", "*chpasswd*",
"*<?php*?>*", "*kworker*",
/* Decompression */
"*gzip -*d *", "*bzip2 -*d *", "*xz -*d *", "*tar -*x*",
/* Path Traversal */
"*../../../*etc/*", "*/.../*", "*../../../*home/*/*", "*../../../*root/*",
/* File Upload/Download */
"*pastebin.com*", "*transfer.sh*", "*bashupload.com*"
) or
process.args in ("id", "whoami", "hostname")
) and
not (
(
process.parent.name == "nginx" and
(
process.args like ("chmod 777 /etc/resty-*", "resty*") or
process.command_line like ("sh -c*/tmp/lua_* 2> /tmp/lua_*", "sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_*")
)
) or
(
process.parent.name == "apache2" and (
process.command_line in (
"sh -c /usr/local/bin/php -r 'echo phpversion();'", "sh -c -- /usr/local/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/lsb_release -a 2>/dev/null",
"sh -c /usr/bin/crontab -l;",
"sh -c -- whoami",
"sh -c /usr/bin/crontab -l 2>/dev/null",
"sh -c /usr/bin/crontab -",
"sh -c lsb_release --all </dev/null 2>/dev/null",
"sh -c /usr/bin/lsb_release -ds | cut -d= -f2 | tr -d '\"'"
) or
process.args like (
"""bash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*""",
"chmod 777 /etc/cobra/uploads/mysql*", "stat*"
) or
process.command_line like (
"*/usr/bin/crontab*phpupdatecrontab.txt", "*mysqldump*/var/www/html/*/writable/uploads/backup/mysql*",
"sh -c chmod 777 -R /opt/data/www/php_upload/*/temp", "sh -c chmod 777 -R /opt/data/www/php_upload/*/sync/*"
)
)
) or
(
process.parent.name like "php-fpm*" and (
process.command_line in (
"sh -c /usr/bin/php -r 'echo phpversion();'", "sh -c -- /usr/bin/php -r 'echo phpversion();'",
"sh -c php -r 'print_r(phpversion());'", "sh -c chattr -i -a /usr/local/virtualizor/license2.php",
"sh -c -- netstat -ie 2>&1",
"sh -c hostname",
"sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKE",
"sh -c netstat -ie 2>&1",
"sh -c php -r \"echo date('T');\"",
"sh -c php -r \"echo PHP_VERSION;\"",
"sh -c -- php -r \"echo (int)function_exists('pcntl_signal');\"",
"sh -c -- php -r \"echo PHP_VERSION;\"",
"sh -c -- php -r \"echo date('T');\"",
"sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.command_line like (
"*var_export*extension_loaded*", "*/tmp/tmp_resize*", "*/v1/objects/hosts/*_Infoterminal*", "*python -m json.tool*",
"sh -c timeout 3600 ssh -o ControlMaster=auto -o ControlPath=/var/www/html/storage/app/ssh/mux/*",
"sh -c -- chmod 777 *.XML", "sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.args like ("ps*|*grep*", "ffmpeg*", "chmod*777*.xml")
)
) or
(
process.parent.name == "php-cgi" and (
process.command_line like (
"sh -c nohup php /home/*/public_html/lockindex.php index.php >/dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-content/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-includes/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/*/wp-content/* >> /dev/null 2>&1 &",
"*-ef|grep*",
"sh -c /usr/bin/php -r 'echo phpversion();'"
) or
process.args like "ps*| grep*"
)
) or
(
process.parent.name == "java" and process.command_line == "/usr/bin/env sh -c ldd /usr/bin/env | grep -q musl"
) or
(
process.command_line == "/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" and
process.parent.name == "gunicorn"
) or
(
process.parent.executable == "/usr/local/bin/gunicorn" and
process.command_line == "/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
) or
(
process.parent.executable like "/home/rails/.rbenv/versions/*/bin/ruby" and
process.command_line == "sh -c crontab -l 2> /dev/null"
) or
(
process.parent.executable == "/opt/bitnami/apache/bin/httpd" and
process.command_line == "sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm" and
process.command_line == "sh -c /usr/local/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi" and
process.command_line == "/bin/sh -c { touch /run/uwsgi-logrotate }"
) or
(process.parent.executable == "/var/www/cgi-bin/vtsystem.cgi" and process.command_line == "sh -c hostname") or
(process.parent.name like "python*" and process.parent.command_line like "*hive_server.py*") or
(process.parent.name == "sw-engine-fpm" and process.command_line like ("*/opt/psa/admin/bin/*", "*/usr/local/psa/admin/*")) or
(
process.parent.name == "httpd" and
process.command_line like (
"*/datastore/htdocs/control-states/compass*", "*/dev/shm/netmon-log*", "sh -c /usr/bin/crontab -l 2>/dev/null",
"sh -c /usr/bin/crontab -"
)
) or
(process.parent.name == "asterisk" and process.args like "/bin/chmod 777 */gravacoes/*.WAV") or
(process.parent.name == "varnishd" and process.args like "exec gcc*") or
(process.parent.name in ("apache2", "php-cgi") and process.command_line in ("sh -c crontab -l", "sh -c -- crontab -l")) or
(process.parent.name in ("php-fpm", "httpd") and process.command_line in (
"sh -c whoami", "sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c TERM=dumb cat /var/run/elasticsearch/elasticsearch.pid", "sh -c TERM=dumb cat /var/run/logstash/logstash.pid"
)) or
(process.parent.name == "zabbix_server" and process.command_line like "*/usr/sbin/sendmail*") or
(process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and process.command_line like "*morpheus-local*") or
(
process.parent.name == "ruby" and
process.command_line in (
"sh -c cat /etc/hostname 2>/dev/null",
"sh -c echo \"^d\" | openssl s_client -connect 127.0.0.1:443 2>&1",
"sh -c cat /etc/hosts.allow 2>/dev/null"
)
) or
(process.parent.name == "java" and process.args like "chmod 777 *.csv") or
process.command_line == "sh -c node -v || nodejs -v" or
process.working_directory == "/var/lib/puppet/rack/puppetmasterd" or
(process.working_directory == "/olympe" and process.parent.executable == "/usr/local/bin/ruby" and process.command_line == "sh -c ssh-keygen -f ~/.ssh/id_ed25519 -y") or
(process.parent.name like "python*" and process.parent.args == "/root/.local/share/uv/tools/mini-swe-agent/bin/python") or
(process.parent.executable == "/usr/sbin/zabbix_server" and process.command_line like "*/usr/lib/zabbix/alertscripts/sms_gw*")
)
'''
min_endpoint_version = "8.2.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1190"
name = "Exploit Public-Facing Application"
reference = "https://attack.mitre.org/techniques/T1190/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1210"
name = "Exploitation of Remote Services"
reference = "https://attack.mitre.org/techniques/T1210/"
[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
[[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.2.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.interactive == false and (
process.parent.name in (
"nginx", "apache2", "httpd", "caddy", "mongrel_rails", "uwsgi", "daphne", "httpd.worker", "flask",
"php-cgi", "php-fcgi", "php-cgi.cagefs", "lswsctrl", "varnishd", "uvicorn", "waitress-serve", "starman",
"frankenphp", "zabbix_server", "asterisk", "sw-engine-fpm"
) or
process.parent.name like ("php-fpm*", "gunicorn*", "*.cgi", "*.fcgi") or
(
process.parent.name like "ruby*" and
process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*") and
not process.parent.command_line == "sh -c /usr/bin/lsb_release -cidvr 2>/dev/null"
) or
(
process.parent.name like "python*" and
process.parent.command_line like~ (
"*hypercorn*", "*flask*", "*uvicorn*", "*django*", "*app.py*", "*server.py*", "*wsgi.py*", "*asgi.py*"
)
) or
(process.parent.name like "perl*" and process.parent.command_line like~ "*plackup*") or
(process.parent.name == "java" and process.parent.args like~ (
"org.apache.catalina.startup.Bootstrap", "-Dcatalina.base=*",
"org.eclipse.jetty.start.Main", "-Djetty.home=*",
"org.jboss.modules.Main", "-Djboss.home.dir=*",
"weblogic.Server", "-Dweblogic.Name=*", "*weblogic-launcher.jar*",
"com.ibm.ws.runtime.WsServer", "com.ibm.ws.kernel.boot.cmdline.Bootstrap",
"com.sun.enterprise.glassfish.bootstrap.ASMain",
"com.caucho.server.resin.Resin",
"org.springframework.boot.loader.*",
"*quarkus-run.jar*", "io.quarkus.runner.GeneratedMain",
"io.micronaut.runtime.Micronaut",
"io.dropwizard.cli.ServerCommand",
"play.core.server.ProdServerStart",
"io.helidon.microprofile.server.Main", "io.helidon.webserver*",
"io.vertx.core.Launcher",
"org.keycloak*",
"org.apereo.cas*",
"org.elasticsearch.bootstrap.Elasticsearch",
"com.atlassian.jira.startup.Launcher", "*BitbucketServerLauncher*", "com.google.gerrit.pgm.Daemon",
"*-Dsolr.solr.home=*",
"*jenkins.war*"
)
)
) and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
process.args in ("-c", "-cl", "-lc") and (
process.command_line like~ (
"* /tmp/* ", "* /var/tmp/* ", "* /dev/shm/*", "* /run/*", "* /var/run/*",
"*|sh", "*| sh *", "*| sh ", "*|bash*", "*| bash*", "*|zsh*", "*| zsh*", "*|dash*", "*| dash*",
"*|python*", "*| python*", "*|php*", "*| php*", "*|perl*", "*| perl*", "*|ruby*", "*| ruby*",
"*|node*", "*| node*", "*|lua*", "*| lua*", "*|busybox*", "*| busybox*", "*|*base64 -d*", "*|*base64 --decode*",
"*|*base64 --decode*", "*|*openssl base64 -d*", "*xxd *", "*| openssl*enc * -d *", "*b64decode -r*",
"*python -c*", "*python3 -c*", "*php -r*", "*perl -e*", "*ruby -e*", "*lua -e*", "*node -e *",
"*netcat *", "* nc *", "*ncat *", "*/dev/tcp*", "*/dev/udp/*", "*socat *", "*openssl*s_client *", "*stty*raw*-echo*",
"*mkfifo /tmp/*",
"*>*/etc/cron*", "*crontab*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*", "*~/.ssh/*", "*/etc/shadow*",
"*/etc/passwd*", "*/etc/master.passwd*",
"*/etc/hosts*", "*/etc/resolv.conf*", "*/etc/hostname*", "*/etc/issue*", "*/etc/os-release*", "*lsb_release*",
"*/proc/*/environ*", "*sudo -l*", "*/proc/*/cgroup*", "*dockerenv*", "*/proc/*/mountinfo*", "*printenv*",
"*cat*.env *", "*getcap*", "*capsh*", "*find / *", "*netstat *",
"*aws_access_key_id*", "*aws_secret_access_key*", "*aws_session_token*", "*accesskeyid*", "*secretaccesskey*",
"*.aws/credentials*", "*/.aws/config*",
"*AZURE_CLIENT_ID*", "*AZURE_TENANT_ID*", "*AZURE_CLIENT_SECRET*", "*AZURE_FEDERATED_TOKEN_FILE*",
"*IDENTITY_ENDPOINT*", "*IDENTITY_HEADER*", "*MSI_ENDPOINT*", "*MSI_SECRET*", "*/.azure/*",
"*/run/secrets/azure/*",
"*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*",
"*client_email*", "*private_key_id*", "*/run/secrets/google/*", "*GOOGLE_APPLICATION_CREDENTIALS*",
"*/.docker/config.json*", "*/.npmrc*", "*/secrets/kubernetes.io/serviceaccount/*",
"*timeout *sh -c *", "*env *sh *-c*", "*exec -a*",
"*chattr *", "*busybox *", "*#!*", "*chmod +x *", "*chmod 777*", "*chpasswd*",
"*<?php*?>*", "*kworker*",
"*gzip -*d *", "*bzip2 -*d *", "*xz -*d *", "*tar -*x*",
"*../../../*etc/*", "*/.../*", "*../../../*home/*/*", "*../../../*root/*",
"*pastebin.com*", "*transfer.sh*", "*bashupload.com*"
) or
process.args in ("id", "whoami", "hostname")
) and
not (
(
process.parent.name == "nginx" and
(
process.args like ("chmod 777 /etc/resty-*", "resty*") or
process.command_line like ("sh -c*/tmp/lua_* 2> /tmp/lua_*", "sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_*")
)
) or
(
process.parent.name == "apache2" and (
process.command_line in (
"sh -c /usr/local/bin/php -r 'echo phpversion();'", "sh -c -- /usr/local/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c /usr/bin/lsb_release -a 2>/dev/null",
"sh -c /usr/bin/crontab -l;",
"sh -c -- whoami",
"sh -c /usr/bin/crontab -l 2>/dev/null",
"sh -c /usr/bin/crontab -",
"sh -c lsb_release --all </dev/null 2>/dev/null",
"sh -c /usr/bin/lsb_release -ds | cut -d= -f2 | tr -d '\"'"
) or
process.args like (
"""bash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*""",
"chmod 777 /etc/cobra/uploads/mysql*", "stat*"
) or
process.command_line like (
"*/usr/bin/crontab*phpupdatecrontab.txt", "*mysqldump*/var/www/html/*/writable/uploads/backup/mysql*",
"sh -c chmod 777 -R /opt/data/www/php_uploadsync/*"
)
)
) or
(
process.parent.name like "php-fpm*" and (
process.command_line in (
"sh -c /usr/bin/php -r 'echo phpversion();'", "sh -c -- /usr/bin/php -r 'echo phpversion();'",
"sh -c php -r 'print_r(phpversion());'", "sh -c chattr -i -a /usr/local/virtualizor/license2.php",
"sh -c -- netstat -ie 2>&1",
"sh -c hostname",
"sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKE",
"sh -c netstat -ie 2>&1",
"sh -c php -r \"echo date('T');\"",
"sh -c php -r \"echo PHP_VERSION;\"",
"sh -c -- php -r \"echo (int)function_exists('pcntl_signal');\"",
"sh -c -- php -r \"echo PHP_VERSION;\"",
"sh -c -- php -r \"echo date('T');\"",
"sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.command_line like (
"*var_export*extension_loaded*", "*/tmp/tmp_resize*", "*/v1/objects/hosts/*_Infoterminal*", "*python -m json.tool*",
"sh -c timeout 3600 ssh -o ControlMaster=auto -o ControlPath=/var/www/html/storage/app/ssh/mux/*",
"sh -c -- chmod 777 *.XML", "sh -c /usr/bin/lsb_release -a 2>/dev/null"
) or
process.args like ("ps*|*grep*", "ffmpeg*", "chmod*777*.xml")
)
) or
(
process.parent.name == "php-cgi" and (
process.command_line like (
"sh -c nohup php /home/*/public_html/lockindex.php index.php >/dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-content/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/wp-includes/* >> /dev/null 2>&1 &",
"sh -c nohup php /home/*/public_html/*/wp-content/* >> /dev/null 2>&1 &",
"*-ef|grep*",
"sh -c /usr/bin/php -r 'echo phpversion();'"
) or
process.args like "ps*| grep*"
)
) or
(
process.parent.name == "java" and process.command_line == "/usr/bin/env sh -c ldd /usr/bin/env | grep -q musl"
) or
(
process.command_line == "/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" and
process.parent.name == "gunicorn"
) or
(
process.parent.executable == "/usr/local/bin/gunicorn" and
process.command_line == "/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate"
) or
(
process.parent.executable like "/home/rails/.rbenv/versions/*/bin/ruby" and
process.command_line == "sh -c crontab -l 2> /dev/null"
) or
(
process.parent.executable == "/opt/bitnami/apache/bin/httpd" and
process.command_line == "sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm" and
process.command_line == "sh -c /usr/local/bin/php -r 'echo phpversion();'"
) or
(
process.parent.executable like "/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi" and
process.command_line == "/bin/sh -c { touch /run/uwsgi-logrotate }"
) or
(process.parent.executable == "/var/www/cgi-bin/vtsystem.cgi" and process.command_line == "sh -c hostname") or
(process.parent.name like "python*" and process.parent.command_line like "*hive_server.py*") or
(process.parent.name == "sw-engine-fpm" and process.command_line like ("*/opt/psa/admin/bin/*", "*/usr/local/psa/admin/*")) or
(
process.parent.name == "httpd" and
process.command_line like (
"*/datastore/htdocs/control-states/compass*", "*/dev/shm/netmon-log*", "sh -c /usr/bin/crontab -l 2>/dev/null",
"sh -c /usr/bin/crontab -"
)
) or
(process.parent.name == "asterisk" and process.args like "/bin/chmod 777 */gravacoes/*.WAV") or
(process.parent.name == "varnishd" and process.args like "exec gcc*") or
(process.parent.name in ("apache2", "php-cgi") and process.command_line in ("sh -c crontab -l", "sh -c -- crontab -l")) or
(process.parent.name in ("php-fpm", "httpd") and process.command_line in (
"sh -c whoami", "sh -c /usr/bin/php -r 'echo phpversion();'",
"sh -c TERM=dumb cat /var/run/elasticsearch/elasticsearch.pid", "sh -c TERM=dumb cat /var/run/logstash/logstash.pid"
)) or
(process.parent.name == "zabbix_server" and process.command_line like "*/usr/sbin/sendmail*") or
(process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and process.command_line like "*morpheus-local*") or
(
process.parent.name == "ruby" and
process.command_line in (
"sh -c cat /etc/hostname 2>/dev/null",
"sh -c echo \"^d\" | openssl s_client -connect 127.0.0.1:443 2>&1",
"sh -c cat /etc/hosts.allow 2>/dev/null"
)
) or
(process.parent.name == "java" and process.args like "chmod 777 *.csv") or
process.command_line == "sh -c node -v || nodejs -v" or
process.working_directory == "/var/lib/puppet/rack/puppetmasterd" or
(process.working_directory == "/olympe" and process.parent.executable == "/usr/local/bin/ruby" and process.command_line == "sh -c ssh-keygen -f ~/.ssh/id_ed25519 -y") or
(process.parent.name like "python*" and process.parent.args == "/root/.local/share/uv/tools/mini-swe-agent/bin/python") or
(process.parent.executable == "/usr/sbin/zabbix_server" and process.command_line like "*/usr/lib/zabbix/alertscripts/sms_gw*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
process.parent.args | wildcard |
| field:"process.parent.args" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.interactive | eq |
| field:"process.parent.interactive" kind:eq value:"false" |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"java" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | starts_with | chmod 777 /etc/resty-, resty | excludes:process.args field:"process.args" value:"chmod 777 /etc/resty-" field:"process.args" value:"resty" |
process.command_line | wildcard | sh -c*/tmp/lua_* 2> /tmp/lua_*, sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_* | excludes:process.command_line field:"process.command_line" value:"sh -c*/tmp/lua_* 2> /tmp/lua_*" field:"process.command_line" value:"sh -c gcc -print-multiarch 2>/dev/null > /tmp/lua_*" |
process.parent.name | eq | nginx | excludes:process.parent.name field:"process.parent.name" value:"nginx" |
process.args | wildcard | bash -c "( /home/*/apps/richdocumentscode/collabora/Collabora_Online.AppImage*, chmod 777 /etc/cobra/uploads/mysql*, stat* | excludes:process.args |
process.command_line | in | sh -c -- /usr/local/bin/php -r 'echo phpversion();', sh -c -- whoami, sh -c /usr/bin/crontab -, sh -c /usr/bin/crontab -l 2>/dev/null, sh -c /usr/bin/crontab -l;, sh -c /usr/bin/lsb_release -a 2>/dev/null, sh -c /usr/bin/lsb_release -ds | cut -d= -f2 | tr -d '"', sh -c /usr/bin/php -r 'echo phpversion();', sh -c /usr/local/bin/php -r 'echo phpversion();', sh -c lsb_release --all </dev/null 2>/dev/null | excludes:process.command_line |
process.command_line | wildcard | */usr/bin/crontab*phpupdatecrontab.txt, *mysqldump*/var/www/html/*/writable/uploads/backup/mysql*, sh -c chmod 777 -R /opt/data/www/php_upload/*/temp, sh -c chmod 777 -R /opt/data/www/php_upload/*/sync/* | excludes:process.command_line |
process.parent.name | eq | apache2 | excludes:process.parent.name field:"process.parent.name" value:"apache2" |
process.args | wildcard | ps*| grep* | excludes:process.args field:"process.args" value:"ps*| grep*" |
process.command_line | wildcard | sh -c nohup php /home/*/public_html/lockindex.php index.php >/dev/null 2>&1 &, sh -c nohup php /home/*/public_html/wp-content/* >> /dev/null 2>&1 &, sh -c nohup php /home/*/public_html/wp-includes/* >> /dev/null 2>&1 &, sh -c nohup php /home/*/public_html/*/wp-content/* >> /dev/null 2>&1 &, *-ef|grep*, sh -c /usr/bin/php -r 'echo phpversion();' | excludes:process.command_line |
process.parent.name | eq | php-cgi | excludes:process.parent.name field:"process.parent.name" value:"php-cgi" |
process.args | wildcard | ps*|*grep*, ffmpeg*, chmod*777*.xml | excludes:process.args field:"process.args" value:"ps*|*grep*" field:"process.args" value:"ffmpeg*" field:"process.args" value:"chmod*777*.xml" |
process.command_line | in | sh -c -- /usr/bin/php -r 'echo phpversion();', sh -c -- netstat -ie 2>&1, sh -c -- php -r "echo (int)function_exists('pcntl_signal');", sh -c -- php -r "echo PHP_VERSION;", sh -c -- php -r "echo date('T');", sh -c /usr/bin/lsb_release -a 2>/dev/null, sh -c /usr/bin/php -r 'echo phpversion();', sh -c chattr -i -a /usr/local/virtualizor/license2.php, sh -c hostname, sh -c netstat -ie 2>&1, sh -c php -r "echo PHP_VERSION;", sh -c php -r "echo date('T');", sh -c php -r 'print_r(phpversion());', sh -c source /etc/os-release 2>/dev/null && echo $ID $ID_LIKE | excludes:process.command_line |
process.command_line | wildcard | *var_export*extension_loaded*, */tmp/tmp_resize*, */v1/objects/hosts/*_Infoterminal*, *python -m json.tool*, sh -c timeout 3600 ssh -o ControlMaster=auto -o ControlPath=/var/www/html/storage/app/ssh/mux/*, sh -c -- chmod 777 *.XML, sh -c /usr/bin/lsb_release -a 2>/dev/null | excludes:process.command_line |
process.parent.name | starts_with | php-fpm | excludes:process.parent.name field:"process.parent.name" value:"php-fpm" |
process.args | starts_with | exec gcc | excludes:process.args field:"process.args" value:"exec gcc" |
process.parent.name | eq | varnishd | excludes:process.parent.name field:"process.parent.name" value:"varnishd" |
process.args | wildcard | /bin/chmod 777 */gravacoes/*.WAV | excludes:process.args field:"process.args" value:"/bin/chmod 777 */gravacoes/*.WAV" |
process.parent.name | eq | asterisk | excludes:process.parent.name field:"process.parent.name" value:"asterisk" |
process.args | wildcard | chmod 777 *.csv | excludes:process.args field:"process.args" value:"chmod 777 *.csv" |
process.parent.name | eq | java | excludes:process.parent.name field:"process.parent.name" value:"java" |
process.command_line | eq | /bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate | excludes:process.command_line field:"process.command_line" value:"/bin/sh -c echo 'Q' | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" |
process.parent.executable | eq | /usr/local/bin/gunicorn | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/local/bin/gunicorn" |
process.command_line | eq | /bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate | excludes:process.command_line field:"process.command_line" value:"/bin/sh -c echo | openssl s_client -connect localhost:61617 2>/dev/null | openssl x509 -noout -enddate" |
process.parent.name | eq | gunicorn | excludes:process.parent.name field:"process.parent.name" value:"gunicorn" |
process.command_line | eq | /bin/sh -c { touch /run/uwsgi-logrotate } | excludes:process.command_line field:"process.command_line" value:"/bin/sh -c { touch /run/uwsgi-logrotate }" |
process.parent.executable | wildcard | /var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi | excludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/docker/overlay2/*/merged/usr/sbin/uwsgi" |
process.command_line | eq | /usr/bin/env sh -c ldd /usr/bin/env | grep -q musl | excludes:process.command_line field:"process.command_line" value:"/usr/bin/env sh -c ldd /usr/bin/env | grep -q musl" |
process.command_line | eq | sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();' | excludes:process.command_line field:"process.command_line" value:"sh -c /opt/bitnami/php/bin/php -r 'echo phpversion();'" |
process.parent.executable | eq | /opt/bitnami/apache/bin/httpd | excludes:process.parent.executable field:"process.parent.executable" value:"/opt/bitnami/apache/bin/httpd" |
process.command_line | eq | sh -c /usr/local/bin/php -r 'echo phpversion();' | excludes:process.command_line field:"process.command_line" value:"sh -c /usr/local/bin/php -r 'echo phpversion();'" |
process.parent.executable | wildcard | /var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm | excludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/containers/storage/overlay/*/merged/usr/local/sbin/php-fpm" |
process.command_line | eq | sh -c crontab -l 2> /dev/null | excludes:process.command_line field:"process.command_line" value:"sh -c crontab -l 2> /dev/null" |
process.parent.executable | wildcard | /home/rails/.rbenv/versions/*/bin/ruby | excludes:process.parent.executable field:"process.parent.executable" value:"/home/rails/.rbenv/versions/*/bin/ruby" |
process.command_line | eq | sh -c hostname | excludes:process.command_line field:"process.command_line" value:"sh -c hostname" |
process.parent.executable | eq | /var/www/cgi-bin/vtsystem.cgi | excludes:process.parent.executable field:"process.parent.executable" value:"/var/www/cgi-bin/vtsystem.cgi" |
process.command_line | eq | sh -c ssh-keygen -f ~/.ssh/id_ed25519 -y | excludes:process.command_line field:"process.command_line" value:"sh -c ssh-keygen -f ~/.ssh/id_ed25519 -y" |
process.parent.executable | eq | /usr/local/bin/ruby | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/local/bin/ruby" |
process.working_directory | eq | /olympe | excludes:process.working_directory field:"process.working_directory" value:"/olympe" |
process.command_line | in | sh -c -- crontab -l, sh -c crontab -l | excludes:process.command_line field:"process.command_line" value:"sh -c -- crontab -l" field:"process.command_line" value:"sh -c crontab -l" |
process.parent.name | in | apache2, php-cgi | excludes:process.parent.name field:"process.parent.name" value:"apache2" field:"process.parent.name" value:"php-cgi" |
process.command_line | in | sh -c /usr/bin/php -r 'echo phpversion();', sh -c TERM=dumb cat /var/run/elasticsearch/elasticsearch.pid, sh -c TERM=dumb cat /var/run/logstash/logstash.pid, sh -c whoami | excludes:process.command_line |
process.parent.name | in | httpd, php-fpm | excludes:process.parent.name field:"process.parent.name" value:"httpd" field:"process.parent.name" value:"php-fpm" |
process.command_line | in | sh -c cat /etc/hostname 2>/dev/null, sh -c cat /etc/hosts.allow 2>/dev/null, sh -c echo "^d" | openssl s_client -connect 127.0.0.1:443 2>&1 | excludes:process.command_line |
process.parent.name | eq | ruby | excludes:process.parent.name field:"process.parent.name" value:"ruby" |
process.command_line | match | /opt/psa/admin/bin/, /usr/local/psa/admin/ | excludes:process.command_line field:"process.command_line" value:"/opt/psa/admin/bin/" field:"process.command_line" value:"/usr/local/psa/admin/" |
process.parent.name | eq | sw-engine-fpm | excludes:process.parent.name field:"process.parent.name" value:"sw-engine-fpm" |
process.command_line | match | /usr/lib/zabbix/alertscripts/sms_gw | excludes:process.command_line field:"process.command_line" value:"/usr/lib/zabbix/alertscripts/sms_gw" |
process.parent.executable | eq | /usr/sbin/zabbix_server | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/sbin/zabbix_server" |
process.command_line | match | /usr/sbin/sendmail | excludes:process.command_line field:"process.command_line" value:"/usr/sbin/sendmail" |
process.parent.name | eq | zabbix_server | excludes:process.parent.name field:"process.parent.name" value:"zabbix_server" |
process.command_line | match | morpheus-local | excludes:process.command_line field:"process.command_line" value:"morpheus-local" |
process.parent.executable | eq | /opt/morpheus/embedded/java/jre/bin/java | excludes:process.parent.executable field:"process.parent.executable" value:"/opt/morpheus/embedded/java/jre/bin/java" |
process.command_line | wildcard | */datastore/htdocs/control-states/compass*, */dev/shm/netmon-log*, sh -c /usr/bin/crontab -l 2>/dev/null, sh -c /usr/bin/crontab - | excludes:process.command_line |
process.parent.name | eq | httpd | excludes:process.parent.name field:"process.parent.name" value:"httpd" |
process.parent.args | eq | /root/.local/share/uv/tools/mini-swe-agent/bin/python | excludes:process.parent.args field:"process.parent.args" value:"/root/.local/share/uv/tools/mini-swe-agent/bin/python" |
process.parent.name | starts_with | python | excludes:process.parent.name field:"process.parent.name" value:"python" |
process.parent.command_line | match | hive_server.py | excludes:process.parent.command_line field:"process.parent.command_line" value:"hive_server.py" |
process.command_line | eq | sh -c node -v || nodejs -v | excludes:process.command_line field:"process.command_line" value:"sh -c node -v || nodejs -v" |
process.working_directory | eq | /var/lib/puppet/rack/puppetmasterd | excludes:process.working_directory field:"process.working_directory" value:"/var/lib/puppet/rack/puppetmasterd" |
Potential Antimalware Scan Interface Bypass via PowerShell
#Detects PowerShell scripts that reference Antimalware Scan Interface (AMSI) bypass classes, methods, or known bypass strings. Attackers attempt AMSI bypass to disable scanning and run malicious PowerShell content undetected.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth | |
| Defense Impairment |
Rule Body
[metadata]
creation_date = "2023/01/17"
integration = ["windows"]
maturity = "production"
updated_date = "2026/04/27"
[rule]
author = ["Elastic"]
description = """
Detects PowerShell scripts that reference Antimalware Scan Interface (AMSI) bypass classes, methods, or known bypass
strings. Attackers attempt AMSI bypass to disable scanning and run malicious PowerShell content undetected.
"""
from = "now-9m"
index = ["logs-windows.powershell*", "winlogbeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "Potential Antimalware Scan Interface Bypass via PowerShell"
references = ["https://github.com/S3cur3Th1sSh1t/Amsi-Bypass-Powershell"]
risk_score = 73
rule_id = "1f0a69c0-3392-4adf-b7d5-6012fd292da8"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: PowerShell Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.category:"process" and host.os.type:windows and
(
powershell.file.script_block_text : (
"System.Management.Automation.AmsiUtils" or
amsiInitFailed or
"Invoke-AmsiBypass" or
"Bypass.AMSI" or
"amsi.dll" or
AntimalwareProvider or
amsiSession or
amsiContext or
AmsiInitialize or
unloadobfuscated or
unloadsilent or
AmsiX64 or
AmsiX32 or
FindAmsiFun or
"AllocHGlobal((9076" or
"[cHAr](65)+[cHaR]([byTe]0x6d)+[ChaR]([ByTe]0x73)+[CHaR]([BYte]0x69"
) or
powershell.file.script_block_text:("[Ref].Assembly.GetType(('System.Management.Automation" and ".SetValue(") or
powershell.file.script_block_text:("::AllocHGlobal((" and ".SetValue(" and "-replace" and ".NoRMALiZe(")
) and
not powershell.file.script_block_text : (
"sentinelbreakpoints" and "Set-PSBreakpoint"
)
'''
note = """## Triage and analysis
### Investigating Potential Antimalware Scan Interface Bypass via PowerShell
#### Possible investigation steps
- Does the preserved script block show active AMSI bypass behavior or reference-only content?
- Focus: `powershell.file.script_block_text`, source in `file.path` or `file.name`, and whether bypass helpers execute or are only mentioned.
- Hint: treat AmsiUtils, amsiInitFailed, AmsiScanBuffer/AmsiOpenSession patching, ScriptBlockAst smuggling, VirtualProtect/Marshal.Copy, and logging suppression as active-behavior anchors.
- Implication: escalate when content flips AMSI state, patches scan routines, smuggles script blocks, or invokes decoded content; lower suspicion only for inert research text or bounded training with no execution path.
- Does reconstruction add payload execution, download logic, or extra evasion?
- Why: Script Block Logging can split helper functions, decoded strings, and later stages across multiple fragments.
- Focus: reconstruct fragments scoped by `host.id` and `powershell.file.script_block_id`; order with `powershell.sequence`, confirm `powershell.total`, then read `powershell.file.script_block_text`. $investigate_2
- Hint: review surrounding 4104 blocks for the same `host.id` and `process.pid` with different `powershell.file.script_block_id`; keep timestamp comparison tight to avoid PID reuse. $investigate_3
- Hint: if fragments are missing, score visible bypass logic and record the missing sequence range as unresolved, not benign.
- Implication: escalate when reconstruction adds download, decode, in-memory execution, credential access, persistence, Disable Script Logging, or unloadobfuscated/unloadsilent evasion; lower suspicion only when complete fragments remain bounded to authorized lab or training content.
- Can endpoint process telemetry recover how PowerShell was launched?
- Focus: if available, recover the process via `host.id` and `process.pid` before interpreting `process.*` or `process.parent.*`; read `process.command_line`, `process.parent.command_line`, and `process.Ext.session_info.logon_type`, expanding the window if PowerShell started earlier. $investigate_4
- Implication: escalate for encoded commands, PowerShell v2 downgrade, Office/browser parents, remote-administration launchers, or service/network logon that does not fit the user; missing endpoint telemetry leaves launch context unresolved, not benign.
- Do the user, host, and source context fit an authorized test workflow?
- Focus: `user.id`, `host.id`, `host.name`, preserved `file.path` or `file.name`, and recovered launch context.
- Hint: if no source path is preserved, treat the block as interactive, pasted, in-memory, or remotely delivered and require stronger corroboration before benign closure.
- Implication: escalate when standard-user, shared-workstation, production-server, user-writable-source, or fileless-delivery context cannot be tied to one authorized lab, red-team, detection-engineering, or training case; lower suspicion only when all context supports that exact workflow.
- If local evidence remains suspicious or unresolved, does the pattern recur for the same user or host?
- Focus: last-48h related alerts for the same `user.id`, looking for repeated AMSI bypass, delivery, credential access, persistence, or defense evasion. $investigate_0
- Hint: check the same `host.id` before expanding beyond the affected host or user. $investigate_1
- Implication: broaden scope when related alerts show repeated evasion or follow-on abuse; quiet pivots lower scope only and never close active bypass without local evidence proving one exact authorized workflow.
- Escalate on active bypass logic, suspicious provenance, launch abuse, operational follow-on evidence, or partial/mixed visibility; close only when script content, reconstruction, launch, source, and related-alert evidence bind activity to one exact authorized lab, training, or red-team workflow; preserve artifacts and escalate when outside confirmation is needed.
### False positive analysis
- Authorized detection-engineering, red-team, malware-analysis, training, or reference-only course/research use can trigger this rule. Confirm that `powershell.file.script_block_text`, reconstruction, `user.id`, `host.id`, source/session context, and recovered launch context all stay inside the same test case and add no second stage. If records are unavailable, recurrence supports assessment only when the same telemetry pattern proves the exact exercise; do not close on recurrence alone.
- Before creating an exception, validate that the same `user.id`, `host.id`, stable source path, launch context, and reconstructed fragment pattern recur across prior alerts from this rule. Build the exception from that confirmed workflow pattern. Avoid exceptions on AMSI strings alone, on `user.name` alone, or on a host alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and document which evidence proved the authorized workflow: script content, reconstruction, `user.id`, `host.id`, preserved source path, and recovered launch context. Create an exception only if the same workflow pattern recurs and the telemetry still proves the exact exercise.
- If suspicious but unconfirmed, preserve the script block content, fragment IDs and sequence numbers, `process.pid`, recovered launch details, script-named URLs or paths, source files, and related-alert exports before containment. Apply reversible containment first, such as tighter monitoring on the affected `host.id` or `user.id`, temporary restrictions for script-named URLs, or suspend-process actions when the host role can tolerate them. Escalate to isolation only if reconstructed content or recovered launch evidence confirms operational follow-on activity.
- If confirmed malicious, contain the host or account based on the script content, recovered launch chain, source path, script-named indicators, or related-alert evidence that established unauthorized operational use. Record the recovered PowerShell process details, parent chain, script content, downstream commands, and affected `user.id` / `host.id` before terminating processes, deleting files, or purging sessions.
- Block confirmed malicious script-named URLs or hashes, collect referenced source files, and eradicate only the unauthorized scripts, payloads, startup artifacts, scheduled tasks, and security-control changes expressed in reconstruction or recovered launch context.
- Before destructive cleanup, review related hosts and users for the same script fragments, launch chain, downgrade pattern, script-named indicators, or already-running PowerShell reuse so scope is understood before evidence is removed.
- After the incident, retain Script Block Logging plus required endpoint process telemetry, and document PowerShell version 2 downgrade, logging-suppression, or script-block smuggling variants in the case record.
"""
setup = """## Setup
PowerShell Script Block Logging must be enabled to generate the events used by this rule (e.g., 4104).
Setup instructions: https://ela.st/powershell-logging-setup
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user.id",
"user.domain",
"powershell.file.script_block_text",
"powershell.file.script_block_id",
"powershell.sequence",
"powershell.total",
"file.path",
"file.directory",
"file.name",
"process.pid",
"host.name",
"host.id",
"powershell.file.script_block_length"
]
[transform]
[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Script block fragments for the same script"
description = ""
providers = [
[
{ excluded = false, field = "powershell.file.script_block_id", queryType = "phrase", value = "{{powershell.file.script_block_id}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "PowerShell script blocks for the same process"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "event.code", queryType = "phrase", value = "4104", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Process events for the PowerShell instance"
description = ""
providers = [
[
{ excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[rule.threat.technique.subtechnique]]
id = "T1027.010"
name = "Command Obfuscation"
reference = "https://attack.mitre.org/techniques/T1027/010/"
[[rule.threat.technique]]
id = "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/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: query
event.category:"process" and host.os.type:windows and
(
powershell.file.script_block_text : (
"System.Management.Automation.AmsiUtils" or
amsiInitFailed or
"Invoke-AmsiBypass" or
"Bypass.AMSI" or
"amsi.dll" or
AntimalwareProvider or
amsiSession or
amsiContext or
AmsiInitialize or
unloadobfuscated or
unloadsilent or
AmsiX64 or
AmsiX32 or
FindAmsiFun or
"AllocHGlobal((9076" or
"[cHAr](65)+[cHaR]([byTe]0x6d)+[ChaR]([ByTe]0x73)+[CHaR]([BYte]0x69"
) or
powershell.file.script_block_text:("[Ref].Assembly.GetType(('System.Management.Automation" and ".SetValue(") or
powershell.file.script_block_text:("::AllocHGlobal((" and ".SetValue(" and "-replace" and ".NoRMALiZe(")
) and
not powershell.file.script_block_text : (
"sentinelbreakpoints" and "Set-PSBreakpoint"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
powershell.file.script_block_text | eq |
| field:"ScriptBlockText" kind:eq |
powershell.file.script_block_text | in |
| field:"ScriptBlockText" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
powershell.file.script_block_text | eq | Set-PSBreakpoint | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"Set-PSBreakpoint" |
powershell.file.script_block_text | eq | sentinelbreakpoints | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"sentinelbreakpoints" |
Potential Credential Access via LSASS Memory Dump
#Identifies suspicious access to LSASS handle from a call trace pointing to DBGHelp.dll or DBGCore.dll, which both export the MiniDumpWriteDump method that can be used to dump LSASS memory content in preparation for credential access.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Credential Access |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 10: ProcessAccess |
Rule Body
[metadata]
creation_date = "2021/10/07"
integration = ["windows"]
maturity = "production"
updated_date = "2026/04/27"
[rule]
author = ["Elastic"]
description = """
Identifies suspicious access to LSASS handle from a call trace pointing to DBGHelp.dll or DBGCore.dll, which both export
the MiniDumpWriteDump method that can be used to dump LSASS memory content in preparation for credential access.
"""
from = "now-9m"
index = ["winlogbeat-*", "logs-windows.sysmon_operational-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Credential Access via LSASS Memory Dump"
references = [
"https://www.ired.team/offensive-security/credential-access-and-credential-dumping/dump-credentials-from-lsass-process-without-mimikatz",
"https://www.elastic.co/security-labs/detect-credential-access",
"https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
]
risk_score = 73
rule_id = "9960432d-9b26-409f-972b-839a959e79e2"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Sysmon",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.code == "10" and
winlog.event_data.TargetImage : "?:\\WINDOWS\\system32\\lsass.exe" and
/* dbgcore.dll hosts MiniDumpWriteDump on modern Windows; dbghelp-only traces are non-dump usage */
winlog.event_data.CallTrace : "*dbgcore*" and
/* crash handlers */
not process.executable : (
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\WerFaultSecure.exe"
)
'''
note = """## Triage and analysis
### Investigating Potential Credential Access via LSASS Memory Dump
#### Possible investigation steps
- What did the process-access event prove?
- Focus: `winlog.event_data.SourceImage`, `winlog.event_data.SourceProcessGUID`, `winlog.event_data.TargetImage`, `winlog.event_data.GrantedAccess`, and `winlog.event_data.CallTrace`.
- Implication: escalate on a non-WerFault source touching LSASS with dbgcore in the call trace plus any corroborator; lower concern only when the tuple matches a stable EDR, crash-analysis, support, or authorized-test workflow on that `host.id`.
- Does the source process match a recognized diagnostic tool?
- Focus: recover the process start on the same `host.id` using `winlog.event_data.SourceProcessGUID` or `process.entity_id`, then review `process.executable`, `process.command_line`, `process.pe.original_file_name`, `process.code_signature.subject_name`, and `process.code_signature.trusted`. $investigate_0
- Hint: if the source lacks `winlog.event_data.SourceProcessGUID`, fall back to `winlog.event_data.SourceImage`, `host.id`, and a tight window around `@timestamp`; if PE or signature metadata is absent, keep identity unresolved rather than inferring trust from path.
- Implication: escalate when the recovered source is unsigned, renamed, user-writable, or uses MiniDumpWriteDump-adjacent arguments such as ProcDump-style switches or rundll32 with comsvcs.dll; if process-start telemetry is unavailable, treat identity as unresolved and do not close on `winlog.event_data.SourceImage` alone.
- Does the recovered launch chain explain why this process would touch LSASS?
- Focus: `process.command_line`, `process.parent.executable`, `process.parent.command_line`, `process.Ext.authentication_id`, and `user.id`; use `process.Ext.ancestry` when parent context is incomplete.
- Implication: escalate when shells, script hosts, Office, browsers, archive tools, or remote-admin launchers start the accessor, or when `user.id` does not fit recognized troubleshooting; record `process.Ext.authentication_id` only as a later session bridge, and treat missing lineage as unresolved rather than benign.
- Do same-source file events show dump creation, rename, or staging?
- Focus: same-host file events for recovered `process.entity_id`, or `host.id` plus `process.pid` in a tight alert window; read `file.path`, `file.name`, `file.Ext.original.path`, and `file.size`. $investigate_1
- Implication: escalate when the accessor writes dump output to temp, public, user-writable, or share paths, or renames it into archives or deceptive extensions; missing file telemetry is unresolved, not benign.
- Do surrounding process events show dump handling, archive, copy, or cleanup?
- Focus: child process starts from the recovered accessor on the same `host.id`, especially `process.parent.entity_id`, `process.executable`, `process.command_line`, and `@timestamp`. $investigate_2
- Hint: sibling process review remains a manual expansion from the recovered parent/session context.
- Implication: escalate when archivers, copy tools, PowerShell, rundll32, or cleanup commands appear immediately before or after the access; if process telemetry is sparse, preserve the gap and rely on the access tuple plus other corroborators.
- Do authentication events suggest the account pivoted after the access?
- Why: MiniDumpWriteDump-style LSASS access is usually a precursor step; later credential use matters more than the access alone.
- Focus: after process recovery, use `process.Ext.authentication_id` and `host.id` to review authentication events via `winlog.event_data.TargetLogonId`; search `winlog.event_data.SubjectLogonId` separately for "4648" explicit-credential context.
- Hint: if the process does not preserve `process.Ext.authentication_id`, skip the auth bridge and record the gap.
- Implication: escalate when the linked session or `user.id` shows unexpected remote logons, explicit-credential use, or admin-share access soon after; missing authentication telemetry is unresolved, not benign.
- If source identity, artifacts, or follow-on activity remain suspicious, do related alerts widen scope?
- Focus: related `user.id` alerts for credential access, lateral movement, privilege escalation, or suspicious authentication. $investigate_3
- Hint: compare `host.id` alerts to separate account reuse from host-local dump staging. $investigate_4
- Implication: broaden when the same user or host also triggers dumping, suspicious logon, lateral movement, or exfiltration findings; keep local when related alerts are absent.
- Escalate when LSASS access plus one meaningful corroborator points to unauthorized dump preparation or credential use; close only when identity, access tuple, launch, artifacts, authentication, and scope align with one recognized benign workflow; preserve and escalate if mixed or incomplete.
### False positive analysis
- Recognized EDR, crash-analysis, vendor-support, or authorized testing tooling can legitimately touch LSASS through dbgcore. Close only when the alert tuple, recovered source identity, parent context, `user.id`, and `host.id` all point to that same workflow, with no contradictory dump artifact or post-access authentication evidence. Case records, inventories, and owner confirmation can corroborate but not replace the telemetry match.
- Before exceptioning, validate recurrence for the same recovered tool identity, signer, parent context, `winlog.event_data.SourceImage`, `user.id`, and `host.id`. Avoid exceptions on `winlog.event_data.CallTrace`, `winlog.event_data.TargetImage`, or LSASS access alone.
### Response and remediation
- If confirmed benign, reverse temporary containment and document the alert tuple, recovered source identity, parent context, `user.id`, `host.id`, and absence of contradictory dump or post-access authentication evidence. Create an exception only if the same stable workflow recurs.
- If suspicious but unconfirmed, preserve the full alert event, recovered source process event, dump artifacts, linked authentication records, `user.id`, and `host.id` before containment. Apply reversible containment first, such as heightened monitoring or temporary restrictions on the affected `host.id`; weigh host criticality before isolating domain controllers or other privileged systems, and escalate to isolation only when dump artifacts or linked authentication evidence indicates likely credential exposure.
- If confirmed malicious, preserve the alert tuple, source process identifiers, command line, parent context, dump artifact paths, and linked authentication evidence before terminating processes or deleting files. Then isolate the endpoint; if direct response is unavailable, escalate with the preserved artifact set. Restrict affected share paths when share-staged dumps were identified.
- On servers, jump hosts, or privileged admin systems, scope which local, cached, service, or administrative credentials may have been exposed, then reset or rotate affected credentials according to their role and exposure.
- Before eradication, review related hosts and users for the same source image, dump path pattern, or transfer target. Then remove dump utilities, scripts, archives, copied dumps, persistence mechanisms, and remediate the privilege path or initial access route that enabled the LSASS access.
- Post-incident hardening: retain Sysmon Event ID 10 plus supporting process, file, and authentication telemetry, and document adjacent LSASS dump paths such as ProcDump-style switches or rundll32 with comsvcs.dll for the detection engineering team.
"""
setup = """## Setup
This rule requires Sysmon telemetry to be enabled and ingested.
Setup instructions: https://ela.st/sysmon-event-10-setup
"""
[rule.investigation_fields]
field_names = [
"@timestamp",
"host.name",
"host.id",
"user.name",
"user.id",
"process.entity_id",
"process.pid",
"process.executable",
"process.command_line",
"winlog.event_data.SourceProcessGUID",
"winlog.event_data.SourceImage",
"winlog.event_data.TargetImage",
"winlog.event_data.GrantedAccess",
"winlog.event_data.CallTrace",
]
[transform]
[[transform.investigate]]
label = "Source process events by GUID"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{winlog.event_data.SourceProcessGUID}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "File activity for the source process"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{winlog.event_data.SourceProcessGUID}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[transform.investigate]]
label = "Child process events for the source process"
description = ""
providers = [
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{winlog.event_data.SourceProcessGUID}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
],
[
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
{ excluded = false, field = "event.category", queryType = "phrase", value = "process", 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 = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.001"
name = "LSASS Memory"
reference = "https://attack.mitre.org/techniques/T1003/001/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"
[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.code == "10" and
winlog.event_data.TargetImage : "?:\\WINDOWS\\system32\\lsass.exe" and
winlog.event_data.CallTrace : "*dbgcore*" and
not process.executable : (
"?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\WerFaultSecure.exe"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.code | eq |
| field:"EventID" kind:eq value:"10" |
winlog.event_data.CallTrace | wildcard |
| field:"CallTrace" kind:wildcard value:"*dbgcore*" |
winlog.event_data.TargetImage | wildcard |
| field:"TargetImage" kind:wildcard value:"?:\WINDOWS\system32\lsass.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\WerFaultSecure.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\WerFault.exe" field:"process.executable" value:"?:\Windows\SysWOW64\WerFault.exe" field:"process.executable" value:"?:\Windows\System32\WerFaultSecure.exe" |
Potential VScode Remote Tunnel Established
#Detects the rename or modification of the code_tunnel json file which gets created or modified when a remote tunnel session is created via the VScode portable binary.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Rule Body
[rule]
description = """
Detects the rename or modification of the code_tunnel json file which gets created or modified when a remote tunnel
session is created via the VScode portable binary.
"""
id = "aec74eb4-9618-42ff-96eb-2d13e6959d47"
license = "Elastic License v2"
name = "Potential VScode Remote Tunnel Established"
os_list = ["macos", "windows"]
reference = ["https://badoption.eu/blog/2023/01/31/code_c2.html"]
version = "1.0.10"
query = '''
file where event.action != "deletion" and file.name : "code_tunnel.json" and
not process.executable : "C:\\Windows\\explorer.exe"
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1102"
name = "Web Service"
reference = "https://attack.mitre.org/techniques/T1102/"
[[threat.technique.subtechnique]]
id = "T1102.002"
name = "Bidirectional Communication"
reference = "https://attack.mitre.org/techniques/T1102/002/"
[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
Stage 1: file
file where event.action != "deletion" and file.name : "code_tunnel.json" and
not process.executable : "C:\\Windows\\explorer.exe"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.name | wildcard |
| field:"file.name" kind:wildcard value:"code_tunnel.json" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | C:\Windows\explorer.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\explorer.exe" |
Potential Webshell Deployed via Apache Struts CVE-2023-50164 Exploitation
#Identifies successful exploitation of CVE-2023-50164, a critical path traversal vulnerability in Apache Struts 2 file upload functionality. This high-fidelity rule detects a specific attack sequence where a malicious multipart/form-data POST request with WebKitFormBoundary is made to a Struts .action upload endpoint, immediately followed by the creation of a JSP web shell file by a Java process in Tomcat's webapps directories. This correlated activity indicates active exploitation resulting in remote code execution capability through unauthorized file upload and web shell deployment.
Known False Positives
- False positives are expected to be very rare due to the specific nature of this rule. Legitimate application deployments typically do not involve multipart form uploads to .action endpoints followed immediately by JSP file creation in webapps directories. However, custom deployment scripts or automated testing tools that simulate file uploads could potentially trigger this alert. Review the source IP, user agent, uploaded file content, timing, and deployment schedules to validate if the activity is authorized. Standard package manager operations are already excluded from detection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence | |
| Command & Control |
Rule Body
[metadata]
creation_date = "2025/11/19"
integration = ["endpoint", "network_traffic"]
maturity = "production"
updated_date = "2026/05/01"
[rule]
author = ["Elastic"]
description = """
Identifies successful exploitation of CVE-2023-50164, a critical path traversal vulnerability in Apache Struts 2 file
upload functionality. This high-fidelity rule detects a specific attack sequence where a malicious multipart/form-data
POST request with WebKitFormBoundary is made to a Struts .action upload endpoint, immediately followed by the creation
of a JSP web shell file by a Java process in Tomcat's webapps directories. This correlated activity indicates active
exploitation resulting in remote code execution capability through unauthorized file upload and web shell deployment.
"""
false_positives = [
"""
False positives are expected to be very rare due to the specific nature of this rule. Legitimate application
deployments typically do not involve multipart form uploads to .action endpoints followed immediately by JSP file
creation in webapps directories. However, custom deployment scripts or automated testing tools that simulate file
uploads could potentially trigger this alert. Review the source IP, user agent, uploaded file content, timing, and
deployment schedules to validate if the activity is authorized. Standard package manager operations are already
excluded from detection.
""",
]
from = "now-9m"
index = ["logs-endpoint.events.*", "logs-network_traffic.*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Webshell Deployed via Apache Struts CVE-2023-50164 Exploitation"
note = """## Triage and analysis
### Investigating Potential Webshell Deployed via Apache Struts CVE-2023-50164 Exploitation
CVE-2023-50164 is a critical path traversal vulnerability in Apache Struts 2 that allows attackers to manipulate file upload parameters and write malicious files to arbitrary locations on the web server. This vulnerability affects the file upload feature and enables attackers to bypass security controls, upload JSP-based web shells, and achieve remote code execution. This detection rule identifies the complete attack chain by correlating suspicious file upload requests to Struts endpoints with the subsequent creation of JSP files in web-accessible directories, indicating successful exploitation.
### Possible investigation steps
- Review the source IP address of the HTTP POST request to determine if it originates from a known malicious source, VPN/proxy service, or unexpected geographic location that does not align with legitimate application usage patterns.
- Examine the complete HTTP request details including headers, user agent string, and the full request body content to identify indicators of exploit code, path traversal attempts, or malicious payloads embedded in the multipart form data.
- Investigate the created JSP file by examining its contents, file name, creation timestamp, and file permissions to determine if it contains web shell code, command execution capabilities, or other malicious functionality.
- Check for any subsequent process execution, network connections, or file system activities originating from the Java process after the JSP file creation, which may indicate that the web shell has been accessed and used by the attacker.
- Review web server access logs for requests to the newly created JSP file path to identify if the attacker has attempted to access or execute the web shell, and capture any command execution or data exfiltration attempts.
- Examine the affected Struts application logs and Tomcat catalina logs for additional context about the file upload request, error messages, or anomalous behavior that occurred during the exploitation attempt.
- Identify the version of Apache Struts 2 running on the affected server to confirm if it is vulnerable to CVE-2023-50164 (versions prior to 2.5.33 or 6.3.0.2 are affected).
- Search for additional suspicious file creations, modifications, or deletions in the webapps directories that may indicate the attacker attempted multiple exploitation attempts or deployed additional persistence mechanisms.
### False positive analysis
- Legitimate application deployments using multipart form uploads to Struts endpoints followed by JSP file creation are uncommon but possible in custom deployment workflows. Review the source IP, user identity, and timing against known deployment schedules and authorized deployment systems.
- Automated testing frameworks or security scanning tools that test file upload functionality may trigger this rule if they upload files to Struts endpoints. Identify and exclude known security testing tools or authorized penetration testing activities based on source IP or user agent patterns.
- Development or staging environments where developers frequently test file upload features may generate alerts. Consider creating exceptions for non-production environments or restricting the rule to production systems only.
- CI/CD pipelines that deploy applications via multipart form uploads could potentially match this pattern, though this is rare. Review the deployment process and create exceptions for known automated deployment systems if necessary.
### Response and remediation
- Immediately isolate the affected web server from the network to prevent further exploitation, lateral movement, or data exfiltration by the attacker.
- Identify and delete the malicious JSP web shell file from the web server, ensuring you preserve a copy for forensic analysis and evidence collection.
- Terminate any active web shell sessions by restarting the Java application server process and reviewing all active network connections for suspicious activity.
- Review web server access logs to identify all IP addresses that accessed the web shell and block those IP addresses at the network perimeter to prevent re-exploitation.
- Conduct a comprehensive scan of the affected server for additional web shells, backdoors, persistence mechanisms, or signs of lateral movement to other systems in the environment.
- Patch the Apache Struts 2 installation to version 2.5.33, 6.3.0.2, or higher to remediate the CVE-2023-50164 vulnerability and prevent future exploitation attempts.
- Review and harden file upload configurations in Struts applications, implement strict input validation, restrict file upload locations, and consider implementing web application firewall (WAF) rules to detect and block path traversal attempts.
- Reset credentials for any accounts or services running on the compromised server, as the attacker may have captured sensitive information or credentials through the web shell.
- Escalate the incident to the security operations center (SOC) and incident response team for comprehensive investigation, threat hunting, and to determine if additional systems were compromised.
- Conduct a post-incident review to identify gaps in detection, response, and vulnerability management processes, and implement improvements to prevent similar incidents in the future.
"""
references = [
"https://nvd.nist.gov/vuln/detail/CVE-2023-50164",
"https://www.trendmicro.com/en_us/research/23/l/decoding-cve-2023-50164--unveiling-the-apache-struts-file-upload.html",
"https://github.com/snyk-labs/CVE-2023-50164-POC",
]
risk_score = 73
rule_id = "7f3e8b9a-2c4d-5e6f-8a1b-9c2d3e4f5a6b"
setup = """## Setup
This rule requires data coming in from both Elastic Defend (for file events) and Network Packet Capture integrations (for HTTP traffic analysis).
### Network Packet Capture Integration Setup
**IMPORTANT**: This rule requires HTTP request body capture to be enabled in order to detect the multipart/form-data content containing WebKitFormBoundary indicators. The network traffic integration must be configured to capture HTTP request bodies for POST requests with `multipart/form-data` content type.
"""
severity = "high"
tags = [
"Domain: Endpoint",
"Domain: Web",
"Domain: Network",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Data Source: Network Traffic",
"Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by agent.id with maxspan=10s
[network where data_stream.dataset == "network_traffic.http" and
http.request.method == "POST" and
http.request.body.content like "*WebKitFormBoundary*" and
url.path like~ "*upload*.action"]
[file where data_stream.dataset == "endpoint.events.file" and
host.os.type == "linux" and
event.action == "creation" and
process.name == "java" and
file.extension == "jsp" and
file.path like "*/webapps/*" and
not file.path like "*/WEB-INF/*" and
not file.path like "*/META-INF/*"
]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1190"
name = "Exploit Public-Facing Application"
reference = "https://attack.mitre.org/techniques/T1190/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[rule.threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 10s, correlated by agent.id.
Stage 1: network
[network where data_stream.dataset == "network_traffic.http" and
http.request.method == "POST" and
http.request.body.content like "*WebKitFormBoundary*" and
url.path like~ "*upload*.action"]
Stage 2: file
[file where data_stream.dataset == "endpoint.events.file" and
host.os.type == "linux" and
event.action == "creation" and
process.name == "java" and
file.extension == "jsp" and
file.path like "*/webapps/*" and
not file.path like "*/WEB-INF/*" and
not file.path like "*/META-INF/*"
]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq |
event.action | eq |
| field:"EventType" kind:eq value:"creation" |
file.extension | eq |
| field:"file.extension" kind:eq value:"jsp" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"*/webapps/*" |
http.request.body.content | wildcard |
| field:"http.request.body.content" kind:wildcard value:"*WebKitFormBoundary*" |
http.request.method | eq |
| field:"http.request.method" kind:eq value:"POST" |
process.name | eq |
| field:"process_basename" kind:eq value:"java" |
url.path | wildcard |
| field:"url.path" kind:wildcard value:"*upload*.action" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.path | match | /META-INF/ | excludes:file.path field:"file.path" value:"/META-INF/" |
file.path | match | /WEB-INF/ | excludes:file.path field:"file.path" value:"/WEB-INF/" |
Quarantine Attribute Deleted via Untrusted Binary
#Identifies a potential Gatekeeper bypass from an unsigned or untrusted binary. In macOS, when applications or programs are downloaded from the internet, there is a quarantine flag set on the file. This attribute is read by Apple's Gatekeeper defense program at execution time. An adversary may disable this attribute to evade defenses.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Telemetry Coverage
Rule Body
[rule]
description = """
Identifies a potential Gatekeeper bypass from an unsigned or untrusted binary. In macOS, when applications or programs
are downloaded from the internet, there is a quarantine flag set on the file. This attribute is read by Apple's
Gatekeeper defense program at execution time. An adversary may disable this attribute to evade defenses.
"""
id = "6e47b750-72c4-4af9-ad7b-0fc846df64d3"
license = "Elastic License v2"
name = "Quarantine Attribute Deleted via Untrusted Binary"
os_list = ["macos"]
version = "1.0.29"
query = '''
sequence with maxspan=1m
[process where event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.hash.sha256 == "2d3aa19d6f012c1a4ebc5907a05b06cf0d43a1499107020f59847ea2638c8649" and
not process.executable like "/opt/homebrew/*"] by process.entity_id
[process where event.action == "exec" and
process.args like~ "*xattr" and
process.name like~ ("bash", "sh", "zsh", "xattr", "python*", "osascript") and
(
(process.args like "com.apple.quarantine" and process.args like~ ("-d", "-w", "-?d", "-?w")) or
(process.args == "-c" and not process.args like "github.com/pkg/xattr")
)
] by process.parent.entity_id
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[threat.technique.subtechnique]]
id = "T1553.001"
name = "Gatekeeper Bypass"
reference = "https://attack.mitre.org/techniques/T1553/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.hash.sha256 == "2d3aa19d6f012c1a4ebc5907a05b06cf0d43a1499107020f59847ea2638c8649" and
not process.executable like "/opt/homebrew/*"] by process.entity_id
Stage 2: process
[process where event.action == "exec" and
process.args like~ "*xattr" and
process.name like~ ("bash", "sh", "zsh", "xattr", "python*", "osascript") and
(
(process.args like "com.apple.quarantine" and process.args like~ ("-d", "-w", "-?d", "-?w")) or
(process.args == "-c" and not process.args like "github.com/pkg/xattr")
)
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
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 | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | starts_with | /opt/homebrew/ | excludes:process.executable field:"process.executable" value:"/opt/homebrew/" |
process.hash.sha256 | eq | 2d3aa19d6f012c1a4ebc5907a05b06cf0d43a1499107020f59847ea2638c8649 | excludes:process.hash.sha256 field:"process.hash.sha256" value:"2d3aa19d6f012c1a4ebc5907a05b06cf0d43a1499107020f59847ea2638c8649" |
Security Tooling Enumeration
#Detects a sequence where the same parent process executes several distinct "systemctl", "service", "chkconfig", "grep", "egrep", or "pgrep" commands to check for known security tooling within 3 seconds. Repeated identical command lines are de-duplicated, helping identify rapid multi-command security software discovery rather than a single enumeration attempt.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule Body
[rule]
description = """
Detects a sequence where the same parent process executes several distinct "systemctl", "service", "chkconfig", "grep",
"egrep", or "pgrep" commands to check for known security tooling within 3 seconds. Repeated identical command lines are
de-duplicated, helping identify rapid multi-command security software discovery rather than a single enumeration
attempt.
"""
id = "9de52bd9-0537-4b2c-a3ba-34c3c3ffd855"
license = "Elastic License v2"
name = "Security Tooling Enumeration"
os_list = ["linux"]
version = "1.0.5"
query = '''
sequence by process.parent.entity_id with maxspan=3s
[process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
) and not (
process.parent.executable in (
"/opt/puppetlabs/puppet/bin/ruby", "/opt/puppetlabs/puppet/bin/puppet", "/opt/sophos-spl/base/bin/SulDownloader",
"/usr/local/manageengine/uems_agent/bin/dctaskengine", "/usr/bin/newrelic-infra", "/usr/bin/puppet",
"/usr/lib64/nagios/plugins/check_agents", "/opt/chef/bin/chef-client", "/opt/chef/embedded/bin/ruby",
"/usr/local/manageengine/uems_agent/bin/dcinventory", "/opt/scripts/puppet/puppetrun", "/usr/bin/chef-client"
) or
process.parent.executable like (
"/opt/sophos-spl/base/bin/SulDownloader.*", "/opt/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader",
"/usr/local/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader", "/tmp/newroot/opt/chef/bin/chef-client",
"/usr/lib/venv-salt-minion/bin/python.original", "/etc/checkpoint/common/install_offline.sh",
"/tmp/newroot/usr/local/manageengine/uems_agent/bin/dctaskengine",
"/proc/self/fd/*/usr/local/manageengine/uems_agent/bin/dctaskengine",
"/host/opt/puppetlabs/puppet/bin/ruby"
) or
process.parent.args like (
"/usr/lib/nagios/plugins/check_agents", "/usr/bin/puppet", "/home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py",
"/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py", "/var/tmp/rpm-tmp*", "/var/lib/dpkg/info/cybereason-sensor.prerm",
"/var/lib/dpkg/info/mdatp.postinst"
) or
(process.parent.name like "python*" and process.parent.command_line like "*mitogen*") or
(process.parent.executable like "/usr/bin/python*" and process.args == "otelcol-sumo" and process.args == "show") or
(
(
process.working_directory == "/var/ossec" or
process.parent.executable in ("/var/lib/dpkg/tmp.ci/preinst", "/var/lib/dpkg/info/wazuh-agent.prerm")
) and
process.args == "wazuh-agent"
) and not process.args == "disable"
)] as event0
[process where event.type == "start" and event.action == "exec" and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
not startswith~(process.command_line, event0.process.command_line) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
)] as event1
[process where event.type == "start" and event.action == "exec" and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
not (startswith~(process.command_line, event0.process.command_line) or startswith~(process.command_line, event1.process.command_line)) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
)]
'''
min_endpoint_version = "8.4.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.entity_id"
state = 2
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 2
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1518"
name = "Software Discovery"
reference = "https://attack.mitre.org/techniques/T1518/"
[[threat.technique.subtechnique]]
id = "T1518.001"
name = "Security Software Discovery"
reference = "https://attack.mitre.org/techniques/T1518/001/"
[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 3s, correlated by process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
) and not (
process.parent.executable in (
"/opt/puppetlabs/puppet/bin/ruby", "/opt/puppetlabs/puppet/bin/puppet", "/opt/sophos-spl/base/bin/SulDownloader",
"/usr/local/manageengine/uems_agent/bin/dctaskengine", "/usr/bin/newrelic-infra", "/usr/bin/puppet",
"/usr/lib64/nagios/plugins/check_agents", "/opt/chef/bin/chef-client", "/opt/chef/embedded/bin/ruby",
"/usr/local/manageengine/uems_agent/bin/dcinventory", "/opt/scripts/puppet/puppetrun", "/usr/bin/chef-client"
) or
process.parent.executable like (
"/opt/sophos-spl/base/bin/SulDownloader.*", "/opt/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader",
"/usr/local/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader", "/tmp/newroot/opt/chef/bin/chef-client",
"/usr/lib/venv-salt-minion/bin/python.original", "/etc/checkpoint/common/install_offline.sh",
"/tmp/newroot/usr/local/manageengine/uems_agent/bin/dctaskengine",
"/proc/self/fd/*/usr/local/manageengine/uems_agent/bin/dctaskengine",
"/host/opt/puppetlabs/puppet/bin/ruby"
) or
process.parent.args like (
"/usr/lib/nagios/plugins/check_agents", "/usr/bin/puppet", "/home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py",
"/root/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py", "/var/tmp/rpm-tmp*", "/var/lib/dpkg/info/cybereason-sensor.prerm",
"/var/lib/dpkg/info/mdatp.postinst"
) or
(process.parent.name like "python*" and process.parent.command_line like "*mitogen*") or
(process.parent.executable like "/usr/bin/python*" and process.args == "otelcol-sumo" and process.args == "show") or
(
(
process.working_directory == "/var/ossec" or
process.parent.executable in ("/var/lib/dpkg/tmp.ci/preinst", "/var/lib/dpkg/info/wazuh-agent.prerm")
) and
process.args == "wazuh-agent"
) and not process.args == "disable"
)] as event0
Stage 2: process
[process where event.type == "start" and event.action == "exec" and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
not startswith~(process.command_line, event0.process.command_line) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
)] as event1
Stage 3: process
[process where event.type == "start" and event.action == "exec" and
(
process.name in ("service", "chkconfig", "grep", "egrep", "pgrep") or
process.name == "systemctl" and process.args in ("is-enabled", "show", "is-active", "status", "list-units")
) and
not (startswith~(process.command_line, event0.process.command_line) or startswith~(process.command_line, event1.process.command_line)) and
process.args in (
"avast", "bdsec", "cylancesvc", "cyoptics", "cbsensor", "cpla", "itsm", "cloudmonitor", "falcon-sensor", "cybereason-sensor",
"elastic-agent", "sraagent", "eraagent", "eea", "eea-user-agent", "xagt", "keeperx", "kesl", "klnagent64", "kesl-supervisor",
"kics", "kess", "rocketcyber", "limacharlie", "lr-agent.logrhythm", "MFEcma", "mdatp", "osqueryd", "traps_pmd", "ir_agent",
"armor", "sophoslinuxsensor", "sophos-spl", "otelcol-sumo", "ds_agent", "titanagent", "taniumclient", "oneavd", "mbdaemon",
"wazuh-agent", "emit_scand_service", "f-secure-linuxsecurity-activate"
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"disable" |
process.args | in |
| field:"process.args" kind:in |
process.name | eq |
| field:"process_basename" kind:eq value:"systemctl" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | disable | excludes:process.args field:"process.args" value:"disable" |
process.parent.executable | in | /var/lib/dpkg/info/wazuh-agent.prerm, /var/lib/dpkg/tmp.ci/preinst | excludes:process.parent.executable field:"process.parent.executable" value:"/var/lib/dpkg/info/wazuh-agent.prerm" field:"process.parent.executable" value:"/var/lib/dpkg/tmp.ci/preinst" |
process.working_directory | eq | /var/ossec | excludes:process.working_directory field:"process.working_directory" value:"/var/ossec" |
process.args | eq | wazuh-agent | excludes:process.args field:"process.args" value:"wazuh-agent" |
process.args | eq | otelcol-sumo | excludes:process.args field:"process.args" value:"otelcol-sumo" |
process.args | eq | show | excludes:process.args field:"process.args" value:"show" |
process.parent.executable | starts_with | /usr/bin/python | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/python" |
process.parent.command_line | match | mitogen | excludes:process.parent.command_line field:"process.parent.command_line" value:"mitogen" |
process.parent.name | starts_with | python | excludes:process.parent.name field:"process.parent.name" value:"python" |
process.parent.args | wildcard | /usr/lib/nagios/plugins/check_agents, /usr/bin/puppet, /home/*/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py, /root/.ansible/tmp/ansible-tmp-*/AnsiballZ_*.py, /var/tmp/rpm-tmp*, /var/lib/dpkg/info/cybereason-sensor.prerm, /var/lib/dpkg/info/mdatp.postinst | excludes:process.parent.args |
process.parent.executable | in | /opt/chef/bin/chef-client, /opt/chef/embedded/bin/ruby, /opt/puppetlabs/puppet/bin/puppet, /opt/puppetlabs/puppet/bin/ruby, /opt/scripts/puppet/puppetrun, /opt/sophos-spl/base/bin/SulDownloader, /usr/bin/chef-client, /usr/bin/newrelic-infra, /usr/bin/puppet, /usr/lib64/nagios/plugins/check_agents, /usr/local/manageengine/uems_agent/bin/dcinventory, /usr/local/manageengine/uems_agent/bin/dctaskengine | excludes:process.parent.executable |
process.parent.executable | wildcard | /opt/sophos-spl/base/bin/SulDownloader.*, /opt/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader, /usr/local/rapid7/ir_agent/components/bootstrap/*/bootstrap_upgrader, /tmp/newroot/opt/chef/bin/chef-client, /usr/lib/venv-salt-minion/bin/python.original, /etc/checkpoint/common/install_offline.sh, /tmp/newroot/usr/local/manageengine/uems_agent/bin/dctaskengine, /proc/self/fd/*/usr/local/manageengine/uems_agent/bin/dctaskengine, /host/opt/puppetlabs/puppet/bin/ruby | excludes:process.parent.executable |
process.command_line | starts_with | event0.process.command_line | excludes:process.command_line field:"process.command_line" value:"event0.process.command_line" |
process.command_line | starts_with | event1.process.command_line | excludes:process.command_line field:"process.command_line" value:"event1.process.command_line" |
Sensitive File Access - Cloud Credentials
#Identifies an unusual process accessing common cloud providers credential files. Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Rule Body
[rule]
description = """
Identifies an unusual process accessing common cloud providers credential files. Adversaries may search local file
systems and remote file shares for files containing insecurely stored credentials.
"""
id = "39f60a36-8c5a-4703-8576-ad3e8c800a0f"
license = "Elastic License v2"
name = "Sensitive File Access - Cloud Credentials"
os_list = ["windows"]
reference = ["https://github.com/GhostPack/Seatbelt"]
version = "1.0.35"
query = '''
sequence by process.entity_id with maxspan=5m
[process where event.action == "start" and
user.id like ("S-1-5-21*", "S-1-12-*") and process.executable != null and
not (process.code_signature.subject_name : ("Johannes Schindelin", "Anaconda, Inc.") and process.code_signature.status == "trusted") and
not (process.code_signature.subject_name : "Python Software Foundation" and
process.executable : "?:\\Users\\*\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\bundledpython\\python.exe") and
not process.executable :
(
/* third party programs common install path - requires local admin */
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
/*
dllhost.exe (IFileOperation like view/changing security permission of a file/folder).
explorer.exe for directory and file discovery.
SearchProtocolHost.exe is for file searches and indexing.
*/
"?:\\Windows\\explorer.exe",
"?:\\Windows\\System32\\dllhost.exe",
"?:\\Windows\\System32\\SearchProtocolHost.exe",
/* Windows Defender */
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe") and
process.hash.sha256 != "0a8876ede7d2b65a5a0443831b2b4757d3519396a22bd55c20102bc67e6d16b3"]
[file where event.type == "access" and
/* non system accounts */
user.id like ("S-1-5-21*", "S-1-12-*") and
/* AWS/Google/Azure/Git cloud credential files */
file.path : ("?:\\users\\*\\AppData\\*\\gcloud\\credentials.db",
"?:\\users\\*\\AppData\\*\\gcloud\\legacy_credentials",
"?:\\users\\*\\AppData\\*\\gcloud\\access_tokens.db",
"?:\\users\\*\\.azure\\accessTokens.json",
"?:\\users\\*\\.azure\\azureProfile.json",
"?:\\users\\*\\.azure\\msal_token_cache.json",
"?:\\users\\*\\.azure\\msal_token_cache.bin",
"?:\\users\\*\\.azure\\msal_http_cache.bin",
"?:\\users\\*\\.aws\\credentials",
"?:\\Users\\*\\.config\\git\\credentials")]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
user.id like ("S-1-5-21*", "S-1-12-*") and process.executable != null and
not (process.code_signature.subject_name : ("Johannes Schindelin", "Anaconda, Inc.") and process.code_signature.status == "trusted") and
not (process.code_signature.subject_name : "Python Software Foundation" and
process.executable : "?:\\Users\\*\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\bundledpython\\python.exe") and
not process.executable :
(
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
/*
dllhost.exe (IFileOperation like view/changing security permission of a file/folder).
explorer.exe for directory and file discovery.
SearchProtocolHost.exe is for file searches and indexing.
*/
"?:\\Windows\\explorer.exe",
"?:\\Windows\\System32\\dllhost.exe",
"?:\\Windows\\System32\\SearchProtocolHost.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe") and
process.hash.sha256 != "0a8876ede7d2b65a5a0443831b2b4757d3519396a22bd55c20102bc67e6d16b3"]
Stage 2: file
[file where event.type == "access" and
user.id like ("S-1-5-21*", "S-1-12-*") and
file.path : ("?:\\users\\*\\AppData\\*\\gcloud\\credentials.db",
"?:\\users\\*\\AppData\\*\\gcloud\\legacy_credentials",
"?:\\users\\*\\AppData\\*\\gcloud\\access_tokens.db",
"?:\\users\\*\\.azure\\accessTokens.json",
"?:\\users\\*\\.azure\\azureProfile.json",
"?:\\users\\*\\.azure\\msal_token_cache.json",
"?:\\users\\*\\.azure\\msal_token_cache.bin",
"?:\\users\\*\\.azure\\msal_http_cache.bin",
"?:\\users\\*\\.aws\\credentials",
"?:\\Users\\*\\.config\\git\\credentials")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.type | eq |
| field:"event.type" kind:eq value:"access" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.hash.sha256 | ne |
| field:"Hashes" kind:ne value:"0a8876ede7d2b65a5a0443831b2b4757d3519396a22bd55c20102bc67e6d16b3" |
user.id | wildcard |
| field:"user.id" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.status | eq | trusted | excludes:process.code_signature.status field:"process.code_signature.status" value:"trusted" |
process.code_signature.subject_name | eq | Johannes Schindelin, Anaconda, Inc. | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Johannes Schindelin" field:"process.code_signature.subject_name" value:"Anaconda, Inc." |
process.code_signature.subject_name | eq | Python Software Foundation | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Python Software Foundation" |
process.executable | wildcard | ?:\Users\*\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe | excludes:process.executable field:"process.executable" value:"?:\Users\*\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe" |
process.executable | wildcard | ?:\Program Files\*, ?:\Program Files (x86)\*, ?:\Windows\explorer.exe, ?:\Windows\System32\dllhost.exe, ?:\Windows\System32\SearchProtocolHost.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MsMpEng.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MpCopyAccelerator.exe | excludes:process.executable |
Service Installed by Unsigned Process
#Identifies the install of a new service by a process with no code signature or an invalid one. Adversaries may use this technique to maintain persistence or run with System privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Identifies the install of a new service by a process with no code signature or an invalid one. Adversaries may use this
technique to maintain persistence or run with System privileges.
"""
id = "9a5fefc6-2ec7-445a-8436-4ef894eff9a1"
license = "Elastic License v2"
name = "Service Installed by Unsigned Process"
os_list = ["windows"]
version = "1.0.3"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
(process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
(process.code_signature.trusted == false or process.code_signature.exists == false) and not process.code_signature.status like "errorCode_endpoint*" and
not process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe")]
[any where event.category == "configuration" and event.action == "service_installed" and user.id != "S-1-5-18" and
(process.code_signature.exists == false or process.code_signature.trusted == false) and
not winlog.event_data.ServiceStartType in ("Manual", "Disabled")]
'''
min_endpoint_version = "9.0.0"
optional_actions = []
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[threat.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "9.0.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
(process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
(process.code_signature.trusted == false or process.code_signature.exists == false) and not process.code_signature.status like "errorCode_endpoint*" and
not process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe")]
Stage 2: any
[any where event.category == "configuration" and event.action == "service_installed" and user.id != "S-1-5-18" and
(process.code_signature.exists == false or process.code_signature.trusted == false) and
not winlog.event_data.ServiceStartType in ("Manual", "Disabled")]
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.status | starts_with | errorCode_endpoint | excludes:process.code_signature.status field:"process.code_signature.status" value:"errorCode_endpoint" |
process.executable | wildcard | ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe" |
winlog.event_data.ServiceStartType | in | Disabled, Manual | excludes:winlog.event_data.ServiceStartType field:"winlog.event_data.ServiceStartType" value:"Disabled" field:"winlog.event_data.ServiceStartType" value:"Manual" |
Spike in Group Lifecycle Change Events
#A machine learning job has identified an unusual spike in Okta group lifecycle change events, indicating potential privileged access activity. Adversaries may be altering group structures to escalate privileges, maintain persistence, or facilitate lateral movement within an organization’s identity management system.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2025/02/18"
integration = ["pad", "okta"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job has identified an unusual spike in Okta group lifecycle change events, indicating potential
privileged access activity. Adversaries may be altering group structures to escalate privileges, maintain persistence,
or facilitate lateral movement within an organization’s identity management system.
"""
from = "now-3h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "pad_okta_spike_in_group_lifecycle_changes_ea"
name = "Spike in Group Lifecycle Change Events"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Spike in Group Lifecycle Change Events
In identity management systems like Okta, group lifecycle changes are crucial for managing user access and permissions. Adversaries may exploit these changes to escalate privileges or maintain unauthorized access. The detection rule leverages machine learning to identify unusual spikes in these events, signaling potential misuse. By focusing on privilege escalation tactics, it helps security analysts pinpoint and investigate suspicious activities.
### Possible investigation steps
- Review the specific group lifecycle change events that triggered the alert to identify which groups were altered and the nature of the changes.
- Examine the user accounts associated with the changes to determine if they have a history of suspicious activity or if they have recently been granted elevated privileges.
- Check the timestamps of the group changes to see if they coincide with other unusual activities or known attack patterns within the organization.
- Investigate any recent access requests or approvals related to the affected groups to ensure they were legitimate and authorized.
- Correlate the group changes with other security alerts or logs to identify potential lateral movement or privilege escalation attempts by adversaries.
- Assess the current membership of the affected groups to ensure no unauthorized users have been added or legitimate users removed.
### False positive analysis
- Routine administrative changes in group memberships can trigger false positives. Security teams should identify and whitelist these regular activities to prevent unnecessary alerts.
- Automated processes or scripts that modify group structures for legitimate reasons may cause spikes. Exclude these known processes by creating exceptions in the detection rule.
- Large-scale onboarding or offboarding events can lead to a temporary increase in group lifecycle changes. Coordinate with HR or relevant departments to anticipate these events and adjust monitoring thresholds accordingly.
- Changes due to system integrations or updates might be misinterpreted as suspicious. Document and exclude these events by maintaining an updated list of integration activities.
- Regular audits or compliance checks that involve group modifications should be recognized and filtered out to avoid false alarms.
### Response and remediation
- Immediately isolate affected user accounts and groups to prevent further unauthorized access or privilege escalation. This can be done by temporarily disabling accounts or removing them from critical groups.
- Conduct a thorough review of recent group lifecycle changes to identify unauthorized modifications. Revert any unauthorized changes to restore the original group structures and permissions.
- Implement additional monitoring on the affected accounts and groups to detect any further suspicious activities. This includes setting up alerts for any new group changes or access attempts.
- Escalate the incident to the security operations team for a deeper investigation into potential lateral movement or persistence mechanisms used by the adversary.
- Review and update access controls and group management policies to ensure they align with the principle of least privilege, minimizing the risk of privilege escalation.
- Coordinate with the IT and security teams to apply patches or updates to any vulnerabilities identified during the investigation that may have been exploited for privilege escalation.
- Document the incident, including all actions taken, and conduct a post-incident review to identify lessons learned and improve future response strategies."""
references = [
"https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
"https://docs.elastic.co/en/integrations/pad",
]
risk_score = 21
rule_id = "aa28f01d-bc93-4c8f-bc01-6f67f2a0a833"
setup = """## Setup
The rule requires the Privileged Access Detection integration assets to be installed, as well as Okta logs collected by integrations such as Okta.
### Privileged Access Detection Setup
The Privileged Access Detection integration detects privileged access activity by identifying abnormalities in Windows, Linux and Okta events. Anomalies are detected using Elastic's Anomaly Detection feature.
#### Prerequisite Requirements:
- Fleet is required for Privileged Access Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Okta events collected by [Okta](https://docs.elastic.co/en/integrations/okta) integration.
- To add the Okta integration to an Elastic Agent policy, refer to [this](https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html) guide.
#### The following steps should be executed to install assets associated with the Privileged Access Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Privileged Access Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
"Data Source: Okta",
"Use Case: Privileged Access Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.007"
name = "Additional Local or Domain Groups"
reference = "https://attack.mitre.org/techniques/T1098/007/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.007"
name = "Additional Local or Domain Groups"
reference = "https://attack.mitre.org/techniques/T1098/007/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Suspicious File Creation via Pkg Install Script
#Detects when an installer package executes a pre or post install script that immediately copies a file to suspicious locations on the filesystem. This activity is not common and usually indicates a malicious package attempting to install persistence or establish a working directory for malware.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence |
Rule Body
[metadata]
creation_date = "2026/01/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects when an installer package executes a pre or post install script that immediately copies a file
to suspicious locations on the filesystem. This activity is not common and usually indicates a malicious
package attempting to install persistence or establish a working directory for malware.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*", "logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious File Creation via Pkg Install Script"
references = [
"https://objective-see.org/blog/blog_0x51.html"
]
risk_score = 73
rule_id = "1955e925-6679-4535-9c1b-28ebf369f35f"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide"
]
type = "eql"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Suspicious File Creation via Pkg Install Script
macOS installer packages (.pkg) can include pre-install and post-install scripts that execute with elevated privileges during installation. While legitimate software uses these scripts for proper setup, threat actors abuse this capability to deploy malware, establish persistence, or stage additional payloads under the guise of legitimate software installation. This detection rule identifies when pkg install scripts copy executables or scripts to suspicious locations outside standard installation directories.
### Possible investigation steps
- Examine the process.args to identify the specific pkg install script path and determine which package triggered the alert.
- Review the file.path to understand where files were copied and assess whether the destination is a known malware staging location or persistence directory.
- Analyze the file.Ext.header_bytes to confirm the file type (Mach-O binary indicated by cffaedfe or cafebabe, or script files like .py, .sh, .js).
- Locate the original installer package if still available and examine its contents, including the preinstall and postinstall scripts using pkgutil --expand.
- Check the package's code signature and notarization status using pkgutil --check-signature and spctl --assess to determine if it passed Apple's security review.
- Review the download source or delivery mechanism for the installer package to understand how it reached the system.
- Search for the same package hash across other systems in the environment to identify potential widespread deployment.
### False positive analysis
- Legitimate software installers may deploy helper tools or scripts to /usr/local/bin/ or other locations. Verify the package's origin and signing status.
- Development tools and frameworks may install additional components to various directories during setup. Confirm with development teams if installations were expected.
- Enterprise software deployment may use installer scripts that deploy files to custom locations. Review with IT operations to document expected installation patterns.
- Temporary files during complex installations may appear in /tmp/ or /var/folders/ briefly. These typically don't persist after installation completes.
### Response and remediation
- Terminate any suspicious processes that were spawned by the malicious installer script.
- Remove the files that were copied to suspicious locations, including any persistence mechanisms like LaunchAgents or LaunchDaemons.
- Quarantine the original installer package for forensic analysis and submission to Apple for notarization revocation if appropriate.
- Review system logs for all actions taken during the malicious installation to identify the full scope of changes.
- Scan the system for additional malware components or persistence mechanisms that may have been deployed.
- Report the malicious package to Apple at reportaproblem.apple.com to request notarization revocation.
- Check other systems that may have installed the same package and remediate accordingly.
- Review endpoint security policies to prevent future execution of unsigned or revoked installer packages.
"""
query = '''
sequence by process.entity_id with maxspan=30s
[process where host.os.type == "macos" and event.type == "start" and process.name in ("bash", "sh", "zsh") and
process.args like~ ("/tmp/PKInstallSandbox.*/Scripts/com.*/preinstall",
"/tmp/PKInstallSandbox.*/Scripts/*/postinstall") and
process.args like ("/Users/*", "/Volumes/*") and
not process.args like~ "/Users/*/Library/Caches/*"]
[file where host.os.type == "macos" and event.action != "deletion" and process.name in ("mv", "cp") and
(file.extension in ("py", "js", "sh", "scpt", "terminal", "tcl", "app", "pkg", "dmg", "command") or
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*")) and
file.path like ("/private/etc/*", "/var/tmp/*", "/tmp/*", "/var/folders/*", "/Users/Shared/*",
"/Library/Graphics/*", "/Library/Containers/*", "/Users/*/Library/Containers/*",
"/Users/*/Library/Services/*", "/Users/*/Library/Preferences/*", "/var/root/*",
"/Library/WebServer/*", "/Library/Fonts/*", "/usr/local/bin/*") and
not file.name == "CodeResources"]
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.016"
name = "Installer Packages"
reference = "https://attack.mitre.org/techniques/T1546/016/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.entity_id.
Stage 1: process
[process where host.os.type == "macos" and event.type == "start" and process.name in ("bash", "sh", "zsh") and
process.args like~ ("/tmp/PKInstallSandbox.*/Scripts/com.*/preinstall",
"/tmp/PKInstallSandbox.*/Scripts/*/postinstall") and
process.args like ("/Users/*", "/Volumes/*") and
not process.args like~ "/Users/*/Library/Caches/*"]
Stage 2: file
[file where host.os.type == "macos" and event.action != "deletion" and process.name in ("mv", "cp") and
(file.extension in ("py", "js", "sh", "scpt", "terminal", "tcl", "app", "pkg", "dmg", "command") or
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*")) and
file.path like ("/private/etc/*", "/var/tmp/*", "/tmp/*", "/var/folders/*", "/Users/Shared/*",
"/Library/Graphics/*", "/Library/Containers/*", "/Users/*/Library/Containers/*",
"/Users/*/Library/Services/*", "/Users/*/Library/Preferences/*", "/var/root/*",
"/Library/WebServer/*", "/Library/Fonts/*", "/usr/local/bin/*") and
not file.name == "CodeResources"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.extension | in |
| field:"file.extension" kind:in |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | /Users/*/Library/Caches/* | excludes:process.args field:"process.args" value:"/Users/*/Library/Caches/*" |
file.name | eq | CodeResources | excludes:file.name field:"file.name" value:"CodeResources" |
Suspicious Kworker UID Elevation
#Monitors for the elevation of regular user permissions to root permissions through the kworker process. kworker, or kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process, and hijack the execution flow by hooking certain functions/syscalls through a rootkit in order to provide easy access to root via a special modified command.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2023/10/26"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Monitors for the elevation of regular user permissions to root permissions through the kworker process. kworker, or
kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has
been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities,
and other kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process, and
hijack the execution flow by hooking certain functions/syscalls through a rootkit in order to provide easy access to
root via a special modified command.
"""
from = "now-9m"
index = ["endgame-*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Kworker UID Elevation"
risk_score = 47
rule_id = "7dfaaa17-425c-4fe7-bd36-83705fde7c2b"
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 to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in New agent policy name. If other agent policies already exist, you can click the Existing hosts tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click Save and Continue.
- To complete the integration, select Add Elastic Agent to your hosts and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.action == "session_id_change" and process.name : "kworker*" 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 Suspicious Kworker UID Elevation
Kworker processes are integral to Linux, handling tasks like interrupts and background activities within the kernel. Adversaries may exploit these processes by disguising malicious activities as legitimate kernel operations, often using rootkits to hijack execution flow and gain root access. The detection rule identifies anomalies by monitoring for kworker processes that unexpectedly change session IDs and elevate privileges to root, signaling potential misuse.
### Possible investigation steps
- Review the process details for the kworker process with a session ID change and user ID of 0 to confirm the legitimacy of the process and its parent process.
- Check the system logs around the time of the session ID change event for any unusual activities or errors that might indicate tampering or exploitation attempts.
- Investigate any recent changes to the system, such as new software installations or updates, that could have introduced vulnerabilities or unauthorized modifications.
- Analyze the system for signs of rootkit presence, such as hidden files or processes, by using rootkit detection tools or manual inspection techniques.
- Correlate the event with other security alerts or anomalies in the network to determine if this is part of a broader attack campaign or isolated incident.
### False positive analysis
- Regular system updates or maintenance activities may trigger session ID changes in kworker processes. Users can monitor scheduled maintenance windows and exclude these time frames from triggering alerts.
- Custom kernel modules or legitimate software that interacts with kernel processes might cause kworker to change session IDs. Identify and whitelist these known modules or software to prevent false positives.
- Automated scripts or tools that require elevated privileges for legitimate tasks could inadvertently cause kworker processes to appear suspicious. Review and document these scripts, then create exceptions for their expected behavior.
- Certain system configurations or optimizations might lead to benign kworker session ID changes. Conduct a baseline analysis of normal system behavior and adjust the detection rule to accommodate these patterns without compromising security.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement by the attacker.
- Terminate the suspicious kworker process identified in the alert to stop any ongoing malicious activity.
- Conduct a thorough review of system logs and process trees to identify any additional compromised processes or indicators of rootkit installation.
- Restore the system from a known good backup if rootkit presence is confirmed, as rootkits can deeply embed themselves into the system.
- Change all credentials and keys that may have been exposed or used on the compromised system to prevent unauthorized access using stolen credentials.
- Implement enhanced monitoring and logging for kworker processes and session ID changes to detect similar activities in the future.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the potential impact on other systems."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[rule.threat.technique.subtechnique]]
id = "T1574.013"
name = "KernelCallbackTable"
reference = "https://attack.mitre.org/techniques/T1574/013/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1014"
name = "Rootkit"
reference = "https://attack.mitre.org/techniques/T1014/"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.004"
name = "Masquerade Task or Service"
reference = "https://attack.mitre.org/techniques/T1036/004/"
[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 == "linux" and event.action == "session_id_change" and process.name : "kworker*" and
user.id == "0"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"session_id_change" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"kworker*" |
user.id | eq |
| field:"user.id" kind:eq value:"0" |
Suspicious Print Spooler Point and Print DLL
#Detects attempts to exploit a privilege escalation vulnerability (CVE-2020-1030) related to the print spooler service. Exploitation involves chaining multiple primitives to load an arbitrary DLL into the print spooler process running as SYSTEM.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation | |
| Stealth | |
| Defense Impairment |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2020/11/26"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender"]
maturity = "production"
updated_date = "2026/05/03"
[rule]
author = ["Elastic"]
description = """
Detects attempts to exploit a privilege escalation vulnerability (CVE-2020-1030) related to the print spooler service.
Exploitation involves chaining multiple primitives to load an arbitrary DLL into the print spooler process running as
SYSTEM.
"""
from = "now-9m"
index = [
"logs-endpoint.events.registry-*",
"endgame-*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-m365_defender.event-*",
]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Print Spooler Point and Print DLL"
references = [
"https://www.accenture.com/us-en/blogs/cyber-defense/discovering-exploiting-shutting-down-dangerous-windows-print-spooler-vulnerability",
"https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES/blob/master/Privilege%20Escalation/privesc_sysmon_cve_20201030_spooler.evtx",
"https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2020-1030",
]
risk_score = 73
rule_id = "bd7eefee-f671-494e-98df-f01daf9e5f17"
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Data Source: Elastic Endgame",
"Use Case: Vulnerability",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Resources: Investigation Guide",
"Data Source: SentinelOne",
"Data Source: Microsoft Defender XDR",
]
type = "eql"
query = '''
sequence by host.id with maxspan=30s
[registry where host.os.type == "windows" and
registry.value : "SpoolDirectory" and
registry.path : "*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\*\\SpoolDirectory" and
registry.data.strings : "C:\\Windows\\System32\\spool\\drivers\\x64\\4"]
[registry where host.os.type == "windows" and
registry.value : "Module" and
registry.path : "*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\*\\CopyFiles\\Payload\\Module" and
registry.data.strings : "C:\\Windows\\System32\\spool\\drivers\\x64\\4\\*"]
'''
note = """## Triage and analysis
### Investigating Suspicious Print Spooler Point and Print DLL
#### Possible investigation steps
- Do the source registry events describe one printer object?
- Why: sequence alerts joined only on `host.id` can omit stage-specific registry and writer fields; recover member events before interpreting the grouped alert.
- Focus: compare the printer segment in `registry.path`, `registry.value`, and `registry.data.strings`; keep `user.id` and any `process.entity_id` pivots.
- Implication: escalate when one printer key sets SpoolDirectory to "C:\\Windows\\System32\\spool\\drivers\\x64\\4" then CopyFiles\\Payload\\Module under that path; lower concern only when recovery breaks the same-printer chain or value match.
- Which process and user wrote the values, and does context fit printer administration?
- Focus: source-event writer context: `user.id`, `process.executable`, `process.command_line`, `process.parent.executable`, and recovered `process.entity_id`.
- Implication: escalate when reg.exe, rundll32.exe, a scripting host, a user-writable binary, or an unexpected interactive user wrote the values; lower concern when writer identity, parentage, and service context match the same confirmed driver deployment.
- What DLL path did Module name, and was it staged?
- Focus: recovered Module `registry.data.strings`; if file telemetry exists, exact-path `file.path`, `file.Ext.original.path`, `file.origin_url`, and `file.Ext.windows.zone_identifier`. Missing file telemetry leaves staging unresolved, not benign.
- Implication: escalate when the path names a newly written, renamed, internet-marked, or script-staged DLL in the spool drivers tree; lower concern when the exact path is a stable signed printer-driver package tied to the recovered printer object and writer workflow.
- Did Print Spooler or print isolation consume the module?
- Why: CVE-2020-1030 abuse becomes higher impact when the CopyFiles\\Payload\\Module value is loaded or spooler restart behavior forces the changed configuration into effect.
- Focus: in library or process telemetry, check spoolsv.exe or PrintIsolationHost.exe loading the recovered path with `dll.path`, `dll.hash.sha256`, `dll.code_signature.subject_name`, and `dll.code_signature.trusted`. $investigate_1
- Hint: pivot on the recovered Module path because the sequence alert may not preserve that value; spooler termination or restart around the writes can be a force-load clue.
- Implication: escalate immediately when spooler loads the recovered DLL, restarts unexpectedly, or shows abnormal child activity soon after the writes; absent load telemetry does not clear a matching registry chain.
- If suspicious or unresolved, does the pattern appear beyond this alert?
- Focus: related alerts for `host.id`, then exact matches for recovered `registry.data.strings`, printer `registry.path`, or `dll.hash.sha256` across other hosts when available. $investigate_0
- Implication: broaden response when the same module path, DLL hash, printer-object pattern, or spooler-abuse alert appears on unrelated hosts; keep scope local when the pattern stays confined to the same confirmed driver workflow.
- What disposition do registry chain, writer, payload, spooler, and scope evidence support?
- Focus: decide from same-printer registry stages, writer identity, DLL staging/load, workflow fit, and scope: escalate suspicious or unresolved chains, close only when telemetry cleanly aligns with one signed driver or print-management workflow, and preserve artifacts when evidence is mixed or incomplete.
### False positive analysis
- Recognized signed printer-driver installation, print-management, imaging, or endpoint-build workflows can update SpoolDirectory and CopyFiles\\Payload\\Module or stage spool-directory drivers. Confirm recovered `registry.path`, exact `registry.data.strings`, stable signed DLL identity, writer `process.executable`, parent workflow, current-case `host.id`, and any spooler follow-on all point to the same driver or management workflow without ad hoc scripting, unsigned payloads, or suspicious child processes. Change or deployment records may corroborate; prior-alert recurrence can scope exceptions but must not substitute for current-case telemetry.
- Build exceptions only from the minimum confirmed workflow pattern: `host.id`, recovered printer object from `registry.path`, exact recovered Module path, stable DLL identity, and the confirmed writer or deployment process. Avoid exceptions on the spool drivers directory alone, the printer name alone, or spoolsv.exe activity alone.
### Response and remediation
- If confirmed benign, record `host.id`, the recovered printer object, exact Module path, stable DLL identity, and deployment workflow that justified closure before reversing temporary containment. Create an exception only from that exact confirmed workflow pattern; use prior alerts to narrow scope, not to prove benignity.
- If suspicious but unconfirmed, preserve the Timeline member events, exact `registry.path` and `registry.data.strings`, exported affected registry keys, recovered DLL file if present, file or library hashes, writer `process.executable`, user context, and any spoolsv.exe or PrintIsolationHost.exe follow-on evidence before containment. Apply reversible containment first, such as restricting remote printer administration, disabling Point and Print exposure, or pausing nonessential printing on the affected host.
- If confirmed malicious, preserve the DLL if feasible, export the affected printer keys, and retain related spoolsv.exe or PrintIsolationHost.exe process and library telemetry before containment. Then use endpoint response to isolate the host when registry-chain, payload, or spooler-side evidence shows malicious activity and host criticality allows it. Review other hosts for the same recovered DLL path, DLL hash, or printer-object pattern before stopping spoolsv.exe, deleting the DLL, restoring registry values, and removing the mechanism that staged the payload.
- Post-incident hardening: apply the Microsoft fix for CVE-2020-1030, restrict Point and Print and printer-driver installation rights where feasible, disable the Print Spooler service on hosts that do not need it, retain registry, file, and library telemetry for spooler abuse, and document confirmed printer-object and DLL patterns for future triage.
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [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.id",
"host.name",
"user.id",
"user.name",
"user.domain"
]
[transform]
[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
[
{ excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
]
]
relativeFrom = "now-48h/h"
relativeTo = "now"
[[transform.investigate]]
label = "Spooler or print isolation loads on the host"
description = ""
providers = [
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "library", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.name", queryType = "phrase", value = "spoolsv.exe", valueType = "string" }
],
[
{ excluded = false, field = "event.category", queryType = "phrase", value = "library", valueType = "string" },
{ excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
{ excluded = false, field = "process.name", queryType = "phrase", value = "PrintIsolationHost.exe", valueType = "string" }
]
]
relativeFrom = "now-1h"
relativeTo = "now"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by host.id.
Stage 1: registry
[registry where host.os.type == "windows" and
registry.value : "SpoolDirectory" and
registry.path : "*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\*\\SpoolDirectory" and
registry.data.strings : "C:\\Windows\\System32\\spool\\drivers\\x64\\4"]
Stage 2: registry
[registry where host.os.type == "windows" and
registry.value : "Module" and
registry.path : "*\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\*\\CopyFiles\\Payload\\Module" and
registry.data.strings : "C:\\Windows\\System32\\spool\\drivers\\x64\\4\\*"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
registry.data.strings | wildcard |
| field:"Details" kind:wildcard |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard |
registry.value | wildcard |
| field:"registry_value_name" kind:wildcard |
Suspicious Ruby Command Execution
#This rule monitors for suspicious Ruby command executions by detecting the start of a Ruby process with a command line argument that contains keywords commonly used by attackers to execute malicious code. These command line arguments include operations to execute code, create subprocesses, and encode or decode data.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[rule]
description = """
This rule monitors for suspicious Ruby command executions by detecting the start of a Ruby process with a command line
argument that contains keywords commonly used by attackers to execute malicious code. These command line arguments
include operations to execute code, create subprocesses, and encode or decode data.
"""
id = "a3a3b49c-c135-4959-8a1b-33392bb60991"
license = "Elastic License v2"
name = "Suspicious Ruby Command Execution"
os_list = ["linux"]
version = "1.0.10"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
process.executable like~ ("/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*") and
process.args like "-e*" and process.command_line like~ (
"*system(*", "*exec(*", "*IO.popen(*", "*Open3.popen3(*", "*spawn(*", "*eval(*", "*load(*",
"*Marshal.load(*", "*Fiddle.dlopen(*", "*Fiddle::Function.new(*", "*base64*", "*zlib*",
"*net/http*", "*socket*", "*open-uri*", "*pack(*", "*unpack(*"
) and
not (
process.working_directory like~ ("/etc/puppet/rack", "/builds/*", "/var/tmp/portage/*") or
process.command_line like ("*rails_env*", "*pid*Process.spawn*ssh*StrictHostKeyChecking*ServerAliveInterval*ServerAliveCountMax*") or
process.command_line == "ruby -e require \"yaml\"; YAML.safe_load(File.read(\".gitlab-ci.yml\"), aliases: true)" or
process.parent.args like "/home/*/.vscode-server/cli/servers/Stable-*" or
process.parent.command_line in ("emacs --daemon", "runc init") or
process.parent.name in ("emacs-gtk", "mmonit", "make") or
(process.name == "ruby" and process.parent.name == "ruby") or
process.parent.executable in ("/opt/gitlab/embedded/bin/gitaly", "/usr/bin/runc") or
(
process.working_directory == "/workspace" and
process.parent.executable like ("/home/*/dev/*/rollcage", "/tmp/rollcage-target/debug/rollcage")
) or
process.parent.executable like "*/.aimee-code/bin/*"
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.executable != null and
process.executable like~ ("/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*") and
process.args like "-e*" and process.command_line like~ (
"*system(*", "*exec(*", "*IO.popen(*", "*Open3.popen3(*", "*spawn(*", "*eval(*", "*load(*",
"*Marshal.load(*", "*Fiddle.dlopen(*", "*Fiddle::Function.new(*", "*base64*", "*zlib*",
"*net/http*", "*socket*", "*open-uri*", "*pack(*", "*unpack(*"
) and
not (
process.working_directory like~ ("/etc/puppet/rack", "/builds/*", "/var/tmp/portage/*") or
process.command_line like ("*rails_env*", "*pid*Process.spawn*ssh*StrictHostKeyChecking*ServerAliveInterval*ServerAliveCountMax*") or
process.command_line == "ruby -e require \"yaml\"; YAML.safe_load(File.read(\".gitlab-ci.yml\"), aliases: true)" or
process.parent.args like "/home/*/.vscode-server/cli/servers/Stable-*" or
process.parent.command_line in ("emacs --daemon", "runc init") or
process.parent.name in ("emacs-gtk", "mmonit", "make") or
(process.name == "ruby" and process.parent.name == "ruby") or
process.parent.executable in ("/opt/gitlab/embedded/bin/gitaly", "/usr/bin/runc") or
(
process.working_directory == "/workspace" and
process.parent.executable like ("/home/*/dev/*/rollcage", "/tmp/rollcage-target/debug/rollcage")
) or
process.parent.executable like "*/.aimee-code/bin/*"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"-e*" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
Unusual Host Name for Okta Privileged Operations Detected
#A machine learning job has identified a user performing privileged operations in Okta from an uncommon device, indicating potential privileged access activity. This could signal a compromised account, an attacker using stolen credentials, or an insider threat leveraging an unauthorized device to escalate privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2025/02/18"
integration = ["pad", "okta"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job has identified a user performing privileged operations in Okta from an uncommon device,
indicating potential privileged access activity. This could signal a compromised account, an attacker using stolen
credentials, or an insider threat leveraging an unauthorized device to escalate privileges.
"""
from = "now-1h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "pad_okta_rare_host_name_by_user_ea"
name = "Unusual Host Name for Okta Privileged Operations Detected"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Unusual Host Name for Okta Privileged Operations Detected
Okta is a widely used identity management service that facilitates secure user authentication and access control. Adversaries may exploit Okta by using stolen credentials or unauthorized devices to perform privileged operations, potentially leading to privilege escalation. The detection rule leverages machine learning to identify anomalies in host names associated with privileged actions, flagging unusual device usage that may indicate compromised accounts or insider threats.
### Possible investigation steps
- Review the alert details to identify the specific user and host name involved in the unusual activity.
- Check the user's recent login history and device usage patterns in Okta to determine if the host name has been used before or if it is indeed uncommon.
- Investigate the geographical location and IP address associated with the unusual host name to assess if it aligns with the user's typical access patterns.
- Examine any recent changes to the user's account, such as password resets or modifications to multi-factor authentication settings, to identify potential signs of compromise.
- Correlate the alert with other security logs and alerts to identify any related suspicious activities or patterns that could indicate a broader attack or insider threat.
- Contact the user to verify if they recognize the device and host name, and if they were performing the privileged operations at the time of the alert.
- If unauthorized access is confirmed, follow incident response procedures to secure the account, such as resetting credentials and reviewing access permissions.
### False positive analysis
- Users accessing Okta from new or temporary devices may trigger false positives. Regularly update the list of approved devices to include these new devices if they are legitimate.
- Employees traveling or working remotely might use different devices or networks, causing alerts. Implement a process to verify and whitelist these devices when travel or remote work is expected.
- IT staff performing legitimate administrative tasks from shared or uncommon devices can be mistaken for threats. Maintain a log of such activities and cross-reference with alerts to identify and exclude these benign actions.
- Changes in device naming conventions or system upgrades can result in unusual host names. Ensure that any planned changes are communicated and documented to adjust the detection parameters accordingly.
- Regularly review and refine the machine learning model's training data to minimize false positives by incorporating feedback from security teams on legitimate activities that were incorrectly flagged.
### Response and remediation
- Immediately isolate the device associated with the unusual host name from the network to prevent further unauthorized access or potential lateral movement.
- Revoke any active sessions and reset the credentials for the affected Okta account to prevent further unauthorized access.
- Conduct a thorough review of recent privileged operations performed by the affected account to identify any unauthorized changes or access.
- Notify the security operations team and relevant stakeholders about the potential compromise for further investigation and monitoring.
- Implement additional monitoring on the affected account and similar privileged accounts to detect any further suspicious activities.
- Review and update access controls and policies to ensure that only authorized devices can perform privileged operations in Okta.
- Consider enabling multi-factor authentication (MFA) for all privileged accounts to add an additional layer of security against unauthorized access."""
references = [
"https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
"https://docs.elastic.co/en/integrations/pad",
]
risk_score = 21
rule_id = "8c9ae3e2-f0b1-4b2c-9eba-bd87c2db914f"
setup = """## Setup
The rule requires the Privileged Access Detection integration assets to be installed, as well as Okta logs collected by integrations such as Okta.
### Privileged Access Detection Setup
The Privileged Access Detection integration detects privileged access activity by identifying abnormalities in Windows, Linux and Okta events. Anomalies are detected using Elastic's Anomaly Detection feature.
#### Prerequisite Requirements:
- Fleet is required for Privileged Access Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Okta events collected by [Okta](https://docs.elastic.co/en/integrations/okta) integration.
- To add the Okta integration to an Elastic Agent policy, refer to [this](https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html) guide.
#### The following steps should be executed to install assets associated with the Privileged Access Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Privileged Access Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
"Data Source: Okta",
"Use Case: Privileged Access Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
Windows API Call via Indirect Random Syscall
#Identifies calls to Windows memory APIs from unusual modules or NTDLL offsets. This may indicate an attempt to bypass API monitoring by jumping directly to syscall instructions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies calls to Windows memory APIs from unusual modules or NTDLL offsets. This may indicate an attempt to bypass
API monitoring by jumping directly to syscall instructions.
"""
id = "9bc5d4cd-5748-4425-a4f3-7a704a11029d"
license = "Elastic License v2"
name = "Windows API Call via Indirect Random Syscall"
os_list = ["windows"]
version = "1.0.10"
query = '''
api where
process.Ext.api.name : ("VirtualAlloc", "VirtualAllocEx", "VirtualProtect", "VirtualProtectEx", "MapViewOfFile", "MapViewOfFile2", "WriteProcessMemory") and process.executable != null and
process.thread.Ext.call_stack_summary :("ntdll.dll|*", "win32*", "kernel*") and
process.thread.Ext.call_stack_final_user_module.path != null and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "?:\\windows\\system32\\ntdll.dll!*+0x14") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info:
("*ntdll.dll!*ProtectVirtualMemory*",
"*ntdll.dll!*MapViewOfSection*",
"*ntdll.dll!*AllocateVirtualMemory*",
"*ntdll.dll!*CreateUserProcess*",
"*ntdll.dll!*CreateProcess*",
"*ntdll.dll!*DeviceIoControlFile*",
"*ntdll.dll!*AssignProcessToJobObject*",
"*ntdll.dll!ZwQuerySystemInformation*",
"*ntdll.dll!NtFsControlFile*",
"*ntdll.dll!ZwFsControlFile*",
"*ntdll.dll!ZwCancelIoFile*",
"*ntdll.dll!NtQuerySection*",
"*ntdll.dll!*CreateThread*",
"*kernelbase.dll!SetProcessDynamicEnforcedCetCompatibleRanges*",
"*ntdll.dll!RtlCaptureContext*",
"*kernelbase.dll!VirtualProtect*",
"*ntdll.dll!LdrShutdownProcess*",
"*ntdll.dll!NtdllDialogWndProc_W*",
"*ntdll.dll!*WriteRequestData*",
"*ntdll.dll!KiUserInvertedFunctionTable*",
"*ntdll.dll!*DeleteAtom*",
"*ntdll.dll!*QuerySection*",
"*ntdll.dll!*TerminateThread*",
"*kernelbase.dll*!CreateProcess*",
"*ntdll.dll*!*AlpcOpenSenderProcess*",
"*ntdll.dll*!*AlpcCreateResourceReserve*",
"ntdll.dll*!*IsProcessInJob*",
"*ntdll.dll*!*SetInformationFile*",
"*ntdll.dll*!NtSetEvent*",
"*ntdll.dll*!RtlGetNativeSystemInformation*",
"*ntdll.dll*!KiUserApcDispatcher*",
"*ntdll.dll!LdrLoadDll*",
"*ntdll.dll*!NtReadRequestData*",
"*ntdll.dll!RtlVirtualUnwind*",
"\\device\\+0*",
"*ntdll.dll+0x*",
"*ntdll.dll*!*CreateLowBoxToken*",
"*kernelbase.dll!DeviceIoControl*",
"*ntdll.dll!KiRaiseUserExceptionDispatcher*",
"*ntdll.dll!*IsProcessInJob*",
"*ntdll.dll!*PowerInformation*",
"*\\ntdll.dll!NtWriteVirtualMemory*",
"*\\ntdll.dll!ZwWriteVirtualMemory*",
"*\\windows\\winsxs\\temp\\pendingdeletes\\$$deletemekernelbase.dll*!WriteProcessMemory*",
"*\\kernelbase.dll+0x*",
"*kernelbase.dll!TestReport*",
"*\\kernelbase.dll!WriteProcessMemory*",
"*kernelbase.dll!RegEnumValueW*",
"*\\ntdll.dll!ZwOpenProcess*",
"*\\ntdll.dll!ZwQueryDefaultLocale*",
"*\\kernelbase.dll!CreateProcessInternalW*",
"*ntdll.dll!ZwWaitForSingleObject*",
"*ntdll.dll!NtIsProcessInJob*",
"*ntdll.dll!ZwDeviceIoControlFile*",
"*ntdll.dll!ZwQueryDirectoryFile*",
"*ntdll.dll!ZwDelayExecution*",
"*ntdll.dll!ZwAcceptConnectPort*",
"*kernelbase.dll!VirtualAllocExNuma*",
"*ntdll.dll!ZwQueryDefaultUILanguage*",
"*\\ntdll.dll!NtWaitForKeyedEvent*",
"*\\kernelbase.dll!OpenProcess*",
"*\\kernelbase.dll!GetFileSize*",
"*\\ntdll.dll!NtWaitForKeyedEvent*",
"*\\kernelbase.dll!EqualDomainSid*",
"*\\kernelbase.dll!LoadLibrary*",
"*\\rpcrt4.dll!I_RpcSend*",
"*\\kernelbase.dll!GetPhysicallyInstalledSystemMemory*",
"*\\kernelbase.dll!CallbackMayRunLong*",
"*\\kernelbase.dll!RegisterWaitForSingleObjec*",
"*\\kernelbase.dll!GetModuleFileName*",
"*\\ntdll.dll!NtReleaseWorkerFactoryWorker*",
"*\\ntdll.dll!NtSetInformationWorkerFactory*",
"*\\kernelbase.dll!AddExtensionProgId*",
"*\\ntdll.dll!NtAllocateReserveObject*",
"*\\ntdll.dll!ZwRestoreKey*",
"*\\kernelbase.dll!ProcessIdToSessionId*",
"c:\\windows\\system32\\ntdll.dll!NtOpenSection*",
"c:\\windows\\system32\\ntdll.dll!NtImpersonateClientOfPort*",
"*\\ntdll.dll!NtReleaseMutant+0x14",
"*\\ntdll.dll!NtQueryKey+0x14*",
"*\\ntdll.dll!NtQueryKey+0x14*",
"*\\ntdll.dll!NtEnumerateKey+0x14*",
"*\\ntdll.dll!NtQueryTimer+0x14*",
"*\\ntdll.dll!ZwDuplicateToken+0x14*",
"*\\ntdll.dll!NtDuplicateToken*",
"*\\ntdll.dll!NtdllDefWindowProc_W*",
"*\\ntdll.dll!NtEnumerateKey+0x14*")) and
not (process.thread.Ext.call_stack_summary : "ntdll.dll|Unknown|ntdll.dll*" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "*ntdll.dll!*TestAlert*")) and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Unknown", "Kernel|*", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "clr.dll", "coreclr.dll") and
not process.thread.Ext.call_stack_final_user_module.path like ("c:\\windows\\system32\\umppc*.dll", "c:\\windows\\syswow64\\ntdll.dll", "c:\\windows\\syswow64\\windows.storage.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature,
$entry, $entry.subject_name: ("Mozilla Corporation", "Google LLC", "Microsoft Windows Hardware Compatibility Publisher", "Activision Publishing Inc", "baramundi software GmbH", "Matrix42 GmbH") and $entry.status == "trusted") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("47178fac2c375587e1d971b9a095167e573985cbdf72ea8f32113f0b90f26b22",
"d1e49681e09cedf8a5751538273bc69d2c78d50469e8bc95203fc2643fa17a5f",
"00e8784a6e1e1dce13d49e2e978adaccfed74f9846d43feb1ad94c1aff52dfc3",
"574d3ef726c6ba1f7af31823c3820af7d86892b7e760de6817dbc3be0a09fbc4",
"7280f4d256bde0d274492ec489a31d3e7c43e8747cc0dd726dce8fe26b39acaf",
"1634d01728fe36029198587a173406ac9120a71101ff3d88dce8adcfbb1ec739",
"574d3ef726c6ba1f7af31823c3820af7d86892b7e760de6817dbc3be0a09fbc4",
"3be418a691f37d8648e0821bdb1c5fda99bf6f9dca9da4e6c4b5fa675788692f")
'''
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 = "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 : ("VirtualAlloc", "VirtualAllocEx", "VirtualProtect", "VirtualProtectEx", "MapViewOfFile", "MapViewOfFile2", "WriteProcessMemory") and process.executable != null and
process.thread.Ext.call_stack_summary :("ntdll.dll|*", "win32*", "kernel*") and
process.thread.Ext.call_stack_final_user_module.path != null and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "?:\\windows\\system32\\ntdll.dll!*+0x14") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info:
("*ntdll.dll!*ProtectVirtualMemory*",
"*ntdll.dll!*MapViewOfSection*",
"*ntdll.dll!*AllocateVirtualMemory*",
"*ntdll.dll!*CreateUserProcess*",
"*ntdll.dll!*CreateProcess*",
"*ntdll.dll!*DeviceIoControlFile*",
"*ntdll.dll!*AssignProcessToJobObject*",
"*ntdll.dll!ZwQuerySystemInformation*",
"*ntdll.dll!NtFsControlFile*",
"*ntdll.dll!ZwFsControlFile*",
"*ntdll.dll!ZwCancelIoFile*",
"*ntdll.dll!NtQuerySection*",
"*ntdll.dll!*CreateThread*",
"*kernelbase.dll!SetProcessDynamicEnforcedCetCompatibleRanges*",
"*ntdll.dll!RtlCaptureContext*",
"*kernelbase.dll!VirtualProtect*",
"*ntdll.dll!LdrShutdownProcess*",
"*ntdll.dll!NtdllDialogWndProc_W*",
"*ntdll.dll!*WriteRequestData*",
"*ntdll.dll!KiUserInvertedFunctionTable*",
"*ntdll.dll!*DeleteAtom*",
"*ntdll.dll!*QuerySection*",
"*ntdll.dll!*TerminateThread*",
"*kernelbase.dll*!CreateProcess*",
"*ntdll.dll*!*AlpcOpenSenderProcess*",
"*ntdll.dll*!*AlpcCreateResourceReserve*",
"ntdll.dll*!*IsProcessInJob*",
"*ntdll.dll*!*SetInformationFile*",
"*ntdll.dll*!NtSetEvent*",
"*ntdll.dll*!RtlGetNativeSystemInformation*",
"*ntdll.dll*!KiUserApcDispatcher*",
"*ntdll.dll!LdrLoadDll*",
"*ntdll.dll*!NtReadRequestData*",
"*ntdll.dll!RtlVirtualUnwind*",
"\\device\\+0*",
"*ntdll.dll+0x*",
"*ntdll.dll*!*CreateLowBoxToken*",
"*kernelbase.dll!DeviceIoControl*",
"*ntdll.dll!KiRaiseUserExceptionDispatcher*",
"*ntdll.dll!*IsProcessInJob*",
"*ntdll.dll!*PowerInformation*",
"*\\ntdll.dll!NtWriteVirtualMemory*",
"*\\ntdll.dll!ZwWriteVirtualMemory*",
"*\\windows\\winsxs\\temp\\pendingdeletes\\$$deletemekernelbase.dll*!WriteProcessMemory*",
"*\\kernelbase.dll+0x*",
"*kernelbase.dll!TestReport*",
"*\\kernelbase.dll!WriteProcessMemory*",
"*kernelbase.dll!RegEnumValueW*",
"*\\ntdll.dll!ZwOpenProcess*",
"*\\ntdll.dll!ZwQueryDefaultLocale*",
"*\\kernelbase.dll!CreateProcessInternalW*",
"*ntdll.dll!ZwWaitForSingleObject*",
"*ntdll.dll!NtIsProcessInJob*",
"*ntdll.dll!ZwDeviceIoControlFile*",
"*ntdll.dll!ZwQueryDirectoryFile*",
"*ntdll.dll!ZwDelayExecution*",
"*ntdll.dll!ZwAcceptConnectPort*",
"*kernelbase.dll!VirtualAllocExNuma*",
"*ntdll.dll!ZwQueryDefaultUILanguage*",
"*\\ntdll.dll!NtWaitForKeyedEvent*",
"*\\kernelbase.dll!OpenProcess*",
"*\\kernelbase.dll!GetFileSize*",
"*\\ntdll.dll!NtWaitForKeyedEvent*",
"*\\kernelbase.dll!EqualDomainSid*",
"*\\kernelbase.dll!LoadLibrary*",
"*\\rpcrt4.dll!I_RpcSend*",
"*\\kernelbase.dll!GetPhysicallyInstalledSystemMemory*",
"*\\kernelbase.dll!CallbackMayRunLong*",
"*\\kernelbase.dll!RegisterWaitForSingleObjec*",
"*\\kernelbase.dll!GetModuleFileName*",
"*\\ntdll.dll!NtReleaseWorkerFactoryWorker*",
"*\\ntdll.dll!NtSetInformationWorkerFactory*",
"*\\kernelbase.dll!AddExtensionProgId*",
"*\\ntdll.dll!NtAllocateReserveObject*",
"*\\ntdll.dll!ZwRestoreKey*",
"*\\kernelbase.dll!ProcessIdToSessionId*",
"c:\\windows\\system32\\ntdll.dll!NtOpenSection*",
"c:\\windows\\system32\\ntdll.dll!NtImpersonateClientOfPort*",
"*\\ntdll.dll!NtReleaseMutant+0x14",
"*\\ntdll.dll!NtQueryKey+0x14*",
"*\\ntdll.dll!NtQueryKey+0x14*",
"*\\ntdll.dll!NtEnumerateKey+0x14*",
"*\\ntdll.dll!NtQueryTimer+0x14*",
"*\\ntdll.dll!ZwDuplicateToken+0x14*",
"*\\ntdll.dll!NtDuplicateToken*",
"*\\ntdll.dll!NtdllDefWindowProc_W*",
"*\\ntdll.dll!NtEnumerateKey+0x14*")) and
not (process.thread.Ext.call_stack_summary : "ntdll.dll|Unknown|ntdll.dll*" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "*ntdll.dll!*TestAlert*")) and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Unknown", "Kernel|*", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "clr.dll", "coreclr.dll") and
not process.thread.Ext.call_stack_final_user_module.path like ("c:\\windows\\system32\\umppc*.dll", "c:\\windows\\syswow64\\ntdll.dll", "c:\\windows\\syswow64\\windows.storage.dll") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature,
$entry, $entry.subject_name: ("Mozilla Corporation", "Google LLC", "Microsoft Windows Hardware Compatibility Publisher", "Activision Publishing Inc", "baramundi software GmbH", "Matrix42 GmbH") and $entry.status == "trusted") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("47178fac2c375587e1d971b9a095167e573985cbdf72ea8f32113f0b90f26b22",
"d1e49681e09cedf8a5751538273bc69d2c78d50469e8bc95203fc2643fa17a5f",
"00e8784a6e1e1dce13d49e2e978adaccfed74f9846d43feb1ad94c1aff52dfc3",
"574d3ef726c6ba1f7af31823c3820af7d86892b7e760de6817dbc3be0a09fbc4",
"7280f4d256bde0d274492ec489a31d3e7c43e8747cc0dd726dce8fe26b39acaf",
"1634d01728fe36029198587a173406ac9120a71101ff3d88dce8adcfbb1ec739",
"574d3ef726c6ba1f7af31823c3820af7d86892b7e760de6817dbc3be0a09fbc4",
"3be418a691f37d8648e0821bdb1c5fda99bf6f9dca9da4e6c4b5fa675788692f")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | wildcard |
| field:"process.Ext.api.name" kind:wildcard |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.thread.Ext.call_stack_final_user_module.path | is_not_null | field:"process.thread.Ext.call_stack_final_user_module.path" kind:is_not_null | |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.thread.Ext.call_stack_summary | starts_with | ntdll.dll|Unknown|ntdll.dll | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|Unknown|ntdll.dll" |
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature | |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | in | 00e8784a6e1e1dce13d49e2e978adaccfed74f9846d43feb1ad94c1aff52dfc3, 1634d01728fe36029198587a173406ac9120a71101ff3d88dce8adcfbb1ec739, 3be418a691f37d8648e0821bdb1c5fda99bf6f9dca9da4e6c4b5fa675788692f, 47178fac2c375587e1d971b9a095167e573985cbdf72ea8f32113f0b90f26b22, 574d3ef726c6ba1f7af31823c3820af7d86892b7e760de6817dbc3be0a09fbc4, 7280f4d256bde0d274492ec489a31d3e7c43e8747cc0dd726dce8fe26b39acaf, d1e49681e09cedf8a5751538273bc69d2c78d50469e8bc95203fc2643fa17a5f | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
process.thread.Ext.call_stack_final_user_module.name | in | Kernel, Unknown, clr.dll, coreclr.dll | excludes:process.thread.Ext.call_stack_final_user_module.name |
process.thread.Ext.call_stack_final_user_module.path | wildcard | c:\windows\system32\umppc*.dll, c:\windows\syswow64\ntdll.dll, c:\windows\syswow64\windows.storage.dll | excludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\system32\umppc*.dll" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\syswow64\ntdll.dll" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\syswow64\windows.storage.dll" |
process.thread.Ext.call_stack_final_user_module.protection_provenance | wildcard | Kernel, Unknown, Kernel|*, Undetermined | excludes:process.thread.Ext.call_stack_final_user_module.protection_provenance |
Windows Script Executing PowerShell
#Identifies a PowerShell process launched by either cscript.exe or wscript.exe. Observing Windows scripting processes executing a PowerShell script, may be indicative of malicious activity.
MITRE ATT&CK Coverage
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2020/02/18"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies a PowerShell process launched by either cscript.exe or wscript.exe. Observing Windows scripting processes
executing a PowerShell script, may be indicative of malicious activity.
"""
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.process-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Windows Script Executing PowerShell"
note = """## Triage and analysis
### Investigating Windows Script Executing PowerShell
The Windows Script Host (WSH) is an Windows automation technology, which is ideal for non-interactive scripting needs, such as logon scripting, administrative scripting, and machine automation.
Attackers commonly use WSH scripts as their initial access method, acting like droppers for second stage payloads, but can also use them to download tools and utilities needed to accomplish their goals.
This rule looks for the spawn of the `powershell.exe` process with `cscript.exe` or `wscript.exe` as its parent process.
#### Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate commands executed by the spawned PowerShell process.
- If unsigned files are found on the process tree, retrieve them and determine if they are malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Determine how the script file was delivered (email attachment, dropped by other processes, etc.).
- Investigate other alerts associated with the user/host during the past 48 hours.
### False positive analysis
- The usage of these script engines by regular users is unlikely. In the case of authorized benign true positives (B-TPs), exceptions can be added.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- If the malicious file was delivered via phishing:
- Block the email sender from sending future emails.
- Block the malicious web pages.
- Remove emails from the sender from mailboxes.
- Consider improvements to the security awareness program.
- Reimage the host operating system and restore compromised files to clean versions.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
"""
references = ["https://www.elastic.co/security-labs/operation-bleeding-bear"]
risk_score = 21
rule_id = "f545ff26-3c94-4fd0-bd33-3c7f95a3a0fc"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Execution",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : ("cscript.exe", "wscript.exe") and process.name : "powershell.exe" and
not (
process.parent.name : "wscript.exe" and
process.parent.args : "?:\\ProgramData\\intune-drive-mapping-generator\\IntuneDriveMapping-VBSHelper.vbs" and
process.parent.args : "?:\\ProgramData\\intune-drive-mapping-generator\\DriveMapping.ps1"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[rule.threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[rule.threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.parent.name : ("cscript.exe", "wscript.exe") and process.name : "powershell.exe" and
not (
process.parent.name : "wscript.exe" and
process.parent.args : "?:\\ProgramData\\intune-drive-mapping-generator\\IntuneDriveMapping-VBSHelper.vbs" and
process.parent.args : "?:\\ProgramData\\intune-drive-mapping-generator\\DriveMapping.ps1"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"powershell.exe" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.args | eq | ?:\ProgramData\intune-drive-mapping-generator\DriveMapping.ps1 | excludes:process.parent.args field:"process.parent.args" value:"?:\ProgramData\intune-drive-mapping-generator\DriveMapping.ps1" |
process.parent.args | eq | ?:\ProgramData\intune-drive-mapping-generator\IntuneDriveMapping-VBSHelper.vbs | excludes:process.parent.args field:"process.parent.args" value:"?:\ProgramData\intune-drive-mapping-generator\IntuneDriveMapping-VBSHelper.vbs" |
process.parent.name | eq | wscript.exe | excludes:process.parent.name field:"process.parent.name" value:"wscript.exe" |