Potential Suspicious DebugFS Root Device Access

This rule monitors for the usage of the built-in Linux DebugFS utility to access a disk device without root permissions. Linux users that are part of the "disk" group have sufficient privileges to access all data inside of the machine through DebugFS. Attackers may leverage DebugFS in conjunction with "disk" permissions to read sensitive files owned by root, such as the shadow file, root ssh private keys or other sensitive files that may allow them to further escalate privileges.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/08/30"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/07/30"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule monitors for the usage of the built-in Linux DebugFS utility to access a disk device without root permissions.
11Linux users that are part of the "disk" group have sufficient privileges to access all data inside of the machine
12through DebugFS. Attackers may leverage DebugFS in conjunction with "disk" permissions to read sensitive files owned by
13root, such as the shadow file, root ssh private keys or other sensitive files that may allow them to further escalate
14privileges.
15"""
16from = "now-9m"
17index = ["logs-endpoint.events.*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Potential Suspicious DebugFS Root Device Access"
21references = [
22    "https://book.hacktricks.xyz/linux-hardening/privilege-escalation/interesting-groups-linux-pe#disk-group",
23]
24risk_score = 21
25rule_id = "2605aa59-29ac-4662-afad-8d86257c7c91"
26setup = """## Setup
27
28This rule requires data coming in from Elastic Defend.
29
30### Elastic Defend Integration Setup
31Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
32
33#### Prerequisite Requirements:
34- Fleet is required for Elastic Defend.
35- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
36
37#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
38- Go to the Kibana home page and click "Add integrations".
39- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
40- Click "Add Elastic Defend".
41- Configure the integration name and optionally add a description.
42- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
43- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
44- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
45- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
46For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
47- Click "Save and Continue".
48- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
49For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
50"""
51severity = "low"
52tags = [
53    "Domain: Endpoint",
54    "OS: Linux",
55    "Use Case: Threat Detection",
56    "Tactic: Privilege Escalation",
57    "Data Source: Elastic Defend",
58]
59timestamp_override = "event.ingested"
60type = "eql"
61
62query = '''
63process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
64process.name == "debugfs" and process.args : "/dev/sd*" and not process.args == "-R" and 
65not user.Ext.real.id == "0" and not group.Ext.real.id == "0"
66'''
67
68[[rule.threat]]
69framework = "MITRE ATT&CK"
70
71[[rule.threat.technique]]
72id = "T1078"
73name = "Valid Accounts"
74reference = "https://attack.mitre.org/techniques/T1078/"
75
76[[rule.threat.technique.subtechnique]]
77id = "T1078.003"
78name = "Local Accounts"
79reference = "https://attack.mitre.org/techniques/T1078/003/"
80
81[rule.threat.tactic]
82id = "TA0004"
83name = "Privilege Escalation"
84reference = "https://attack.mitre.org/tactics/TA0004/"

References

Related rules

to-top