Tech8 min read

From a Single Image to OpenAI Monorepo: How a libheif Heap Overflow and SSO Flaw Chained to PR #1186742

IkesanContents

TL;DR

What happened On September 18, 2026, security research team Hacktron AI published details of a multi-stage exploit chain combining a Discourse image decoder vulnerability and an OpenAI SSO flaw to compromise employee ChatGPT and Codex accounts, reaching OpenAI’s internal monorepo in under 72 hours.

Attack entry point The image upload pipeline of OpenAI’s public forum (community.openai.com). Because Discourse’s FastImage did not support HEIC files, it passed them to ImageMagick’s magick command, exposing the underlying C/C++ decoder libheif.

The underlying bug A heap buffer overflow in libheif. The bug had been patched upstream a year earlier, but was categorized as a clean-up commit with no security notice and no CVE assigned. As a result, Debian never backported the fix.

Role of AI agents The team utilized Claude models to construct the exploit. After struggling with ASLR in Opus 4.8, the newly released Claude Opus 5 produced a working ARM64 exploit in 3 hours, which was ported to x86-64/jemalloc and verified via an autonomous /goal loop.

The SSO pivot Gaining RCE on the Discourse server allowed the researchers to exploit an identity configuration flaw in OpenAI SSO (auth.openai.com), taking over active forum users’ ChatGPT and Codex sessions.

Impact proof Without reading or exfiltrating any sensitive internal code, the team prompted an employee’s Codex to open a harmless pull request (PR #1186742) in OpenAI’s internal monorepo (openai/openai).

Resolution & bounty OpenAI patched the SSO flaw roughly 14 hours after the report. Discourse shipped an ImageMagick sandboxing defense-in-depth update, and OpenAI awarded a $6,500 bug bounty.

Security research team Hacktron AI disclosed on September 18, 2026, how they chained an image decoder flaw in Discourse with an OpenAI Single Sign-On (SSO) configuration issue to reach OpenAI’s internal monorepo through compromised employee credentials.
The responsible disclosure exercise took place on July 25, 2026, taking less than 72 hours from initial discovery to repository access.

The incident was not a single critical bug, but a multi-stage exploit chain.
A memory corruption vulnerability in an external help forum cascaded through central authentication infrastructure, reaching the company’s internal GitHub development environment.

The exploit chain: From HEIF upload to internal PR

The full attack flow is illustrated below:

flowchart TD
  A["Upload HEIC/HEIF image to community.openai.com"] --> B["Discourse falls back to ImageMagick<br/>magick command due to FastImage limitation"]
  B --> C["libheif decodes HEIC image<br/>Heap buffer overflow triggered"]
  C --> D["ASLR bypassed on forum server<br/>Remote Code Execution (RCE) achieved"]
  D --> E["Exploit OpenAI SSO identity flaw<br/>Hijack active forum user sessions"]
  E --> F["Take over OpenAI employee ChatGPT / Codex accounts"]
  F --> G["Access internal GitHub organization via employee Codex integration"]
  G --> H["Open PR #1186742 in internal monorepo openai/openai"]

Each stage of the chain served a distinct role:

StageTarget ComponentAction TakenGained Capability
1. Entrycommunity.openai.com (Discourse)HEIF image uploadExecution of image conversion pipeline
2. Vulnerability 1libheif 1.19.7 (Debian 12)Heap buffer overflowOut-of-bounds read/write (OOB R/W) primitive
3. Code ExecutionForum containerShell payload generated with Claude Opus 5Remote code execution and container admin
4. Vulnerability 2auth.openai.com (OpenAI SSO)SSO identity handling flawHijacking sessions of logged-in forum users
5. Lateral MovementEmployee ChatGPT / CodexAccount takeoverAccess to connected internal GitHub organization
6. Impact ProofInternal monorepo openai/openaiPrompted Codex to commit and open PRProved write capability in internal codebase

While the initial entry was an unauthenticated help forum, the endpoint was an employee’s personal development environment and internal codebase.

The silent patch trap in libheif

The attack vector originated in Discourse’s image upload handling.
Discourse typically checks image dimensions and headers using FastImage.
However, because FastImage does not support HEIC or HEIF files, Discourse passed those files to ImageMagick’s magick command for conversion.

This fallback routed untrusted user input directly into libheif, a C/C++ image parsing library.
We previously examined a similar pattern in Rails CVE-2026-66066, where Active Storage fell back to libvips and exposed server credentials.
Even when the web application framework itself is hardened, handing parsing off to deep native media libraries sharply broadens the attack surface.

Compounding the risk was how libheif handled the bug fix.
Upstream had fixed the underlying issue a year earlier with commit 85e21ad44 (“simplify overlay overlap area computation”).
However, the commit was treated as standard code maintenance, lacked any security advisory, and received no CVE identifier.

Because vulnerability databases never logged the issue, the Debian project had no trigger to backport the patch.
Discourse’s Docker image ran Debian 12, leaving the vulnerable libheif 1.19.7 active in production.
As explored in SQLite’s fake CVE controversy and unreviewed advisory databases, software ecosystems frequently struggle with CVE noise while critical memory safety fixes remain hidden in undocumented commits, never reaching downstream distributions.

Overcoming ASLR in three hours with Claude Opus 5

Turning a heap corruption bug into a reliable remote shell in production is notoriously difficult.
Discourse’s target environment enforced ASLR (Address Space Layout Randomization) and utilized jemalloc, preventing naive memory overwrites.

Hacktron AI used Anthropic’s Claude models to assist in the vulnerability analysis and exploit development.
The researchers set up target Docker containers, defined exploitation constraints, and orchestrated the iteration loops.
With Claude Opus 4.8, the team managed to obtain a working exploit on a local container with ASLR disabled, but hit a wall trying to bypass ASLR in the default environment.

The breakthrough came with the release of Claude Opus 5 later that evening.
Feeding the exact same challenge to Opus 5, the model produced a functional ARM64 exploit within 3 hours.
The team then asked the model to port the payload to x86-64 and Discourse’s specific jemalloc heap layout.
By 6:00 a.m. UTC on July 25, 2026, the team confirmed local RCE via an image upload.

To test the remote attack, the team placed Claude in an autonomous /goal loop.
Because frontier models include safeguards against attacking live remote servers, the researchers routed traffic through a CTF-styled proxy (rce.ee/ctf-forum).
By 10:00 a.m. UTC, the agent successfully executed code on the remote Discourse instance and read /etc/hosts.

In our earlier coverage of WordPress 7.0.3 and XSS2Shell, pwn.ai deployed multi-agent workflows to chain DOM clobbering into admin account takeovers.
AI security agents have clearly moved beyond isolated code audits: they are now capable of assembling end-to-end exploit chains against real-world mitigations in hours.

How OpenAI SSO linked a forum to employee accounts

Under standard network segregation, compromising a public forum should not jeopardize internal core infrastructure.
Discourse is an external-facing community tool, isolated from OpenAI’s private development networks.

The link was created by Single Sign-On (SSO).
The forum provided a “Sign in with OpenAI” button routed through auth.openai.com.
Because Hacktron AI held administrative RCE over the forum server, they could intercept token exchange mechanisms during user logins.
An identity misconfiguration on OpenAI’s SSO side allowed attackers to translate control over the forum service into hijacked sessions for users’ ChatGPT and Codex accounts.

Crucially, this was not a Discourse bug.
OpenAI’s SSO identity architecture failed to maintain zero-trust isolation against compromised integration partners.
Had any other first-party or third-party tool connected to OpenAI SSO been breached, the exact same account takeover path would have opened.

Proving impact via PR #1186742 and a 14-hour turnaround

With employee credentials in hand, the team faced the ethical challenge of proving full impact without exfiltrating sensitive intellectual property.
One of the compromised accounts belonged to an active OpenAI engineer whose Codex tool was integrated with OpenAI’s internal GitHub organization.

Rather than cloning internal code or inspecting repositories, the researchers sent a prompt to the employee’s Codex interface, instructing it to open a pull request (PR #1186742) in the internal monorepo openai/openai.
By generating a benign change and opening a PR from inside the corporate boundary, the team definitively demonstrated unauthorized write access to core infrastructure without accessing private data.

The coordinated response proceeded rapidly:

Date & Time (UTC)PartyMilestone
July 25, 2026 05:00–06:00Hacktron AIAchieved initial RCE on forum container
July 25, 2026 08:00–10:00Hacktron AISubmitted vulnerability report via OpenAI Bugcrowd
July 25, 2026 13:30–15:30Hacktron AIOpened PR #1186742 via employee Codex; alerted OpenAI and stopped testing
July 25, 2026 22:49OpenAIConfirmed server-side SSO fix deployed (~14 hours after report)
July 25, 2026Hacktron AISubmitted report to Discourse via HackerOne
July 27, 2026DiscoursePrepared fix including ImageMagick sandboxing
July 28, 2026DiscoursePublished security advisory GHSA-vhm9-85gw-x335
August 8, 2026DebianReleased DSA-6417-1 patching libheif in Debian 13
September 1, 2026OpenAIAwarded $6,500 bounty recognizing the SSO finding
September 18, 2026Hacktron AIPublic technical write-up published

OpenAI deployed a fix for the SSO issue within roughly 14 hours of the report.
While attacks against Discourse were out of scope for OpenAI’s bug bounty program, OpenAI awarded a $6,500 bounty in recognition of the critical SSO finding.

Discourse also responded swiftly over the weekend, delivering a fix on Monday.
Rather than relying solely on upstream package updates, Discourse introduced process sandboxing for ImageMagick, ensuring that future parser bugs cannot compromise the host environment.

Hacktron AI has since expanded this research into “HEIF Heist,” analyzing libheif dependencies across major platforms including Slack, Zoom, Meta, Ruby on Rails, Next.js, and Astro.
As media parsers continue to exhibit memory safety vulnerabilities, strict process isolation and least-privilege identity federation remain essential defenses.