# Poisoning a Knowledge Base for RAG Injection

> Learn how attackers craft and inject malicious documents into RAG pipelines to manipulate model outputs and compromise future users.

Canonical: https://codelivly.com/rooms/poisoning-a-knowledge-base-for-rag-injection
Last updated: 2026-10-12

| | |
|---|---|
| Level | Intermediate |
| Category | Cybersecurity |
| Lessons | 3 |
| Estimated time | 30 min |
| XP | 100 |

This module explores the mechanics of RAG poisoning, a sophisticated attack where adversaries manipulate the knowledge base itself rather than targeting the model directly. You will learn how indirect prompt injection differs from traditional data poisoning, how to craft documents designed to maximize retrieval scores, and why these poisoned payloads create persistent, automated attacks against unsuspecting future users.

## Lessons

1. What is RAG Poisoning and How It Differs from Prompt Injection (30 min)
2. Crafting Documents Designed to Be Retrieved and Trusted (30 min)
3. Persistence: Why Poisoned Content Keeps Attacking Future Users (30 min)

## Related

- [Learning path: RAG and Vector Database Attacks](https://codelivly.com/learning-paths/rag-and-vector-database-attacks)
- [All rooms](https://codelivly.com/rooms)
