
Exploiting LLM prompt injection vulnerabilities
Security researchers have identified prompt injection as a critical vulnerability class targeting large language model (LLM) powered applications, potentially leading to confidentiality breaches, unauthorized data modifications, and service disruptions.
Large language models (LLMs) have become standard components in modern web applications, powering everything from customer support chatbots to internal knowledge assistants. This widespread adoption creates a significant new attack surface for security researchers to explore, with prompt injection emerging as one of the most impactful vulnerability classes targeting these AI systems.
Unlike traditional security flaws like SQL injection, prompt vulnerabilities exploit the fundamental nature of how LLMs process text. The models lack built-in mechanisms to distinguish between trusted system instructions and untrusted user input, allowing malicious actors to manipulate or override developer-defined behaviors.
Types of Prompt Injections
Prompt injection vulnerabilities fall into two main categories. Direct prompt injection occurs when attackers supply malicious instructions directly to the LLM, such as through a chatbot interface. Indirect prompt injection, also known as second-order injection, happens when payloads are embedded in external content like documents, web pages, or emails that the model processes on behalf of users.
For a prompt injection to be considered exploitable, it must demonstrate impact on one of the CIA triad metrics: confidentiality, integrity, or availability. This means the injected input must reliably cause the model to bypass its intended restrictions in a way that causes real harm, such as revealing sensitive information, modifying unauthorized data, or disrupting service functionality.
Exploitation Techniques
Researchers have developed several sophisticated techniques to exploit prompt injection vulnerabilities. System prompt overriding involves instructing the AI to ignore its original instructions, potentially leading to sensitive information disclosure. Role hijacking builds on this by providing the model with a new identity to adopt, making it more likely to comply with malicious requests.
The key here is to iterate over a wide-range of possible characters or roles and pay close attention to when the AI assistant (partially) complies to your request.
Advanced Methods
When basic techniques fail, attackers can employ creative approaches like fictional framing, where they request poems, stories, or riddles that conceal sensitive information. This method works because LLMs typically view creative writing tasks as lower-risk. For more resistant systems, encoding and obfuscation techniques such as base64 encoding can help bypass safety restrictions without compromising the model's ability to decode the message.
As LLMs become increasingly resistant to basic override attempts, security researchers must continue developing new exploitation methods. The evolving nature of these vulnerabilities requires constant vigilance from developers implementing AI systems, who must implement robust safeguards to protect against prompt injection attacks while maintaining the functionality that makes these AI tools valuable.