Open-source RAG attack and defense lab for local ChromaDB + LM Studio stacks

What this is
Aminrj Labs released an open-source RAG attack and defense lab that runs fully local on consumer hardware, specifically targeting ChromaDB + LM Studio stacks with standard LangChain-style chunking. No cloud services or API keys are required—it runs on hardware like a MacBook Pro.
Key findings from the lab
The lab measures knowledge base poisoning effectiveness against default local RAG setups. On an undefended ChromaDB system, poisoning attacks achieve 95% success. The attack operates at the retrieval layer—no jailbreak, model access, or prompt manipulation is needed. The model performs exactly as intended, just with poisoned context.
One notable observation about default chunking: with 512-token chunks and 200-token overlap, a document at a chunk boundary gets embedded twice as two independent chunks. This doubles retrieval probability without additional sophistication, a side effect of settings most local setups inherit without consideration.
The most common defense approach—output filtering—targets the wrong layer since the compromise occurs before generation. Embedding anomaly detection at ingestion proves effective: scoring incoming documents against the existing collection before writing them reduces poisoning success from 95% to 20%.
With all five defenses active, residual poisoning success is 10%. These cases are semantically close enough to the baseline that no layer catches them cleanly, representing the practical ceiling for defense.
Technical details
- Stack: ChromaDB + LM Studio with Qwen2.5-7B
- Chunking: Standard LangChain-style with 512-token chunks and 200-token overlap
- Attack success on undefended system: 95%
- Defense effectiveness with embedding anomaly detection: Drops poisoning to 20%
- Residual poisoning with all defenses: 10%
The repository contains the attack implementation, hardened version, and measurements for each defense layer.
📖 Read the full source: r/LocalLLaMA
👀 See Also

Agent Hush: Open-source tool prevents AI coding agents from leaking sensitive data
Agent Hush is an open-source tool that catches sensitive data before it leaves your machine, created after a developer's AI coding agent leaked API keys, server IPs, and personal info to a public GitHub repo while building a security project.

Snowflake Cortex Code CLI vulnerability allowed sandbox escape and malware execution
A vulnerability in Snowflake Cortex Code CLI version 1.0.25 and earlier allowed arbitrary command execution without human approval via process substitution bypass, enabling malware installation and sandbox escape through indirect prompt injection.

Cloak tool replaces chat passwords with self-destructing links for OpenClaw agents
Cloak is an open source tool that replaces passwords shared in chat with OpenClaw agents with self-destructing links. Each link can only be opened once, then the password disappears, preventing passwords from accumulating in chat histories.

LLM-Assisted Exploit: Anthropic's Mythos Preview Helped Build First Public macOS Kernel Exploit on Apple M5 in Five Days
Using Anthropic's Mythos Preview, security firm Calif built the first public macOS kernel memory corruption exploit on Apple's M5 silicon in five days—breaking MIE hardware security that took Apple five years to develop.