Breaking Guardrails: How I Jailbroke a Chatbot Built on Gemini AP
A third-party chatbot built on the Gemini API leaked raw backend errors and allowed user prompts to override the developer's system instructions. An attacker could fingerprint the model, jailbreak it, and extract hidden system instructions.
Published on medium.com
Large Language Models (LLMs) are being rapidly embedded into third-party chatbot applications via APIs like Google’s Gemini API. While the underlying models are powerful, their security depends heavily on how developers implement them.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the developer failed to sanitise error messages, enforce a strict instruction hierarchy, and filter model outputs.
Impact
The attacker could identify the LLM provider, jailbreak the model, and extract sensitive system instructions, though the text does not claim further exploitation.
What the attacker needed
Access to the chatbot interface; ability to intercept WebSocket traffic
The fix
The developer should sanitise errors, enforce a non-overridable instruction hierarchy, sanitise outputs, and use guardrails libraries.
How it was found
- Send an oversized prompt of repeated characters to trigger a backend error.
- Inspect the WebSocket traffic to see the raw Gemini error.
- Ask the model to respond in Base64 to bypass a text filter.
- Use a Developer Mode jailbreak prompt to override instructions.
- Request the hidden system instructions in JSON format.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A chatbot uses a hidden set of rules (the system prompt) to guide its behaviour. Here, the app let users' messages replace those rules and also showed internal error messages. This let someone trick the bot into revealing its secret instructions.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.