Skip to content
AI Learning Ground Start learning

News ·

How We Took Over ChatGPT Accounts

Parameter Labs disclosed a complex attack chain against ChatGPT's HTML previews (the artifacts pattern) that let untrusted iframe code execute JavaScript on the parent page and take over other users' accounts; OpenAI fixed it and paid a $5,000 bounty.

Parameter Labs found an exploit in ChatGPT's implementation of the artifacts pattern, now called HTML previews, where interactive custom HTML apps run in a sandboxed iframe. The sandbox is meant to keep untrusted code from touching OpenAI APIs and private data, but the researchers built an attack chain that broke through, ultimately enabling account takeover.

The chain started with MathLive, a JavaScript library OpenAI uses for graph support. Its virtual keyboard is triggered via postMessage() from the sandboxed iframe, and the receiving code uses innerHTML, with nothing preventing other sandboxed frames from calling it. That let untrusted iframe code inject HTML into the parent page, including a new iframe without sandbox restrictions. OpenAI's CSP blocked inline scripts and limited script loading to a few domains, but YouTube was allowed, and its oEmbed endpoint could reflect JavaScript back in executable form. With JavaScript running on ChatGPT, the attackers could fetch private user data from APIs and exfiltrate it via an image reference.

The result was a ChatGPT share URL that, when visited by another signed-in user, could exfiltrate their private data or take actions on their behalf. OpenAI closed the hole and paid a $5,000 bug bounty, which Simon Willison called cheap for a vulnerability this serious. For anyone building AI products with sandboxed generated HTML, this shows how third-party libraries, permissive postMessage handling, and small CSP allowlists can combine into a full account takeover.

The takeaway for builders: sandboxing generated content requires defense in depth, since the artifacts pattern's entire security model depends on the iframe boundary holding. Every endpoint on your allowlist is an attack surface, and message handlers that render untrusted input via innerHTML can silently undo your sandbox.

References

Read the full story at Simon Willison ↗Like, save or discuss on Buzz

#tooling #prompting