Chuyển đến nội dung
Skillpedia
Agent35k · #8397

testing-prompt-injection-in-rag-pipelines

Skill này làm gì

Công cụ này giúp kiểm thử bảo mật các hệ thống AI trả lời câu hỏi dựa trên tài liệu. Nó tìm cách đánh lừa hệ thống để tiết lộ thông tin hoặc hành động bất thường, bằng cách lợi dụng cách hệ thống truy xuất và sử dụng tài liệu.

Khi nào nên dùng

  • ✓Khi bạn kiểm thử bảo mật một chatbot AI trước khi đưa vào hoạt động.
  • ✓Khi bạn muốn kiểm tra xem các biện pháp chống chỉ dẫn độc hại có hoạt động không.
  • ✓Khi bạn muốn đảm bảo tài liệu bí mật không bị lộ.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/testing-prompt-injection-in-rag-pipelines/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/testing-prompt-injection-in-rag-pipelines/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kiểm thử bảo mật chatbot nội bộ của chúng tôi để xem nó có bị đánh lừa tiết lộ thông tin từ các phòng ban khác không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các công cụ khác (garak, Promptfoo, PyRIT) để gửi 'chỉ dẫn bí mật' được ngụy trang thành tài liệu. Nó kiểm tra xem hệ thống AI có thực thi chúng hay bỏ qua.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Testing Prompt Injection in RAG Pipelines

Authorized-use-only notice: This skill describes offensive testing techniques against Retrieval-Augmented Generation (RAG) systems. Run these probes only against applications you own or have explicit written authorization to test. Adversarial inputs that exfiltrate documents or hijack a model can cause real harm to production systems and downstream users. Always test in a non-production environment first and follow your engagement rules of engagement (RoE).

Overview

Retrieval-Augmented Generation (RAG) pipelines combine a large language model (LLM) with a retrieval layer (a vector store such as FAISS, Chroma, Pinecone, Milvus, or pgvector) so the model can answer questions over private documents. The retrieval layer is an injection surface: any text that the retriever returns is concatenated into the model's context window and is treated by the model as authoritative. An attacker who can influence the document corpus (a poisoned PDF, a malicious wiki edit, a planted support ticket, a crafted email) can plant instructions that the model will follow when that chunk is retrieved. This is indirect prompt injection delivered through the retrieval channel, and it maps to MITRE ATLAS AML.T0051 (LLM Prompt Injection) and OWASP LLM01:2025 Prompt Injection.

Beyond text-level injection, RAG pipelines are vulnerable at the embedding layer. An attacker who understands the embedding model can craft text that lands near high-value queries in vector space ("embedding manipulation" / retrieval poisoning), guaranteeing that the malicious chunk is retrieved for a target query even when it is not semantically relevant to a human. This skill walks through systematically probing both surfaces using NVIDIA garak, Promptfoo red-team plugins, and Microsoft PyRIT, with verified, runnable commands from each tool's documentation.

When to Use

  • When security-testing a RAG chatbot, internal knowledge assistant, or document-Q&A product before or after release.
  • When validating that retrieval guardrails (input/output filtering, context sandboxing) actually block injected instructions.
  • During an AI red-team engagement scoped to test the LLM application layer (OWASP LLM Top 10 coverage).
  • When you ingest user-controllable or third-party content into a vector store and need to prove the blast radius of a poisoned document.
  • As a regression gate in CI/CD: re-run the probe suite on every prompt-template or retriever change.

Prerequisites

  • Python 3.10-3.13 and a virtual environment.
  • Network access to the target RAG application (HTTP API, or a local harness you control).
  • Authorization / signed RoE for the target.
  • Install the tooling:
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate

# NVIDIA garak — LLM vulnerability scanner
python -m pip install -U garak

# Microsoft PyRIT — Python Risk Identification Tool (Python 3.10-3.13)
pip install pyrit

# Promptfoo — declarative red-team / eval CLI (Node.js 18+)
npm install -g promptfoo
# or run ad hoc with: npx promptfoo@latest
  • For local embedding-poisoning experiments: pip install sentence-transformers faiss-cpu numpy.

Objectives

  • Enumerate the retrieval surface of the target RAG pipeline and identify where untrusted content enters the corpus.
  • Run automated injection probes with garak (promptinject, latentinjection, leakreplay) and capture pass/fail rates.
  • Author Promptfoo red-team configs using the indirect-prompt-injection and rag-document-exfiltration plugins.
  • Drive multi-turn injection campaigns with PyRIT orchestrators against the target endpoint.
  • Demonstrate embedding-space retrieval poisoning so a benign-looking query reliably retrieves an attacker chunk.
  • Produce evidence (transcripts, retrieved chunks, scorer output) and map each finding to OWASP LLM01 and ATLAS AML.T0051.

MITRE ATT&CK Mapping

This skill is anchored in MITRE ATLAS (the AI-specific companion to ATT&CK). Names below are the official ATLAS technique names.

ID Official Name Relevance
AML.T0051 LLM Prompt Injection Core technique — instructions injected via retrieved context override system intent
AML.T0051.001 LLM Prompt Injection: Indirect Injection delivered through documents the RAG retriever ingests, not direct user input

…

Câu hỏi thường gặp

“Prompt injection” là gì?

Đây là khi ai đó cố đưa chỉ dẫn bí mật cho AI, ẩn trong văn bản bình thường, để khiến nó hành động khác với ý định.

RAG là gì?

RAG là viết tắt của 'Retrieval-Augmented Generation' (sinh văn bản tăng cường truy xuất). Đây là kỹ thuật trong đó AI lấy thông tin từ cơ sở dữ liệu (tài liệu) trước khi tạo câu trả lời, giúp câu trả lời chính xác và đầy đủ hơn.

Vì sao điều này quan trọng?

Hệ thống AI có thể được dùng để truy cập thông tin quan trọng. Kiểm thử bảo mật đảm bảo chúng không thể bị lợi dụng để đánh cắp dữ liệu hoặc thực hiện hành động không mong muốn.

Chi tiết

Mô tả gốc của tác giả

Probes Retrieval-Augmented Generation pipelines for indirect prompt injection via poisoned retrieved documents and embedding-space manipulation, using NVIDIA garak, Promptfoo red-team plugins, and Microsoft PyRIT against vector stores like FAISS, Chroma, Pinecone, or pgvector. Use when security-testing a RAG chatbot or document-Q&A system, validating retrieval guardrails, or gating CI/CD on prompt

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8397
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự