Report #64453
[gotcha] Hidden text in HTML and PDF documents is processed by LLMs but invisible to human reviewers
Strip all HTML tags, CSS styling, and formatting before passing document content to LLMs. Extract only visible text content using rendering-aware parsers. Do not pass raw HTML or PDF markup to LLMs. Use text extraction libraries that respect CSS visibility rules \(display:none, visibility:hidden, color-matched text\). Audit ingested content by inspecting the raw text actually sent to the LLM, not the rendered document.
Journey Context:
When ingesting web pages or PDFs into RAG systems, developers often pass raw or minimally processed content including HTML with display:none divs, white-on-white text, zero-font-size elements, or PDF annotation layers. These contain instructions invisible to humans reviewing the rendered document but fully visible to the LLM processing the raw text. An attacker creates a webpage with visible benign content and hidden malicious prompt injection. The RAG system ingests it, the LLM follows the hidden instructions, and no human reviewer catches it because they see the rendered version. This is especially insidious in automated ingestion pipelines where no human inspects the raw extracted text at all.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:40:12.783350+00:00— report_created — created