Back to skill

Security audit

Codex Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a Codex automation guide, but it recommends unsandboxed no-approval runs and includes unsafe shell examples that could execute unintended commands or push repository changes.

Review before installing or using as-is. Use this only in a disposable, isolated environment with no production credentials, avoid the dangerous bypass flag, prefer read-only or workspace-write modes, and require manual review before commits, pushes, PR comments, or cleanup. The shell examples should be fixed to pass prompts and paths safely before being copied into automation.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:146
Finding
Codex Is Launched Without Sandbox or Approval Controls<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:146-173` **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: High ### Vulnerable Code ```bash tmux pipe-pane -t "$TASK_ID" -o "stdbuf -oL cat >> $LOG_FILE" tmux send-keys -t "$TASK_ID" \ 'codex -c "model_reasoning_effort=high" \ --dangerously-bypass-approvals-and-sandbox \ '"'"'Your detailed prompt here. When completely finished: 1. Commit all changes with descriptive messages 2. Push the branch: git push -u origin '"$BRANCH"' 3. Create PR: gh pr create --fill 4. Notify: openclaw system event --text "Done: '"$TASK_ID"'" --mode now'"'"' \ ; echo "CODEX_EXIT=$?" >> '"$LOG_FILE" Enter ``` The Skill subsequently justifies this configuration: ```markdown - `--dangerously-bypass-approvals-and-sandbox` is safe in container/sandbox environments ``` The same unrestricted mode is recommended or used elsewhere at `SKILL.md:27`, `SKILL.md:382`, `SKILL.md:415`, and `SKILL.md:466`. ### Technical Analysis The `--dangerously-bypass-approvals-and-sandbox` option removes both execution isolation and interactive approval controls. This gives model-generated commands the ambient permissions of the account running Codex instead of limiting them to the target workspace. The documented workflow does not verify that it is running inside a suitably isolated container or VM before enabling this mode. It also does not verify that sensitive host directories, credentials, sockets, or environment variables are unavailable inside such an environment. Merely stating that the option is safe in containers does not establish a security boundary. The workflow processes repository contents, task prompts, dependency metadata, build scripts, and failure logs. Any of these sources can contain malicious or adversarial instructions. Running Codex without a sandbox turns such content into a potential route to unrestricted local command execution. The task generally only needs work ...[truncated 1871 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Use `--full-auto` or `-s workspace-write` as the default for implementation tasks. 2. Reserve `--dangerously-bypass-approvals-and-sandbox` for exceptional operations that cannot be completed in workspace-write mode. 3. Require explicit user confirmation immediately before enabling unrestricted execution. 4. Programmatically verify isolation rather than relying on documentation. The environment should have: - No unnecessary host-directory mounts. - No Docker or orchestration control sockets. - No SSH agent socket. - No unrelated source-control or cloud credentials. - A non-root user. - A read-only base filesystem where practical. - Network egress restrictions. - Resource and process limits. 5. Separate Git push and PR creation from the coding process. Review generated changes before performing authenticated remote operations. 6. Keep credential-bearing operations in a distinct, narrowly scoped process that Codex cannot invoke directly. 7. Treat repository text, dependency scripts, task descriptions, and logs as untrusted input. 8. Update the documentation to state that containers and VMs are only safe when their mounts, credentials, network access, and privileges have been explicitly restricted. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:409
Finding
Shell Command Injection Through Unescaped Prompt and Path Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:409-415` **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: High ### Vulnerable Code ```bash launch_codex() { local TASK="$1" WORKDIR="$2" PROMPT="$3" local LOG="$WORKDIR/codex-output.log" tmux new-session -d -s "$TASK" -c "$WORKDIR" tmux pipe-pane -t "$TASK" -o "stdbuf -oL cat >> $LOG" tmux send-keys -t "$TASK" \ "pnpm install && codex --dangerously-bypass-approvals-and-sandbox '$PROMPT'; echo \"CODEX_EXIT=\$?\" >> $LOG" Enter } ``` Related unquoted log-path construction also occurs at `SKILL.md:146` and `SKILL.md:379`: ```bash tmux pipe-pane -t "$TASK_ID" -o "stdbuf -oL cat >> $LOG_FILE" ``` ### Technical Analysis The helper constructs shell command strings by directly interpolating `PROMPT` and `LOG`. Although the generated command visually surrounds the prompt with single quotes, the prompt is expanded by the outer shell before the resulting text is sent to the tmux pane. A single quote inside `PROMPT` therefore terminates the intended quoting context in the shell that receives the command. For example, a prompt containing a value structurally similar to the following can break out of the quoted argument: ```text '; attacker_command; # ``` After interpolation, the tmux pane receives a shell command equivalent in structure to: ```bash pnpm install && codex --dangerously-bypass-approvals-and-sandbox ''; attacker_command; #' ``` The shell in the tmux pane then executes `attacker_command` as an independent command. `LOG` is also inserted without shell quoting into both the `pipe-pane` command and the command sent to the pane. A worktree path containing whitespace or shell metacharacters can change redirection behavior or inject additional shell syntax. The function quotes variables for its immediate shell invocation in some places, but it does not safely encode them for the second round of parsing performed by tmux and the pane's shell. This is ...[truncated 1945 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not place prompts directly inside shell command strings. Store the prompt in a securely created file and pass it through a supported file or standard-input interface. 2. If command construction is unavoidable, encode every dynamic value with a robust shell-quoting primitive such as `printf '%q'`; do not implement quoting through manual replacement. 3. Quote log paths inside the destination command, not only in the shell that creates the tmux session. 4. Validate task and session identifiers against a strict allowlist, for example: ```bash [[ "$TASK" =~ ^[A-Za-z0-9._-]+$ ]] || { echo "Invalid task identifier" >&2 return 1 } ``` 5. Reject worktree paths containing control characters and use canonical absolute paths. 6. Prefer launching a fixed wrapper script with positional arguments rather than sending a dynamically assembled command to an interactive shell. 7. Use arrays when invoking commands in the current shell so arguments retain their boundaries: ```bash codex_args=(codex --full-auto) codex_args+=("$PROMPT") "${codex_args[@]}" ``` 8. Securely quote the logging target if `tmux pipe-pane` must invoke a shell. Alternatively, use a fixed logging wrapper that receives the path as a separately encoded argument. 9. Add regression tests using prompts and paths containing single quotes, double quotes, spaces, semicolons, command substitutions, newlines, and redirection operators. 10. Combine these changes with sandboxed Codex execution so that any residual command-construction flaw has a restricted impact. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Missing User Warnings

High
Confidence
97% confidence
Finding
The top-level description advertises hands-off execution without approval prompts but does not prominently disclose that the workflow may modify files, push branches, create PRs, access networked services, and alter system state. That omission undermines informed consent and can cause users to authorize a much riskier tool than they realize.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
This section normalizes use of `--dangerously-bypass-approvals-and-sandbox` as part of the standard tmux workflow and even labels it safe in certain environments without enforcing those conditions. Disabling both approvals and sandboxing allows arbitrary file, system, and network actions with no human checkpoint, greatly increasing the blast radius of prompt mistakes or malicious task input.

Missing User Warnings

High
Confidence
99% confidence
Finding
This guidance recommends dangerous bypass and sandbox disabling without a prominent warning immediately adjacent to the commands, and frames it as recommended for the workflow. Users may copy these commands into sensitive environments, enabling unrestricted autonomous actions without understanding the consequences.

Missing User Warnings

High
Confidence
98% confidence
Finding
The parallel execution helper launches multiple unsandboxed autonomous Codex sessions concurrently, compounding the risk of destructive or unintended changes and making monitoring harder. Concurrent high-privilege agents can race, amplify mistakes, and touch multiple worktrees or services before a human can intervene.

External Model or Provider Selection

High
Category
Excessive Agency
Content
codex -c "model_reasoning_effort=high" --full-auto "refactor auth module"

# Medium — balanced (default)
codex exec --full-auto "add input validation"

# Low — for trivial/mechanical changes
codex -c "model_reasoning_effort=low" --full-auto "rename all instances of foo to bar"
Confidence
90% confidence
Finding
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

External Model or Provider Selection

High
Category
Excessive Agency
Content
```bash
# Structured output for programmatic processing
codex exec --full-auto --json "implement and test the feature"

# Save to file
codex exec --full-auto -o results.txt "run analysis"
Confidence
90% confidence
Finding
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

External Model or Provider Selection

High
Category
Excessive Agency
Content
codex exec --full-auto --json "implement and test the feature"

# Save to file
codex exec --full-auto -o results.txt "run analysis"
```

### Resume Session
Confidence
90% confidence
Finding
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

External Model or Provider Selection

High
Category
Excessive Agency
Content
```bash
# Resume last session with a follow-up task
codex exec resume --last "now add tests for the feature you just built"
```

---
Confidence
90% confidence
Finding
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
---
name: codex-skill
description: 'Use when user asks to leverage codex, gpt-5, or gpt-5.1 to implement something (usually implement a plan or feature designed by Claude). Provides non-interactive automation mode for hands-off task execution without approval prompts.'
---

# Codex Agent Skill
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes the skill as merely using Codex/GPT-5 to implement tasks, but the body grants a much broader autonomous capability set: branch creation, push, PR creation/commenting, notifications, retries, and cleanup. This scope expansion is dangerous because callers may invoke the skill under a much narrower trust assumption than the actual actions it can take on repositories and external services.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The activation condition is very broad: any request involving Codex/GPT-5 implementation can trigger a skill that supports highly privileged automation. Broad routing increases the risk of this capability being invoked in contexts where the user only intended lightweight assistance, not autonomous execution.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The skill positions itself as a coding helper, but immediately instructs operation of Codex as a managed agent through PR merge lifecycle activities. That broader orchestration capability increases the chance that users trigger repository-modifying and externally visible actions they did not expect from the advertised purpose.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
| Flag | Effect |
|------|--------|
| `exec "prompt"` | Non-interactive one-shot, exits when done |
| `--full-auto` | Alias for `-s workspace-write` (auto-approve file edits) |
| `-s workspace-write` | Read + write files in workspace |
| `-s read-only` | Analysis only, no modifications (default for `exec`) |
| `-s danger-full-access` | Full access including network and system |
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Static analysis

No suspicious patterns detected.