Creation of Hidden Files and Directories via CommandLine
Users can mark specific files as hidden simply by putting a "." as the first character in the file or folder name. Adversaries can use this to their advantage to hide files and folders on the system for persistence and defense evasion. This rule looks for hidden files or folders in common writable directories.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/04/29"
3integration = ["endpoint"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/02/22"
8
9[rule]
10author = ["Elastic"]
11description = """
12Users can mark specific files as hidden simply by putting a "." as the first character in the file or folder name.
13Adversaries can use this to their advantage to hide files and folders on the system for persistence and defense evasion.
14This rule looks for hidden files or folders in common writable directories.
15"""
16false_positives = [
17 """
18 Certain tools may create hidden temporary files or directories upon installation or as part of their normal
19 behavior. These events can be filtered by the process arguments, username, or process name values.
20 """,
21]
22from = "now-9m"
23index = ["auditbeat-*", "logs-endpoint.events.*"]
24language = "eql"
25license = "Elastic License v2"
26max_signals = 33
27name = "Creation of Hidden Files and Directories via CommandLine"
28note = """## Setup
29
30If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
31"""
32risk_score = 47
33rule_id = "b9666521-4742-49ce-9ddc-b8e84c35acae"
34severity = "medium"
35tags = ["Elastic", "Host", "Linux", "Threat Detection", "Defense Evasion"]
36timestamp_override = "event.ingested"
37type = "eql"
38
39query = '''
40process where host.os.type == "linux" and event.type in ("start", "process_started") and
41 process.working_directory in ("/tmp", "/var/tmp", "/dev/shm") and
42 process.args regex~ """\.[a-z0-9_\-][a-z0-9_\-\.]{1,254}""" and
43 not process.name in ("ls", "find", "grep")
44'''
45
46
47[[rule.threat]]
48framework = "MITRE ATT&CK"
49[[rule.threat.technique]]
50id = "T1564"
51name = "Hide Artifacts"
52reference = "https://attack.mitre.org/techniques/T1564/"
53[[rule.threat.technique.subtechnique]]
54id = "T1564.001"
55name = "Hidden Files and Directories"
56reference = "https://attack.mitre.org/techniques/T1564/001/"
57
58
59
60[rule.threat.tactic]
61id = "TA0005"
62name = "Defense Evasion"
63reference = "https://attack.mitre.org/tactics/TA0005/"
64[[rule.threat]]
65framework = "MITRE ATT&CK"
66
67[rule.threat.tactic]
68id = "TA0003"
69name = "Persistence"
70reference = "https://attack.mitre.org/tactics/TA0003/"
Setup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.