Masquerading Space After Filename
This rules identifies a process created from an executable with a space appended to the end of the filename. This may indicate an attempt to masquerade a malicious file as benign to gain user execution. When a space is added to the end of certain files, the OS will execute the file according to it's true filetype instead of it's extension. Adversaries can hide a program's true filetype by changing the extension of the file. They can then add a space to the end of the name so that the OS automatically executes the file when it's double-clicked.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/10/18"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/10/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rules identifies a process created from an executable with a space appended to the end of the filename. This may
11indicate an attempt to masquerade a malicious file as benign to gain user execution. When a space is added to the end of
12certain files, the OS will execute the file according to it's true filetype instead of it's extension. Adversaries can
13hide a program's true filetype by changing the extension of the file. They can then add a space to the end of the name
14so that the OS automatically executes the file when it's double-clicked.
15"""
16from = "now-9m"
17index = ["auditbeat-*", "logs-endpoint.events.*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Masquerading Space After Filename"
21references = [
22 "https://www.picussecurity.com/resource/blog/picus-10-critical-mitre-attck-techniques-t1036-masquerading",
23]
24risk_score = 47
25rule_id = "f5fb4598-4f10-11ed-bdc3-0242ac120002"
26setup = """## Setup
27
28If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
29events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
30Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
31`event.ingested` to @timestamp.
32For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
33"""
34severity = "medium"
35tags = [
36 "Domain: Endpoint",
37 "OS: Linux",
38 "OS: macOS",
39 "Use Case: Threat Detection",
40 "Tactic: Defense Evasion",
41 "Data Source: Elastic Defend",
42]
43timestamp_override = "event.ingested"
44type = "eql"
45query = '''
46process where host.os.type:("linux","macos") and event.type == "start" and
47process.executable regex~ """/[a-z0-9\s_\-\\./]+\s""" and not (
48 process.name in ("ls", "find", "grep", "xkbcomp") or
49 process.executable like ("/opt/nessus_agent/*", "/opt/gitlab/sv/gitlab-exporter/*", "/tmp/ansible-admin/*") or
50 process.parent.args in (
51 "./check_rubrik", "/usr/bin/check_mk_agent", "/etc/rubrik/start_stop_bootstrap.sh", "/etc/rubrik/start_stop_agent.sh"
52 )
53)
54'''
55
56[[rule.threat]]
57framework = "MITRE ATT&CK"
58
59[[rule.threat.technique]]
60id = "T1036"
61name = "Masquerading"
62reference = "https://attack.mitre.org/techniques/T1036/"
63
64[[rule.threat.technique.subtechnique]]
65id = "T1036.006"
66name = "Space after Filename"
67reference = "https://attack.mitre.org/techniques/T1036/006/"
68
69[rule.threat.tactic]
70id = "TA0005"
71name = "Defense Evasion"
72reference = "https://attack.mitre.org/tactics/TA0005/"
References
Related rules
- Elastic Agent Service Terminated
- Tampering of Shell Command-Line History
- Timestomping using Touch Command
- Deprecated - Suspicious JAVA Child Process
- Potential Non-Standard Port SSH connection