Shell Execution of Non-Executable File


Description

Detects the execution of an un-executable file, per file extension, via a shell interpreter. Sometimes threat actors will masquerade their payloads as non-executable files in order to avoid suspicion and go unnoticed.

Query · eql

process where event.type == "start" and event.action == "exec" and process.args_count == 2 and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args in (
  "/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/dash", "/usr/bin/dash", "/bin/zsh", "/usr/bin/zsh",
  "/bin/tcsh", "/usr/bin/tcsh", "/bin/csh", "/usr/bin/csh", "/bin/ksh", "/usr/bin/ksh", "/bin/fish", "/usr/bin/fish"
) and
process.args like ("*.pid", "*.txt", "*.json", "*.bin", "*.log", "*.dat") and
not (
  process.args in ("/opt/config/example.txt", "/var/lib/git/beinformed.git/subgit/authors.txt") or
  process.parent.args like ("/sbin/init", "/var/opt/eset/RemoteAdministrator/Agent/*") or
  process.parent.executable in ("/usr/bin/emscli", "./runc") or
  process.command_line in (
    /* Manage Engine UEMS Agent */
    "/bin/bash /opt/DesktopCentral/UEMS_LinuxAgent.bin", "/bin/bash ./UEMS_LinuxAgent.bin"
  )
)
Raw source Shell Execution of Non-Executable File · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects the execution of an un-executable file, per file extension, via a shell interpreter. Sometimes threat actors
will masquerade their payloads as non-executable files in order to avoid suspicion and go unnoticed.
"""
id = "4c61fca2-6f77-474d-a537-2d7fd9ec75e0"
license = "Elastic License v2"
name = "Shell Execution of Non-Executable File"
os_list = ["linux"]
version = "1.0.10"

query = '''
process where event.type == "start" and event.action == "exec" and process.args_count == 2 and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args in (
  "/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/dash", "/usr/bin/dash", "/bin/zsh", "/usr/bin/zsh",
  "/bin/tcsh", "/usr/bin/tcsh", "/bin/csh", "/usr/bin/csh", "/bin/ksh", "/usr/bin/ksh", "/bin/fish", "/usr/bin/fish"
) and
process.args like ("*.pid", "*.txt", "*.json", "*.bin", "*.log", "*.dat") and
not (
  process.args in ("/opt/config/example.txt", "/var/lib/git/beinformed.git/subgit/authors.txt") or
  process.parent.args like ("/sbin/init", "/var/opt/eset/RemoteAdministrator/Agent/*") or
  process.parent.executable in ("/usr/bin/emscli", "./runc") or
  process.command_line in (
    /* Manage Engine UEMS Agent */
    "/bin/bash /opt/DesktopCentral/UEMS_LinuxAgent.bin", "/bin/bash ./UEMS_LinuxAgent.bin"
  )
)
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.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 = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

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.