Skip to content
RCE Write-up Advanced

CVE-2019-5736: runc container breakout

A malicious container could overwrite the host's runc binary and gain root-level code execution on the host, requiring only that a command be run as root inside the container. This affects creating a new container from an attacker-controlled image or attaching to an existing container the attacker had write access to.

seclists.org

Published on seclists.org

I am one of the maintainers of runc (the underlying container runtime underneath Docker, cri-o, containerd, Kubernetes, and so on). We recently had a vulnerability reported which we have verified and have a patch for.

The author, on seclists.org

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 exposure flaw in runc's nsenter helper that allowed a container process to write to the host's runc binary through /proc/self/exe.

Impact

An attacker could gain root-level code execution on the host, though the exploit is blocked by correct use of user namespaces and by some SELinux policies.

What the attacker needed

Ability to run a command as root in a container; attacker-controlled image or write access to container

The fix

The issue was fixed by a patch to runc (and a similar patch for LXC).

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 main computer (the host). Here, a flaw let a program inside a container replace a key host program (runc) and then run commands as the all-powerful root user on the host. The attacker only needed to get a command run as root inside the container, for example by using a malicious container image.

What is RCE?

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

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.