Skip to content

Commit c89dcea

Browse files
authored
Merge pull request #1196 from HackTricks-wiki/research_update_src_linux-hardening_privilege-escalation_docker-security_docker-breakout-privilege-escalation_sensitive-mounts_20250727_082412
Research Update Enhanced src/linux-hardening/privilege-escal...
2 parents 43a0ba3 + b2db410 commit c89dcea

File tree

1 file changed

+11
-2
lines changed
  • src/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation

1 file changed

+11
-2
lines changed

src/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation/sensitive-mounts.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ Mounting certain host Unix sockets or writable pseudo-filesystems is equivalent
299299
/run/containerd/containerd.sock # containerd CRI socket
300300
/var/run/crio/crio.sock # CRI-O runtime socket
301301
/run/podman/podman.sock # Podman API (rootful or rootless)
302+
/run/buildkit/buildkitd.sock # BuildKit daemon (rootful)
302303
/var/run/kubelet.sock # Kubelet API on Kubernetes nodes
303304
/run/firecracker-containerd.sock # Kata / Firecracker
304305
```
@@ -332,7 +333,7 @@ When the last process leaves the cgroup, `/tmp/pwn` runs **as root on the host**
332333
### Mount-Related Escape CVEs (2023-2025)
333334

334335
* **CVE-2024-21626 – runc “Leaky Vessels” file-descriptor leak**
335-
runc ≤1.1.11 leaked an open directory file descriptor that could point to the host root. A malicious image or `docker exec` could start a container whose *working directory* is already on the host filesystem, enabling arbitrary file read/write and privilege escalation. Fixed in runc 1.1.12 (Docker ≥25.0.3, containerd ≥1.7.14).
336+
runc ≤ 1.1.11 leaked an open directory file descriptor that could point to the host root. A malicious image or `docker exec` could start a container whose *working directory* is already on the host filesystem, enabling arbitrary file read/write and privilege escalation. Fixed in runc 1.1.12 (Docker ≥ 25.0.3, containerd ≥ 1.7.14).
336337

337338
```Dockerfile
338339
FROM scratch
@@ -343,11 +344,17 @@ When the last process leaves the cgroup, `/tmp/pwn` runs **as root on the host**
343344
* **CVE-2024-23651 / 23653 – BuildKit OverlayFS copy-up TOCTOU**
344345
A race condition in the BuildKit snapshotter let an attacker replace a file that was about to be *copy-up* into the container’s rootfs with a symlink to an arbitrary path on the host, gaining write access outside the build context. Fixed in BuildKit v0.12.5 / Buildx 0.12.0. Exploitation requires an untrusted `docker build` on a vulnerable daemon.
345346

347+
* **CVE-2024-1753 – Buildah / Podman bind-mount breakout during `build`**
348+
Buildah ≤ 1.35.0 (and Podman ≤ 4.9.3) incorrectly resolved absolute paths passed to `--mount=type=bind` in a *Containerfile*. A crafted build stage could mount `/` from the host **read-write** inside the build container when SELinux was disabled or in permissive mode, leading to full escape at build time. Patched in Buildah 1.35.1 and the corresponding Podman 4.9.4 back-port series.
349+
350+
* **CVE-2024-40635 – containerd UID integer overflow**
351+
Supplying a `User` value larger than `2147483647` in an image config overflowed the 32-bit signed integer and started the process as UID 0 inside the host user namespace. Workloads expected to run as non-root could therefore obtain root privileges. Fixed in containerd 1.6.38 / 1.7.27 / 2.0.4.
352+
346353
### Hardening Reminders (2025)
347354

348355
1. Bind-mount host paths **read-only** whenever possible and add `nosuid,nodev,noexec` mount options.
349356
2. Prefer dedicated side-car proxies or rootless clients instead of exposing the runtime socket directly.
350-
3. Keep the container runtime up-to-date (runc ≥1.1.12, BuildKit ≥0.12.5, containerd ≥1.7.14).
357+
3. Keep the container runtime up-to-date (runc ≥ 1.1.12, BuildKit ≥ 0.12.5, Buildah ≥ 1.35.1 / Podman ≥ 4.9.4, containerd ≥ 1.7.27).
351358
4. In Kubernetes, use `securityContext.readOnlyRootFilesystem: true`, the *restricted* PodSecurity profile and avoid `hostPath` volumes pointing to the paths listed above.
352359

353360
### References
@@ -357,6 +364,8 @@ When the last process leaves the cgroup, `/tmp/pwn` runs **as root on the host**
357364
- [https://0xn3va.gitbook.io/cheat-sheets/container/escaping/sensitive-mounts](https://0xn3va.gitbook.io/cheat-sheets/container/escaping/sensitive-mounts)
358365
- [Understanding and Hardening Linux Containers](https://research.nccgroup.com/wp-content/uploads/2020/07/ncc_group_understanding_hardening_linux_containers-1-1.pdf)
359366
- [Abusing Privileged and Unprivileged Linux Containers](https://www.nccgroup.com/globalassets/our-research/us/whitepapers/2016/june/container_whitepaper.pdf)
367+
- [Buildah CVE-2024-1753 advisory](https://github.com/containers/buildah/security/advisories/GHSA-pmf3-c36m-g5cf)
368+
- [containerd CVE-2024-40635 advisory](https://github.com/containerd/containerd/security/advisories/GHSA-265r-hfxg-fhmg)
360369

361370
{{#include ../../../../banners/hacktricks-training.md}}
362371

0 commit comments

Comments
 (0)