.. / CVE-2024-21626

Exploit for runc <= 1.1.11 Container Escape - Local Privilege Escalation (CVE-2024-21626)

Description:

runc is a CLI tool for spawning and running containers on Linux according to the OCI specification. In runc 1.1.11 and earlier, due to an internal file descriptor leak, an attacker could cause a newly-spawned container process (from runc exec) to have a working directory in the host filesystem namespace, allowing for a container escape by giving access to the host filesystem (“attack 2”). The same attack could be used by a malicious image to allow a container process to gain access to the host filesystem through runc run (“attack 1”). Variants of attacks 1 and 2 could be also be used to overwrite semi-arbitrary host binaries, allowing for complete container escapes (“attack 3a” and “attack 3b”). runc 1.1.12 includes patches for this issue.

Proof of Concept

PoC exploit

Try the exploit in a lab environment:

Lab Machine Link
Hack The Box Runner Go to Practice

References:

https://nvd.nist.gov/vuln/detail/CVE-2024-21626
https://snyk.io/blog/cve-2024-21626-runc-process-cwd-container-breakout/
https://packetstormsecurity.com/files/176993/runc-1.1.11-File-Descriptor-Leak-Privilege-Escalation.html
https://github.com/opencontainers/runc/commit/02120488a4c0fc487d1ed2867e901eeed7ce8ecf
https://github.com/opencontainers/runc/releases/tag/v1.1.12
https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv