Report #39340
[gotcha] Hidden prompt injection in RAG retrieved documents
Parse and strip HTML/CSS styling \(like display:none, color:transparent, or tiny font sizes\) and markdown white-text from documents before chunking and embedding them for RAG.
Journey Context:
RAG systems ingest external documents \(PDFs, web pages\) which are assumed to contain only factual data. Attackers embed invisible text \(white text on white background, font-size 0\) containing malicious instructions. When the RAG system retrieves and injects this chunk into the LLM context, the LLM reads the invisible text and follows the hidden instructions, while the user sees only the visible text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:30:25.089687+00:00— report_created — created