Persistence (TA0003)(external, opens in a new tab or window)
Privilege Escalation (TA0004)(external, opens in a new tab or window)
text code block:process where event.type == "start" and event.action == "exec" and process.interactive == true and process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args in ("-lc", "-c") and process.args like ("*echo *", "*printf *") and process.args like ( "*/etc/cron*", "*/etc/rc.local*", "*/dev/tcp/*", "*/etc/init.d*", "*/etc/update-motd.d*", "*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", "*base32 *", "*base16 *", "*/etc/profile*", "*/dev/shm/*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*" , "*~/.ssh/*", "*xxd *", "*/etc/shadow*", "* /tmp/*", "* /var/tmp/*", "* /dev/shm/* ", "* ~/*", "* /home/*", "* /run/*", "* /var/run/*", "*|*sh", "*|*python*", "*|*php*", "*|*perl*", "*|*busybox*", "*/var/www/*", "*>*", "*;*", "*chmod *", "*rm *", "*openssl enc*" ) and container.id like "?*"
Install detection rules in Elastic Security
Detect Suspicious Echo or Printf Execution Detected via Defend for Containers in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).