Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseAPI / Product · ActionableSimon Willison→ original

A Single Chat Link Could Hijack a ChatGPT Account, and OpenAI Paid $5,000

Researchers at Parameter Labs showed how to hijack a ChatGPT account: the victim only had to open a shared chat link. A mini-app running in the HTML preview broke out of its isolated sandbox through the MathLive library and YouTube, a domain allowed by the content security policy. OpenAI closed the hole and paid a $5,000 bug bounty. If your product displays AI-generated code, host it on a separate domain.

AI-processed from Simon Willison; edited by Hamidun News
A Single Chat Link Could Hijack a ChatGPT Account, and OpenAI Paid $5,000
Source: Simon Willison. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceSimon Willison ↗
Editor-in-Chief
Key metric #1The attack used postMessage and innerHTML in the MathLive keyboard
Key metric #2The CSP was bypassed via the YouTube oEmbed endpoint on the allowlist
Key metric #3Simon Willison considered the $5,000 reward too modest for a flaw of this severity

Imagine simply opening a link to someone else's ChatGPT chat, while a attacker's script reads your personal data and can act on your behalf. That is the attack the researchers at Parameter Labs described. OpenAI has already fixed the hole and paid them $5,000 through its bug bounty program. This is how companies pay independent specialists for vulnerabilities that are found and reported responsibly. Simon Willison picked up the analysis, and for anyone who displays code generated by a model in their product, it is a ready-made teaching example.

What Was Broken

The feature in question is what OpenAI previously called Canvas and now calls HTML previews. The model writes a small web app, and it runs directly in the conversation, inside a sandboxed iframe. The isolation exists so that foreign code cannot access OpenAI's APIs and read private data. It is like a guest let into one room: they can play around, but they don't have the keys to the rest of the house.

The attackers did not find one dramatic hole. They chained several minor weaknesses together, and each one looked harmless on its own.

How the Chain Worked

The first link was the MathLive library, which ChatGPT uses for graphs. It ships its own virtual keyboard. The parent page accepts messages for it via postMessage(). This is the standard way browser windows and frames pass data to each other. There was no protection against invoking this mechanism from another isolated frame, including an HTML preview.

The second link was the message handler. It wrote incoming content using innerHTML, so any sender could inject their own HTML into the ChatGPT page. innerHTML does not run scripts directly. But it can be used to insert a new iframe that is free of the sandbox restrictions.

The third link was the content security policy (CSP). This is a list of rules that tells the browser which scripts it may execute. OpenAI's policy completely forbade inline scripts and allowed loading resources from only a few domains. One of them was YouTube, and its oEmbed endpoint could reflect supplied JavaScript back in a way that the browser would execute. That gave the attackers the ability to run their own code on the ChatGPT page.

From there, it was straightforward. The script requested the user's private data through the ChatGPT API and sent it outward, for example by requesting an image from the attacker's server. It could also perform actions on the victim's behalf. The scenario: a link to a shared chat is created, another logged-in user opens it, and their data goes to the attacker.

What Developers Should Do

OpenAI has closed the vulnerability. Willison considers $5,000 a modest sum for a problem this serious. The reason is clear: people share chat links constantly, and the attack requires nothing more than a click.

Practical takeaways for anyone building AI products with generated code:

  • Serve such previews from a separate domain, not the main application domain. Then even escaped code gets no cookies and no access to your service's API.
  • Verify the origin and format of every postMessage, and do not use innerHTML with data from outside sources.
  • Treat the CSP allowlist as an attack surface. A single "harmless" domain with a reflecting endpoint can undo the entire protection.
  • Third-party libraries such as MathLive are also inside your trust boundary. Check which communication channels they open to the parent page.

There is one honest caveat. The write-up contains no data on whether attackers exploited the vulnerability before it was fixed. The details come from the researchers themselves and from Willison's summary. But the lesson is clear regardless: a sandbox for AI-generated code must be separated from the application itself, not just configured within it.

Story

Key Questions Answered

What Was Broken?

The feature in question is what OpenAI previously called Canvas and now calls HTML previews. The model writes a small web app, and it runs directly in the conversation, inside a sandboxed iframe. The isolation exists so that foreign code cannot access OpenAI's APIs and read private data. It is like a guest let into one room: they can play around, but they don't have the keys to the rest of the house. The attackers did not find one dramatic hole.

How the Chain Worked?

The first link was the MathLive library, which ChatGPT uses for graphs. It ships its own virtual keyboard. The parent page accepts messages for it via postMessage(). This is the standard way browser windows and frames pass data to each other. There was no protection against invoking this mechanism from another isolated frame, including an HTML preview. The second link was the message handler. It wrote incoming content using innerHTML, so any sender could inject their own HTML into the ChatGPT page.

What Developers Should Do?

OpenAI has closed the vulnerability. Willison considers $5,000 a modest sum for a problem this serious. The reason is clear: people share chat links constantly, and the attack requires nothing more than a click. Practical takeaways for anyone building AI products with generated code: Serve such previews from a separate domain, not the main application domain. Then even escaped code gets no cookies and no access to your service's API.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…