
Key points
- Untrusted HTML in ChatGPT previews could inject unrestricted iframes via MathLive.
- The exploit used YouTube oEmbed to bypass Content Security Policy script restrictions.
- OpenAI patched the flaw and paid a $5,000 bug bounty to the researchers.
Parameter Labs reported a vulnerability in ChatGPT’s HTML preview feature that allowed attackers to take over user accounts.reported The exploit chain enabled untrusted code to escape sandboxing and interact with the parent page.
The evidence
According to Simon Willison’s report on Parameter Labs’ findings, the attack targeted the artifacts pattern, previously known as Canvas.reported Interactive custom HTML applications are displayed within sandboxed iframes to prevent untrusted code from accessing OpenAI APIs or private data.
Parameter Labs identified a complex attack chain involving the MathLive JavaScript library. OpenAI uses this library for graph support, and it includes a virtual keyboard feature. This keyboard can be triggered in the parent page via postMessage() calls from the sandboxed iframe.
The code handling these messages used innerHTML to process input. This meant any sender could add custom HTML to the parent page. There was no mechanism to prevent other sandboxed frames, including HTML preview frames, from invoking this method.
Untrusted code in an iframe could therefore insert HTML into the parent context. While innerHTML does not directly execute script elements, it allowed the injection of a new iframe without sandbox restrictions. This bypassed the intended isolation of the preview environment.
OpenAI’s Content Security Policy blocked inline scripts and restricted script loading to specific domains. However, YouTube was an allowed domain. Attackers used the YouTube oEmbed endpoint to reflect JavaScript back in a way that executed it.
The result was a shareable ChatGPT URL that could exfiltrate private data or perform actions on behalf of signed-in users. OpenAI closed the vulnerability after the report. The company paid a $5,000 bug bounty for the disclosure.
The decision
The incident highlights the risks of complex dependency chains in sandboxed environments. Allowing postMessage() interactions with libraries that modify the DOM via innerHTML creates significant exposure. Even strict CSP rules can be circumvented if trusted domains reflect executable content.
The takeaway
Sandboxing effectiveness depends on rigorous input validation for all cross-frame communications. Using innerHTML for messages from untrusted sources is inherently dangerous. Developers must ensure that sandboxed contexts cannot influence the parent document’s structure.
Building on this
Developers building interactive HTML previews must isolate sandboxed content from parent-page DOM manipulation. Use textContent instead of innerHTML when processing postMessage() data. Validate message origins and restrict which frames can trigger sensitive functions. Ensure Content Security Policies do not allow trusted domains to reflect executable scripts. Audit third-party libraries like MathLive for unintended side effects in sandboxed contexts.
Why it matters
- Enterprise IT buyers must verify that AI platforms sandbox untrusted HTML previews effectively.
- The use of innerHTML for cross-frame messages poses a critical security risk.
- Trusted domains in CSP can be abused if they reflect executable content.
- Bug bounty payouts may not reflect the severity of account takeover vulnerabilities.
Topics: OpenAI, ChatGPT, security, sandboxing, bug bounty
Updated
Story timeline
- 31 Oct 2026 Do the math: How we took over ChatGPT accounts
- 31 Oct 2026 How We Took Over ChatGPT Accounts
Ask the article
Local keyword search of this article; no generated answers.Did this article give you the evidence you needed?
Your choice stays on this device. No public tally.Questions readers ask
How did the ChatGPT sandbox bypass work?
Untrusted code used postMessage() to trigger MathLive’s virtual keyboard, injecting HTML via innerHTML and creating unrestricted iframes.
What was the impact of this vulnerability?
Attackers could create shareable URLs that exfiltrate private data or perform actions on behalf of signed-in users.
Did OpenAI fix the issue?
Yes, OpenAI closed the vulnerability and paid a $5,000 bug bounty to Parameter Labs.
Connected stories
Reading receipt
- Untrusted HTML in ChatGPT previews could inject unrestricted iframes via MathLive.
- The exploit used YouTube oEmbed to bypass Content Security Policy script restrictions.
- OpenAI patched the flaw and paid a $5,000 bug bounty to the researchers.