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/05/21"
 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"
45
46query = '''
47process where host.os.type:("linux","macos") and
48  event.type == "start" and
49  (process.executable regex~ """/[a-z0-9\s_\-\\./]+\s""") and not
50  process.name in ("ls", "find", "grep", "xkbcomp")
51'''
52
53
54[[rule.threat]]
55framework = "MITRE ATT&CK"
56[[rule.threat.technique]]
57id = "T1036"
58name = "Masquerading"
59reference = "https://attack.mitre.org/techniques/T1036/"
60[[rule.threat.technique.subtechnique]]
61id = "T1036.006"
62name = "Space after Filename"
63reference = "https://attack.mitre.org/techniques/T1036/006/"
64
65
66
67[rule.threat.tactic]
68id = "TA0005"
69name = "Defense Evasion"
70reference = "https://attack.mitre.org/tactics/TA0005/"

References

Related rules

to-top