Skip to content

[Security] Harden workflows against shell command injection via untrusted filenames #4721

Description

@kuramaSeige-OFC

Summary

I've identified an issue in our GitHub Action workflows:

  • Command Injection Vulnerability: Standard workflows (ci.yml and card-to-archive.yml) directly interpolate untrusted file names from fork PRs into shell script runner commands, allowing arbitrary command execution.

Scenario & Narration

During reviewing recent pull request #4694 , In this PR he/she submitted changes containing files with unusual characters in their names, specifically:

  • .github/workflows/file;id>.txt
  • file;env>env.txt;#.js

This was an attempt to exploit a Shell Command Injection vulnerability in our workflows.

Here is how the exploit works step-by-step:

  1. In ci.yml and card-to-archive.yml, we retrieve list of changed files via tj-actions/changed-files.
  2. Workflow then run inline bash scripts using GitHub's template substitution:
    npx prettier --check ${{ steps.changed-files.outputs.all_changed_files }}
    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugciCI/CD changesgithub_actionsPull requests that update GitHub Actions codemaintainer-reviewNeeds review from a maintainerpriority:criticalCritical prioritysecuritySecurity improvements

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions