Background Process Execution via Shell


Description

Detects when a binary located in a suspicious location gets executed by a shell interpreter and put in the background via the & operator. Malwares may execute their payloads in the background in an effort to remain hidden.

Query · eql

process where event.type == "start" and event.action == "exec" and 
    process.name like~ ("bash", "sh", "zsh", "tclsh*") and
    process.args == "-c" and process.args like~ ("/* &", "/*&") and
    process.args_count == 3 and 
    process.parent.executable like~ 
                                ("/private/tmp/*", 
                                 "/var/tmp/*", 
                                 "/tmp/*", 
                                 "/var/folders/*", 
                                 "/Library/Containers/*", 
                                 "/Library/Graphics/*",
                                 "/Users/Shared/*", 
                                 "/Users/*/Library/Preferences/*", 
                                 "/var/root/*", 
                                 "/Library/WebServer/*", 
                                 "/Library/Preferences/*", 
                                 "/Library/Services/*", 
                                 "/Library/Fonts/*", 
                                 "/usr/local/bin/*")
Raw source Background Process Execution via Shell · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects when a binary located in a suspicious location gets executed by a shell interpreter and put in the background
via the & operator. Malwares may execute their payloads in the background in an effort to remain hidden.
"""
id = "603ac59e-9cca-4c48-9750-e38399079043"
license = "Elastic License v2"
name = "Background Process Execution via Shell"
os_list = ["macos"]
version = "1.0.19"

query = '''
process where event.type == "start" and event.action == "exec" and 
    process.name like~ ("bash", "sh", "zsh", "tclsh*") and
    process.args == "-c" and process.args like~ ("/* &", "/*&") and
    process.args_count == 3 and 
    process.parent.executable like~ 
                                ("/private/tmp/*", 
                                 "/var/tmp/*", 
                                 "/tmp/*", 
                                 "/var/folders/*", 
                                 "/Library/Containers/*", 
                                 "/Library/Graphics/*",
                                 "/Users/Shared/*", 
                                 "/Users/*/Library/Preferences/*", 
                                 "/var/root/*", 
                                 "/Library/WebServer/*", 
                                 "/Library/Preferences/*", 
                                 "/Library/Services/*", 
                                 "/Library/Fonts/*", 
                                 "/usr/local/bin/*")
'''

min_endpoint_version = "8.10.2"
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/"

[internal]
min_endpoint_version = "8.10.2"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.