T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- SKILL.md:163
- Finding
- Skill Instructions Recommend Disabling Sandbox and Inheriting the Entire Host Environment<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:163-166` **Vulnerability Type**: Least-privilege boundary bypass **Risk Level**: High ### Vulnerable Code ```markdown - `--full-auto` sandbox blocks `npm install` network access (ENOTFOUND registry.npmjs.org) - Fix: use `--dangerously-bypass-approvals-and-sandbox` flag instead - Auth: `echo "$OPENAI_API_KEY" | codex login --with-api-key` stores credentials to `~/.codex/auth.json` - Config: `~/.codex/config.toml` with `model = "gpt-5.2-codex"` and `[shell_environment_policy] inherit = "all"` ``` ### Technical Analysis The Skill explicitly recommends disabling approval and sandbox controls when network access is unavailable. It also recommends configuring subprocesses to inherit the complete parent environment. Code verification commonly executes repository-controlled test scripts, package lifecycle hooks, compilers, and analysis tools. Running these components outside the sandbox while exposing all environment variables materially expands their privileges. The audited repository or a downloaded dependency could access API keys, authentication files, source repositories, SSH material, and other user-readable host data. The Skill only needs scoped access to the target project and explicitly approved analysis tools. Disabling the sandbox and inheriting all environment variables exceed those minimum requirements. ### Attack Path 1. A user asks the Skill to audit an untrusted or compromised repository. 2. The agent follows the instructions in `SKILL.md`. 3. The agent starts Codex with `--dangerously-bypass-approvals-and-sandbox`. 4. The environment policy exposes all parent environment variables. 5. A repository-controlled test, build script, or package lifecycle hook executes during verification. 6. That code reads inherited secrets or modifies files outside the audited project without sandbox restrictions. ### Impact Assessment Successful exploitation can provide the repository-controlled pr ...[truncated 377 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove the recommendation to use `--dangerously-bypass-approvals-and-sandbox`. - Keep sandbox and approval controls enabled during all audits. - Use an explicit allowlist for network destinations and executable tools. - Pass only the environment variables required by a specific command instead of using `inherit = "all"`. - Redact or unset `OPENAI_API_KEY`, cloud credentials, SSH agent variables, and other secrets before executing project-controlled commands. - Run tests and package tools in an isolated container or disposable workspace with read-only mounts where practical. - Require explicit, informed user approval before any operation that installs packages or executes repository-controlled hooks. ]]>
