Skip to content

T1609 Container Administration Command

Adversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment.365

In Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as docker exec to execute a command within a running container.21 In Kubernetes, if an adversary has sufficient permissions, they may gain remote execution in a container in the cluster via interaction with the Kubernetes API server, the kubelet, or by running a command such as kubectl exec.4

Item Value
ID T1609
Sub-techniques
Tactics TA0002
Platforms Containers
Version 1.2
Created 29 March 2021
Last Modified 15 April 2023

Procedure Examples

ID Name Description
S0601 Hildegard Hildegard was executed through the kubelet API run command and by executing commands on running containers.16
S0599 Kinsing Kinsing was executed with an Ubuntu container entry point that runs shell scripts.18
S0683 Peirates Peirates can use kubectl or the Kubernetes API to run commands.15
S0623 Siloscape Siloscape can send kubectl commands to victim clusters through an IRC channel and can run kubectl locally to spread once within a victim cluster.17
G0139 TeamTNT TeamTNT executed Hildegard through the kubelet API run command and by executing commands on running containers.16

Mitigations

ID Mitigation Description
M1042 Disable or Remove Feature or Program Remove unnecessary tools and software from containers.
M1038 Execution Prevention Use read-only containers, read-only file systems, and minimal images when possible to prevent the execution of commands.8 Where possible, also consider using application control and software restriction tools (such as those provided by SELinux) to restrict access to files, processes, and system calls in containers.14
M1035 Limit Access to Resource Over Network Limit communications with the container service to managed and secured channels, such as local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API and Kubernetes API Server.1013 In Kubernetes clusters deployed in cloud environments, use native cloud platform features to restrict the IP ranges that are permitted to access to API server.11 Where possible, consider enabling just-in-time (JIT) access to the Kubernetes API to place additional restrictions on access.12
M1026 Privileged Account Management Ensure containers are not running as root by default. In Kubernetes environments, consider defining Pod Security Standards that prevent pods from running privileged containers and using the NodeRestriction admission controller to deny the kublet access to nodes and pods outside of the node it belongs to.8 7
M1018 User Account Management Enforce authentication and role-based access control on the container service to restrict users to the least privileges required.8 When using Kubernetes, avoid giving users wildcard permissions or adding users to the system:masters group, and use RoleBindings rather than ClusterRoleBindings to limit user privileges to specific namespaces.9

Detection

ID Data Source Data Component
DS0017 Command Command Execution
DS0009 Process Process Creation

References


  1. Docker. (n.d.). Docker Exec. Retrieved March 29, 2021. 

  2. Docker. (n.d.). Docker run reference. Retrieved March 29, 2021. 

  3. Docker. (n.d.). DockerD CLI. Retrieved March 29, 2021. 

  4. The Kubernetes Authors. (n.d.). Get a Shell to a Running Container. Retrieved March 29, 2021. 

  5. The Kubernetes Authors. (n.d.). Kubelet. Retrieved March 29, 2021. 

  6. The Kubernetes Authors. (n.d.). The Kubernetes API. Retrieved March 29, 2021. 

  7. Kubernetes. (n.d.). Admission Controllers Reference. Retrieved March 8, 2023. 

  8. National Security Agency, Cybersecurity and Infrastructure Security Agency. (2022, March). Kubernetes Hardening Guide. Retrieved April 1, 2022. 

  9. Kubernetes. (n.d.). Role Based Access Control Good Practices. Retrieved March 8, 2023. 

  10. Docker. (n.d.). Protect the Docker Daemon Socket. Retrieved March 29, 2021. 

  11. Kubernetes. (n.d.). Overview of Cloud Native Security. Retrieved March 8, 2023. 

  12. Microsoft. (2023, February 27). AKS-managed Azure Active Directory integration. Retrieved March 8, 2023. 

  13. The Kubernetes Authors. (n.d.). Controlling Access to The Kubernetes API. Retrieved March 29, 2021. 

  14. Kubernetes. (n.d.). Configure a Security Context for a Pod or Container. Retrieved March 8, 2023. 

  15. InGuardians. (2022, January 5). Peirates GitHub. Retrieved February 8, 2022. 

  16. Chen, J. et al. (2021, February 3). Hildegard: New TeamTNT Cryptojacking Malware Targeting Kubernetes. Retrieved April 5, 2021. 

  17. Prizmant, D. (2021, June 7). Siloscape: First Known Malware Targeting Windows Containers to Compromise Cloud Environments. Retrieved June 9, 2021. 

  18. Singer, G. (2020, April 3). Threat Alert: Kinsing Malware Attacks Targeting Container Environments. Retrieved April 1, 2021.