Cyber Security Community Question

How do we defend against 'Prompt Injection' attacks in our corporate AI chatbots?

Posted on 2024-04-11 • In Cyber Security • By Kevin Adams

We are deploying an internal LLM-based assistant for our staff. I’ve read about 'prompt injection' where users can trick the AI into ignoring its safety guidelines or leaking sensitive training data. What are the best sanitization techniques for user inputs before they hit the LLM API?

3 Answers 18,954 Views

All answers to this question 3 Answers

Sandra Martinez Answered on 2024-05-15
Answered

AI security is the new frontier. To prevent prompt injection, you need to treat LLM inputs like you treat SQL inputs: never trust them. We use a 'dual-LLM' architecture. The first, smaller model acts as a firewall, scanning the user prompt for malicious patterns or 'jailbreak' attempts before passing it to the main model. Additionally, use 'delimiting.' Wrap the user's input in specific tags and tell the system prompt that everything inside those tags is strictly data, not instructions. Most importantly, never give your AI direct access to write to databases or execute code without a human-in-the-loop for approval.

Paul Scott Answered on 2024-05-18
Answered

Have you seen any tools that can automatically red-team these LLM prompts, or are we stuck manually trying to break our own AI?

George Harris Commented on 2024-05-21
Commented

Paul, there are several open-source 'fuzzing' tools now that can send thousands of known jailbreak prompts to your AI to see how it responds. We also use 'adversarial training,' where we specifically retrain the model on examples of failed injections so it learns to recognize the linguistic patterns of an attack.

Mary Lee Answered on 2024-05-24
Answered

The best defense is data minimization. If the AI doesn't have access to sensitive PII in its context window, it can't leak it, no matter how clever the injection is.

Kevin Adams Commented on 2024-05-27
Commented

Mary is right. Restricting the AI's 'knowledge base' to only what is absolutely necessary for the task is the most effective way to reduce the impact of a successful injection.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.