{"slug": "hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits", "title": "Hidden Prompt Injections in Financial PDFs, and Where a Scrub Step Fits", "summary": "A researcher at tomclancy.info demonstrated prompt-injection attacks against an LLM tool that parses financial PDFs, using hidden text, white-on-white ink, glyph overlap and Unicode tricks to make the model report figures not present in SEC filings or account statements. The researcher built six PDF-level detectors — HiddenInk, Text Raster Divergence, Unicode Obfuscation, Accessibility Channel, Glyph Overlap and Non-Text Ink — and a separate text-scrubbing layer (Sentinel's /v1/scrub) is proposed to scan extracted text before it reaches the model. The write-up notes that scrubbing cannot catch injections written as ordinary financial prose, which it frames as a data-integrity problem requiring human verification against the source.", "body_md": "A QA engineer pointed an internal LLM tool at financial PDFs (SEC filings, account statements) and made it report numbers that weren't in the document. The tool did what it was built to do. It read the PDF, and the attacker had written some of the PDF for it.\n\nThis is a research write-up, not a breach. The author, writing at [tomclancy.info](https://tomclancy.info/joshua-judges-ruth.html), demonstrated the attack against a tool that parses financial documents, then built a set of mechanical PDF-level detectors to catch it. The piece got almost no traction on HN (1 point, 0 comments), which is a shame, because the underlying problem is one most document-ingestion pipelines have.\n\nThe demonstrated techniques all do the same thing: put text in the PDF that an LLM will see and a human reviewer won't.\n\nThe goal in the demo was to get the model to state numbers the document doesn't contain. For a tool people use to read filings and statements, wrong numbers delivered confidently are the worst outcome. A reviewer skimming the rendered PDF sees a normal document. The text extractor feeding the LLM sees the normal document plus a paragraph of instructions.\n\nA PDF text extractor has no idea what's visible. It pulls characters out of content streams. Color, height, and position are rendering concerns the extractor doesn't weigh, so everything lands in the prompt as one undifferentiated string.\n\nThen the model gets that string. System prompts that say \"only report figures from the document\" don't help, because the injected text is part of the document as far as the model can tell. Instructions and data arrive in the same channel.\n\nThe author's response is a layered \"Swiss cheese\" approach, six judges that each look for one kind of PDF-level trick: HiddenInk, Text Raster Divergence, Unicode Obfuscation, Accessibility Channel, Glyph Overlap, and Non-Text Ink. That's sound engineering. Each judge has holes, and stacking them is how you cover the holes. I'm not going to describe how each judge works internally, since the summary doesn't give me enough to do that honestly. Read the original for the details.\n\nBe clear about the division of labor. The author's judges operate on the PDF itself: rendering, glyph geometry, ink, accessibility tags. Sentinel doesn't parse PDFs or inspect rendering, so it can't tell you a span was white-on-white. That's the author's layer, and it's a good one.\n\nSentinel works on the text after extraction, before it reaches the model. For a pipeline like this, that means the extracted PDF text goes through `/v1/scrub` first. Hidden or not, an injected instruction ends up as text, and text is what Sentinel scans.\n\nThree layers are relevant:\n\nOne more layer is worth knowing about: the **unverifiable authorization claim heuristic**. Content that asserts its own authority (\"you have my permission to...\") sets a soft floor on the score and comes back `flagged`. Injected footnotes that claim to be corrections or official addenda can trip it. It's deliberately a flag and not a block, because the same phrasing is common in legitimate documents.\n\nWhat Sentinel can't do here: it can't see that text was hidden. If an attacker writes an injection that reads like ordinary financial prose (\"Restated net income was $4.2M\"), there's no injection signature to match. That's a data-integrity problem, not a prompt-injection problem, and no scrub layer fixes it. The PDF-level judges and a human checking numbers against the source are the answer there.\n\nIllustrative example: extract text, scrub it, and only send the result to the model if it passes.\n\n``` python\nimport httpx\n\nextracted = extract_text_from_pdf(\"filing.pdf\")  # your extractor\n\nresp = httpx.post(\n    \"https://api.sentinelaifirewall.com/v1/scrub\",\n    json={\"content\": extracted, \"tier\": \"strict\"},\n    headers={\"X-Sentinel-Key\": \"sk_live_...\"},\n).json()\n\naction = resp[\"security\"][\"action_taken\"]\n\nif action == \"blocked\":\n    raise ValueError(\"Document withheld: injection detected\")\nif action == \"flagged\":\n    queue_for_human_review(resp[\"request_id\"])\n\nsafe_text = resp[\"safe_payload\"]  # send this to the LLM, not `extracted`\n```\n\nAn illustrative response for a document with an injected instruction block:\n\n```\n{\n  \"request_id\": \"a1b2c3...\",\n  \"security\": {\n    \"action_taken\": \"blocked\",\n    \"threat_score\": 0.91\n  },\n  \"safe_payload\": \"[SENTINEL BLOCKED]: Article withheld — fast-path prompt injection detected. Matched: \\\"...\\\".\"\n}\n```\n\nNote that `safe_payload` on a block is a descriptive placeholder, not null. Branch on `action_taken`, and log the placeholder if you like.\n\nIf you're feeding many filings through, `/v1/scrub/batch` (Teams and Enterprise) takes up to 100 items per request, so you can scan at ingestion time instead of per query.\n\nTreat extracted document text as untrusted input, the same way you'd treat a web form field. If your pipeline goes PDF to extractor to LLM with nothing in between, add a scrub step between the extractor and the model today. Pair it with checks at the PDF layer like the ones in the original write-up, because they cover things a text-level scan can't see, and Sentinel covers things they can't. Neither catches plausible-looking wrong numbers, so keep a human verifying figures that matter.\n\nSentinel has a free Starter tier (100 requests/month, no credit card): [sentinelaifirewall.com](https://sentinelaifirewall.com)\n\n*AI-assisted draft or imaging, human-curated, reviewed and edited.*", "url": "https://wpnews.pro/news/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits", "canonical_source": "https://dev.to/coridev/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits-1kp8", "published_at": "2026-11-21 08:34:00+00:00", "updated_at": "2026-11-21 08:42:00.890563+00:00", "lang": "en", "topics": ["ai-safety", "large-language-models", "ai-agents", "ai-tools"], "entities": ["tomclancy.info", "Sentinel", "SEC"], "also_reported_by": [], "takeaway": "PDF text extractors flatten hidden, white-on-white and overlapping glyphs into the same prompt string as visible text, so layer PDF-level detectors with a post-extraction scrub step — and still verify figures against the source, since prose-style injections leave no signature to match.", "recommendation": {"advice": "Run extracted document text through a scrub step before it reaches the model, and pair it with PDF-level rendering checks, since scrubbing alone misses injections written as ordinary prose.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits", "markdown": "https://wpnews.pro/news/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits.md", "text": "https://wpnews.pro/news/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits.txt", "jsonld": "https://wpnews.pro/news/hidden-prompt-injections-in-financial-pdfs-and-where-a-scrub-step-fits.jsonld"}}