-
Notifications
You must be signed in to change notification settings - Fork 603
[New Rule] File Creation with Curly Braces or Command Substitution #5219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aegrah
wants to merge
2
commits into
main
Choose a base branch
from
new-rule-vshell-detection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 : "*$(*" | ||
) 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/" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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)