text code block:process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and ( ( process.name == "curl" and process.args in ("-H", "--header") and process.args like "*Authorization: Bearer *" and ( /* CA-specified */ process.args in ("--cacert", "--capath") or /* insecure */ process.args in ("-k", "--insecure") ) ) or ( process.name == "wget" and process.args like "--header*" and process.args like "*Authorization: Bearer *" and ( /* CA-specified */ process.args == "--ca-certificate" or /* insecure */ process.args == "--no-check-certificate" ) ) or ( /* Account for tools that execute utilities as a subprocess, in this case the target utility name will appear as a process arg */ process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and process.args in ("wget", "/bin/wget", "/usr/bin/wget", "/usr/local/bin/wget") and process.args like "--header*" and process.args like "*Authorization: Bearer*" and process.args == "--no-check-certificate" ) or ( /* ssl_client is busybox-specific, so we need to handle it separately */ process.name == "busybox" and process.args == "ssl_client" and process.args like "*Authorization: Bearer*" ) or (process.name == "openssl" and process.args == "s_client" and process.args == "-connect") or (process.name == "socat" and process.args like~ "*ssl*") or (process.name == "ncat" and process.args like "--ssl*") or (process.name == "kubectl" and process.args in ("get", "list", "watch", "create", "patch", "update")) ) and process.interactive == true and container.id like "*"
Install detection rules in Elastic Security
Detect Direct Interactive Kubernetes API Request 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).