Vowpal Wabbit: Command Injection via GitHub Actions Pull Request Trigger
Overview
The Vowpal Wabbit project's CI/CD pipeline, specifically the `.github/workflows/python_checks.yml` workflow, contains a critical command injection vulnerability. The workflow is triggered by pull requests targeting any branch. Within this workflow, the content of the pull request's title, accessed via the `github.event.pull_request.title` context, is directly embedded into bash commands. These commands are enclosed in double quotes and passed as arguments to the `run_tests_model_gen_and_load.py` script. The shell interprets the interpolated pull request title before executing the Python script. An attacker can craft a malicious pull request title containing shell metacharacters and commands. When the CI/CD runner processes this title, the shell will execute these injected commands before the Python script is even invoked. This allows an attacker to achieve arbitrary command execution on the build runner, potentially compromising the CI environment and any sensitive information processed by it. The vulnerability affects multiple jobs within the workflow, amplifying the risk.
Affected Systems
Testing Guide
1. Fork the Vowpal Wabbit repository. 2. Create a new branch. 3. Open a pull request targeting the main branch of the original Vowpal Wabbit repository. 4. In the pull request title, include malicious shell commands, for example: `"test" && echo vulnerable && exit 0` or `"test"; ls -la; echo done`. 5. Observe the logs of the GitHub Actions workflow that is automatically triggered. 6. If the injected commands (e.g., `echo vulnerable`) are executed and appear in the logs, the system is vulnerable.
Mitigation Steps
* Sanitize or escape user-provided input, such as the pull request title, before incorporating it into shell commands. * Avoid directly embedding external input into shell commands; prefer using safer mechanisms like environment variables or passing data as arguments to scripts executed in a controlled manner. * Implement stricter access controls or review processes for pull requests that trigger automated workflows. * Regularly review GitHub Actions workflow definitions for insecure input handling practices.
Patch Details
Commit 998e390e80a7e8192d7849b7784bc113dbd190ad