Simon Willison 转述 Parameter Labs 披露的 ChatGPT 沙箱逃逸漏洞攻击链:HTML 预览 iframe 中的不可信代码可通过 postMessage 触发
MathLive 虚拟键盘的 innerHTML 注入,再借助被 CSP 允许的 YouTube oEmbed 端点反射执行 JavaScript,最终可窃取登录用户的私有数据或代其操作。
我们如何接管 ChatGPT 账户:https://www.parameter.ai/labs/we-found-a-gap-at-openai (来源:https://news.ycombinator.com/item?id=50314699)Parameter Labs 描述了他们发现的针对 ChatGPT 人工制品模式实现的漏洞(OpenAI 以前称其为“Canvas”,但最新版本似乎称为 HTML 预览:https://help.openai.com/en/articles/20001246-working-with-writing-blocks-and-code-blocks-in-chatgpt),在该模式中,交互式自定义 HTML 应用在沙箱 iframe 中显示。
确保其中的 HTML 严格在沙箱内运行非常重要,以避免不受信任的代码与 OpenAI API 交互并访问私人数据。
Parameter 发现了一个相当复杂的攻击链。OpenAI 在其图表支持中使用了 MathLive JavaScript 库,该库包含自己的虚拟键盘:https://mathlive.io/mathfield/virtual-keyboard/,可以通过沙箱 iframe 的 postMessage() 在父页面中触发。
接收消息的代码使用 innerHTML,因此任何发送消息的内容都可以向父页面添加自定义 HTML —— 且没有机制阻止其他沙箱框架,包括 HTML 预览框架,调用该方法。
这意味着 iframe 中的不受信任代码可以插入 HTML,虽然 innerHTML 不会直接执行 script 元素,但它可以用来注入一个没有沙箱限制的新 iframe。
OpenAI 的 CSP 规则完全阻止了内联脚本,并且只允许从少数域加载脚本,而其中一个是 YouTube —— YouTube 的 oEmbed 端点可用于以执行 JavaScript 的方式反射回 JavaScript。
一旦攻击在 ChatGPT 上执行了 JavaScript,就很容易从 API 获取私人用户数据并通过图片引用将其外泄。
最终结果:你可以创建一个 ChatGPT 分享 URL,当其他已登录用户访问该 URL 时,可以外泄他们的私人数据或代表他们执行操作。
OpenAI 修补了这个漏洞,并支付了 5000 美元的漏洞赏金,我认为对于如此严重的漏洞,这个金额有点低。
这是 Simon Willison 于 2026 年 10 月 31 日发布的一个链接帖子:/2026/Oct/31/。
每月赞助我 10 美元即可获得精选电子邮件摘要,其中包含本月最重要的 LLM 发展动态。
How We Took Over ChatGPT Accounts:https://www.parameter.ai/labs/we-found-a-gap-at-openai (via:https://news.ycombinator.com/item?id=50314699) Parameter Labs describe an exploit they found against ChatGPT's implementation of the artifacts pattern (OpenAI used to call this "Canvas" but it looks like the latest revision is called HTML previews:https://help.openai.com/en/articles/20001246-working-with-writing-blocks-and-code-blocks-in-chatgpt), where interactive custom HTML apps are displayed in a sandboxed iframe.
It's important that HTML in these stays tightly sandboxed to avoid untrusted code interacting with OpenAI APIs and accessing private data.
Parameter found quite a complex attack chain. OpenAI use the MathLive JavaScript library as part of their graph support, and that library includes its own virtual keyboard:https://mathlive.io/mathfield/virtual-keyboard/, which can be triggered in the parent page via postMessage() from the sandboxed iframe.
That message receiving code uses innerHTML , so anything that sends a message can add custom HTML to the parent - and there was no mechanism to prevent other sandboxed frames, including HTML preview frames, from calling that method.
This meant untrusted code in an iframe could insert HTML, and while innerHTML doesn't directly execute script elements it could be used to inject a new iframe without sandbox restrictions.
OpenAI’s CSP rules blocked inline scripts entirely, and only allowed script loading from a handful of domains, but one of those was YouTube - and the YouTube oEmbed endpoint could be used to reflect JavaScript back in a way that executed it.
Once the attack had JavaScript execution on ChatGPT, it was trivial to fetch private user data from APIs and exfiltrate it via an image reference.
The end result: you could create a ChatGPT share URL which, when visited by another signed-in user, could exfiltrate their private data or take actions on their behalf.
OpenAI closed the hole and paid out a $5,000 bug bounty, which I think was a bit cheap for a vulnerability this serious.
This is a link post by Simon Willison, posted on 31st October 2026:/2026/Oct/31/.
Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.