T1612: Build Image on Host
Last updated
Was this helpful?
Last updated
Was this helpful?
Adversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docket API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.
An adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they may utilize Deploy Container using that custom image. If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it's a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment.
Now if adversaries can locate a remote docker API this can actually aid in the process of building a docker on the host where their malicious activities and payloads can run without the intervention of EDR or AV.
In this small example I'll demonstrate that docker images can be set remotely
But if there are images already installed execution can be achieved
Interacting with the API to enumerate the containers available
And finally executing commands inside the container and then proceed with steps from their such as Escape to Host or use a Privilege Escalation technique to continue