Prompt Injection Scanner

io.github.GuardBee由 GitHub 帳號 GuardBee 發布v1.2.0更新於 Nov 3, 2026

Scans RAG content/scraped pages for indirect prompt injection

已驗證STDIO僅桌面知識與記憶安全與監控

概覽

AI 產生的概覽

在內容進入模型上下文之前,掃描文字、檔案與目錄中的間接提示注入酬載。

可以做什麼
  • 掃描文字字串,例如 RAG 片段、擷取的網頁或工具回傳結果中的注入酬載
  • 掃描單一檔案,或遞迴掃描知識庫等目錄,自動略過 node_modules、.git、dist 與二進位檔
  • 依類別列出支援的偵測模式
  • 提供含嚴重等級與處理建議的發現項目,並可選擇輸出 SARIF 供 CI 使用
適用情境
當助理會讀取不受信任的內容(檢索到的文件、擷取的網頁、工具結果)時,可在信任這些內容前做一次啟發式檢查,辨識指令覆寫、角色偽造、隱藏文字、直接對 AI 說話與外洩企圖。
執行需求
透過 stdio 在本機執行,通常以 npx 從 npm 套件啟動,因此需要 Node.js。未宣告驗證、環境變數或標頭。可選的 LLM 判定器預設關閉,需設定 GUARDBEE_JUDGE_URL 與 GUARDBEE_JUDGE_MODEL 才會啟用。
安裝前請注意
偵測結果是啟發式文字模式比對而非語意分析,每筆結果仍應人工複核。遙測預設關閉;設定 GUARDBEE_TELEMETRY=1 會把伺服器、工具、成功與否、耗時以及檔案路徑等短參數值傳送給第三方。可選的判定器會把被掃描內容送到所設定的端點,非本機端點需明確開啟且僅限 https。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Prompt Injection Scanner,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@guardbee/mcp-prompt-injection-scanner

🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch

[npm version] [npm downloads] [License: MIT]

An MCP (Model Context Protocol) server that scans content — a RAG chunk, a scraped web page, a document — for indirect prompt injection payloads.

ai-code-scanner and mcp-server-auditor scan code; this package scans data. In classic prompt injection, the attacker writes a malicious prompt themselves; in indirect prompt injection, the attacker never talks to the model at all — instead they embed instructions in a document, web page, or tool result the model will later read. The moment the model pulls this content into its context via a RAG retrieval or a web fetch, the embedded instruction appears to carry the same authority as the user's own instructions.

Telemetry is off by default. With GUARDBEE_TELEMETRY=1 it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields like content, token or password are replaced with a placeholder. See @guardbee/mcp-telemetry.

Web page/RAG document ──► prompt-injection-scanner ──► LLM context              │              ├─ Instruction override   ("ignore all previous instructions", "önceki talimatları yok say")              ├─ Role spoofing          ("System:", <|im_start|>, [INST], <system>)              ├─ Hidden text            (zero-width, Unicode tag and bidi characters, display:none + instruction, HTML comment)              ├─ Direct address         ("Dear AI, ...")              └─ Exfiltration           (system prompt extraction request, data → URL instruction, templated img beacon)

Features

  • 17 patterns, 5 categories — instruction-override, role-spoofing, hidden-text, direct-address, exfiltration. English and Turkish phrasing
  • The rules live in @guardbee/guard-core, shared with @guardbee/mcp-security-proxy, so a phrase this scanner reports is the same phrase the proxy blocks at runtime
  • Every finding includes why it's risky and what to do about it (recommendation) — not just "found it"
  • SARIF 2.1.0 output — CI/CD integration (e.g. auto-scanning a knowledge-base repo on every PR)
  • Config file support via guardbee.yml
  • 45 unit tests — a positive and a negative (false-positive) scenario for every pattern; known false-positive sources like emoji ZWJ sequences and ordinary display:none modals are specifically tested

Quick Start

Claude Desktop / MCP Client

json
{  "mcpServers": {    "guardbee-prompt-injection-scanner": {      "command": "npx",      "args": ["-y", "@guardbee/mcp-prompt-injection-scanner"]    }  }}

CLI (CI/CD — e.g. scan a RAG knowledge-base repo on every PR)

bash
npx @guardbee/mcp-prompt-injection-scanner scan ./knowledge-base --fail-on=high --format=sarif > results.sarif

MCP Tools

ToolDescription
scan_textScans a given text/document snippet
scan_fileScans a single file
scan_directoryRecursively scans a directory (e.g. a RAG knowledge base) (node_modules, .git, dist skipped automatically)
list_patternsLists all supported patterns by category

Detected Patterns

CategoryPatternSeverityWhat it means
instruction-overrideinstruction_override_phrasehighA classic override phrase like "ignore/disregard/forget previous instructions"
instruction-overrideinstruction_override_trhighThe Turkish form: "önceki talimatları yok say / unut / görmezden gel"
instruction-overridedan_modehighAsks for the "DAN mode" jailbreak persona
instruction-overridebypass_safetyhighTells the model to bypass or disable its safety measures / guardrails
role-spoofingsystem_role_spoofmediumA fake "System:" role label at the start of a line in the content
role-spoofingchat_template_marker_injectionhighRaw chat-template control tokens (<|im_start|>, [INST]) in the content
role-spoofingsystem_taghighA <system> tag that tries to pass data off as a system message
hidden-texthidden_zero_width_charsmediumZero-width space/word-joiner (U+200B/U+2060) — text hidden from a human reviewer
hidden-textunicode_tag_smugglingcriticalInvisible Unicode tag characters (U+E0000–E007F) carrying hidden text; flag emoji such as 🏴󠁧󠁢󠁥󠁮󠁧󠁿 are excluded
hidden-textbidi_control_charsmediumBidi override/isolate characters that make text display in a different order than it is read
hidden-textcss_hidden_text_with_instructionhighA display:none/white-on-white element containing instruction-like language
hidden-texthtml_comment_instructionhighAn HTML comment containing instruction-like language
direct-addressdirect_address_to_aimediumThe content directly addresses "the AI"/"the assistant"
exfiltrationexfiltration_url_template_in_imagehighA markdown image URL with a {{...}}/${...} template — a data-exfil beacon
exfiltrationreveal_system_prompt_requesthighA sentence asking the model to reveal its system prompt
exfiltrationreveal_system_prompt_trhighThe Turkish form: "sistem istemini göster"
exfiltrationsend_data_to_url_instructioncriticalAn explicit instruction ordering the model to send data to an external URL

These are heuristic findings — a static text-pattern scan, not a semantic/intent analysis. Designed for a low false-positive rate (e.g. emoji ZWJ sequences and ordinary display:none modals are specifically excluded), but every finding should still be reviewed manually.


LLM judge (optional)

The patterns know attack phrases; a paraphrased, indirect or translated instruction slips past them. --judge also has a model read each file, in chunks, and reports instructions aimed at an agent as judge_semantic_injection (high). The finding carries judge: { model, version, confidence }, also in SARIF properties. The judge only adds findings.

bash
GUARDBEE_JUDGE_URL=http://127.0.0.1:11434/v1 GUARDBEE_JUDGE_MODEL=qwen2.5:7b \  npx @guardbee/mcp-prompt-injection-scanner scan ./docs --judge

It is off unless configured. Since the content goes to the endpoint, a non-local one needs --judge-allow-remote and https. On GuardBee's judge benchmark (50 English and Turkish samples), the patterns catch 16% of the attacks and qwen2.5:7b all of them, with no false positives.

Configuration (guardbee.yml)

yaml
prompt-injection-scanner:  fail-on: high       # any | critical | high | medium | low | none  max-files: 5000  exclude:    - ".test.ts"    - "fixtures/"

Development

bash
npm run buildnpm test             # 45 unit tests

License

MIT — GuardBee

Feedback

Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.

來源:packages/prompt-injection-scanner/README.md,提交 8cc1e03

工具

4

scan_text

Scan a text string — a RAG chunk, a scraped web page, a document, a tool result — for indirect prompt injection payloads (instruction-override phrases, spoofed chat-template roles, hidden/invisible text, content addressing 'the AI' directly, data-exfiltration attempts) before it reaches a model's context.

輸入參數labelcontent必填

scan_file

Scan a single file (a knowledge-base document, an HTML page, extracted text) for indirect prompt injection payloads

輸入參數path必填

scan_directory

Recursively scan a directory — e.g. a RAG knowledge base or a corpus of scraped pages — for indirect prompt injection payloads. Automatically skips node_modules, .git, dist, and binary files.

輸入參數path必填excludeincludemaxFiles

list_patterns

List all indirect prompt injection patterns that the scanner can detect, grouped by category

無需輸入參數。

版本歷史

13
  1. v1.2.0最新Nov 1, 2026
  2. v1.1.1Oct 30, 2026
  3. v1.0.2Oct 22, 2026
  4. v0.2.23Oct 21, 2026
  5. v0.2.22Oct 20, 2026
  6. v0.2.20Oct 19, 2026
  7. v0.2.19Oct 16, 2026
  8. v0.2.18Oct 15, 2026
  9. v0.2.16Oct 14, 2026
  10. v0.2.15Oct 14, 2026
  11. v0.2.13Oct 13, 2026
  12. v0.2.12Oct 11, 2026
  13. v0.2.11Oct 9, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分