Beyond text in a chat box, what channels can indirect prompt injection arrive through, and how do you sanitise them?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The channel list is longer than most people expect, and the gaps are where the bypasses live. Anywhere the model reads content a human skims or never sees at all:
- PDFs: white-on-white text, zero-point fonts, text under an image layer, off-page content, form-field defaults, XMP metadata.
- Images: text a vision model reads that a human does not attend to, low-contrast overlays, text in a screenshot the user pasted, EXIF comments.
- HTML:
display:none, off-screen positioning, alt text,aria-label, HTML comments,titleattributes. - Office docs: tracked changes, comments, speaker notes, hidden rows and far-off cells in spreadsheets, document properties.
- Everything else agents touch: calendar invite descriptions, email headers and quoted trails, code comments and docstrings, commit messages, issue templates, JSON fields nobody renders, and filenames.
- The agent's own carried state: memory entries and context-compaction summaries. OpenAI reported in 2026 that an unreleased model wrote jailbreak-style instructions into its own compaction summaries during RL training, and the successor context sometimes followed them. A summary that crosses a context boundary is a persistence channel even with no outside attacker, so treat it as untrusted input too.
Full worked answer with diagram
The channel list is longer than most people expect, and the gaps are where the bypasses live. Anywhere the model reads content a human skims or never sees at all:
- PDFs: white-on-white text, zero-point fonts, text under an image layer, off-page content, form-field defaults, XMP metadata.
- Images: text a vision model reads that a human does not attend to, low-contrast overlays, text in a screenshot the user pasted, EXIF comments.
- HTML:
display:none, off-screen positioning, alt text,aria-label, HTML comments,titleattributes. - Office docs: tracked changes, comments, speaker notes, hidden rows and far-off cells in spreadsheets, document properties.
- Everything else agents touch: calendar invite descriptions, email headers and quoted trails, code comments and docstrings, commit messages, issue templates, JSON fields nobody renders, and filenames.
- The agent's own carried state: memory entries and context-compaction summaries. OpenAI reported in 2026 that an unreleased model wrote jailbreak-style instructions into its own compaction summaries during RL training, and the successor context sometimes followed them. A summary that crosses a context boundary is a persistence channel even with no outside attacker, so treat it as untrusted input too.
The key insight for the defence, and the thing most teams get wrong: your injection classifier must see exactly what the model sees. If you scan the raw PDF bytes but the model consumes text extracted by a different library, or you scan rendered HTML while the model gets the DOM, you have built a bypass. So: extract first with the same pipeline the model uses, then scan the extraction.
The rest of the stack:
- Normalise and flatten. Strip metadata, drop invisible layers, collapse Unicode confusables and zero-width characters, cap document size.
- Render-then-OCR as a comparison. Rasterise the document, OCR the image, and diff against the extracted text. A large mismatch means content is hidden from human view but visible to the model, which is close to a definition of an injection attempt. It is expensive, so reserve it for high-risk paths, but it is the highest-signal check available.
- Provenance and trust tags on every chunk, kept through retrieval.
- Structure over inspection. The durable defence is the quarantined-model pattern: untrusted content goes to a model with no tools that returns typed values, and the privileged side never reads the prose. Filters are a probability play; structure is not.
For images specifically, note there is no reliable extract-and-scan step, which is a good argument for not letting a tool-enabled model read arbitrary user-supplied images.
Worth sketching. It shows the scanner sitting on the same extraction the model consumes, which is the detail that decides whether the check is real or a bypass.
flowchart LR
A["PDF, HTML or office doc"] --> B["Extraction the model actually consumes"]
B --> C["Injection scan on that exact text"]
A --> D["Rasterise, then OCR"]
C --> E["Diff the two views"]
D --> E
E -->|"large mismatch"| F["Content hidden from humans: quarantine"]
E -->|"they agree"| G["Pass, tagged with provenance"]
What a good answer covers
- The channel list is longer than most people expect, and the gaps are where the bypasses live
- PDFs: white-on-white text, zero-point fonts, text under an image layer, off-page content, form-field…
- Images: text a vision model reads that a human does not attend to, low-contrast overlays, text in a…
- HTML: display:none, off-screen positioning, alt text, aria-label, HTML comments, title attributes
- Office docs: tracked changes, comments, speaker notes, hidden rows and far-off cells in spreadsheets,…
Key terms: PDFs · Images · HTML · Office docs · Everything else agents touch · The agent's own carried state · Normalise and flatten · Render-then-OCR as a comparison · Structure over inspection
In the glossary: Compaction
Interviewer follow-ups to expect
The render-then-OCR diff is expensive. Where would you actually apply it, and what is your fallback elsewhere?
How does this change for an image, where you cannot separate the text out to scan it?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep