Skip to content
RCE Write-up Advanced

Docker and runC Vulnerabilities: A Deep Dive into CVE-2024–21626 and Its Counterparts

A file descriptor leak in runC allowed a container to access the host filesystem, and several BuildKit flaws enabled container breakout, arbitrary file deletion, and privilege escalation during builds. An attacker could read or modify host files, delete files outside the container, or run containers with elevated privileges.

elniak Follow

Published on medium.com

In the dynamic landscape of containerized computing, Docker and runC have become fundamental in developing and managing applications efficiently and securely. However, the discovery of critical vulnerabilities, namely CVE-2024–21626, CVE-2024–23651, CVE-2024–23652, and CVE-2024–23653, has raised significant concerns…

ElNiak, on medium.com

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's handling of the working directory, plus race conditions and privilege-check gaps in BuildKit's build process.

Impact

An attacker could read, modify, or delete host files, potentially leading to full host compromise; BuildKit flaws could also cause arbitrary file deletion or privilege escalation during builds.

What the attacker needed

Ability to run a container or build an image; malicious Dockerfile or image; runC version up to 1.1.11 or BuildKit up to 0.12.4

The fix

runC was fixed in version 1.1.12 by ensuring the working directory stays within the container and closing privileged file descriptors; BuildKit fixes were planned for version 0.12.5.

How it was found

  1. Set the container's working directory to a path that resolves through a leaked file descriptor to a host directory.
  2. Run the container (via docker build or docker run) so that the working directory points to the host filesystem.
  3. Access host files (e.g., read /etc/shadow or create files) through the leaked descriptor.

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 host computer. These bugs let a malicious container or Dockerfile break out of that isolation and touch files on the host, which could let an attacker read secrets or take over the machine.

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 elniak

View all

28 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.