Summary
OWASP BLT's GitHub Actions workflow .github/workflows/pre-commit-fix.yaml used the privileged pull_request_target trigger while checking out and executing code directly from an untrusted fork.
Under these conditions, an attacker could achieve remote code execution within the CI environment and gain write permissions to the target repository.
Affected context
This vulnerability manifests in GitHub repositories using OWASP BLT prior to version 2.1.2 where:
- The
.github/workflows/pre-commit-fix.yamlworkflow is present and enabled - The workflow is triggered by the
pull_request_targetevent - The workflow checks out and executes code from the pull request's fork instead of the base repository
In this context, untrusted contributor code gains effective access to a privileged GitHub Actions token.
Exploit preconditions
- Attack surface: GitHub Actions CI environment for repositories using the affected OWASP BLT workflow.
- Required access: Ability to open a pull request from a fork against a repository that has the vulnerable workflow enabled.
- Trigger point: Creation or update of a pull request that causes the
pull_request_targetworkflow to run and execute code from the forked branch. - Why exploitation is possible: The workflow combines a privileged event (
pull_request_target, which runs in the context of the base repository) with direct checkout and execution of attacker-controlled code from the fork, allowing that code to run with write-capable credentials.
Why this happens
At its core, the issue is a CI/CD pipeline misconfiguration that leads to arbitrary code execution, aligning with CWE-94: Improper Control of Generation of Code ('Code Injection') and related dynamic execution risks as modeled by CWE-95.
The vulnerable workflow:
- Uses
pull_request_target, which by design runs with the base repository's security context and elevated permissions. - Checks out the pull request's fork (untrusted code) instead of a safe, trusted reference.
- Executes that untrusted code as part of automated checks or fixes.
This pattern effectively treats attacker-supplied repository content as trusted code, allowing it to be executed in a privileged environment, thereby enabling arbitrary commands or scripts to run with write access to the repository.
Potential impact
- Modification or deletion of repository contents via the GitHub Actions token.
- Creation or alteration of pull requests and branches to insert malicious code.
- Tampering with security controls, CI workflows, or configuration files to weaken future protections.
- Injection of supply-chain backdoors into the project's source code or release artifacts.
- Lateral movement to other systems that trust this repository or its artifacts.
General mitigation guidance
Effective mitigation focuses on restricting what code runs with privileged CI tokens and how untrusted contributions are handled:
- Avoid executing code from untrusted forks in workflows triggered by
pull_request_target; instead, run only workflows defined in the base repository and operate on safe, base branches. - Prefer the
pull_requestevent when running tests on untrusted code, combined with reduced-permission tokens orGITHUB_TOKENdefaults that disallow repository writes. - Separate workflows into:
- Privileged workflows that never ingest or execute contributor code directly.
- Unprivileged workflows that can run untrusted code but operate with minimal permissions.
- Treat workflow configurations as security-critical code: require review from maintainers familiar with CI security patterns before changes are merged.
- Use least-privilege principles for CI tokens, disabling write scopes where they are not strictly necessary.
How teams detect issues like this
Organizations can surface this class of issue through proactive analysis of CI configurations:
- Static configuration review: Scan GitHub Actions workflows for
pull_request_targetusage combined with steps that: - Check out code from
github.event.pull_request.heador equivalent untrusted refs. - Execute scripts, build systems, or tooling directly from the contributor's branch.
- Automated policy enforcement: Implement repository-level or organizational policies that:
- Flag workflows using
pull_request_targetand untrusted checkout patterns. - Require security review or approval when workflows are added or modified.
- Code review cues: During manual review, look for:
- Direct calls to
actions/checkoutpointing to PR heads in privileged workflows. - Scripts that dynamically import or execute code from the repository without origin checks.
- Security tooling integration: Integrate CI configuration linters and SAST tools that understand GitHub Actions semantics and can identify insecure workflow patterns.

