Back to skill

Security audit

Codex Swarm

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Codex swarm orchestrator, but it gives automated agents broad repository write, push, merge, cleanup, and notification authority with weak safety gates.

Install only if you are comfortable granting the skill automated control over Codex CLI runs, worktrees, commits, remote branches, and possibly main. Use it in a disposable or protected repository first, disable automatic main pushes, avoid enabling webhook/Telegram notifications unless needed, and review task IDs and task JSON as trusted input because they affect paths, branches, and generated runner scripts.

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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/spawn-agent.sh:96
Finding

Shell Command Injection Through Generated Agent Runner

Content
View full analysis
"$RUNNER" << RUNEOF #!/usr/bin/env bash set -o pipefail cd "$WORKTREE_DIR" echo "[runner] Starting codex/$MODEL ..." MAX_RETRIES=2 RETRY=0 CUR_MODEL="$MODEL" while true; do codex exec --full-auto -c "model=\$CUR_MODEL" -c "model_reasoning_effort=$REASONING" - < "$PROMPT_FILE" 2>&1 EXIT=\$? if [ "\$EXIT" -eq 0 ]; then echo "[runner] ✅ Agent completed successfully" break fi RETRY=\$((RETRY + 1)) if [ "\$RETRY" -gt "\$MAX_RETRIES" ]; then echo "[runner] ❌ Max retries reached" break fi echo "[runner] 🔄 Retry \$RETRY/\$MAX_RETRIES ..." sleep 10 done RUNEOF chmod +x "$RUNNER" ``` The affected values originate from command-line or batch JSON input: ```bash TASK_ID="${2:?Missing task-id}" MODEL="${5:-}" REASONING="${6:-}" ``` ### Technical Analysis The script dynamically creates an executable shell script using an unquoted heredoc. Values derived from `TASK_ID`, `MODEL`, and `REASONING` are inserted directly into the generated shell source. Shell quoting in the template does not safely serialize these values. An input containing a double quote, newline, command substitution, or other shell syntax can terminate the intended expression and introduce new commands. The resulting file is made executable and subsequently started in tmux. For example, a malicious model or reasoning value containing shell syntax can modify the generated `CUR_MODEL` assignment or `codex exec` command. A task identifier also influences `WORKTREE_DIR`, which is embedded in the generated `cd` statement. ### Attack Path 1. An attacker supplies a crafted `model`, `reasoning`, or task identifier through the tasks JSON or direct script arguments. 2. `scripts/spawn-batch.sh` r ...[truncated 880 chars]
Remediation
View remediation
&2; exit 1 ;; esac ``` - If script generation is unavoidable, serialize every inserted value with `printf '%q'` before writing it into shell source. - Use `--` where supported when passing values to commands. - Run agents with a dedicated, minimally privileged account that does not have unrestricted access to production credentials or protected branches. - Add automated tests containing quotes, newlines, command substitutions, traversal sequences, and leading dashes. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/endorse-task.sh:5
Finding

Path Traversal and Arbitrary File Overwrite Through Unvalidated Identifiers

Content
View full analysis
}" mkdir -p "$SWARM_DIR/endorsements" echo "Endorsed at $(date)" > "$SWARM_DIR/endorsements/${TASK_ID}.endorsed" echo "✅ Task '$TASK_ID' endorsed → $SWARM_DIR/endorsements/${TASK_ID}.endorsed" ``` Related path construction in `scripts/spawn-agent.sh`: ```bash BRANCH="feat/$TASK_ID" TMUX_SESSION="codex-$TASK_ID" ENDORSEMENT_FILE="$SWARM_DIR/endorsements/$TASK_ID.endorsed" WORKLOG="/tmp/worklog-${TMUX_SESSION}.md" WORKTREE_DIR="${PROJECT_DIR}-worktrees/${TASK_ID}" PROMPT_FILE="$SWARM_DIR/logs/${TMUX_SESSION}-prompt.md" RUNNER="$SWARM_DIR/logs/${TMUX_SESSION}-run.sh" ``` Batch identifiers are also used directly as filenames in `scripts/spawn-batch.sh`: ```bash mkdir -p "$SWARM_DIR/logs" cat > "$SWARM_DIR/logs/batch-${BATCH_ID}.json" << EOF {"batchId":"$BATCH_ID","project":"$PROJECT_DIR","desc":"$BATCH_DESC","created":"$(date -Iseconds)","sessions":$(printf '%s\n' "${TMUX_SESSIONS[@]}" | jq -R . | jq -s .)} EOF ``` ### Technical Analysis `TASK_ID` and `BATCH_ID` are accepted without validation and are incorporated directly into filesystem paths. Quoting prevents word splitting but does not prevent path traversal. Identifiers containing `/`, `../`, or absolute-path-like components can escape the intended endorsements, logs, or worktree directories. Several affected operations overwrite files with shell redirection. The runner file is additionally marked executable and later invoked, increasing the security consequences of writing it to an unintended location. The same task identifier controls multiple security-sensitive resources, including the endorsement filename. Consequently, ma ...[truncated 1243 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/notify-on-complete.sh:22
Finding

Fail-Open Review Gates Permit Unapproved Code to Be Pushed

Content
View full analysis
/dev/null || true cd "$WORK_DIR" REVIEW=$(mktemp) codex exec review 2>&1 | tee "$REVIEW" if grep -qi "no issues\|LGTM\|looks good\|clean\|approved" "$REVIEW"; then bash "$SCRIPTS_DIR/notify.sh" "✅ Review passed for $TASK_ID" 2>/dev/null || true rm -f "$REVIEW"; break fi # If issues found, Codex review may auto-fix. Commit and retry. git add -A 2>/dev/null && git commit -m "review fix (round $ROUND)" 2>/dev/null || true rm -f "$REVIEW" done cd "$WORK_DIR" git push origin "$BRANCH" --force-with-lease 2>/dev/null || git push origin "$BRANCH" 2>/dev/null || true ``` Integration review in `scripts/integration-watcher.sh`: ```bash for ROUND in $(seq 1 "$MAX_ROUNDS"); do REVIEW=$(mktemp) codex exec review 2>&1 | tee "$REVIEW" if grep -qi "approved\|LGTM\|no issues\|clean" "$REVIEW"; then bash "$SCRIPTS_DIR/notify.sh" "✅ Integration passed for $BATCH_ID" 2>/dev/null || true rm -f "$REVIEW"; break fi git add -A 2>/dev/null && git commit -m "integration fix (round $ROUND)" 2>/dev/null || true rm -f "$REVIEW" done # Push if [ "${SWARM_AUTO_MERGE:-true}" = "true" ]; then git push origin main 2>/dev/null && bash "$SCRIPTS_DIR/notify.sh" "✅ Batch $BATCH_ID pushed to main" 2>/dev/null || true fi ``` ### Technical Analysis Approval is inferred by searching unrestricted natural-language review output for common positive terms. This is not a reliable authorization protocol. For example, output such as “not approved,” “the documentation says LGTM,” or text quoting repository-controlled content m ...[truncated 1502 chars]
Remediation
View remediation
", "findings": [] } ``` - Validate the schema and require `reviewed_commit` to equal the exact commit being pushed. - Maintain an explicit `REVIEW_PASSED=false` state and stop execution unless it becomes true. - Treat review command failures, malformed output, ambiguity, and exhausted rounds as hard failures. - Do not assume that a review tool automatically fixes reported issues. - Default `SWARM_AUTO_MERGE` to `false`. - Require explicit human approval before pushing to `main`. - Enforce protected branches, mandatory CI checks, signed reviews, and least-privilege Git credentials on the remote. - Avoid force-pushing by default, even with `--force-with-lease`. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/spawn-batch.sh:18
Finding

Batch Workflow Automatically Satisfies Its Own Endorsement Gate

Content
View full analysis
/dev/null || stat -f %m "$ENDORSEMENT_FILE" 2>/dev/null || echo 0) )) if [ "$ENDORSE_AGE" -lt "$COOLDOWN" ]; then echo "⛔ COOLDOWN: Wait $((COOLDOWN - ENDORSE_AGE))s" exit 1 fi echo "✅ Endorsement verified" ``` ### Technical Analysis The same batch workflow that consumes approval also creates the approval artifact. There is no independent approver, task-content integrity check, signature, or binding between the endorsement and the exact prompt, model, role, project, or commit. The cooldown only delays execution. It does not establish that a trusted user inspected or authorized the task. Modifying task content after an endorsement also does not invalidate the approval because only the task identifier and file timestamp are checked. ### Attack Path 1. An attacker or untrusted automation supplies a tasks JSON file. 2. `spawn-batch.sh` reads each task identifier. 3. The script automatically calls `endorse-task.sh` for every task. 4. It waits for the configured cooldown. 5. `spawn-agent.sh` sees the automatically created file and reports that endorsement was verified. 6. ...[truncated 639 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cleanup.sh:14
Finding

Cleanup Operation Can Delete Unrelated Worktrees, Sessions, and Remote Branches

Content
View full analysis
/dev/null | grep "^codex-" | cut -d: -f1 | while read -r s; do tmux kill-session -t "$s" 2>/dev/null && echo " Killed: $s" done # Remove worktrees echo "Removing worktrees..." WORKTREE_DIR="${PROJECT_DIR}-worktrees" if [ -d "$WORKTREE_DIR" ]; then rm -rf "$WORKTREE_DIR" echo " Removed: $WORKTREE_DIR" fi # Also clean .claude/worktrees if any if [ -d "$PROJECT_DIR/.claude/worktrees" ]; then rm -rf "$PROJECT_DIR/.claude/worktrees" echo " Removed: .claude/worktrees/" fi git worktree prune 2>/dev/null # Delete feat/* branches (local + remote) if [ "$ALL" = "--all" ]; then echo "Deleting feat/* branches..." git branch | grep "feat/" | xargs -r git branch -D 2>/dev/null || true git branch -r | grep "origin/feat/" | sed 's|origin/||' | while read -r b; do git push origin --delete "$b" 2>/dev/null && echo " Deleted remote: $b" done fi ``` ### Technical Analysis Cleanup is selected by naming conventions rather than by an inventory of resources created by a specific batch. The script: - Kills every tmux session beginning with `codex-`. - Recursively removes the complete `${PROJECT_DIR}-worktrees` directory. - Recursively removes all `.claude/worktrees`. - With `--all`, deletes every local branch whose displayed name contains `feat/`. - Deletes every matching `origin/feat/` remote branch. These resources may belong to other batches, users, tools, or manually maintained development work. Remote deletion is especially destructive and is performed without confirmation or a dry run. ### Attack Path 1. A user invokes cleanup for one project or completed batch. 2. The script enumerates resources using broad prefixes and directory locations. 3. Active tmux sessions from ot ...[truncated 754 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented behavior includes webhook and Telegram-style notifications plus external delivery, but those networked capabilities are not clearly declared in the skill metadata or permissions. This mismatch can conceal data egress paths and operational side effects from users, especially if code, branch names, task descriptions, or repository metadata are sent to third-party endpoints.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bash scripts/spawn-batch.sh "/path/to/project" "batch-1" "Description" /tmp/tasks.json

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bash scripts/spawn-batch.sh "/path/to/project" "batch-1" "Description" /tmp/tasks.json

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

sh
# Also clean .claude/worktrees if any
if [ -d "$PROJECT_DIR/.claude/worktrees" ]; then
  rm -rf "$PROJECT_DIR/.claude/worktrees"
  echo "  Removed: .claude/worktrees/"
fi

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
95% confidence
Finding

The script invokes codex exec --full-auto with a high-capability external model to resolve merge conflicts and then instructs it to run git add . && git commit --no-edit. This gives an external AI system autonomous authority to modify repository contents and create commits during a sensitive merge-conflict state, where prompt/context manipulation from repository files or conflict text could cause unsafe code changes, secret exposure, or integrity loss.

Content

Scanner excerpt · scripts/integration-watcher.sh (reported line 49)May include surrounding context.

sh
CONFLICTS=$(git diff --name-only --diff-filter=U 2>/dev/null || echo "")
    if [ -n "$CONFLICTS" ]; then
      # Use o3 (reasoning model) for conflict resolution
      codex exec --full-auto -c "model=o3" -c "model_reasoning_effort=high" \
        "Resolve merge conflicts in: $CONFLICTS. Keep both features working. Then: git add . && git commit --no-edit" 2>/dev/null || {
        git merge --abort 2>/dev/null; FAILURES+=("$B"); continue
      }

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

The script delegates integration review to codex exec review and treats matching text such as approved, LGTM, no issues, or clean as sufficient to declare success. In this skill's autonomous swarm setting, that weak text-based approval heuristic can be spoofed or can over-trust external model output, allowing flawed or malicious changes to pass review and continue toward main.

Content

Scanner excerpt · scripts/integration-watcher.sh (reported line 61)May include surrounding context.

sh
# Integration review
for ROUND in $(seq 1 "$MAX_ROUNDS"); do
  REVIEW=$(mktemp)
  codex exec review 2>&1 | tee "$REVIEW"
  if grep -qi "approved\|LGTM\|no issues\|clean" "$REVIEW"; then
    bash "$SCRIPTS_DIR/notify.sh" "✅ Integration passed for $BATCH_ID" 2>/dev/null || true
    rm -f "$REVIEW"; break

External Model or Provider Selection

High
Category
Excessive Agency
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.

Content

Scanner excerpt · scripts/notify-on-complete.sh (reported line 28)May include surrounding context.

sh
cd "$WORK_DIR"
  
  REVIEW=$(mktemp)
  codex exec review 2>&1 | tee "$REVIEW"
  
  if grep -qi "no issues\|LGTM\|looks good\|clean\|approved" "$REVIEW"; then
    bash "$SCRIPTS_DIR/notify.sh" "✅ Review passed for $TASK_ID" 2>/dev/null || true

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The script performs an automatic 'git push' using '--force-with-lease' on a branch name taken from input, with fallback behavior that still pushes if the safer force option fails. In a swarm automation workflow, this can overwrite remote history, publish unreviewed agent output, or push to an unintended branch with no interactive verification, making repository integrity highly sensitive to upstream parameter control.

Content

Scanner excerpt · scripts/notify-on-complete.sh (reported line 41)May include surrounding context.

sh
done

cd "$WORK_DIR"
git push origin "$BRANCH" --force-with-lease 2>/dev/null || git push origin "$BRANCH" 2>/dev/null || true

External Model or Provider Selection

High
Category
Excessive Agency
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.

Content

Scanner excerpt · scripts/spawn-agent.sh (reported line 108)May include surrounding context.

sh
CUR_MODEL="$MODEL"

while true; do
  codex exec --full-auto -c "model=\$CUR_MODEL" -c "model_reasoning_effort=$REASONING" - < "$PROMPT_FILE" 2>&1
  EXIT=\$?
  
  if [ "\$EXIT" -eq 0 ]; then

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill advertises shell-driven orchestration and operational scripts but declares no explicit tool scope or permissions boundary. That makes it easier for an agent runtime to invoke shell actions with unclear constraints, increasing the chance of unintended command execution, filesystem modification, or network-capable helper usage without informed user approval.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest says the skill triggers on "parallel coding, multi-agent work, swarm orchestration, or batch spawning," but it does not clearly constrain where or how those phrases should be interpreted. Terms like "parallel coding" and especially "multi-agent work" are broad enough to overlap with ordinary development discussion, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation describes automated merge, cleanup, and notification workflows without prominent warnings about state-changing effects. In a coding and repository-management context, silent or poorly signposted automation can lead to branch deletion, unintended merges, loss of worktree state, or unapproved external notifications, especially when run in full-auto mode.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script performs recursive deletion of worktree directories without any confirmation, dry-run mode, or path safety validation beyond simple string concatenation. In a cleanup utility for parallel coding workflows, this creates a real risk of accidental data loss if the operator supplies the wrong project path or if the derived worktree path points to unexpected content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

When invoked with --all, the script force-deletes local feat/* branches and deletes matching remote branches with no confirmation or review step. In a multi-agent orchestration context where many temporary branches may exist, this behavior is operationally convenient but still dangerous because it can irreversibly remove work that was not meant to be cleaned up.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This script automatically checks out main, merges multiple remote branches, may invoke an LLM to resolve conflicts, runs an automated review loop, and then pushes to origin/main without any explicit human confirmation gate. In a multi-agent coding/orchestration context, this creates a direct path for unreviewed or incorrectly resolved changes to land on the primary branch, amplifying the blast radius of model mistakes or compromised agent output.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script automatically stages, commits, and pushes changes after an automated review loop without any explicit user confirmation or policy gate. In a multi-agent orchestration context, this can propagate unintended, low-quality, or malicious modifications to the remote repository, especially because the review pass/fail decision is based on simple text matching and failures are suppressed with '|| true'.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/notify.sh (reported line 15)May include surrounding context.

sh
case "$NOTIFY" in
  webhook)
    if [ -n "${SWARM_WEBHOOK_URL:-}" ]; then
      curl -s -X POST "$SWARM_WEBHOOK_URL" \
        -H "Content-Type: application/json" \
        -d "{\"text\": \"$MSG\"}" 2>/dev/null || true
    fi

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script sends the provided message content to either a configured webhook or the Telegram API via curl, which can disclose user or system data externally. There is no confirmation prompt, warning print, or explanatory comment near the network operations indicating that message contents may leave the local system.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/notify.sh (reported line 22)May include surrounding context.

sh
;;
  telegram)
    if [ -n "${SWARM_TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${SWARM_TELEGRAM_CHAT_ID:-}" ]; then
      curl -s "https://api.telegram.org/bot${SWARM_TELEGRAM_BOT_TOKEN}/sendMessage" \
        -d "chat_id=${SWARM_TELEGRAM_CHAT_ID}" \
        -d "text=${MSG}" \
        -d "parse_mode=Markdown" 2>/dev/null || true

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/notify.sh (reported line 22)May include surrounding context.

sh
;;
  telegram)
    if [ -n "${SWARM_TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${SWARM_TELEGRAM_CHAT_ID:-}" ]; then
      curl -s "https://api.telegram.org/bot${SWARM_TELEGRAM_BOT_TOKEN}/sendMessage" \
        -d "chat_id=${SWARM_TELEGRAM_CHAT_ID}" \
        -d "text=${MSG}" \
        -d "parse_mode=Markdown" 2>/dev/null || true

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script persists the full task prompt to a predictable local log file under the swarm directory, and that prompt may contain sensitive source code, credentials, internal URLs, or proprietary instructions. In a multi-agent orchestration context, prompts are effectively data payloads; storing them without minimization, access controls, or explicit disclosure increases the risk of local data exposure and unintended retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
76% confidence
Finding

This code writes a shell script and then uses it to invoke codex exec --full-auto, which is a subprocess execution path with potentially impactful automated behavior. While there are general status prints about spawning an agent, there is no explicit disclosure here that a generated script will be executed to run the agent automatically.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.