Skip to content
RCE Write-up Advanced

Leaky Vessels: runC and BuildKit container escape vulnerabilities - everything you need to know

Several vulnerabilities in runC and BuildKit allow container escape, giving an attacker access to the host filesystem and potentially full control of the host. The most severe flaw, CVE-2024-21626, can be exploited by running a malicious container image or by tricking a user into executing into a container.

Merav Bar Follow

Published on wiz.io

New vulnerabilities have been revealed in the runC command line tool (CVE-2024-21626) and in BuildKit (CVE-2024-23651, CVE-2024-23652, and CVE-2024-23653). These flaws pose a risk of container escape, meaning that exploiting them could grant unauthorized access to the host operating system, potentially compromising…

Merav Bar, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a file descriptor leak in runC and race conditions or logic flaws in BuildKit that allow a container process to access host filesystem paths.

Impact

An attacker could gain full control of the host, access sensitive data, and move laterally to other pods or cloud resources; however, exploitation requires control over the container image, Dockerfile, or launch arguments, or tricking a user into executing into the container.

What the attacker needed

Control over container image or Dockerfile; or ability to influence container launch arguments; or victim uses runc exec into container

The fix

The vulnerabilities were fixed in runC v1.1.12, BuildKit v0.12.5, Moby v25.0.2, and Docker Desktop v4.27.1.

How it was found

  1. Create a Dockerfile that sets the working directory to a host file descriptor path.
  2. Build the Dockerfile, causing the build container to start in the host's cgroup directory.
  3. Traverse up the directory tree to reach the host root filesystem.
  4. Read or write arbitrary files on the host, such as /etc/shadow.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Containers are meant to keep programs isolated from the rest of the computer, like a box inside a box. These bugs let a program break out of its box and read or change files on the real computer, which is very dangerous. An attacker could use a specially crafted container image to do this.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Merav Bar

View all

27 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.