Detection rules › Elastic
World Writeable Directory Exec Remount
This rule detects the execution of the "mount" command with suspicious arguments that indicate an attempt to remount world-writable directories or shared memory directories. This behavior is often associated with attempts to evade detection or modify system behavior in a way that could facilitate further malicious activity.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule body
[rule]
description = """
This rule detects the execution of the "mount" command with suspicious arguments that indicate an attempt to remount
world-writable directories or shared memory directories. This behavior is often associated with attempts to evade
detection or modify system behavior in a way that could facilitate further malicious activity.
"""
id = "5b3b2411-c114-48c5-8f95-21894067d2ba"
license = "Elastic License v2"
name = "World Writeable Directory Exec Remount"
os_list = ["linux"]
version = "1.0.4"
query = '''
process where event.type == "start" and event.action == "exec" and
process.executable in ("/bin/mount", "/usr/bin/mount", "/usr/local/bin/mount") and
process.args in ("-o", "--options") and process.args like "remount*" and process.args like "exec*" and
process.args like ("/tmp*", "/var/tmp*", "/dev/shm*") and
not process.command_line like "*noexec*" and
not (
process.parent.executable like ("/usr/bin/sudo", "/usr/sbin/apt-get.hook", "/usr/bin/python*") or
process.working_directory == "/var/lib/usg"
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.executable in ("/bin/mount", "/usr/bin/mount", "/usr/local/bin/mount") and
process.args in ("-o", "--options") and process.args like "remount*" and process.args like "exec*" and
process.args like ("/tmp*", "/var/tmp*", "/dev/shm*") and
not process.command_line like "*noexec*" and
not (
process.parent.executable like ("/usr/bin/sudo", "/usr/sbin/apt-get.hook", "/usr/bin/python*") or
process.working_directory == "/var/lib/usg"
)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.executable | wildcard | /usr/bin/sudo, /usr/sbin/apt-get.hook, /usr/bin/python* | excludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/sudo" field:"process.parent.executable" value:"/usr/sbin/apt-get.hook" field:"process.parent.executable" value:"/usr/bin/python*" |
process.working_directory | eq | /var/lib/usg | excludes:process.working_directory field:"process.working_directory" value:"/var/lib/usg" |
process.command_line | match | noexec | excludes:process.command_line field:"process.command_line" value:"noexec" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.executable | in |
| field:"Image" kind:in |