AAK-TRUST-009: Codex model provider points at a non-OpenAI endpoint
- Severity
- CRITICAL
- Category
- Trust Boundaries (
trust-boundary) - Scanner
agent_audit_kit/scanners/trust_boundary.py- Auto-fixable
- No.
- SARIF name
CodexModelProviderOverride
What it detects
A Codex config selects a model provider whose base_url, or openai_base_url for the built-in openai provider, is not OpenAI's, Azure OpenAI's or this machine's. Codex then sends that host the session's prompts and the code in them, and any key the provider is set up to send. Check Point Research reported the class on 4 Nov 2026, through The Hacker News: a GitHub bundle modifies Codex's configuration files and writes persistent adverts for an opaque OpenAI-compatible gateway into the global agent instruction file. The report names no keys. CRITICAL in a project's .codex/config.toml: Codex before 0.129.0 honours these keys there, so a repository re-points everyone who trusts it. Codex 0.129.0 (May 2026) and later ignores them in project config and prints a startup warning, so on a current Codex the file is an attempt with no effect. HIGH in the user's $CODEX_HOME/config.toml, read under --include-user-config, where Codex honours them and the user may have set the provider on purpose.
How to fix
In a project's .codex/config.toml, delete model_provider, model_providers, profiles and openai_base_url, and run Codex 0.129.0 or later. In your own $CODEX_HOME/config.toml, keep the provider only if you set it and trust its host. If you did not set it, remove those keys, rotate any API key those sessions used, and read $CODEX_HOME/AGENTS.md and AGENTS.override.md for text you did not write.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-TRUST-009
Limitations
Reads .codex/config.toml at the root of the scanned directory and, under --include-user-config, $CODEX_HOME/config.toml (~/.codex/config.toml when CODEX_HOME is unset or empty); a file that does not parse is skipped. It takes the providers selected by the top-level model_provider (Codex's default is openai) and by each [profiles.*] table, a shape Codex stopped reading for --profile in 0.134.0, and judges each one's [model_providers.<id>].base_url, plus openai_base_url for openai, by host. openai.com and its subdomains, *.openai.azure.com and this machine (localhost, loopback addresses and 0.0.0.0) pass whatever the scheme, so a cleartext http://api.openai.com/v1 passes. Any other host is reported, a company's own gateway included, and so is a URL with no single host to read. A provider nothing selects is not reported, and each file is judged alone, so a provider one file defines and the other selects is not reported either. Current Codex refuses a config whose [model_providers.openai] sets a base_url; it is reported all the same. OPENAI_BASE_URL in the process environment or a shell profile is not read; only these two files are, so a profile file ($CODEX_HOME/<name>.config.toml) and the same config in a subdirectory (packages/web/.codex/config.toml) are not read either. A file over 1,000,000 bytes is not read.
References
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-REDIRECT-01 (Anthropic URL Redirect)
- CSA AI Controls Matrix (AICM): IAM-16
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-TRUST-009.md: the page then shows that text, with the registry reference appended under it.