Report #76470
[gotcha] RAG ingests invisible or zero-width characters from HTML/PDF that hijack the LLM
Strip all formatting, CSS, and zero-width characters during the document ingestion and chunking pipeline. Extract only the visible text content.
Journey Context:
When scraping web pages or parsing PDFs for RAG, developers often extract raw text including HTML tags or hidden spans. Attackers can inject white-text-on-white-background or zero-width characters that spell out a malicious prompt. The LLM processes these invisible characters as valid instructions, while human reviewers of the document see nothing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:56:54.855440+00:00— report_created — created