T1552.007: Container API
Adversaries may gather credentials via APIs within a containers environment. APIs in these environments, such as the Docker API and Kubernetes APIs, allow a user to remotely manage their container resources and cluster components.
An adversary may access the Docker API to collect logs that contain credentials to cloud, container, and various other resources in the environment. An adversary with sufficient permissions, such as via a pod's service account, may also use the Kubernetes API to retrieve credentials from the Kubernetes API server. These credentials may include those needed for Docker API authentication or secrets from Kubernetes cluster components.
Detection
ID | DS0002 | Data source and component | User Account: User Account Authentication | Description | It may be possible to detect adversary use of credentials they have obtained such as in Valid Accounts. |
---|
ID | DS0017 | Data source and component | Command: Command Execution | Description | Establish centralized logging for the activity of container and Kubernetes cluster components. Monitor logs for actions that could be taken to gather credentials to container and cloud infrastructure, including the use of discovery API calls by new or unexpected users and APIs that access Docker logs. |
---|
Mitigation
ID | M1026 | Name | Privileged Account Management | Description | Use the principle of least privilege for privileged accounts such as the service account in Kubernetes. For example, if a pod is not required to access the Kubernetes API, consider disabling the service account altogether. |
---|
ID | M1035 | Name | Limit Access to Resource Over Network | Description | 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. 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. Where possible, consider enabling just-in-time (JIT) access to the Kubernetes API to place additional restrictions on access. |
---|
ID | M1030 | Name | Network Segmentation | Description | Deny direct remote access to internal systems through the use of network proxies, gateways, and firewalls. |
---|
ID | M1018 | Name | User Account Management | Description | Enforce authentication and role-based access control on the container API to restrict users to the least privileges required. When using Kubernetes, avoid giving users wildcard permissions or adding users to the |
---|