Back to skill

Security audit

Codex Handoff (OpenClaw Plans, Codex Codex, OpenClaw Judges)

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-aligned but asks an agent to hand code changes to Codex CLI in full-auto workspace-write mode, with weak guardrails around model selection and external data exposure.

Install only if you are comfortable letting an agent invoke Codex CLI to modify the current repository automatically. Use it on trusted repos, review diffs before keeping changes, avoid untrusted model argument values, and assume project context included in the handoff may be exposed to the Codex provider.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:62
Finding

Command Injection Through Unsanitized Model Argument

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 62-68
Vulnerability Type: Shell command injection through unsafe argument interpolation
Risk Level: High

Vulnerable Code:

markdown
Parse optional arguments:
- `--max-iterations N` — max loop iterations (default: 5, per-phase in phased mode)
- `--model MODEL` — pass to codex as `-m MODEL`
- `--phase N` — execute only this phase (phased mode only)

```bash
codex exec --full-auto -s workspace-write [-m MODEL] < /tmp/codex-handoff-{timestamp}.md
text

### Technical Analysis

The Skill instructs the agent to accept a user-provided `--model MODEL` value and insert it into a Bash command as `-m MODEL`. It does not require validation, an allowlist, shell-safe quoting, or separation of command arguments from shell syntax.

If the implementation constructs the displayed command as a shell string, shell metacharacters in `MODEL` can be interpreted as command separators, substitutions, or redirections rather than as part of a model identifier. This creates a command-injection boundary between untrusted command arguments and the Bash tool.

The command also uses a predictable path under `/tmp`. Although the `{timestamp}` component can reduce collisions, the instructions do not require secure creation with exclusive permissions. This can expose the workflow to temporary-file collision or symbolic-link risks in a shared environment.

### Attack Path

1. An attacker or untrusted user invokes the Skill with a crafted `--model` value containing shell syntax.
2. The Skill parses that value without applying a strict model-name allowlist.
3. The value is interpolated into the documented `codex exec` Bash command.
4. Bash interprets the injected metacharacters as shell syntax.
5. The injected command executes with the same operating-system permissions and environment available to the supervising agent.

Exploitation depends on the documented placeholder 
...[truncated 884 chars]
Remediation
View remediation

Remediation Suggestions

  1. Validate MODEL against a strict allowlist of supported model identifiers. Reject whitespace, control characters, shell metacharacters, option prefixes, and unexpected path characters.
  2. Do not construct the invocation by concatenating user-controlled values into a shell command string. Pass each argument as a distinct process argument.
  3. If Bash must be used, construct an argument array and quote every expansion:
    bash
    args=(exec --full-auto -s workspace-write)
    if [[ -n "$model" ]]; then
      [[ "$model" =~ ^[A-Za-z0-9._:/-]+$ ]] || {
        printf 'Invalid model identifier\n' >&2
        exit 2
      }
      args+=(-m "$model")
    fi
    codex "${args[@]}" < "$prompt_file"
    
  4. Prevent option injection by rejecting model values beginning with - or by using an API that unambiguously separates option values.
  5. Create the prompt file securely with mktemp, restrict its permissions, quote its path, and remove it with a cleanup trap:
    bash
    prompt_file="$(mktemp "${TMPDIR:-/tmp}/codex-handoff.XXXXXXXX")" || exit 1
    chmod 600 "$prompt_file"
    trap 'rm -f -- "$prompt_file"' EXIT
    
  6. Update the Skill instructions to explicitly prohibit direct interpolation of any user-provided option into Bash commands.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (2)

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
95% confidence
Finding

The skill explicitly instructs the agent to hand project context and plans to an external coding agent via codex exec --full-auto -s workspace-write, optionally selecting a model dynamically with -m MODEL. This creates a high-risk delegation boundary: sensitive repository contents and prompts may be sent to an external provider, and the external agent is authorized to autonomously modify the workspace, which can lead to data exfiltration, unsafe code changes, or supply-chain style compromise if the plan, repo, or model input is adversarial.

Content

Scanner excerpt · SKILL.md (reported line 83)May include surrounding context.

  • --phase N — execute only this phase (phased mode only)
bash
codex exec --full-auto -s workspace-write [-m MODEL] < /tmp/codex-handoff-{timestamp}.md

Let the command run to completion. Capture stdout and exit code. Report: "Codex iteration {N} complete. Reviewing changes..."

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Line L106 states that the supervisor should never modify code itself, implying a non-coding, oversight-only role. But the documented procedure explicitly tells the agent to execute codex exec --full-auto -s workspace-write via Bash (L82-L84), which is a direct action by the skill that causes workspace modifications and coding changes under the agent's control.

Content

No source excerpt is available for this finding.