$5,000 Bounty: How I Hijacked Google Gemini’s UI via Python Code Execution
Gemini's Python code execution feature rendered the script's standard output as active HTML instead of encoding it, so HTML tags printed by a script became live page elements. An attacker could inject CSS to overlay the chat interface with a fake login screen on the gemini.google.com domain, enabling phishing.
In the world of cybersecurity, trust is everything. What if an attacker could manipulate exactly what you see on an official Google website?
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 Python interpreter's standard output was inserted into the page without HTML encoding, so printed markup was rendered as active elements.
Impact
An attacker could show a convincing fake login screen under the official Gemini domain, which could be used for phishing; the text does not show credential theft actually occurring.
What the attacker needed
Gemini's code execution feature; victim views the crafted output
The fix
The output of executed Python should be HTML-encoded before display; the report's timeline says the issue was fixed in November 2025.
How it was found
- Ask Gemini to run a Python script whose print output contains HTML and CSS.
- The script's output is rendered as live page elements rather than plain text.
- The injected CSS covers the whole chat interface with a fake sign-in screen.
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.
Gemini can run small Python programs for you. Normally, any text a program prints should be shown as plain text, so characters like angle brackets stay visible rather than becoming part of the page. Here the printed text was treated as real web page code, letting an attacker draw a fake login box on top of the real Gemini page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.