AI代理安全扫描工具

agentwise是一款快速的离线安全扫描工具,专为AI代理配置设计,能够检测MCP服务器和AI代理的漏洞与配置错误。

  • by brandonwise
  • Rust
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 brandonwise/agentwise

使用说明

agentwise

The fast, offline security scanner for AI agent configurations.


思考 npm audit,但适用于MCP服务器和AI代理。

$ agentwise scan .

  ╔══════════════════════════════════════════════════════════════╗
  ║  agentwise v0.1.0                                          ║
  ║  MCP Security Scanner                                      ║
  ╚══════════════════════════════════════════════════════════════╝

  ● Scanned 3 configs (12 servers) in 4ms

  ┌──────────────────────────────────────────────────────────────┐
  │  ■ 3 critical  ■ 5 high  ■ 7 medium  ■ 0 low               │
  └──────────────────────────────────────────────────────────────┘

  ✖ CRITICAL  .mcp.json → filesystem  AW-002
    Filesystem server with dangerous root access
    Fix: Add "allowedDirectories" to restrict to project directories

  ✖ CRITICAL  .mcp.json → quickbooks  AW-001
    No authentication on remote MCP server
    Fix: Add authentication via env vars (AUTH_TOKEN, API_KEY, etc.)

  ▲ HIGH      .mcp.json → filesystem  AW-006
    CVE-2025-53110: Path traversal in server-filesystem <0.6.3
    Fix: Upgrade to >=0.6.3

  ╔══════════════════════════════════════════════════════════════╗
  ║  Score: 12/100  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  Grade: F   ║
  ╚══════════════════════════════════════════════════════════════╝

运作原理

为什么是代理?

在过去60天内,针对MCP服务器的CVE超过30个。36%的MCP服务器提供零身份验证。您的AI代理设置可能存在漏洞。

每个现有的扫描器都是Python、JavaScript或TypeScript。他们需要 pip install 或 npm install,提取了数十个依赖项,并且有些依赖项需要每次扫描都要花钱的LLM API调用。

agentwise Snyk代理扫描 Cisco mcp扫描器 mcp屏蔽
语言 Rust Python Python TypeScript
安装 单二进制 pip/uvx pip npm
速度等级 毫秒 秒 秒
离线 是 否 否 是
EPSS评分 是 否 否 无
供应链 是 否 否 不
deps.dev 是 否 否 不

性能(测量)

在macOS arm64上测量,发布版本,使用 hyperfine.

代理扫描延迟

命令 平均时间
agentwise scan testdata/vulnerable-mcp.json (5台服务器) 3.2毫秒
agentwise scan research/configs/ (109台服务器) 3.9毫秒

快速头对头(相同的易损夹具)

工具 平均运行时间
agentwise 3.1毫秒
思科 mcp-scanner (--analyzers yara) 2.68秒
mcp-shield (默认运行) 60.62秒

笔记:

  • 这些是同一设备上的默认CLI运行(testdata/vulnerable-mcp.json).
  • 一些工具通过设计尝试实时服务器连接,这增加了运行时间。
  • 使用中的基准命令在本地复制 research/benchmarks.md.

真实世界的调查结果快照

从扫描 109个MCP服务器条目 从公开的GitHub配置+官方文档中收集:

  • 共发现130项 (13高,117中)
  • 100% 缺少刀具列表(AW-007)
  • 8.26% 具有不受限制的文件系统访问权限(AW-002)
  • 1.83% 暴露的硬编码秘密(AW-004)
  • 不安全的明文传输和通配符绑定暴露(http://, ws://, 0.0.0.0, [::])仍然出现在公开场合(AW-005)

完整的方法论、来源归因和原始输出都在 research/FINDINGS.md 和 research/scan-results.json.

信任信号

  • 4.0 MB 发布二进制文件
  • 273/273测试通过
  • 0个简短的警告 随着 -D warnings
  • 0个已知的Rust依赖漏洞 (cargo audit)

安装

来自crates.io(即将推出)

agentwise 尚未在crates.io上发布。

立即安装Cargo

cargo install --git https://github.com/brandonwise/agentwise agentwise

立即从源代码构建

git clone https://github.com/brandonwise/agentwise
cd agentwise
cargo build --release
./target/release/agentwise --version

预构建二进制文件

curl -sSf https://raw.githubusercontent.com/brandonwise/agentwise/main/install.sh | sh

Homebrew

brew tap brandonwise/tap
brew install agentwise

扫描工作流程

快速开始

# Scan current directory (auto-detects MCP configs)
agentwise scan .

# Scan a specific config file
agentwise scan ~/.mcp.json

# Scan a Codex MCP config
agentwise scan ~/.codex/config.toml

# Live mode: query OSV + EPSS for real-time CVE data
agentwise scan . --live

# Supply chain analysis (npm registry + deps.dev)
agentwise scan . --supply-chain

# Fail CI on high+ severity findings
agentwise scan . --fail-on high

# Produce a Markdown report with remediation priorities
agentwise scan . --format markdown --output agentwise-report.md

支持的配置

agentwise自动检测和扫描:

  • .mcp.json --Claude Code项目级配置
  • claude_desktop_config.json --克劳德桌面
  • .cursor/mcp.json --光标编辑器
  • ~/.codex/config.toml 和 .codex/config.toml --Codex命令行界面+集成开发环境
  • mcp.json --通用MCP配置
  • 任何JSON文件 mcpServers 或 context_servers 作为论据通过
  • 任何法典 config.toml 随着 [mcp_servers.<name>] 作为参数传递的表

报告还包括补救优先级部分。它将发现分为现在修复、下一步计划和监控通道,这样产品和安全所有者就可以决定先清理什么,而无需手动整理原始发现。

威胁覆盖范围

检测规则

13条内置规则,涵盖配置错误、已知CVE、主机控制风险和供应链风险:

ID 规则 严重性
AW-001 远程服务器上没有身份验证 严重
AW-002 过度许可的文件系统访问 严重
AW-003 无限制的shell/exec访问 关键
AW-004 明文配置中的秘密 高
AW-005 传输不安全或通配符绑定暴露(http://, ws://, 0.0.0.0, [::]) 高
AW-006 已知CVE匹配(嵌入式+OSV) 严重/高
AW-007 缺少刀具列表 中等
AW-008 无需选择加入即可编写工具 中等
AW-009 无限制网络/获取工具 中等
AW-010 快速注射表面 中等
AW-011 供应链风险信号 高/中
AW-012 深度依赖链(deps.dev) 高/中
AW-013 Docker套接字或特权主机控制 严重/高

实时模式

这个 --live 标记查询 OSV.dev 用于实时漏洞数据和 第一个EPSS 用于计算开采概率得分。这告诉你 什么 易受攻击,但 可能性多大 它将在野外被利用。

$ agentwise scan . --live

  ...

  ▲ HIGH      .mcp.json → filesystem  AW-006 [LIVE]
    CVE-2025-53110: Path traversal in server-filesystem <0.6.3
    EPSS: 72% exploitation probability (95th percentile)
    Fix: Upgrade to >=0.6.3

  ● Live CVE check: queried OSV for 8 packages (2 new vulnerabilities found)

  ...

EPSS得分超过50%被标记为在野外被积极利用。这个 --offline 标志禁用所有网络查询,仅使用嵌入式数据库。

供应链分析

这个 --supply-chain flag分析每个MCP服务器的npm包以获取供应链风险信号:单个维护包、拼写错误、安装脚本、低下载次数和依赖图深度 deps.dev.

$ agentwise scan . --supply-chain

  ...

  ▲ HIGH      .mcp.json → sketchy-mcp  AW-011 [SUPPLY-CHAIN]
    Supply chain risk: HIGH for sketchy-mcp
    ├ Single maintainer 'anon42' (account takeover risk)
    ├ Has postinstall script
    └ 43 weekly downloads
    Fix: Review package provenance and consider official @modelcontextprotocol packages

  ● MEDIUM    .mcp.json → some-tool  AW-012 [DEPS.DEV]
    Deep dependency chain: 247 transitive deps
    ├ 247 transitive dependencies (high risk)
    └ 2 transitive deps have known advisories
    Fix: Review transitive dependencies and update packages with advisories

  ...

CI/CD集成

GitHub 操作

使用捆绑的复合操作进行发布安装、更安全的参数处理和源代码模式自检:

- uses: brandonwise/agentwise@v1
  with:
    path: ./Agent Configs/.mcp.json
    format: sarif
    output: ./reports/agentwise.sarif
    fail-on: high

- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: ./reports/agentwise.sarif

笔记:

  • 支持带空格的路径和输出文件。
  • install-mode: source 构建已签出的操作源,而不是下载版本。可用于测试pull请求中的操作更改。
  • 这个 --fail-on 当发现达到或超过所选严重性时,阈值仍然会关闭作业。

如果你更喜欢手动路径,这仍然有效:

- name: Install agentwise
  run: curl -sSf https://raw.githubusercontent.com/brandonwise/agentwise/main/install.sh | sh

- name: Scan MCP configs
  run: agentwise scan . --fail-on high --format sarif > agentwise.sarif

- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: agentwise.sarif

输出格式

agentwise scan .                                        # Colorized terminal output (default)
agentwise scan . --format json                          # JSON for scripting and pipelines
agentwise scan . --format sarif                         # SARIF for GitHub Code Scanning
agentwise scan . --format html --output report.html     # Dark-themed HTML report
agentwise scan . --format markdown                      # Markdown for PRs/Notion/Confluence
agentwise badge --format svg --output badge.svg         # Shields.io-style SVG badge
agentwise inspect .                                      # Per-server risk posture summary
agentwise inspect . --format json                        # Machine-readable inspect output

基线管理

agentwise 支持在到期时抑制发现:

agentwise baseline init
agentwise baseline show
agentwise baseline add --rule AW-007 --server mcp-fetch --reason "trusted tool for now" --expires 2026-12-31
agentwise baseline remove --rule AW-007 --server mcp-fetch
agentwise baseline prune-expired

解析器兼容性

agentwise 解析多个MCP配置形状:

  • mcpServers
  • context_servers (例如Zed)
  • lsp.{mcpServers|context_servers} 嵌套块

检查模式

inspect 在不更改AW-*分类法的情况下给出每台服务器的姿态视图:

agentwise inspect .
agentwise inspect ~/.mcp.json --format json

检查输出包括运输类型、身份验证/分配列表存在、包裹固定和风险标签,如 remote_no_auth, unrestricted_network,以及 broad_filesystem.

评分

每次扫描都会产生0到100的安全评分:

等级 分数 含义
A 90-100 非常好——风险最小
B 80-89 好——小问题
C 70-79 公平——一些担忧
D 50-69 差——重大风险
F 0-49 危急——需要立即采取行动

评分权重:关键=-20,高=-10,中=-5,低=-2。

CVE数据库

agentwise附带了一个嵌入式数据库,其中包含22个已知的MCP漏洞,这些漏洞是在构建时编译的。值得注意的条目:

  • CVE-2025-6514 --MCP工具配置中的命令注入(CVSS 10.0)
  • CVE-2026-2256 --在中通过Shell工具提示RCE ms-agent (CVSS 10.0)
  • CVE-2025-59536 --通过克劳德代码项目文件(CVSS 9.8)进行RCE
  • CVE-2026-15503 --集装箱逃生 mcp-server-docker (CVSS 9.6)
  • CVE-2026-31024 --SQL注入 mcp-server-postgres (CVSS 9.1)
  • CVE-2025-53110 --路径遍历 server-filesystem
  • CVE-2025-68143 --Git MCP中的路径遍历+参数注入

随时从OSV更新本地缓存:

agentwise update

路线图

  • [x] 12条检测规则(AW-001至AW-012)
  • [x] 嵌入式CVE数据库(22+个条目)
  • [x] 实时OSV+EPSS增强(--live)
  • [x] 供应链分析(--supply-chain)
  • [x] deps.dev依赖图分析
  • [x] 终端、JSON、SARIF输出
  • [x] GitHub行动
  • [x] 评分系统(0-100,A-F)
  • [x] 自动发现(agentwise scan --auto)
  • [x] 检查模式(agentwise inspect)
  • []自定义规则DSL(YAML)
  • []交互式TUI
  • []自动修复(agentwise fix)

贡献

看 贡献.md最简单的贡献方式是添加新的检测规则——每个规则都是 src/rules/.

许可证

MIT许可证(许可证-麻省理工学院).


建造于 @布兰登明智因为你的人工智能代理应该比 "auth": null.