Skip to content

security: [HIGH] Unquoted CLAUDE_MODEL_FLAG expansion in security.sh (word-splitting risk) #2979

@louisgv

Description

@louisgv

Security Issue

Severity: HIGH
File: .claude/skills/setup-agent-team/security.sh:296
Reporter: security/shell-scanner

Vulnerability

Unquoted variable expansion of CLAUDE_MODEL_FLAG on line 296:

claude -p "$(cat "${PROMPT_FILE}")" ${CLAUDE_MODEL_FLAG} >> "${LOG_FILE}" 2>&1 &

When RUN_MODE="triage", this sets:

CLAUDE_MODEL_FLAG="--model google/gemini-3-flash-preview"

Attack Vector

The unquoted expansion is vulnerable to word-splitting. While the current value doesn't exploit this, the pattern is unsafe:

  1. If CLAUDE_MODEL_FLAG is empty, the unquoted expansion passes nothing (correct behavior)
  2. If CLAUDE_MODEL_FLAG contains spaces, each word becomes a separate argument
  3. A malicious model name could inject additional claude arguments

Recommended Fix

Option 1: Use conditional expansion with quoting (safe for empty values):

claude -p "$(cat "${PROMPT_FILE}")" ${CLAUDE_MODEL_FLAG:+"${CLAUDE_MODEL_FLAG}"} >> "${LOG_FILE}" 2>&1 &

Option 2 (preferred): Use an array for args:

CLAUDE_MODEL_ARGS=()
if [[ "${RUN_MODE}" == "triage" ]]; then
    CLAUDE_MODEL_ARGS=(--model google/gemini-3-flash-preview)
fi
claude -p "$(cat "${PROMPT_FILE}")" "${CLAUDE_MODEL_ARGS[@]}" >> "${LOG_FILE}" 2>&1 &

Related Issues

Note

This file is in .claude/skills/setup-agent-team/ (bot infrastructure), which is off-limits for automated refactoring per CLAUDE.md. Manual maintainer fix required.


Filed automatically by security/shell-scanner team

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions