performing-container-escape-detection
What it does
This tool checks container configurations in Kubernetes clusters for security flaws that could allow a container to 'escape' and access the host system. It looks for risky settings like privileged access or sensitive directory mounts.
When to use it
- ✓When performing a security audit on a cluster.
- ✓When investigating a security incident.
- ✓Before enabling new security rules.
Skill link
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-container-escape-detection/SKILL.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Scan my Kubernetes cluster for container configurations that allow escape.”
5 new skills a week. 1 minute to read.
How it works
The tool uses the Kubernetes Python library to inspect the settings of each container. It looks for warning signs like 'privileged: true' or volume mounts that grant access to critical system parts.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Performing Container Escape Detection
When to Use
- When conducting security assessments that involve performing container escape detection
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with container security concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
Audit Kubernetes pods for container escape vectors including privileged mode, dangerous capabilities, host namespace sharing, and writable hostPath mounts.
from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
pods = v1.list_pod_for_all_namespaces()
for pod in pods.items:
for container in pod.spec.containers:
sc = container.security_context
if sc and sc.privileged:
print(f"PRIVILEGED: {pod.metadata.namespace}/{pod.metadata.name}")
Key escape vectors:
- Privileged containers (full host access)
- CAP_SYS_ADMIN capability
- Host PID/Network/IPC namespace sharing
- Writable hostPath mounts to / or /etc
- Docker socket mount (/var/run/docker.sock)
Examples
# Check for docker socket mounts
for vol in pod.spec.volumes or []:
if vol.host_path and "docker.sock" in (vol.host_path.path or ""):
print(f"Docker socket exposed: {pod.metadata.name}")
FAQ
What is 'container escape'?
It's when a program running inside a container manages to access or control the operating system of the server where the container is running, which should not be possible.
What are 'capabilities'?
These are special permissions a container can have. Some of them, like CAP_SYS_ADMIN, are very powerful and can be dangerous if misconfigured.
What is a 'hostPath mount'?
It's when a directory from the server (host) is shared with the container. If a sensitive directory like '/' or '/etc' is mounted, the container might gain access to important server files.
Details
Original description by the author
Audits container and pod configuration for escape-enabling misconfiguration using the Kubernetes Python client - privileged flags, dangerous capability grants, host path mounts, shared namespaces, and CVE-2022-0492 style cgroup abuse. Use when sweeping a cluster for workloads that could break out, producing a posture report, or checking configuration before enforcement is switched on. Keywords: pr
Popularity
- GitHub stars
- 35k
- Ranking position
- #8207
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
35kGives your AI agent ready-made instructions for a specific task, so it does it better and faster.
abusing-shadow-credentials-for-privesc
35kTeaches your AI agent to write clear, well-structured text.
achieving-cmmc-level-2-compliance
35kHelps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
acquiring-disk-image-with-dd-and-dcfldd
35kHelps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.