Skip to content
XSS Write-up Intermediate

Deepseek Ai In Chat Unveils The Risks Of Prompt Injection To Account Takeover

The author claims that Deepseek AI's chat interface processes uploaded files and renders their content, allowing an attacker to embed a prompt injection that causes the AI to output an iframe with a JavaScript URL. This could execute script in the user's browser, stealing the session token from localStorage and cookies, potentially leading to account takeover.

Adesh Kolte Follow

Published on infosecwriteups.com

I am Adesh Kolte, an Offensive Security Engineer specializing in both Web2 and Web3 ecosystems. One morning, as part of my routine exploration of AI security, I began experimenting with Deepseek AI to assess its capabilities and found something interesting.

Adesh Kolte, on infosecwriteups.com

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 AI chat interface renders user-supplied content (including AI-generated output) without sanitising it, allowing JavaScript execution via an iframe with a javascript: URL.

Impact

The JavaScript could retrieve the user's session token from localStorage and cookies, and if an attacker obtains this token, it could allow account takeover.

What the attacker needed

Victim uploads a malicious file; victim asks AI to show file content; AI renders unsanitised output

How it was found

  1. Create a text file containing a Base64-encoded XSS payload that decodes to an iframe with a javascript: URL.
  2. Go to Deepseek AI's chat interface and upload the file.
  3. Ask Deepseek AI to show the content of the uploaded file.
  4. If Deepseek AI executes the prompt, it renders the JavaScript, causing XSS execution.

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.

This report suggests that an AI chat tool might display content from uploaded files without proper safety checks. An attacker could craft a file that tricks the AI into showing a malicious link or script. If a user then views that content, the script could run in their browser and steal their login token, letting the attacker take over their account.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.