skip to content
Back to
Home Bounties Research Advisories CodeQL Wall of Fame Get Involved Events
February 3, 2021

GHSL-2020-240: Command injection in scikit-learn/scikit-learn workflow

Jaroslav Lobacevski

Coordinated Disclosure Timeline


The ‘sync_pull_request.yml’ GitHub workflow is vulnerable to arbitrary command injection.


scikit-learn/scikit-learn GitHub repository

Tested Version

The latest changeset 12f1521 to the date.


Issue: The forked branch name is used to format a shell command

When a label ci sync is assigned to a PR it automatically starts the GitHub workflow. The forked branch name is used to format a bash script.

name: Sync Pull Request
    types: [labeled]

    runs-on: ubuntu-latest
    if: contains(github.event.pull_request.labels.*.name, 'ci sync')
      - name: Sync with master
        run: |
          set -xe
          git remote add pr_remote ${{ github.event.pull_request.head.repo.html_url }}
          git fetch pr_remote ${{ github.event.pull_request.head.ref }}

If an authorized person is tricked into assigning the label on a specially crafted PR this vulnerability allows for arbitrary command injection into the bash script. For a Proof of Concept create a PR from branch named main;echo${IFS}"abc";exit${IFS}0.


The injection allows for exfiltration of the temporary GitHub repository authorization token to the attacker controlled server. Although the token is not valid after the workflow finishes, since the attacker controls the execution of the workflow he or she can delay it to give the malicious server time to modify the repository.


This issue was discovered and reported by GHSL team member @JarLob (Jaroslav Lobačevski).


You can contact the GHSL team at, please include a reference to GHSL-2020-240 in any communication regarding this issue.