Container K8s Escape logo

Container K8s Escape

Community
hypnguyen1209
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

Overview

Publisherhypnguyen1209
Repositoryoffensive-claude
Skill namecontainer-k8s-escape
Stars
396
Forks
71
Bundled files
12
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 12 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by hypnguyen1209 on GitHub. Read the source before you install it.

Installation

Install the Container K8s Escape AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/hypnguyen1209/offensive-claude/tree/main/skills/container-k8s-escape
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hypnguyen1209/offensive-claude.git /tmp/offensive-claude
mkdir -p .claude/skills
cp -r /tmp/offensive-claude/skills/container-k8s-escape .claude/skills/container-k8s-escape
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Container K8s Escape in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Container K8s Escape on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Container K8s Escape is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Container Breakout & Kubernetes Escape

When to Activate

  • You have code execution inside a container/pod and want to break out to the host node
  • Auditing a Kubernetes cluster for RBAC privilege-escalation and lateral-movement paths
  • Assessing runc/containerd/BuildKit/Docker runtime versions against known escape CVEs
  • A pod is privileged, has dangerous capabilities, hostPath/hostPID/hostNetwork, or a mounted docker.sock
  • Attacking GPU/AI workloads using the NVIDIA Container Toolkit
  • Testing ingress-nginx / admission-controller exposure for unauthenticated RCE
  • Post-escape: pivoting from one node to full cluster takeover (kubelet, SA tokens, etcd, cloud IMDS)
  • Building Falco/Sigma detections for container-escape behavior (defensive validation)

Technique Map

TechniqueATT&CKCWEReferenceScript
runc working-dir fd leak escape (Leaky Vessels, CVE-2024-21626)T1611CWE-403references/runtime-cve-escapes.mdscripts/runc_cwd_escape.py
runc masked-path / /dev/null symlink escape (CVE-2025-31133)T1611CWE-367references/runtime-cve-escapes.mdscripts/runc_cwd_escape.py
runc /dev/console bind-mount + LSM bypass (CVE-2025-52565/52881)T1611CWE-363references/runtime-cve-escapes.mdscripts/escape_enum.sh
BuildKit cache/teardown symlink escape (CVE-2024-23651/52/53)T1611CWE-59references/runtime-cve-escapes.mdscripts/escape_enum.sh
Privileged / CAP_SYS_ADMIN cgroup release_agent escapeT1611CWE-269references/privileged-misconfig-escape.mdscripts/release_agent_escape.sh
core_pattern host-side code exec on crashT1611CWE-269references/privileged-misconfig-escape.mdscripts/release_agent_escape.sh
hostPID + nsenter into PID 1 namespaceT1611CWE-668references/privileged-misconfig-escape.mdscripts/escape_enum.sh
Mounted docker.sock / containerd.sock host takeoverT1610CWE-668references/privileged-misconfig-escape.mdscripts/escape_enum.sh
hostPath / mount → write host filesystemT1611CWE-22references/privileged-misconfig-escape.mdscripts/escape_enum.sh
NVIDIAScape LD_PRELOAD OCI-hook escape (CVE-2025-23266)T1611CWE-426references/nvidia-gpu-escape.mdscripts/nvidiascape_build.sh
NVIDIA CT TOCTOU mount escape (CVE-2024-0132 / CVE-2025-23359)T1611CWE-367references/nvidia-gpu-escape.mdscripts/nvidiascape_build.sh
K8s RBAC privesc (verb/wildcard/escalate, SA token theft)T1078.001CWE-269references/k8s-rbac-escalation.mdscripts/k8s_rbac_audit.py
nodes/proxy GET → kubelet WebSocket exec RCET1609CWE-863references/k8s-rbac-escalation.mdscripts/kubelet_exec.py
Anonymous/authed kubelet API exec on :10250T1609CWE-306references/k8s-rbac-escalation.mdscripts/kubelet_exec.py
IngressNightmare unauth RCE (CVE-2025-1974 + annotation chain)T1190CWE-94references/ingress-admission-attacks.mdscripts/escape_enum.sh
Node → cluster pivot (etcd, IMDS, SA-token harvest)T1613CWE-552references/node-host-pivot.mdscripts/escape_enum.sh

Quick Start

bash
# 0. Enumerate the container/pod context: caps, mounts, sockets, runtime versions, K8s creds
bash scripts/escape_enum.sh                 # run INSIDE the target container

# 1. Runtime-CVE path: detect vulnerable runc/BuildKit and run the cwd-fd escape (CVE-2024-21626)
python3 scripts/runc_cwd_escape.py --probe                       # try fd 7,8,9 -> host /
python3 scripts/runc_cwd_escape.py --cmd 'id; cat /etc/shadow'   # via docker -w or k8s revshell

# 2. Misconfig path: privileged / CAP_SYS_ADMIN -> cgroup release_agent host code exec
bash scripts/release_agent_escape.sh -c 'id > /tmp/escape_out'   # reads host PID list / runs cmd

# 3. GPU path: build a malicious image for NVIDIAScape (CVE-2025-23266)
bash scripts/nvidiascape_build.sh --cmd 'id; cat /etc/shadow' --tag evil-gpu:latest

# 4. K8s RBAC: audit who can escalate / reach the kubelet (needs a kubeconfig or in-pod SA token)
python3 scripts/k8s_rbac_audit.py --kubeconfig ~/.kube/config --dangerous

# 5. nodes/proxy or open kubelet -> exec into any pod on the node
python3 scripts/kubelet_exec.py --node 10.0.0.5 --pod kube-system/etcd-master \
        --container etcd --cmd 'cat /var/lib/etcd/...' --token "$SA_TOKEN"

Recommended tooling: deepce / cdk / amicontained (in-container recon), peirates (K8s pivot), kube-hunter (cluster scan), kubeletctl (kubelet API), crictl (post-escape node control), falco (defensive validation of every technique below).

OPSEC & Detection (summary)

TechniqueTelemetry / IOCDetection (Sigma/EDR/Falco)OPSEC note
runc cwd-fd escape (CVE-2024-21626)container process cwd under /proc/self/fd/N; getcwd ENOENT errors; host-path access from pid1Falco Container Drift/unexpected host-fs read; alert on runtime < runc 1.1.12No new files needed; works via -w/cwd only — very quiet, but lands on real host fs
runc 2025 trio (masked-path/console)symlink swap of /dev/null or /dev/pts/N; RW open of /proc/sysrq-trigger/core_patternFalco "Write below /proc/sys"/sysrq; mount race anomaliesSymlink swap is a timing race; on failure may crash host (sysrq) — loud
release_agent / core_patternmount of cgroup/cgroup2; write to */release_agent or /proc/sys/kernel/core_patternFalco Detect release_agent File Container Escapes; Sigma on write to core_patternRequires CAP_SYS_ADMIN+mount; release_agent is cgroup-v1 only
nsenter / hostPIDnsenter --target 1; process entering host mount/pid nsFalco "nsenter" / proc.name=nsenter in container; ATT&CK T1611hostPID is visible in pod spec; nsenter is a strong IOC
docker.sock abuse/var/run/docker.sock mounted; curl --unix-socket create privileged containerFalco "Docker socket access by unexpected proc"; new privileged container eventSpawns a new privileged container — visible to docker/containerd events
NVIDIAScape (CVE-2025-23266)image ENV LD_PRELOAD=/proc/self/cwd/*.so; nvidia hook loads .so from container fsFalco shared-lib load by nvidia-ctk/hook from container pathNeeds only image push + run; no kernel bug — image scan catches the ENV
nodes/proxy → kubelet execWebSocket GET to kubelet /exec//run on :10250; no API-server audit entryRuntime/L7 only — invisible to API audit & GuardDuty; monitor kubelet access logBypasses API-server audit & admission entirely — extremely stealthy
K8s RBAC privesc / SA-token theftread of /var/run/secrets/.../token; can-i probes; bind to cluster-adminAPI audit create rolebindings/escalate; Falco Read SA tokenkubectl auth can-i probing is logged at API server
IngressNightmare (CVE-2025-1974)AdmissionReview with injected NGINX directive; .so loaded from /proc/<pid>/fdSysdig/Falco "IngressNightmare"; shared-lib load from /proc in nginxCode runs during nginx -t validation; controller SA grabs all-namespace secrets

Deep Dives

  • references/runtime-cve-escapes.md — runc CVE-2024-21626 (working-dir fd leak), the Nov-2025 runc trio (CVE-2025-31133/52565/52881 masked-path & /dev/console), and the BuildKit Leaky Vessels CVEs, with full PoCs and version matrices.
  • references/privileged-misconfig-escape.md — --privileged/capability escapes: cgroup-v1 release_agent, core_pattern, hostPID+nsenter, mounted docker/containerd sockets, and hostPath// mounts, with complete scripts.
  • references/nvidia-gpu-escape.md — NVIDIAScape (CVE-2025-23266 LD_PRELOAD OCI-hook) and the CVE-2024-0132 / CVE-2025-23359 TOCTOU mount escapes in the NVIDIA Container Toolkit; build-and-run PoCs.
  • references/k8s-rbac-escalation.md — RBAC privilege escalation (wildcards, escalate/bind, pods/exec, impersonation), SA-token harvest, the nodes/proxy GET → kubelet WebSocket exec RCE, and open kubelet :10250.
  • references/ingress-admission-attacks.md — IngressNightmare (CVE-2025-1974 + the annotation-injection chain), admission-webhook abuse, and how a controller SA leads to cluster-wide secret theft.
  • references/node-host-pivot.md — post-escape playbook: from one node to the whole cluster — etcd looting, kubelet/crictl, SA-token mining across pods, cloud IMDS role theft, and the defensive counterweight.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Container K8s Escape AI skill do?

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

Why use Container K8s Escape on TypingMind?

Because you install it once and use it with any model. Container K8s Escape is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Container K8s Escape in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/hypnguyen1209/offensive-claude/tree/main/skills/container-k8s-escape. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Container K8s Escape?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Container K8s Escape?

As many as you like. As long as a model supports skills, you can use Container K8s Escape with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Container K8s Escape AI skill free?

Yes. It is published on GitHub by hypnguyen1209 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇