본문으로 건너뛰기
Skillpedia
에이전트35k · #8397

testing-prompt-injection-in-rag-pipelines

하는 일

이 도구는 문서를 바탕으로 질문에 답하는 AI 시스템의 보안을 테스트하도록 돕습니다. 검색과 문서 사용 방식을 악용해 시스템이 정보를 드러내거나 예상과 다르게 행동하도록 속이는 방법을 찾습니다.

사용하는 경우

  • ✓AI 챗봇을 공개하기 전에 보안을 테스트할 때.
  • ✓악의적인 지시를 막는 보호 장치가 작동하는지 확인할 때.
  • ✓기밀 문서가 노출되지 않도록 확인하고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/testing-prompt-injection-in-rag-pipelines/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 내부 챗봇이 다른 부서의 정보를 드러내도록 속을 수 있는지 보안을 테스트해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 다른 도구(garak, Promptfoo, PyRIT)를 사용해 문서처럼 위장한 ‘비밀 지시’를 보냅니다. 그다음 AI 시스템이 이를 실행하는지 무시하는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

…

자주 묻는 질문

‘프롬프트 주입’이란 무엇인가요?

정상적인 텍스트 안에 숨겨진 비밀 지시를 AI에게 주어, 의도와 다르게 행동하도록 만드는 것입니다.

RAG란 무엇인가요?

검색 증강 생성(Retrieval-Augmented Generation)의 약자입니다. AI가 답변을 만들기 전에 데이터베이스(문서)에서 정보를 검색해, 더 정확하고 근거 있는 답변을 만드는 기법입니다.

이것이 왜 중요한가요?

AI 시스템은 중요한 정보에 접근하는 데 쓰일 수 있습니다. 보안 테스트는 AI가 데이터를 훔치거나 원치 않는 작업을 하는 데 사용될 수 없음을 확인해 줍니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
35k
순위
#8397
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬