Coordinated Disclosure Timeline

Summary

The validate.ymland kickstart-tests.yml GitHub workflows are vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.

Product

rhinstaller/anaconda GitHub repository

Tested Version

The latest changesets c0044f0 and 9be8294 to the date.

Details

Issue 1: Untrusted code is explicitly checked out and run on a Pull Request from a fork

Workflows triggered on pull_request_target have read/write tokens for the base repository and the access to secrets. By explicitly checking out and running the build script from a fork the untrusted code is running in an environment that is able to push to the base repository and to access secrets. More details can be found in the article Keeping your GitHub Actions and workflows secure: Preventing pwn requests.

on: [push, pull_request_target]
...
      - name: Clone repository
        uses: actions/checkout@v2
        with:
          # otherwise we are testing target branch instead of the PR branch (see pull_request_target trigger)
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
...
      - name: Build anaconda-ci container
        # FIXME: always build ELN container, until we publish it to quay.io
        if: steps.check-dockerfile-changed.outputs.changed || matrix.release == 'eln'
        run: make -f Makefile.am anaconda-ci-build
...

Impact

The vulnerability allows for unauthorized modification of the base repository and secrets exfiltration.

Issue 2: A comment body is used to format a shell command

on:
  issue_comment:
    types: [created]
...
    if: startsWith(github.event.comment.body, '/kickstart-test')
...
      - name: Parse launch arguments
        id: parse_launch_args
        run: |
          # extract first line and cut out the "/kickstart-tests" first word
          LAUNCH_ARGS=$(echo '$' | sed -n '1 s/^[^ ]* *//p')
          echo "::set-output name=launch_args::${LAUNCH_ARGS}"

Impact

This vulnerability allows for arbitrary command injection into the bash script which allows for unauthorized modification of the base repository and secrets exfiltration. For a proof a concept comment on an issue with /kickstart-test'); echo 'test' #.

Credit

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

Contact

You can contact the GHSL team at securitylab@github.com, please include a reference to GHSL-2020-370 in any communication regarding this issue.