Brief · Builders
One GitHub issue was a path to backdooring OpenAI's Codex package on npm
On Nov 11, the security firm Depi published how a single GitHub issue could have ended with a backdoored @openai/codex package on npm. That's the Codex CLI package, which npm counts at about 97 million downloads over the past month. The weak spot wasn't Codex CLI itself but a label bot in OpenAI's own repo: an Issue Labeler workflow handed every new issue's title and body to the Codex agent with allow-users: "*", so anyone who could open an issue could give it instructions. Depi says OpenAI "deployed a fix right away," and nothing malicious was published. There's no CVE, and OpenAI hasn't published its own account, so the chain below is Depi's.
How a label bot became a release problem
Depi's Pierre Martin and Garance de la Brosse wrote an issue that closed off the workflow's real prompt and started a new one, telling Codex it was a QA engineer who should run the diagnostic command in the issue. The command was compressed and encoded, which Depi says kept Codex's guardrails from recognizing what it did, and Codex ran it.
That put them inside Codex's sandbox, which blocks network access and process debugging and drops the workflow's tokens from its environment. But the GitHub runner's own .NET processes leave debug pipes in /tmp, and on Linux a pipe opens like a file, so the sandbox didn't stop them. Depi used those pipes to read the runner's memory, where the tokens still lived.
The rest is GitHub Actions plumbing. With a stolen token, Depi says an attacker could poison the build cache used by another workflow in the repo, one with write permissions that runs Python tests after restoring that cache. The planted test would create a fake Codex release, and when a maintainer deleted it, a booby-trapped workflow would hand the attacker an OpenID Connect token. Depi says that token could be traded for a signed token npm trusts, and that's enough to publish a malicious Codex version.
Depi showed the token theft in its own test environment and describes the final npm step without showing it run against OpenAI. It reported the chain through Bugcrowd with a full proof of concept, and Depi says OpenAI awarded an initial $1,000 bounty while the report is still under review. On Nov 11, the repo's labeler was changed to call OpenAI's API with tools disabled instead of running the Codex agent.
The sandbox escape is the clever part, but I think the first step is the one to remember. A bot holding secrets read text from strangers and treated it as instructions, and plenty of repos now run AI agents on issues and pull requests in exactly that setup. If you use Codex CLI, Depi says there's nothing to patch.
What to do
-
Don't let an agent with secrets act on issues and pull requests from anyone.
- Why: The labeler ran with an OpenAI API key and
allow-users: "*", so whoever opened an issue could steer the agent. - How: Limit who can trigger agent workflows to people you trust. For anything that has to read outside text, I'd use a job with no secrets and no write permissions, or a plain API call with tools turned off, which is what OpenAI's labeler does now.
- Why: The labeler ran with an OpenAI API key and
-
Give each workflow only the permissions it needs.
- Why: In Depi's chain, a token taken from the label bot reached the repo's build cache, and a workflow with write access ran what it restored from there.
- How: Set
permissions:explicitly for every workflow and job, and grant write access orid-token: writeonly to the jobs that publish. That's my advice, not Depi's.
-
Wait a little before taking new versions of agent tools.
- Why: Depi says a malicious Codex release would reach anyone on auto-update with no version pin or diff for a person to review, and Codex runs on developer machines with developer credentials.
- How: Pin Codex CLI and similar tools to a version and move up after a short wait instead of the minute a release ships, so someone else gets the chance to spot a bad one first.
Want the next one?
One email, weekly-ish. The week's briefs, how worried to be, and what to do about it. No doom.
Subscribe on Beehiiv ↗Free. Opens Beehiiv in a new tab. Unsubscribe whenever, I won't be offended.