Arbitrary Code Injection The advisory has been revoked - it doesn't affect any version of package torch  (opens in a new tab)


Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-TORCH-5876728
  • published31 Aug 2023
  • disclosed30 Aug 2023
  • creditjorgectf

Introduced: 30 Aug 2023

CVE NOT AVAILABLE CWE-94  (opens in a new tab)

Amendment

This was deemed not a vulnerability.

Overview

torch is a Tensors and Dynamic neural networks in Python with strong GPU acceleration

Affected versions of this package are vulnerable to Arbitrary Code Injection through filter-test-configs in the pull_request_target-triggered workflow, allowing an attacker to use a malicious branch name to gain command execution and potentially leak secrets.

Mitigation:

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"

References