Detection rules › Elastic

Potential Ransomware Behavior - Note Files by System

Status
production
Severity
medium
Time window
9m
Group by
Esql.time_window_date_trunc, file.name, host.id, host.name, process.entity_id, user.id, user.name
Author
Elastic
Source
github.com/elastic/detection-rules

This rule identifies the creation of multiple files with same name and over SMB by the same user. This behavior may indicate the successful remote execution of a ransomware dropping file notes to different folders.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 11FileCreate

Rule body elastic

[metadata]
creation_date = "2024/05/03"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/04"

[rule]
author = ["Elastic"]
description = """
This rule identifies the creation of multiple files with same name and over SMB by the same user. This behavior may indicate the 
successful remote execution of a ransomware dropping file notes to different folders.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Potential Ransomware Behavior - Note Files by System"
note = """## Triage and analysis

#### Possible investigation steps

- Investigate the content of the dropped files.
- Investigate any file names with unusual extensions.
- Investigate any incoming network connection to port 445 on this host.
- Investigate any network logon events to this host.
- Identify the total number and type of modified files by pid 4.
- If the number of files is too high and source.ip connecting over SMB is unusual isolate the host and block the used credentials.
- Investigate other alerts associated with the user/host during the past 48 hours.

### False positive analysis

- Local file modification from a Kernel mode driver.

### Related rules

- Third-party Backup Files Deleted via Unexpected Process - 11ea6bec-ebde-4d71-a8e9-784948f8e3e9
- Volume Shadow Copy Deleted or Resized via VssAdmin - b5ea4bfe-a1b2-421f-9d47-22a75a6f2921
- Volume Shadow Copy Deletion via PowerShell - d99a037b-c8e2-47a5-97b9-170d076827c4
- Volume Shadow Copy Deletion via WMIC - dc9c1f74-dac3-48e3-b47f-eb79db358f57
- Potential Ransomware Note File Dropped via SMB - 02bab13d-fb14-4d7c-b6fe-4a28874d37c5
- Suspicious File Renamed via SMB - 78e9b5d5-7c07-40a7-a591-3dbbf464c386

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Consider isolating the involved host to prevent destructive behavior, which is commonly associated with this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- If any other destructive action was identified on the host, it is recommended to prioritize the investigation and look for ransomware preparation and execution activities.
- If any backups were affected:
  - Perform data recovery locally or restore the backups from replicated copies (cloud, other servers, etc.).
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

setup = """## Setup

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

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

references = ["https://news.sophos.com/en-us/2023/12/21/akira-again-the-ransomware-that-keeps-on-taking/"]
risk_score = 47
rule_id = "1397e1b9-0c90-4d24-8d7b-80598eb9bc9a"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Impact",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend"
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-endpoint.events.file-* metadata _id, _version, _index

// filter for file creation event done remotely over SMB with common user readable file types used to place ransomware notes
| where event.category == "file" and host.os.type == "windows" and event.action == "creation" and process.pid == 4 and user.id != "S-1-5-18" and 
  file.extension in ("txt", "htm", "html", "hta", "pdf", "jpg", "bmp", "png") and
  to_lower(file.path) like """c:\\*""" and not to_lower(file.path) like """c:\\temp\\*"""

// truncate the timestamp to a 60-second window
| eval Esql.time_window_date_trunc = date_trunc(60 seconds, @timestamp)

| keep user.id, user.name, file.path, file.name, process.entity_id, Esql.time_window_date_trunc, host.name, host.ip, host.id

// filter for same file name dropped in at least 3 unique paths by the System virtual process
| stats Esql.file_path_count_distinct = COUNT_DISTINCT(file.path),  Esql.file_path_values = VALUES(file.path), Esql.host_ip_values = values(host.ip) by host.id, host.name, user.name, user.id, process.entity_id , file.name, Esql.time_window_date_trunc
| where Esql.file_path_count_distinct >= 3
'''


[[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.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.technique]]
id = "T1570"
name = "Lateral Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1570/"

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

Stages and Predicates

Stage 1: from

from logs-endpoint.events.file-* metadata _id, _version, _index

Stage 2: where

| where event.category == "file" and host.os.type == "windows" and event.action == "creation" and process.pid == 4 and user.id != "S-1-5-18" and
  file.extension in ("txt", "htm", "html", "hta", "pdf", "jpg", "bmp", "png") and
  to_lower(file.path) like """c:\\*""" and not to_lower(file.path) like """c:\\temp\\*"""

Stage 3: eval

| eval Esql.time_window_date_trunc = date_trunc(60 seconds, @timestamp)

Stage 4: keep

| keep user.id, user.name, file.path, file.name, process.entity_id, Esql.time_window_date_trunc, host.name, host.ip, host.id

Stage 5: stats

| stats Esql.file_path_count_distinct = COUNT_DISTINCT(file.path),  Esql.file_path_values = VALUES(file.path), Esql.host_ip_values = values(host.ip) by host.id, host.name, user.name, user.id, process.entity_id , file.name, Esql.time_window_date_trunc

Stage 6: where

| where Esql.file_path_count_distinct >= 3

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Esql.file_path_count_distinctge
  • 3
event.actioneq
  • creation corpus 25 (elastic 25)
event.categoryeq
  • file corpus 31 (elastic 31)
file.extensionin
  • bmp corpus 2 (elastic 2)
  • hta corpus 6 (elastic 6)
  • htm
  • html corpus 2 (elastic 2)
  • jpg corpus 2 (elastic 2)
  • pdf
  • png corpus 2 (elastic 2)
  • txt
process.pideq
  • 4 corpus 11 (elastic 11)
user.idne
  • S-1-5-18 corpus 8 (elastic 8)

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
Esql.file_path_count_distinctSTATS Esql.file_path_count_distinct = COUNT_DISTINCT(file.path)
Esql.file_path_valuesSTATS Esql.file_path_values = VALUES(file.path)
Esql.host_ip_valuesSTATS Esql.host_ip_values = values(host.ip)
host.idSTATS BY
host.nameSTATS BY
user.nameSTATS BY
user.idSTATS BY
process.entity_idSTATS BY
file.nameSTATS BY
Esql.time_window_date_truncSTATS BY