Implementation Guide

    How to Detect Prompt Injection in Faxed and Scanned Prior Authorization Attachments

    Treat every faxed or scanned attachment as untrusted input and place detection at the OCR-to-model boundary, before extracted text reaches any model or agent. Combine image and layout checks, OCR confidence analysis, and classification of the extracted text, then map detection confidence to allow, redact, block or escalate responses. Detection is probabilistic, so also separate document content from instructions, minimize agent tool privileges, and enforce policy on model calls and tool calls in the execution path.

    Map where untrusted content enters the workflow

    Indirect prompt injection occurs when a model accepts input from external sources such as websites or files. A faxed prior authorization attachment is exactly that: a document from an outside party, converted by OCR into text that summarization, classification, extraction and agent steps then consume. The model cannot tell which of those words came from your system prompt and which came from the sender.

    Start by listing every point where extracted text becomes model context. That usually includes more than the first summarization call. Extracted text may be cached, passed to a second model for classification, stored in a case record, or retrieved later by an agent. Each of those is an entry point, and tool output that embeds document text should be treated as untrusted too.

    It also matters that an injection does not need to be readable by a person. Instructions only need to be parsed by the model. OCR can surface faint marks, margin notes, stamps or noise that a reviewer glancing at the image would never register. A manual check of the image is therefore not a control for this risk.

    Layer detection at the OCR-to-model boundary

    No single check is reliable on fax-quality input, where compression, skew, and noise distort both legitimate and malicious text. Run several independent checks and combine their signals, rather than treating any one as a verdict. Run them before the primary model sees anything, using a classifier on fetched or extracted context as a screening step.

    Published tooling for hidden-content detection focuses on native file formats such as PDF and Word, where techniques like colour-matched text, off-page content and invisible Unicode exist. Many of those do not apply to a rasterized fax, so do not assume native-format coverage carries over to scanned images. Build and validate your own checks for the raster path.

    • Image and layout anomaly checks: Flag text regions with very low contrast, unusually small type, content in margins or outside expected form fields, and regions that do not match the document template.
    • OCR confidence analysis: Compare per-word and per-region confidence against the page. Fluent, high-confidence instruction-like text inside an otherwise noisy region is worth a closer look.
    • Instruction-pattern matching: Look for imperative phrasing aimed at an AI system, references to roles, prior instructions, or tools. Use it as one signal only.
    • Intent classification: Score extracted text with a classifier for whether it attempts to direct a model, which catches content that avoids obvious phrases.
    • Content-versus-context separation: Mark extracted text as data, keep it apart from system instructions, and use spotlighting-style delimiting. Wording alone is not sufficient, so enforce the separation in the design.
    • Output monitoring: Inspect model outputs and proposed actions for signs that an injection succeeded, as a second line when input screening misses.

    Understand what detection cannot do

    Screening does not stop an injection it fails to detect, and it does not cover content that arrives through other channels. Treat detection as risk reduction, not prevention. NIST's taxonomy lists input filtering, spotlighting, LLM-based defenses, detection schemes and hierarchical-trust training as complementary approaches, and presents none of them as complete.

    Pattern matching alone is a particular weakness. In one study of 196,682 resumes from a hiring platform, more than 90% of hidden prompts contained no explicit instruction. Applying that cautiously to prior authorization, keyword rules will likely under-detect, which is why structural and OCR-level signals belong alongside text classification.

    Thresholds need local evidence. Measure false positives on documents from your own domain, at your own fax quality, before deciding what to block. Prior authorization attachments contain clinical shorthand, stamps, handwritten notes and form boilerplate that can resemble anomalies. A threshold that blocks too much creates a backlog of manual review. One that blocks too little offers false assurance. Revisit thresholds on a regular schedule and include adversarial test documents in that review, since regular penetration testing and breach simulation that treat the model as an untrusted user are recommended for testing trust boundaries.

    Define responses by confidence and consequence

    Detection is only useful if each outcome has a defined action. Tie the response to two inputs: how confident the detection is, and what the workflow could do with the content. A summary shown to a reviewer carries less consequence than an extraction that feeds an agent with write access.

    Set the cutoffs from your measured false-positive data, not from defaults. When a document is flagged, also tighten what downstream agents may do with it.

    • Allow: Low-confidence or no signal. Proceed with content marked as untrusted data and normal tool restrictions in place.
    • Redact: A specific span looks like an instruction but the rest of the document is usable. Remove or neutralize the span and record that it was removed.
    • Block: High-confidence injection or multiple independent signals. Stop the document from reaching the model and route it to a security queue.
    • Escalate for human review: Ambiguous signals, or any flagged document that would trigger a sending, deleting or modifying action. A person decides before the workflow continues.

    Enforce in the execution path, not only at intake

    Because detection can miss, the controls that matter most limit what a successful injection can accomplish. Privilege minimization is the most effective control: give agents only the tools the task needs, and require confirmation before sending, deleting or modifying anything. An agent that asks first creates a checkpoint that injection alone cannot bypass.

    Authorize tool calls on the proposed operation, its target, its arguments and the caller's authority, not on keyword counts in the prompt. Context isolation should be enforced at design time and not left to prompt wording, and content from outside the trusted system prompt stays untrusted regardless of how it is framed.

    This is where Trussed applies. Trussed enforces policy in the execution path across models, agents, tools and MCP servers, and can allow, redact, block, rate limit or escalate for human approval on individual interactions and tool calls. In this workflow, that means the response chosen for a flagged document is enforced at runtime, not reviewed after the fact. Trussed does not replace OCR-level and document-level detection. It is the layer that holds when detection is wrong or incomplete.

    Retain evidence for each suspected injection

    For every detected or suspected event, keep the security-relevant metadata and the decision: which document and processing step, which signals fired and their scores, the response taken, the model call or tool call affected, and who approved any escalation. Log agent actions together with the originating input, so anomalous scope expansion can be traced back to the document that triggered it.

    Minimize what you store. Exclude credentials and secrets, avoid unnecessary sensitive prompt or response content, and redact or anonymize content before storage. Prior authorization attachments contain PHI, so store references and hashes where they serve the purpose instead of copying full extracted text into security records. Enrich AI-specific security events with context so downstream detection and response teams can act on them.

    Trussed produces audit-ready evidence as a direct result of enforcement, mapped to HIPAA, NAIC, NYDFS, EU AI Act and NIST, with self-managed deployment in the customer cloud and configurable retention and data residency. Your retention periods and incident-review procedures remain a decision for your compliance and legal teams.

    Control points between a fax and a model

    Intake

    Fax and scan attachments arrive from external senders and are treated as untrusted.

    OCR and layout

    Text is extracted along with confidence scores and layout structure.

    Detection

    Layered checks produce a confidence signal for each document or text span.

    Response

    Allow, redact, block or escalate for human review.

    Model and tool calls

    Policy is enforced on each interaction in the execution path.

    Enforce policy on the model and tool calls your documents can reach

    Talk through where scanned attachments enter your AI workflow and how policy enforcement in the execution path can apply allow, redact, block or escalate decisions with audit-ready evidence.

    Request a Demo