Skip to content
XSS Write-up Advanced

Account takeover via prompt injection

The AI report generator embedded the user's access token in image URLs and allowed script injection via prompt injection, so a shared chat could execute script in the victim's session and exfiltrate their token. The attacker could steal another user's access token by sending a crafted report link that auto-clicked a confirmation button.

medium.com

Published on medium.com

Hello, I am Root. If you don’t know me, that’s fine, because someday you will.

Root0101, on medium.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 report generator embedded the user's access token in image URLs and allowed unsanitised script injection via prompt injection, combined with a permissive iframe sandbox and a wildcard frame-ancestors policy.

Impact

An attacker could steal another user's access token, leading to account takeover, but the initial exploit required the victim to click a confirmation button; the attacker later bypassed this with an auto-clicking iframe.

What the attacker needed

Victim opens a shared chat link; victim clicks 'OK' to copy chat (bypassed later); attacker can send a link to the victim

How it was found

  1. The attacker used a single-prompt request to make the AI generate a report containing a script that sends image paths to an external server.
  2. The attacker shared the entire chat history, which included the malicious report.
  3. The victim opened the shared chat link and clicked 'OK' to copy the chat, causing the script to run and exfiltrate the victim's token.
  4. To avoid the click, the attacker used another prompt to create a report on a subdomain that iframed the shared chat and auto-clicked the 'OK' button.
  5. The attacker sent the final report link to the victim, and the token was exfiltrated automatically.

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.

The AI tool made web pages that included the user's secret login token in image links. Because the tool also let the user's instructions add scripts to the page, an attacker could make a page that sent the victim's token to the attacker's server. The attacker then tricked the victim into opening a link that automatically clicked a button to load the malicious page.

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.