ai newsDi., 1. Dez.

Why putting a secret in a system prompt never works

A shop chatbot has a rule in its system prompt: never reveal the discount code. The code is right there in the same prompt. How long does it stay secret once a user starts asking? Usually not long, and the reason is structural. One stream of text A language model gets a single sequence of tokens. Y

dev.toSamstag 17:05 · 28.11.1 Min. Lesezeit
Bild: dev.to

A shop chatbot has a rule in its system prompt: never reveal the discount code. The code is right there in the same prompt. How long does it stay secret once a user starts asking?

Usually not long, and the reason is structural.

A language model gets a single sequence of tokens. Your system prompt is the start of it. The user's message comes after. There is no separate, protected channel for instructions, so the rule "never reveal the code" is competing with whatever the user typed next. Vendors train models to prefer the system prompt, which raises the effort needed. It does not remove the problem.

Picture a tester working through a retail bot that holds a promo code.

Any one of these working is enough. The attacker needs a single success, and the defender needs every attempt to fail. That asymmetry is why filtering the model's answers with a second prompt is a weak fix: the filter is also a model reading text, and it can be argued with in the same way.

The free ShopBot prompt injection CTF on Codelivly is a shop assistant guarding a discount code, rated easy. Once that falls, the Helios system prompt extraction CTF asks you to get a hidden prompt out of an assistant that has been hardened a little more.

For the wider methodology, the Hacking AI Systems book covers prompt injection, LLM security and AI red teaming in practice.

Quelle: dev.to (dev.to). Original öffnen