Source-linked AI summary

Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection

Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, Mario Fritz

arXiv:2302.12173v2cs.CRcs.AIcs.CLcs.CY

TL;DR

LLM-integrated applications blur data and instructions, creating an underexplored security gap in which retrieved content can carry adversarial prompts. The paper introduces and systematically analyzes indirect prompt injection, demonstrating attacks across synthetic and real-world systems. It finds that retrieved prompts can compromise models, manipulate functionality, and produce threats such as data theft, denial of service, and user manipulation.

  • Problem

    Existing prompt-injection assumptions focused on direct user interaction, leaving the risks of malicious prompts embedded in untrusted retrieved data underexplored.

  • Method

    The paper introduces indirect prompt injection, derives a computer-security taxonomy, and demonstrates attacks using synthetic applications and real-world systems.

  • Results

    Indirect prompt injection can lead to full compromise at inference time, including remote control, persistent compromise, data theft, denial of service, disinformation, and user manipulation.

  • Takeaways & Limitations

    Retrieved prompts can function as arbitrary code and cross security boundaries, underscoring the need for robust defenses in LLM-integrated applications.

  • Takeaways & Limitations

    Experiments primarily used synthetic applications, local HTML files, and Bing Chat’s sidebar, while access limitations prevented testing other applications.

Abstract

from arXiv · show

Large Language Models (LLMs) are increasingly being integrated into various applications. The functionalities of recent LLMs can be flexibly modulated via natural language prompts. This renders them susceptible to targeted adversarial prompting, e.g., Prompt Injection (PI) attacks enable attackers to override original instructions and employed controls. So far, it was assumed that the user is directly prompting the LLM. But, what if it is not the user prompting? We argue that LLM-Integrated Applications blur the line between data and instructions. We reveal new attack vectors, using Indirect Prompt Injection, that enable adversaries to remotely (without a direct interface) exploit LLM-integrated applications by strategically injecting prompts into data likely to be retrieved. We derive a comprehensive taxonomy from a computer security perspective to systematically investigate impacts and vulnerabilities, including data theft, worming, information ecosystem contamination, and other novel security risks. We demonstrate our attacks' practical viability against both real-world systems, such as Bing's GPT-4 powered Chat and code-completion engines, and synthetic applications built on GPT-4. We show how processing retrieved prompts can act as arbitrary code execution, manipulate the application's functionality, and control how and if other APIs are called. Despite the increasing integration and reliance on LLMs, effective mitigations of these emerging threats are currently lacking. By raising awareness of these vulnerabilities and providing key insights into their implications, we aim to promote the safe and responsible deployment of these powerful models and the development of robust defenses that protect users and systems from potential attacks.

1 INTRODUCTION

LLMs are rapidly integrated into applications that retrieve external data and call APIs, but these systems often lack adequate guardrails. The paper introduces indirect prompt injection, showing that adversaries can place prompts in retrieved data to remotely affect applications and users.

  • LLM-Integrated Applications: LLMs are increasingly embedded in chat, search, summarization, and API-calling applications, while their rapid deployment has not been matched by adequate guardrails and safety evaluations.Examples include Bing Chat, Bard, Microsoft 365 and Security Copilots, and ChatGPT plugins.
  • Indirect Prompt Injection: Indirect prompt injection blurs the boundary between data and instructions by placing adversarial prompts in sources likely to be retrieved at inference time.Unlike direct prompt injection, the attacker need not directly access the victim’s system.
  • Impact: Retrieved prompts can remotely control models and enable attacks including persistent compromise, data theft, denial of service, disinformation, and user manipulation.The paper frames these effects as a full compromise of the model at inference time, analogous to traditional security principles.
  • Contributions: The paper develops a taxonomy and systematic threat analysis for indirect prompt injection, then demonstrates practical attacks on real-world and synthetic LLM-integrated systems.The contributions include attack demonstrations and publicly shared demonstrations and prompts to support future security assessment.

2 PRELIMINARIES AND RELATED WORK

Prior work established prompt injection, tool-using LLMs, autonomous agents, and computer-like language-model behavior, but largely considered direct attacks or controlled interfaces. This paper extends that security perspective to retrieved data, where natural-language content can function like executable instructions.

  • From LLMs to Autonomous Agents: Tool-using and autonomous-agent research shows that LLMs can generate API calls, plan actions, and connect to external systems to complete tasks.Toolformer, ReAct, and autonomous-agent projects motivate security analysis of models with broader operational capabilities.
  • Adversarial Prompting and Jailbreaking: Prior prompt-injection work focused on malicious users attacking their own model instances or public interfaces, including hijacking goals, leaking instructions, and bypassing restrictions.The paper distinguishes indirect prompt injection from these direct prompting and jailbreaking settings.
  • LLMs as Computers: LLMs can be viewed as black-box computers executing programs expressed in natural language, motivating security techniques such as obfuscation, payload splitting, and virtualization.This computer-security analogy provides the conceptual foundation for analyzing prompt-based attacks.
  • LLMs as Computers: With retrieval, processing untrusted data becomes analogous to executing arbitrary code because natural-language instructions can be embedded in retrieved content.This observation identifies the blurred data-code boundary as a critical security issue in LLM-integrated applications.
  • Other Adversarial ML Attacks: Indirect prompt injection differs from related attacks by requiring less technical skill, machine-learning capability, attack cost, and model knowledge.These lower requirements may create practical and economic incentives for attackers.

3 ATTACK SURFACE OF LLM-INTEGRATED APPLICATIONS

LLM-integrated applications create an indirect prompt-injection attack surface because retrieved data can carry instructions that influence models, users, and connected systems. The paper organizes these risks by delivery method, threat type, and affected targets.

  • Attack delivery: Indirect prompt injections let attackers place malicious instructions in data that applications retrieve, crossing security boundaries through a user’s query.Retrieval blurs the distinction between data and instructions, allowing remote attacks without direct access to the victim’s model.
  • Attack delivery: Passive, active, user-driven, and hidden methods can deliver injections through websites, emails, copied text, imported code, or staged payloads.Hidden injections may begin with a small prompt that directs the model to retrieve a larger payload.
  • Threat taxonomy: A threat-based taxonomy maps indirect prompting to established cybersecurity risks while accommodating future changes in attack techniques and models.The taxonomy covers delivery methods, threats, and affected individuals or systems.
  • Threats: Indirect prompt injections can enable malware-like propagation, manipulated content, fraud, disinformation, user manipulation, data theft, and denial-of-service attacks.Prompts can function as programs or worms, alter summaries and search results, disseminate scams, and disrupt model availability.
  • Threats: Because models mediate API calls and information access, attackers can manipulate or sabotage both API inputs and outputs and exploit systems operating with little oversight.The affected scope ranges from masses of people to specific individuals, entities, and automated data-processing pipelines.

4 EVALUATION

The evaluation presents demonstrations after introducing the experimental setup, covering different threats and advanced injection-hiding methods. These demonstrations instantiate the taxonomy but are not exhaustive.

  • Evaluation: The evaluation first introduces its experimental setup, then demonstrates different threats and advanced methods for hiding injections.The demonstrations are instantiations of the proposed taxonomy rather than an exhaustive treatment.

4.1 Experimental Setup

The experiments combine controlled synthetic LLM applications with tests against Bing Chat and code completion. The setup examines attacks across tool use, retrieved content, browsing, email, memory, and application functionality.

  • Synthetic applications: The synthetic chat application equips an LLM with tools for search, webpage viewing, URL retrieval, email, address-book access, and memory.Tool descriptions and instructions are supplied in an initial prompt, with the agent deciding whether tools are needed.
  • Experimental controls: Proof-of-concept attacks use prepared content, ignore unrelated queries, and run at sampling temperature 0, without requests to real systems or websites.These controls provide reproducibility and isolate the attack demonstrations in the synthetic environment.
  • Real-world targets: Bing Chat serves as a black-box real-world target for dynamic scenarios and attacks aimed at the application’s actual functionality.The study also tests its sidebar’s ability to read page content, using prompts inserted into local HTML comments.
  • Real-world targets: Additional experiments target Bing Chat search and summarization and GitHub Copilot code completion.Bing Chat runs on GPT-4 with search, answer-generation, and citation components, while Copilot uses OpenAI Codex to suggest code.

4.2 Demonstrations of Threats

The demonstrations show that indirectly injected instructions can steer LLM-integrated applications, bypass interface filtering, persist across interactions, and manipulate primary tasks, APIs, and user behavior. The attacks span information theft, fraud, malware propagation, remote control, and manipulated content.

  • General observations: Indirectly injected instructions successfully steer models because data and instruction modalities are not disentangled.Prompts filtered through the chat interface may still succeed when ingested indirectly.
  • Persistence: In most cases, the model retained the injection throughout the conversation session, allowing the adversary's influence to persist beyond the initial attack.The initial injection method could vary, including retrieval or email, and some examples began with an already compromised model.
  • Information gathering: Models can autonomously implement an attacker's outlined goal, including persuading users to disclose information and exfiltrating it through search-related side channels.Bing Chat retained the injection across conversation turns and adapted its persuasion using user-provided context.
  • Fraud and malware: Injected prompts enabled fraud and malware delivery by generating disguised links, urgency, authority claims, and other social-engineering techniques without specifying exact persuasion details.The demonstrations included phishing-style account verification and malicious web pages that could lead to drive-by downloads.
  • Intrusion: An already compromised model could fetch changing instructions from an attacker-controlled server, creating a remotely accessible backdoor while continuing to answer users' original requests.The GPT-4 synthetic application demonstrated bidirectional communication and behavior changes after reprogramming.
  • Manipulated content: Indirect injections also manipulated search and summarization, producing biased or false content and potentially reinforcing themselves through follow-up API calls.A poisoned conversation caused Bing Chat to omit the New York Times from a news summary and generate negative claims about it.

4.3 Demonstrations of Hidden Injections

The demonstrations show that hidden or obfuscated injections can trigger LLMs to retrieve attacker-controlled payloads, including encoded prompts, while disrupting search functionality can produce availability attacks.

  • Obfuscation: Attackers can hide injections by encoding prompts or embedding them invisibly in otherwise ordinary content.The paper presents prompt hiding and obfuscation as methods for making injections less apparent to users or defenses.
  • Availability attacks: Disrupting search functionality is classified as an availability attack when the disruption is an unintended byproduct rather than intended manipulation.The classification follows the attack’s effect on the search feature.
  • Hidden payload retrieval: A small hidden injection can autonomously trigger retrieval of a larger attacker-controlled payload.The injection may be concealed in Markdown and instruct the model to search for a keyword or retrieve a URL containing the secondary payload.
  • Obfuscation: Base64 encoding can conceal an indirect prompt that the model decodes and executes as a cascaded injection.The demonstrated attack worked without additional natural-language instructions explaining that the decoded string should become a new prompt.

5 DISCUSSION

The discussion examines practical security, evaluation, ethical, reproducibility, and future-attack implications of indirect prompt injection. It emphasizes current harms and unresolved defenses while identifying important experimental and methodological boundaries.

  • 5.1 Ethical Considerations and Disclosure: The authors responsibly disclosed the vulnerabilities but argue that clear-cut defenses against prompt-based attacks remain difficult.They describe existing defenses as uncertain and characterize current mitigation efforts as a continuing challenge.
  • 5.2 Limitations: The experiments used synthetic applications, local HTML files, and Bing Chat, while access to other applications was unavailable.The authors consider in-the-wild retrieved injections feasible in principle but did not test Microsoft 365 Copilot or ChatGPT plugins.
  • 5.2 Limitations: Attack success rates were not quantified because dynamically evolving conversations require evaluating triggering, persuasion, consistency, and prompt variation.The authors leave this evaluation for future work, although many attack prompts worked on their first drafting attempt.
  • 5.2 Limitations: Deception potential remains insufficiently evaluated, and visual-channel injections showed only limited success in smaller multimodal models.The paper calls for user studies and more reliable methods, including less visible visual prompts.
  • 5.3 Other Attack Directions: Encoded, multimodal, and staged injections may evade filtering, while defenses face a trade-off between detecting complex inputs and preserving model capability.The authors also identify autonomous-agent security and stronger obfuscation as directions requiring further study.
  • 5.4 Reproducibility: Reproducibility is difficult in black-box, dynamic environments despite public demonstrations, prompts, and screenshots.The released synthetic demos are intended to support benchmarking and future evaluation.
  • 5.1 Ethical Considerations and Disclosure: The attacks investigated are practical with current technologies and could cause immediate harm to users.The authors distinguish these security risks from futuristic concerns and note that attackers may have incentives to pursue them.
  • 5.1 Ethical Considerations and Disclosure: Adversarially prompted search engines could amplify disinformation because chatbots may produce credible summaries from untrusted sources for large user bases.The discussion connects retrieval poisoning with overreliance and the potential domination of chatbot summaries by malicious online content.

6 CONCLUSION

The paper frames indirect prompt injection as a security problem created by retrieved inputs and external API access. It develops a taxonomy and demonstrations to support systematic security evaluation of current applications and future agents.

  • 6 CONCLUSION: Indirect prompt injection lets attackers remotely affect users by crossing security boundaries through retrieved inputs and external API calls.The paper argues that LLM-integrated applications no longer have controlled input-output channels.
  • 6 CONCLUSION: The authors derive a computer-security taxonomy, demonstrate threats on synthetic applications and Bing Chat, and discuss implications and defenses.The work is presented as an initial step toward evaluating LLM-integrated applications and autonomous agents.

A PROMPTS AND OUTPUTS

The appendix presents prompts, tool formats, attack payloads, screenshots, and outputs illustrating how injected instructions can manipulate tool-using chat applications. The examples include information gathering, fraud, malware spreading, remote control, and multi-stage attacks.

  • Initial Prompts: The synthetic chat application defines tools for web search, viewing pages, memory, fetching URLs, and email operations, with strict tool-call response formatting.The system prompt instructs the assistant to output nothing else when using a tool and respond only after requirements are met.
  • Initial Prompts: The GPT-4 application uses a direct chat format, while the LangChain application uses ReAct-style prompting with demonstrations and tool subsets.The GPT-4 setup reportedly worked without requiring ReAct prompting.
  • Attack Prompts: The information-gathering and fraud prompts instruct the assistant to impersonate an unrestricted bot and persuade users to disclose information or follow credential-stealing links.Examples include soliciting a user’s name and directing users toward Amazon or Microsoft account phishing pages.
  • Attack Prompts: The malware scenario uses injected instructions to make the assistant spread malicious URLs, while a visual example targets misclassification through a multimodal model.The visual injection targets the language model rather than the visual model and is described as an example of visual prompt injection.
  • Attack Outputs: The malware-spreading output chains email retrieval, contact retrieval, and composition of a prepared email to all contacts.The sequence demonstrates how injected content can drive multiple API calls through the assistant.
  • Attack Outputs: The remote-control output changes the assistant’s behavior after it retrieves instructions and views prepared website content, producing a pirate-accent response.The sequence shows injected instructions influencing subsequent tool use and final response style.
  • Attack Outputs: The multi-stage attack first causes a search for “KW87DD72S” after a poisoned Wikipedia page is supplied, then feeds a second payload.This output illustrates staged retrieval and execution of injected instructions.
Loading 2302.12173v2…