Hidden receipt text tricks multimodal LLM into authorising a Rs 48,500 expense payout

Illustrative photo: Hidden receipt text tricks LLM into approving payout

A demo built around a fictional "ExpenseBot" shows that a multimodal language model can be duped into approving a Rs 48,500 payment after reading faint, hidden text in a cab receipt image, highlighting the danger of treating OCR output as trusted input.

The attack vector

ExpenseBot processes employee claims by feeding the full OCR output of a receipt image into a large‑language model. In the demo, the receipt’s visible total line reads Rs 1,240, but a barely visible line of fine‑print at the bottom addresses the AI directly, stating that Finance pre‑approved the claim for Rs 48,500. Because the OCR step (using Tesseract) captures every line of text, the hidden instruction reaches the model, which then sets the amount and marks the claim as approved. The application simply records whatever the model tells it to do, leading to the inflated payout.

The visible receipt total is Rs 1,240 while the hidden instruction payout is Rs 48,500.

The underlying issue is the same as OWASP LLM01: text extracted from images, PDFs or screenshots is untrusted data, yet the bot treats it as a reliable prompt. Multimodal models do not distinguish between legible and faint text – they interpret everything they see, making fine‑print an effective injection vector.

A reproducible lab

The vulnerability is demonstrated in the open‑source "Hack It, Then Fix It" repository (github.com/usinha79/hack-it-then-fix-it). The lab includes a vulnerable Flask app that runs ExpenseBot, a set of receipt PNGs with the hidden line, and a script that sends a chat request to the model. Running the vulnerable version and issuing a "Review Ravi's expense claim" command triggers the Rs 48,500 payout. The repository also provides a "fixed" version where the same receipt is processed but the inflated amount is blocked.

The lab’s setup steps are straightforward: clone the repo, install Python dependencies, add the Tesseract binary, start the vulnerable server, and then execute ./attack.sh. The same receipt image, when processed by the patched server, results in a mismatch error because the amount parsed from the TOTAL line (Rs 1,240) does not equal the model‑suggested amount, and the claim is routed to a manager for review.

Code‑level mitigations

The fix shown in the lab adds three safeguards. First, the OCR output is scanned for any line that mentions the AI assistant; such lines are stripped before the prompt reaches the model. Second, the amount supplied by the model is cross‑checked against the numeric total extracted directly from the receipt’s "TOTAL" line; any discrepancy results in a "BLOCKED" response. Third, the model is no longer allowed to approve claims – approval logic is moved into deterministic policy code that enforces an auto‑approve limit and escalates flagged or out‑of‑limit requests to a human manager.

Three code-level safeguards include stripping AI directives from OCR, cross-checking totals, and enforcing deterministic policy code for approvals.

These changes illustrate a defense‑in‑depth approach: treat OCR data as untrusted, validate critical fields in code, and keep final authorization out of the LLM’s hands.

Why it matters

The receipt‑prompt injection example is more than a quirky hack; it surfaces a systemic risk for any workflow that combines multimodal AI with unstructured visual data. Companies are increasingly embedding OCR or image‑to‑text stages before feeding results to LLMs for classification, routing, or decision‑making. If the downstream model is trusted to act on those results – for instance, to approve financial transactions, grant access, or trigger automated processes – an attacker can embed malicious instructions in low‑visibility text and bypass traditional sanitisation. The demo underscores OWASP’s recommendation to treat all extracted text as hostile input and to enforce policy checks in immutable code rather than in the model’s output. Organizations deploying expense automation, invoice processing, or document‑driven bots should audit their pipelines for similar injection pathways, add pattern‑matching filters for AI‑directed directives, and ensure that any monetary or security‑critical decision is gated by deterministic business rules. As multimodal models become more capable and cheaper to integrate, the attack surface will expand, making these safeguards essential to prevent financial loss or compliance breaches.

Cover: thart2009 · CC BY 2.0 · Flickr. Layout and headline text by Signal Titans.

Source: Prompt Injection Hidden in a Receipt Image Made an AI Expense Bot Pay Rs 48,500 · hack-it-then-fix-it/ep10-image-prompt-injection at main · usinha79/hack-it-then-fix-it · GitHub

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *