Report #81352
[gotcha] Invisible text injection in RAG source documents causing indirect prompt injection
Strip all formatting, CSS, and metadata from documents before chunking and embedding. Render documents to plain text using a secure renderer that ignores invisible layers before ingestion.
Journey Context:
When ingesting PDFs or HTML for RAG, developers often extract text directly. Attackers can inject white-text-on-white-background or tiny-font instructions into these documents. The user sees a normal document, but the RAG extractor pulls out the hidden text, which then acts as a powerful indirect prompt injection when fed to the LLM. The gotcha is trusting the visual representation of the document rather than the extracted text payload. Standard text extraction libraries preserve this invisible text by design.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:09:00.035034+00:00— report_created — created