How We Took Over ChatGPT Accounts
我们是如何入侵ChatGPT账户的 Parameter Labs描述了一种他们发现的针对ChatGPT对“artifacts模式”(OpenAI以前称之为“Canvas”,但看起来最新版本称为“HTML预览”)实现的漏洞。在该模式中,交互式自定义HTML应用程序会在沙箱化的iframe中显示。确保这些HTML内容保持严格的沙箱化非常重要,以避免不受信任的代码与OpenAI API进行交互并访问私人数据。Parameter发现了一个相当复杂的攻击链。OpenAI在他们的图表支持中使用了MathLive JavaScript库,而该库包含了自己的虚拟键盘,可以通过沙箱化iframe通过postMessage()触发父页面。接收该消息的代码使用innerHTML,因此任何发送消息的内容都可以向父页面添加自定义HTML,并且没有机制阻止其他沙箱化框架(包括HTML预览框架)调用该方法。这意味着iframe中的不受信任代码可以插入HTML,虽然innerHTML不会直接执行脚本元素,但可以用来注入一个没有沙箱限制的新iframe。OpenAI的CSP规则完全阻止了内联脚本,并且只允许
How We Took Over ChatGPT Accounts 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. 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 , 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