Prompt Injection - OWASP Top 10 LLM

View original on LinkedIn →

A Prompt Injection Vulnerability happens when someone sneaks tricky or sneaky instructions into what looks like a normal request to a large language model (LLM), like ChatGPT. These hidden commands can make the model act in unexpected, sometimes harmful ways like a polite waiter who suddenly throws your food out the window because someone whispered “chaos mode” into his ear.

Imagine you’re trying to ask your super-smart digital assistant for a cookie recipe, and instead of flour and sugar, it starts giving you steps to break into someone’s Wi-Fi. Whoa! That’s not what you asked but that’s the weird world of prompt injection.

Checkout the Youtube link for full video -

#Invisible but Dangerous

The wild part? These malicious prompts don’t even have to be visible to humans. The model might read something in the data, like a secret note in invisible ink, and take it seriously. Humans won’t notice anything fishy, but the model will be like:

“Ah, yes. Hidden command detected. Let’s cause some mischief.”

#How It Messes Things Up

These prompt injections can:

And yes, it still happens even when developers use fancy tricks like RAG (Retrieval Augmented Generation) or fine-tuning to make the model smarter. It’s like giving your dog obedience training—and it still chases squirrels when no one’s watching.

Prompt Injection vs. Jailbreaking (The Evil Cousin)

People often mix up prompt injection and jailbreaking, and that’s fair—they’re kind of like siblings in mischief.

Prevention and Mitigation Strategies

Well… kind of. Developers are trying to build defenses like filtering out shady inputs or adding protective prompts under the hood. But attackers keep getting more creative, like pranksters finding new ways to get past security guards.

So the fight against prompt injection and jailbreaking is ongoing, and it’s kind of like software whack-a-mole. Fix one thing, and something else pops up. 🧑‍💻

Segregate and identify external content. Separate and clearly denote untrusted content to limit its influence on user prompts.

Enforce privilege control and least privilege access, provide the application with its own API tokens for extensible functionality, and handle these functions in code rather than providing them to the model. Restrict the model’s access privileges to the minimum necessary for its intended operations.

Let’s be real, Gen AI is kind of like a super-talented improv actor. It’s brilliant, creative… and a little unpredictable. Because of how these models work, there’s no 100% guaranteed way to stop prompt injections. But you can keep your AI from going full drama mode with these smart strategies:

Require human approval for high-risk actions. Implement human-in-the-loop controls for privileged operations to prevent unauthorized actions