Skip to content
Disclosed report Advanced

Backdooring the next release of Codex through Github Action Pipeline exploit chaining

A prompt injection in a GitHub Actions workflow allowed any user to run commands inside the Codex agent sandbox. Attackers could then escape the sandbox, steal tokens, poison the cache, and plant a backdoored workflow with write access, risking malicious releases.

W0rty Follow

Originally disclosed on Bugcrowd

Bounty$1,000 Critical View original
  • Accepted in 56 days
  • Fixed in 56 days
  • Disclosed after 5 months

Summary by W0rty

Depi's Research Team discovered a full CI/CD compromise chain against openai/codex, starting from a prompt injection in the issue-labeler.yml workflow that lets any user embed attacker-controlled instructions in a GitHub issue and achieve command execution inside the Codex agent sandbox. From there, the team escaped the workspace-write sandbox by abusing .NET CLR debug pipes exposed in /tmp/ to read runner process memory and leak the ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN. Those credentials enabled GitHub Actions cache poisoning, pivoting execution into the more privileged rust-ci.yml workflow, gaining contents: write, and planting a persistent backdoored workflow with id-token: write. Because @openai/codex sees roughly 10M (spiking to 200M) weekly npm downloads, the chain represents a critical supply-chain risk capable of publishing malicious releases under a trusted OpenAI identity.

The original report as published on Bugcrowd, by W0rty. Images and videos are our own copies; raw HTML is shown as text. View it on Bugcrowd.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target is the openai/codex repository and its GitHub Actions pipelines. Codex is distributed as the npm package @openai/codex, which the report says sees roughly 10M weekly downloads, spiking to 200M. The report describes a full CI/CD compromise chain against that repository, starting from a prompt injection in the issue-labeler.yml workflow and ending with the ability to plant a persistent backdoored workflow that could publish malicious releases under a trusted OpenAI identity.

The entry point is the issue-labelling automation: a workflow that reacts to GitHub issues and, in this case, feeds issue content to the Codex agent. Because any GitHub user can open an issue, the content that reaches the agent is attacker-controlled.

Setup

The report says any user can embed attacker-controlled instructions in a GitHub issue on openai/codex. The chain then relies on the Codex agent sandbox running with a workspace-write profile, on .NET CLR debug pipes being exposed in /tmp/ inside that sandbox, and on the runner holding ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN in its process memory. The later stages depend on the repository's GitHub Actions cache and on a second, more privileged workflow, rust-ci.yml.

Finding it

The research team noticed that issue-labeler.yml passes issue content into the Codex agent. Since issue text is written by whoever opens the issue, an attacker can embed instructions in the issue that the agent then follows. That is the prompt injection: it turns a public, unauthenticated input channel into command execution inside the agent sandbox.

The second observation is that the sandbox profile is workspace-write, not a fully isolated environment, and that .NET CLR debug pipes are visible in /tmp/. The team abused those pipes to read runner process memory.

Exploitation

Step 1: Prompt injection in issue-labeler.yml

The attacker opens a GitHub issue containing instructions aimed at the Codex agent. When issue-labeler.yml processes the issue, the agent treats the embedded text as instructions and executes commands inside the Codex agent sandbox. This gives command execution as the first foothold.

Step 2: Sandbox escape via .NET CLR debug pipes

From inside the workspace-write sandbox, the team abused .NET CLR debug pipes exposed in /tmp/ to read the memory of runner processes. The objective was to extract the ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN held by the runner. The report does not include the specific commands or payloads used for this step.

Step 3: GitHub Actions cache poisoning

With the leaked ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN, the team poisoned the GitHub Actions cache. This pivoted execution into the more privileged rust-ci.yml workflow.

Step 4: Privilege escalation to contents: write

The pivot into rust-ci.yml gained the team contents: write.

Step 5: Persistent backdoored workflow with id-token: write

Using contents: write, the team planted a persistent backdoored workflow carrying id-token: write. The report characterises the chain as a critical supply-chain risk capable of publishing malicious releases under a trusted OpenAI identity.

Root cause

The chain starts with a prompt injection in issue-labeler.yml that lets any user embed instructions in an issue and achieve command execution in the Codex agent sandbox. The workspace-write sandbox is not sufficient isolation: the .NET CLR debug pipes in /tmp/ give a path from inside the sandbox to runner process memory, and therefore to the runner's tokens. Once ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN leak, the Actions cache becomes a pivot into a workflow with broader permissions, and contents: write allows persistence. The report does not describe which specific defences were in place or why they failed.

Impact

The report characterises the chain as a critical supply-chain risk. An attacker who can open an issue can reach command execution in the Codex agent sandbox, leak runner tokens, poison the Actions cache, pivot into rust-ci.yml, obtain contents: write, and plant a persistent backdoored workflow with id-token: write. Because @openai/codex has roughly 10M weekly npm downloads, spiking to 200M, the report characterises the chain as a critical supply-chain risk capable of publishing malicious releases under a trusted OpenAI identity. The report does not state that a malicious release was actually published.

Fix

Based on the chain, the changes that would break it are: stop passing untrusted issue content to an agent with command execution, or constrain the agent so injected instructions cannot cause execution; remove or restrict access to .NET CLR debug pipes inside the sandbox so process memory of the runner is not reachable; avoid exposing ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN to processes the agent can influence; and prevent cache poisoning from crossing into workflows with broader permissions such as contents: write and id-token: write.

Variants to test

  1. Other issue-triggered agents: look for workflows that pass issue titles, bodies or comments to an LLM agent with tool access. A positive result is the agent executing an instruction embedded in the issue text.
  2. Sandbox escape via debug interfaces: check /tmp/ and similar shared paths inside agent sandboxes for debug sockets or pipes (CLR, language runtimes, debuggers). A positive result is reading memory or environment of a process outside the sandbox.
  3. Token leakage from runner processes: after any sandbox escape, check whether ACTIONS_RUNTIME_TOKEN or GITHUB_TOKEN can be recovered. A positive result is a usable token.
  4. Cache poisoning as a pivot: test whether a workflow with limited permissions can write cache entries consumed by a workflow with broader permissions. A positive result is code execution in the privileged workflow.
  5. Persistence via contents: write: with write access, test whether a new workflow file with id-token: write can be committed and triggered. A positive result is a workflow that runs with OIDC token issuance.

Hunting notes

This class of bug tends to hide where automation consumes user-controlled text: issue labelling, triage bots, comment-triggered agents and any workflow that feeds GitHub content to an LLM with tools. During recon, look for workflows that trigger on issues and reference an agent or model, and for sandboxes that share /tmp/ with the runner. Signals include debug sockets or pipes in shared paths and workflows whose permissions differ sharply between the trigger workflow and the workflow that consumes its artefacts or cache. The report showed impact by carrying the chain all the way to a persistent workflow with id-token: write, which is what turns a sandbox escape into a supply-chain risk for a package with roughly 10M weekly downloads.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

A security research team found a way to take over the automated systems that build and publish a piece of software called Codex, which is made by OpenAI. Codex is distributed as the npm package @openai/codex, which the report says sees roughly 10M weekly downloads, spiking to 200M. That makes it a very attractive target: if you can slip a tampered version into that stream, a huge number of people install it without knowing.

The chain of events starts with something surprisingly simple. The issue-labeler.yml workflow lets any user embed attacker-controlled instructions in a GitHub issue and achieve command execution inside the Codex agent sandbox. Because anyone can write an issue, anyone can write text that the agent mistakes for instructions. That is called prompt injection.

From there the team chained the sandbox escape, token leak, cache poisoning and a privileged workflow to plant a persistent backdoored workflow. The report rates the whole thing critical. It does not say that a malicious release was actually published.

This article walks through the same chain step by step, explaining each concept from scratch.

Context

The target is the openai/codex repository and its GitHub Actions pipelines.

Let us unpack that sentence.

  • Repository: a project's folder of files, hosted on GitHub, with a full history of every change. Think of it as a shared drive with an undo history that never forgets.
  • GitHub Actions: GitHub's built-in automation service. You write small recipes called workflows, and GitHub runs them for you on its own computers whenever something happens, such as a new issue being opened or new code being pushed. The computers that run these recipes are called runners.
  • Pipeline: the sequence of automated steps that takes code from "someone proposed a change" to "a new version is built and published". Think of a factory conveyor belt.
  • CI/CD: short for Continuous Integration / Continuous Delivery. It just means the conveyor belt is automatic: every change is tested and shipped by machines, not by a person copying files by hand.

npm is the main public library for JavaScript software: developers type a name, and their computer downloads that package from npm. A package is simply a bundle of software published under a name.

The report describes a full CI/CD compromise chain against that repository, starting from a prompt injection in the issue-labeler.yml workflow and ending with the ability to plant a persistent backdoored workflow that could publish malicious releases under a trusted OpenAI identity.

A few more terms before we go on:

  • issue-labeler.yml: the name of one workflow file. The .yml ending means it is written in YAML, a plain-text format for configuration. You can read it as a list of instructions.
  • Prompt injection: when text that a system treats as data is instead interpreted as an instruction. Compare it to a receptionist who is told "deliver this note to the manager", and the note itself says "give the bearer the office keys". The note was supposed to be a message, not an order.
  • Backdoor: a hidden way into a system that the rightful owners did not intend, left there on purpose so the attacker can return later.
  • Persistent: it survives. A one-off break-in ends when you leave; something persistent stays in place and keeps working.
  • Supply chain: everything that goes into the software you use, including the people and machines that build and distribute it. Poisoning the supply chain means tampering with the factory rather than with any single customer.

The entry point is the issue-labelling automation: a workflow that reacts to GitHub issues and, in this case, feeds issue content to the Codex agent. Because any GitHub user can open an issue, the content that reaches the agent is attacker-controlled.

An issue on GitHub is a public post on a project's page, used for bug reports and questions. Anyone with a GitHub account can create one. That is the whole point of the attack surface here: a channel designed to accept text from strangers is wired into a machine that can act on text.

Setup

The report says any user can embed attacker-controlled instructions in a GitHub issue on openai/codex.

The report says any user can embed attacker-controlled instructions in a GitHub issue.

The chain then relies on three things inside the automation:

  1. The Codex agent sandbox running with a workspace-write profile.
  2. .NET CLR debug pipes being exposed in /tmp/ inside that sandbox.
  3. The runner holding ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN in its process memory.

Let us define each of these.

Sandbox: a restricted area in which a program is allowed to run, so that if it misbehaves it cannot damage the rest of the machine. Compare it to a playpen: the child can move freely inside, but cannot reach the kitchen knives. A sandbox is a security boundary, and the whole middle of this attack is about crossing it.

workspace-write profile: the name of the sandbox profile the Codex agent ran with, which the team escaped.

.NET CLR: .NET is a software platform made by Microsoft for running programs; the CLR (Common Language Runtime) is the engine inside it that actually executes those programs. The report says .NET CLR debug pipes were exposed in /tmp/ inside the sandbox.

Debug pipes: a pipe is a channel that two programs on the same computer use to exchange data, like a speaking tube between two rooms. A debug pipe is a channel that a debugging tool uses to inspect and control a running program: pause it, read its variables, look at its memory. Debugging is a legitimate developer feature. The problem is that a debug channel is also a channel for reading things you were never meant to read.

/tmp/: a folder present on Linux and similar systems for temporary files. Every program on the machine can usually read and write there. Because it is shared, it is a classic place for one program to leave something another program can pick up, whether that is intended or not.

Process memory: when a program runs, everything it is currently working with sits in its memory: variables, open files, and often secrets such as passwords and tokens. Reading another program's memory is like reading its mind while it works.

Token: a long random string that acts as proof of identity, like a wristband at an event. You show it, and the system believes you are who the wristband says. Anyone who copies the wristband can pretend to be you. Tokens are the main prize in this attack.

  • GITHUB_TOKEN: a token that GitHub automatically gives to a running workflow so it can talk to the repository (read files, comment, and so on). Its powers depend on permissions granted to the workflow.
  • ACTIONS_RUNTIME_TOKEN: a token the GitHub Actions system uses internally while a workflow runs, for things like the cache service described below.

The later stages depend on the repository's GitHub Actions cache and on a second, more privileged workflow, rust-ci.yml.

Cache: a store of previously computed results kept so they can be reused instead of recomputed. Think of a cook keeping pre-chopped vegetables in the fridge. GitHub Actions has a cache feature so that repeated builds do not redo slow work. If an attacker can put something into the fridge, the next cook may use it without checking.

Privileged: having more permissions than ordinary. A privileged workflow can do things a normal one cannot, such as write to the repository.

rust-ci.yml: the second, more privileged workflow the team pivoted into.

Finding it

The research team noticed that issue-labeler.yml passes issue content into the Codex agent. Since issue text is written by whoever opens the issue, an attacker can embed instructions in the issue that the agent then follows. That is the prompt injection: it turns a public, unauthenticated input channel into command execution inside the agent sandbox.

Public means anyone with a GitHub account can open an issue. Command execution means the ability to make the computer run a command of your choosing, which is the difference between reading a system and controlling it.

The second observation is that the sandbox profile is workspace-write, not a fully isolated environment, and that .NET CLR debug pipes are visible in /tmp/. Those pipes allow a process inside the sandbox to interact with the CLR debugging interface of another process, which is the basis for reading runner process memory.

In plain terms: the playpen had a speaking tube running through it, and the tube connected to the mind of the adult in the next room.

Exploitation

Step 1: Prompt injection in issue-labeler.yml

The attacker opens a GitHub issue containing instructions aimed at the Codex agent. When issue-labeler.yml processes the issue, the agent treats the embedded text as instructions and executes commands inside the Codex agent sandbox. This gives command execution as the first foothold.

A foothold is the first small piece of access an attacker gets, from which everything else is built. It is rarely the goal by itself.

The report says the workflow lets any user embed attacker-controlled instructions in an issue that reach the Codex agent.

The report does not include the exact issue text used.

Step 2: Sandbox escape via .NET CLR debug pipes

From inside the workspace-write sandbox, the team abused .NET CLR debug pipes exposed in /tmp/ to read the memory of runner processes. The objective was to extract the ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN held by the runner.

A sandbox escape is the moment code that was supposed to be contained gets access outside its container. Compare it to a prisoner who was allowed into the exercise yard and finds the yard shares a wall with the control room.

The team abused the pipes to read runner process memory and leak ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN.

The report does not include the specific commands or payloads used for this step.

Step 3: GitHub Actions cache poisoning

With the leaked ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN, the team poisoned the GitHub Actions cache. This moved execution out of the sandbox context and into the more privileged rust-ci.yml workflow, which consumes the cache.

Cache poisoning means placing malicious content into a cache so that whoever reads from the cache later receives the attacker's content instead of the genuine article. Compare it to swapping a sealed medicine bottle in the pharmacy fridge for one you filled yourself: the next pharmacist reaches in and trusts what they find.

The leaked credentials enabled GitHub Actions cache poisoning, pivoting execution into the more privileged rust-ci.yml workflow.

Step 4: Privilege escalation to contents: write

Running inside rust-ci.yml gave the team the contents: write permission. That permission is what allows writing to the repository, and it is the prerequisite for the final step.

Privilege escalation means gaining more rights than you started with. Permissions in GitHub Actions are listed by name, and each name grants a specific ability.

contents: write is the permission the team gained after pivoting into rust-ci.yml.

The pivot into rust-ci.yml gained contents: write, which the team used to plant the backdoored workflow.

Step 5: Persistent backdoored workflow with id-token: write

Using contents: write, the team planted a persistent backdoored workflow carrying id-token: write. That combination is what makes the chain a supply-chain risk: a workflow with write access and OIDC token issuance can be used to publish releases under the OpenAI identity.

id-token: write is the permission the planted backdoored workflow carried.

The team planted a persistent backdoored workflow with id-token: write, which the report calls a critical supply-chain risk.

Root cause

The chain starts with a prompt injection in issue-labeler.yml that lets any user embed instructions in an issue and achieve command execution in the Codex agent sandbox. Untrusted means it comes from someone you do not control. Autonomous means it acts on its own, without a human approving each action.

The workspace-write sandbox is not sufficient isolation: the .NET CLR debug pipes in /tmp/ give a path from inside the sandbox to runner process memory, and therefore to the runner's tokens. Once ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN leak, the Actions cache becomes a pivot into a workflow with broader permissions, and contents: write allows persistence.

A pivot is using one foothold to reach the next. Each stage here is a pivot: issue text to command execution, sandbox to runner memory, tokens to cache, cache to privileged workflow, write access to permanent backdoor.

The report does not describe which specific defences were in place or why they failed.

Impact

The report characterises the chain as a critical supply-chain risk. An attacker who can open an issue can reach command execution in the Codex agent sandbox, leak runner tokens, poison the Actions cache, pivot into rust-ci.yml, obtain contents: write, and plant a persistent backdoored workflow with id-token: write.

Because @openai/codex has roughly 10M weekly npm downloads, spiking to 200M, the report characterises the chain as a critical supply-chain risk capable of publishing malicious releases under a trusted OpenAI identity.

Because @openai/codex sees roughly 10M weekly downloads, spiking to 200M, the report characterises the chain as a critical supply-chain risk.

Fix

Based on the chain, the changes that would break it are:

  1. Stop passing untrusted issue content to an agent with command execution, or constrain the agent so injected instructions cannot cause execution.
  2. Remove or restrict access to .NET CLR debug pipes inside the sandbox so process memory of the runner is not reachable.
  3. Avoid exposing ACTIONS_RUNTIME_TOKEN and GITHUB_TOKEN to processes the agent can influence.
  4. Prevent cache poisoning from crossing into workflows with broader permissions such as contents: write and id-token: write.

Variants to test

These are the generalised lessons: the same shape of bug may exist elsewhere.

  1. Other issue-triggered agents: look for workflows that pass issue titles, bodies or comments to an LLM agent with tool access. A positive result is the agent executing an instruction embedded in the issue text. An LLM is a large language model, the kind of AI that reads and writes text; tool access means it can do things beyond talking, such as running commands.
  2. Sandbox escape via debug interfaces: check /tmp/ and similar shared paths inside agent sandboxes for debug sockets or pipes (CLR, language runtimes, debuggers). A positive result is reading memory or environment of a process outside the sandbox. A socket is like a pipe but can also connect across a network.
  3. Token leakage from runner processes: after any sandbox escape, check whether ACTIONS_RUNTIME_TOKEN or GITHUB_TOKEN can be recovered. A positive result is a usable token.
  4. Cache poisoning as a pivot: test whether a workflow with limited permissions can write cache entries consumed by a workflow with broader permissions. A positive result is code execution in the privileged workflow.
  5. Persistence via contents: write: with write access, test whether a new workflow file with id-token: write can be committed and triggered. A positive result is a workflow that runs with OIDC token issuance.

Hunting notes

This class of bug tends to hide where automation consumes user-controlled text: issue labelling, triage bots, comment-triggered agents and any workflow that feeds GitHub content to an LLM with tools. Triage is the first sorting of incoming reports, deciding what is urgent and who handles it.

During recon, look for workflows that trigger on issues and reference an agent or model, and for sandboxes that share /tmp/ with the runner. Recon (reconnaissance) is the survey phase: mapping what exists before trying anything.

Signals include debug sockets or pipes in shared paths and workflows whose permissions differ sharply between the trigger workflow and the workflow that consumes its artefacts or cache. An artefact is a file produced by a workflow and passed on to something else, such as a build output.

The report showed impact by carrying the chain all the way to a persistent workflow with id-token: write, which is what turns a sandbox escape into a supply-chain risk for a package with roughly 10M weekly downloads.

Glossary

  • ACTIONS_RUNTIME_TOKEN: a token the GitHub Actions system uses internally while a workflow runs, for services such as the cache.
  • Agent: an AI system that can take actions, such as running commands, rather than only producing text.
  • Artefact: a file produced by a workflow and passed on to another process or workflow.
  • Autonomous: acting without a human approving each step.
  • Backdoor: a hidden, deliberate way into a system, left for later use.
  • Cache: a store of reused results, kept so slow work does not have to be repeated.
  • Cache poisoning: placing malicious content into a cache so later readers receive it instead of the genuine content.
  • CI/CD: Continuous Integration / Continuous Delivery, the automatic testing and shipping of software changes.
  • CLR: Common Language Runtime, the engine inside .NET that executes programs.
  • Command execution: the ability to make a computer run a command of your choosing.
  • contents: write: a GitHub Actions permission allowing changes to a repository's files.
  • Debug pipe: a channel used by debugging tools to inspect and control a running program.
  • Foothold: the first small piece of access an attacker obtains, used as a base for further steps.
  • GitHub Actions: GitHub's automation service that runs workflows on its own computers.
  • GITHUB_TOKEN: a token GitHub gives a running workflow so it can act on the repository within its granted permissions.
  • id-token: write: a GitHub Actions permission allowing a workflow to request an OIDC identity token.
  • Issue: a public post on a GitHub project page, used for bug reports and questions, which anyone can create.
  • issue-labeler.yml: the workflow file that reacts to issues and, in this case, passes issue content to the Codex agent.
  • LLM: large language model, an AI that reads and writes text.
  • npm: the main public package library for JavaScript software.
  • OIDC: OpenID Connect, a standard for proving identity with short-lived signed tokens.
  • Package: a bundle of software published under a name.
  • Permissions: named abilities granted to a workflow, such as reading or writing repository contents.
  • Persistent: surviving beyond a single session or run.
  • Pipeline: the automated sequence that builds, tests and publishes software.
  • Pipe: a channel two programs on the same computer use to exchange data.
  • Pivot: using one foothold to reach the next stage of an attack.
  • Privilege escalation: gaining more rights than you started with.
  • Process memory: the working data of a running program, which can include secrets.
  • Prompt injection: when text meant as data is interpreted as an instruction by a system.
  • Recon: reconnaissance, the survey phase of mapping a target before attacking.
  • Repository: a project's folder of files with full change history, hosted on GitHub.
  • Runner: the computer that executes a GitHub Actions workflow.
  • Sandbox: a restricted area in which a program runs so it cannot affect the rest of the machine.
  • Sandbox escape: getting out of a sandbox into the surrounding system.
  • Socket: a communication channel between programs, which can also span a network.
  • Supply chain: everything involved in producing and distributing software, including the machines that build it.
  • Token: a random string used as proof of identity, which anyone holding it can use.
  • Triage: the first sorting of incoming reports to decide urgency and ownership.
  • Unauthenticated: usable without any login or identity check.
  • Untrusted: coming from a source you do not control.
  • Workflow: a configuration file describing automated steps for GitHub Actions to run.
  • workspace-write: the sandbox profile that lets the agent write inside its own working folder.
  • YAML: a plain-text format for configuration files, recognisable by the .yml ending.
  • /tmp/: a shared folder for temporary files on Linux-like systems.