T09 · Insecure Skill Coding Practices
- Location
scripts/deploy.sh:24- Finding
Predictable and Unvalidated Temporary Checkout Enables Local Code Execution and Repository Redirection
- Content
View full analysis
/dev/null || git checkout -b "$BRANCH" fi ``` Subsequent commands also operate on the trusted checkout: ```bash git commit -m "$COMMIT_MSG" COMMIT_HASH=$(git rev-parse HEAD) git push -u origin "$BRANCH" --force ``` ### Technical Analysis The checkout location is deterministically derived from the basename of the user-provided remote URL and placed directly under the shared `/tmp` directory. The script treats any existing directory at that location as a valid checkout without checking: - Its owner and permissions. - Whether the path or any parent component is a symbolic link. - Whether it is a valid Git repository created by this script. - Whether its configured `origin` matches the supplied `REMOTE_URL`. - Whether it contains attacker-controlled Git hooks or configuration. Git commands can invoke repository-local hooks. For example, checkout operations can invoke `post-checkout`, pull operations can invoke merge-related hooks, and commits can invoke `pre-commit` or other commit hooks. An attacker-prepared ...[truncated 1960 chars]- Remediation
View remediation
