Binary Executed from Shared Memory Directory
Identifies the execution of a binary by root in Linux shared memory directories: (/dev/shm/, /run/shm/, /var/run/, /var/lock/). This activity is to be considered highly abnormal and should be investigated. Threat actors have placed executables used for persistence on high-uptime servers in these directories as system backdoors.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/05/10"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/05/21"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the execution of a binary by root in Linux shared memory directories: (/dev/shm/, /run/shm/, /var/run/,
11/var/lock/). This activity is to be considered highly abnormal and should be investigated. Threat actors have placed
12executables used for persistence on high-uptime servers in these directories as system backdoors.
13"""
14false_positives = [
15 """
16 Directories /dev/shm and /run/shm are temporary file storage directories in Linux. They are intended to appear as a
17 mounted file system, but uses virtual memory instead of a persistent storage device and thus are used for mounting
18 file systems in legitimate purposes.
19 """,
20]
21from = "now-9m"
22index = ["logs-endpoint.events.*", "endgame-*"]
23language = "eql"
24license = "Elastic License v2"
25name = "Binary Executed from Shared Memory Directory"
26references = [
27 "https://linuxsecurity.com/features/fileless-malware-on-linux",
28 "https://twitter.com/GossiTheDog/status/1522964028284411907",
29 "https://www.elastic.co/security-labs/a-peek-behind-the-bpfdoor",
30]
31risk_score = 73
32rule_id = "3f3f9fe2-d095-11ec-95dc-f661ea17fbce"
33setup = """## Setup
34
35This rule requires data coming in from Elastic Defend.
36
37### Elastic Defend Integration Setup
38Elastic 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.
39
40#### Prerequisite Requirements:
41- Fleet is required for Elastic Defend.
42- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
43
44#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
45- Go to the Kibana home page and click "Add integrations".
46- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
47- Click "Add Elastic Defend".
48- Configure the integration name and optionally add a description.
49- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
50- 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).
51- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
52- 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.
53For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
54- Click "Save and Continue".
55- 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.
56For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
57"""
58severity = "high"
59tags = [
60 "Domain: Endpoint",
61 "OS: Linux",
62 "Use Case: Threat Detection",
63 "Tactic: Execution",
64 "Threat: BPFDoor",
65 "Data Source: Elastic Endgame",
66 "Data Source: Elastic Defend",
67]
68timestamp_override = "event.ingested"
69type = "eql"
70
71query = '''
72process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
73user.id == "0" and process.executable : ("/dev/shm/*", "/run/shm/*", "/var/run/*", "/var/lock/*") and
74not process.executable : ("/var/run/docker/*", "/var/run/utsns/*", "/var/run/s6/*", "/var/run/cloudera-scm-agent/*",
75"/var/run/argo/argoexec") and not process.parent.command_line : "/usr/bin/runc init"
76'''
77
78
79[[rule.threat]]
80framework = "MITRE ATT&CK"
81[[rule.threat.technique]]
82id = "T1059"
83name = "Command and Scripting Interpreter"
84reference = "https://attack.mitre.org/techniques/T1059/"
85
86
87[rule.threat.tactic]
88id = "TA0002"
89name = "Execution"
90reference = "https://attack.mitre.org/tactics/TA0002/"
References
Related rules
- Process Started from Process ID (PID) File
- BPF filter applied using TC
- Interactive Terminal Spawned via Perl
- Interactive Terminal Spawned via Python
- Netcat Listener Established via rlwrap