T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/run_dispatch.sh:73- Finding
Path Traversal Through Unvalidated Project and Task Names
- Content
View full analysis
``` 2. The script constructs: ```text ${REPOS_ROOT}/../../unintended-target ``` 3. `mkdir -p` creates the resolved directory if the process account has permission. 4. The dispatcher launches Claude Code with that unintended location as its working directory. 5. Claude Code can inspect or modify files available to the process ...[truncated 733 chars]- Remediation
View remediation
&2 exit 2 fi if [[ ! "$TASK_NAME" =~ ^[A-Za-z0-9._-]+$ ]] || [[ "$TASK_NAME" == "." || "$TASK_NAME" == ".." ]]; then echo "Invalid task name" >&2 exit 2 fi ``` 2. Reject path separators, traversal components, control characters, and newline characters. 3. Canonicalize the configured root and candidate path with `realpath`. 4. Verify that the canonical candidate begins with the canonical root followed by `/`. 5. Perform equivalent containment checks independently for work, result, and log paths. 6. Prefer an internally generated opaque run identifier rather than embedding user-controlled names in filenames. 7. Refuse to create a project directory automatically unless directory creation is an explicitly intended and authorized operation. ]]>
