Hacking the Hacker’s Assistant: How I Found a Critical Stored X
The DeepSeek chatbot's HTML code preview ran generated code in an iframe without sandboxing or a Content-Security-Policy, so event handlers such as onerror executed in the main site's origin. An attacker could craft a chat containing a hidden payload and share it, so that anyone who clicked the Run button saw a native password prompt and had their input sent to an external server.
Published on medium.com
Today, I’m bringing you a wild story about how curiosity got the better of me. I was actually in the middle of testing another target for LLM prompt injection and XSS.
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
The HTML preview iframe lacked a sandbox attribute, a restrictive Content-Security-Policy, and sanitisation of event-handler attributes, so generated markup executed with the main site's origin and could make outbound requests.
Impact
Because shared chats could carry the payload, a single link could trick any visitor who clicked Run into typing their password into a native-looking prompt, which was then sent to the attacker; the report notes the victim did not need an account for the phishing aspect.
What the attacker needed
Victim clicks a shared chat link; victim clicks the Run button; no account needed for the phishing step
The fix
The preview iframe was later locked down, which the author says patched the issue.
How it was found
- Ask the chatbot to generate HTML that contains an image tag with an onerror handler which shows a prompt and sends the answer to an external URL.
- The chatbot outputs the code block with the payload intact.
- Click the Run button to preview the generated HTML.
- The browser shows a native password prompt and sends the entered value to the attacker's server.
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 can show a preview of HTML code it generates. Normally such previews should be isolated so the code cannot affect the main website. Here the preview was not isolated, so code hidden in a chat could run as if it were part of the chatbot site itself. That let an attacker show a fake password box and send whatever was typed to their own server.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.