K8s Sidecar Attack logo

K8s Sidecar Attack

OrganizationPopular
wgpsec
k8s-sidecar-attack

Kubernetes Sidecar 容器流量劫持与敏感信息窃取。当目标 Pod 存在 Istio/Envoy/Linkerd sidecar、题目提到'隐形旁观者'或'共享网络'、或需要从 Pod 内部嗅探流量时使用。覆盖 tcpdump 抓包、sidecar 明文流量捕获、共享网络命名空间利用。只要在 K8s Pod 中发现有 sidecar 或多容器共存的迹象,就应使用此技能

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namek8s-sidecar-attack
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 Sidecar Attack 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-sidecar-attack .claude/skills/k8s-sidecar-attack
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable K8s Sidecar Attack 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 Sidecar Attack 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 Sidecar Attack 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 Sidecar 流量劫持

同一 Pod 内的所有容器共享网络命名空间——这是 K8s 的设计决定,也是攻击者的福音。Sidecar 容器(如 Istio Envoy)发送的流量可以被同 Pod 的任何容器通过 tcpdump 直接抓取,因为它们共享同一张网卡。

Pod 网络命名空间(共享)
┌──────────────────────────────────┐
│  [你的容器]  ←── 同一网卡 ──→  [Sidecar]  │
│       ↓                        ↓       │
│    tcpdump 能抓到 sidecar 的所有流量        │
└──────────────────────────────────┘

Phase 1: 检测 Sidecar

bash
# 最可靠:看进程列表中有没有 envoy / pilot-agent / linkerd-proxy
ps aux 2>/dev/null | grep -E 'envoy|pilot-agent|linkerd'
# 看到 envoy 或 pilot-agent → 确认 Istio sidecar 存在

# 环境变量(Istio 注入后会设置这些)
env | grep -i istio
# ISTIO_META_* 开头的变量 → 确认 Istio

# 网络接口(辅助判断,不能单独确认)
ip addr
# 看到 istio0 / lo 以外的多个接口 → 可能有 sidecar,需结合上面确认

# DNS 配置
cat /etc/resolv.conf  # search 行包含 istio 相关条目

Phase 2: 流量抓包

Sidecar 内部通常使用 HTTP 明文通信(mTLS 在 Envoy 层终止后再转发),所以 tcpdump 能直接看到请求内容。

基本抓包

bash
# 全流量抓包(-A 显示 ASCII,能直接看到 HTTP 内容)
tcpdump -A -vvv

# 只抓 HTTP 流量(减少噪音)
tcpdump -A -s 0 'tcp port 80 or tcp port 8080'

# 直接过滤敏感关键词
tcpdump -A -s 0 | grep -i -A5 'flag\|secret\|password\|token\|key'

# 保存 pcap 后续用 Wireshark 分析
tcpdump -w /tmp/capture.pcap -c 1000

针对性抓包

bash
# 抓特定服务的流量
tcpdump -A host <target-service-ip>

# 抓 POST 请求体(通常 credential 在 POST body 里)
tcpdump -A -s 0 'tcp dst port 80' | grep -A 20 'POST'

Phase 3: 分析结果

抓到的流量中寻找:

  1. HTTP 请求/响应体 — flag、token、credential
  2. Authorization Header — Bearer token、Basic auth
  3. Cookie — session ID
  4. POST body — 表单数据、JSON payload
  5. Service 间通信 — 内部 API 调用暴露的敏感数据

无 tcpdump 时的替代方案

bash
# 查看当前活跃连接(推断有哪些服务在通信)
cat /proc/net/tcp
cat /proc/net/tcp6
ss -tlnp
netstat -tlnp 2>/dev/null

# 如果有 socat,可以做端口转发中间人抓取经过的流量
socat -v TCP-LISTEN:8080,fork TCP:<target-svc>:80
# -v 会在 stderr 打印双向流量内容

注意事项

  • 流量可能是周期性的(cron job、定时上报),需要持续监听至少 30-60 秒
  • 关注 reporting-servicemetricswebhook 等命名的服务请求
  • 如果抓到的全是加密流量,说明 mTLS 没在 sidecar 层终止——换思路,尝试 Skill(skill="k8s-istio-bypass") 绕过策略

相关技能

  • 还没做服务发现?先 Skill(skill="k8s-network-recon") 确定有哪些服务
  • 发现 Istio AuthorizationPolicy 阻拦 → Skill(skill="k8s-istio-bypass")
  • 发现 NFS/EFS 挂载 → Skill(skill="k8s-storage-exploit")

Frequently asked questions

What does the K8s Sidecar Attack AI skill do?

Kubernetes Sidecar 容器流量劫持与敏感信息窃取。当目标 Pod 存在 Istio/Envoy/Linkerd sidecar、题目提到'隐形旁观者'或'共享网络'、或需要从 Pod 内部嗅探流量时使用。覆盖 tcpdump 抓包、sidecar 明文流量捕获、共享网络命名空间利用。只要在 K8s Pod 中发现有 sidecar 或多容器共存的迹象,就应使用此技能

Why use K8s Sidecar Attack on TypingMind?

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

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

Which AI models can use K8s Sidecar Attack?

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 Sidecar Attack?

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

Is the K8s Sidecar Attack 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 👇