Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions rules/linux/defense_evasion_unusual_file_creation.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[metadata]
creation_date = "2025/10/14"
integration = ["endpoint"]
maturity = "production"
updated_date = "2025/10/14"

[rule]
author = ["Elastic"]
description = """
This rule detects the creation of files with names containing curly braces "{}" or command substitution "$()". Such naming conventions
are often used in scripts to dynamically generate file names or execute commands, which can be exploited by attackers for obfuscation
or evasion techniques. The presence of these characters in file names may indicate an attempt to create files in a non-standard manner,
potentially as part of a malicious activity.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process*",
]
language = "eql"
license = "Elastic License v2"
name = "File Creation with Curly Braces or Command Substitution"
references = ["https://www.trellix.com/blogs/research/the-silent-fileless-threat-of-vshell/"]
risk_score = 21
rule_id = "0fda68c7-afaf-4ea2-9195-3df18cdc8428"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Tactic: Execution",
"Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.type == "creation" and (
file.name regex~ """.*\{[^\}]*,[^\}]*\}.*""" or
file.name : "*$(*"
Comment on lines +38 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like an expensive query - match on any file creation with regex or wildcards, can't you limit to some processes or file paths ? its OK to push expensive queries if there are no other alternatives and the scenario is so common (top TTPs)

) and not (
process.name in ("git", "dockerd", "tar", "smbd", "jetbrains-toolbox", "executor", "nautilus", "singularity") or
file.path like~ ("/tmp/plz_sandbox*", "/usr/local/share/nvm/*", "/mnt/*", "/datastore/*", "/builds/*") or
file.name like~ ("Running 'nvm*", ".Running 'nvm*")
)
'''

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

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

[[rule.threat.technique]]
name = "Obfuscated Files or Information"
id = "T1027"
reference = "https://attack.mitre.org/techniques/T1027/"

[[rule.threat.technique]]
name = "Deobfuscate/Decode Files or Information"
id = "T1140"
reference = "https://attack.mitre.org/techniques/T1140/"

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

[[rule.threat.technique]]
name = "User Execution"
id = "T1204"
reference = "https://attack.mitre.org/techniques/T1204/"

[[rule.threat.technique.subtechnique]]
name = "Malicious File"
id = "T1204.002"
reference = "https://attack.mitre.org/techniques/T1204/002/"
Loading