Potential Credential Validation via Sudo from Unusual Parent
Description
Identifies use of sudo with -k (invalidate cached credentials) and -S (read password from stdin) to run a lightweight command such as pwd, whoami, or true. Malware and social-engineering chains often use this pattern to verify a password collected from a fake authentication dialog before proceeding with privileged actions. Parent processes such as osascript, node, or bun, or unsigned binaries from user-writable paths, are uncommon legitimate sources for this behavior.
Query · eql
process where event.type == "start" and event.action == "exec" and process.args_count <= 8 and
(
(process.name == "sudo" and process.args == "-k" and process.args == "-S") or
(process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.command_line like "*sudo -k -S *")
) and
(
(process.parent.name in ("osascript", "node", "bun") or process.parent.name like "python*") or
process.parent.executable like (
"/Users/*", "/private/tmp/*", "/tmp/*", "/var/tmp/*", "/home/*/*", "/run/user/*",
"/var/run/user/*", "/dev/shm/*"
)
)