Container Runtime CLI Execution with Suspicious Arguments
Detects execution of container runtime CLI tools (ctr, crictl, nerdctl) with arguments indicating container creation, command execution inside existing containers, image manipulation, or host filesystem mounting, potentially leading to privileged container creation and unauthorized access to sensitive data.
This detection rule identifies the execution of container runtime CLI tools (ctr, crictl, nerdctl) with suspicious arguments, indicating malicious activity within a containerized environment. Attackers leveraging host-level access can exploit these tools to bypass Kubernetes API server, RBAC authorization, admission webhooks, pod security standards, and Kubernetes audit logging. This allows attackers to create privileged “ghost” containers, execute commands within other pods to steal service account tokens and secrets, pull attacker-controlled images, and destroy evidence, all while remaining undetected by traditional Kubernetes-level monitoring. The rule specifically focuses on the use of ctr, crictl, and nerdctl with arguments related to task execution, privileged container creation, and snapshot mounting.
Attack Chain
- Attacker gains initial host-level access through a compromised node or other vulnerability.
- Attacker utilizes a container runtime CLI tool (
ctr,crictl, ornerdctl) to interact directly with the container runtime socket. - The attacker executes
ctr tasks execwith a specified container ID to gain shell access within the targeted container. - Alternatively, the attacker uses
ctr run --privilegedto create a new, highly privileged container, effectively bypassing security policies. - The attacker mounts host filesystems into the container using
ctr run --mount, granting them access to sensitive host data. - Attacker pulls malicious images from untrusted registries using
ctr pull <malicious_image>, introducing potentially compromised software into the environment. - The attacker leverages access to steal service account tokens and other secrets from targeted pods.
- The attacker uses the compromised environment to move laterally within the cluster, escalate privileges, and exfiltrate sensitive data.
Impact
Successful exploitation can lead to a complete compromise of the Kubernetes cluster. Attackers can gain unauthorized access to sensitive data, escalate privileges, and move laterally within the environment. The bypass of standard Kubernetes security controls makes detection difficult, allowing attackers to operate undetected for extended periods.
Recommendation
- Deploy the Sigma rule “Container Runtime CLI Execution with Suspicious Arguments” to your SIEM to detect suspicious container runtime CLI executions (rule: Container Runtime CLI Execution with Suspicious Arguments).
- Enable process execution telemetry with arguments from Elastic Defend and/or Auditd Manager to provide the necessary data for detection (setup instructions in the rule description).
- Tune the Sigma rule by filtering out legitimate parent processes, users, or host roles known to use these CLIs, to reduce false positives (false_positives in the rule description).
- Review and restrict host-level access to nodes to minimize the attack surface for this type of exploit (overview).
- Implement strict image scanning and registry controls to prevent the introduction of malicious images into the environment (attack chain step 6).
- Monitor file, network, and Kubernetes audit activity for pulls from unusual registries or subsequent pod changes to identify suspicious container activity (note).
Detection coverage 2
Container Runtime CLI Execution with Suspicious Arguments
mediumDetects execution of container runtime CLI tools (ctr, crictl, nerdctl) with arguments indicating container creation, command execution inside existing containers, image manipulation, or host filesystem mounting.
Suspicious Container Runtime Socket Access from Temporary Locations
highDetects processes running from /tmp, /dev/shm or /var/tmp accessing container runtime sockets, indicating potential container escape attempts.
Detection queries are kept inside the platform. Get full rules →