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"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2023/10/19"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12This rules identifies a process created from an executable with a space appended to the end of the filename. This may
13indicate an attempt to masquerade a malicious file as benign to gain user execution. When a space is added to the end of
14certain files, the OS will execute the file according to it's true filetype instead of it's extension. Adversaries can
15hide a program's true filetype by changing the extension of the file. They can then add a space to the end of the name
16so that the OS automatically executes the file when it's double-clicked.
17"""
18from = "now-9m"
19index = ["auditbeat-*", "logs-endpoint.events.*"]
20language = "eql"
21license = "Elastic License v2"
22name = "Masquerading Space After Filename"
23references = [
24    "https://www.picussecurity.com/resource/blog/picus-10-critical-mitre-attck-techniques-t1036-masquerading",
25]
26risk_score = 47
27rule_id = "f5fb4598-4f10-11ed-bdc3-0242ac120002"
28setup = """## Setup
29
30If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
31events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
32Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
33`event.ingested` to @timestamp.
34For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
35"""
36severity = "medium"
37tags = ["Domain: Endpoint", "OS: Linux", "OS: macOS", "Use Case: Threat Detection", "Tactic: Defense Evasion", "Data Source: Elastic Defend"]
38timestamp_override = "event.ingested"
39type = "eql"
40
41query = '''
42process where host.os.type:("linux","macos") and
43  event.type == "start" and
44  (process.executable regex~ """/[a-z0-9\s_\-\\./]+\s""") and not
45  process.name in ("ls", "find", "grep", "xkbcomp")
46'''
47
48
49[[rule.threat]]
50framework = "MITRE ATT&CK"
51[[rule.threat.technique]]
52id = "T1036"
53name = "Masquerading"
54reference = "https://attack.mitre.org/techniques/T1036/"
55[[rule.threat.technique.subtechnique]]
56id = "T1036.006"
57name = "Space after Filename"
58reference = "https://attack.mitre.org/techniques/T1036/006/"
59
60
61
62[rule.threat.tactic]
63id = "TA0005"
64name = "Defense Evasion"
65reference = "https://attack.mitre.org/tactics/TA0005/"

References

Related rules

to-top