agent-security-hardening
AFaffaan-m/ECC278k4,046 new stars in the last 7 days
MCP (Model Context Protocol) 协议安全测试方法论。当目标环境使用 MCP Server 集成外部工具、 需要评估 MCP 工具描述安全性、或测试 Agent 通过 MCP 调用工具时的安全边界时触发。 覆盖: 工具描述投毒、地毯式骗局(动态篡改)、指令覆盖(Shadow Tool)、隐藏指令(ANSI/Unicode)、 跨 Server 攻击、Token 窃取、Schema 操纵、上下文溢出。
MCP (Model Context Protocol) 为 LLM 提供标准化的工具调用接口,但其信任模型存在根本缺陷:模型必须解析工具的完整描述(description)来决定如何调用,而这些描述由 MCP Server 控制。攻击者可通过恶意 Server 在描述中注入指令,劫持模型行为——这比传统 Prompt 注入更隐蔽,因为用户通常不会审查工具描述的原始内容。
| 攻击类型 | 核心机制 | 危害等级 | GAARM 编号 |
|---|---|---|---|
| 工具描述投毒 | description 中嵌入恶意指令 | Critical | GAARM.0046 |
| 地毯式骗局 | 授权后动态篡改 description | Critical | GAARM.0046.001 |
| 指令覆盖 (Shadow Tool) | 恶意 Server 劫持可信工具行为 | Critical | GAARM.0046.002 |
| 隐藏指令注入 | ANSI 转义码/零宽 Unicode 隐写 | High | GAARM.0046.003 |
<IMPORTANT>、[SYSTEM]、HTML 注释等指令标签notifications/tools/list_changed 更新描述,客户端是否在更新时重新请求用户授权\x1b[8m (隐藏文本) 指令,检查终端渲染和模型解析的差异1. [ ] 目标环境连接了哪些 MCP Server?是否包含第三方/未审计 Server?
2. [ ] 工具 description 原始内容是否包含可疑指令标签或编码内容?
3. [ ] 工具描述是否会在授权后发生动态变化?客户端是否重新确认?
4. [ ] 是否存在跨 Server 的工具名称冲突或描述覆盖?
5. [ ] description 中是否嵌入 ANSI 转义码或零宽 Unicode 字符?
6. [ ] 各 Server 的 Token/凭据是否实现了隔离?
7. [ ] 客户端是否对 inputSchema 做严格校验,还是透传给模型?
8. [ ] 工具调用结果是否经过消毒后再返回模型上下文?
AFaffaan-m/ECC278k4,046 new stars in the last 7 days
DIDietrichGebert/ponytail162k5,405 new stars in the last 7 days
DIDietrichGebert/ponytail162k5,405 new stars in the last 7 days
DIDietrichGebert/ponytail162k5,405 new stars in the last 7 days
GAgarrytan/gstack136k883 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills106k3,628 new stars in the last 7 days