Summary
Mesa's GitHub-based benchmarks workflow up to version 3.5.0 checks out and runs untrusted code, enabling arbitrary code execution within a privileged CI runner.
If an attacker can influence the repository content or referenced code at workflow runtime, they may execute arbitrary commands with the runner's privileges during benchmark execution.
Affected context
This vulnerability affects Mesa projects that use the benchmarks.yml GitHub Actions workflow (or equivalent CI configuration) which:
- Automatically checks out repository code or external code for benchmarking, and
- Executes benchmark scripts or commands with high privileges on the CI runner.
The risk is elevated in setups where:
- Pull request or branch code is trusted by default,
- Benchmarks run automatically on untrusted contributions, or
- The runner has access tokens, secrets, or internal infrastructure.
Exploit preconditions
- Attack surface: CI/CD environment, specifically the GitHub Actions (or similar) workflow executing
benchmarks.yml. - Required access: Ability to submit or modify code/configuration that the workflow checks out (e.g., via pull request, branch push, or compromised dependency repository).
- Trigger point: Automatic or manual execution of the benchmarks workflow that checks out and runs the contributed code or scripts.
- Why exploitation is possible: The workflow design implicitly trusts checked-out content and executes it under a privileged runner context without strong isolation or validation, enabling arbitrary commands to run as part of benchmarks.
Why this happens
The core issue aligns with CWE-94: Improper Control of Generation of Code ('Code Injection') in the CI/CD pipeline.
The benchmarks.yml workflow treats repository or referenced code as inherently trustworthy, checking it out and executing it as part of benchmark runs.
Because the workflow does not sufficiently constrain what code can be executed, an attacker who controls or influences the checked-out content can inject commands or scripts that run with the CI runner's privileges.
Conceptually, this is an unsafe pattern where execution logic within automation pipelines is derived from untrusted or partially trusted sources, without sandboxing, policy checks, or strict execution boundaries.
Potential impact
- Execution of arbitrary commands on the CI runner.
- Theft or misuse of CI secrets, tokens, or credentials accessible to the runner.
- Modification or exfiltration of build artifacts, benchmarks, or test results.
- Use of the runner as a pivot to access internal services reachable from the CI environment.
- Poisoning of benchmark data or performance metrics to mislead downstream decisions.
General mitigation guidance
Effective mitigation centers on reducing trust in dynamically checked-out code and constraining what CI workflows execute:
- Separate untrusted contributor benchmarks from trusted workflows, e.g., run on isolated, low-privilege runners with no secrets.
- Avoid executing arbitrary repository scripts directly; instead, use fixed, version-controlled benchmark commands and entry points defined in the workflow itself.
- Restrict when workflows run (e.g., only for trusted branches) or gate execution with manual approvals for contributions from forks.
- Apply least privilege to CI runners: minimize available secrets, network access, and system capabilities for benchmarking jobs.
- Use sandboxing or containerization for arbitrary code evaluation so that even if code runs, its effects are tightly contained.
How teams detect issues like this
To detect similar issues, organizations can:
- Review CI/CD workflows for steps that
checkoutand then execute repository content or scripts derived from contributor-controlled files. - Use static analysis or policy-as-code tools (e.g., GitHub Actions linters, OPA-based policies) to flag workflows that execute untrusted code, run shell commands built from inputs, or require excessive permissions.
- Enforce repository protections so changes to CI workflow files undergo security-focused review.
- Monitor CI logs and audit trails for anomalous commands, unexpected network calls, or access to secrets during benchmark or test jobs.

