OWASP BLT RCE via Malicious Pull Request
OWASP BLT versions before 2.1.1 are vulnerable to remote code execution via a malicious pull request that injects code into the CI environment through the 'regenerate-migrations' workflow.
OWASP BLT, a QA testing and vulnerability disclosure platform, is susceptible to a critical remote code execution (RCE) vulnerability (CVE-2026-40316) in versions prior to 2.1.1. The vulnerability resides in the .github/workflows/regenerate-migrations.yml workflow. This workflow utilizes the pull_request_target trigger, granting it full GITHUB_TOKEN write permissions. An attacker can exploit this by submitting a malicious pull request containing a specially crafted website/models.py file. When a maintainer applies the regenerate-migrations label, the workflow copies files from the untrusted pull request, specifically the website/models.py file, into the trusted runner workspace using git show. Subsequently, the workflow executes python manage.py makemigrations, which imports Django model modules, including the attacker-controlled website/models.py. This import leads to the execution of any module-level Python code within the attacker's models.py file. This results in arbitrary code execution within the privileged CI environment, enabling access to GITHUB_TOKEN and repository secrets.
Attack Chain
- An attacker creates a malicious fork of an OWASP BLT repository running a version prior to 2.1.1.
- The attacker crafts a
website/models.pyfile containing malicious Python code designed for remote code execution, such as exfiltrating secrets or injecting a reverse shell. - The attacker submits a pull request to the upstream OWASP BLT repository, including the malicious
website/models.pyfile. - A maintainer applies the
regenerate-migrationslabel to the pull request, triggering the.github/workflows/regenerate-migrations.ymlworkflow. - The
git showcommand within the workflow copies the attacker-controlledwebsite/models.pyfile from the pull request into the runner's workspace. - The
python manage.py makemigrationscommand is executed, which imports the Django model modules, including the maliciouswebsite/models.pyfile. - The attacker's malicious Python code within
website/models.pyis executed in the privileged CI environment, granting access toGITHUB_TOKENand repository secrets. - The attacker leverages the compromised
GITHUB_TOKENto exfiltrate sensitive information, inject malicious code, or perform other unauthorized actions within the repository, potentially leading to a supply chain attack.
Impact
Successful exploitation of CVE-2026-40316 allows an attacker to achieve remote code execution within the OWASP BLT CI environment. This can lead to the exfiltration of sensitive information, such as API keys and credentials, potentially compromising connected systems. The attacker can also modify the repository code, inject malicious code, or even take complete control of the repository. This poses a significant risk to the integrity and security of the OWASP BLT project and its users. Given that OWASP BLT is used for QA testing and vulnerability disclosure, a successful attack could undermine trust in the platform itself, impacting numerous other projects and organizations.
Recommendation
- Upgrade OWASP BLT to version 2.1.1 or later to patch CVE-2026-40316.
- Implement controls to restrict the use of the
regenerate-migrationslabel and require multi-factor authentication for maintainers. - Monitor GitHub Actions logs for suspicious activity, particularly related to the
regenerate-migrationsworkflow and the execution ofpython manage.py makemigrations. Deploy the Sigma rules in this brief to your SIEM to detect suspicious activity. - Implement code review processes to carefully examine pull requests, especially those modifying
website/models.pyor other critical files.
Detection coverage 2
Detect Suspicious models.py Modification in Pull Requests
mediumDetects pull requests that modify models.py with potentially malicious code
Detect python manage.py makemigrations Execution in Github Actions
highDetects the execution of python manage.py makemigrations command within a Github Actions environment, which could indicate exploitation of CVE-2026-40316
Detection queries are available on the platform. Get full rules →