Mesa Python Library Code Execution Vulnerability in GitHub Actions Workflow
Vulnerability
A code execution vulnerability has been identified in the Mesa Python library, specifically in the GitHub Actions workflow file 'benchmarks.yml'. This issue affects versions of Mesa prior to 3.5.1. The vulnerability arises because the 'benchmarks.yml' workflow checks out code from the pull request branch and executes it in a privileged runner. A malicious 'setup.py' or 'benchmarks/global_benchmark.py' could be crafted to run arbitrary code, exploiting the fact that the runner has write privileges to issues and pull requests.
Impact
Exploitation of this vulnerability could lead to unauthorized code execution in the GitHub Actions runner, with the executed code having write privileges to issues and pull requests.
Reproduction
The vulnerability can be reproduced by creating a pull request that includes a malicious 'setup.py' file or a 'benchmarks/global_benchmark.py' script. Once the pull request is submitted, the 'benchmarks.yml' workflow will be triggered. This workflow checks out the code from the pull request branch and executes the global benchmark script, which can be used to run arbitrary code on the runner.
Remediation
The vulnerability has been patched in Mesa version 3.5.1. Users are advised to update to this version. Additionally, the 'benchmarks.yml' workflow can be split into two separate workflows to mitigate the issue. The first workflow should run the benchmarks and be triggered on 'pull_request' events with read-only permissions. The second workflow can handle the 'Comment PR' step with the original permissions, using an artifact from the first workflow.
Vulnerability Rating
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.
