Container Vulnerabilities 101
Last updated
Last updated
Before we begin, it's important to re-cap some of the things learned in the Intro to Containerisation room. First, let's recall that containers are isolated and have minimal environments. The picture below depicts the environment of a container.
Just because you have access (i.e. a foothold) to a container, it does not mean you have access to the host operating system and associated files or other containers.
Due to the minimal nature of containers (i.e. they only have the tools specified by the developer), you are unlikely to find fundamental tools such as Netcat, Wget or even Bash! This makes interacting within a container quite difficult for an attacker.
While Docker containers are designed to isolate applications from one another, they can still be vulnerable. For example, hard-coded passwords for an application can still be present. If an attacker is able to gain access through a vulnerable web application, for example, they will be able to find these credentials. You can see an example of a web application containing hard-coded credentials to a database server in the code snippet below:
This, of course, isn't the only vulnerability that can be exploited in containers. The other potential attack vectors have been listed in the table below.
Vulnerability | Description |
---|---|
Misconfigured Containers | Misconfigured containers will have privileges that are not necessary for the operation of the container. For example, a container running in "privileged" mode will have access to the host operating system - removing the layers of isolation. |
Vulnerable Images | There have been numerous incidents of popular Docker images being backdoored to perform malicious actions such as crypto mining. |
Network Connectivity | A container that is not correctly networked can be exposed to the internet. For example, a database container for a web application should only be accessible to the web application container - not the internet. Additionally, containers can serve to become a method of lateral movement. Once an attacker has access to a container, they may be able to interact with other containers on the host that are not exposed to the network. |