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

References

Related rules

to-top