Potential Hidden Process via Mount Hidepid

Identifies the execution of mount process with hidepid parameter, which can make processes invisible to other users from the system. Adversaries using Linux kernel version 3.2+ (or RHEL/CentOS v6.5+ above) can hide the process from other users. When hidepid=2 option is executed to mount the /proc filesystem, only the root user can see all processes and the logged-in user can only see their own process. This provides a defense evasion mechanism for the adversaries to hide their process executions from all other commands such as ps, top, pgrep and more. With the Linux kernel hardening hidepid option all the user has to do is remount the /proc filesystem with the option, which can now be monitored and detected.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/04/11"
 3integration = ["endpoint", "auditd_manager"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2024/03/08"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Identifies the execution of mount process with hidepid parameter, which can make processes invisible to
13other users from the system. Adversaries using Linux kernel version 3.2+ (or RHEL/CentOS v6.5+ above) can hide
14the process from other users. When hidepid=2 option is executed to mount the /proc filesystem, only the root user
15can see all processes and the logged-in user can only see their own process. This provides a defense evasion mechanism for
16the adversaries to hide their process executions from all other commands such as ps, top, pgrep and more.
17With the Linux kernel hardening hidepid option all the user has to do is remount the /proc filesystem with the option,
18which can now be monitored and detected.
19"""
20from = "now-9m"
21index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
22language = "eql"
23license = "Elastic License v2"
24name = "Potential Hidden Process via Mount Hidepid"
25references = [
26    "https://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/",
27]
28risk_score = 47
29rule_id = "dc71c186-9fe4-4437-a4d0-85ebb32b8204"
30setup = """## Setup
31
32This rule requires data coming in from Elastic Defend.
33
34### Elastic Defend Integration Setup
35Elastic 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.
36
37#### Prerequisite Requirements:
38- Fleet is required for Elastic Defend.
39- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
40
41#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
42- Go to the Kibana home page and click "Add integrations".
43- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
44- Click "Add Elastic Defend".
45- Configure the integration name and optionally add a description.
46- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
47- 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).
48- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
49- 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.
50For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
51- Click "Save and Continue".
52- 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.
53For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
54"""
55severity = "medium"
56tags = [
57        "Domain: Endpoint",
58        "OS: Linux",
59        "Use Case: Threat Detection",
60        "Tactic: Defense Evasion",
61        "Data Source: Elastic Endgame",
62        "Data Source: Elastic Defend",
63        "Data Source: Auditd Manager"
64        ]
65timestamp_override = "event.ingested"
66type = "eql"
67query = '''
68process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
69 and process.name == "mount" and process.args == "/proc" and process.args == "-o" and
70process.args : "*hidepid=2*"
71'''
72
73[[rule.threat]]
74framework = "MITRE ATT&CK"
75
76[[rule.threat.technique]]
77id = "T1564"
78name = "Hide Artifacts"
79reference = "https://attack.mitre.org/techniques/T1564/"
80
81[rule.threat.tactic]
82id = "TA0005"
83name = "Defense Evasion"
84reference = "https://attack.mitre.org/tactics/TA0005/"

References

Related rules

to-top