Detection rules › Elastic

Elastic rules: 34

RuleSeverity
Attempt to Hide Files via Registry Modification
AWS CloudTrail Log Createdlow
AWS ECR Repository or Registry Policy Granted Public Accessmedium
AWS IAM AdministratorAccess Policy Attached to Userhigh
AWS KMS Imported Key Material Deletedmedium
AWS Systems Manager SecureString Parameter Request with Decryption Flagmedium
Evasion via Multiple Memory Section Mapping
External Alertsmedium
File or Directory Deletion Commandlow
First Time Python Spawned a Shell on Hostmedium
GKE Client Certificate Signing Request Created or Approvedmedium
Google Workspace Admin Role Assigned to a User or Grouphigh
Google Workspace Drive Encryption Key(s) Accessed from Anonymous Userhigh
Ingress Tool Transfer via INET Cache
M365 Identity OAuth Flow by User Sign-in to Device Registrationhigh
Newly Observed RC4 Kerberos Service Ticket Requestmedium
Persistence via Scheduled Job Creationmedium
Potential Command and Control via Windows Scripts
Potential Meterpreter Reverse Shellhigh
Potential Network Scan Executed From Hostmedium
Potential PowerShell Obfuscation via String Reorderingmedium
Potential Proxy Execution via PHP
Potential Redis CONFIG SET Cron Directory Persistence (RedisRaider)high
Sensitive File Access - SSH Saved Keys
Shared Object Load via LoLBinmedium
Spike in Special Privilege Use Eventslow
Stack Spoofing via ROP Gadget for DLL Load
Suspicious Archive Creation via Ditto
Suspicious Child Execution via Web Servermedium
Suspicious Executable File Creation
Suspicious File Renamed via SMBhigh
Suspicious Java Class File Created in PaperCut Server Librarycritical
Suspicious JavaScript Execution via Deno
Suspicious Kernel32 Memory Protection
Suspicious Microsoft IIS Worker Descendant
Tainted Kernel Module Loadmedium
Tclsh Execution followed by immediate Network Connection
Threat Intel URL Indicator Matchhigh
Unusual Windows Remote Userlow

Attempt to Hide Files via Registry Modification

#
Source
github.com/elastic/protections-artifacts

This rule detects the modification of registry settings that control how files are visualized to the user via Explorer. Some malwares will modify those entries to hide malware related files.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule detects the modification of registry settings that control how files are visualized to the user via Explorer.
Some malwares will modify those entries to hide malware related files.
"""
id = "4f7b1362-1299-4ce7-8e02-03b74dad4eb1"
license = "Elastic License v2"
name = "Attempt to Hide Files via Registry Modification"
os_list = ["windows"]
version = "1.0.6"

query = '''
registry where event.action == "modification" and process.executable != null and
 registry.key like "S-*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced" and
 (
  (registry.value == "HideFileExt" and registry.data.strings == "1") or
  (registry.value == "Hidden" and registry.data.strings == "2") or
  (registry.value == "ShowSuperHidden" and registry.data.strings == "0")
  ) and
  not process.executable :
                ("C:\\Windows\\system32\\svchost.exe",
                 "C:\\Windows\\explorer.exe",
                 "C:\\Windows\\regedit.exe",
                 "C:\\Windows\\System32\\runonce.exe",
                 "C:\\Windows\\System32\\ShellAppRuntime.exe",
                 "C:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
                 "C:\\Windows\\System32\\SystemPropertiesPerformance.exe",
                 "C:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
                 "C:\\Windows\\System32\\SystemPropertiesComputerName.exe",
                 "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                 "C:\\Program Files\\KEYENCE\\IM Editor2\\IMController.exe",
                 "C:\\Program Files\\Streamline3\\1.7.1.2\\pxsvc.exe", 
                 "C:\\Windows\\System32\\reg.exe", 
                 "C:\\Windows\\System32\\regsvr32.exe",
                 "C:\\$WINDOWS.~BT\\Sources\\SetupPlatform.exe",
                 "C:\\ADP SmartCompliance PowerTool\\Compliance.exe",
                 "D:\\USMT\\X64\\loadstate.exe",
                 "C:\\Program Files\\*.exe", 
                 "C:\\Program Files (x86)\\*.exe") and
not (process.code_signature.subject_name : ("Cyberdigm. Corp.", "CYBERDIGM CO., LTD.", "Electronic Arts, Inc.") and process.code_signature.trusted == true)
'''

min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"

[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Stage 1: registry

registry where event.action == "modification" and process.executable != null and
 registry.key like "S-*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced" and
 (
  (registry.value == "HideFileExt" and registry.data.strings == "1") or
  (registry.value == "Hidden" and registry.data.strings == "2") or
  (registry.value == "ShowSuperHidden" and registry.data.strings == "0")
  ) and
  not process.executable :
                ("C:\\Windows\\system32\\svchost.exe",
                 "C:\\Windows\\explorer.exe",
                 "C:\\Windows\\regedit.exe",
                 "C:\\Windows\\System32\\runonce.exe",
                 "C:\\Windows\\System32\\ShellAppRuntime.exe",
                 "C:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
                 "C:\\Windows\\System32\\SystemPropertiesPerformance.exe",
                 "C:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
                 "C:\\Windows\\System32\\SystemPropertiesComputerName.exe",
                 "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                 "C:\\Program Files\\KEYENCE\\IM Editor2\\IMController.exe",
                 "C:\\Program Files\\Streamline3\\1.7.1.2\\pxsvc.exe", 
                 "C:\\Windows\\System32\\reg.exe", 
                 "C:\\Windows\\System32\\regsvr32.exe",
                 "C:\\$WINDOWS.~BT\\Sources\\SetupPlatform.exe",
                 "C:\\ADP SmartCompliance PowerTool\\Compliance.exe",
                 "D:\\USMT\\X64\\loadstate.exe",
                 "C:\\Program Files\\*.exe", 
                 "C:\\Program Files (x86)\\*.exe") and
not (process.code_signature.subject_name : ("Cyberdigm. Corp.", "CYBERDIGM CO., LTD.", "Electronic Arts, Inc.") and process.code_signature.trusted == true)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • modification corpus 72 (elastic 72)
field:"EventType" kind:eq value:"modification"
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
registry.data.stringseq
  • 0
  • 1 corpus 3 (elastic 2, kusto 1)
  • 2
field:"Details" kind:eq
registry.keywildcard
  • S-*\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
field:"TargetObject" kind:wildcard value:"S-*\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
registry.valueeq
  • Hidden
  • HideFileExt
  • ShowSuperHidden
field:"registry_value_name" kind:eq

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqCyberdigm. Corp., CYBERDIGM CO., LTD., Electronic Arts, Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Cyberdigm. Corp." field:"process.code_signature.subject_name" value:"CYBERDIGM CO., LTD." field:"process.code_signature.subject_name" value:"Electronic Arts, Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executablewildcardC:\Windows\system32\svchost.exe, C:\Windows\explorer.exe, C:\Windows\regedit.exe, C:\Windows\System32\runonce.exe, C:\Windows\System32\ShellAppRuntime.exe, C:\Windows\ImmersiveControlPanel\SystemSettings.exe, C:\Windows\System32\SystemPropertiesPerformance.exe, C:\Windows\System32\SystemPropertiesAdvanced.exe, C:\Windows\System32\SystemPropertiesComputerName.exe, C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, C:\Program Files\KEYENCE\IM Editor2\IMController.exe, C:\Program Files\Streamline3\1.7.1.2\pxsvc.exe, C:\Windows\System32\reg.exe, C:\Windows\System32\regsvr32.exe, C:\$WINDOWS.~BT\Sources\SetupPlatform.exe, C:\ADP SmartCompliance PowerTool\Compliance.exe, D:\USMT\X64\loadstate.exe, C:\Program Files\*.exe, C:\Program Files (x86)\*.exeexcludes:process.executable

AWS CloudTrail Log Created

#
Status
production
Severity
low
Time window
6m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects creation of a new AWS CloudTrail trail via CreateTrail API. While legitimate during onboarding or auditing improvements, adversaries can create trails that write to attacker-controlled destinations, limit regions, or otherwise subvert monitoring objectives. New trails should be validated for destination ownership, encryption, multi-region coverage, and organizational scope.

Known False Positives

  • Trail creations may be made by a system or network administrator. Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Trail creations by unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2020/06/10"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Detects creation of a new AWS CloudTrail trail via CreateTrail API. While legitimate during onboarding or auditing
improvements, adversaries can create trails that write to attacker-controlled destinations, limit regions, or otherwise
subvert monitoring objectives. New trails should be validated for destination ownership, encryption, multi-region
coverage, and organizational scope.
"""
false_positives = [
    """
    Trail creations may be made by a system or network administrator. Verify whether the user identity, user agent,
    and/or hostname should be making changes in your environment. Trail creations by unfamiliar users or hosts should be
    investigated. If known behavior is causing false positives, it can be exempted from the rule.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS CloudTrail Log Created"
note = """## Triage and analysis

### Investigating AWS CloudTrail Log Created

AWS CloudTrail is a service that enables governance, compliance, and operational and risk auditing of your AWS account. It logs API calls and related events, providing visibility into user activity. Adversaries may create new trails to capture sensitive data or cover their tracks. This detection identifies
`CreateTrail` calls so responders can verify destination ownership, encryption, and scope before accepting the change.

#### Possible investigation steps

- **Identify the actor and context**
  - Review `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.type`, `user_agent.original`, `source.ip`.
  - Confirm a related change request exists (onboarding, architecture change).
- **Validate trail configuration**
  - In `aws.cloudtrail.request_parameters`, verify:
    - `S3BucketName`/`CloudWatchLogsLogGroupArn` belong to your org (no external accounts).
    - `IsMultiRegionTrail=true` and `IncludeGlobalServiceEvents=true` (as per your standard).
    - `KmsKeyId` is an approved CMK; log file validation enabled.
- **Correlate activity**
  - Look for `PutEventSelectors`, `PutInsightSelectors`, `StartLogging` following creation.
  - Check for prior enumeration: `DescribeTrails`, `ListBuckets`, `GetEventSelectors`.

### False positive analysis
- **Planned creation**: Onboarding or compliance initiatives often add trails. Validate via ticket and standard template.
- **Automation**: IaC or control-tower pipelines may create trails on account bootstrap.

### Response and remediation
- **If unauthorized**
  - Disable or delete the trail; verify and secure the destination S3/CloudWatch resources.
  - Review the actor’s recent changes and rotate credentials if compromise is suspected.
- **Hardening**
  - Restrict `cloudtrail:CreateTrail` to admin roles.
  - Use AWS Config / Security Hub controls to enforce multi-region, global events, and validated destinations.

### 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/awscloudtrail/latest/APIReference/API_CreateTrail.html",
    "https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/create-trail.html",
]
risk_score = 21
rule_id = "594e0cbf-86cc-45aa-9ff7-ff27db27d3ed"
severity = "low"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS Cloudtrail",
    "Use Case: Log Auditing",
    "Tactic: Collection",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: "aws.cloudtrail" 
    and event.provider: "cloudtrail.amazonaws.com" 
    and event.action: "CreateTrail" 
    and event.outcome: "success"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"

[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"

[[rule.threat.technique.subtechnique]]
id = "T1562.008"
name = "Disable or Modify Cloud Logs"
reference = "https://attack.mitre.org/techniques/T1562/008/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[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: "cloudtrail.amazonaws.com" 
    and event.action: "CreateTrail" 
    and event.outcome: "success"

Indicators

These rows show field, operator, and value matches.

AWS ECR Repository or Registry Policy Granted Public Access

#
Status
production
Severity
medium
Time window
15m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects when an Amazon ECR repository or registry policy is modified to grant public access using a wildcard principal (Principal:"") statement. This rule analyzes SetRepositoryPolicy and PutRegistryPolicy events whose policy document grants an Allow effect to a wildcard ("") principal, indicating that pull (and potentially push) permissions were extended to all identities, including unauthenticated users. A public container registry can expose proprietary images and any secrets baked into their layers, and, if push is allowed, enables supply-chain implantation. Public ECR access is sometimes intentional for image distribution, so the granting principal and the permissions should be validated.

Known False Positives

  • Repositories used to distribute public images may legitimately contain Principal:"*". This rule does not by itself determine whether a Deny statement restricts the same access; review the full policy in "aws.cloudtrail.request_parameters" and confirm the granted actions (pull-only versus push) and whether public exposure is intended.

MITRE ATT&CK Coverage

TacticTechniques
Exfiltration

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/06/29"
integration = ["aws"]
maturity = "production"
updated_date = "2026/06/29"

[rule]
author = ["Elastic"]
description = """
Detects when an Amazon ECR repository or registry policy is modified to grant public access using a wildcard principal
(Principal:"*") statement. This rule analyzes SetRepositoryPolicy and PutRegistryPolicy events whose policy document grants an Allow effect to a
wildcard ("*") principal, indicating that pull (and potentially push) permissions were
extended to all identities, including unauthenticated users. A public container registry can expose proprietary images
and any secrets baked into their layers, and, if push is allowed, enables supply-chain implantation. Public ECR access
is sometimes intentional for image distribution, so the granting principal and the permissions should be validated.
"""
false_positives = [
    """
    Repositories used to distribute public images may legitimately contain Principal:"*". This rule does not by itself
    determine whether a Deny statement restricts the same access; review the full policy in
    "aws.cloudtrail.request_parameters" and confirm the granted actions (pull-only versus push) and whether public
    exposure is intended.
    """,
]
from = "now-15m"
interval = "10m"
language = "esql"
license = "Elastic License v2"
name = "AWS ECR Repository or Registry Policy Granted Public Access"
note = """## Triage and analysis

### Investigating AWS ECR Repository or Registry Policy Granted Public Access

This rule detects "SetRepositoryPolicy" or "PutRegistryPolicy" calls where the policy document grants an Allow effect to a wildcard ("*") principal, granting access to all identities. A public ECR repository allows anyone to pull its images, exposing proprietary code and any secrets embedded in image layers; if push actions are granted, an adversary can implant a malicious image that downstream ECS, EKS, or Lambda workloads then run.

### Possible investigation steps

- Identify the actor in "aws.cloudtrail.user_identity.arn" and "aws.cloudtrail.user_identity.type", and review "source.ip" and "user_agent.original" for an unexpected origin or tool.
- Extract the policy from "aws.cloudtrail.request_parameters" and identify the granted actions; pull actions (BatchGetImage, GetDownloadUrlForLayer) expose images, while push actions (PutImage, UploadLayerPart) enable implantation.
- Confirm whether a Deny statement restricts the same access, in which case the alert may be a false positive.
- Determine which repository is affected and whether it contains sensitive images, and correlate with subsequent pull or push activity from external principals.

### False positive analysis

- Public image distribution legitimately uses Principal:"*". Confirm the exposure is intended, the actions are pull-only, and the granting principal is approved.

### Response and remediation

- If the exposure is unauthorized, restore a known-good policy or remove the public statement, and review for any external pulls or pushes since the change.
- Rotate or restrict credentials for the principal if compromise is suspected, and restrict "ecr:SetRepositoryPolicy" and "ecr:PutRegistryPolicy" to trusted administrators.
"""
references = [
    "https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_SetRepositoryPolicy.html",
    "https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html",
]
risk_score = 47
rule_id = "699fdfb9-8430-4dcb-b5a9-da67dae64808"
setup = "This rule requires AWS CloudTrail logs ingested via the Elastic AWS integration. See https://docs.elastic.co/integrations/aws/cloudtrail for setup details."
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS ECR",
    "Use Case: Threat Detection",
    "Tactic: Exfiltration",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
FROM logs-aws.cloudtrail-* METADATA _id, _version, _index
| WHERE event.provider == "ecr.amazonaws.com"
  AND event.action IN ("SetRepositoryPolicy", "PutRegistryPolicy")
  AND event.outcome == "success"
  AND (aws.cloudtrail.user_identity.type IS NULL OR aws.cloudtrail.user_identity.type != "AWSService")
  AND aws.cloudtrail.request_parameters RLIKE """.*\"Effect\": *\"Allow\".*"""
  AND (aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\"\*\".*"""
       OR aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\{ *\"AWS\": *\"\*\".*""")
| KEEP _id, _version, _index, @timestamp, aws.*, cloud.*, event.*, source.*, user.*, user_agent.*
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1537"
name = "Transfer Data to Cloud Account"
reference = "https://attack.mitre.org/techniques/T1537/"


[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user_agent.original",
    "source.ip",
    "source.as.number",
    "source.as.organization.name",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.type",
    "aws.cloudtrail.user_identity.access_key_id",
    "aws.cloudtrail.resources.arn",
    "aws.cloudtrail.resources.type",
    "event.action",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters",
    "aws.cloudtrail.response_elements",
]

Stages and Predicates

Stage 1: from

FROM logs-aws.cloudtrail-* METADATA _id, _version, _index

Stage 2: where

| WHERE event.provider == "ecr.amazonaws.com"
  AND event.action IN ("SetRepositoryPolicy", "PutRegistryPolicy")
  AND event.outcome == "success"
  AND (aws.cloudtrail.user_identity.type IS NULL OR aws.cloudtrail.user_identity.type != "AWSService")
  AND aws.cloudtrail.request_parameters RLIKE """.*\"Effect\": *\"Allow\".*"""
  AND (aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\"\*\".*"""
       OR aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\{ *\"AWS\": *\"\*\".*""")

Stage 3: keep

| KEEP _id, _version, _index, @timestamp, aws.*, cloud.*, event.*, source.*, user.*, user_agent.*

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
aws.cloudtrail.request_parametersregex_match
  • .*\"Effect\": *\"Allow\".*
  • .*\"Principal\": *\"*\".*
  • .*\"Principal\": *{ *\"AWS\": *\"*\".*
field:"aws::requestParameters" kind:regex_match
aws.cloudtrail.user_identity.typeis_null
  • (no value, null check)
field:"aws::userIdentity.type" kind:is_null
aws.cloudtrail.user_identity.typene
  • AWSService corpus 7 (elastic 6, panther 1)
field:"aws::userIdentity.type" kind:ne value:"AWSService"
event.actionin
  • PutRegistryPolicy
  • SetRepositoryPolicy
field:"EventType" kind:in
event.outcomeeq
  • success corpus 82 (elastic 82)
field:"event.outcome" kind:eq value:"success"
event.providereq
  • ecr.amazonaws.com
field:"Provider_Name" kind:eq value:"ecr.amazonaws.com"

Output Fields

These fields are emitted when the rule matches.

FieldSource
_idKEEP _id
_versionKEEP _version
_indexKEEP _index
@timestampKEEP @timestamp
aws.*KEEP aws.*
cloud.*KEEP cloud.*
event.*KEEP event.*
source.*KEEP source.*
user.*KEEP user.*
user_agent.*KEEP user_agent.*

AWS IAM AdministratorAccess Policy Attached to User

#
Status
production
Severity
high
Time window
6m
Author
Elastic
Source
github.com/elastic/detection-rules

An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by attaching additional permissions to compromised user accounts. This rule looks for use of the IAM AttachUserPolicy API operation to attach the highly permissive AdministratorAccess AWS managed policy to an existing IAM user.

Known False Positives

  • While this can be normal behavior, it should be investigated to ensure validity. Verify whether the user identity should be using the IAM `AttachUserPolicy` API operation to attach the `AdministratorAccess` policy to the target user.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2024/05/30"
integration = ["aws"]
maturity = "production"
updated_date = "2026/07/08"

[rule]
author = ["Elastic"]
description = """
An adversary with access to a set of compromised credentials may attempt to persist or escalate privileges by attaching
additional permissions to compromised user accounts. This rule looks for use of the IAM AttachUserPolicy API operation
to attach the highly permissive AdministratorAccess AWS managed policy to an existing IAM user.
"""
false_positives = [
    """
    While this can be normal behavior, it should be investigated to ensure validity. Verify whether the user identity
    should be using the IAM `AttachUserPolicy` API operation to attach the `AdministratorAccess` policy to the target
    user.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "eql"
license = "Elastic License v2"
name = "AWS IAM AdministratorAccess Policy Attached to User"
note = """## Triage and analysis

### Investigating AWS IAM AdministratorAccess Policy Attached to User

The AWS-managed `AdministratorAccess` policy grants full access to all AWS services and resources.  
When attached to a user, it effectively elevates that user to full administrative privileges.  
An adversary with `iam:AttachUserPolicy` permissions can abuse this operation to escalate privileges or maintain persistence.  
This rule detects `AttachUserPolicy` events where the attached policy name is `AdministratorAccess`.

#### Possible investigation steps

- **Validate intent and context.**  
  Identify the calling user (`aws.cloudtrail.user_identity.arn`) and the target IAM user (`aws.cloudtrail.request_parameters.userName`).  
  Confirm whether this was an intentional administrative action, part of provisioning automation, or a potential privilege escalation.  

- **Review CloudTrail event details.**  
  Check `source.ip`, `user_agent.original`, and `source.geo` fields.  
  Compare to historical login or automation behavior. Unrecognized IPs, non-SDK user agents, or new regions may indicate misuse.  

- **Correlate with related IAM activity.**  
  Search CloudTrail for additional IAM events around the same time (`CreateUser`, `CreateAccessKey`, `AttachGroupPolicy`, `PutUserPolicy`, etc.) that could indicate lateral movement or persistence attempts.  

- **Review the target user’s permissions.**  
  Determine if the target user already had elevated privileges or if this represents a meaningful privilege increase.  
  Check for new API calls from the target user post-attachment, especially `CreateAccessKey`, `UpdateAssumeRolePolicy`, or S3 access attempts.  

- **Investigate associated entities.**  
  Look for other alerts tied to the same caller or target within the past 48 hours to identify potential correlated activity.  

### False positive analysis

- **Legitimate administrative change.**  
  Policy attachments may be expected during provisioning or troubleshooting. Validate through change management records.  
- **Authorized automation.**  
  Some CI/CD pipelines or identity automation systems temporarily attach this policy. Review automation logs and intended IAM behavior.  
- **Delegated admin scenarios.**  
  Verify if the calling user or role is part of a delegated IAM administration group.

### Response and remediation

**Immediate containment**
- Detach the policy. Remove the `AdministratorAccess` policy from the affected IAM user immediately (`aws iam detach-user-policy`).  
- Rotate credentials. Rotate passwords and access keys for both the caller and target users.  
- Restrict IAM permissions. Temporarily remove `iam:AttachUserPolicy` privileges from non-administrative roles during scoping.  
- Enable or confirm MFA for affected accounts.  

**Evidence preservation**
- Export related `AttachUserPolicy` CloudTrail events ±30 minutes from the alert to a secure evidence bucket.  
- Preserve GuardDuty findings and AWS Config snapshots for correlation.  

**Scoping and investigation**
- Search CloudTrail for subsequent use of the affected user’s credentials.  
  Look for newly created keys, S3 access, or changes to IAM trust policies.  
- Review other accounts for similar policy attachment attempts from the same user or IP.  

**Recovery and hardening**
- Reinforce least privilege by granting only role-based admin access instead of direct user-level AdministratorAccess.  
- Implement IAM service control policies (SCPs) to prevent attachment of `AdministratorAccess` except for trusted roles.  
- Enable CloudTrail, GuardDuty, and Security Hub across all regions.  
- Regularly audit IAM policy attachments through AWS Config or CloudFormation drift detection.  

### Additional information

- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/): response steps related to IAM policy modification and unauthorized privilege escalation.  
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/):** for containment, analysis, and recovery guidance.  
- **AWS Documentation:** [AdministratorAccess Policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator).  
- **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/IAM/latest/APIReference/API_AttachUserPolicy.html",
    "https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AdministratorAccess.html",
    "https://hackingthe.cloud/aws/exploitation/iam_privilege_escalation/",
]
risk_score = 73
rule_id = "9aa4be8d-5828-417d-9f54-7cd304571b24"
severity = "high"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS IAM",
    "Use Case: Identity and Access Audit",
    "Tactic: Privilege Escalation",
    "Tactic: Persistence",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
iam where data_stream.dataset == "aws.cloudtrail"
   and event.provider == "iam.amazonaws.com"
   and event.action == "AttachUserPolicy"
   and event.outcome == "success"
   and stringContains(aws.cloudtrail.request_parameters, "policyArn=arn:aws:iam::aws:policy/AdministratorAccess")
'''


[[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.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/003/"



[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.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/003/"



[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user_agent.original",
    "source.ip",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.type",
    "aws.cloudtrail.user_identity.access_key_id",
    "event.action",
    "user.target.name",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters",
]

Stages and Predicates

Stage 1: iam

iam where data_stream.dataset == "aws.cloudtrail"
   and event.provider == "iam.amazonaws.com"
   and event.action == "AttachUserPolicy"
   and event.outcome == "success"
   and stringContains(aws.cloudtrail.request_parameters, "policyArn=arn:aws:iam::aws:policy/AdministratorAccess")

Indicators

These rows show field, operator, and value matches.

AWS KMS Imported Key Material Deleted

#
Status
production
Severity
medium
Time window
6m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies deletion of imported key material from an AWS KMS customer managed key via DeleteImportedKeyMaterial. Keys created with an external key material origin (BYOK) rely on key material that the customer imports. Deleting that material immediately makes the key unusable and renders all data encrypted under it inaccessible, with no recovery window. Unlike ScheduleKeyDeletion, which enforces a pending deletion period of 7 to 30 days, this action takes effect instantly, making it an attractive primitive for cloud ransomware and data-destruction attacks. Because this operation only applies to external-origin keys and is rare in normal operations, its use by an unexpected principal warrants prompt review.

Known False Positives

  • Encryption or platform teams that operate keys with imported key material (BYOK/HYOK) may delete and re-import material during key rotation, migration, or decommissioning. Verify the principal in "aws.cloudtrail.user_identity.arn", confirm the change aligns with a planned key lifecycle activity, and check whether material was re-imported shortly after. Known administration roles and automation can be excluded after validation.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/06/18"
integration = ["aws"]
maturity = "production"
updated_date = "2026/06/18"

[rule]
author = ["Elastic"]
description = """
Identifies deletion of imported key material from an AWS KMS customer managed key via DeleteImportedKeyMaterial. Keys
created with an external key material origin (BYOK) rely on key material that the customer imports. Deleting that
material immediately makes the key unusable and renders all data encrypted under it inaccessible, with no recovery
window. Unlike ScheduleKeyDeletion, which enforces a pending deletion period of 7 to 30 days, this action takes effect
instantly, making it an attractive primitive for cloud ransomware and data-destruction attacks. Because this operation
only applies to external-origin keys and is rare in normal operations, its use by an unexpected principal warrants
prompt review.
"""
false_positives = [
    """
    Encryption or platform teams that operate keys with imported key material (BYOK/HYOK) may delete and re-import
    material during key rotation, migration, or decommissioning. Verify the principal in
    "aws.cloudtrail.user_identity.arn", confirm the change aligns with a planned key lifecycle activity, and check
    whether material was re-imported shortly after. Known administration roles and automation can be excluded after
    validation.
    """,
]
from = "now-6m"
index = ["logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS KMS Imported Key Material Deleted"
note = """## Triage and analysis

### Investigating AWS KMS Imported Key Material Deleted

AWS KMS keys can be created with an external key material origin (BYOK), where the customer imports the cryptographic material rather than having KMS generate it. "DeleteImportedKeyMaterial" removes that material, immediately transitioning the key to a "PendingImport" state where it can no longer encrypt or decrypt. All data protected by the key becomes inaccessible until the exact same material is re-imported. Unlike "ScheduleKeyDeletion", there is no pending window, so the impact is instant and, for an adversary who controls and withholds the original material, effectively irreversible.

Because this action only applies to external-origin keys and is uncommon in normal operations, it should be treated as a high-risk, destructive action when performed unexpectedly. Adversaries may delete imported key material to sabotage recovery, destroy data, or hold encrypted resources for ransom.

### Possible investigation steps

- Identify the actor and authentication context in "aws.cloudtrail.user_identity.arn", "aws.cloudtrail.user_identity.access_key_id", and "aws.cloudtrail.user_identity.type", and review "source.ip" and "user_agent.original" to determine whether the action came from an expected network path or automation platform.
- Identify the affected key from "aws.cloudtrail.resources.arn" or the "keyId" in "aws.cloudtrail.request_parameters", and determine which services and data depend on it (S3, EBS, RDS, Secrets Manager, etc.).
- Determine whether the same material was re-imported shortly after ("ImportKeyMaterial") or whether the key was left unusable.
- Correlate with surrounding activity by the same principal, such as KMS key policy changes, scheduled key deletions, S3 or EBS destructive actions, or credential changes that may indicate a broader sabotage or ransom attempt.

### False positive analysis

- Organizations with BYOK/HYOK requirements may delete and re-import key material during planned rotation, migration, or decommissioning. Confirm the change is expected and exclude known administration roles or automation on "aws.cloudtrail.user_identity.arn" after validation.

### Response and remediation

- If the deletion is unauthorized, re-import the original key material if it is securely retained, and restore access to affected services.
- Treat any encrypted data whose key material cannot be re-imported as potentially unrecoverable, and engage incident response and data owners to assess impact.
- Rotate or restrict credentials for the principal if compromise is suspected, and constrain "kms:DeleteImportedKeyMaterial" and "kms:ImportKeyMaterial" to a small set of trusted administrators.
- Use AWS Organizations SCPs to limit who can manage imported key material in production accounts.

### Additional information

- [DeleteImportedKeyMaterial API](https://docs.aws.amazon.com/kms/latest/APIReference/API_DeleteImportedKeyMaterial.html)
- [Importing key material into AWS KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
"""
references = [
    "https://docs.aws.amazon.com/kms/latest/APIReference/API_DeleteImportedKeyMaterial.html",
    "https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html",
]
risk_score = 47
rule_id = "f6fee40d-8a5e-4cc8-9f73-8688419c6d68"
setup = """This rule requires AWS CloudTrail management events for AWS Backup and ingestion via the Elastic AWS CloudTrail integration. See https://docs.elastic.co/integrations/aws/cloudtrail."""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Data Source: AWS",
    "Data Source: Amazon Web Services",
    "Data Source: AWS KMS",
    "Use Case: Threat Detection",
    "Tactic: Impact",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: "aws.cloudtrail"
    and event.provider: "kms.amazonaws.com"
    and event.action: "DeleteImportedKeyMaterial"
    and event.outcome: "success"
    and not aws.cloudtrail.user_identity.type: "AWSService"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1485"
name = "Data Destruction"
reference = "https://attack.mitre.org/techniques/T1485/"

[[rule.threat.technique.subtechnique]]
id = "T1485.001"
name = "Lifecycle-Triggered Deletion"
reference = "https://attack.mitre.org/techniques/T1485/001/"

[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",
    "aws.cloudtrail.resources.arn",
    "aws.cloudtrail.resources.type",
    "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: "kms.amazonaws.com"
    and event.action: "DeleteImportedKeyMaterial"
    and event.outcome: "success"
    and not aws.cloudtrail.user_identity.type: "AWSService"

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
aws.cloudtrail.user_identity.typeeqAWSServiceexcludes:aws.cloudtrail.user_identity.type field:"aws.cloudtrail.user_identity.type" value:"AWSService"

AWS Systems Manager SecureString Parameter Request with Decryption Flag

#
Status
production
Severity
medium
Time window
6m
Group by
cloud.account.id, user.name
Author
Elastic
Source
github.com/elastic/detection-rules

Detects the first occurrence of a user identity accessing AWS Systems Manager (SSM) SecureString parameters using the GetParameter or GetParameters API actions with credentials in the request parameters. This could indicate that the user is accessing sensitive information. This rule detects when a user accesses a SecureString parameter with the withDecryption parameter set to true. This is a New Terms rule that detects the first occurrence of an AWS identity accessing SecureString parameters with decryption.

Known False Positives

  • Users may legitimately access AWS Systems Manager (SSM) parameters using the GetParameter, GetParameters, or DescribeParameters API actions with credentials in the request parameters. Ensure that the user has a legitimate reason to access the parameters and that the credentials are secured.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2024/04/12"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/05"

[rule]
author = ["Elastic"]
description = """
Detects the first occurrence of a user identity accessing AWS Systems Manager (SSM) SecureString parameters using the GetParameter or GetParameters API actions with credentials in the request parameters. This could indicate that the user is accessing sensitive information. This rule detects when a user accesses a SecureString parameter with the withDecryption parameter set to true. This is a New Terms rule that detects the first occurrence of an AWS identity accessing SecureString parameters with decryption.
"""
false_positives = [
    """
    Users may legitimately access AWS Systems Manager (SSM) parameters using the GetParameter, GetParameters, or DescribeParameters API actions with credentials in the request parameters. Ensure that the user has a legitimate reason to access the parameters and that the credentials are secured.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS Systems Manager SecureString Parameter Request with Decryption Flag"
note = """
## Triage and analysis

### Investigating AWS Systems Manager SecureString Parameter Request with Decryption Flag

This rule detects when an AWS resource accesses SecureString parameters within AWS Systems Manager (SSM) with the decryption flag set to true. SecureStrings are encrypted using a KMS key, and accessing these with decryption can indicate attempts to access sensitive data.

Adversaries may target SecureStrings to retrieve sensitive information such as encryption keys, passwords, and other credentials that are stored securely. Accessing these parameters with decryption enabled is particularly concerning because it implies the adversary is attempting to bypass the encryption to obtain plain text values that can be immediately used or exfiltrated. This behavior might be part of a larger attack strategy aimed at escalating privileges or moving laterally within an environment to access protected data or critical infrastructure.

#### Possible Investigation Steps

- **Review the Access Event**: Identify the specific API call (`GetParameter` or `GetParameters`) that triggered the rule. Examine the `request_parameters` for `withDecryption` set to true and the name of the accessed parameter.
- **Verify User Identity and Access Context**: Check the `aws.cloudtrail.user_identity` details to understand who accessed the parameter and their role within the organization. This includes checking the ARN and access key ID to determine if the access was authorized.
    - **User ID**: Review the `user.name` field to identify the specific user or role that initiated the API call. Note that the ARN associated may be an assumed role and may not directly correspond to a human user.
- **Contextualize with User Behavior**: Assess whether the access pattern fits the user’s normal behavior or job responsibilities. Investigate any out-of-pattern activities around the time of the event.
- **Analyze Geographic and IP Context**: Using the `source.ip` and `source.geo` information, verify if the request came from a trusted location or if there are any anomalies that suggest a compromised account.
- **Inspect Related CloudTrail Events**: Look for other related events in CloudTrail to see if there was unusual activity before or after this event, such as unusual login attempts, changes to permissions, or other API calls that could indicate broader unauthorized actions.

### False Positive Analysis

- **Legitimate Administrative Use**: Verify if the decryption of SecureString parameters is a common practice for the user’s role, particularly if used in automation scripts or deployment processes like those involving Terraform or similar tools.
- **Authorized Access**: Ensure that the user or role has a legitimate reason to access the SecureString parameters and that the access is part of their expected job responsibilities.

### Response and Remediation

- **Immediate Verification**: Contact the user or team responsible for the API call to verify their intent and authorization.
- **Review and Revise Permissions**: If the access was unauthorized, review the permissions assigned to the user or role to ensure they align with the principle of least privilege.
- **Audit Parameter Access Policies**: Ensure that policies governing access to SecureString parameters are strict and audit logs are enabled to track access with decryption.
- **Incident Response**: If suspicious activity is confirmed, follow through with your organization's incident response plan to mitigate any potential security issues.
- **Enhanced Monitoring and Alerting**: Strengthen monitoring rules to detect unusual accesses to SecureString parameters, especially those that involve decryption.

### Additional Information

This rule focuses solely on SecureStrings in AWS Systems Manager (SSM) parameters. SecureStrings are encrypted using an AWS Key Management Service (KMS) key. When a user accesses a SecureString parameter, they can specify whether the parameter should be decrypted. If the user specifies that the parameter should be decrypted, the decrypted value is returned in the response.
"""
references = [
    "https://docs.aws.amazon.com/vsts/latest/userguide/systemsmanager-getparameter.html",
    "https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html",
]
risk_score = 47
rule_id = "fd332492-0bc6-11ef-b5be-f661ea17fbcc"
setup = "This rule requires that AWS CloudTrail logs are ingested into the Elastic Stack. Ensure that the AWS integration is properly configured to collect AWS CloudTrail logs. This rule also requires event logging for AWS Systems Manager (SSM) API actions which can be enabled in CloudTrail's data events settings.\n"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Platform: AWS",
    "Data Source: AWS CloudTrail",
    "Service: AWS SSM",
    "Tactic: Credential Access",
    "Rule Type: New Terms",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset: aws.cloudtrail
    and event.provider: "ssm.amazonaws.com"
    and event.action: (GetParameters or GetParameter)
    and event.outcome: success
    and aws.cloudtrail.flattened.request_parameters.withDecryption: true
    and not source.address: (
        "cloudformation.amazonaws.com" or
        "servicecatalog.amazonaws.com"
    )
    and not user_agent.original: (
      *Fargate* or
      *Terraform*
    )
'''

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user_agent.original",
    "source.ip",
    "aws.cloudtrail.user_identity.type",
    "aws.cloudtrail.user_identity.arn",
    "aws.cloudtrail.user_identity.access_key_id",
    "event.action",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters"
]

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[rule.threat.technique.subtechnique]]
id = "T1555.006"
name = "Cloud Secrets Management Stores"
reference = "https://attack.mitre.org/techniques/T1555/006/"



[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[rule.new_terms]
field = "new_terms_fields"
value = ["cloud.account.id", "user.name"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"

Stages and Predicates

Stage 1: new_terms

data_stream.dataset: aws.cloudtrail
    and event.provider: "ssm.amazonaws.com"
    and event.action: (GetParameters or GetParameter)
    and event.outcome: success
    and aws.cloudtrail.flattened.request_parameters.withDecryption: true
    and not source.address: (
        "cloudformation.amazonaws.com" or
        "servicecatalog.amazonaws.com"
    )
    and not user_agent.original: (
      *Fargate* or
      *Terraform*
    )

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Evasion via Multiple Memory Section Mapping

#
Time window
1m
Sequence by
process.Ext.api.parameters.address, process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies multiple calls to MapViewOfFile to manipulate the same section adddress and with RWX permissions. This may indicate an attempt to map a malicious private section at the same address of a legit one.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies multiple calls to MapViewOfFile to manipulate the same section adddress and with RWX permissions. This may
indicate an attempt to map a malicious private section at the same address of a legit one.
"""
id = "eab94afc-d8c0-41e6-964f-d396cb0cfbe4"
license = "Elastic License v2"
name = "Evasion via Multiple Memory Section Mapping"
os_list = ["windows"]
reference = ["https://github.com/oldboy21/SWAPPALA"]
version = "1.0.5"

query = '''
sequence by process.entity_id, process.Ext.api.parameters.address with maxspan=1m
 [api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and process.Ext.api.parameters.protection == "RWX" and
  process.Ext.api.parameters.size >= 10000 and process.executable != null and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != "85a6d48587500f6808c119838293e02b700e99035f8fd8dd0b49cc184ce66b6a"]
 [api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and process.Ext.api.parameters.protection == "RWX"]
'''

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

Ordered sequence: each step below must occur in order within 1m, correlated by process.Ext.api.parameters.address, process.entity_id.

Stage 1: api

[api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and process.Ext.api.parameters.protection == "RWX" and
  process.Ext.api.parameters.size >= 10000 and process.executable != null and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != "85a6d48587500f6808c119838293e02b700e99035f8fd8dd0b49cc184ce66b6a"]

Stage 2: api

[api where process.Ext.api.name in ("MapViewOfFile", "MapViewOfFile2") and process.Ext.api.parameters.protection == "RWX"]

Indicators

These rows show field, operator, and value matches.

External Alerts

#

This is a third-party alert feed, not a detection over modeled telemetry. Another security product raised the finding; this rule forwards or reshapes it into the SIEM. It is searchable for reference but is excluded from the detection-rule browse and the ATT&CK coverage matrix.

Status
production
Severity
medium
Time window
2m
Author
Elastic
Source
github.com/elastic/detection-rules

Generates a detection alert for each external alert written to the configured indices. Enabling this rule allows you to immediately begin investigating external alerts in the app.

Rule Body

[metadata]
creation_date = "2020/07/08"
maturity = "production"
promotion = true
updated_date = "2026/01/22"

[rule]
author = ["Elastic"]
description = """
Generates a detection alert for each external alert written to the configured indices. Enabling this rule allows you to
immediately begin investigating external alerts in the app.
"""
from = "now-2m"
index = [
    "apm-*-transaction*",
    "traces-apm*",
    "auditbeat-*",
    "filebeat-*",
    "logs-*",
    "packetbeat-*",
    "winlogbeat-*",
]
interval = "1m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "External Alerts"
risk_score = 47
rule_id = "eb079c62-4481-4d6e-9643-3ca499df7aaa"
rule_name_override = "message"
setup = """## Setup

### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "medium"
tags = ["OS: Windows", "Data Source: APM", "OS: macOS", "OS: Linux", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.kind:alert and not event.module:(endgame or endpoint or cloud_defend)
'''
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 External Alerts

External alerts are crucial for identifying potential threats across diverse environments like Windows, macOS, and Linux. These alerts are generated from various sources, excluding specific modules like endpoint or cloud defend, to focus on broader threat landscapes. Adversaries may exploit vulnerabilities in these systems to execute unauthorized actions. The 'External Alerts' detection rule filters and highlights such activities by focusing on alert events, enabling analysts to swiftly investigate and mitigate risks.

### Possible investigation steps

- Review the alert details to identify the specific event.kind:alert that triggered the detection, ensuring it is not associated with the excluded modules (endgame, endpoint, or cloud_defend).
- Examine the source and context of the alert by checking the associated tags, such as 'OS: Windows', 'OS: macOS', or 'OS: Linux', to understand the environment affected.
- Gather additional context by correlating the alert with other logs or events from the same time frame or system to identify any related suspicious activities.
- Assess the risk score and severity level to prioritize the investigation and determine the potential impact on the organization.
- Investigate the origin of the alert by identifying the source IP, user account, or process involved, and check for any known vulnerabilities or exploits associated with them.
- Consult threat intelligence sources to determine if the alert corresponds to any known threat actors or campaigns targeting similar environments.

### False positive analysis

- Alerts from benign third-party applications may trigger false positives. Review and identify these applications, then create exceptions to exclude them from future alerts.
- Routine system updates or patches can generate alerts. Monitor update schedules and create exceptions for known update activities to reduce noise.
- Network monitoring tools might produce alerts due to their scanning activities. Verify these tools and exclude their activities if deemed non-threatening.
- Alerts from internal security testing or penetration testing exercises can be mistaken for threats. Coordinate with security teams to whitelist these activities during scheduled tests.
- Certain administrative scripts or automation tasks may trigger alerts. Evaluate these scripts and exclude them if they are part of regular operations and pose no risk.

### Response and remediation

- Isolate affected systems immediately to prevent further unauthorized actions and contain the threat.
- Conduct a thorough review of the alert details to identify any specific vulnerabilities or exploits used by the adversary.
- Apply relevant patches or updates to the affected systems to remediate any identified vulnerabilities.
- Restore systems from a known good backup if unauthorized changes or actions have been detected.
- Monitor network traffic and system logs closely for any signs of further suspicious activity or attempts to exploit similar vulnerabilities.
- Escalate the incident to the appropriate security team or management if the threat appears to be part of a larger attack campaign or if additional resources are needed for remediation.
- Enhance detection capabilities by updating security tools and configurations to better identify similar threats in the future."""


[[rule.risk_score_mapping]]
field = "event.risk_score"
operator = "equals"
value = ""

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "low"
value = "21"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "medium"
value = "47"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "high"
value = "73"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "critical"
value = "99"


Stages and Predicates

Stage 1: query

event.kind:alert and not event.module:(endgame or endpoint or cloud_defend)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.kindeq
  • alert corpus 35 (elastic 35)
field:"event.kind" kind:eq value:"alert"

Exclusions

The rule actively suppresses these predicates.

File or Directory Deletion Command

#
Status
production
Kind
building block (feeds higher-level correlation rules; not a standalone alert)
Severity
low
Time window
119m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule identifies the execution of commands that can be used to delete files and directories. Adversaries may delete files and directories on a host system, such as logs, browser history, or malware.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2023/07/13"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
This rule identifies the execution of commands that can be used to delete files and directories. Adversaries may delete
files and directories on a host system, such as logs, browser history, or malware.
"""
from = "now-119m"
index = ["logs-endpoint.events.process-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "File or Directory Deletion Command"
risk_score = 21
rule_id = "5919988c-29e1-4908-83aa-1f087a838f63"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Rule Type: BBR",
    "Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and 
(
  ((process.name : "rundll32.exe" or ?process.pe.original_file_name : "RUNDLL32.EXE") and process.args : "*InetCpl.cpl,Clear*") or 
  ((process.name : "reg.exe" or ?process.pe.original_file_name : "reg.exe") and process.args : "delete") or 
  (
    (process.name : "cmd.exe" or ?process.pe.original_file_name : "Cmd.Exe") and
    process.args : ("*rmdir*", "*rm *", "rm", "*del *", "del", "*erase *", "erase") and
    not process.args : (
          "*\\AppData\\Local\\Microsoft\\OneDrive\\*",
          "*\\AppData\\Local\\Temp\\DockerDesktop\\*",
          "*\\AppData\\Local\\Temp\\Report.*",
          "*\\AppData\\Local\\Temp\\*.PackageExtraction"
    )
  ) or
  ((process.name : "powershell.exe" or ?process.pe.original_file_name : "PowerShell.EXE") and
    process.args : ("*rmdir", "rm", "rd", "*Remove-Item*", "del", "*]::Delete(*"))
) and not user.id : "S-1-5-18"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"

[[rule.threat.technique.subtechnique]]
id = "T1070.004"
name = "File Deletion"
reference = "https://attack.mitre.org/techniques/T1070/004/"

[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"

[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"

[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stages and Predicates

Stage 1: process

process where host.os.type == "windows" and event.type == "start" and 
(
  ((process.name : "rundll32.exe" or ?process.pe.original_file_name : "RUNDLL32.EXE") and process.args : "*InetCpl.cpl,Clear*") or 
  ((process.name : "reg.exe" or ?process.pe.original_file_name : "reg.exe") and process.args : "delete") or 
  (
    (process.name : "cmd.exe" or ?process.pe.original_file_name : "Cmd.Exe") and
    process.args : ("*rmdir*", "*rm *", "rm", "*del *", "del", "*erase *", "erase") and
    not process.args : (
          "*\\AppData\\Local\\Microsoft\\OneDrive\\*",
          "*\\AppData\\Local\\Temp\\DockerDesktop\\*",
          "*\\AppData\\Local\\Temp\\Report.*",
          "*\\AppData\\Local\\Temp\\*.PackageExtraction"
    )
  ) or
  ((process.name : "powershell.exe" or ?process.pe.original_file_name : "PowerShell.EXE") and
    process.args : ("*rmdir", "rm", "rd", "*Remove-Item*", "del", "*]::Delete(*"))
) and not user.id : "S-1-5-18"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • *InetCpl.cpl,Clear*
  • *Remove-Item*
  • *]::Delete(*
  • *del *
  • *erase *
  • *rm * corpus 2 (elastic 2)
  • *rmdir
  • *rmdir*
  • del
  • delete corpus 6 (elastic 6)
  • erase
  • rd
  • rm
field:"process.args" kind:wildcard
process.namewildcard
  • cmd.exe corpus 122 (elastic 93, splunk 29)
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
  • reg.exe corpus 28 (elastic 18, splunk 9, kusto 1)
  • rundll32.exe corpus 123 (elastic 100, splunk 23)
field:"process_basename" kind:wildcard
process.pe.original_file_namewildcard
  • Cmd.Exe corpus 75 (sigma 43, splunk 17, elastic 15)
  • PowerShell.EXE corpus 134 (sigma 86, splunk 30, elastic 18)
  • RUNDLL32.EXE corpus 72 (sigma 35, splunk 21, elastic 16)
  • reg.exe corpus 41 (sigma 32, splunk 8, elastic 1)
field:"OriginalFileName" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"

First Time Python Spawned a Shell on Host

#
Status
production
Severity
medium
Time window
9m
Group by
host.id, process.parent.executable
Author
Elastic
Source
github.com/elastic/detection-rules

Detects the first time a Python process spawns a shell on a given host. Malicious Python scripts, compromised dependencies, or model file deserialization can result in shell spawns that would not occur during normal workflows. Since legitimate Python processes rarely shell out to interactive shells, a first occurrence of this behavior on a host is a strong signal of potential compromise.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/02/23"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Detects the first time a Python process spawns a shell on a given host. Malicious Python scripts, compromised
dependencies, or model file deserialization can result in shell spawns that would not occur during normal workflows.
Since legitimate Python processes rarely shell out to interactive shells, a first occurrence of this behavior on a
host is a strong signal of potential compromise.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "kuery"
license = "Elastic License v2"
name = "First Time Python Spawned a Shell on Host"
note = """## Triage and analysis

### Investigating First Time Python Spawned a Shell on Host

Attackers who achieve Python code execution — whether through malicious scripts, compromised dependencies, or model file deserialization (e.g., pickle/PyTorch `__reduce__`) — often spawn shell processes to perform reconnaissance, credential theft, persistence, or reverse shell activity. Since legitimate Python workflows rarely shell out with `-c`, a first occurrence is highly suspicious.

This rule uses the New Terms rule type to detect the first occurrence of a Python process spawning a shell with the `-c` flag on a given host within a 7-day window. This approach reduces false positives from recurring legitimate Python workflows while surfacing novel, potentially malicious activity.

### Possible investigation steps

- Examine the parent Python process command line to identify the script or command that triggered the shell spawn.
- Determine if the Python process was loading a model file (look for `torch.load`, `pickle.load`), running a standalone script, or executing via a compromised dependency.
- Review the shell command arguments to assess intent (credential access, reverse shell, persistence, reconnaissance).
- Inspect the full process tree to determine if the Python process was launched from an interactive session, a cron job, or an automated pipeline.
- Investigate the origin of any recently downloaded scripts, packages, or model files on the host.
- Correlate with other hosts in the environment to determine if the same behavior is occurring elsewhere, which may indicate a supply chain compromise.

### False positive analysis

- Development environments where Python scripts legitimately shell out for system tasks (e.g., build scripts, CI/CD runners) may trigger this rule on first occurrence. Consider excluding known CI/CD working directories or build automation paths.
- Package installation via pip or conda may spawn shells during post-install scripts. These are excluded by the query filter.
- Jupyter notebooks executing system commands via `!` or `subprocess` may trigger this rule in data science environments.

### Response and remediation

- Investigate the shell command that was executed and assess its impact (credential access, persistence, data exfiltration).
- If a malicious file is confirmed, quarantine it and identify its source (PyPI, Hugging Face, shared drive, email attachment).
- Scan other hosts that may have received the same file.
- Review and rotate any credentials that may have been accessed.
- Consider implementing `weights_only=True` enforcement for PyTorch model loading across the environment.
"""
references = [
    "https://blog.trailofbits.com/2024/06/11/exploiting-ml-models-with-pickle-file-attacks-part-1/",
    "https://github.com/trailofbits/fickling",
    "https://5stars217.github.io/2024-03-04-what-enables-malicious-models/",
]
risk_score = 47
rule_id = "92a36c98-b24a-4bf7-aac7-1eac71fa39cf"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
    "Domain: LLM",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:process and host.os.type:macos and event.type:start and event.action:exec and
process.parent.name:python* and
process.name:(bash or dash or sh or tcsh or csh or zsh or ksh or fish) and process.args:"-c" and
not process.command_line:(*pip* or *conda* or *brew* or *jupyter*)
'''

[[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.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id", "process.parent.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"

Stages and Predicates

Stage 1: new_terms

event.category:process and host.os.type:macos and event.type:start and event.action:exec and
process.parent.name:python* and
process.name:(bash or dash or sh or tcsh or csh or zsh or ksh or fish) and process.args:"-c" and
not process.command_line:(*pip* or *conda* or *brew* or *jupyter*)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 37 (elastic 22, sigma 15)
field:"EventType" kind:eq value:"exec"
event.categoryeq
  • process corpus 105 (elastic 105)
field:"event.category" kind:eq value:"process"
event.typeeq
  • start corpus 67 (elastic 67)
field:"event.type" kind:eq value:"start"
process.argseq
  • -c corpus 19 (elastic 19)
field:"process.args" kind:eq value:"-c"
process.namein
  • bash corpus 21 (elastic 11, splunk 10)
  • csh corpus 11 (elastic 9, splunk 2)
  • dash corpus 20 (elastic 11, splunk 9)
  • fish corpus 12 (elastic 10, splunk 2)
  • ksh corpus 14 (elastic 10, splunk 4)
  • sh corpus 17 (elastic 11, splunk 6)
  • tcsh corpus 11 (elastic 9, splunk 2)
  • zsh corpus 16 (elastic 10, splunk 6)
field:"process_basename" kind:in
process.parent.namewildcard
  • python* corpus 19 (elastic 19)
field:"parent_process_basename" kind:wildcard value:"python*"

Exclusions

The rule actively suppresses these predicates.

GKE Client Certificate Signing Request Created or Approved

#
Status
production
Severity
medium
Time window
6m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects creation or approval of a GKE CertificateSigningRequest (CSR) by a non-system identity. This is a breadth baseline rule for human or custom automation CSR activity on GKE. Attackers with cluster access can submit and approve CSRs to obtain long-lived client certificates that survive token revocation and RBAC changes. Use companion rules to evaluate signer choice, requested identity, and self-approval behavior.

Known False Positives

  • Approved certificate workflows (for example cert-manager, internal PKI rotation, or node bootstrap) may create or update CSRs from identities not in the exclusion list if they run under a custom service account. Baseline automation that legitimately approves CSRs and tune exclusions for those principals.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/07/10"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/07/10"

[rule]
author = ["Elastic"]
description = """
Detects creation or approval of a GKE CertificateSigningRequest (CSR) by a non-system identity. This is a breadth
baseline rule for human or custom automation CSR activity on GKE. Attackers with cluster access can submit and approve
CSRs to obtain long-lived client certificates that survive token revocation and RBAC changes. Use companion rules to
evaluate signer choice, requested identity, and self-approval behavior.
"""
false_positives = [
    """
    Approved certificate workflows (for example cert-manager, internal PKI rotation, or node bootstrap) may create or
    update CSRs from identities not in the exclusion list if they run under a custom service account. Baseline
    automation that legitimately approves CSRs and tune exclusions for those principals.
    """,
]
from = "now-6m"
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE Client Certificate Signing Request Created or Approved"
note = """## Triage and analysis

### Investigating GKE Client Certificate Signing Request Created or Approved

Identify the actor (`client.user.email`), `source.ip`, and `user_agent.original`. Confirm whether the principal is
expected to create or approve CSRs. Review `event.action`, `gcp.audit.resource_name`, and when audit level captures
request bodies, the CSR spec in `gcp.audit.request` (requested signer, usages, and requested identity / Common Name).

### Extracting the Certificate Common Name

For create events, `gcp.audit.request.spec.request` may hold the base64-encoded PEM certificate signing request.
On GKE this is base64 of the full PEM CSR. Decode and inspect the subject for high-risk Common Names such as
`system:masters`, `system:kube-controller-manager`, and `system:admin`. The companion rule "GKE Certificate Signing
Request Privileged Identity Requested" decodes the CSR body and matches those identities automatically.

```bash
# Full decoded PEM block
echo "<gcp.audit.request.spec.request>" | base64 -d

# Parsed CSR details (subject, key type/size, extensions, signature)
echo "<gcp.audit.request.spec.request>" | base64 -d | openssl req -noout -text

# Subject only
echo "<gcp.audit.request.spec.request>" | base64 -d | openssl req -noout -subject
```

Priority CNs that usually indicate privilege escalation intent:

- `system:masters` (cluster-admin group)
- `system:kube-controller-manager` (broad control-plane-style access, including secrets and token minting)
- `system:kube-scheduler` (scheduling across the cluster)
- `system:kube-proxy` (node/network-adjacent access)
- Any CN that matches an existing ClusterRoleBinding subject name

### Possible investigation steps

- Compare the CSR name and extracted CN against approved PKI or bootstrap processes.
- Determine whether the same identity both created and approved the CSR in a short window (`approval.update`, `update`,
  or `patch`), which matches self-approval abuse.
- Review `gcp.audit.resource_name` and subsequent authentication or API activity from unusual networks.
- Correlate with RBAC changes, secret access, or TokenRequest activity that preceded CSR activity.

### False positive analysis

- Admins testing CSR workflows with kubectl are common in lab clusters. Baseline expected operators and tune exclusions.
- cert-manager or custom PKI automation outside the exclusion list may create or approve CSRs during normal rotation.

### Related rules

- GKE Certificate Signing Request API Client Signer Requested - 1e344fba-a2f7-462b-aaec-d6c8f80d5a28
- GKE Certificate Signing Request Privileged Identity Requested - 4159bec9-76ad-4cdc-a797-4a8572073bbe
- GKE Certificate Signing Request Self-Approved - e155e658-3dcd-4d27-a4e5-1d8da6704b0e

### Response and remediation

- If malicious, deny further approval, delete or deny the CSR per incident policy, revoke or rotate cluster signing
  trust if the CA or signer was abused, and invalidate issued credentials.
- Remove excessive RBAC that allows `certificatesigningrequests` create/update/patch or approval for untrusted
  identities; enforce signer restrictions and approved issuers where supported.

"""
setup = "The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."
references = [
    "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/",
    "https://kubernetes.io/docs/concepts/security/rbac-good-practices/",
    "https://stratus-red-team.cloud/attack-techniques/kubernetes/k8s.persistence.create-client-certificate/",
    "https://raesene.github.io/blog/2022/12/21/Kubernetes-persistence-with-Tocan-and-Teisteanas/",
    "https://www.aquasec.com/blog/kubernetes-rbac-privilige-escalation/",
]
risk_score = 47
rule_id = "ec67ab57-945a-4edb-84f8-1d7a51f46544"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Kubernetes",
    "Data Source: GCP",
    "Data Source: GCP Audit Logs",
    "Data Source: Google Cloud Platform",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Privilege Escalation",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:"gcp.audit" and service.name:"k8s.io" and event.outcome:"success" and
event.action:(
  "io.k8s.certificates.v1.certificatesigningrequests.create" or
  "io.k8s.certificates.v1.certificatesigningrequests.approval.update"
) and not client.user.email:(
  "system:gcp-controller-manager" or
  "system:kube-controller-manager" or
  "system:serviceaccount:kube-system:certificate-controller"
) and not (
  event.action:"io.k8s.certificates.v1.certificatesigningrequests.create" and
  client.user.email:(
    "kubelet-bootstrap" or
    "kubelet-nodepool-bootstrap" or
    system\:node\:*
  )
)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[[rule.threat.technique.subtechnique]]
id = "T1098.006"
name = "Additional Container Cluster Roles"
reference = "https://attack.mitre.org/techniques/T1098/006/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[[rule.threat.technique.subtechnique]]
id = "T1098.006"
name = "Additional Container Cluster Roles"
reference = "https://attack.mitre.org/techniques/T1098/006/"

[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "client.user.email",
    "source.ip",
    "user_agent.original",
    "event.action",
    "event.outcome",
    "gcp.audit.resource_name",
    "gcp.audit.request",
    "gcp.audit.response",
    "data_stream.namespace",
]

Stages and Predicates

Stage 1: query

data_stream.dataset:"gcp.audit" and service.name:"k8s.io" and event.outcome:"success" and
event.action:(
  "io.k8s.certificates.v1.certificatesigningrequests.create" or
  "io.k8s.certificates.v1.certificatesigningrequests.approval.update"
) and not client.user.email:(
  "system:gcp-controller-manager" or
  "system:kube-controller-manager" or
  "system:serviceaccount:kube-system:certificate-controller"
) and not (
  event.action:"io.k8s.certificates.v1.certificatesigningrequests.create" and
  client.user.email:(
    "kubelet-bootstrap" or
    "kubelet-nodepool-bootstrap" or
    system\:node\:*
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.dataseteq
  • gcp.audit corpus 60 (elastic 60)
field:"data_stream.dataset" kind:eq value:"gcp.audit"
event.actionin
  • io.k8s.certificates.v1.certificatesigningrequests.approval.update
  • io.k8s.certificates.v1.certificatesigningrequests.create
field:"EventType" kind:in
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
service.nameeq
  • k8s.io corpus 28 (elastic 28)
field:"ServiceName" kind:eq value:"k8s.io"

Exclusions

The rule actively suppresses these predicates.

Google Workspace Admin Role Assigned to a User or Group

#
Status
production
Severity
high
Time window
130m
Author
Elastic
Source
github.com/elastic/detection-rules

Assigning an administrative role to a user or group grants elevated privileges within Google Workspace, including access to the Google Admin console and the ability to manage domain resources and applications. Adversaries may assign administrator roles to an existing account or a newly created account/group to establish persistence, facilitate privilege escalation, and enable follow-on actions across the tenant. In particular, users with Super Admin privileges can bypass single sign-on (SSO) if it is enabled in Google Workspace.

Known False Positives

  • Google Workspace admin role assignments may be modified by system administrators. Verify that the configuration change was expected. Exceptions can be added to this rule to filter expected behavior.

MITRE ATT&CK Coverage

Telemetry Coverage

PlatformRecord / event type
Google WorkspaceASSIGN_ROLE: Assign Role

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2020/11/17"
integration = ["google_workspace"]
maturity = "production"
updated_date = "2026/05/29"

[rule]
author = ["Elastic"]
description = """
Assigning an administrative role to a user or group grants elevated privileges within Google Workspace, including
access to the Google Admin console and the ability to manage domain resources and applications. Adversaries may assign
administrator roles to an existing account or a newly created account/group to establish persistence, facilitate
privilege escalation, and enable follow-on actions across the tenant. In particular, users with Super Admin privileges
can bypass single sign-on (SSO) if it is enabled in Google Workspace.
"""
false_positives = [
    """
    Google Workspace admin role assignments may be modified by system administrators. Verify that the configuration
    change was expected. Exceptions can be added to this rule to filter expected behavior.
    """,
]
from = "now-130m"
index = ["filebeat-*", "logs-google_workspace.admin-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "Google Workspace Admin Role Assigned to a User or Group"
note = """## Triage and analysis

### Investigating Google Workspace Admin Role Assigned to a User or Group

Google Workspace roles allow administrators to assign specific permissions to users or groups. Because these roles can
grant broad administrative control over identity, devices, and security settings, role assignments should follow the
principle of least privilege (PoLP) and be carefully controlled. Threat actors may assign high-privilege roles (for
example, Super Admin or other *_ADMIN_ROLE roles) to establish persistence, expand access, and perform follow-on actions
such as creating OAuth tokens, modifying security controls, changing mail routing, or altering SSO settings. Unexpected
admin privileges can also lead to operational impact if changes are made unintentionally.

This rule identifies when a Google Workspace administrative role is assigned to a user or a group.

### Possible investigation steps

- Identify the initiating (actor) account that performed the change by reviewing `user.email` or `user.name`, and note the `source.ip` and `event.ingested` timestamps.
- Identify the target principal that received the role assignment:
  - For assignments, review `user.target.email` and `user.target.name`.
  - For group assignments, determine which users are members of that group at the time of assignment.
- Identify the role assigned by reviewing `google_workspace.admin.role.name`.
- Determine whether the assignment is expected and authorized:
  - Validate there is an approved change request/ticket and that the actor account is authorized to grant this level of access.
  - If the role is high privilege (for example, Super Admin), treat as urgent until proven benign.
- Scope for additional role assignments by searching for `event.action: ASSIGN_ROLE` over an expanded time window and filtering on:
  - The same `user.email` (actor) to find other role changes performed by the same account.
  - The same `google_workspace.admin.role.name` to identify other principals granted the role.
  - The same target (`user.target.email`) to identify multiple roles granted to the same principal.
- Evaluate whether the target user (or group members) performed suspicious activity after receiving the role:
  - Review the last 48 hours of admin/audit events for security control changes, user or group changes, and Gmail configuration changes.
  - If available, correlate with sign-in events for unusual geolocation, impossible travel, unfamiliar devices, or sign-ins from the `source.ip`.
- Determine whether the target user account was recently created by searching for `event.action: CREATE_USER` and filtering for `user.target.email`.

### False positive analysis

- Verify the role assignment aligns with approved administrative duties, an authorized change window, and the organization’s access governance process.
- Confirm the initiating admin account is legitimate and not performing role assignments from unusual IPs, devices, or locations.
- For group assignments, verify the group is intended for administrative delegation and validate recent membership changes that could expand who effectively received the privilege.

### Response and remediation

- Initiate the incident response process based on triage findings.
- If the assignment is not clearly authorized, remove the role assignment from the user/group and/or place the target account(s) under administrative restriction while the investigation proceeds.
- For suspected compromise of the initiating admin account:
  - Reset credentials, revoke active sessions, enforce MFA re-enrollment, and review delegation/OAuth grants for persistence.
  - Validate recovery email/phone settings and account security posture.
- Review the permissions assigned to the implicated user/group to ensure PoLP is being followed, and consider replacing broad roles with narrower delegated roles where feasible.
- Implement security best practices [outlined](https://support.google.com/a/answer/7587183) by Google.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

## Setup

The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.

### Important Information Regarding Google Workspace Event Lag Times
- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
- By default, `var.interval` is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m).
- See the following references for further information:
  - https://support.google.com/a/answer/7061566
  - https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-google_workspace.html"""
references = [
    "https://support.google.com/a/answer/172176?hl=en",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two"
]
risk_score = 73
rule_id = "68994a6c-c7ba-4e82-b476-26a26877adf6"
severity = "high"
tags = [
    "Domain: Cloud",
    "Data Source: Google Workspace",
    "Use Case: Identity and Access Audit",
    "Tactic: Persistence",
    "Tactic: Privilege Escalation",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:"google_workspace.admin" and event.action:"ASSIGN_ROLE"
  and google_workspace.admin.role.name : *_ADMIN_ROLE
'''

[rule.investigation_fields]
field_names = [
    "source.ip",
    "user.name",
    "user.email",
    "event.action",
    "google_workspace.admin.role.name",
    "user.target.name",
    "user.target.email",
]

[[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.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/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 = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[[rule.threat.technique.subtechnique]]
id = "T1098.003"
name = "Additional Cloud Roles"
reference = "https://attack.mitre.org/techniques/T1098/003/"

[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

Stages and Predicates

Stage 1: query

data_stream.dataset:"google_workspace.admin" and event.action:"ASSIGN_ROLE"
  and google_workspace.admin.role.name : *_ADMIN_ROLE

Indicators

These rows show field, operator, and value matches.

Google Workspace Drive Encryption Key(s) Accessed from Anonymous User

#
Status
production
Severity
high
Time window
130m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects when an anonymous user views, copies, or downloads a private key or credential file from Google Drive via an anyone-with-the-link share. Adversaries who obtain or create open Drive links can harvest encryption keys and secrets stored in user drives, then use those materials to decrypt data, authenticate to services, or expand access beyond the initial compromise.

Known False Positives

  • A user may generate a shared access link to encryption key files to share with others. It is unlikely that the intended recipient is an external or anonymous user.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2023/03/21"
integration = ["google_workspace"]
maturity = "production"
updated_date = "2026/06/02"

[rule]
author = ["Elastic"]
description = """
Detects when an anonymous user views, copies, or downloads a private key or credential file from Google Drive via an
anyone-with-the-link share. Adversaries who obtain or create open Drive links can harvest encryption keys and secrets
stored in user drives, then use those materials to decrypt data, authenticate to services, or expand access beyond the
initial compromise.
"""
false_positives = [
    """
    A user may generate a shared access link to encryption key files to share with others. It is unlikely that the
    intended recipient is an external or anonymous user.
    """,
]
from = "now-130m"
index = ["filebeat-*", "logs-google_workspace.drive-*"]
interval = "10m"
language = "eql"
license = "Elastic License v2"
name = "Google Workspace Drive Encryption Key(s) Accessed from Anonymous User"
note = """## Triage and analysis

### Investigating Google Workspace Drive Encryption Key(s) Accessed from Anonymous User

Threat actors and opportunistic scanners frequently abuse Google Drive links set to "Anyone with the link" to access
sensitive files without authenticating. Private keys, keystores, and token files stored in user drives are high-value
targets. Possession of these files can enable decryption of protected data, signing or impersonation, and lateral
movement into systems that trust the exposed material.

This rule uses EQL to detect `view`, `copy`, or `download` activity in `google_workspace.drive` where
`google_workspace.drive.visibility` is `people_with_link`, `source.user.email` is empty (anonymous access), and
`file.extension` matches common key or credential file types.

### Possible investigation steps

- Identify the file accessed by reviewing `file.name` and `google_workspace.drive.file.type`, and note `event.action` (`view`, `copy`, or `download`) and `event.ingested`.
- Identify the file owner by reviewing `google_workspace.drive.file.owner.email` and determine whether that user should store key material in Drive.
- Review `source.user.id` and any available IP or user-agent context in the raw event to characterize the anonymous accessor.
- Confirm sharing posture in Google Drive:
  - Open the file in Drive as an administrator or the owner and review Share settings.
  - Verify whether access is "Anyone with the link" and whether the link was intentionally published or may have been exposed after account compromise.
- Search Kibana for related Drive activity for the same file or owner:
  ```
  data_stream.dataset: "google_workspace.drive" and google_workspace.drive.file.owner.email: "<OWNER_EMAIL>" and file.name: "<FILE_NAME>"
  ```
  - Look for earlier `change_user_access`, `change_document_visibility`, or `rename` events that may indicate when the link was opened.
  - Search for other key-like files owned by the same user with `people_with_link` visibility.
- Determine blast radius — identify which systems, applications, or cloud resources the key protects (VPN, TLS, code signing, service accounts, encrypted archives).
- Contact the file owner and security stakeholders to confirm whether anonymous access was expected (for example, a documented external audit). Treat unexpected access as high priority.

### False positive analysis

- Legitimate use of link-based sharing for key files is rare; validate business justification before closing as benign.
- Automated scanners or DLP tools may touch public links — correlate with known security tooling and owner intent.

### Response and remediation

- Initiate the incident response process based on triage findings.
- Revoke the open link or restrict sharing to specific users; move key material out of broadly link-shared locations.
- If access is unauthorized, rotate or replace the exposed keys and review dependent systems for abuse.
- Review the file owner's account for signs of compromise (unusual logins, OAuth grants, or mass sharing changes).

## Setup

The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.

### Important Information Regarding Google Workspace Event Lag Times
- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
- By default, `var.interval` is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m).
- See the following references for further information:
  - https://support.google.com/a/answer/7061566
  - https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-google_workspace.html"""
references = [
    "https://support.google.com/drive/answer/2494822",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two"
]
risk_score = 73
rule_id = "980b70a0-c820-11ed-8799-f661ea17fbcc"
severity = "high"
tags = [
    "Domain: Cloud",
    "Data Source: Google Workspace",
    "Use Case: Configuration Audit",
    "Tactic: Credential Access",
    "Tactic: Collection",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where data_stream.dataset == "google_workspace.drive" and event.action : ("copy", "view", "download") and
    google_workspace.drive.visibility: "people_with_link" and source.user.email == "" and
    file.extension: (
        "token","assig", "pssc", "keystore", "pub", "pgp.asc", "ps1xml", "pem", "gpg.sig", "der", "key",
        "p7r", "p12", "asc", "jks", "p7b", "signature", "gpg", "pgp.sig", "sst", "pgp", "gpgz", "pfx", "crt",
        "p8", "sig", "pkcs7", "jceks", "pkcs8", "psc1", "p7c", "csr", "cer", "spc", "ps2xml")
'''

[rule.investigation_fields]
field_names = [
    "source.user.id",
    "event.action",
    "file.name",
    "google_workspace.drive.file.type",
    "google_workspace.drive.file.owner.email",
]

[[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.004"
name = "Private Keys"
reference = "https://attack.mitre.org/techniques/T1552/004/"

[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 = "T1530"
name = "Data from Cloud Storage"
reference = "https://attack.mitre.org/techniques/T1530/"

[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

Stages and Predicates

Stage 1: file

file where data_stream.dataset == "google_workspace.drive" and event.action : ("copy", "view", "download") and
    google_workspace.drive.visibility: "people_with_link" and source.user.email == "" and
    file.extension: (
        "token","assig", "pssc", "keystore", "pub", "pgp.asc", "ps1xml", "pem", "gpg.sig", "der", "key",
        "p7r", "p12", "asc", "jks", "p7b", "signature", "gpg", "pgp.sig", "sst", "pgp", "gpgz", "pfx", "crt",
        "p8", "sig", "pkcs7", "jceks", "pkcs8", "psc1", "p7c", "csr", "cer", "spc", "ps2xml")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.dataseteq
  • google_workspace.drive corpus 2 (elastic 2)
field:"data_stream.dataset" kind:eq value:"google_workspace.drive"
event.actionwildcard
  • copy
  • download corpus 2 (elastic 1, kusto 1)
  • view
field:"EventType" kind:wildcard
file.extensionwildcard
  • asc
  • assig
  • cer
  • crt
  • csr
  • der
  • gpg
  • gpg.sig
  • gpgz
  • jceks
  • jks
  • key
  • keystore
  • p12
  • p7b corpus 2 (elastic 2)
  • p7c
  • p7r
  • p8
  • pem
  • pfx
  • pgp
  • pgp.asc
  • pgp.sig
  • pkcs7
  • pkcs8
  • ps1xml
  • ps2xml
  • psc1
  • pssc
  • pub
  • sig
  • signature
  • spc
  • sst
  • token
field:"file.extension" kind:wildcard
google_workspace.drive.visibilitywildcard
  • people_with_link
field:"google_workspace.drive.visibility" kind:wildcard value:"people_with_link"

Ingress Tool Transfer via INET Cache

#
Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the use of a signed utility that takes a remote URL as a process argument or no arguments at all followed by the creation of an executable file in the INetCache Folder. Adversaries may use trusted utilities to download extra payloads to avoid ingress tool transfer restrictions.

MITRE ATT&CK Coverage

TacticTechniques
Command & Control

Rule Body

[rule]
description = """
Identifies the use of a signed utility that takes a remote URL as a process argument or no arguments at all followed by
the creation of an executable file in the INetCache Folder. Adversaries may use trusted utilities to download extra
payloads to avoid ingress tool transfer restrictions.
"""
id = "bd4d88c1-466e-4591-9c81-f2d257dbc9db"
license = "Elastic License v2"
name = "Ingress Tool Transfer via INET Cache"
os_list = ["windows"]
reference = [
    "https://attack.mitre.org/techniques/T1105/",
    "https://www.elastic.co/security-labs/unmasking-financial-services-intrusion-ref0657",
]
version = "1.0.7"

query = '''
sequence by process.entity_id with maxspan=1m
 [process where event.action == "start" and not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and 
  process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft*" and 
  (process.command_line : "*http*" or (process.executable : "?:\\Windows\\*" and process.args_count <= 1)) and 
  not process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and
  not (process.name : "rundll32.exe" and process.args : "C:\\Windows\\System32\\rundll32.exe  C:\\Windows\\System32\\LogiLDA.dll,LogiFetch")]
 [file where event.action!= "deletion" and file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\*" and 
  (file.Ext.header_bytes : "4d5a*" or 
   file.extension : ("exe", "pif", "scr", "dll", "cpl", "bat", "cmd", "hta"))]
'''

min_endpoint_version = "8.0.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 = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "8.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 not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and 
  process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft*" and 
  (process.command_line : "*http*" or (process.executable : "?:\\Windows\\*" and process.args_count <= 1)) and 
  not process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and
  not (process.name : "rundll32.exe" and process.args : "C:\\Windows\\System32\\rundll32.exe  C:\\Windows\\System32\\LogiLDA.dll,LogiFetch")]

Stage 2: file

[file where event.action!= "deletion" and file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\*" and 
  (file.Ext.header_bytes : "4d5a*" or 
   file.extension : ("exe", "pif", "scr", "dll", "cpl", "bat", "cmd", "hta"))]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 4d5a* corpus 45 (elastic 45)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.extensionwildcard
  • bat corpus 13 (elastic 13)
  • cmd corpus 15 (elastic 15)
  • cpl corpus 19 (elastic 19)
  • dll corpus 32 (elastic 32)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • pif corpus 18 (elastic 18)
  • scr corpus 17 (elastic 17)
field:"file.extension" kind:wildcard
file.pathwildcard
  • ?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*
field:"TargetFilename" kind:wildcard value:"?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*"
process.args_countle
  • 1 transforms: number corpus 5 (elastic 5)
field:"process.args_count" kind:le value:"1"
process.code_signature.subject_namewildcard
  • Microsoft* corpus 19 (elastic 19)
field:"Signature" kind:wildcard value:"Microsoft*"
process.code_signature.trustedeq
  • true transforms: boolean corpus 14 (elastic 14)
field:"process.code_signature.trusted" kind:eq value:"true"
process.command_linewildcard
  • *http* corpus 45 (sigma 34, elastic 10, splunk 1)
field:"CommandLine" kind:wildcard value:"*http*"
process.executablewildcard
  • ?:\Windows\* corpus 5 (elastic 5)
field:"Image" kind:wildcard value:"?:\Windows\*"

Exclusions

The rule actively suppresses these predicates.

M365 Identity OAuth Flow by User Sign-in to Device Registration

#
Status
production
Severity
high
Time window
30m
Sequence by
related.user
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies attempts to register a new device in Microsoft Entra ID after OAuth authentication with authorization code grant. Adversaries may use OAuth phishing techniques to obtain an OAuth authorization code, which can then be exchanged for access and refresh tokens. This rule detects a sequence of events where a user principal authenticates via OAuth, followed by a device registration event, indicating potential misuse of the OAuth flow to establish persistence or access resources.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2025/04/30"
integration = ["o365"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Identifies attempts to register a new device in Microsoft Entra ID after OAuth authentication with authorization code
grant. Adversaries may use OAuth phishing techniques to obtain an OAuth authorization code, which can then be exchanged
for access and refresh tokens. This rule detects a sequence of events where a user principal authenticates via OAuth,
followed by a device registration event, indicating potential misuse of the OAuth flow to establish persistence or
access resources.
"""
from = "now-30m"
index = ["filebeat-*", "logs-o365.audit-*"]
interval = "15m"
language = "eql"
license = "Elastic License v2"
name = "M365 Identity OAuth Flow by User Sign-in to Device Registration"
note = """## Triage and analysis

### Investigating M365 Identity OAuth Flow by User Sign-in to Device Registration

### Possible investigation steps
- Review the two UserLoggedIn logs to confirm that they come from different source.ip values and are associated to the same account.
- Verify all events associated to the source.ip of the the second event in the sequence.
- Investiguate the details of the new device that was added by reviewing the o365.audit.ModifiedProperties.Device_DisplayName.NewValue attribute.
- Investigate the user account associated with the successful sign-in to determine if this activity aligns with expected behavior or if it appears suspicious.
- Review the history of sign-ins for the user to identify any patterns or unusual access times that could suggest unauthorized access.
- Assess the device from which the sign-in was attempted to ensure it is a recognized and authorized device for the user.

### False positive analysis
- Both authentcation events of the sequence are originatng from the same source.ip.
- User using multiple devices and attempted to add a new device post an OAuth code authentication.

### Response and remediation
- Immediately revoke the compromised Primary Refresh Tokens (PRTs) to prevent further unauthorized access. This can be done through the Azure portal by navigating to the user's account and invalidating all active sessions.
- Enforce a password reset for the affected user accounts to ensure that any credentials potentially compromised during the attack are no longer valid.
- Implement additional Conditional Access policies that require device compliance checks and restrict access to trusted locations or devices only, to mitigate the risk of future PRT abuse.
- Conduct a thorough review of the affected accounts' recent activity logs to identify any unauthorized actions or data access that may have occurred during the compromise.
- Escalate the incident to the security operations team for further investigation and to determine if there are any broader implications or additional compromised accounts.
- Enhance monitoring by configuring alerts for unusual sign-in patterns or device code authentication attempts from unexpected locations or devices, to improve early detection of similar threats.
- Coordinate with the incident response team to perform a post-incident analysis and update the incident response plan with lessons learned from this event."""
references = [
    "https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow",
    "https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
]
risk_score = 73
rule_id = "fcd2e4be-6ec4-482f-9222-6245367cd738"
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: SaaS",
    "Data Source: Microsoft 365",
    "Data Source: Microsoft 365 Audit Logs",
    "Use Case: Identity and Access Audit",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",

]
timestamp_override = "event.ingested"
type = "eql"

query = '''
sequence by related.user with maxspan=30m
[authentication where event.action == "UserLoggedIn" and
 o365.audit.ExtendedProperties.RequestType == "OAuth2:Authorize" and o365.audit.ExtendedProperties.ResultStatusDetail == "Redirect" and
 o365.audit.UserType: ("0", "2", "3", "10")] // victim source.ip
[authentication where event.action == "UserLoggedIn" and
 o365.audit.ExtendedProperties.RequestType == "OAuth2:Token" and o365.audit.ExtendedProperties.ResultStatusDetail == "Success"] // attacker source.ip to convert oauth code to token
[web where data_stream.dataset == "o365.audit" and event.action == "Add registered users to device."] // user.name is captured in related.user
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"

[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

[[rule.threat.technique.subtechnique]]
id = "T1098.005"
name = "Device Registration"
reference = "https://attack.mitre.org/techniques/T1098/005/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"

[[rule.threat.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"

[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30m, correlated by related.user.

Stage 1: authentication

[authentication where event.action == "UserLoggedIn" and
 o365.audit.ExtendedProperties.RequestType == "OAuth2:Authorize" and o365.audit.ExtendedProperties.ResultStatusDetail == "Redirect" and
 o365.audit.UserType: ("0", "2", "3", "10")]

Stage 2: authentication

[authentication where event.action == "UserLoggedIn" and
 o365.audit.ExtendedProperties.RequestType == "OAuth2:Token" and o365.audit.ExtendedProperties.ResultStatusDetail == "Success"]

Stage 3: web

[web where data_stream.dataset == "o365.audit" and event.action == "Add registered users to device."]

Indicators

These rows show field, operator, and value matches.

Newly Observed RC4 Kerberos Service Ticket Request

#
Status
production
Severity
medium
Time window
9m
Group by
winlog.event_data.ServiceName, winlog.event_data.TargetUserName
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies a successful RC4-HMAC Kerberos service ticket request for a requester and service pair that has not been observed during the previous 7 days. A newly observed requester-to-service relationship involving an RC4-encrypted ticket may indicate Kerberoasting.

Known False Positives

  • First-time or infrequent access to legacy services, cross-platform integrations, and inter-domain trust activity may legitimately establish a new requester-to-service relationship using RC4 encryption.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/08/04"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/08/10"

[rule]
author = ["Elastic"]
description = """
Identifies a successful RC4-HMAC Kerberos service ticket request for a requester and service pair that has not been
observed during the previous 7 days. A newly observed requester-to-service relationship involving an RC4-encrypted
ticket may indicate Kerberoasting.
"""
false_positives = [
    """
    First-time or infrequent access to legacy services, cross-platform integrations, and inter-domain trust activity may
    legitimately establish a new requester-to-service relationship using RC4 encryption.
    """,
]
from = "now-9m"
index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
language = "kuery"
license = "Elastic License v2"
name = "Newly Observed RC4 Kerberos Service Ticket Request"
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 Newly Observed RC4 Kerberos Service Ticket Request

This alert flags a successful Windows Kerberos service ticket request that used legacy RC4 encryption for a requester-to-service pairing not seen in the last week. It matters because RC4 tickets are easier for attackers to crack offline, and a new pairing can reveal account targeting rather than normal application behavior. A common pattern is an intruder using a low-privileged domain account to request RC4 tickets for SPN-backed service accounts, then extracting password hashes for Kerberoasting.

### Possible investigation steps

- Validate whether the requester, source host, and service account relationship aligns with a known application change, scheduled task, or newly deployed system, because legitimate first-seen pairings often coincide with onboarding or configuration work.
- Review recent authentication activity for the requester across domain controllers for bursts of service ticket requests to multiple SPNs, especially privileged or human-managed service accounts, which is a strong Kerberoasting pattern.
- Pivot on the requesting host and user for adjacent suspicious behavior such as interactive logons from unusual systems, PowerShell or script execution, remote administration activity, credential dumping alerts, or other Active Directory enumeration in the same timeframe.
- Examine the targeted service account’s privilege level, password age, SPN exposure, delegation settings, and whether it still permits RC4, then prioritize escalation if the account is highly privileged, old, or tied to critical services.
- If the activity is not readily explained, contain the requester and source system as appropriate and rotate the service account credentials while planning to disable RC4 support and enforce stronger Kerberos encryption for affected accounts.

### False positive analysis

- A newly deployed or reconfigured Windows service, scheduled task, or application host can create a first-seen requester-to-service pairing against a legacy SPN that still uses RC4, so verify recent change activity and confirm the requester, source host, and service account match the expected business function.
- An infrequently run maintenance or batch process may legitimately request an RC4 service ticket after more than seven days of inactivity, so confirm the event time aligns with its normal schedule and review adjacent 4769 activity to ensure the account is only accessing its usual limited set of services.

### Response and remediation

- Isolate the requesting host and any other systems used by the compromised account from the network, block remote administration access, and preserve volatile and disk evidence before rebooting or rebuilding them.
- Disable the compromised requester account and the targeted service account, rotate passwords or keys for every exposed SPN-backed service they can access, and force logoff or ticket purge so previously issued Kerberos tickets cannot be reused.
- Remove attacker persistence by reviewing and deleting unauthorized scheduled tasks, services, startup items, WMI event subscriptions, remote access tools, Run key entries, and any newly granted local or domain group memberships tied to the affected identities or hosts.
- Restore affected endpoints and servers to a known-good state by reimaging compromised systems or rolling back unauthorized changes, then verify business applications start cleanly with the newly rotated service credentials.
- Escalate to incident response immediately if the targeted service account is privileged, tied to domain controllers or other Tier 0 systems, or if you also find credential dumping, lateral movement, multiple unusual SPN requests, or forged-ticket activity.
- Harden the environment by disabling RC4 where legacy dependencies permit it, enforcing AES-only Kerberos encryption on service accounts, migrating eligible services to gMSAs, reducing excessive service account privileges and SPNs, and adding detections for unusual service ticket bursts and new requester-to-service relationships.
"""
references = [
    "https://learn.microsoft.com/en-us/windows-server/security/kerberos/detect-remediate-rc4-kerberos",
]
risk_score = 47
rule_id = "57bc9e8d-9054-472c-9752-4aa91dc4cd49"
setup = """## Setup

Audit Kerberos Service Ticket Operations must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-kerberos-service-ticket-operations
"""
severity = "medium"
tags = [
    "Domain: Identity",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Use Case: Active Directory Monitoring",
    "Data Source: Active Directory",
    "Data Source: Windows Security Event Logs",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
host.os.type:windows and event.category:authentication and event.code:4769 and
  winlog.event_data.Status:0x0 and winlog.event_data.TicketEncryptionType:0x17 and
  winlog.event_data.TargetUserName:* and
  winlog.event_data.ServiceName:(* and not (krbtgt or *$)) and
  not (winlog.event_data.TargetUserName:*$@* and source.ip:(127.0.0.0/8 or "::1"))
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1558"
name = "Steal or Forge Kerberos Tickets"
reference = "https://attack.mitre.org/techniques/T1558/"
[[rule.threat.technique.subtechnique]]
id = "T1558.003"
name = "Kerberoasting"
reference = "https://attack.mitre.org/techniques/T1558/003/"

[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[rule.new_terms]
field = "new_terms_fields"
value = ["winlog.event_data.TargetUserName", "winlog.event_data.ServiceName"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"

Stages and Predicates

Stage 1: new_terms

host.os.type:windows and event.category:authentication and event.code:4769 and
  winlog.event_data.Status:0x0 and winlog.event_data.TicketEncryptionType:0x17 and
  winlog.event_data.TargetUserName:* and
  winlog.event_data.ServiceName:(* and not (krbtgt or *$)) and
  not (winlog.event_data.TargetUserName:*$@* and source.ip:(127.0.0.0/8 or "::1"))

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Persistence via Scheduled Job Creation

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

A job can be used to schedule programs or scripts to be executed at a specified date and time. Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code.

Known False Positives

  • Legitimate scheduled jobs may be created during installation of new software.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2021/03/15"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender"]
maturity = "production"
updated_date = "2026/07/21"

[rule]
author = ["Elastic"]
description = """
A job can be used to schedule programs or scripts to be executed at a specified date and time. Adversaries may abuse
task scheduling functionality to facilitate initial or recurring execution of malicious code.
"""
false_positives = ["Legitimate scheduled jobs may be created during installation of new software."]
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.file-*",
    "logs-windows.sysmon_operational-*",
    "endgame-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-m365_defender.event-*",
]
language = "eql"
license = "Elastic License v2"
name = "Persistence via Scheduled Job Creation"
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Persistence via Scheduled Job Creation

Scheduled jobs in Windows environments allow tasks to be automated by executing scripts or programs at specified times. Adversaries exploit this feature to maintain persistence by scheduling malicious code execution. The detection rule identifies suspicious job creation by monitoring specific file paths and extensions, excluding known legitimate processes, to flag potential abuse while minimizing false positives.

### Possible investigation steps

- Review the file path and extension to confirm the presence of a scheduled job in the "?:\\Windows\\Tasks\\" directory with a ".job" extension, which is indicative of a scheduled task.
- Examine the process executable path to determine if the job creation is associated with any known legitimate processes, such as CCleaner or ManageEngine, which are excluded in the detection rule.
- Investigate the origin of the process that created the scheduled job by checking the process execution history and command line arguments to identify any potentially malicious behavior.
- Analyze the scheduled job's content and associated scripts or programs to identify any suspicious or unauthorized code that may indicate malicious intent.
- Correlate the event with other security logs and alerts from data sources like Elastic Endgame, Sysmon, or Microsoft Defender XDR to gather additional context and identify any related malicious activity.
- Assess the risk and impact of the scheduled job by determining if it aligns with known adversary tactics, techniques, and procedures (TTPs) related to persistence, as outlined in the MITRE ATT&CK framework.

### False positive analysis

- Scheduled jobs created by CCleaner for crash reporting can trigger false positives. Exclude the path "?:\\Windows\\Tasks\\CCleanerCrashReporting.job" when the process executable is "?:\\Program Files\\CCleaner\\CCleaner64.exe".
- ManageEngine UEMS Agent and DesktopCentral Agent may create scheduled jobs for updates, leading to false positives. Exclude the path "?:\\Windows\\Tasks\\DCAgentUpdater.job" when the process executable is "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dcagentregister.exe" or "?:\\Program Files (x86)\\DesktopCentral_Agent\\bin\\dcagentregister.exe".
- Regularly review and update exclusion lists to ensure they reflect the current environment and legitimate software behavior.
- Consider implementing a whitelist of known legitimate processes and paths to further reduce false positives while maintaining effective threat detection.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further execution of potentially malicious scheduled jobs and limit lateral movement.
- Terminate any suspicious processes associated with the identified scheduled job, using tools like Task Manager or PowerShell, to halt any ongoing malicious activity.
- Delete the suspicious scheduled job file from the system to prevent future execution. This can be done using the Task Scheduler or command-line tools.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) solutions to identify and remove any additional malicious files or remnants.
- Review and audit other scheduled tasks on the system to ensure no additional unauthorized or suspicious jobs are present.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if other systems are affected.
- Implement enhanced monitoring and alerting for scheduled job creation activities across the network to detect similar threats in the future, leveraging the specific query fields used in the detection rule."""
risk_score = 47
rule_id = "1327384f-00f3-44d5-9a8c-2373ba071e92"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: SentinelOne",
    "Data Source: Microsoft Defender XDR",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type == "windows" and event.type != "deletion" and
  file.path : "?:\\Windows\\Tasks\\*" and file.extension : "job" and
  not (
    (
      process.executable : "?:\\Program Files\\CCleaner\\CCleaner64.exe" and
      file.path : "?:\\Windows\\Tasks\\CCleanerCrashReporting.job"
    ) or
    process.executable : (
      "?:\\Program Files (x86)\\DesktopCentral_Agent\\bin\\dcagentregister.exe",
      "?:\\Program Files (x86)\\epson\\Epson Scan 2\\Update\\e_dtsksd.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dcagentregister.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\dcconfig.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\UemsComponentUpgrader.exe",
      "?:\\Program Files (x86)\\Skillbrains\\Updater\\*\\Updater.exe",
      "?:\\Windows\\System32\\drivers\\RivetNetworks\\Killer\\CustomizeInstallFirstRun.exe"
    )
  )
'''

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 11 - File Create](https://ela.st/sysmon-event-11-setup)
"""


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[rule.threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"



[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

Stages and Predicates

Stage 1: file

file where host.os.type == "windows" and event.type != "deletion" and
  file.path : "?:\\Windows\\Tasks\\*" and file.extension : "job" and
  not (
    (
      process.executable : "?:\\Program Files\\CCleaner\\CCleaner64.exe" and
      file.path : "?:\\Windows\\Tasks\\CCleanerCrashReporting.job"
    ) or
    process.executable : (
      "?:\\Program Files (x86)\\DesktopCentral_Agent\\bin\\dcagentregister.exe",
      "?:\\Program Files (x86)\\epson\\Epson Scan 2\\Update\\e_dtsksd.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dcagentregister.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\dcconfig.exe",
      "?:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\UemsComponentUpgrader.exe",
      "?:\\Program Files (x86)\\Skillbrains\\Updater\\*\\Updater.exe",
      "?:\\Windows\\System32\\drivers\\RivetNetworks\\Killer\\CustomizeInstallFirstRun.exe"
    )
  )

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.patheq?:\Windows\Tasks\CCleanerCrashReporting.jobexcludes:file.path field:"file.path" value:"?:\Windows\Tasks\CCleanerCrashReporting.job"
process.executableeq?:\Program Files\CCleaner\CCleaner64.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files\CCleaner\CCleaner64.exe"
process.executablewildcard?:\Program Files (x86)\DesktopCentral_Agent\bin\dcagentregister.exe, ?:\Program Files (x86)\epson\Epson Scan 2\Update\e_dtsksd.exe, ?:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\dcagentregister.exe, ?:\Program Files (x86)\ManageEngine\UEMS_Agent\dcconfig.exe, ?:\Program Files (x86)\ManageEngine\UEMS_Agent\Updates\UemsComponentUpgrader.exe, ?:\Program Files (x86)\Skillbrains\Updater\*\Updater.exe, ?:\Windows\System32\drivers\RivetNetworks\Killer\CustomizeInstallFirstRun.exeexcludes:process.executable

Potential Command and Control via Windows Scripts

#
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the execution of a Windows script interpreter followed by a network connection or DNS loookup request after 5 minutes of the process start. This may indicate long term network activity from a Windows script which is common pattern of a command and control backdoor via malicious scripts.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the execution of a Windows script interpreter followed by a network connection or DNS loookup request after 5
minutes of the process start. This may indicate long term network activity from a Windows script which is common pattern
of a command and control backdoor via malicious scripts.
"""
id = "3121956f-8c0b-40ef-b98d-7b7b0ab02d2e"
license = "Elastic License v2"
name = "Potential Command and Control via Windows Scripts"
os_list = ["windows"]
version = "1.0.11"

query = '''
sequence by process.entity_id
 [process where event.action == "start" and
  process.pe.original_file_name : ("wscript.exe", "AutoIt*.exe") and
  not process.Ext.token.integrity_level_name == "system" and not process.args : "\\\\*\\netlogon\\*.vbs"]
 [network where
  event.action == "connection_attempted" and network.direction == "egress" and network.transport == "tcp" and
   process.uptime >= 300 and source.port >= 49152 and
   not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
       "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
       "100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
       "FE80::/10", "FF00::/8", "100.64.0.0/10", "192.168.0.0/16", "192.88.99.0/24")]
  until [process where event.action:"end"]
'''

min_endpoint_version = "8.8.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"

[[threat.technique]]
id = "T1573"
name = "Encrypted Channel"
reference = "https://attack.mitre.org/techniques/T1573/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "8.8.0"

Stages and Predicates

Ordered sequence: each step below must occur in order, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
  process.pe.original_file_name : ("wscript.exe", "AutoIt*.exe") and
  not process.Ext.token.integrity_level_name == "system" and not process.args : "\\\\*\\netlogon\\*.vbs"]

Stage 2: network

[network where
  event.action == "connection_attempted" and network.direction == "egress" and network.transport == "tcp" and
   process.uptime >= 300 and source.port >= 49152 and
   not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
       "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
       "100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
       "FE80::/10", "FF00::/8", "100.64.0.0/10", "192.168.0.0/16", "192.88.99.0/24")]

Until: process

until [process where event.action:"end"]

Ends the sequence: the steps above must complete before an event matching this clause occurs.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • connection_attempted corpus 72 (elastic 72)
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq
event.actionwildcard
  • end corpus 7 (elastic 7)
field:"EventType" kind:wildcard value:"end"
network.directioneq
  • egress corpus 13 (elastic 13)
field:"Initiated" kind:eq value:"egress"
network.transporteq
  • tcp corpus 16 (elastic 16)
field:"Protocol" kind:eq value:"tcp"
process.pe.original_file_namewildcard
  • AutoIt*.exe corpus 8 (elastic 8)
  • wscript.exe corpus 2 (elastic 2)
field:"OriginalFileName" kind:wildcard
process.uptimege
  • 300 transforms: number corpus 2 (elastic 2)
field:"process.uptime" kind:ge value:"300"
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.token.integrity_level_nameeqsystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system"
process.argswildcard\\*\netlogon\*.vbsexcludes:process.args field:"process.args" value:"\\*\netlogon\*.vbs"
destination.ipcidr_match10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8, 100.64.0.0/10, 192.168.0.0/16, 192.88.99.0/24excludes:destination.ip

Potential Meterpreter Reverse Shell

#
Status
production
Severity
high
Sequence by
host.id, process.pid, user.id
Author
Elastic
Source
github.com/elastic/detection-rules

This detection rule identifies a sample of suspicious Linux system file reads used for system fingerprinting, leveraged by the Metasploit Meterpreter shell to gather information about the target that it is executing its shell on. Detecting this pattern is indicative of a successful meterpreter shell connection.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/08/10"
integration = ["auditd_manager"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This detection rule identifies a sample of suspicious Linux system file reads used for system fingerprinting, leveraged
by the Metasploit Meterpreter shell to gather information about the target that it is executing its shell on. Detecting
this pattern is indicative of a successful meterpreter shell connection.
"""
from = "now-9m"
index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Meterpreter Reverse Shell"
references = [
    "https://www.elastic.co/security-labs/primer-on-persistence-mechanisms",
    "https://www.elastic.co/security-labs/linux-detection-engineering-with-auditd",
]
risk_score = 73
rule_id = "5c895b4f-9133-4e68-9e23-59902175355c"
setup = """## Setup

This rule requires data coming in from one of the following integrations:
- Auditbeat
- Auditd Manager

### Auditbeat Setup
Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.

#### The following steps should be executed in order to add the Auditbeat on a Linux System:
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html).
- To run Auditbeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html).
- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).

### Auditd Manager Integration Setup
The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel.
Auditd Manager provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system.

#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" on a Linux System:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Auditd Manager” and select the integration to see more details about it.
- Click “Add Auditd Manager”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “auditd manager” to an existing or a new agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager).

#### Rule Specific Setup Note
Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration.
However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
- For this detection rule the following additional audit rules are required to be added to the integration:
  -w /proc/net/ -p r -k audit_proc
  -w /etc/machine-id -p wa -k machineid
  -w /etc/passwd -p wa -k passwd
"""
severity = "high"
tags = [
    "Data Source: Auditd Manager",
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sample by host.id, process.pid, user.id
  [file where host.os.type == "linux" and auditd.data.syscall == "open" and auditd.data.a2 == "1b6" and file.path == "/etc/machine-id"]
  [file where host.os.type == "linux" and auditd.data.syscall == "open" and auditd.data.a2 == "1b6" and file.path == "/etc/passwd"]
  [file where host.os.type == "linux" and auditd.data.syscall == "open" and auditd.data.a2 == "1b6" and file.path == "/proc/net/route"]
  [file where host.os.type == "linux" and auditd.data.syscall == "open" and auditd.data.a2 == "1b6" and file.path == "/proc/net/ipv6_route"]
  [file where host.os.type == "linux" and auditd.data.syscall == "open" and auditd.data.a2 == "1b6" and file.path == "/proc/net/if_inet6"]
'''
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Potential Meterpreter Reverse Shell

Meterpreter is a sophisticated payload within the Metasploit framework, enabling attackers to execute commands and scripts on compromised systems. Adversaries exploit it to perform system reconnaissance and data exfiltration. The detection rule identifies suspicious file access patterns typical of Meterpreter's system fingerprinting activities, such as reading key system files, indicating a potential reverse shell connection.

### Possible investigation steps

- Review the process associated with the alert by examining the process ID (process.pid) and user ID (user.id) to determine if the process is legitimate or potentially malicious.
- Check the host ID (host.id) to identify the specific system where the suspicious activity was detected and assess if it is a high-value target or has been previously compromised.
- Investigate the command history and running processes on the affected host to identify any unusual or unauthorized activities that may indicate a Meterpreter session.
- Analyze network connections from the host to detect any suspicious outbound connections that could suggest a reverse shell communication.
- Examine the file access patterns, particularly the access to files like /etc/machine-id, /etc/passwd, /proc/net/route, /proc/net/ipv6_route, and /proc/net/if_inet6, to understand the context and purpose of these reads and whether they align with normal system operations.
- Correlate the alert with other security events or logs from the same timeframe to identify any additional indicators of compromise or related malicious activities.

### False positive analysis

- System administration scripts or tools that perform regular checks on system files like /etc/machine-id or /etc/passwd may trigger this rule. To manage this, identify and whitelist these legitimate processes by their process ID or user ID.
- Backup or monitoring software that accesses network configuration files such as /proc/net/route or /proc/net/ipv6_route can cause false positives. Exclude these applications by adding exceptions for their specific file access patterns.
- Security tools that perform network diagnostics or inventory checks might read files like /proc/net/if_inet6. Review these tools and exclude their known benign activities from triggering the rule.
- Custom scripts used for system health checks or inventory management that access the flagged files should be reviewed. If deemed safe, add them to an exception list based on their host ID or user ID.

### Response and remediation

- Isolate the affected system from the network immediately to prevent further data exfiltration or lateral movement by the attacker.
- Terminate any suspicious processes identified by the detection rule, particularly those associated with the process IDs flagged in the alert.
- Conduct a thorough review of the affected system's logs and file access history to identify any additional unauthorized access or data exfiltration attempts.
- Change all credentials and keys that may have been exposed or compromised on the affected system, especially those related to user accounts identified in the alert.
- Restore the affected system from a known good backup to ensure any malicious changes are removed, and verify the integrity of the restored system.
- Implement network segmentation to limit the potential impact of future attacks and enhance monitoring of critical systems for similar suspicious activities.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected."""

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "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 = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"

[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"

[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"

[[rule.threat.technique]]
id = "T1087"
name = "Account Discovery"
reference = "https://attack.mitre.org/techniques/T1087/"

[[rule.threat.technique.subtechnique]]
id = "T1087.001"
name = "Local Account"
reference = "https://attack.mitre.org/techniques/T1087/001/"

[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

Stages and Predicates

Ordered sequence: each step below must occur in order, correlated by host.id, process.pid, user.id.

Stage 1: file

auditd.data.a2 == "1b6" and auditd.data.syscall == "open" and file.path == "/etc/machine-id" and host.os.type == "linux"

Stage 2: file

auditd.data.a2 == "1b6" and auditd.data.syscall == "open" and file.path == "/etc/passwd" and host.os.type == "linux"

Stage 3: file

auditd.data.a2 == "1b6" and auditd.data.syscall == "open" and file.path == "/proc/net/route" and host.os.type == "linux"

Stage 4: file

auditd.data.a2 == "1b6" and auditd.data.syscall == "open" and file.path == "/proc/net/ipv6_route" and host.os.type == "linux"

Stage 5: file

auditd.data.a2 == "1b6" and auditd.data.syscall == "open" and file.path == "/proc/net/if_inet6" and host.os.type == "linux"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
auditd.data.a2eq
  • 1b6
field:"auditd.data.a2" kind:eq value:"1b6"
auditd.data.syscalleq
  • open
field:"auditd.data.syscall" kind:eq value:"open"
file.patheq
  • /etc/machine-id
  • /etc/passwd
  • /proc/net/if_inet6
  • /proc/net/ipv6_route
  • /proc/net/route
field:"TargetFilename" kind:eq

Potential Network Scan Executed From Host

#
Status
production
Severity
medium
Time window
9m
Group by
host.id, process.executable, process.parent.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

This threshold rule monitors for the rapid execution of unix utilities that are capable of conducting network scans. Adversaries may leverage built-in tools such as ping, netcat or socat to execute ping sweeps across the network while attempting to evade detection or due to the lack of network mapping tools available on the compromised host.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/09/04"
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This threshold rule monitors for the rapid execution of unix utilities that are capable of conducting network scans.
Adversaries may leverage built-in tools such as ping, netcat or socat to execute ping sweeps across the network while
attempting to evade detection or due to the lack of network mapping tools available on the compromised host.
"""
from = "now-9m"
index = [
    "auditbeat-*",
    "endgame-*",
    "logs-auditd_manager.auditd-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
]
language = "kuery"
license = "Elastic License v2"
name = "Potential Network Scan Executed From Host"
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Potential Network Scan Executed From Host

In Linux environments, utilities like ping, netcat, and socat are essential for network diagnostics and communication. However, adversaries can exploit these tools to perform network scans, identifying active hosts and services for further exploitation. The detection rule identifies rapid execution of these utilities, signaling potential misuse for network reconnaissance, by monitoring process initiation events linked to these tools.

### Possible investigation steps

- Review the process initiation events to confirm the rapid execution of utilities like ping, netcat, or socat by examining the process.name field in the alert.
- Identify the user account associated with the process execution by checking the user information in the event data to determine if the activity aligns with expected behavior.
- Analyze the command line arguments used with the executed utilities by inspecting the process.command_line field to understand the scope and intent of the network scan.
- Correlate the alert with other recent events on the host by reviewing event timestamps and related process activities to identify any patterns or additional suspicious behavior.
- Check network logs or firewall logs for any unusual outbound connections or traffic patterns originating from the host to assess the potential impact of the network scan.
- Investigate the host's recent login history and user activity to determine if there are signs of unauthorized access or compromise that could explain the network scan activity.

### False positive analysis

- Routine network diagnostics by system administrators can trigger alerts. To manage this, create exceptions for known administrator accounts or specific IP addresses frequently used for legitimate network diagnostics.
- Automated monitoring scripts that use these utilities for health checks or performance monitoring may cause false positives. Identify and exclude these scripts by their process names or execution paths.
- Scheduled tasks or cron jobs that involve network utilities for maintenance purposes can be mistaken for network scans. Exclude these tasks by their specific scheduling patterns or associated user accounts.
- Security tools that perform regular network sweeps as part of their functionality might be flagged. Whitelist these tools by their process names or hash values to prevent unnecessary alerts.
- Development or testing environments where network utilities are used for testing purposes can generate false positives. Implement exclusions based on environment-specific identifiers or network segments.

### Response and remediation

- Isolate the affected host from the network to prevent further reconnaissance or lateral movement by the adversary.
- Terminate any suspicious processes identified by the detection rule, such as those involving ping, netcat, or socat, to halt ongoing network scans.
- Conduct a thorough review of the host's process logs and network activity to identify any additional indicators of compromise or related malicious activity.
- Reset credentials and review access permissions for accounts that were active on the compromised host to prevent unauthorized access.
- Apply patches and updates to the host's operating system and installed software to mitigate vulnerabilities that could be exploited by adversaries.
- Enhance network monitoring and logging to detect similar reconnaissance activities in the future, ensuring that alerts are configured to notify security teams promptly.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional hosts or systems are affected."""
risk_score = 47
rule_id = "03c23d45-d3cb-4ad4-ab5d-b361ffe8724a"
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: Discovery",
    "Data Source: Elastic Defend",
    "Data Source: Elastic Endgame",
    "Data Source: Auditd Manager",
    "Data Source: Crowdstrike",
    "Data Source: SentinelOne",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "threshold"
query = '''
event.category:process and host.os.type:linux and event.type:start and
event.action:(exec or exec_event or executed or process_started or start or ProcessRollup2) and
process.name:(ping or nping or hping or hping2 or hping3 or nc or ncat or netcat or socat)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1018"
name = "Remote System Discovery"
reference = "https://attack.mitre.org/techniques/T1018/"

[[rule.threat.technique]]
id = "T1046"
name = "Network Service Discovery"
reference = "https://attack.mitre.org/techniques/T1046/"

[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[rule.threshold]
field = ["host.id", "process.parent.entity_id", "process.executable"]
value = 1

[[rule.threshold.cardinality]]
field = "process.args"
value = 100

Stages and Predicates

Stage 1: query

event.category:process and host.os.type:linux and event.type:start and
event.action:(exec or exec_event or executed or process_started or start or ProcessRollup2) and
process.name:(ping or nping or hping or hping2 or hping3 or nc or ncat or netcat or socat)
Threshold
gte 1
Cardinality
process.args ≥ 100

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2
  • exec
  • exec_event
  • executed
  • process_started
  • start
field:"EventType" kind:in
event.categoryeq
  • process
field:"event.category" kind:eq value:"process"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.namein
  • hping
  • hping2
  • hping3
  • nc
  • ncat
  • netcat
  • nping
  • ping
  • socat
field:"process_basename" kind:in

Potential PowerShell Obfuscation via String Reordering

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects PowerShell scripts that uses format placeholders like "{0}{1}" with the -f operator or ::Format to reorder strings at runtime. Attackers use format-based reconstruction to hide commands or payload strings and evade static analysis and AMSI.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2025/04/03"
integration = ["windows"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Detects PowerShell scripts that uses format placeholders like "{0}{1}" with the -f operator or ::Format to reorder strings at runtime.
Attackers use format-based reconstruction to hide commands or payload strings and evade static analysis and AMSI.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Potential PowerShell Obfuscation via String Reordering"
note = """## Triage and analysis

> **Disclaimer**:
> This guide was created by humans with the assistance of generative AI. While its contents have been manually curated to include the most valuable information, always validate assumptions and adjust procedures to match your internal runbooks and incident triage and response policies.

### Investigating Potential PowerShell Obfuscation via String Reordering

This alert indicates a PowerShell script block used indexed format placeholders (for example, "{0}{1}") with runtime formatting (for example, the `-f` operator or `::Format`) to reorder and reconstruct strings. This technique can hide meaningful strings (commands, URLs, artifact names) from straightforward text inspection and can be used as part of staged execution.

Because the detection requires repeated occurrences of these patterns in a larger script block, triage should focus on (1) execution context (host and user), (2) script origin (file-backed vs. in-memory/interactive), and (3) what strings are being reconstructed and what actions they enable.

#### Key alert fields to review

- `user.name`, `user.domain`, `user.id`: Account execution context for correlation, prioritization, and scoping.
- `host.name`, `host.id`: Host execution context for correlation, prioritization, and scoping.
- `file.path`, `file.directory`, `file.name`: File-origin context when the script block is sourced from an on-disk file.
- `powershell.file.script_block_text`: Script block content that matched the detection logic.
- `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`: Script block metadata to pivot to other fragments or reconstruct full script content when split across multiple events.
- `Esql.script_block_tmp`: Transformed script block where detection patterns replace original content with a marker to support scoring/counting and quickly spot match locations.
- `Esql.script_block_pattern_count`: Count of matches for the detection pattern(s) observed in the script block content.
- `powershell.file.script_block_entropy_bits`: Shannon entropy of the script block. Higher values may indicate obfuscation.
- `powershell.file.script_block_surprisal_stdev`: Standard deviation of surprisal across the script block. Low values indicate uniform randomness. High values indicate mixed patterns and variability.
- `powershell.file.script_block_unique_symbols`: Count of distinct characters present in the script block.
- `powershell.file.script_block_length`: Script block length (size) context.

#### Possible investigation steps

- Confirm the execution context and initial scope:
  - Identify the affected endpoint using `host.name` and `host.id`. Check for other security alerts or suspicious activity on the same host around the alert time.
  - Identify the account context using `user.name`, `user.domain`, and `user.id`. Prioritize alerts where the user is unexpected for the host role or where the user does not typically run PowerShell.
  - If `file.path` / `file.directory` / `file.name` are present, capture the script location and assess whether the path and filename are expected for that host and user. If file fields are missing, treat the activity as potentially interactive or in-memory and increase emphasis on correlated telemetry.

- Review the script block content and determine what is being reconstructed:
  - Start with `Esql.script_block_tmp` to quickly locate where formatting patterns occur, then use `powershell.file.script_block_text` as the authoritative source for analysis and evidence.
  - Identify how formatting is used:
    - Placeholder-only or placeholder-heavy format strings that primarily consist of `{n}` tokens.
    - Out-of-order placeholder indexes (for example, `{3}{0}{2}{1}`) and repeated reordering blocks.
    - Multiple reconstruction stages where formatted output is subsequently reformatted or concatenated.
  - Reconstruct key strings by mapping placeholder indexes to the arguments/fragments used in each formatting operation. Record any reconstructed strings that indicate follow-on behavior (remote addresses, filenames, persistence identifiers, or execution flow).

- Use the available scoring and statistics fields to guide prioritization:
  - Review `Esql.script_block_pattern_count` to understand how heavily the script relies on formatting-based reconstruction. Higher counts generally increase suspicion.
  - Review `powershell.file.script_block_entropy_bits`, `powershell.file.script_block_unique_symbols`, `powershell.file.script_block_surprisal_stdev`, and `powershell.file.script_block_length` to differentiate structured, readable scripts from highly variable or packed content.
  - Treat these values as supporting signals; base the decision primarily on reconstructed strings and correlated activity.

- Reconstruct full script content when split across multiple events:
  - Pivot on `powershell.file.script_block_id` to gather all fragments for the same script block.
  - Order fragments using `powershell.sequence` and confirm completeness using `powershell.total` before drawing conclusions.

- Correlate and validate impact using adjacent telemetry available in your environment:
  - Review other PowerShell script blocks from the same `host.id` and `user.id` to identify staging, deobfuscation, or follow-on execution.
  - Correlate with endpoint telemetry for the same host and timeframe to understand how PowerShell was started and what occurred next (process ancestry, network activity, file/registry changes, and authentication activity). Use reconstructed strings to focus this correlation.

- Expand the hunt to assess prevalence:
  - Search for the same or similar content in `powershell.file.script_block_text` (shared fragments, repeated placeholder patterns) across other hosts.
  - Use `Esql.script_block_pattern_count` and the script block statistics fields to identify other high-similarity or high-complexity scripts that may represent the same technique.

### False positive analysis

- Legitimate automation can use indexed placeholders to build dynamic output, reports, or templated configuration content. Benign usage is more likely when the resulting strings are human-readable and the script has an expected on-disk origin (`file.path` / `file.name`) and consistent execution over time.
- Some internally developed frameworks generate PowerShell dynamically and may include repeated formatting patterns. Validate ownership of the script source and whether execution by the identified `user.id` on the identified `host.id` is expected.
- Localization or templating logic may use indexed placeholders. This is typically associated with readable templates and stable execution patterns rather than multi-stage reconstruction of operational strings.

### Response and remediation

- If malicious or suspicious activity is confirmed:
  - Contain the affected endpoint identified by `host.name` / `host.id` to prevent further execution and limit lateral movement.
  - Preserve evidence, including `powershell.file.script_block_text`, `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`, and the alert enrichment fields (`Esql.script_block_tmp`, `Esql.script_block_pattern_count`, and script block statistics).
  - Use reconstructed strings to drive scoping and impact assessment (look for related activity on the same host, and search for the same indicators across other hosts and users).

- Eradication and recovery:
  - Identify the execution mechanism and remove it (for example, an unexpected script file, a startup trigger, or other persistence identified during correlation).
  - Remove or quarantine related artifacts discovered during analysis and validate that similar activity is not occurring on other endpoints.

- If the activity is determined to be benign:
  - Document the expected script source (`file.path` / `file.name`), the responsible team, and the expected execution context (`host.id`, `user.id`) to support faster triage of future alerts.
  - Monitor for deviations from the established baseline (new hosts, new users, or materially different reconstructed strings).
"""
risk_score = 47
rule_id = "e903ce9a-5ce6-4246-bb14-75ed3ec2edf5"
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
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Data Source: PowerShell Logs",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-windows.powershell_operational* metadata _id, _version, _index
| where event.code == "4104" and powershell.file.script_block_text like "*{0}*"

// Filter out smaller scripts that are unlikely to implement obfuscation using the patterns we are looking for
| eval Esql.script_block_length = length(powershell.file.script_block_text)
| where Esql.script_block_length > 500

// replace the patterns we are looking for with the 🔥 emoji to enable counting them
// The emoji is used because it's unlikely to appear in scripts and has a consistent character length of 1
| eval Esql.script_block_tmp = replace(
    powershell.file.script_block_text,
    """((\{\d+\}){2,}["']\s?-f|::Format[^\{]+(\{\d+\}){2,})""",
    "🔥"
)

// count how many patterns were detected by calculating the number of 🔥 characters inserted
| eval Esql.script_block_pattern_count = length(Esql.script_block_tmp) - length(replace(Esql.script_block_tmp, "🔥", ""))

// keep the fields relevant to the query, although this is not needed as the alert is populated using _id
| keep
    Esql.script_block_pattern_count,
    Esql.script_block_length,
    Esql.script_block_tmp,
    powershell.file.*,
    file.path,
    file.directory,
    powershell.sequence,
    powershell.total,
    _id,
    _version,
    _index,
    host.name,
    host.id,
    agent.id,
    user.id

// Filter for scripts that match the pattern at least five times
| where Esql.script_block_pattern_count >= 5

// Exclude Noisy Patterns

// Icinga Framework
| where not file.directory == "C:\\Program Files\\WindowsPowerShell\\Modules\\icinga-powershell-framework\\cache"
  // ESQL requires this condition, otherwise it only returns matches where file.directory exists.
  or file.directory IS NULL

| where not (powershell.file.script_block_text LIKE "*GitBranchStatus*" AND 
    powershell.file.script_block_text LIKE "*$s.BranchBehindStatusSymbol.Text*")
| where not
    // https://wtfbins.wtf/17
    (
        (powershell.file.script_block_text like "*sentinelbreakpoints*" or
         powershell.file.script_block_text like "*:::::\\\\windows\\\\sentinel*")
        and
        (powershell.file.script_block_text like "*$local:Bypassed*" or
         powershell.file.script_block_text like "*origPSExecutionPolicyPreference*")
    )
'''


[[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 = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.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/"
[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"
]

Stages and Predicates

Stage 1: from

from logs-windows.powershell_operational* metadata _id, _version, _index

Stage 2: where

| where event.code == "4104" and powershell.file.script_block_text like "*{0}*"

Stage 3: eval

| eval Esql.script_block_length = length(powershell.file.script_block_text)

Stage 4: where

| where Esql.script_block_length > 500

Stage 5: eval

| eval Esql.script_block_tmp = replace(
    powershell.file.script_block_text,
    """((\{\d+\}){2,}["']\s?-f|::Format[^\{]+(\{\d+\}){2,})""",
    "🔥"
)

Stage 6: eval

| eval Esql.script_block_pattern_count = length(Esql.script_block_tmp) - length(replace(Esql.script_block_tmp, "🔥", ""))

Stage 7: keep

| keep
    Esql.script_block_pattern_count,
    Esql.script_block_length,
    Esql.script_block_tmp,
    powershell.file.*,
    file.path,
    file.directory,
    powershell.sequence,
    powershell.total,
    _id,
    _version,
    _index,
    host.name,
    host.id,
    agent.id,
    user.id

Stage 8: where

| where Esql.script_block_pattern_count >= 5

Stage 9: where

| where not file.directory == "C:\\Program Files\\WindowsPowerShell\\Modules\\icinga-powershell-framework\\cache"
  or file.directory IS NULL

Stage 10: where

| where not (powershell.file.script_block_text LIKE "*GitBranchStatus*" AND 
    powershell.file.script_block_text LIKE "*$s.BranchBehindStatusSymbol.Text*")

Stage 11: where

| where not
    (
        (powershell.file.script_block_text like "*sentinelbreakpoints*" or
         powershell.file.script_block_text like "*:::::\\\\windows\\\\sentinel*")
        and
        (powershell.file.script_block_text like "*$local:Bypassed*" or
         powershell.file.script_block_text like "*origPSExecutionPolicyPreference*")
    )

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Output Fields

These fields are emitted when the rule matches.

FieldSource
Esql.script_block_pattern_countKEEP Esql.script_block_pattern_count
Esql.script_block_lengthKEEP Esql.script_block_length
Esql.script_block_tmpKEEP Esql.script_block_tmp
powershell.file.*KEEP powershell.file.*
file.pathKEEP file.path
file.directoryKEEP file.directory
powershell.sequenceKEEP powershell.sequence
powershell.totalKEEP powershell.total
_idKEEP _id
_versionKEEP _version
_indexKEEP _index
host.nameKEEP host.name
host.idKEEP host.id
agent.idKEEP agent.id
user.idKEEP user.id

Potential Proxy Execution via PHP

#
Source
github.com/elastic/protections-artifacts

This rule detects the execution of a command or binary through the PHP interpreter. Attackers may use this technique to execute commands while attempting to evade detection.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule detects the execution of a command or binary through the PHP interpreter. Attackers may use this technique to
execute commands while attempting to evade detection.
"""
id = "dd914805-e99b-4ff6-b445-775c53d44e10"
license = "Elastic License v2"
name = "Potential Proxy Execution via PHP"
os_list = ["linux"]
reference = ["https://gtfobins.github.io/gtfobins/php/"]
version = "1.0.8"

query = '''
process where event.type == "start" and event.action == "exec" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and

// Check if the parent process is a PHP interpreter with an optional version number

process.parent.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.parent.args == "-r" and

// Check if -r is used right after the PHP process or process path

process.parent.command_line regex~ """(\/.*\/)?php[0-9]?\.?[0-9]{0,2} \-r .*"""

and not (
  process.command_line in (
    "sh -c mysql --version 2>/dev/null", "sh -c locale -a", "locale -a", "stty -a", "datadog-ipc-helper",
    "sh -c whereis -b traceroute", "sh -c git describe --always --tags --abbrev=0", "sh -c git rev-parse --short HEAD",
    "/usr/sbin/sendmail -t -i", "sh -c /usr/sbin/sendmail -t -i", "sh -c stty -a | grep columns", "whereis -b traceroute",
    "sh -c /usr/sbin/sendmail -t -i ", "sh -c exec rpm -q --queryformat '%{VERSION}.%{RELEASE}' SecurityCenter",
    "sh -c /usr/bin/convert -version 2>&1", "sh -c /usr/bin/convert -list delegate 2>&1"
  ) or
  process.args like ("/var/lib/asterisk/bin/backup.php*", "/usr/sbin/sendmail*") or
  process.executable in ("/usr/bin/newrelic-daemon", "/usr/bin/git") or 
  process.command_line like "*git*" or
  process.parent.command_line == "php get_monatsdaten.php -v -s1 -r"
)
'''

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.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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.parent.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.parent.args == "-r" and
process.parent.command_line regex~ """(\/.*\/)?php[0-9]?\.?[0-9]{0,2} \-r .*"""
and not (
  process.command_line in (
    "sh -c mysql --version 2>/dev/null", "sh -c locale -a", "locale -a", "stty -a", "datadog-ipc-helper",
    "sh -c whereis -b traceroute", "sh -c git describe --always --tags --abbrev=0", "sh -c git rev-parse --short HEAD",
    "/usr/sbin/sendmail -t -i", "sh -c /usr/sbin/sendmail -t -i", "sh -c stty -a | grep columns", "whereis -b traceroute",
    "sh -c /usr/sbin/sendmail -t -i ", "sh -c exec rpm -q --queryformat '%{VERSION}.%{RELEASE}' SecurityCenter",
    "sh -c /usr/bin/convert -version 2>&1", "sh -c /usr/bin/convert -list delegate 2>&1"
  ) or
  process.args like ("/var/lib/asterisk/bin/backup.php*", "/usr/sbin/sendmail*") or
  process.executable in ("/usr/bin/newrelic-daemon", "/usr/bin/git") or
  process.command_line like "*git*" or
  process.parent.command_line == "php get_monatsdaten.php -v -s1 -r"
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argsstarts_with/var/lib/asterisk/bin/backup.php, /usr/sbin/sendmailexcludes:process.args field:"process.args" value:"/var/lib/asterisk/bin/backup.php" field:"process.args" value:"/usr/sbin/sendmail"
process.command_linein/usr/sbin/sendmail -t -i, datadog-ipc-helper, locale -a, sh -c /usr/bin/convert -list delegate 2>&1, sh -c /usr/bin/convert -version 2>&1, sh -c /usr/sbin/sendmail -t -i, sh -c /usr/sbin/sendmail -t -i , sh -c exec rpm -q --queryformat '%{VERSION}.%{RELEASE}' SecurityCenter, sh -c git describe --always --tags --abbrev=0, sh -c git rev-parse --short HEAD, sh -c locale -a, sh -c mysql --version 2>/dev/null, sh -c stty -a | grep columns, sh -c whereis -b traceroute, stty -a, whereis -b tracerouteexcludes:process.command_line
process.command_linematchgitexcludes:process.command_line field:"process.command_line" value:"git"
process.executablein/usr/bin/git, /usr/bin/newrelic-daemonexcludes:process.executable field:"process.executable" value:"/usr/bin/git" field:"process.executable" value:"/usr/bin/newrelic-daemon"
process.parent.command_lineeqphp get_monatsdaten.php -v -s1 -rexcludes:process.parent.command_line field:"process.parent.command_line" value:"php get_monatsdaten.php -v -s1 -r"

Potential Redis CONFIG SET Cron Directory Persistence (RedisRaider)

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule detects attempts to abuse Redis CONFIG SET commands to redirect the database save directory to a cron directory on Linux hosts. Attackers issue CONFIG SET dir to a cron path such as /etc/cron.d or /var/spool/cron, set a filename via CONFIG SET dbfilename, write a cron payload via SET, and then call BGSAVE to flush it to disk, establishing persistence for execution of an XMRig cryptominer.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/06/11"
integration = ["network_traffic"]
maturity = "production"
updated_date = "2026/06/11"

[rule]
author = ["Elastic"]
description = """
This rule detects attempts to abuse Redis CONFIG SET commands to redirect the database save directory to a cron
directory on Linux hosts. Attackers issue CONFIG SET dir to a cron path such as /etc/cron.d or /var/spool/cron,
set a filename via CONFIG SET dbfilename, write a cron payload via SET, and then call BGSAVE to flush it to
disk, establishing persistence for execution of an XMRig cryptominer.
"""
from = "now-9m"
index = ["logs-network_traffic.redis*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Redis CONFIG SET Cron Directory Persistence (RedisRaider)"
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Potential Redis CONFIG SET Cron Directory Persistence (RedisRaider)

Redis's CONFIG SET command allows runtime reconfiguration of the server, including the working directory (`dir`) and database filename (`dbfilename`). Attackers exploit this to redirect Redis's BGSAVE output into system directories such as `/etc/cron.d` or `/var/spool/cron`, writing attacker-controlled content as a cron job. The RedisRaider campaign used this technique to deploy XMRig cryptominers at scale by mass-scanning IPv4 blocks for unauthenticated Redis instances.

A related variant (not specific to RedisRaider) targets SSH key injection using `CONFIG SET dir /root/.ssh` and `CONFIG SET dbfilename authorized_keys`. Consider a companion rule for that pattern if your Redis instances are internet-exposed.

### Possible investigation steps

- Identify the source IP and determine whether it is an expected Redis client or an external/unknown address. Internet-sourced CONFIG SET to a cron path is almost certainly malicious.
- Check whether the destination Redis instance requires authentication (`requirepass` or ACL). Unauthenticated instances are the primary target of RedisRaider-style campaigns.
- Review subsequent Redis commands from the same source IP for `SET` (cron payload write) and `BGSAVE` (flush to disk), which complete the persistence chain.
- Examine the Redis host for new or modified files under `/etc/cron.d`, `/etc/cron.daily`, `/etc/cron.hourly`, `/var/spool/cron`, or `/var/spool/cron/crontabs` at or after the alert time.
- Check for XMRig or other cryptominer process execution and unexplained CPU spikes on the host.
- Review outbound network connections from the Redis host for connections to known mining pools or C2 infrastructure.

### False positive analysis

- `CONFIG SET dir` is a legitimate administrative command used during backup configuration, data migration, or operational changes. Verify whether the directory is a known backup or data path rather than a system directory.
- Legitimate Redis usage will never set `dir` to `/etc/cron.d`, `/var/spool/cron`, or any other system cron directory. A match on this pattern has an extremely low false positive rate.
- Automated deployment or configuration management tools (Ansible, Chef, Puppet) may issue CONFIG SET as part of Redis setup — verify the source IP and timing against known deployment windows.

### Response and remediation

- Immediately check the target cron directories for newly created files written by the Redis process (owner: redis, unusual content).
- If a cron file was written, delete it and terminate any spawned miner processes before remediating.
- Require authentication on all Redis instances (`requirepass` or ACL). Unauthenticated Redis exposed to any network is the root cause of this attack class.
- Restrict `CONFIG SET` permissions using Redis ACLs: `ACL SETUSER <user> -config`.
- Block inbound access to Redis port 6379 from untrusted networks at the host firewall or perimeter.
- Consider enabling Redis's protected mode, which rejects connections from non-loopback addresses when no authentication is configured.
"""
references = [
    "https://securitylabs.datadoghq.com/articles/redisraider-mining-campaign/",
    "https://attack.mitre.org/techniques/T1053/003/",
    "https://attack.mitre.org/techniques/T1496/",
]
risk_score = 73
rule_id = "29e57265-d358-420a-b1cd-845e8a1fd70d"
setup = """## Setup

This rule requires the Elastic **network_traffic** integration (Packetbeat via Elastic Agent) with the Redis
protocol module enabled.

### Enabling the Redis module

In the Elastic Agent `network_traffic` integration policy:
1. Add or confirm **Redis** in the protocols list with `enabled: true`.
2. Set **ports** to include `6379` (or the custom port your Redis instances listen on).
3. Deploy the sensor on the Redis host, on a SPAN/mirror port, or on a gateway that receives Redis traffic.

### TLS limitation

This rule requires unencrypted Redis traffic. Redis uses plaintext by default (port 6379). If TLS is configured,
Packetbeat cannot inspect the payload without TLS decryption.
"""
severity = "high"
tags = [
    "Domain: Network",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Impact",
    "Data Source: Network Packet Capture",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
network where data_stream.dataset == "network_traffic.redis" and
  network_traffic.redis.query like~ "*CONFIG SET dir*" and
  (
    network_traffic.redis.query like~ "*/etc/cron*" or
    network_traffic.redis.query like~ "*/var/spool/cron*"
  )
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[rule.threat.technique.subtechnique]]
id = "T1053.003"
name = "Cron"
reference = "https://attack.mitre.org/techniques/T1053/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 = "T1496"
name = "Resource Hijacking"
reference = "https://attack.mitre.org/techniques/T1496/"

[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"

Stages and Predicates

Stage 1: network

network where data_stream.dataset == "network_traffic.redis" and
  network_traffic.redis.query like~ "*CONFIG SET dir*" and
  (
    network_traffic.redis.query like~ "*/etc/cron*" or
    network_traffic.redis.query like~ "*/var/spool/cron*"
  )

Indicators

These rows show field, operator, and value matches.

Sensitive File Access - SSH Saved Keys

#
Source
github.com/elastic/protections-artifacts

Identifies an unusual process accessing common SSH clients saved SSH keys. Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies an unusual process accessing common SSH clients saved SSH keys. Adversaries may search local file systems and
remote file shares for files containing insecurely stored credentials.
"""
id = "1487d726-2bd2-4a9e-a9d2-db8aef1d6239"
license = "Elastic License v2"
name = "Sensitive File Access - SSH Saved Keys"
os_list = ["windows"]
reference = ["https://github.com/GhostPack/Seatbelt", "https://github.com/AlessandroZ/LaZagne"]
version = "1.0.39"

query = '''
any where event.category in ("registry", "file") and
 event.action in ("query", "open") and
 user.id like ("S-1-5-21*", "S-1-12-*") and process.executable : "C:\\*" and
 (file.path : "?:\\Users\\*\\.ssh\\known_hosts" or
  registry.path :
        ("HKEY_USERS\\S-1-5-21*\\Software\\SimonTatham\\PuTTY\\SshHostKeys\\*",
         "HKEY_USERS\\S-1-12-1-*\\Software\\SimonTatham\\PuTTY\\SshHostKeys\\*")) and
  not process.executable :
      ("?:\\Program Files\\*",
	   "?:\\Program Files (x86)\\*", 
	   "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe", 
	   "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe",
	   "?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*\\MsSense.exe",
	   "?:\\Windows\\System32\\OpenSSH\\*.exe", 
	   "?:\\Windows\\System32\\smartscreen.exe", 
	   "?:\\WINDOWS\\system32\\reg.exe", 
	   "?:\\Windows\\regedit.exe", 
	   "?:\\Windows\\System32\\notepad.exe", 
	   "?:\\Windows\\System32\\Robocopy.exe",
	   "?:\\Windows\\System32\\cmd.exe",
	   "?:\\Windows\\explorer.exe",
       "?:\\Windows\\System32\\mmc.exe",
	   "?:\\Windows\\System32\\svchost.exe",
	   "?:\\$WINDOWS.~BT\\Sources\\setuphost.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\Git\\mingw64\\bin\\git.exe",
	   "?:\\Users\\*\\AppData\\Local\\DBeaver\\dbeaver.exe",
	   "?:\\Users\\*\\Tools\\dbeaver\\dbeaver.exe",
	   "?:\\Windows\\System32\\SearchProtocolHost.exe",
	   "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\OneDrive.exe",
	   "?:\\ProgramData\\GalacticScan\\GalacticScan.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\GalacticScan\\GalacticScan_Warpspeed.exe",
	   "?:\\Users\\*\\AppData\\Local\\Postman\\app-*\\Postman.exe",
	   "?:\\Users\\*\\OneDrive\\*\\Wintriage\\Tools\\ADSecurizame.exe",
	   "?:\\Users\\*\\AppData\\Local\\JetBrains\\Toolbox\\apps\\Gateway\\*\\bin\\gateway64.exe",
	   "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\*\\@vscode\\ripgrep\\bin\\rg.exe",
	   "?:\\programs\\!_local\\SmartGit\\bin\\smartgit.exe",
	   "?:\\Windows\\System32\\dllhost.exe",
	   "?:\\Windows\\System32\\OpenWith.exe",
	   "?:\\Windows\\System32\\userinit.exe",
	   "?:\\Windows\\System32\\fhmanagew.exe",
	   "C:\\OSGeo4W64\\bin\\qgis-ltr-bin.exe",
	   "C:\\Users\\*\\Anaconda3\\pythonw.exe") and

  /* many of the following exclusions are not signed nor have an original file name  */
  not process.name : ("pscp.exe", "psftp.exe", "_ssh.exe", "plink.exe", "PuTTYNG.exe", "putty*.exe", "busybox.exe",
                      "ssh.exe", "WinSCP.exe", "bash.exe", "MoTTY.exe", "eclipse.exe", "code.exe", "datagrip*.exe",
                      "MobaXterm_Personal*.exe", "RoyalTS_PuTTY*.exe", "MAP.EXE", "rssputty.exe", "phpstorm64.exe",
                      "Fork.exe", "fzsftp.exe", "OneDrive.exe") and
  not (process.code_signature.subject_name :
               ("Galactic Advisors, Inc.", "Simon Tatham", "Atlassian Pty Ltd", "Emsisoft Limited", "JetBrains s.r.o.",
                "ESET, spol. s r.o.", "Notepad++", "Open Source Developer, Sven Strickroth", "ShowMyPC", "AXOSOFT, LLC",
                "General Services Administration", "ShowMyPC INC", "Oracle America, Inc.", "CS.DISA-RE11.08-0031", "Mobatek", 
		"DBeaver Corp", "Eclipse.org Foundation, Inc.", "Shadow", "The Qt Company Oy", "Anysphere, Inc.",
		"International Business Machines Corporation", "Red Hat, Inc", "SmartBear Software Inc.",
		"Python Software Foundation", "Amazon.com Services LLC", "OpenJS Foundation", "T3 Tools Inc",
		"KICAD SERVICES CORPORATION", "VNG GROUP JSC", "The FreeCAD project association AISBL") and
       process.code_signature.status in ("trusted", "errorChaining")) and
  process.thread.Ext.call_stack_summary != "ntdll.dll|cygwin1.dll"
'''

min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[threat.technique.subtechnique]]
id = "T1021.004"
name = "SSH"
reference = "https://attack.mitre.org/techniques/T1021/004/"



[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: any

any where event.category in ("registry", "file") and
 event.action in ("query", "open") and
 user.id like ("S-1-5-21*", "S-1-12-*") and process.executable : "C:\\*" and
 (file.path : "?:\\Users\\*\\.ssh\\known_hosts" or
  registry.path :
        ("HKEY_USERS\\S-1-5-21*\\Software\\SimonTatham\\PuTTY\\SshHostKeys\\*",
         "HKEY_USERS\\S-1-12-1-*\\Software\\SimonTatham\\PuTTY\\SshHostKeys\\*")) and
  not process.executable :
      ("?:\\Program Files\\*",
	   "?:\\Program Files (x86)\\*",
	   "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
	   "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe",
	   "?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*\\MsSense.exe",
	   "?:\\Windows\\System32\\OpenSSH\\*.exe",
	   "?:\\Windows\\System32\\smartscreen.exe",
	   "?:\\WINDOWS\\system32\\reg.exe",
	   "?:\\Windows\\regedit.exe",
	   "?:\\Windows\\System32\\notepad.exe",
	   "?:\\Windows\\System32\\Robocopy.exe",
	   "?:\\Windows\\System32\\cmd.exe",
	   "?:\\Windows\\explorer.exe",
       "?:\\Windows\\System32\\mmc.exe",
	   "?:\\Windows\\System32\\svchost.exe",
	   "?:\\$WINDOWS.~BT\\Sources\\setuphost.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\Git\\mingw64\\bin\\git.exe",
	   "?:\\Users\\*\\AppData\\Local\\DBeaver\\dbeaver.exe",
	   "?:\\Users\\*\\Tools\\dbeaver\\dbeaver.exe",
	   "?:\\Windows\\System32\\SearchProtocolHost.exe",
	   "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\OneDrive.exe",
	   "?:\\ProgramData\\GalacticScan\\GalacticScan.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\GalacticScan\\GalacticScan_Warpspeed.exe",
	   "?:\\Users\\*\\AppData\\Local\\Postman\\app-*\\Postman.exe",
	   "?:\\Users\\*\\OneDrive\\*\\Wintriage\\Tools\\ADSecurizame.exe",
	   "?:\\Users\\*\\AppData\\Local\\JetBrains\\Toolbox\\apps\\Gateway\\*\\bin\\gateway64.exe",
	   "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
	   "?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\*\\@vscode\\ripgrep\\bin\\rg.exe",
	   "?:\\programs\\!_local\\SmartGit\\bin\\smartgit.exe",
	   "?:\\Windows\\System32\\dllhost.exe",
	   "?:\\Windows\\System32\\OpenWith.exe",
	   "?:\\Windows\\System32\\userinit.exe",
	   "?:\\Windows\\System32\\fhmanagew.exe",
	   "C:\\OSGeo4W64\\bin\\qgis-ltr-bin.exe",
	   "C:\\Users\\*\\Anaconda3\\pythonw.exe") and
  not process.name : ("pscp.exe", "psftp.exe", "_ssh.exe", "plink.exe", "PuTTYNG.exe", "putty*.exe", "busybox.exe",
                      "ssh.exe", "WinSCP.exe", "bash.exe", "MoTTY.exe", "eclipse.exe", "code.exe", "datagrip*.exe",
                      "MobaXterm_Personal*.exe", "RoyalTS_PuTTY*.exe", "MAP.EXE", "rssputty.exe", "phpstorm64.exe",
                      "Fork.exe", "fzsftp.exe", "OneDrive.exe") and
  not (process.code_signature.subject_name :
               ("Galactic Advisors, Inc.", "Simon Tatham", "Atlassian Pty Ltd", "Emsisoft Limited", "JetBrains s.r.o.",
                "ESET, spol. s r.o.", "Notepad++", "Open Source Developer, Sven Strickroth", "ShowMyPC", "AXOSOFT, LLC",
                "General Services Administration", "ShowMyPC INC", "Oracle America, Inc.", "CS.DISA-RE11.08-0031", "Mobatek",
		"DBeaver Corp", "Eclipse.org Foundation, Inc.", "Shadow", "The Qt Company Oy", "Anysphere, Inc.",
		"International Business Machines Corporation", "Red Hat, Inc", "SmartBear Software Inc.",
		"Python Software Foundation", "Amazon.com Services LLC", "OpenJS Foundation", "T3 Tools Inc",
		"KICAD SERVICES CORPORATION", "VNG GROUP JSC", "The FreeCAD project association AISBL") and
       process.code_signature.status in ("trusted", "errorChaining")) and
  process.thread.Ext.call_stack_summary != "ntdll.dll|cygwin1.dll"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • open corpus 7 (elastic 7)
  • query corpus 3 (elastic 3)
field:"EventType" kind:in
event.categoryin
  • file corpus 15 (elastic 15)
  • registry corpus 10 (elastic 10)
field:"event.category" kind:in
file.pathwildcard
  • ?:\Users\*\.ssh\known_hosts
field:"TargetFilename" kind:wildcard value:"?:\Users\*\.ssh\known_hosts"
process.executablewildcard
  • C:\* corpus 16 (elastic 16)
field:"Image" kind:wildcard value:"C:\*"
process.thread.Ext.call_stack_summaryne
  • ntdll.dll|cygwin1.dll
field:"process.thread.Ext.call_stack_summary" kind:ne value:"ntdll.dll|cygwin1.dll"
registry.pathwildcard
  • HKEY_USERS\S-1-12-1-*\Software\SimonTatham\PuTTY\SshHostKeys\*
  • HKEY_USERS\S-1-5-21*\Software\SimonTatham\PuTTY\SshHostKeys\*
field:"TargetObject" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 21 (elastic 21)
  • S-1-5-21* corpus 21 (elastic 21)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statusinerrorChaining, trustedexcludes:process.code_signature.status field:"process.code_signature.status" value:"errorChaining" field:"process.code_signature.status" value:"trusted"
process.code_signature.subject_nameeqGalactic Advisors, Inc., Simon Tatham, Atlassian Pty Ltd, Emsisoft Limited, JetBrains s.r.o., ESET, spol. s r.o., Notepad++, Open Source Developer, Sven Strickroth, ShowMyPC, AXOSOFT, LLC, General Services Administration, ShowMyPC INC, Oracle America, Inc., CS.DISA-RE11.08-0031, Mobatek, DBeaver Corp, Eclipse.org Foundation, Inc., Shadow, The Qt Company Oy, Anysphere, Inc., International Business Machines Corporation, Red Hat, Inc, SmartBear Software Inc., Python Software Foundation, Amazon.com Services LLC, OpenJS Foundation, T3 Tools Inc, KICAD SERVICES CORPORATION, VNG GROUP JSC, The FreeCAD project association AISBLexcludes:process.code_signature.subject_name
process.executablewildcard?:\Program Files\*, ?:\Program Files (x86)\*, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MsMpEng.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MpCopyAccelerator.exe, ?:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Platform\*\MsSense.exe, ?:\Windows\System32\OpenSSH\*.exe, ?:\Windows\System32\smartscreen.exe, ?:\WINDOWS\system32\reg.exe, ?:\Windows\regedit.exe, ?:\Windows\System32\notepad.exe, ?:\Windows\System32\Robocopy.exe, ?:\Windows\System32\cmd.exe, ?:\Windows\explorer.exe, ?:\Windows\System32\mmc.exe, ?:\Windows\System32\svchost.exe, ?:\$WINDOWS.~BT\Sources\setuphost.exe, ?:\Users\*\AppData\Local\Programs\Git\mingw64\bin\git.exe, ?:\Users\*\AppData\Local\DBeaver\dbeaver.exe, ?:\Users\*\Tools\dbeaver\dbeaver.exe, ?:\Windows\System32\SearchProtocolHost.exe, ?:\Users\*\AppData\Local\Microsoft\OneDrive\OneDrive.exe, ?:\ProgramData\GalacticScan\GalacticScan.exe, ?:\Users\*\AppData\Local\Programs\GalacticScan\GalacticScan_Warpspeed.exe, ?:\Users\*\AppData\Local\Postman\app-*\Postman.exe, ?:\Users\*\OneDrive\*\Wintriage\Tools\ADSecurizame.exe, ?:\Users\*\AppData\Local\JetBrains\Toolbox\apps\Gateway\*\bin\gateway64.exe, ?:\Users\*\AppData\Local\Google\Chrome\Application\chrome.exe, ?:\Users\*\AppData\Local\Programs\Microsoft VS Code\resources\app\*\@vscode\ripgrep\bin\rg.exe, ?:\programs\!_local\SmartGit\bin\smartgit.exe, ?:\Windows\System32\dllhost.exe, ?:\Windows\System32\OpenWith.exe, ?:\Windows\System32\userinit.exe, ?:\Windows\System32\fhmanagew.exe, C:\OSGeo4W64\bin\qgis-ltr-bin.exe, C:\Users\*\Anaconda3\pythonw.exeexcludes:process.executable
process.namewildcardpscp.exe, psftp.exe, _ssh.exe, plink.exe, PuTTYNG.exe, putty*.exe, busybox.exe, ssh.exe, WinSCP.exe, bash.exe, MoTTY.exe, eclipse.exe, code.exe, datagrip*.exe, MobaXterm_Personal*.exe, RoyalTS_PuTTY*.exe, MAP.EXE, rssputty.exe, phpstorm64.exe, Fork.exe, fzsftp.exe, OneDrive.exeexcludes:process.name

Shared Object Load via LoLBin

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule detects when a process not commonly used to load shared objects, is executed with arguments that load a shared object file. This technique can load a malicious shared object into memory while attempting to evade detection.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/07/02"
integration = ["endpoint", "auditd_manager", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/07/06"

[rule]
author = ["Elastic"]
description = """
This rule detects when a process not commonly used to load shared objects, is executed with arguments that load a shared
object file. This technique can load a malicious shared object into memory while attempting to evade detection.
"""
from = "now-9m"
index = [
    "auditbeat-*",
    "endgame-*",
    "logs-auditd_manager.auditd-*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Shared Object Load via LoLBin"
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 Shared Object Load via LoLBin

This alert flags a Linux program that normally is not used as a loader but is started with options that pull a shared object into memory, a common way to hide malicious code behind trusted tools. An attacker can launch `openssl -engine /tmp/libcrypto.so` or a short `python -c` snippet that calls `cdll.LoadLibrary("/tmp/libx.so")` to execute a rogue library while blending in with legitimate system activity.

### Possible investigation steps

- Review the full command line, ancestor process chain, session context, and executing user to determine whether the shared object load aligns with a legitimate admin task, build workflow, or expected plugin behavior.
- Identify the referenced `.so` file on disk and validate its package ownership, hash reputation, permissions, timestamps, and location, giving extra scrutiny to libraries in temporary, user-writable, hidden, or recently created paths.
- Pivot on the same library path or hash across hosts and users to determine whether it is isolated to one system, newly introduced, or part of a broader sequence involving script execution, file drops, or repeated LoLBin abuse.
- Examine activity immediately before and after the load for suspicious follow-on behavior such as outbound network connections, credential access attempts, unexpected child processes, privilege escalation, or persistence-related file changes.
- If the library is not attributable to approved software, collect the binary and related artifacts for static or sandbox analysis and consider host containment or blocking the file hash and path if corroborating malicious evidence is present.

### False positive analysis

- Developers or build jobs may use `python -c`, `ruby -e`, or `openssl -engine` to validate a locally built `.so` during compilation or testing; confirm the parent process and working directory map to an expected build path or `make`-driven workflow and that the library resides in a project or package-managed location.
- Administrators may intentionally load a legitimate shell builtin or application plugin through `bash -c`, `gdb`, or `vim` while troubleshooting or enabling features; verify the session is interactive and attributable to the user, then check that the referenced `.so` is package-owned or stored in a standard system library or plugin directory rather than a writable temporary path.

### Response and remediation

- Isolate the affected Linux host from the network, terminate the abusing LoLBin and any spawned processes, and quarantine the referenced `.so` and any copies found in writable locations such as `/tmp`, `/dev/shm`, user home directories, or hidden folders.
- Remove attacker persistence by deleting unauthorized entries from `/etc/ld.so.preload`, shell startup files, cron jobs, systemd services or timers, and any wrapper scripts that relaunch `openssl -engine`, `python -c`, `ruby -e`, or shell commands to load the malicious library.
- Reset credentials and revoke secrets used on the host, including SSH keys, API tokens, and service-account passwords, if the library executed under a privileged account or accessed authentication material, browser data, or configuration files with embedded secrets.
- Restore the host to a known-good state by rebuilding from a trusted image or reinstalling verified packages, then validate that no unapproved libraries, altered loader settings, or attacker-added binaries remain on disk before returning the system to production.
- Escalate to incident response immediately if the same library hash or path is present on multiple hosts, the load occurred as `root`, or the host showed follow-on behavior such as new persistence, remote command execution, or suspicious outbound network connections.
- Harden the environment by restricting plugin and engine loads to approved library directories, enforcing package integrity checks, monitoring for changes to preload files and service definitions, and applying SELinux or AppArmor policies that prevent scripts and LoLBins from loading shared objects from user-writable paths.
"""
references = ["https://gtfobins.github.io/#+library%20load"]
risk_score = 47
rule_id = "ebf493d1-20be-41a0-a010-c1b6a6f90e28"
setup = """## Setup

This rule requires data coming in from one of the following integrations:
- Elastic Defend
- Auditbeat
- Auditd Manager
- CrowdStrike

### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Tactic: Execution",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Auditd Manager",
    "Data Source: SentinelOne",
    "Data Source: Crowdstrike",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "executed", "process_started", "start", "ProcessRollup2") and
?process.parent.executable != null and
(
  (process.name == "bash" and process.args == "-c" and process.args like "* enable *-f*.so*") or
  (process.name == "openssl" and process.args == "-engine" and process.args like "*.so*") or
  (process.name like "python*" and process.args == "-c" and process.args like "*cdll.LoadLibrary*.so*") or
  (process.name like "ruby*" and process.args == "-e" and process.args like "*Fiddle.dlopen*.so*") or 
  (process.name in ("gdb", "gimp", "rview", "rvim", "view", "vim", "vimdiff") and
   process.args like "*cdll.LoadLibrary*.so*") or
  (process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.args == "-c" and process.args like ("*cdll.LoadLibrary*.so*", "*ruby*-e**Fiddle.dlopen*.so*")
  )
) and
not (
  ?process.parent.executable like (
    "/root/.cache/bazel/_bazel_root/install/*", "/opt/Xilinx/PetaLinux/*", "/usr/bin/find", "/bin/find", 
    "/opt/nessus_agent/sbin/nessus-agent-module", "/sw/eb/sw/Python/*/bin/python*"
  ) or
  ?process.parent.name in ("make", "process-wrapper", "bwrap") or
  (process.name like "python*" and ?process.command_line like~ "*import torch*torchinductor*") or
  ?process.command_line like "*https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE*"
)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

  [rule.threat.tactic]
  name = "Defense Evasion"
  id = "TA0005"
  reference = "https://attack.mitre.org/tactics/TA0005/"

    [[rule.threat.technique]]
    id = "T1218"
    name = "System Binary Proxy Execution"
    reference = "https://attack.mitre.org/techniques/T1218/"

   [[rule.threat.technique]]
   name = "Hijack Execution Flow"
   id = "T1574"
   reference = "https://attack.mitre.org/techniques/T1574/"

[[rule.threat]]
framework = "MITRE ATT&CK"

  [rule.threat.tactic]
  name = "Execution"
  id = "TA0002"
  reference = "https://attack.mitre.org/tactics/TA0002/"

  [[rule.threat.technique]]
  id = "T1059"
  name = "Command and Scripting Interpreter"
  reference = "https://attack.mitre.org/techniques/T1059/"

    [[rule.threat.technique.subtechnique]]
    name = "Unix Shell"
    id = "T1059.004"
    reference = "https://attack.mitre.org/techniques/T1059/004/"

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "executed", "process_started", "start", "ProcessRollup2") and
?process.parent.executable != null and
(
  (process.name == "bash" and process.args == "-c" and process.args like "* enable *-f*.so*") or
  (process.name == "openssl" and process.args == "-engine" and process.args like "*.so*") or
  (process.name like "python*" and process.args == "-c" and process.args like "*cdll.LoadLibrary*.so*") or
  (process.name like "ruby*" and process.args == "-e" and process.args like "*Fiddle.dlopen*.so*") or 
  (process.name in ("gdb", "gimp", "rview", "rvim", "view", "vim", "vimdiff") and
   process.args like "*cdll.LoadLibrary*.so*") or
  (process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.args == "-c" and process.args like ("*cdll.LoadLibrary*.so*", "*ruby*-e**Fiddle.dlopen*.so*")
  )
) and
not (
  ?process.parent.executable like (
    "/root/.cache/bazel/_bazel_root/install/*", "/opt/Xilinx/PetaLinux/*", "/usr/bin/find", "/bin/find", 
    "/opt/nessus_agent/sbin/nessus-agent-module", "/sw/eb/sw/Python/*/bin/python*"
  ) or
  ?process.parent.name in ("make", "process-wrapper", "bwrap") or
  (process.name like "python*" and ?process.command_line like~ "*import torch*torchinductor*") or
  ?process.command_line like "*https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE*"
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2
  • exec
  • exec_event
  • executed
  • process_started
  • start
field:"EventType" kind:in
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argseq
  • -c
  • -e
  • -engine
field:"process.args" kind:eq
process.argswildcard
  • * enable *-f*.so*
  • *.so*
  • *Fiddle.dlopen*.so*
  • *cdll.LoadLibrary*.so*
  • *ruby*-e**Fiddle.dlopen*.so*
field:"process.args" kind:wildcard
process.nameeq
  • bash
  • openssl
field:"process_basename" kind:eq
process.namein
  • bash
  • csh
  • dash
  • fish
  • gdb
  • gimp
  • ksh
  • rview
  • rvim
  • sh
  • tcsh
  • view
  • vim
  • vimdiff
  • zsh
field:"process_basename" kind:in
process.namewildcard
  • python*
  • ruby*
field:"process_basename" kind:wildcard
process.parent.executableis_not_null
  • (no value, null check)
field:"ParentImage" kind:is_not_null

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linewildcard*import torch*torchinductor*excludes:process.command_line field:"process.command_line" value:"*import torch*torchinductor*"
process.namestarts_withpythonexcludes:process.name field:"process.name" value:"python"
process.command_linematchhttps://github.com/community-scripts/ProxmoxVE/raw/main/LICENSEexcludes:process.command_line field:"process.command_line" value:"https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE"
process.parent.executablewildcard/root/.cache/bazel/_bazel_root/install/*, /opt/Xilinx/PetaLinux/*, /usr/bin/find, /bin/find, /opt/nessus_agent/sbin/nessus-agent-module, /sw/eb/sw/Python/*/bin/python*excludes:process.parent.executable
process.parent.nameinbwrap, make, process-wrapperexcludes:process.parent.name field:"process.parent.name" value:"bwrap" field:"process.parent.name" value:"make" field:"process.parent.name" value:"process-wrapper"

Spike in Special Privilege Use Events

#
Status
production
Severity
low
Author
Elastic
Source
github.com/elastic/detection-rules

A machine learning job has detected an unusual increase in special privilege usage events, such as privileged operations and service calls, for a user, suggesting potential unauthorized privileged access. A sudden spike in these events may indicate an attempt to escalate privileges, execute unauthorized tasks, or maintain persistence within a system.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/02/18"
integration = ["pad", "system"]
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 detected an unusual increase in special privilege usage events, such as privileged operations
and service calls, for a user, suggesting potential unauthorized privileged access. A sudden spike in these events may
indicate an attempt to escalate privileges, execute unauthorized tasks, or maintain persistence within a system.
"""
from = "now-3h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "pad_windows_high_count_special_privilege_use_events_ea"
name = "Spike in Special Privilege Use 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 Special Privilege Use Events

Machine learning models monitor special privilege use, identifying anomalies that suggest unauthorized access. Adversaries exploit these privileges to escalate access, execute unauthorized actions, or maintain system persistence. The detection rule leverages ML to spot unusual spikes in privileged operations, flagging potential misuse for further investigation.

### Possible investigation steps

- Review the user account associated with the spike in special privilege use events to determine if the activity aligns with their normal behavior or job role.
- Examine the specific privileged operations and service calls that were flagged to identify any unusual or unauthorized actions.
- Check for any recent changes in user permissions or group memberships that could explain the increase in privilege use.
- Investigate any corresponding logs or alerts around the same timeframe to identify potential indicators of compromise or related suspicious activities.
- Assess the system or application where the privilege escalation occurred for any signs of exploitation or unauthorized access attempts.
- Correlate the detected spike with known threat intelligence or recent security advisories to determine if it matches any known attack patterns or vulnerabilities.

### False positive analysis

- Routine administrative tasks by IT personnel can trigger false positives. Regularly review and whitelist known administrative accounts to prevent unnecessary alerts.
- Scheduled maintenance activities often involve elevated privileges. Document and exclude these activities from monitoring during known maintenance windows.
- Automated scripts or services that require elevated privileges may cause spikes. Identify and exclude these scripts or services from the rule to reduce false positives.
- Software updates or installations can lead to temporary spikes in privilege use. Coordinate with IT to recognize these events and adjust monitoring rules accordingly.
- Frequent legitimate use of privileged operations by certain users or roles should be analyzed. Establish a baseline for these users and adjust the detection threshold to accommodate their normal activity levels.

### Response and remediation

- Immediately isolate the affected user account to prevent further unauthorized privileged operations. Disable the account or change its credentials to stop potential misuse.
- Conduct a thorough review of recent privileged operations and service calls associated with the user account to identify any unauthorized actions or changes made during the spike.
- Revoke any unnecessary privileges or access rights from the affected user account to minimize the risk of future exploitation.
- Implement additional monitoring on the affected system and user account to detect any further suspicious activities or attempts to regain unauthorized access.
- Escalate the incident to the security operations team for a deeper investigation into potential privilege escalation techniques used, referencing MITRE ATT&CK technique T1068.
- Review and update access control policies and privilege management practices to ensure they align with the principle of least privilege, reducing the risk of similar incidents.
- Conduct a post-incident analysis to identify any gaps in detection or response and enhance the machine learning model's ability to detect similar threats in the future."""
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 = "6fb2280a-d91a-4e64-a97e-1332284d9391"
setup = """## Setup

The rule requires the Privileged Access Detection integration assets to be installed, as well as Windows logs collected by the System integration.

### 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).
- Windows events collected by the [System](https://docs.elastic.co/en/integrations/system) integration.
- To add the System 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: Windows Security Event Logs",
    "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 = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"

[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stack Spoofing via ROP Gadget for DLL Load

#
Source
github.com/elastic/protections-artifacts

Detects potential stack spoofing via ROP gadget in the context of module load events. Flags library loads where the call stack exhibits patterns associated with return-oriented programming used to alter call stack appearance.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects potential stack spoofing via ROP gadget in the context of module load events. Flags library loads where the call
stack exhibits patterns associated with return-oriented programming used to alter call stack appearance.
"""
id = "b4d9f1e8-6c0a-2e5b-d3f7-9a8c4e1b0d2f"
license = "Elastic License v2"
name = "Stack Spoofing via ROP Gadget for DLL Load"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/doubling-down-etw-callstacks",
    "https://attack.mitre.org/techniques/T1036/",
]
version = "1.0.1"

query = '''
library where
  dll.name in (
    "ws2_32.dll",
    "wininet.dll",
    "winhttp.dll",
    "system.directoryservices.ni.dll",
    "system.management.automation.ni.dll",
    "netapi32.dll", 
    "dnsapi.dll"
  ) and
  process.thread.Ext.call_stack_summary in (
    "ntdll.dll|kernelbase.dll|dfshim.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|dfshim.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|archiveint.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|archiveint.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|fluenceds.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|fluenceds.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|bingmaps.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|bingmaps.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|maprouter.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|maprouter.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|mfc140.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|mfc140.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|mshtml.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|mshtml.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|printui.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|printui.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|shell32.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|shell32.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|urlmon.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|urlmon.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll"
  ) and
  not (dll.name in ("netapi32.dll", "ws2_32.dll") and process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|printui.dll|kernel32.dll|ntdll.dll", "ntdll.dll|printui.dll|kernel32.dll|ntdll.dll")) and
  not (dll.name == "wininet.dll" and process.thread.Ext.call_stack_summary == "ntdll.dll|mshtml.dll|kernel32.dll|ntdll.dll")
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"

[[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.0"

Stages and Predicates

Stage 1: library

library where
  dll.name in (
    "ws2_32.dll",
    "wininet.dll",
    "winhttp.dll",
    "system.directoryservices.ni.dll",
    "system.management.automation.ni.dll",
    "netapi32.dll", 
    "dnsapi.dll"
  ) and
  process.thread.Ext.call_stack_summary in (
    "ntdll.dll|kernelbase.dll|dfshim.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|dfshim.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|archiveint.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|archiveint.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|fluenceds.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|fluenceds.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|bingmaps.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|bingmaps.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|maprouter.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|maprouter.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|mfc140.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|mfc140.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|mshtml.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|mshtml.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|printui.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|printui.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|shell32.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|shell32.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|urlmon.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|urlmon.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|kernelbase.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll",
    "ntdll.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll"
  ) and
  not (dll.name in ("netapi32.dll", "ws2_32.dll") and process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|printui.dll|kernel32.dll|ntdll.dll", "ntdll.dll|printui.dll|kernel32.dll|ntdll.dll")) and
  not (dll.name == "wininet.dll" and process.thread.Ext.call_stack_summary == "ntdll.dll|mshtml.dll|kernel32.dll|ntdll.dll")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namein
  • dnsapi.dll
  • netapi32.dll
  • system.directoryservices.ni.dll
  • system.management.automation.ni.dll
  • winhttp.dll
  • wininet.dll
  • ws2_32.dll
field:"dll.name" kind:in
process.thread.Ext.call_stack_summaryin
  • ntdll.dll|archiveint.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|bingmaps.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|dfshim.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|fluenceds.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|archiveint.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|authfwsnapin.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|bingmaps.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|dfshim.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|fluenceds.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|hostnetsvc.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|maprouter.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|mfc140.dll|kernel32.dll|ntdll.dll
  • ntdll.dll|kernelbase.dll|mshtml.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|printui.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|shell32.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|urlmon.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|kernelbase.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|maprouter.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|mfc140.dll|kernel32.dll|ntdll.dll
  • ntdll.dll|mshtml.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|printui.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|shell32.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|urlmon.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|windows.networking.backgroundtransfer.contentprefetchtask.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
  • ntdll.dll|winipcsecproc.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
field:"process.thread.Ext.call_stack_summary" kind:in

Exclusions

The rule actively suppresses these predicates.

Suspicious Archive Creation via Ditto

#
Source
github.com/elastic/protections-artifacts

Detects the use of the Ditto utility on macOS to create a compressed archive. The AMOS stealer has used this lesser known method for creating an archive containing the collected data for exfiltration via C2.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects the use of the Ditto utility on macOS to create a compressed archive. The AMOS stealer has used this lesser
known method for creating an archive containing the collected data for exfiltration via C2.
"""
id = "9aec8065-72d1-4e34-bac9-22ae1213dd41"
license = "Elastic License v2"
name = "Suspicious Archive Creation via Ditto"
os_list = ["macos"]
reference = [
    "https://moonlock.com/atomic-macos-stealer",
    "https://medium.com/@dineshdevadoss04/breaking-down-atomic-macos-stealer-amos-8cd5eea56024",
]
version = "1.0.9"

query = '''
process where event.type == "start" and event.action == "exec" and process.name == "ditto" and
 process.args in~ ("-c", "-k", "--sequesterRsrc", "--keepParent") and
 process.args like ("/Users/*", "/private/tmp/*", "/tmp/*", "/var/folders/*") and
 process.args like~ "*.zip*" and
 (process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false) and
 not process.parent.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*", "/usr/local/Homebrew/*") and 
 not process.Ext.effective_parent.executable like ("/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
                                                  "/opt/homebrew/*",
                                                  "/Applications/Ghostty.app/Contents/MacOS/ghostty")
'''

min_endpoint_version = "8.11.1"
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 = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[[threat.technique.subtechnique]]
id = "T1074.001"
name = "Local Data Staging"
reference = "https://attack.mitre.org/techniques/T1074/001/"



[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

[internal]
min_endpoint_version = "8.11.1"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.name == "ditto" and
 process.args in~ ("-c", "-k", "--sequesterRsrc", "--keepParent") and
 process.args like ("/Users/*", "/private/tmp/*", "/tmp/*", "/var/folders/*") and
 process.args like~ "*.zip*" and
 (process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false) and
 not process.parent.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*", "/usr/local/Homebrew/*") and 
 not process.Ext.effective_parent.executable like ("/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
                                                  "/opt/homebrew/*",
                                                  "/Applications/Ghostty.app/Contents/MacOS/ghostty")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argsin
  • --keepParent
  • --sequesterRsrc
  • -c corpus 4 (elastic 4)
  • -k
field:"process.args" kind:in
process.argswildcard
  • *.zip*
  • /Users/* corpus 6 (elastic 6)
  • /private/tmp/* corpus 7 (elastic 7)
  • /tmp/* corpus 11 (elastic 11)
  • /var/folders/*
field:"process.args" kind:wildcard
process.nameeq
  • ditto corpus 2 (elastic 2)
field:"process_basename" kind:eq value:"ditto"
process.parent.code_signature.existseq
  • false transforms: boolean corpus 25 (elastic 25)
field:"process.parent.code_signature.exists" kind:eq value:"false"
process.parent.code_signature.trustedeq
  • false transforms: boolean corpus 26 (elastic 26)
field:"process.parent.code_signature.trusted" kind:eq value:"false"

Exclusions

The rule actively suppresses these predicates.

Suspicious Child Execution via Web Server

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies suspicious child processes executed via a web server, which may suggest a vulnerability and remote shell access. Attackers may exploit a vulnerability in a web application to execute commands via a web server, or place a backdoor file that can be abused to gain code execution as a mechanism for persistence.

Known False Positives

  • Network monitoring or management products may have a web server component that runs shell commands as part of normal behavior.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/03/04"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/20"

[transform]
[[transform.osquery]]
label = "Osquery - Retrieve Listening Ports"
query = "SELECT pid, address, port, socket, protocol, path FROM listening_ports"

[[transform.osquery]]
label = "Osquery - Retrieve Open Sockets"
query = "SELECT pid, family, remote_address, remote_port, socket, state FROM process_open_sockets"

[[transform.osquery]]
label = "Osquery - Retrieve Process Info"
query = "SELECT name, cmdline, parent, path, uid FROM processes"

[[transform.osquery]]
label = "Osquery - Retrieve Process Info for Webapp User"
query = "SELECT name, cmdline, parent, path, uid FROM processes WHERE uid = {{process.user.id}}"

[[transform.osquery]]
label = "Osquery - Retrieve Crontab Information"
query = "SELECT * FROM crontab"

[rule]
author = ["Elastic"]
description = """
Identifies suspicious child processes executed via a web server, which may suggest a vulnerability and remote shell access.
Attackers may exploit a vulnerability in a web application to execute commands via a web server, or place a backdoor
file that can be abused to gain code execution as a mechanism for persistence.
"""
false_positives = [
    """
    Network monitoring or management products may have a web server component that runs shell commands as part of normal
    behavior.
    """,
]
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Child Execution via Web Server"
note = """## Triage and analysis

### Investigating Suspicious Child Execution via Web Server

Adversaries may backdoor web servers with web shells to establish persistent access to systems. A web shell is a malicious script, often embedded into a compromised web server, that grants an attacker remote access and control over the server. This enables the execution of arbitrary commands, data exfiltration, and further exploitation of the target network.

This rule detects a web server process spawning script and command line interface programs, potentially indicating attackers executing commands using the web shell.

> **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.
> This investigation guide uses [placeholder fields](https://www.elastic.co/guide/en/security/current/osquery-placeholder-fields.html) to dynamically pass alert data into Osquery queries. Placeholder fields were introduced in Elastic Stack version 8.7.0. If you're using Elastic Stack version 8.6.0 or earlier, you'll need to manually adjust this investigation guide's queries to ensure they properly run.

#### Possible investigation steps

- Investigate abnormal behaviors by the subject process such as network connections, file modifications, and any other spawned child processes.
  - Investigate listening ports and open sockets to look for potential reverse shells or data exfiltration.
    - $osquery_0
    - $osquery_1
  - Investigate the process information for malicious or uncommon processes/process trees.
    - $osquery_2
  - Investigate the process tree spawned from the user that is used to run the web application service. A user that is running a web application should not spawn other child processes.
    - $osquery_3
- Examine the command line to determine which commands or scripts were executed.
- Investigate other alerts associated with the user/host during the past 48 hours.
- If scripts or executables were dropped, retrieve the files 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.
        - Check if the domain is newly registered or unexpected.
        - Check the reputation of the domain or IP address.
      - File access, modification, and creation activities.
      - Cron jobs, services and other persistence mechanisms.
        - $osquery_4

### False positive analysis

- This activity is unlikely to happen legitimately. Any activity that triggered the alert and is not inherently malicious must be monitored by the security team.

### 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.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- 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.
- Leverage the incident response data and logging to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
references = [
    "https://pentestlab.blog/tag/web-shell/",
    "https://www.elastic.co/security-labs/elastic-response-to-the-the-spring4shell-vulnerability-cve-2022-22965",
]
risk_score = 47
rule_id = "f16fca20-4d6c-43f9-aec1-20b6de3b0aeb"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Initial Access",
    "Use Case: Vulnerability",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend"
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" 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*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi") or
  (
    process.parent.name like "ruby*" and
    process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*")
  ) 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*"
      ) or
      ?process.working_directory like "/u0?/*"
    )
  )
) and (
  process.executable like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "/lost+found/*",
    "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*" 
  ) or
  process.name like~ (
    // Hidden processes
    ".*",

    // Suspicious file formats
    "*.elf", "*.sh", "*.py", "*.rb", "*.pl", "*.lua*", "*.php*", ".js", "*.bin", "*.jar", "*.mjs",

    // Network utilities often used for reverse shells
    "nc", "netcat", "ncat", "telnet", "socat", "openssl", "nc.openbsd", "ngrok", "nc.traditional",

    // Cloud CLI
    "az", "gcloud", "aws", "kubectl", "helm", "docker", "ctr", "crictl",

    // Misc. tools
    "whoami", "ifconfig", "ip", "ss", "top", "htop", "du", "lsblk", "lsof", "tcpdump",
    "strace", "ltrace", "curl", "wget", "dig", "nslookup", "host", "nmap", "arp", "traceroute",
    "cat", "touch", "mv", "rm", "mkdir", "ln", "chmod", "sudo", "xxd", "base64", "basez",
    "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16", "chpasswd",
    "passwd"
  ) 
) and 
not (
  (
    process.parent.name == "java" and
    process.executable like ("/tmp/CVU_*/exectask*", "/u01/app/*/bin/crsctl.bin", "/u01/app/*/bin/olsnodes.bin")
  ) or
  process.working_directory like ("/u01/*/sysman/emd", "/run/systemd/mount-rootfs") or
  (
    process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and
    process.command_line like (
      "chmod -R g+w /var/opt/morpheus/morpheus-local/repo/git/*",
      "sudo -S -u morpheus-local*"
    )
  ) or
  (
    process.parent.command_line == "/bin/sh /etc/init.d/nginx rotate" and
    process.name == "cat"
  ) or
  (
    process.parent.name == "asterisk" and
    process.executable like (
      "/var/www/html/dialapplet-web/agi/*.php", "/var/lib/asterisk/bin/faxnotify.php"
    )
  ) or
  (
    process.parent.executable == "/home/jiraContractor/jira.install/jre/bin/java" and
    process.executable == "/home/jiraContractor/jira.install/jre/lib/jspawnhelper"
  ) or
  process.parent.args like "/home/agent/Claude/*" or
  (process.parent.executable == "/usr/lib/jvm/java-21-openjdk/bin/java" and process.name == "ln") or
  (
    process.parent.name == "java" and
    process.name == "chmod" and
    process.command_line like ("chmod 00660 /etc/pki/*", "*/u01/app/*")
  )
)
'''

[[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 = "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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[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 == "linux" and event.type == "start" and event.action == "exec" 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*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi") or
  (
    process.parent.name like "ruby*" and
    process.parent.command_line like~ ("*puma*", "*rails*", "*passenger*")
  ) 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*"
      ) or
      ?process.working_directory like "/u0?/*"
    )
  )
) and (
  process.executable like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "/lost+found/*",
    "/proc/*", "/var/mail/*", "/var/www/*", "/home/*/*", "/root/*"
  ) or
  process.name like~ (
    ".*",
    "*.elf", "*.sh", "*.py", "*.rb", "*.pl", "*.lua*", "*.php*", ".js", "*.bin", "*.jar", "*.mjs",
    "nc", "netcat", "ncat", "telnet", "socat", "openssl", "nc.openbsd", "ngrok", "nc.traditional",
    "az", "gcloud", "aws", "kubectl", "helm", "docker", "ctr", "crictl",
    "whoami", "ifconfig", "ip", "ss", "top", "htop", "du", "lsblk", "lsof", "tcpdump",
    "strace", "ltrace", "curl", "wget", "dig", "nslookup", "host", "nmap", "arp", "traceroute",
    "cat", "touch", "mv", "rm", "mkdir", "ln", "chmod", "sudo", "xxd", "base64", "basez",
    "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16", "chpasswd",
    "passwd"
  )
) and
not (
  (
    process.parent.name == "java" and
    process.executable like ("/tmp/CVU_*/exectask*", "/u01/app/*/bin/crsctl.bin", "/u01/app/*/bin/olsnodes.bin")
  ) or
  process.working_directory like ("/u01/*/sysman/emd", "/run/systemd/mount-rootfs") or
  (
    process.parent.executable == "/opt/morpheus/embedded/java/jre/bin/java" and
    process.command_line like (
      "chmod -R g+w /var/opt/morpheus/morpheus-local/repo/git/*",
      "sudo -S -u morpheus-local*"
    )
  ) or
  (
    process.parent.command_line == "/bin/sh /etc/init.d/nginx rotate" and
    process.name == "cat"
  ) or
  (
    process.parent.name == "asterisk" and
    process.executable like (
      "/var/www/html/dialapplet-web/agi/*.php", "/var/lib/asterisk/bin/faxnotify.php"
    )
  ) or
  (
    process.parent.executable == "/home/jiraContractor/jira.install/jre/bin/java" and
    process.executable == "/home/jiraContractor/jira.install/jre/lib/jspawnhelper"
  ) or
  process.parent.args like "/home/agent/Claude/*" or
  (process.parent.executable == "/usr/lib/jvm/java-21-openjdk/bin/java" and process.name == "ln") or
  (
    process.parent.name == "java" and
    process.name == "chmod" and
    process.command_line like ("chmod 00660 /etc/pki/*", "*/u01/app/*")
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /home/*/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namewildcard
  • *.bin
  • *.elf
  • *.jar
  • *.lua*
  • *.mjs
  • *.php*
  • *.pl
  • *.py
  • *.rb
  • *.sh
  • .*
  • .js
  • arp
  • aws
  • az
  • base16
  • base32
  • base64
  • base64mime
  • base64pem
  • base64plain
  • base64url
  • basenc
  • basez
  • cat
  • chmod
  • chpasswd
  • crictl
  • ctr
  • curl
  • dig
  • docker
  • du
  • gcloud
  • helm
  • host
  • htop
  • ifconfig
  • ip
  • kubectl
  • +29 more values (see full rule source)
field:"process_basename" kind:wildcard
process.parent.argswildcard
  • *-Dsolr.solr.home=*
  • *BitbucketServerLauncher*
  • *jenkins.war*
  • *quarkus-run.jar*
  • *weblogic-launcher.jar*
  • -Dcatalina.base=*
  • -Djboss.home.dir=*
  • -Djetty.home=*
  • -Dweblogic.Name=*
  • com.atlassian.jira.startup.Launcher
  • com.caucho.server.resin.Resin
  • com.google.gerrit.pgm.Daemon
  • com.ibm.ws.kernel.boot.cmdline.Bootstrap
  • com.ibm.ws.runtime.WsServer
  • com.sun.enterprise.glassfish.bootstrap.ASMain
  • io.dropwizard.cli.ServerCommand
  • io.helidon.microprofile.server.Main
  • io.helidon.webserver*
  • io.micronaut.runtime.Micronaut
  • io.quarkus.runner.GeneratedMain
  • io.vertx.core.Launcher
  • org.apache.catalina.startup.Bootstrap
  • org.apereo.cas*
  • org.eclipse.jetty.start.Main
  • org.elasticsearch.bootstrap.Elasticsearch
  • org.jboss.modules.Main
  • org.keycloak*
  • org.springframework.boot.loader.*
  • play.core.server.ProdServerStart
  • weblogic.Server
field:"process.parent.args" kind:wildcard
process.parent.command_linewildcard
  • *app.py*
  • *asgi.py*
  • *django*
  • *flask*
  • *hypercorn*
  • *passenger*
  • *plackup*
  • *puma*
  • *rails*
  • *server.py*
  • *uvicorn*
  • *wsgi.py*
field:"ParentCommandLine" kind:wildcard
process.parent.nameeq
  • java
field:"parent_process_basename" kind:eq value:"java"
process.parent.namein
  • apache2
  • asterisk
  • caddy
  • daphne
  • flask
  • frankenphp
  • httpd
  • httpd.worker
  • lswsctrl
  • mongrel_rails
  • nginx
  • php-cgi
  • php-cgi.cagefs
  • php-fcgi
  • starman
  • sw-engine-fpm
  • uvicorn
  • uwsgi
  • varnishd
  • waitress-serve
  • zabbix_server
field:"parent_process_basename" kind:in
process.parent.namewildcard
  • *.cgi
  • *.fcgi
  • gunicorn*
  • lsphp*
  • perl*
  • php-fpm*
  • python*
  • ruby*
field:"parent_process_basename" kind:wildcard
process.working_directorywildcard
  • /u0?/*
field:"CurrentDirectory" kind:wildcard value:"/u0?/*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linestarts_withchmod -R g+w /var/opt/morpheus/morpheus-local/repo/git/, sudo -S -u morpheus-localexcludes:process.command_line field:"process.command_line" value:"chmod -R g+w /var/opt/morpheus/morpheus-local/repo/git/" field:"process.command_line" value:"sudo -S -u morpheus-local"
process.parent.executableeq/opt/morpheus/embedded/java/jre/bin/javaexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/morpheus/embedded/java/jre/bin/java"
process.command_linewildcardchmod 00660 /etc/pki/*, */u01/app/*excludes:process.command_line field:"process.command_line" value:"chmod 00660 /etc/pki/*" field:"process.command_line" value:"*/u01/app/*"
process.nameeqchmodexcludes:process.name field:"process.name" value:"chmod"
process.parent.nameeqjavaexcludes:process.parent.name field:"process.parent.name" value:"java"
process.executableeq/home/jiraContractor/jira.install/jre/lib/jspawnhelperexcludes:process.executable field:"process.executable" value:"/home/jiraContractor/jira.install/jre/lib/jspawnhelper"
process.parent.executableeq/home/jiraContractor/jira.install/jre/bin/javaexcludes:process.parent.executable field:"process.parent.executable" value:"/home/jiraContractor/jira.install/jre/bin/java"
process.executablewildcard/tmp/CVU_*/exectask*, /u01/app/*/bin/crsctl.bin, /u01/app/*/bin/olsnodes.binexcludes:process.executable field:"process.executable" value:"/tmp/CVU_*/exectask*" field:"process.executable" value:"/u01/app/*/bin/crsctl.bin" field:"process.executable" value:"/u01/app/*/bin/olsnodes.bin"
process.executablewildcard/var/www/html/dialapplet-web/agi/*.php, /var/lib/asterisk/bin/faxnotify.phpexcludes:process.executable field:"process.executable" value:"/var/www/html/dialapplet-web/agi/*.php" field:"process.executable" value:"/var/lib/asterisk/bin/faxnotify.php"
process.parent.nameeqasteriskexcludes:process.parent.name field:"process.parent.name" value:"asterisk"
process.nameeqcatexcludes:process.name field:"process.name" value:"cat"
process.parent.command_lineeq/bin/sh /etc/init.d/nginx rotateexcludes:process.parent.command_line field:"process.parent.command_line" value:"/bin/sh /etc/init.d/nginx rotate"
process.nameeqlnexcludes:process.name field:"process.name" value:"ln"
process.parent.executableeq/usr/lib/jvm/java-21-openjdk/bin/javaexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/lib/jvm/java-21-openjdk/bin/java"
process.parent.argsstarts_with/home/agent/Claude/excludes:process.parent.args field:"process.parent.args" value:"/home/agent/Claude/"
process.working_directorywildcard/u01/*/sysman/emd, /run/systemd/mount-rootfsexcludes:process.working_directory field:"process.working_directory" value:"/u01/*/sysman/emd" field:"process.working_directory" value:"/run/systemd/mount-rootfs"

Suspicious Executable File Creation

#
Source
github.com/elastic/protections-artifacts

Identifies the creation of an executable file by a signed Microsoft binary proxy utility such as MSHTA.exe, CertReq.exe, CertUtil.exe or Common Microsoft Documents processes like WinWord and Excel.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the creation of an executable file by a signed Microsoft binary proxy utility such as MSHTA.exe, CertReq.exe,
CertUtil.exe or Common Microsoft Documents processes like WinWord and Excel.
"""
id = "37c54ca7-e96d-4fd5-92d3-08cab38516b7"
license = "Elastic License v2"
name = "Suspicious Executable File Creation"
os_list = ["windows"]
version = "1.0.26"

query = '''
file where event.action != "deletion" and not user.id : "S-1-5-18" and

 (file.extension : ("exe", "pif", "scr", "iso", "rar", "zip", "7z", "img", "vhd", "js", "vbs", "wsh", "hta",
                    "cpl", "jse", "vbe", "cmd", "dll") or

  file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and

 (
   process.name : ("CertUtil.exe", "CertReq.exe") or

   (process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
   file.path :
       ("?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*",
        "?:\\Users\\Public\\*",
        "?:\\ProgramData\\*",
        "?:\\Users\\Public\\*",
        "?:\\Users\\*\\Documents\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Users\\*\\Music\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Windows\\Tasks\\*",
        "?:\\Windows\\System32\\tasks\\*"))
  ) and

  /* MS Office often downloads js file types in the INETCache folder */
  not (file.extension : "js" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
       file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*" and

       /* avoid bypass via fake js file extension */
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and

  not (file.extension : ("zip", "rar", "7z") and process.executable : "?:\\Program Files*\\Microsoft Office\\*.exe" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (process.name : ("winword.exe", "POWERPNT.EXE") and file.path : "C:\\ProgramData\\CanonIJFAX\\*\\CNCARGU.DLL") and
  not (process.name : "POWERPNT.EXE" and file.extension :("dll", "tmp") and
       file.path : ("C:\\ProgramData\\UpSlide\\UnpackBinaries\\*", "c:\\programdata\\seagull\\drivers\\temp\\*.tmp")) and
  not (process.name : "certutil.exe" and
       file.path : ("?:\\Windows\\Installer\\*",
                    "?:\\Program Files\\Sales Pro Suite*.exe",
                    "?:\\Users\\*\\AppData\\Local\\Packages\\microsoft.windows.search_*\\AC\\AppCache\\*.js")) and
  not (process.name : ("excel.exe", "winword.exe") and
       file.path : ("?:\\ProgramData\\Seagull\\Drivers\\Temp\\ss#*.tmp",
                    "C:\\ProgramData\\SafeNet Sentinel\\Sentinel RMS Development Kit\\System\\*.dll",
                    "?:\\ProgramData\\TeamMate\\Integration\\*",
                    "?:\\ProgramData\\FactSet\\OnlineComponents\\*",
                    "?:\\ProgramData\\UpSlide\\UnpackBinaries\\*.dll",
                    "C:\\ProgramData\\Agilent\\Temp\\tmp*.tmp",
                    "?:\\ProgramData\\TeamMate\\*",
                    "?:\\ProgramData\\Sophos\\AutoUpdate\\*",
                    "C:\\Users\\Public\\Tegus Toolkit Addin\\Downloads\\Installation\\Application Files\\CanalystToolkitAddin_*"))
'''

min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"

[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: file

file where event.action != "deletion" and not user.id : "S-1-5-18" and
 (file.extension : ("exe", "pif", "scr", "iso", "rar", "zip", "7z", "img", "vhd", "js", "vbs", "wsh", "hta",
                    "cpl", "jse", "vbe", "cmd", "dll") or
  file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
 (
   process.name : ("CertUtil.exe", "CertReq.exe") or
   (process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
   file.path :
       ("?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*",
        "?:\\Users\\Public\\*",
        "?:\\ProgramData\\*",
        "?:\\Users\\Public\\*",
        "?:\\Users\\*\\Documents\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Users\\*\\Music\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Windows\\Tasks\\*",
        "?:\\Windows\\System32\\tasks\\*"))
  ) and
  not (file.extension : "js" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
       file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (file.extension : ("zip", "rar", "7z") and process.executable : "?:\\Program Files*\\Microsoft Office\\*.exe" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (process.name : ("winword.exe", "POWERPNT.EXE") and file.path : "C:\\ProgramData\\CanonIJFAX\\*\\CNCARGU.DLL") and
  not (process.name : "POWERPNT.EXE" and file.extension :("dll", "tmp") and
       file.path : ("C:\\ProgramData\\UpSlide\\UnpackBinaries\\*", "c:\\programdata\\seagull\\drivers\\temp\\*.tmp")) and
  not (process.name : "certutil.exe" and
       file.path : ("?:\\Windows\\Installer\\*",
                    "?:\\Program Files\\Sales Pro Suite*.exe",
                    "?:\\Users\\*\\AppData\\Local\\Packages\\microsoft.windows.search_*\\AC\\AppCache\\*.js")) and
  not (process.name : ("excel.exe", "winword.exe") and
       file.path : ("?:\\ProgramData\\Seagull\\Drivers\\Temp\\ss#*.tmp",
                    "C:\\ProgramData\\SafeNet Sentinel\\Sentinel RMS Development Kit\\System\\*.dll",
                    "?:\\ProgramData\\TeamMate\\Integration\\*",
                    "?:\\ProgramData\\FactSet\\OnlineComponents\\*",
                    "?:\\ProgramData\\UpSlide\\UnpackBinaries\\*.dll",
                    "C:\\ProgramData\\Agilent\\Temp\\tmp*.tmp",
                    "?:\\ProgramData\\TeamMate\\*",
                    "?:\\ProgramData\\Sophos\\AutoUpdate\\*",
                    "C:\\Users\\Public\\Tegus Toolkit Addin\\Downloads\\Installation\\Application Files\\CanalystToolkitAddin_*"))

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 3c736372697074206c616e6775616765 corpus 2 (elastic 2)
  • 406563686F* corpus 2 (elastic 2)
  • 406563686F*
  • 4d5a* corpus 2 (elastic 2)
  • 4d5a* corpus 45 (elastic 45)
  • 76617220* corpus 2 (elastic 2)
  • TVqQ* corpus 2 (elastic 2)
  • TVqQ*
field:"file.Ext.header_bytes" kind:wildcard
file.extensionwildcard
  • 7z corpus 3 (elastic 3)
  • cmd corpus 15 (elastic 15)
  • cpl corpus 19 (elastic 19)
  • dll corpus 32 (elastic 32)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • img corpus 4 (elastic 4)
  • iso corpus 4 (elastic 4)
  • js corpus 22 (elastic 22)
  • jse corpus 18 (elastic 18)
  • pif corpus 18 (elastic 18)
  • rar corpus 4 (elastic 4)
  • scr corpus 17 (elastic 17)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • vhd corpus 3 (elastic 3)
  • wsh corpus 16 (elastic 16)
  • zip corpus 3 (elastic 3)
field:"file.extension" kind:wildcard
file.pathwildcard
  • ?:\ProgramData\* corpus 3 (elastic 3)
  • ?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\* corpus 3 (elastic 3)
  • ?:\Users\*\Documents\*
  • ?:\Users\*\Music\*
  • ?:\Users\*\Pictures\*
  • ?:\Users\Public\* corpus 3 (elastic 3)
  • ?:\Windows\System32\tasks\* corpus 2 (elastic 2)
  • ?:\Windows\Tasks\*
field:"TargetFilename" kind:wildcard
process.namewildcard
  • CertReq.exe corpus 20 (elastic 20)
  • CertUtil.exe corpus 45 (elastic 39, splunk 6)
  • excel.exe corpus 34 (elastic 34)
  • powerpnt.exe corpus 31 (elastic 31)
  • winword.exe corpus 35 (elastic 35)
field:"process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.Ext.header_bytesstarts_with4d5a, TVqQ, 406563686Fexcludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"4d5a" field:"file.Ext.header_bytes" value:"TVqQ" field:"file.Ext.header_bytes" value:"406563686F"
file.extensioneqjsexcludes:file.extension field:"file.extension" value:"js"
file.pathwildcard?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\*excludes:file.path field:"file.path" value:"?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\*"
process.nameeqwinword.exe, excel.exe, powerpnt.exeexcludes:process.name field:"process.name" value:"winword.exe" field:"process.name" value:"excel.exe" field:"process.name" value:"powerpnt.exe"
file.extensioneqzip, rar, 7zexcludes:file.extension field:"file.extension" value:"zip" field:"file.extension" value:"rar" field:"file.extension" value:"7z"
process.executablewildcard?:\Program Files*\Microsoft Office\*.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files*\Microsoft Office\*.exe"
file.extensioneqdll, tmpexcludes:file.extension field:"file.extension" value:"dll" field:"file.extension" value:"tmp"
file.pathwildcardC:\ProgramData\UpSlide\UnpackBinaries\*, c:\programdata\seagull\drivers\temp\*.tmpexcludes:file.path field:"file.path" value:"C:\ProgramData\UpSlide\UnpackBinaries\*" field:"file.path" value:"c:\programdata\seagull\drivers\temp\*.tmp"
process.nameeqPOWERPNT.EXEexcludes:process.name field:"process.name" value:"POWERPNT.EXE"
file.pathwildcard?:\ProgramData\Seagull\Drivers\Temp\ss#*.tmp, C:\ProgramData\SafeNet Sentinel\Sentinel RMS Development Kit\System\*.dll, ?:\ProgramData\TeamMate\Integration\*, ?:\ProgramData\FactSet\OnlineComponents\*, ?:\ProgramData\UpSlide\UnpackBinaries\*.dll, C:\ProgramData\Agilent\Temp\tmp*.tmp, ?:\ProgramData\TeamMate\*, ?:\ProgramData\Sophos\AutoUpdate\*, C:\Users\Public\Tegus Toolkit Addin\Downloads\Installation\Application Files\CanalystToolkitAddin_*excludes:file.path
process.nameeqexcel.exe, winword.exeexcludes:process.name field:"process.name" value:"excel.exe" field:"process.name" value:"winword.exe"
file.pathwildcard?:\Windows\Installer\*, ?:\Program Files\Sales Pro Suite*.exe, ?:\Users\*\AppData\Local\Packages\microsoft.windows.search_*\AC\AppCache\*.jsexcludes:file.path field:"file.path" value:"?:\Windows\Installer\*" field:"file.path" value:"?:\Program Files\Sales Pro Suite*.exe" field:"file.path" value:"?:\Users\*\AppData\Local\Packages\microsoft.windows.search_*\AC\AppCache\*.js"
process.nameeqcertutil.exeexcludes:process.name field:"process.name" value:"certutil.exe"
file.pathwildcardC:\ProgramData\CanonIJFAX\*\CNCARGU.DLLexcludes:file.path field:"file.path" value:"C:\ProgramData\CanonIJFAX\*\CNCARGU.DLL"
process.nameeqwinword.exe, POWERPNT.EXEexcludes:process.name field:"process.name" value:"winword.exe" field:"process.name" value:"POWERPNT.EXE"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"

Suspicious File Renamed via SMB

#
Status
production
Severity
high
Time window
1s
Group by
file.extension, host.id
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies suspicious file rename operation by the virtual System process. This may indicate a remote ransomware attack via the SMB protocol.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/05/02"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/08"

[rule]
author = ["Elastic"]
description = """
Identifies suspicious file rename operation by the virtual System process. This may indicate a remote ransomware attack via the SMB protocol.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious File Renamed via SMB"
references = ["https://news.sophos.com/en-us/2023/12/21/akira-again-the-ransomware-that-keeps-on-taking/"]
risk_score = 73
rule_id = "78e9b5d5-7c07-40a7-a591-3dbbf464c386"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Impact",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
sequence by host.id, file.extension with maxspan=1s
 [file where host.os.type == "windows" and
  event.action == "rename" and process.pid == 4 and user.id : ("S-1-5-21*", "S-1-12-*") and
  file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
  file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk") and
  not file.extension : ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk")] with runs=3
'''

note = """## Triage and analysis

### Investigating Suspicious File Renamed via SMB
#### Possible investigation steps

- What do the Timeline member events show for the SMB-to-rename sequence?
  - Focus: use `host.id` as target context; open Investigate in Timeline to recover accepted SMB `source.ip`, rename-event `user.id`, and representative renamed `file.path`.
  - Implication: escalate on one remote SMB source followed by repeated high-entropy user-file renames; lower concern only when member events show one bounded remote file-management job with stable source, account, path, and extension mapping. Missing member events are unresolved, not benign.
- Does the recovered source/account pair fit a recognized remote file-management workflow?
  - Focus: recovered `source.ip`, `user.id`, `user.name`, and `user.domain`.
  - Implication: escalate when a rare source or privileged account remotely renames user data; lower concern when the same source/account pair recurs as a backup, migration, DLP, or conversion actor for this exact share.
- Do rename artifacts look like encryption instead of content conversion?
  - Focus: same target host, SMB-server context, alert window, and recovered `user.id`: `file.Ext.original.extension`, `file.extension`, `file.Ext.entropy`, and `file.size`.
  - Implication: escalate when common documents or images move to one unfamiliar high-entropy extension family across many paths; lower concern when before/after extensions and file sizes match a recognized converter, archive, or quarantine workflow.
- How far did the rename burst spread on the target host?
  - Focus: file rename events from the same target host, SMB-server context, recovered `user.id`, and surrounding window; compare `file.path` roots and `file.Ext.original.extension` families.
  - Implication: escalate when the burst crosses user profiles, share roots, or document families; lower urgency when it stays a short bounded task in one managed folder with stable extension mapping.
- Did the target receive ransom-note or payload files around the rename burst?
  - Why: SMB ransomware may run from the remote source while leaving note or helper files on the target share, making target-side file artifacts decisive corroboration.
  - Focus: file events on the same `host.id` around the rename window: repeated `file.name`, `file.path`, or `file.extension` patterns for note-like files, scripts, or executables. $investigate_0
  - Implication: escalate when repeated note-like names or executable/script drops appear in impacted paths; lower concern when file activity stays limited to the explained rename workflow.
- Did recovery inhibition or destructive behavior align with the rename burst?
  - Focus: related alerts on the same `host.id` around the rename window naming recovery inhibition, destructive file activity, or ransomware notes. $investigate_1
  - Implication: escalate and prioritize containment when these alerts align; absence reduces urgency only after source/account and rename evidence fit one exact workflow.
- If local findings remain suspicious or unresolved, does the same SMB source or account drive similar renames elsewhere?
  - Focus: across hosts, look for the same recovered `source.ip` or `user.id` paired with inbound SMB accept events and high-entropy rename bursts using the suspicious `file.extension`.
  - Implication: broaden containment when the same source or account drives similar user-file rename bursts on other hosts; keep scope local only when this pivot is quiet and local evidence is otherwise resolved.
- Escalate when SMB source/account, rename shape, target breadth, note/payload artifacts, recovery-inhibition alerts, or cross-host spread show remote encryption or destructive file handling over SMB. Close only when recovered telemetry binds one exact backup, migration, DLP, or conversion job on this host, with owner or change records as corroboration only. Preserve evidence and escalate when telemetry is mixed, incomplete, or contradicted.

### False positive analysis

- Backup, migration, DLP quarantine, or document-conversion tooling can rename many files over SMB. Confirm that recovered `source.ip`, `user.id`, managed `file.path` scope, extension mapping, and absence of note/payload or recovery-inhibition evidence all support the same workflow on this host. Use owner confirmation or change records only as corroboration; if unavailable, close only when recovered events independently bind one exact workflow.
- Treat recurrence of the same source/account, folder scope, and extension mapping across prior alerts as candidate tuning evidence, not a standalone benign verdict. Build exceptions from the narrowest stable pattern: recovered `source.ip`, `user.id`, managed `file.path` scope, host cohort, and extension mapping. Do not except on SMB activity, `process.pid` 4, high entropy, rename volume, or one extension alone.

### Response and remediation

- If confirmed benign, reverse temporary containment and document the source host, account, managed folder scope, and extension mapping that explained the rename burst. Create an exception only after the same bounded pattern recurs.
- If suspicious but unconfirmed, preserve a Timeline export of the sequence member events, representative renamed files, any note or payload files, recovered SMB source/account details, and related alert IDs before containment that could alter evidence.
- Apply reversible containment first: block SMB from the recovered source, suspend the recovered account session, or temporarily restrict write access to the impacted share. Isolate the source or target host only when active renaming or destructive corroborators show ongoing ransomware activity.
- If confirmed malicious, isolate the source and impacted target or file server when the environment can tolerate it, disable and reset the recovered account, and stop active SMB sessions only after recording the source, account, renamed-file set, notes or payloads, and destructive alerts.
- Review other hosts for the same `source.ip`, `user.id`, suspicious extension, or note pattern before restoration so the full ransomware scope is understood.
- Restore renamed or encrypted files only from trusted backups or replicas after scope is complete, and verify backup repositories were not touched by the same source or account.
- Post-incident hardening: restrict remote SMB write paths and administrative shares, require MFA or equivalent controls for remote access and high-privilege accounts, protect backup credentials, and retain file and network telemetry needed to recover future SMB rename sequences."""

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
"""

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "host.id",
    "host.name",
    "host.os.type",
    "process.pid",
]

[transform]

[[transform.investigate]]
label = "Recent file activity on this host"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
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 = "T1485"
name = "Data Destruction"
reference = "https://attack.mitre.org/techniques/T1485/"

[[rule.threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"

[[rule.threat.technique]]
id = "T1490"
name = "Inhibit System Recovery"
reference = "https://attack.mitre.org/techniques/T1490/"

[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"

[[rule.threat.technique.subtechnique]]
id = "T1021.002"
name = "SMB/Windows Admin Shares"
reference = "https://attack.mitre.org/techniques/T1021/002/"

[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

Stages and Predicates

Stage 1: file ×3

[file where host.os.type == "windows" and
  event.action == "rename" and process.pid == 4 and user.id : ("S-1-5-21*", "S-1-12-*") and
  file.extension != null and file.Ext.entropy >= 6 and file.path : "C:\\Users\\*" and
  file.Ext.original.name : ("*.jpg", "*.bmp", "*.png", "*.pdf", "*.doc", "*.docx", "*.xls", "*.xlsx", "*.ppt", "*.pptx", "*.lnk") and
  not file.extension : ("jpg", "bmp", "png", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "lnk")] with runs=3

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • rename corpus 12 (elastic 12)
field:"EventType" kind:eq value:"rename"
file.Ext.entropyge
  • 6 transforms: number corpus 5 (elastic 5)
field:"file.Ext.entropy" kind:ge value:"6"
file.Ext.original.namewildcard
  • *.bmp corpus 6 (elastic 6)
  • *.doc corpus 6 (elastic 6)
  • *.docx corpus 6 (elastic 6)
  • *.jpg corpus 6 (elastic 6)
  • *.lnk corpus 2 (elastic 2)
  • *.pdf corpus 6 (elastic 6)
  • *.png corpus 6 (elastic 6)
  • *.ppt corpus 6 (elastic 6)
  • *.pptx corpus 6 (elastic 6)
  • *.xls corpus 6 (elastic 6)
  • *.xlsx corpus 6 (elastic 6)
field:"file.Ext.original.name" kind:wildcard
file.extensionis_not_null
  • (no value, null check)
field:"file.extension" kind:is_not_null
file.pathwildcard
  • C:\Users\* corpus 13 (sigma 9, elastic 4)
field:"TargetFilename" kind:wildcard value:"C:\Users\*"
process.pideq
  • 4 transforms: number corpus 17 (elastic 17)
field:"process_id" kind:eq value:"4"
user.idwildcard
  • S-1-12-* corpus 25 (elastic 25)
  • S-1-5-21* corpus 26 (elastic 26)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.extensioneqjpg, bmp, png, pdf, doc, docx, xls, xlsx, ppt, pptx, lnkexcludes:file.extension

Suspicious Java Class File Created in PaperCut Server Library

#
Status
production
Severity
critical
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects creation of Java .class files within the PaperCut NG/MF Application Server library directory. During active exploitation of CVE-2026-82078 (chained with CVE-2026-81578), attackers deliver hex-encoded malicious .class payloads into the PaperCut server/lib path (observed examples include Udydn.class and Moo97.class) so arbitrary bytecode executes inside the PaperCut JVM / Application Server process.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/08/28"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/08/28"

[rule]
author = ["Elastic"]
description = """
Detects creation of Java .class files within the PaperCut NG/MF Application Server library directory. During active
exploitation of CVE-2026-82078 (chained with CVE-2026-81578), attackers deliver hex-encoded malicious .class payloads
into the PaperCut server/lib path (observed examples include Udydn.class and Moo97.class) so arbitrary bytecode executes
inside the PaperCut JVM / Application Server process.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Java Class File Created in PaperCut Server Library"
note = """## Triage and analysis

### Investigating Suspicious Java Class File Created in PaperCut Server Library

PaperCut NG/MF loads database/driver-related classes from the Application Server classpath. CVE-2026-82078 allows unsafe
dynamic class loading when configuration can be manipulated (enabled by CVE-2026-81578 authentication bypass). Huntress
recovered attacker `.class` files written under `server\\lib` (for example `Udydn.class`, `Moo97.class`) that decoded
commands, wrote output under `server\\data\\content`, then deleted staging files and often `server.log`.

#### Possible investigation steps

- Inspect `file.path`, `file.name`, `file.size`, and writing `process.executable`/`process.name`. Unexpected short or
  random `.class` names under `server/lib` are high confidence.
- On the same host, look for companion artifacts under `server/data/content` (`.cmd`, `.out`) and for suspicious
  `pc-app.exe` / Java child processes (shells, `whoami`, `tasklist`, `charmap.exe`).
- Review PaperCut `server/logs` for hex-encoded blobs, base64 command strings, `jdbc:derby:memory:pwn`, Derby boot paths
  containing `\\pwn`, or `ERROR No suitable driver found for jdbc:no:x`. Note missing/truncated `server.log` files.
- Confirm whether a PaperCut upgrade or emergency patch was running at `@timestamp`; legitimate upgrades also write
  many `.class` files under `server/lib`.
- Scope other PaperCut servers for the same file names/paths and review internet exposure of the management interface.

### False positive analysis

- PaperCut installation, upgrade, and emergency patch operations legitimately create `.class` files under `server/lib`.
  Correlate with change tickets, installer process names, and volume of writes before treating as malicious.
- Exclude only tightly scoped upgrade processes/paths after validation; do not blanket-exclude the `server/lib` directory.

### Response and remediation

- Restrict public access to the PaperCut Application Server immediately.
- Preserve `server/lib` `.class` files, `server/logs`, `server/data/content`, and process telemetry before cleanup or patch.
- Remove unauthorized `.class` payloads after evidence collection; apply PaperCut Emergency Patch Release 2 (or newer).
- Hunt for related child-process activity from `pc-app.exe` and rotate credentials if exploitation is confirmed.
"""

setup = """## Setup

This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.

Setup instructions: https://ela.st/install-elastic-defend
"""

references = [
    "https://www.papercut.com/kb/Main/security-bulletin-27-aug-2026-urgent-security-advisory/",
    "https://www.huntress.com/blog/papercut-actively-exploited",
]
risk_score = 99
rule_id = "a2d4508e-e9c2-41f6-9466-0c3aed8cc2c9"
severity = "critical"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "OS: Linux",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Use Case: Vulnerability",
    "Tactic: Initial Access",
    "Tactic: Execution",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type in ("windows", "linux", "macos") and
  event.action in ("creation", "overwrite") and
  file.extension : "class" and
  file.path : (
    "?:\\Program Files\\PaperCut*\\server\\lib\\*",
    "?:\\Program Files (x86)\\PaperCut*\\server\\lib\\*",
    "/opt/papercut/server/lib/*",
    "/usr/local/papercut/server/lib/*",
    "/Applications/PaperCut*/server/lib/*"
  )
'''

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "host.id",
    "host.name",
    "host.os.type",
    "user.id",
    "user.name",
    "process.name",
    "process.executable",
    "file.path",
    "file.name",
    "file.size",
]

[[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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1620"
name = "Reflective Code Loading"
reference = "https://attack.mitre.org/techniques/T1620/"

[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Stages and Predicates

Stage 1: file

file where host.os.type in ("windows", "linux", "macos") and
  event.action in ("creation", "overwrite") and
  file.extension : "class" and
  file.path : (
    "?:\\Program Files\\PaperCut*\\server\\lib\\*",
    "?:\\Program Files (x86)\\PaperCut*\\server\\lib\\*",
    "/opt/papercut/server/lib/*",
    "/usr/local/papercut/server/lib/*",
    "/Applications/PaperCut*/server/lib/*"
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • creation corpus 32 (elastic 32)
  • overwrite corpus 8 (elastic 8)
field:"EventType" kind:in
file.extensionwildcard
  • class corpus 2 (elastic 2)
field:"file.extension" kind:wildcard value:"class"
file.pathwildcard
  • /Applications/PaperCut*/server/lib/*
  • /opt/papercut/server/lib/*
  • /usr/local/papercut/server/lib/*
  • ?:\Program Files (x86)\PaperCut*\server\lib\*
  • ?:\Program Files\PaperCut*\server\lib\*
field:"TargetFilename" kind:wildcard

Suspicious JavaScript Execution via Deno

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to execute JavaScript using Deno with suspicious command line value. Adversaries may abuse this utility to execute malicious JavaScript.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies attempts to execute JavaScript using Deno with suspicious command line value. Adversaries may abuse this
utility to execute malicious JavaScript.
"""
id = "ff18d24b-2ba6-4691-a17f-75c4380d0965"
license = "Elastic License v2"
name = "Suspicious JavaScript Execution via Deno"
os_list = ["windows"]
reference = ["https://deno.com/"]
version = "1.0.1"

query = '''
process where event.action== "start" and
 (process.name : "deno.exe" or process.pe.original_file_name == "deno.exe" or process.code_signature.subject_name == "Deno Land Inc.") and
  process.command_line : ("*javascript*base64*", "*eval(*", "*http*", "*javascript*import*")
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[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.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action== "start" and
 (process.name : "deno.exe" or process.pe.original_file_name == "deno.exe" or process.code_signature.subject_name == "Deno Land Inc.") and
  process.command_line : ("*javascript*base64*", "*eval(*", "*http*", "*javascript*import*")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.code_signature.subject_nameeq
  • Deno Land Inc. corpus 2 (elastic 2)
field:"Signature" kind:eq value:"Deno Land Inc."
process.command_linewildcard
  • *eval(* corpus 6 (elastic 6)
  • *http* corpus 5 (elastic 5)
  • *javascript*base64* corpus 2 (elastic 2)
  • *javascript*import* corpus 3 (elastic 3)
field:"CommandLine" kind:wildcard
process.namewildcard
  • deno.exe corpus 3 (elastic 3)
field:"process_basename" kind:wildcard value:"deno.exe"
process.pe.original_file_nameeq
  • deno.exe corpus 2 (elastic 2)
field:"OriginalFileName" kind:eq value:"deno.exe"

Suspicious Kernel32 Memory Protection

#
Source
github.com/elastic/protections-artifacts

Detects multiple Windows Memory API calls to modify the protection of the same memory address from Kernel32 module and in a short time window.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Detects multiple Windows Memory API calls to modify the protection of the same memory address from Kernel32 module and
in a short time window.
"""
id = "c53dfced-feba-4527-bb8a-f181bcac59bc"
license = "Elastic License v2"
name = "Suspicious Kernel32 Memory Protection"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.8"

query = '''
api where process.Ext.api.name : "VirtualProtect" and process.executable != null and 
  process.Ext.api.summary : "*kernel32.dll*" and process.Ext.api.behaviors : "write_fluctuation" and 
  process.Ext.api.parameters.size == 16 and 
  process.thread.Ext.call_stack_final_user_module.name != null and not process.thread.Ext.call_stack_final_user_module.name : "Kernel" and
  not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("91bade6d0e01a3b0abe7f98f97e4eff2a04dbaa475c4a90e3ee97024f488606d", "ca4459a331c7dbb8440fa7eb3f0a2636b4685b762d94f16e2452a627faf9197b") and
  not process.thread.Ext.call_stack_final_user_module.path :
                                         ("?:\\Program Files\\*",
                                          "?:\\Program Files (x86)\\*", 
                                          "\\program files\\*", 
                                          "\\program files (x86)\\*",
                                          "?:\\windows\\microsoft.net\\framework*.dll", 
                                          "\\windows\\microsoft.net\\framework*.dll", 
                                          "?:\\programdata\\dell\\drivers\\*\\installer.exe", 
                                          "?:\\windows\\system32\\driverstore\\filerepository\\*", 
                                          "\\windows\\system32\\driverstore\\filerepository\\*", 
                                          "?:\\windows\\winsxs\\*", 
                                          "\\windows\\winsxs\\*", 
                                          "?:\\windows\\system32\\atiumd64.dll", 
                                          "\\windows\\system32\\atiumd64.dll")
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
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 : "VirtualProtect" and process.executable != null and 
  process.Ext.api.summary : "*kernel32.dll*" and process.Ext.api.behaviors : "write_fluctuation" and 
  process.Ext.api.parameters.size == 16 and 
  process.thread.Ext.call_stack_final_user_module.name != null and not process.thread.Ext.call_stack_final_user_module.name : "Kernel" and
  not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("91bade6d0e01a3b0abe7f98f97e4eff2a04dbaa475c4a90e3ee97024f488606d", "ca4459a331c7dbb8440fa7eb3f0a2636b4685b762d94f16e2452a627faf9197b") and
  not process.thread.Ext.call_stack_final_user_module.path :
                                         ("?:\\Program Files\\*",
                                          "?:\\Program Files (x86)\\*", 
                                          "\\program files\\*", 
                                          "\\program files (x86)\\*",
                                          "?:\\windows\\microsoft.net\\framework*.dll", 
                                          "\\windows\\microsoft.net\\framework*.dll", 
                                          "?:\\programdata\\dell\\drivers\\*\\installer.exe", 
                                          "?:\\windows\\system32\\driverstore\\filerepository\\*", 
                                          "\\windows\\system32\\driverstore\\filerepository\\*", 
                                          "?:\\windows\\winsxs\\*", 
                                          "\\windows\\winsxs\\*", 
                                          "?:\\windows\\system32\\atiumd64.dll", 
                                          "\\windows\\system32\\atiumd64.dll")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stack_final_user_module.hash.sha256in91bade6d0e01a3b0abe7f98f97e4eff2a04dbaa475c4a90e3ee97024f488606d, ca4459a331c7dbb8440fa7eb3f0a2636b4685b762d94f16e2452a627faf9197bexcludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" value:"91bade6d0e01a3b0abe7f98f97e4eff2a04dbaa475c4a90e3ee97024f488606d" field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" value:"ca4459a331c7dbb8440fa7eb3f0a2636b4685b762d94f16e2452a627faf9197b"
process.thread.Ext.call_stack_final_user_module.nameeqKernelexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel"
process.thread.Ext.call_stack_final_user_module.pathwildcard?:\Program Files\*, ?:\Program Files (x86)\*, \program files\*, \program files (x86)\*, ?:\windows\microsoft.net\framework*.dll, \windows\microsoft.net\framework*.dll, ?:\programdata\dell\drivers\*\installer.exe, ?:\windows\system32\driverstore\filerepository\*, \windows\system32\driverstore\filerepository\*, ?:\windows\winsxs\*, \windows\winsxs\*, ?:\windows\system32\atiumd64.dll, \windows\system32\atiumd64.dllexcludes:process.thread.Ext.call_stack_final_user_module.path

Suspicious Microsoft IIS Worker Descendant

#
Source
github.com/elastic/protections-artifacts

Identifies suspicious child processes of Microsoft IIS Worker process which may suggest a vulnerability and remote webshell access.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies suspicious child processes of Microsoft IIS Worker process which may suggest a vulnerability and remote
webshell access.
"""
id = "89c9c5a0-a136-41e9-8cc8-f21ef5ad894b"
license = "Elastic License v2"
name = "Suspicious Microsoft IIS Worker Descendant"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry",
]
version = "1.0.36"

query = '''
process where event.action == "start" and
(
  (
    process.parent.name : "w3wp.exe" and
    (
      (process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE") and
        (process.command_line : ("*/c powershell*", "*&cd&echo*", "*certutil*", "*bitsadmin*", "*/c cd /d *",
                                "*http*", "*.replace*", "*Reflection.Assembly*", "*$*$*$*$*$*", "*^*^*^*^*^*^*",
                                "*set *set *set *", "* wget*") or
        process.args : ("?:\\Users\\Public\\*", "?:\\Windows\\Tasks\\*", "?:\\Windows\\Temp\\*", "?:\\windows\\help\\*"))) or

      (process.pe.original_file_name == "PowerShell.EXE" and length(process.parent.command_line) >= 150 and
        process.parent.command_line : ("* -enc*", "* -e *", "* bypass*")) or

      (process.parent.args : ("MSExchange*", "SharePoint*") and
        process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE", "CertUtil.exe", "CertReq.exe", "curl.exe", "RUNDLL32.EXE", "REGSVR32.EXE")) or

      (process.pe.original_file_name == "Cmd.Exe" and process.args_count ==1)
    )
  ) or

  (descendant of [process where process.name : "w3wp.exe"] and
  (
    (process.name : ("net.exe", "net1.exe") and process.command_line : ("*administrators*", "*remote desktop*", "*use \\* /user*")) or
    (process.pe.original_file_name in ("CertUtil.exe", "CertReq.exe", "curl.exe", "bitsadmin.exe"))
   )
  ) or

  (descendant of [process where process.parent.name : "w3wp.exe" and
    process.pe.original_file_name == "Cmd.Exe" and process.command_line : ("*/c powershell*", "*&cd&echo*")]
  )
)
/* False Positives */
and not (process.name : "cmd.exe" and process.parent.args : "Icims" and process.command_line : "*vault.azure.net*" and process.parent.name : "w3wp.exe") and
not (process.name : "powershell.exe" and process.command_line : "\"powershell.exe\" netsh http show servicestate | ?{$_.Tostring().Contains(*") and
process.hash.sha256 != "fe1d2ad2781879dc05039d87bd12259f3bcf411c66c925d31827d6a757d33ec4" and
not (process.name : "cmd.exe" and process.parent.name:"w3wp.exe" and
     process.args:"'HttpsPortDesktopAgent'),"  and process.args : "echo" and process.parent.args : "DefaultAppPool") and
not (process.name == "conhost.exe" and process.parent.name == "cmd.exe") and
not (process.name : "curl.exe" and process.args : "https*.lansweeper.com" and process.parent.name : "w3wp.exe" and process.parent.args : "Lansweeper AppPool")
'''

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 = "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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"

[[threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
(
  (
    process.parent.name : "w3wp.exe" and
    (
      (process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE") and
        (process.command_line : ("*/c powershell*", "*&cd&echo*", "*certutil*", "*bitsadmin*", "*/c cd /d *",
                                "*http*", "*.replace*", "*Reflection.Assembly*", "*$*$*$*$*$*", "*^*^*^*^*^*^*",
                                "*set *set *set *", "* wget*") or
        process.args : ("?:\\Users\\Public\\*", "?:\\Windows\\Tasks\\*", "?:\\Windows\\Temp\\*", "?:\\windows\\help\\*"))) or
      (process.pe.original_file_name == "PowerShell.EXE" and length(process.parent.command_line) >= 150 and
        process.parent.command_line : ("* -enc*", "* -e *", "* bypass*")) or
      (process.parent.args : ("MSExchange*", "SharePoint*") and
        process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE", "CertUtil.exe", "CertReq.exe", "curl.exe", "RUNDLL32.EXE", "REGSVR32.EXE")) or
      (process.pe.original_file_name == "Cmd.Exe" and process.args_count ==1)
    )
  ) or
  (descendant of [process where process.name : "w3wp.exe"] and
  (
    (process.name : ("net.exe", "net1.exe") and process.command_line : ("*administrators*", "*remote desktop*", "*use \\* /user*")) or
    (process.pe.original_file_name in ("CertUtil.exe", "CertReq.exe", "curl.exe", "bitsadmin.exe"))
   )
  ) or
  (descendant of [process where process.parent.name : "w3wp.exe" and
    process.pe.original_file_name == "Cmd.Exe" and process.command_line : ("*/c powershell*", "*&cd&echo*")]
  )
)
and not (process.name : "cmd.exe" and process.parent.args : "Icims" and process.command_line : "*vault.azure.net*" and process.parent.name : "w3wp.exe") and
not (process.name : "powershell.exe" and process.command_line : "\"powershell.exe\" netsh http show servicestate | ?{$_.Tostring().Contains(*") and
process.hash.sha256 != "fe1d2ad2781879dc05039d87bd12259f3bcf411c66c925d31827d6a757d33ec4" and
not (process.name : "cmd.exe" and process.parent.name:"w3wp.exe" and
     process.args:"'HttpsPortDesktopAgent'),"  and process.args : "echo" and process.parent.args : "DefaultAppPool") and
not (process.name == "conhost.exe" and process.parent.name == "cmd.exe") and
not (process.name : "curl.exe" and process.args : "https*.lansweeper.com" and process.parent.name : "w3wp.exe" and process.parent.args : "Lansweeper AppPool")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.argswildcard
  • ?:\Users\Public\*
  • ?:\Windows\Tasks\*
  • ?:\Windows\Temp\*
  • ?:\windows\help\*
field:"process.args" kind:wildcard
process.args_counteq
  • 1 transforms: number corpus 50 (elastic 50)
field:"process.args_count" kind:eq value:"1"
process.command_linewildcard
  • * wget*
  • *$*$*$*$*$*
  • *&cd&echo*
  • *.replace* corpus 4 (elastic 4)
  • */c cd /d *
  • */c powershell*
  • *Reflection.Assembly* corpus 8 (elastic 8)
  • *^*^*^*^*^*^*
  • *administrators*
  • *bitsadmin* corpus 2 (elastic 2)
  • *certutil* corpus 2 (elastic 2)
  • *http* corpus 5 (elastic 5)
  • *remote desktop*
  • *set *set *set * corpus 4 (elastic 4)
  • *use \* /user*
field:"CommandLine" kind:wildcard
process.hash.sha256ne
  • fe1d2ad2781879dc05039d87bd12259f3bcf411c66c925d31827d6a757d33ec4
field:"Hashes" kind:ne value:"fe1d2ad2781879dc05039d87bd12259f3bcf411c66c925d31827d6a757d33ec4"
process.namewildcard
  • net.exe corpus 30 (elastic 27, splunk 2, kusto 1)
  • net1.exe corpus 40 (elastic 21, splunk 19)
field:"process_basename" kind:wildcard
process.parent.argswildcard
  • MSExchange*
  • SharePoint*
field:"process.parent.args" kind:wildcard
process.parent.command_linewildcard
  • * -e *
  • * -enc*
  • * bypass*
field:"ParentCommandLine" kind:wildcard
process.parent.namewildcard
  • w3wp.exe corpus 8 (elastic 8)
field:"parent_process_basename" kind:wildcard value:"w3wp.exe"
process.pe.original_file_nameeq
  • Cmd.Exe corpus 7 (elastic 7)
  • PowerShell.EXE corpus 7 (elastic 7)
field:"OriginalFileName" kind:eq
process.pe.original_file_namein
  • CertReq.exe corpus 3 (elastic 3)
  • CertUtil.exe corpus 4 (elastic 4)
  • Cmd.Exe corpus 12 (elastic 12)
  • PowerShell.EXE corpus 19 (elastic 19)
  • REGSVR32.EXE corpus 7 (elastic 7)
  • RUNDLL32.EXE corpus 8 (elastic 8)
  • bitsadmin.exe corpus 3 (elastic 3)
  • curl.exe corpus 3 (elastic 3)
field:"OriginalFileName" kind:in

Exclusions

The rule actively suppresses these predicates.

Tainted Kernel Module Load

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule monitors the syslog log file for messages related to instances of a tainted kernel module load. Rootkits often leverage kernel modules as their main defense evasion technique. Detecting tainted kernel module loads is crucial for ensuring system security and integrity, as malicious or unauthorized modules can compromise the kernel and lead to system vulnerabilities or unauthorized access.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/10/23"
integration = ["system"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
This rule monitors the syslog log file for messages related to instances of a tainted kernel module load. Rootkits often
leverage kernel modules as their main defense evasion technique. Detecting tainted kernel module loads is crucial for
ensuring system security and integrity, as malicious or unauthorized modules can compromise the kernel and lead to
system vulnerabilities or unauthorized access.
"""
from = "now-9m"
index = ["logs-system.syslog-*"]
language = "kuery"
license = "Elastic License v2"
name = "Tainted Kernel Module Load"
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 Tainted Kernel Module Load

Kernel modules extend the functionality of the Linux kernel, allowing dynamic loading of code. While beneficial, they can be exploited by adversaries to introduce malicious code, bypassing security measures. Attackers may load unsigned or improperly signed modules, leading to a "tainted" kernel state. The detection rule identifies such events by monitoring syslog for specific error messages, signaling potential unauthorized module loads, thus aiding in early threat detection and system integrity maintenance.

### Possible investigation steps

- Review the syslog entries around the time of the alert to gather additional context and identify any other suspicious activities or related events.
- Investigate the specific kernel module mentioned in the syslog message to determine its origin, legitimacy, and whether it is expected on the system.
- Check the system for any recent changes or installations that could have introduced the unsigned or improperly signed module, including software updates or new applications.
- Analyze the system for signs of compromise, such as unexpected network connections, unusual process activity, or unauthorized user accounts, which may indicate a broader security incident.
- Consult with system administrators or relevant personnel to verify if the module load was authorized or part of a legitimate operation, and document any findings or justifications provided.

### False positive analysis

- Custom kernel modules: Organizations often use custom or proprietary kernel modules that may not be signed. These can trigger false positives. To manage this, maintain a list of known, trusted custom modules and create exceptions for them in the monitoring system.
- Outdated or unsupported hardware drivers: Some older hardware drivers may not have signed modules, leading to false positives. Regularly update drivers and, if necessary, exclude specific drivers that are known to be safe but unsigned.
- Development and testing environments: In environments where kernel module development occurs, unsigned modules may be loaded frequently. Implement separate monitoring rules or exceptions for these environments to avoid unnecessary alerts.
- Vendor-provided modules: Certain vendors may provide modules that are not signed. Verify the legitimacy of these modules with the vendor and consider excluding them if they are confirmed to be safe.
- Temporary testing modules: During troubleshooting or testing, temporary modules might be loaded without proper signing. Ensure these are removed after testing and consider temporary exceptions during the testing phase.

### Response and remediation

- Immediately isolate the affected system from the network to prevent potential lateral movement by the attacker.
- Verify the integrity of the kernel and loaded modules by comparing them against known good versions or using a trusted baseline.
- Unload the suspicious kernel module if possible, and replace it with a verified, signed version to restore system integrity.
- Conduct a thorough forensic analysis of the affected system to identify any additional signs of compromise or persistence mechanisms.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if other systems are affected.
- Implement enhanced monitoring and logging for kernel module loads and other critical system activities to detect similar threats in the future.
- Review and update system and network access controls to ensure only authorized personnel can load kernel modules, reducing the risk of unauthorized changes."""
risk_score = 47
rule_id = "05cad2fb-200c-407f-b472-02ea8c9e5e4a"
setup = """## Setup

This rule requires data coming in from one of the following integrations:
- Filebeat

### Filebeat Setup
Filebeat is a lightweight shipper for forwarding and centralizing log data. Installed as an agent on your servers, Filebeat monitors the log files or locations that you specify, collects log events, and forwards them either to Elasticsearch or Logstash for indexing.

#### The following steps should be executed in order to add the Filebeat for the Linux System:
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setup-repositories.html).
- To run Filebeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html).
- To run Filebeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-kubernetes.html).
- For quick start information for Filebeat refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/8.11/filebeat-installation-configuration.html).
- For complete Setup and Run Filebeat information refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setting-up-and-running.html).

#### Rule Specific Setup Note
- This rule requires the Filebeat System Module to be enabled.
- The system module collects and parses logs created by the system logging service of common Unix/Linux based distributions.
- To run the system module of Filebeat on Linux follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-system.html).
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
host.os.type:linux and data_stream.dataset:"system.syslog" and process.name:kernel and
message:"module verification failed: signature and/or required key missing - tainting kernel"
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"

[[rule.threat.technique.subtechnique]]
id = "T1547.006"
name = "Kernel Modules and Extensions"
reference = "https://attack.mitre.org/techniques/T1547/006/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1014"
name = "Rootkit"
reference = "https://attack.mitre.org/techniques/T1014/"

[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 = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"

[[rule.threat.technique.subtechnique]]
id = "T1547.006"
name = "Kernel Modules and Extensions"
reference = "https://attack.mitre.org/techniques/T1547/006/"

[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

Stages and Predicates

Stage 1: query

host.os.type:linux and data_stream.dataset:"system.syslog" and process.name:kernel and
message:"module verification failed: signature and/or required key missing - tainting kernel"

Indicators

These rows show field, operator, and value matches.

Tclsh Execution followed by immediate Network Connection

#
Time window
15s
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Detects the execution of the tclsh binary followed by an immediate network connection by tclsh linked by the process.entity_id value. Tclsh is a shell-like application that reads Tcl commands from its standard input or from a file and evaluates them. Tcl is a high-level programming language. It is still a default installation as of macOS 12 Monterey, making it an ideal candidate for payload execution.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Detects the execution of the tclsh binary followed by an immediate network connection by tclsh linked by the
process.entity_id value. Tclsh is a shell-like application that reads Tcl commands from its standard input or from a
file and evaluates them. Tcl is a high-level programming language. It is still a default installation as of macOS 12
Monterey, making it an ideal candidate for payload execution.
"""
id = "ac1eaed8-2aee-48d7-9824-2be1f00eda0e"
license = "Elastic License v2"
name = "Tclsh Execution followed by immediate Network Connection"
os_list = ["macos"]
reference = ["https://posts.specterops.io/dylib-loads-that-tickle-your-fancy-d25196addd8c"]
version = "1.0.21"

query = '''
sequence by process.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and process.name like~ "tclsh*" and
  not process.parent.executable like "/usr/bin/sudo"]
[network where event.type == "start" and process.name like~ "tclsh*"]
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 15s, correlated by process.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and process.name like~ "tclsh*" and
  not process.parent.executable like "/usr/bin/sudo"]

Stage 2: network

[network where event.type == "start" and process.name like~ "tclsh*"]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.namewildcard
  • tclsh* corpus 2 (elastic 2)
field:"process_basename" kind:wildcard value:"tclsh*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.executableeq/usr/bin/sudoexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/sudo"

Threat Intel URL Indicator Match

#
Status
production
Severity
high
Group by
threat.indicator.url.full, threat.indicator.url.original, url.full, url.original
Author
Elastic
Source
github.com/elastic/detection-rules

This rule is triggered when a URL indicator from the Threat Intel Filebeat module or integrations has a match against an event that contains URL data, like DNS events, network logs, etc.

Rule Body

[metadata]
creation_date = "2023/05/22"
maturity = "production"
updated_date = "2025/04/22"

[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 = """
This rule is triggered when a URL indicator from the Threat Intel Filebeat module or integrations has a match against an
event that contains URL data, like DNS events, network logs, etc.
"""
from = "now-65m"
index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "packetbeat-*", "winlogbeat-*"]
interval = "1h"
language = "kuery"
license = "Elastic License v2"
name = "Threat Intel URL Indicator Match"
note = """## Triage and analysis

### Investigating Threat Intel URL Indicator Match

Threat Intel indicator match rules allow matching from a local observation, such as an endpoint event that records a file hash with an entry of a file hash stored within the Threat Intel integrations index.

Matches are based on threat intelligence data that's been ingested during the last 30 days. Some integrations don't place expiration dates on their threat indicators, so we strongly recommend validating ingested threat indicators and reviewing match results. When reviewing match results, check associated activity to determine whether the event requires additional investigation.

This rule is triggered when a URL indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against an event that contains URL data, like DNS events, network logs, etc.

> **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 URL, which can be found in the `threat.indicator.matched.atomic` field:
  - Identify the type of malicious activity related to the URL (phishing, malware, etc.).
  - Check the reputation of the IP address in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
  - Execute a WHOIS lookup to retrieve information about the domain registration and contacts to report abuse.
  - If dealing with a phishing incident:
    - Contact the user to gain more information around the delivery method, information sent, etc.
    - Analyze whether the URL is trying to impersonate a legitimate address. Look for typosquatting, extra or unusual subdomains, or other anomalies that could lure the user.
    - Investigate the phishing page to identify which information may have been sent to the attacker by the user.
- Identify the process responsible for the connection, and 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.
- Retrieve the involved process executable and examine the host for derived artifacts that indicate suspicious activities:
  - Analyze the process executable using a private sandboxed analysis system.
  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
    - Attempts to contact external domains and addresses.
      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
      - Examine the DNS cache for suspicious or anomalous entries.
        - $osquery_0
    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
    - Examine the host services for suspicious or anomalous entries.
      - $osquery_1
      - $osquery_2
      - $osquery_3
- Using the data collected through the analysis, scope users targeted and other machines infected in the environment.

### False Positive Analysis

- False positives might occur after large and publicly written campaigns if curious employees interact with attacker infrastructure.
- Some feeds may include internal or known benign addresses by mistake (e.g., 8.8.8.8, google.com, 127.0.0.1, etc.). Make sure you understand how blocking a specific domain or address might impact the organization or normal system functioning.

### 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.
- Consider reporting the address for abuse using the provided contact information.
- 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).
"""
references = [
    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
    "https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html",
    "https://www.elastic.co/security/tip",
]
risk_score = 73
rule_id = "f3e22c8b-ea47-45d1-b502-b57b6de950b3"
setup = """## Setup

This rule needs threat intelligence indicators to work.
Threat intelligence indicators can be collected using an [Elastic Agent integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#agent-ti-integration),
the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).

More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).
"""
severity = "high"
tags = ["OS: Windows", "Data Source: Elastic Endgame", "Rule Type: Threat Match", "Resources: Investigation Guide"]
threat_index = ["filebeat-*", "logs-ti_*"]
threat_indicator_path = "threat.indicator"
threat_language = "kuery"
threat_query = """
@timestamp >= "now-30d/d" and event.module:(threatintel or ti_*) and threat.indicator.url.full:* and not
labels.is_ioc_transform_source:"true"
"""
timeline_id = "495ad7a7-316e-4544-8a0f-9c098daee76e"
timeline_title = "Generic Threat Match Timeline"
timestamp_override = "event.ingested"
type = "threat_match"

query = '''
url.full:*
'''


[[rule.threat_filters]]

[rule.threat_filters."$state"]
store = "appState"
[rule.threat_filters.meta]
disabled = false
key = "event.category"
negate = false
type = "phrase"
[rule.threat_filters.meta.params]
query = "threat"
[rule.threat_filters.query.match_phrase]
"event.category" = "threat"
[[rule.threat_filters]]

[rule.threat_filters."$state"]
store = "appState"
[rule.threat_filters.meta]
disabled = false
key = "event.kind"
negate = false
type = "phrase"
[rule.threat_filters.meta.params]
query = "enrichment"
[rule.threat_filters.query.match_phrase]
"event.kind" = "enrichment"
[[rule.threat_filters]]

[rule.threat_filters."$state"]
store = "appState"
[rule.threat_filters.meta]
disabled = false
key = "event.type"
negate = false
type = "phrase"
[rule.threat_filters.meta.params]
query = "indicator"
[rule.threat_filters.query.match_phrase]
"event.type" = "indicator"
[[rule.threat_mapping]]

[[rule.threat_mapping.entries]]
field = "url.full"
type = "mapping"
value = "threat.indicator.url.full"

[[rule.threat_mapping]]

[[rule.threat_mapping.entries]]
field = "url.original"
type = "mapping"
value = "threat.indicator.url.original"


Stages and Predicates

Stage 1: threat_match:event

url.full:*

Stage 2: threat_match:indicator

(event.module:"threatintel" or event.module:ti_*) and not labels.is_ioc_transform_source:true and @timestamp >= "now-30d/d" and threat.indicator.url.full:*

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
labels.is_ioc_transform_sourceeqtrueexcludes:labels.is_ioc_transform_source field:"labels.is_ioc_transform_source" value:"true"

Unusual Windows Remote User

#
Status
production
Severity
low
Author
Elastic
Source
github.com/elastic/detection-rules

A machine learning job detected an unusual remote desktop protocol (RDP) username, which can indicate account takeover or credentialed persistence using compromised accounts. RDP attacks, such as BlueKeep, also tend to use unusual usernames.

Known False Positives

  • Uncommon username activity can be due to an engineer logging onto a server instance in order to perform manual troubleshooting or reconfiguration.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2020/03/25"
integration = ["windows"]
maturity = "production"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
updated_date = "2026/07/27"

[rule]
anomaly_threshold = 50
author = ["Elastic"]
description = """
A machine learning job detected an unusual remote desktop protocol (RDP) username, which can indicate account takeover
or credentialed persistence using compromised accounts. RDP attacks, such as BlueKeep, also tend to use unusual
usernames.
"""
false_positives = [
    """
    Uncommon username activity can be due to an engineer logging onto a server instance in order to perform manual
    troubleshooting or reconfiguration.
    """,
]
from = "now-45m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = ["v3_windows_rare_user_type10_remote_login_ea"]
name = "Unusual Windows Remote User"
note = """## Triage and analysis

### Investigating Unusual Windows Remote User
Detection alerts from this rule indicate activity for a rare and unusual Windows RDP (remote desktop) user. Here are some possible avenues of investigation:
- Consider the user as identified by the username field. Is the user part of a group who normally logs into Windows hosts using RDP (remote desktop protocol)? Is this logon activity part of an expected workflow for the user?
- Consider the source of the login. If the source is remote, could this be related to occasional troubleshooting or support activity by a vendor or an employee working remotely?"""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "1781d055-5c66-4adf-9e93-fc0fa69550c9"
setup = """## Setup

This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
- Windows

### Anomaly Detection Setup

Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).

### Windows Integration Setup
The Windows integration allows you to monitor the Windows OS, services, applications, and more.

#### The following steps should be executed in order to add the Elastic Agent System integration "windows" to your system:
- Go to the Kibana home page and click “Add integrations”.
- In the query bar, search for “Windows” and select the integration to see more details about it.
- Click “Add Windows”.
- Configure the integration name and optionally add a description.
- Review optional and advanced settings accordingly.
- Add the newly installed “windows” to an existing or a new agent policy, and deploy the agent on your system from which windows log files are desirable.
- Click “Save and Continue”.
- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/windows).
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Data Source: Windows Security Event Logs",
    "Use Case: Threat Detection",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Tactic: Initial Access",
    "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.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"

[[rule.threat.technique.subtechnique]]
id = "T1021.001"
name = "Remote Desktop Protocol"
reference = "https://attack.mitre.org/techniques/T1021/001/"

[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

Back to all Elastic rules