Suspicious Execution of Unsigned or Untrusted Process via Sudo


Description

Detects when Sudo is used to execute an untrusted or unsigned binary via the -S option allowing a password or pre-gathered key to be piped to the binary upon execution. A recent stealer sample was seen executing a second stage payload in this manner passing the user provided password to supply the second stage payload with upon execution. The use of Sudo with the -S option in itself is not common but when its used to execute an untrusted or unsigned binary it should be considered highly suspicious acitvity.

Query · eql

sequence with maxspan=5s
[process where event.type == "start" and event.action == "exec" and process.name == "sudo" and 
  process.args == "-S"] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.parent.name == "sudo" and 
  (process.code_signature.trusted == false or process.code_signature.exists == false)] by process.parent.entity_id
Raw source Suspicious Execution of Unsigned or Untrusted Process via Sudo · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects when Sudo is used to execute an untrusted or unsigned binary via the -S option allowing a password or
pre-gathered key to be piped to the binary upon execution. A recent stealer sample was seen executing a second stage
payload in this manner passing the user provided password to supply the second stage payload with upon execution. The
use of Sudo with the -S option in itself is not common but when its used to execute an untrusted or unsigned binary it
should be considered highly suspicious acitvity.
"""
id = "7998fa77-dc94-4bd7-b458-34cf1cbcee9a"
license = "Elastic License v2"
name = "Suspicious Execution of Unsigned or Untrusted Process via Sudo"
os_list = ["macos"]
reference = ["https://x.com/moonlock_lab/status/1815640547551306015"]
version = "1.0.6"

query = '''
sequence with maxspan=5s
[process where event.type == "start" and event.action == "exec" and process.name == "sudo" and 
  process.args == "-S"] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.parent.name == "sudo" and 
  (process.code_signature.trusted == false or process.code_signature.exists == false)] by process.parent.entity_id
'''

min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[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.11.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.