读见

我们如何接管 ChatGPT 账户

原题How We Took Over ChatGPT Accounts

约 2 分钟约 303 字原文英文已翻译

读前速览

4 个要点

Parameter Labs 在 ChatGPT 的 HTML 预览中发现了一个漏洞,通过复杂的沙箱绕过攻击链,可实现账户接管和数据窃取。

  1. HTML 预览中的沙箱绕过

    ChatGPT 使用沙箱化 iframe 来运行交互式应用,但其实现未能阻止沙箱帧通过 postMessage 触发父页面方法。

  2. 复杂攻击链的组成部分

    该漏洞利用 MathLive 库的虚拟键盘向父页面注入 innerHTML,从而插入一个不受沙箱限制的新 iframe。

  3. 通过 YouTube 绕过 CSP

    虽然 CSP 策略阻止了内联脚本,但攻击者利用允许的 YouTube oEmbed 端点来反射并执行 JavaScript,从而获得对会话的控制权。

  4. 对用户隐私的影响

    一旦实现 JavaScript 执行,攻击者便可以从 OpenAI API 获取私有数据,并通过图片引用将其窃取,实际上实现了账户接管。

完整摘要

文章详细介绍了 ChatGPT「HTML 预览」(原 Canvas)功能中的一个安全漏洞。攻击者利用 MathLive JavaScript 库及其虚拟键盘功能,绕过 iframe 沙箱限制,向父页面注入 HTML。这使得攻击者能够创建一个不受限制的 iframe,并利用 YouTube 的 oEmbed 端点执行任意 JavaScript。因此,攻击者可以访问私有 API,窃取用户数据或以受害者名义执行操作。

查看原文

2026年10月31日 - Link 博客31st October 2026 - Link Blog

我们如何接管 ChatGPT 账户(通过……)Parameter Labs 描述了他们发现的一种漏洞,针对的是 ChatGPT 对 artifacts 模式的实现(OpenAI 过去称之为“Canvas”,但看起来最新版本叫作 HTML 预览),该模式会在沙盒化的 iframe 中展示交互式自定义 HTML 应用。How We Took Over ChatGPT Accounts (via) 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), where interactive custom HTML apps are displayed in a sandboxed iframe.

务必将这些内容中的 HTML 严格限制在沙箱内,以避免不可信代码与 OpenAI API 交互并访问私有数据。It's important that HTML in these stays tightly sandboxed to avoid untrusted code interacting with OpenAI APIs and accessing private data.

Parameter 发现了一条相当复杂的攻击链。OpenAI 使用 MathLive JavaScript 库来支持图表功能,而该库内置了自己的虚拟键盘,可通过沙盒 iframe 中的 postMessage() 在父页面中触发。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, which can be triggered in the parent page via postMessage() from the sandboxed iframe.

接收消息的代码使用了 innerHTML,因此任何发送消息的内容都能向父级添加自定义 HTML;而且没有任何机制阻止其他沙盒化框架(包括 HTML 预览框架)调用该方法。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.

这意味着 iframe 中不受信任的代码可以插入 HTML。虽然 innerHTML 不会直接执行 script 元素,但它可以被用来注入一个不受沙箱限制的新 iframe。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 的 CSP 规则完全禁止内联脚本,只允许从少数几个域加载脚本,其中之一是 YouTube;而 YouTube 的 oEmbed 端点可以用来反射 JavaScript,从而使其得到执行。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.

一旦攻击者能在 ChatGPT 上执行 JavaScript,就可以轻易地从 API 获取用户私有数据,并通过图像引用将其外传。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.

最终结果是:你可以创建一个 ChatGPT 分享链接,其他已登录用户访问后,你就能窃取他们的私人数据,或冒充他们执行操作。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 修复了这个漏洞,并支付了 5,000 美元的漏洞赏金;我觉得对于如此严重的漏洞来说,这笔钱有点少。OpenAI closed the hole and paid out a $5,000 bug bounty, which I think was a bit cheap for a vulnerability this serious.

值得记下

  1. 确保这些 HTML 内容被严格沙箱化非常重要,以避免不可信代码与 OpenAI API 交互并访问私有数据。
  2. 最终结果是:你可以创建一个 ChatGPT 分享链接,当另一个已登录用户访问时,该链接可以窃取他们的私有数据或以他们的名义执行操作。
  3. OpenAI 修复了该漏洞并支付了 5000 美元的漏洞赏金,我认为对于如此严重的漏洞来说,这个金额有点低。