Multimodal prompt injection

Also known as: visual prompt injection · image prompt injection

On this page 7

Multimodal prompt injection is an attack in which adversarial instructions are embedded in non-text inputs, such as images, screenshots, audio, video or documents, so that a multimodal language model reads them and treats them as commands. In AI security, it extends classic prompt injection beyond text and is also known as visual prompt injection or image prompt injection.

The threat is most serious for AI agents that browse, read files or control a computer, because they continually ingest images and pages from untrusted sources. A single poisoned screenshot or product photo can redirect the agent, leak data or trigger unwanted tool calls.

How multimodal prompt injection works

Multimodal prompt injection works because a vision-language or audio-language model converts every input into tokens in one shared context. Once an image is encoded, the text it contains, or the meaning a model extracts from it, sits next to the system prompt and the user request. The model has no reliable built-in boundary between data it should analyze and instructions it should obey.

Most attacks are indirect: the attacker never talks to the model. Instead, the payload is planted in content that a legitimate user later asks the model to process, such as a web page an agent visits, a PDF attached to an email, or a photo uploaded to a support chat.

Attackers use several carriers. The table below groups the main injection techniques by modality and indicates how visible each is to a human reviewer.

TechniqueModalityVisibility to humansTypical example
Visible typographic textImageVisibleInstruction printed on a sign or slide
Low-contrast or tiny textImage, screenshotNearly invisibleLight gray text on a white background
Adversarial pixel perturbationImageInvisibleOptimized noise that decodes as an instruction
Hidden document layersPDF, slidesHiddenWhite text or off-page objects
Spoken or ultrasonic commandsAudio, videoAudible or inaudibleInstruction mixed into a voice track
Interface spoofingScreenshot for agentsVisible but deceptiveFake dialog telling the agent to click
Main carriers of multimodal prompt injection

Why images and audio are harder to defend

Non-text modalities are harder to defend because filters that work on text do not see the payload. A keyword scanner or a text-based classifier inspects the user message and the retrieved text, but the instruction lives inside pixels or a waveform until the model itself decodes it.

Optical character recognition as a pre-filter only partly helps. It catches plain typographic attacks, yet misses adversarial perturbations, which are optimized against the model’s vision encoder rather than against human-readable text. These perturbations are closely related to adversarial examples and can transfer between models that share similar encoders.

AspectText prompt injectionMultimodal prompt injection
Payload locationCharacters in textPixels, audio samples, layout
Detection with text filtersPartly effectiveLargely ineffective
Human reviewReadableOften hidden or ambiguous
Attack craftingWriting instructionsWriting or optimizing media
Main exposureChatbots, retrieval systemsAgents, vision assistants, voice systems
Text and multimodal prompt injection compared

Multimodal attacks also combine with other techniques. An image can carry a jailbreak, a token smuggling trick split across picture and text, or a hidden request that makes the model embed private data in a link or image URL, which is a form of data exfiltration via prompt injection.

Impact on AI agents and applications

The impact depends on what the model is allowed to do. A captioning model that only returns text produces a misleading answer, while a computer-use agent with email, file and payment tools can take harmful real-world actions.

Risk becomes critical when three conditions meet, a combination often called the lethal trifecta: access to private data, exposure to untrusted content and the ability to communicate externally. Multimodal inputs widen the second condition, because almost every screenshot of the open web counts as untrusted content.

ApplicationLikely consequenceSeverity
Image description serviceWrong or manipulated outputLow to moderate
Document assistantAltered summary, leaked file contentModerate
Browsing agentNavigation to attacker pages, data leakageHigh
Computer-use agentUnwanted clicks, downloads or transactionsHigh to critical
Voice assistantUnauthorized commands to connected devicesModerate to high
Typical consequences by application type

Defenses and mitigation strategies

No single control reliably prevents multimodal prompt injection, so practitioners apply defense in depth. The most robust measures limit what an injected instruction can achieve rather than trying to detect every payload.

  • Instruction hierarchy training, which teaches models to rank system and user instructions above content found in tool outputs and media.
  • Spotlighting and provenance marking, which labels untrusted inputs so the model treats them as data.
  • Isolation patterns such as the dual LLM pattern or CaMeL, where a privileged planner never reads raw untrusted content.
  • Least privilege and human confirmation for sensitive tools, payments and outbound messages.
  • Multimodal safety classifiers and OCR scanning as an additional, imperfect filter.
  • Red teaming with tools such as garak and PyRIT, extended with image and audio payloads.

The following decision table matches common deployment situations with the control that usually gives the largest reduction in risk.

SituationPriority controlReason
Agent browses arbitrary websitesRestrict tools and require confirmationContent cannot be trusted
Users upload images to a chatbotIsolate uploads from system instructionsLimits instruction takeover
Agent handles private documentsBlock external links and image fetchesPrevents exfiltration
Voice control of devicesSpeaker verification for actionsRejects foreign audio commands
Choosing mitigations by deployment situation

Common misconceptions

A frequent misconception is that better models will simply ignore injected text. Stronger instruction following and better reading of images can actually make a model more responsive to hidden instructions, because it decodes them more accurately.

  • Resizing or compressing images removes some perturbations but does not stop typographic attacks.
  • Hiding the system prompt does not prevent injection; it only makes some attacks harder to tune.
  • Visible text is not harmless, since users rarely read every word in a screenshot.
  • A passing benchmark score does not guarantee robustness against adaptive attackers.

Threat frameworks such as MITRE ATLAS and the OWASP guidance for language model applications classify prompt injection as a leading risk, and multimodal variants fall under the same category with a larger attack surface.

The idea in brief

Some AI tools can look at pictures and listen to sound. They also follow written instructions. An attacker can hide an instruction inside a picture or a recording.

When the AI looks at that picture, it may obey the hidden message instead of the person using it. It is like a note slipped into a stack of papers that says to send the files to a stranger. The safest approach is to limit what the AI may do on its own and to ask a person before anything important happens.

A practical scenario

A finance team uses a browsing agent to compare supplier prices and fill in purchase requests. The agent takes screenshots of supplier websites and reasons over them. One supplier page contains a banner with pale gray text on a white background telling the agent to open the company mailbox and forward the latest invoice to an external address.

During a red-team exercise, the security team reproduces the attack and confirms that the agent attempts the forwarding step in 7 of 20 runs. They then remove email access from the browsing agent, require human approval for any outbound message, and mark all screenshot content as untrusted data in the prompt.

After these changes, the agent still reads the hidden text, but no run produces an outbound email. The team adds the attack image to its regular regression suite so that future model updates are tested against it.