Summary
Actions expression injection in filter-test-configs (GHSL-2023-181)
The pytorch/pytorch filter-test-configs workflow is vulnerable to an expression injection in Actions, allowing an attacker to potentially leak secrets and alter the repository using the workflow.
Details
The filter-test-configs workflow is using the raw github.event.workflow_run.head_branch value inside the filter step:
- name: Select all requested test configurations
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
JOB_NAME: ${{ steps.get-job-name.outputs.job-name }}
id: filter
run: |
...
python3 "${GITHUB_ACTION_PATH}/../../scripts/filter_test_configs.py" \
...
--branch "${{ github.event.workflow_run.head_branch }}"
In the event of a repository using filter-test-configs in a pull_request_target-triggered workflow, an attacker could use a malicious branch name to gain command execution in the step and potentially leak secrets.
name: Example
on: pull_request_target
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Filter
uses: pytorch/pytorch/.github/actions/filter-test-configs@v2
Resources
Impact
This issue may lead to stealing workflow secrets.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
- Use an intermediate environment variable for potentially attacker-controlled values such as
github.event.workflow_run.head_branch:
- name: Select all requested test configurations
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
JOB_NAME: ${{ steps.get-job-name.outputs.job-name }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
id: filter
run: |
...
python3 "${GITHUB_ACTION_PATH}/../../scripts/filter_test_configs.py" \
...
--branch "$HEAD_BRANCH"
Frequently Asked Questions
- What is GHSA-HW6R-G8GJ-2987? GHSA-HW6R-G8GJ-2987 is a medium-severity security vulnerability in https://github.com/pytorch/pytorch/.github/actions/filter-test-configs (actions), affecting versions < 2.0.1. No fixed version is listed yet.
- Which versions of https://github.com/pytorch/pytorch/.github/actions/filter-test-configs are affected by GHSA-HW6R-G8GJ-2987? https://github.com/pytorch/pytorch/.github/actions/filter-test-configs (actions) versions < 2.0.1 is affected.
- Is there a fix for GHSA-HW6R-G8GJ-2987? No fixed version is listed for GHSA-HW6R-G8GJ-2987 yet. Monitor the advisory for updates and apply mitigations in the interim.
- Is GHSA-HW6R-G8GJ-2987 exploitable, and should I be worried? Whether GHSA-HW6R-G8GJ-2987 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-HW6R-G8GJ-2987 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.