performing-container-escape-detection

Solid

Detects container escape attempts by analyzing namespace configurations, privileged container checks, dangerous capability assignments, and host path mounts using the kubernetes Python client. Identifies CVE-2022-0492 style escapes via cgroup abuse. Use when auditing container security posture or investigating escape attempts.

AI & Automation 36,355 stars 4443 forks Updated 2 months ago Apache-2.0

Install

View on GitHub

Quality Score: 92/100

Stars 20%
100
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
79
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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. ```python 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 ```python # Check for docker socket mounts for vol in pod.spec.volumes or []: if vol.host_path and "docker.sock" in (vol.host_path.path...

Details

Author
mukul975
Repository
mukul975/Anthropic-Cybersecurity-Skills
Created
8 months ago
Last Updated
2 months ago
Language
Python
License
Apache-2.0

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

detecting-container-escape-attempts

Container escape is a critical attack technique where an adversary breaks out of container isolation to access the host system or other containers. Detection involves monitoring for escape indicators

36,355 Updated 2 months ago
mukul975
DevOps & Infrastructure Listed

detect-container-escape

Detection, hunting, and hardening for container escape to the host (MITRE ATT&CK T1611 Escape to Host, Privilege Escalation; related T1610 Deploy Container and T1613 Container and Resource Discovery). Keys off Linux auditd syscall records, CNCF Falco and eBPF runtime sensors, and the Kubernetes kube-apiserver audit log to catch namespace breakout, privileged or sensitive-mount workloads, capability abuse, and host-namespace process execution. Gives the defender view, the exact log sources and fields, a prose detection approach pointing to public rule sources, a hypothesis-driven hunt, seccomp and capability hardening, and the honest blind spots. Use when detecting or hunting container escape, investigating a shell spawned in a container, triaging a privileged pod or hostPath mount alert, monitoring seccomp and Linux capabilities on container hosts, or hardening Docker and Kubernetes against breakout to the node.

0 Updated 5 days ago
umbrasec-labs
DevOps & Infrastructure Featured

container-k8s-escape

Use when breaking out of a container or escalating inside Kubernetes — runc/BuildKit CVEs, privileged/capability/cgroup misconfig escapes, NVIDIA GPU toolkit escape, K8s RBAC abuse, kubelet RCE, ingress/admission-controller RCE, node-to-cluster pivot

421 Updated 3 weeks ago
hypnguyen1209