Hacker News ★ 94 7 min

A heap overflow and SSO misconfiguration to compromise OpenAI internal repos

🔗 https://www.hacktron.ai/blog/hacking-openai

📌 一支論壇圖片上傳漏洞,如何鏈成OpenAI內部程式碼庫的存取權

TL;DR:研究團隊串連libheif堆疊溢位與OpenAI SSO設定錯誤,72小時內從論壇RCE走到員工Codex帳號。

一張看似無害的HEIC圖片上傳,最後能讓外部研究者用OpenAI員工的Codex帳號,在OpenAI內部monorepo裡開一個PR。這不是想像,而是安全研究團隊Hacktron在2026年7月25日實際完成的攻擊鏈,而整段過程從發現漏洞到取得內部倉庫存取,只花了不到72小時。

🤔 論壇的「Sign in with OpenAI」,成了跳板的關鍵假設

OpenAI的官方論壇community.openai.com使用Discourse架設,並支援透過auth.openai.com的「Sign in with OpenAI」SSO登入。Hacktron團隊在摸清OpenAI服務與基礎架構後推測:只要能攻陷這個論壇,就有機會透過這條身分驗證流程,滲透進OpenAI更廣泛的服務。由於使用者能把GitHub、Slack、Email等多種服務連接到ChatGPT與Codex帳號,理論上暴露的攻擊面相當可觀。要驗證這個假設,第一步是先在Discourse論壇上拿到RCE。

🧩 從HEIC圖片到heap overflow:libheif的未回補安全修復

Discourse本身並不是容易的攻擊目標,團隊過去也曾研究過,於是轉向其依賴套件。他們在檢視Discourse圖片上傳流程時發現,Discourse原本用FastImage做圖片檢查,但FastImage不支援HEIF格式,因此HEIC/HEIF檔案會被轉交給ImageMagick的magick指令做轉換,這使得底層的libheif解析器直接暴露在攻擊者可控的檔案面前。

團隊用Claude Opus 4.8檢查Discourse Docker映像中安裝的libheif套件,發現某些安全修復並未被回補(backport)到該版本,導致HEIC解碼過程中出現heap buffer overflow,可產生越界讀寫(OOB R/W)原語。值得注意的是,這段有問題的程式碼在上游其實已於前一年修改過,但當時的commit並未被標記為安全修復,也沒有拿到CVE編號——這很可能正是Debian 12與13遲遲沒有跟進回補的原因。Discourse的Docker映像基於Debian 12,安裝的是有漏洞的libheif 1.19.7版;即使是Debian 13,在事發當時裝的1.19.8版同樣受影響。Debian直到8月8日才發布Debian 13的對應安全更新。

🧩 Opus 5上線當晚,exploit從ARM64搬到x86-64/jemalloc

7月24日,團隊先用Opus 4.8在關閉ASLR的情況下做出可用的ImageMagick/libheif程式碼執行exploit,但要在ASLR開啟、貼近Discourse預設設定的環境下做到穩定利用,多次嘗試並不順利。就在當天晚上,Anthropic發布了Claude Opus 5。團隊用新模型重新開始,三小時內先在本地Mac上做出可用的ARM64 exploit,再要求它移植到Discourse實際使用的x86-64與jemalloc記憶體配置環境。到7月25日清晨6點,他們已透過圖片上傳確認了本地RCE。

接著團隊把Claude放進自主的/goal迴圈,讓它攻擊自己架設的Discourse Cloud instance,並用rce.ee/ctf-forum做代理讓目標看起來像CTF題目——原因是Opus本身會拒絕針對真實遠端目標撰寫exploit。上午10點再檢查時,agent已經在Discourse Cloud上拿到RCE,並透過讀取/etc/hosts證明存取。團隊用產生出的exploit腳本,最終在OpenAI自己的Discourse實例上取得RCE,驗證了論壇會員可被零互動(no interaction)方式接管ChatGPT/Codex帳號的假設,隨即通報OpenAI。之後他們接管了一名OpenAI員工的帳號,其Codex恰好連結到OpenAI的GitHub組織。為了證明影響力但不實際窺探任何內部程式碼,團隊向這名員工的Codex送出一則prompt,請它在OpenAI內部monorepo中開了PR #1186742。

📊 72小時時間線與後續處理

時間事件
7/25 05:00–06:00 UTC取得Discourse社群環境的RCE與管理員權限
7/25 08:00–10:00 UTC向OpenAI Bugcrowd計畫提交報告
7/25 13:30–15:30 UTC建立內部monorepo的無害PoC PR,並停止一切測試
7/25 22:49 UTCOpenAI確認修復完成
7/25向Discourse HackerOne計畫提交報告
7/27Discourse完成修復並加入圖片處理沙箱作為深度防禦
7/28Discourse發布安全公告GHSA-vhm9-85gw-x335
9/1OpenAI核發6,500美元賞金並結案

⚠️ 一個容易被忽略的細節:賞金範圍不含對Discourse本身的測試

OpenAI在結案留言中特別澄清:針對Discourse託管的community.openai.com本身的測試,其實明確排除在OpenAI漏洞賞金計畫範圍之外;這筆6,500美元獎金認可的是OpenAI端的問題(即SSO身分驗證流程被利用的部分),而非團隊對Discourse所做的操作。若你自架Discourse,也要留意:僅更新網頁介面並不會替換底層映像檔,官方建議在/var/discourse下執行git pull後接著./launcher rebuild app才能真正套用修復。

🎯 實務啟示

這個案例提醒工程團隊幾件事:第三方圖片處理函式庫(尤其是HEIC/HEIF/AVIF解碼路徑)是容易被忽視的攻擊面,且作業系統套件的安全回補未必即時;SSO與帳號連接的第三方服務(GitHub、Slack、Email)會放大單點漏洞的影響範圍;而AI模型被用於加速exploit開發本身也是值得關注的雙面刃趨勢。Hacktron團隊表示後續已將研究延伸為「HEIF Heist」,追蹤libheif在Slack、Meta、GitHub Enterprise、Ruby on Rails,以及Next.js、Astro、Gatsby等Node.js框架中的影響面,若你的應用程式會接受使用者上傳的.heic/.heif/.avif檔案,很可能也在受影響範圍內。

🔗 來源

  • 標題:A heap overflow and SSO misconfiguration to compromise OpenAI internal repos
  • 作者/機構:Hacktron(Harsh Jaiswal、Mohan Pedhapati、Rahul Maini)
  • 連結:https://www.hacktron.ai/blog/hacking-openai

#OpenAI #SecurityResearch #BugBounty #libheif #Discourse #SSO #HeapOverflow #ResponsibleDisclosure #ExploitDev #InfoSec

原始資料 Hacker News · 收集於 2026-09-18
來源原標題
A heap overflow and SSO misconfiguration to compromise OpenAI internal repos
作者
Handy-Man
原始標籤
hackernews
來源訊號
HN points 444 HN 留言 189
原始連結
https://www.hacktron.ai/blog/hacking-openai

摘要原文

Intro On July 25, 2026, we chained two critical vulnerabilities to compromise multiple OpenAI employees’ ChatGPT accounts. With these accounts, we could then access internal OpenAI repositories, and potentially many other connectors. To prove we had in fact gained the access we believed without allowing ourselves to learn any sensitive information, we used the employee’s Codex to open a PR #1186742 in OpenAI’s internal monorepo openai/openai . Exploit chain libheif Image decoder Debian Missing security backport ImageMagick Uses libheif Discourse Image uploads OpenAI forum community.openai.com OpenAI SSO Identity flaw ChatGPT / Codex Account access GitHub Connected integration Internal repos OpenAI Until two months ago, any user or OpenAI employee logging into OpenAI’s own help forum ( community.openai.com ) could have had their ChatGPT and Codex accounts taken over. Since people can connect various services to Codex and ChatGPT, the scope of what we could theoretically access was huge, including GitHub, Slack and emails. The entire timeline from initial discovery to access to OpenAI repo access took place in less than 72 hours. We immediately reported the initial vulnerability to OpenAI and Discourse and worked with them to coordinate the patch. We appreciate their attention to detail and fast resolution of this issue. OpenAI also paid us a $6,500 bounty. We provide a full timeline of the disclosure process here. The rest of the post details how we discovered the two vulnerabilities, how we used claude models, as well as our takeaways from this experience. 25 July 2026 05:00–06:00 UTC Initial Finding HacktronAI team obtained remote code execution (RCE) and administrative access to the Discourse environment hosted at community.openai.com . 25 July 2026 08:00–10:00 UTC Bugcrowd Submission After confirming the cross-product impact, the team coordinated internally on the responsible disclosure process and submitted a report through OpenAI’s Bug Bounty Program on Bugcrowd. 25 July 2026 13:30–15:30 UTC OpenAI Employee Account Access & Proof of Concept To demonstrate the practical impact of the vulnerability, we created a harmless proof-of-concept pull request in OpenAI’s internal monorepo (link redacted at OpenAI’s request). We updated the existing Bugcrowd submission with these findings, reached out to friends at OpenAI on Twitter/X to notify them directly, and ceased all further testing at approximately 15:30 UTC . 25 July 2026 22:49:45 UTC OpenAI-Side Fix Confirmed OpenAI replied to the report confirming the issue had been fixed, roughly 14 hours after the initial submission. 25 July 2026 Discourse Reported via HackerOne We submitted a report to Discourse through its HackerOne program. 26 July 2026 Discourse Responded Discourse replied to the report on Sunday. 27 July 2026 Discourse Fix Ready Discourse had a fix ready by Monday and added image-processing sandboxing as defense in depth. 28 July 2026 Discourse Advisory Published Discourse published GHSA-vhm9-85gw-x335 with patch and rebuild guidance. 01 Sep 2026 OpenAI Rewarded $6,500 Bounty and Marked Resolved OpenAI comment — To clarify the scope of that award: testing against the Discourse-hosted community.openai.com was explicitly excluded from our bug bounty program. The award recognizes the OpenAI-side finding, not the actions against Discourse. Background A few months ago, our team at Hacktron, led by Harsh Jaiswal alongside Mohan Pedhapati and Rahul Maini, began researching frontier AI companies to find security vulnerabilities. This led us to discover an SSO misconfiguration in OpenAI’s identity infrastructure and a libheif RCE in the community forum used by OpenAI. We’ve since expanded the research into HEIF Heist , a multi-month investigation tracing libheif across Slack, Meta, GitHub Enterprise, Ruby on Rails, and Node.js frameworks such as Next.js, Astro, and Gatsby. A surprising amount of widely-used software depends on this one image-processing library. If your application processes user-controlled images and accepts .heic/.heif/.avif images, it is highly likely it is affected. Please reach out to us at hello@hacktron.ai if you need any kind of assistance. Hacking community.openai.com Warning Patch notice: If you self-host Discourse, rebuild your installation now. Older Docker images may contain a vulnerable libheif dependency that permits code execution through an image upload. Run git pull followed by ./launcher rebuild app from /var/discourse ; a web-interface update alone may not replace the underlying image. Discourse-hosted customers have already been patched. See the security advisory . OpenAI uses Discourse for their forum and allows “Sign in with OpenAI” through auth.openai.com . After getting a good understanding of OpenAI’s services and infrastructure, we had reason to believe that compromising the forum could create a path into broader OpenAI services through this identity flow. To test that hypothesis, we first needed remote code execution on an OpenAI service like the Discourse community forum. While the Discourse app itself is actually not an easy target (we have looked into it in the past), we thought we could go after a dependency. Heap buffer overflow in libheif On July 23, we started reviewing Discourse’s image-upload pipeline, and we found that HEIC and HEIF files followed an unusual path. Discourse normally used FastImage for image checks, but because FastImage did not support HEIF, it passed those files to ImageMagick’s magick command for conversion. 2 That exposed the underlying libheif parser directly to attacker-controlled files. We started an Opus 4.8 session with the Discourse Docker image and asked it to inspect the installed libheif package for security issues. After a while, it found that some particular security fixes were not back-ported to the libheif package. This allowed an heap buffer overflow leading to OOB R/W primitives during HEIC decoding. Interestingly, the vulnerable code had been changed upstream the previous year, but the commit was not documented as a security fix and received no CVE. 3 This might be a reason why Debian 12 and 13 have not received the security relevant backports in time. Because Discourse’s Docker image was based on Debian 12, it installed the vulnerable libheif version 1.19.7. Even Debian 13 still shipped the vulnerable version 1.19.8 at the time. Since then, Debian has published its security update for Debian 13 on August 8, 2026. 4 On July 24, we used Opus 4.8 to develop a working ImageMagick/ libheif code-execution exploit with ASLR disabled. We then launched several separate sessions to make it reliable against Discourse’s default configuration with ASLR enabled, which wasn’t fruitful. Opus 5 Released That evening, Anthropic released Claude Opus 5. 5 We started a new session, which first produced a working ARM64 exploit for a local Mac within 3 hours. We then asked it to port the exploit to the x86-64 environment and jemalloc configuration used by Discourse. By 6:00 a.m. on July 25, we had confirmed local RCE through an image upload. We then placed Claude in an autonomous /goal loop against our own Discourse Cloud instance, proxied through rce.ee/ctf-forum to make it look like a CTF target as Opus refused write exploit for remote instances. When we checked again at 10:00 a.m., the agent had achieved RCE on Discourse Cloud and demonstrated access by reading /etc/hosts . Using the generated exploit script, we managed to get RCE on OpenAI’s instance. After we had confirmed our hypothesis of no interaction account takeover of ChatGPT/Codex accounts from active members of the forum, we immediately sent our report to OpenAI. We then took over an OpenAI employee’s account, whose Codex was connected to OpenAI’s Github organization. To demonstrate impact without actually accessing any internal code, we sent a prompt to this employee’s Codex account to open a PR for us in OpenAI’s internal monorepo. (444 points, 189 comments on Hacker News)

由 claude-code/sonnet 自動生成