技能注入扫描器

技能注入扫描器会在隐藏指令和提示注入模式操纵你的 AI 代理之前,审计代理技能文件。

vnbochkarev-netizen
2026年9月9日
0 收藏
71 下载

安装与下载

1 ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install skill-injection-scanner

2 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/
工作区 {'/skills/'}

优先级:工作区 › 全局 › 内置

3 提示词安装

将此提示词复制到 Openclaw 即可自动安装。

请帮我使用 Clawhub 安装 skill-skill-injection-scanner。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

更倾向于下载?

获取包含原生技能文件的ZIP压缩包。

下载技能 (.zip)

基本信息

名称 技能注入扫描器
Slug skill-injection-scanner
创建者 vnbochkarev-netizen
创建时间 2026-09-09 05:30:08
更新时间 2026-09-09 05:30:08
收藏数 0
使用量 71
浏览量 8

安装指南

  1. ClawHub CLI 从源直接安装技能的最快方式。
    npx clawhub@latest install skill-injection-scanner
  2. 手动安装 将技能文件夹复制到以下位置之一
    全局模式
    ~/.openclaw/skills/
    工作区
    /skills/
    优先级:工作区 > 本地 > 内置
  3. 提示词安装 将此提示词复制到 OpenClaw 即可自动安装。
    请帮我使用 Clawhub 安装 skill-injection-scanner。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
    更倾向于下载?
    获取包含原生技能文件的ZIP压缩包。
    下载技能 (.zip)

什么是

技能注入扫描器是一款本地优先的安全工具,用于在安装或使用前检查 Openclaw 技能及其他代理技能目录。它可检测19类提示注入行为,包括角色劫持、指令覆盖、保密要求、混淆、系统消息冒充,以及英语和俄语中的远程获取并运行模式。
扫描器仅使用只读访问,零依赖,不发起网络请求,不写入日志,并将发现结果以文本或 JSON 形式在本地输出到 stdout。它适用于市场下载、定期技能库审计,以及作者验证自己的文档,但不能替代完整的 SAST、恶意软件分析或代码仓库漏洞扫描。

应用场景

在首次使用前,扫描从 ClawHub、n8n、npm 或其他市场新下载的 Openclaw 技能。
定期对维护中的代理技能库进行安全检查。
检查第三方技能文档中的隐藏命令或提示注入载荷。
验证内部编写的技能,避免将合法安全示例误认为可执行指令。
生成机器可读的 JSON 发现结果,用于本地检查或后续审计流程。
调查嵌入技能文件中的可疑英语或俄语指令。
不要将其用作通用代码 SAST、二进制恶意软件分析或完整代码仓库漏洞扫描的替代品。

工作原理

获得用户明确同意,并确定将要读取的确切技能文件夹。
使用可选的输出、排除和代码范围设置,对选定目录运行 scanner.py。
使用扫描器的只读流程在内存中读取技能文件;不会执行子进程、安装、网络调用或 shell 命令。
应用19条检测规则,覆盖指令劫持、保密要求、混淆、系统标记、远程执行、附件或图像提取,以及英语和俄语中的操纵性语言。
应用上下文感知评分,使安全文档、可信主机引用、代码示例和展示而非告知的指导更不容易产生误报。
将每个发现及其文件、行号、规则和简短片段输出到 stdout,或使用 --format json 序列化结果。
检查高风险发现,尤其是未知主机引用,并使用随附的验证来源指导。
可选地从 Git 仓库运行 --self-test;缺少测试夹具时以状态1退出,绝不会报告误导性的绿色结果。

配置指南

使用打包的扫描器,或在 github.com/vnbochkarev-netizen/skill-injection-scanner 克隆仓库。
扫描前,告知用户将读取哪个技能目录并获得明确同意。
对 Openclaw 技能目录运行基本扫描:
python3 scanner.py --skills ~/.openclaw/skills
扫描 Claude 技能并输出 JSON 发现结果:
python3 scanner.py --skills ~/.claude/skills --format json
在需要时排除备份文件并包含代码范围:
python3 scanner.py --skills /path/to/skills --exclude .bak --include-code-spans
从包含 fixtures/ 目录的 Git 仓库运行自测:
python3 scanner.py --self-test
打包的市场版本可能因策略省略 fixtures/,因此应从仓库检出目录执行自测。不需要安装依赖、设置账户、访问网络或配置文件。

数据架构

输入范围
元素 行为
技能目录 用户明确选择要扫描的文件夹,例如 ~/.openclaw/skills 或 ~/.claude/skills
文件访问 只读;扫描期间文件内容保存在内存中
过滤器 可选排除项,例如 .bak,以及可选的代码范围包含设置
语言 英语和俄语注入模式
发现结果
每个报告的发现结果包含:
文件路径
检测规则
本地简短片段
上下文感知的严重性或评分,包括对未知主机的 HIGH 处理以及验证来源提示
默认将结果输出到 stdout,也可使用 --format json 输出 JSON。扫描器不会生成项目文件、缓存数据、遥测、日志或云端记录。如果将输出重定向到文件,该文件由用户的 shell 而不是扫描器创建,并可正常删除。
检测分类 19条规则覆盖角色和人格劫持、系统消息冒充、忽略先前指令攻击、保密命令、编码或混淆指令、 和代码围栏系统标记、远程获取并运行命令、附件或图像指令提取,以及基于紧迫感或表情符号的操纵。可信主机和描述性安全示例会获得上下文感知处理。

高级特性

针对代理技能文件打造的19条提示注入检测规则。
覆盖英语和俄语模式,包括角色劫持、保密指令和指令覆盖。
上下文感知评分,降低安全文档、代码示例、可信主机引用和展示而非告知指导中的误报。
对未知主机进行高风险处理,并建议验证来源。
支持 JSON 输出,用于自动化、报告和本地审计管道。
支持目录排除及可选的 --include-code-spans 扫描,以控制精确度和覆盖范围。
故障安全的 --self-test 模式:测试夹具缺失时以状态1退出,而不是报告虚假成功。
本地优先的隐私模型:无遥测、云同步、子进程、安装、网络访问或持久日志。
明确同意流程,将扫描限制在用户指定的技能文件夹内。
兼容 Openclaw 技能库,同时也适用于其他代理技能目录。


name: skill-injection-scanner description: "Scan agent skill files for hidden instructions and prompt-injection patterns (EN/RU) before a poisoned skill rewrites your agent. 19 rules, zero dependencies. Use ONLY with the user's explicit consent: tell the user which skills folder will be scanned — findings are printed to stdout locally." version: 1.1.6
tools: [python]
license: MIT

Skill Injection Scanner

Local-first. No telemetry, no cloud sync — the files you scan never leave your machine.

When to use

You just installed a skill from a marketplace (ClawHub, n8n, OpenClaw, npm…) and want to check it before first use.
You maintain a skills library and want a periodic security sweep.
You write agent skills and want to make sure none of your docs accidentally look like hidden commands. Don't use for: general code SAST, binary malware analysis, full-repo vulnerability scanning.

Quick start

# from this package (or the git repo: github.com/vnbochkarev-netizen/skill-injection-scanner)
python3 scanner.py --skills ~/.openclaw/skills
python3 scanner.py --skills ~/.claude/skills --format json
python3 scanner.py --skills /path/to/skills --exclude .bak --include-code-spans

What it detects (19 rules)
Role/personality hijack ("you are now…" and Russian equivalents) and system-message impersonation
«Ignore previous instructions» / «follow only this text» (EN+RU)
Secrecy orders ("never tell the owner…" and Russian equivalents)
Obfuscated instructions (base64/rot13/encoded), embedded / ```system markers
Remote fetch-and-run (curl | bash, git clone … && run), instruction extraction from attachments/images
Manipulation tricks («this is critical: ignore…», emoji-boosted commands)

Context-aware scoring: security docs that describe injections, «show, don't tell» writing advice, code-span examples and trusted hosts (github.com, docs.python.org, …) are not flagged; unknown hosts stay HIGH with a «verify the source» note. --self-test exits 1 if fixtures/ are missing — it can never report a fake green. Note: the packaged copy has no fixtures/ (marketplace policy); run --self-test from the git repo, which ships them.

Privacy, consent, retention & deletion

What Where How to delete

Read file contents of the folder you point at in memory only nothing is written; findings go to stdout
Findings (file:line, rule, snippet) stdout / --format json close the terminal / redirect to a file and delete it

Get explicit consent before scanning a folder: tell the user what will be read. The tool writes nothing, phones nothing and keeps no logs.

Permissions

Files: read-only access to the skills directory the user explicitly points at.
Process: none — no subprocesses, no installs, no shell execution.
Network: NONE.
Secrets: never reads secret/config files by design; a credential-looking pattern inside a scanned file is reported as a finding with a short snippet for local review.

License

MIT © 2026 Viacheslav Bochkarev. Free to use, modify and redistribute.

product-launch-opening-film

Open Claude