KGT24k/mcp-config-guard

GitHub: KGT24k/mcp-config-guard

一款零依赖的 MCP 配置文件安全检测工具,通过 54 项 OWASP 映射检查和恶意软件数据库,在 MCP server 启动前拦截供应链攻击和配置漏洞。

Stars: 2 | Forks: 0

# MCP Config Guard **零依赖的 MCP 配置安全 Linter。** 在任何 MCP server 启动之前,扫描您的 `.mcp.json` 以检测 54 种安全漏洞。无需 API keys。无需云端。无需 LLM。 [![PyPI version](https://badge.fury.io/py/mcp-config-guard.svg)](https://pypi.org/project/mcp-config-guard/) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](https://pypi.org/project/mcp-config-guard/) ## 为什么? **43% 的公共 MCP server 存在命令注入漏洞**(BlueRock TechReport 2026)。您使用的每一个 MCP 配置都是一个信任边界——而大多数开发者从未审计过它们。 Config Guard 能捕捉到人类容易忽略的问题: - 伪装成真实包的 Typosquat(拼写模仿)包 - 具有已知 CVE 的 server(20 个包中存在 22 个 CVE) - 44 个已确认的恶意包(JFrog, Kaspersky, Lazarus APT, SANDWORM_MODE) - 环境变量中的 secrets 泄露 - Rug-pull(撤资)向量(`npx @latest` 自动更新) - 通过 tunnels 暴露的 Shadow servers ## 安装 ``` pip install mcp-config-guard ``` ## 快速开始 ``` # 扫描当前目录的 .mcp.json mcp-config-guard # 扫描特定项目 mcp-config-guard --path /my/project # 自动发现系统上的所有 MCP configs mcp-config-guard --discover # CI/CD 集成 (用于 GitHub Code Scanning 的 SARIF output) mcp-config-guard --sarif > results.sarif # 用于脚本编写的 JSON output mcp-config-guard --json ``` ## 54 项安全检查 每项检查都映射到 [OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/) 和 [OWASP Agentic Security Top 10](https://owasp.org/www-project-agentic-security/)。有关完整的 CWE 映射,请参阅 [docs/OWASP-MAPPING.md](docs/OWASP-MAPPING.md)。 | # | 检查项 | 风险 | OWASP | |---|-------|------|-------| | 1 | 网络暴露(非 localhost URLs) | HIGH | MCP-03 | | 2 | Rug pulls(`npx @latest` 自动更新) | HIGH | MCP-07 | | 3 | Secret 泄露(args/env 中的 API keys) | HIGH | MCP-04 | | 4 | 命令注入(`shell=True`) | CRITICAL | MCP-01 | | 5 | 路径穿越(参数中包含 `..`) | MEDIUM | MCP-05 | | 6 | Typosquat 检测(Levenshtein 距离) | HIGH | MCP-07 | | 7 | 危险权限(`--no-sandbox`, `sudo`) | HIGH | MCP-06 | | 8 | HTTP transport 缺少身份验证 | MEDIUM | MCP-08 | | 9 | 敏感路径访问(`.ssh`, `.aws`, `.env`) | HIGH | MCP-04 | | 10 | 过于宽泛的文件系统访问(`/`, `C:\`) | MEDIUM | MCP-06 | | 11 | 环境变量泄露(硬编码 secrets) | MEDIUM | MCP-04 | | 12 | server 数量过多(攻击面) | LOW | MCP-10 | | 13 | 已知 CVE(20 个包中存在 22 个 CVE) | CRITICAL | MCP-09 | | 14 | Symlink 绕过(CVE-2025-53109) | HIGH | MCP-05 | | 15 | Shadow servers(ngrok, cloudflared, `0.0.0.0`) | HIGH | MCP-05 | | 16 | 代码执行(`eval`/`exec` 模式) | CRITICAL | MCP-01 | | 17 | 已知恶意包(44 个已确认 malware) | CRITICAL | MCP-07 | | 18 | 已弃用的 SSE transport(无 per-request auth) | MEDIUM | MCP-03 | | 19 | Shell servers(将原生 shell 作为 MCP server) | CRITICAL | MCP-01 | | 20 | 未锁定版本的包(npx/uvx 不带版本号) | MEDIUM | MCP-04 | ## CVE 数据库 Config Guard 跟踪已知的存在漏洞的 MCP 包: | Package | CVE | 严重程度 | |---------|-----|----------| | `mcp-remote` | CVE-2025-6514 | Critical (CVSS 9.6) | | `@modelcontextprotocol/server-git` | CVE-2025-68145 | Critical | | `mcp-server-git` | CVE-2026-27735 | Medium | | `@anthropic/mcp-server-filesystem` | CVE-2025-53109 | High | | `gemini-mcp-tool` | CVE-2026-0755 | Critical | | `mcp-vegalite-server` | CVE-2026-1977 | Critical | | `github-kanban-mcp` | CVE-2026-0756 | High | | `godot-mcp` | CVE-2026-25546 | High | | `fermat-mcp` | CVE-2026-2008 | Critical | | `@anthropic/mcp-inspector` | CVE-2026-23744 | Critical (CVSS 9.8) | Config Guard 还能检测**已确认的恶意包**(例如 `postmark-mcp`, `@lanyer640/mcp-runcommand-server`),这些包包含 reverse shells 或 malware payloads。 ## 输出格式 ### 人类可读(默认) ``` MCP Security Scan Results ```
标签:AI安全, Chat Copilot, CI/CD安全, Claude, CVE检测, Defensive, DNS 反向解析, Homebrew安装, Linter, Llama, LLM工具, LNA, MCP, pptx, Python, SARIF, SAST, Typosquatting, 依赖安全, 命令注入, 提示注入检测, 文档安全, 文档结构分析, 无后门, 模型上下文协议, 盲注攻击, 逆向工具, 错误基检测, 零依赖, 静态代码分析