Mcp Security logo

Mcp Security

OrganizationPopular
wgpsec
mcp-security

MCP (Model Context Protocol) 协议安全测试方法论。当目标环境使用 MCP Server 集成外部工具、 需要评估 MCP 工具描述安全性、或测试 Agent 通过 MCP 调用工具时的安全边界时触发。 覆盖: 工具描述投毒、地毯式骗局(动态篡改)、指令覆盖(Shadow Tool)、隐藏指令(ANSI/Unicode)、 跨 Server 攻击、Token 窃取、Schema 操纵、上下文溢出。

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namemcp-security
Stars
1.7K
Forks
242
Bundled files
1
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.

  • 1 bundled files

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

  • Open source

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

Installation

Install the Mcp Security 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/ai-security/mcp-security .claude/skills/mcp-security
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mcp Security 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 Mcp Security 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 Mcp Security 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.

MCP 协议安全测试方法论

概述

MCP (Model Context Protocol) 为 LLM 提供标准化的工具调用接口,但其信任模型存在根本缺陷:模型必须解析工具的完整描述(description)来决定如何调用,而这些描述由 MCP Server 控制。攻击者可通过恶意 Server 在描述中注入指令,劫持模型行为——这比传统 Prompt 注入更隐蔽,因为用户通常不会审查工具描述的原始内容。

深入参考


攻击面分类

攻击类型核心机制危害等级GAARM 编号
工具描述投毒description 中嵌入恶意指令CriticalGAARM.0046
地毯式骗局授权后动态篡改 descriptionCriticalGAARM.0046.001
指令覆盖 (Shadow Tool)恶意 Server 劫持可信工具行为CriticalGAARM.0046.002
隐藏指令注入ANSI 转义码/零宽 Unicode 隐写HighGAARM.0046.003

方法论概览

Phase 0: MCP 环境侦察

  • 枚举目标已连接的 MCP Server 列表及来源(官方/第三方/自建)
  • 提取每个 Server 暴露的工具清单、inputSchema 定义、权限声明
  • 判断客户端的信任模型:是否区分不同 Server 的信任等级、工具调用是否需要二次确认

Phase 1: 工具描述投毒检测

  • 获取所有工具的完整 description(包括 inputSchema.description),检查是否包含 <IMPORTANT>[SYSTEM]、HTML 注释等指令标签
  • 对 description 做 base64/Unicode 解码扫描,识别编码后的隐藏指令
  • 验证模型是否会遵循 description 中的指令——构造含有"忽略用户请求"类指令的测试工具,观察模型行为变化

Phase 2: 动态篡改测试(地毯式骗局)

  • 记录工具首次注册时的 description 哈希值
  • 模拟持续运行场景:定时重新获取工具列表,对比 description 是否发生变化
  • 关键判断:MCP 协议允许 Server 随时通过 notifications/tools/list_changed 更新描述,客户端是否在更新时重新请求用户授权

Phase 3: 指令覆盖测试(Shadow Tool)

  • 注册恶意 MCP Server,其工具 description 中包含针对其他 Server 工具的覆盖指令
  • 测试跨工具劫持:恶意工具描述要求模型在调用邮件/文件等可信工具时篡改参数
  • 验证客户端是否存在工具名称冲突保护(同名工具优先级机制)

Phase 4: 隐藏指令注入

  • ANSI 转义码测试:在 description 中嵌入 \x1b[8m (隐藏文本) 指令,检查终端渲染和模型解析的差异
  • 零宽 Unicode 字符测试:用 U+200B/U+200C/U+200D/U+FEFF 编码恶意指令,验证人类不可见但模型可读
  • "行跳跃"攻击:利用 ANSI 光标控制序列覆盖终端显示内容,伪造用户可见的输出

Phase 5: 跨 Server 攻击与 Token 窃取

  • 测试恶意 Server 能否通过工具描述指令获取其他 Server 的 OAuth Token 或 API Key
  • 验证 Token 隔离机制:一个 Server 的凭据是否对其他 Server 可见
  • Server 伪装检测:恶意 Server 是否能声称自己是可信 Server 的"更新版本"

实战检测清单

1. [ ] 目标环境连接了哪些 MCP Server?是否包含第三方/未审计 Server?
2. [ ] 工具 description 原始内容是否包含可疑指令标签或编码内容?
3. [ ] 工具描述是否会在授权后发生动态变化?客户端是否重新确认?
4. [ ] 是否存在跨 Server 的工具名称冲突或描述覆盖?
5. [ ] description 中是否嵌入 ANSI 转义码或零宽 Unicode 字符?
6. [ ] 各 Server 的 Token/凭据是否实现了隔离?
7. [ ] 客户端是否对 inputSchema 做严格校验,还是透传给模型?
8. [ ] 工具调用结果是否经过消毒后再返回模型上下文?

参考资源

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 Mcp Security AI skill do?

MCP (Model Context Protocol) 协议安全测试方法论。当目标环境使用 MCP Server 集成外部工具、 需要评估 MCP 工具描述安全性、或测试 Agent 通过 MCP 调用工具时的安全边界时触发。 覆盖: 工具描述投毒、地毯式骗局(动态篡改)、指令覆盖(Shadow Tool)、隐藏指令(ANSI/Unicode)、 跨 Server 攻击、Token 窃取、Schema 操纵、上下文溢出。

Why use Mcp Security on TypingMind?

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

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/ai-security/mcp-security. 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 Mcp Security?

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 Mcp Security?

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

Is the Mcp Security 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 👇