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

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.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/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.
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

“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:

  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
#8207
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