Skip to content
Skillpedia
Deploy & cloud (DevOps)35k · #6044

performing-container-escape-detection

Teaches your AI agent to ship projects and manage infrastructure.

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.

Example of what to ask your AI

“Scan my Kubernetes cluster for container configurations that allow escape.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-container-escape-detection/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-container-escape-detection/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
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.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-container-escape-detection

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/performing-container-escape-detection/SKILL.md -o SKILL.md
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:

  1. Privileged containers (full host access)
  2. CAP_SYS_ADMIN capability
  3. Host PID/Network/IPC namespace sharing
  4. Writable hostPath mounts to / or /etc
  5. 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

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#6044
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills