Back to skill

Security audit

Claude Code × Codex Collaborate

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly transparent about its collaboration workflow, but it needs Review because it can install persistent Claude hooks and may send broad repository diffs to a configurable Codex executable.

Install only in repositories you trust. Before enabling loop automation, review the exact .claude/settings.json hook changes, keep codex.cli_command set to a trusted Codex executable, and avoid running reviews while tracked diffs contain credentials, private keys, customer data, or production configuration. Use loop-stop to disable the hooks when you no longer need automatic continuation.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cccc-build-context.sh:88
Finding

Tracked Secrets Can Be Included in Codex Review Input

Content
View full analysis

Vulnerability Details

File Location: scripts/cccc-build-context.sh:88-98; downstream transmission at scripts/cccc-codex-milestone-review.sh:35-47,69-75
Vulnerability Type: Sensitive data exposure through insufficiently filtered model context
Risk Level: High

Vulnerable Code

sh
echo "\n## Git diff stat"
git diff --stat 2>/dev/null || true

echo "\n## Git diff"
git diff -- . ':!docs/cccc/context-bundle.md' 2>/dev/null || true

echo "\n## Untracked Files"
echo "Listing untracked files:"
git ls-files --others --exclude-standard 2>/dev/null || true

The generated context is subsequently copied into the Codex prompt and supplied to the configured CLI:

sh
CONTEXT="$($SCRIPT_DIR/cccc-build-context.sh)"
STAMP="$(date -u +"%Y%m%dT%H%M%SZ")"
OUT="docs/cccc/reviews/milestones/${MILESTONE_ID}-r${REVIEW_ROUND}-${STAMP}.json"
PROMPT="docs/cccc/runtime/${MILESTONE_ID}-review-prompt-$STAMP.md"

mkdir -p docs/cccc/reviews/milestones docs/cccc/runtime

cat > "$PROMPT" <<EOF2
$(cat "$SKILL_DIR/prompts/codex-milestone-review.md")

---

# Context Bundle

$(cat "$CONTEXT")
EOF2
sh
if "$CLI_CMD" exec \
  --cd "$ROOT" \
  --sandbox read-only \
  --output-schema "$SKILL_DIR/schemas/codex-milestone-review.schema.json" \
  --output-last-message "$OUT" \
  - < "$PROMPT" 2>/dev/null; then
  SUCCESS=true
fi

Technical Analysis

The context builder applies filename and file-type filtering only when previewing untracked files. It does not apply equivalent filtering to the tracked Git diff. The unrestricted git diff output is written to docs/cccc/context-bundle.md, duplicated into a runtime prompt, and passed to the configured Codex CLI.

Consequently, a tracked file containing a password, API token, private key, customer record, production configuration, or other sensitive value can have that value included in model input whenever it is added or changed in the working tree.

The read-only Codex sandbox limits filesystem modification by Co ...[truncated 1840 chars]

Remediation
View remediation

Remediation Suggestions

  1. Generate diffs file by file and apply the same sensitive-path exclusions used for untracked files before reading any content.
  2. Add content-based secret detection using established patterns or a dedicated scanner before writing context or invoking Codex.
  3. Redact detected values rather than relying solely on filename extensions.
  4. Provide a project-level exclusion file for paths that must never enter model context.
  5. Exclude known sensitive paths such as environment files, credentials, keys, production configuration, private datasets, and generated secret stores from both diff content and filename listings.
  6. Abort the review and require explicit human approval whenever secret scanning produces a positive or uncertain result.
  7. Present the exact files that will be included before the first external model call.
  8. Store context and runtime prompts with restrictive permissions and delete transient prompt files after review when retention is unnecessary.
  9. Document whether the configured Codex provider receives repository content and what retention policy applies.
  10. Add tests proving that tracked secret-like files and secret values embedded in ordinary filenames cannot enter the generated context.

T07 · Tool Hijacking and Spoofing

Warning
Location
scripts/cccc-setup.sh:173
Finding

Project Configuration Can Substitute the Trusted Codex Executable

Content
View full analysis

Vulnerability Details

File Location: scripts/cccc-setup.sh:173-186,214-230; execution at scripts/cccc-codex-check.sh:15-23,47-48 and scripts/cccc-codex-milestone-review.sh:64-75
Vulnerability Type: Configurable executable substitution and tool spoofing
Risk Level: Medium

Vulnerable Code

The setup process accepts custom configuration or preserves imported configuration:

sh
custom)
  if $CONFIG_EXISTS; then
    mkdir -p docs/cccc/backups
    cp docs/cccc/config.json "docs/cccc/backups/config.${NOW//:/-}.json"
  fi
  # Read custom config from stdin
  cat > docs/cccc/config.json
  ;;
import)
  if ! $CONFIG_EXISTS; then
    # No existing config, use recommended as fallback
    preset_recommended > docs/cccc/config.json
  fi
  # Otherwise keep existing config.json as-is
  ;;

Configuration validation checks only two top-level fields:

python
import json
from pathlib import Path
p = Path('docs/cccc/config.json')
try:
    data = json.loads(p.read_text())
    if 'version' not in data:
        raise ValueError("Missing 'version' field")
    if 'mode' not in data:
        raise ValueError("Missing 'mode' field")
except json.JSONDecodeError as e:
    print(f"ERROR: Invalid JSON in config.json: {e}", flush=True)
    raise SystemExit(1)
except ValueError as e:
    print(f"ERROR: Invalid config.json: {e}", flush=True)
    raise SystemExit(1)

The unchecked command is then resolved and executed:

sh
CLI_CMD="codex"
if [[ -f "$CONFIG" ]]; then
  CLI_CMD="$(jq -r '.codex.cli_command // "codex"' "$CONFIG" 2>/dev/null || echo "codex")"
fi

if ! command -v "$CLI_CMD" >/dev/null 2>&1; then
  echo "ERROR: Codex CLI not found: $CLI_CMD" >&2
  echo "Install or configure Codex before continuing." >&2
  # ...
fi
sh
if "$CLI_CMD" --version >/dev/null 2>&1; then
  VERSION_INFO="$("$CLI_CMD" --version 2>/dev/null || echo 'unknown')"
fi

Review scripts execute the same configured command:

sh
CLI_CMD="$(jq -r '.codex.cli_command // 
...[truncated 2909 chars]
Remediation
View remediation

Remediation Suggestions

  1. Use a fixed trusted codex executable by default and remove project-level executable configurability unless it is strictly necessary.
  2. If configurability is required, reject relative paths and repository-local executables.
  3. Resolve the executable to a canonical absolute path and require explicit user approval when it differs from the trusted default.
  4. Enforce an allowlist of approved executable names or installation paths.
  5. Validate the complete configuration against a JSON Schema, including the type and permitted form of codex.cli_command.
  6. Treat imported repository configuration as untrusted and display all execution-affecting differences before accepting it.
  7. Do not execute an unapproved command merely to obtain its version.
  8. Verify executable ownership and permissions where supported, and reject executables writable by the project or untrusted users.
  9. Separate review-provider configuration from repository-controlled files by placing it in trusted user-level configuration.
  10. Validate review provenance rather than trusting any process that can write schema-conforming JSON.
  11. Add tests ensuring values such as ./tool, project-local paths, unexpected interpreters, and unknown command names are rejected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (83)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This variant is more serious because the skill explicitly modifies .claude/commands, .claude/hooks, and .claude/settings.json, creates backups, and synchronizes hook command paths, yet these privileged filesystem effects are not reflected in declared permissions or in the concise purpose statement. Hidden or under-disclosed configuration mutation is dangerous because it can persist behavior beyond a single run and alter future agent execution.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
96% confidence
Finding

The script forwards the entire parent process environment to a repository-local shell script. In agent/tooling contexts, environment variables commonly contain API keys, tokens, credentials, and internal configuration; a malicious hook can exfiltrate them immediately once executed.

Content

Scanner excerpt · scripts/cccc-doctor.py (reported line 189)May include surrounding context.

python
["bash", str(stop_script)],
                input='{"stop_hook_active":false}',
                capture_output=True, text=True, timeout=10,
                env={**os.environ, "CLAUDE_PROJECT_DIR": str(ROOT)},
                cwd=str(ROOT),
            )
            stdout = r.stdout.strip()

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · scripts/cccc-init.sh (reported line 4)May include surrounding context.

sh
#!/usr/bin/env bash
# Initialize docs/cccc workspace from templates.
# Called internally by cccc-setup.sh and other scripts.
# Does not overwrite existing files. Reads language from config.json.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
97% confidence
Finding

This script directly reads and modifies .claude/settings.json to register executable hooks under PreToolUse, Stop, and StopFailure. Altering the agent's config directory changes future agent behavior and creates a persistence mechanism inside the workspace; if the skill or copied hook scripts are compromised, they can intercept tool use and execute automatically, which is especially risky in an automation skill that enables a "full-auto-safe" loop.

Content

Scanner excerpt · scripts/cccc-loop-start.sh (reported line 38)May include surrounding context.

sh
python3 - <<'PY'
import json
from pathlib import Path
settings_path = Path('.claude/settings.json')
try:
    settings = json.loads(settings_path.read_text())
except Exception:

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/cccc-loop-stop.sh (reported line 18)May include surrounding context.

sh
python3 - <<'PY'
import json
from pathlib import Path
settings_path = Path('.claude/settings.json')
try:
    settings = json.loads(settings_path.read_text())
except Exception:

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/cccc-update.sh (reported line 240)May include surrounding context.

sh
python3 - <<'PY'
import json
from pathlib import Path
settings_path = Path('.claude/settings.json')
try:
    settings = json.loads(settings_path.read_text())
except Exception:

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · scripts/cccc-migrate-config.py (reported line 80)May include surrounding context.

python
# Deep merge: preserve user settings, add new template fields
    merged = deep_merge(existing, template)

    # Update skill metadata
    merged.setdefault('skill', {})
    merged['skill']['name'] = 'cc-codex-collaborate'
    merged['skill']['installed_version'] = args.version

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/cccc-repair.sh (reported line 14)May include surrounding context.

sh
CONFIG="docs/cccc/config.json"
STATE="docs/cccc/state.json"
SETTINGS="$ROOT/.claude/settings.json"
HOOKS_DIR="$ROOT/.claude/hooks"
COMMANDS_DIR="$ROOT/.claude/commands"
SKILL_DIR="$(cccc_skill_dir)"

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/cccc-update.sh (reported line 30)May include surrounding context.

sh
CONFIG="docs/cccc/config.json"
STATE="docs/cccc/state.json"
SETTINGS="$ROOT/.claude/settings.json"
HOOKS_DIR="$ROOT/.claude/hooks"
COMMANDS_DIR="$ROOT/.claude/commands"
SKILL_DIR="$(cccc_skill_dir)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

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

md
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

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

md
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/cccc-doctor.py (reported line 133)May include surrounding context.

python
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/cccc-doctor.py (reported line 139)May include surrounding context.

python
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/cccc-rehydrate-state.py (reported line 266)May include surrounding context.

python
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/cccc-reset.sh (reported line 2)May include surrounding context.

sh
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · templates/commands/cc-codex-collaborate.md (reported line 20)May include surrounding context.

md
#!/usr/bin/env bash
# CCCC Reset — reset state machine runtime state and rehydrate from docs.
# Does NOT delete planning docs, reviews, or logs.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/cccc-reset.sh (reported line 62)May include surrounding context.

sh
echo ""
echo "════════════════════════════════════════════════════════════"
echo "Reset State 完成"
echo "════════════════════════════════════════════════════════════"
echo ""
echo "恢复结果:"

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · scripts/cccc-update.sh (reported line 185)May include surrounding context.

sh
if python3 -c "
import json
try:
    data = json.loads(open('.claude/settings.json').read())
    hooks = data.get('hooks', {})
    for event, groups in hooks.items():
        for group in groups:

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · templates/commands/cc-codex-collaborate.md (reported line 18)May include surrounding context.

md
- **`setup`** — Run the interactive setup wizard. Do NOT start any task. Follow the "First-run setup" and "Setup wizard flow" sections in SKILL.md.
- **`update`** — Run safe workspace migration after upgrading skill. Sync config/state fields, commands, and enabled hooks. Does NOT overwrite user planning/review history. Does NOT enable hooks if not already enabled.
- **`force-update`** — Force sync regardless of version number. Run `.claude/skills/cc-codex-collaborate/scripts/cccc-update.sh --force` and summarize the report. Does NOT overwrite user planning/review history.
- **`resume`** — Resume a paused workflow. Follow the "Resume command" section in SKILL.md. Run `cccc-resume.sh`, ask the user questions if needed, update state, and continue the state machine. Does NOT bypass Codex gates, safety pauses, or secret requirements.
- **`reset`** or **`reset state`** — Reset state machine runtime state. Run `.claude/skills/cc-codex-collaborate/scripts/cccc-reset.sh` and summarize. Rehydrates current milestone from planning docs, reviews, and git history. Does NOT delete planning docs, reviews, or logs.
- **`doctor`** — Run diagnostics. Run `python3 .claude/skills/cc-codex-collaborate/scripts/cccc-doctor.py` and present the PASS/WARN/FAIL results. Does NOT modify files.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

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

md
- **`update`** — Run safe workspace migration after upgrading skill. Sync config/state fields, commands, and enabled hooks. Does NOT overwrite user planning/review history. Does NOT enable hooks if not already enabled.
- **`force-update`** — Force sync regardless of version number. Run `.claude/skills/cc-codex-collaborate/scripts/cccc-update.sh --force` and summarize the report. Does NOT overwrite user planning/review history.
- **`resume`** — Resume a paused workflow. Follow the "Resume command" section in SKILL.md. Run `cccc-resume.sh`, ask the user questions if needed, update state, and continue the state machine. Does NOT bypass Codex gates, safety pauses, or secret requirements.
- **`reset`** or **`reset state`** — Reset state machine runtime state. Run `.claude/skills/cc-codex-collaborate/scripts/cccc-reset.sh` and summarize. Rehydrates current milestone from planning docs, reviews, and git history. Does NOT delete planning docs, reviews, or logs.
- **`doctor`** — Run diagnostics. Run `python3 .claude/skills/cc-codex-collaborate/scripts/cccc-doctor.py` and present the PASS/WARN/FAIL results. Does NOT modify files.
- **`rebuild-context`** — Rebuild context-bundle.md. Run `.claude/skills/cc-codex-collaborate/scripts/cccc-build-context.sh` and report what was included/skipped. Does NOT modify milestone status or run Codex.
- **`gates`** — Show current Codex gate and state machine gate status. Run `python3 .claude/skills/cc-codex-collaborate/scripts/cccc-gates.py` and present the results. Does NOT modify files.