CVE-2023-52137

7.7 HIGH

📋 TL;DR

This CVE describes a command injection vulnerability in the tj-actions/verify-changed-files GitHub Action. Attackers can inject malicious commands through specially crafted filenames, potentially executing arbitrary code on GitHub Runners and stealing secrets like GITHUB_TOKEN. Users of this action in GitHub workflows are affected.

💻 Affected Systems

Products:
  • tj-actions/verify-changed-files GitHub Action
Versions: All versions before v17 and v17.0.0
Operating Systems: All GitHub Runner operating systems (Linux, Windows, macOS)
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires the action output to be used in a raw fashion within a run block without proper escaping.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of GitHub Runner with execution of arbitrary commands, theft of all repository secrets including GITHUB_TOKEN, and potential lateral movement within GitHub infrastructure.

🟠

Likely Case

Execution of limited commands on GitHub Runner, potential exfiltration of workflow secrets, and unauthorized access to repository contents.

🟢

If Mitigated

No impact if safe_output is enabled and outputs are properly handled, or if action is not used with vulnerable configurations.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires ability to create or modify filenames in a repository, typically through pull requests or direct commits.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v17 and v17.0.0

Vendor Advisory: https://github.com/tj-actions/verify-changed-files/security/advisories/GHSA-ghm2-rq8q-wrhc

Restart Required: No

Instructions:

1. Update your workflow to use tj-actions/verify-changed-files@v17 or later. 2. Verify safe_output is enabled (default in patched versions). 3. Review workflow usage to ensure outputs are properly handled.

🔧 Temporary Workarounds

Enable safe_output manually

all

Manually enable safe_output parameter in workflow configuration

- uses: tj-actions/verify-changed-files@v16
  with:
    safe_output: true

Sanitize output before use

all

Properly escape or sanitize the action output before using in run commands

- name: Sanitize output
  run: |
    SANITIZED_OUTPUT="$(echo "${{ steps.verify.outputs.changed_files }}" | sed 's/[^a-zA-Z0-9._/-]//g')"
    echo "Sanitized: $SANITIZED_OUTPUT"

🧯 If You Can't Patch

  • Disable or remove the verify-changed-files action from workflows
  • Implement strict filename validation in repository policies

🔍 How to Verify

Check if Vulnerable:

Check workflow YAML files for uses: tj-actions/verify-changed-files with version below v17 and without safe_output: true parameter.

Check Version:

grep -r "tj-actions/verify-changed-files" .github/workflows/

Verify Fix Applied:

Verify workflow uses tj-actions/verify-changed-files@v17 or later, or has safe_output: true explicitly set.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected command execution in GitHub Actions logs
  • Suspicious filenames containing special characters in workflow outputs

Network Indicators:

  • Unusual outbound connections from GitHub Runners during workflow execution

SIEM Query:

source="github-actions" AND ("verify-changed-files" OR "changed_files") AND command_execution

🔗 References

📤 Share & Export