T1613 - Container and Resource Discovery#

Adversaries may attempt to discover containers and other resources that are available within a containers environment. Other resources may include images, deployments, pods, nodes, and other information such as the status of a cluster.

These resources can be viewed within web applications such as the Kubernetes dashboard or can be queried via the Docker and Kubernetes APIs.(Citation: Docker API)(Citation: Kubernetes API) In Docker, logs may leak information about the environment, such as the environment’s configuration, which services are available, and what cloud provider the victim may be utilizing. The discovery of these resources may inform an adversary’s next steps in the environment, such as how to perform lateral movement and which methods to utilize for execution.

Atomic Tests#

Atomic Test #1 - Container and ResourceDiscovery#

Adversaries may attempt to discover containers and other resources that are available within a containers environment. Supported Platforms: containers

Dependencies: Run with sh!#

Description: Verify docker is installed.#
Check Prereq Commands:#
which docker
Get Prereq Commands:#
if [ "" == "`which docker`" ]; then echo "Docker Not Found"; if [ -n "`which apt-get`" ]; then sudo apt-get -y install docker ; elif [ -n "`which yum`" ]; then sudo yum -y install docker ; fi ; else echo "Docker installed"; fi
Description: Verify docker service is running.#
Check Prereq Commands:#
sudo systemctl status docker  --no-pager
Get Prereq Commands:#
sudo systemctl start docker
Invoke-AtomicTest T1613 -TestNumbers 1 -GetPreReqs

Attack Commands: Run with sh#

docker build -t t1613  $PathtoAtomicsFolder/T1613/src/
docker run --name t1613_container  -d -t t1613
docker ps
docker stats --no-stream
docker inspect $(docker ps -l -q --filter ancestor=t1613)```
Invoke-AtomicTest T1613 -TestNumbers 1

Cleanup:#

docker stop t1613_container
docker rmi -f t1613_container```
Invoke-AtomicTest T1613 -TestNumbers 1 -Cleanup

Detection#

Establish centralized logging for the activity of container and Kubernetes cluster components. This can be done by deploying logging agents on Kubernetes nodes and retrieving logs from sidecar proxies for application pods to detect malicious activity at the cluster level.

Monitor logs for actions that could be taken to gather information about container infrastructure, including the use of discovery API calls by new or unexpected users. Monitor account activity logs to see actions performed and activity associated with the Kubernetes dashboard and other web applications.