Summary
CoreShop's GitHub Actions workflow for static checks uses the pull_request_target trigger but then checks out and executes code from the untrusted pull request head.
An attacker can submit a crafted pull request that injects malicious commands into the repository's scripts, leading to remote code execution (RCE) on the GitHub Actions runner when the workflow runs.
Affected context
This vulnerability occurs in CoreShop's GitHub Actions configuration (.github/workflows/static.yml) for versions 5.0.1 through 5.1.0-beta.1.
The workflow is triggered by pull_request_target, which runs with elevated permissions and access to repository secrets, but it checks out and executes code from the pull request head rather than the trusted base.
The risk materializes in repositories that automatically run this workflow for pull requests, including those from forks and external contributors.
Exploit preconditions
- Attack surface: GitHub repository accepting pull requests with the vulnerable workflow enabled.
- Required access: Ability to open a pull request (e.g., from a fork or external GitHub account).
- Trigger point: The
pull_request_target-based workflow runs and checks outgithub.event.pull_request.head.ref, then executesbin/consoleor other scripts from that untrusted commit. - Why exploitation is possible: The workflow grants trusted context (permissions, tokens, secrets) to code originating from an untrusted pull request head, enabling arbitrary command execution on the runner.
Why this happens
The root cause is an unsafe combination of GitHub Actions features:
- Using
pull_request_target, which runs in the context of the base repository and can access secrets and write permissions. - Checking out untrusted code from the pull request head (
ref: ${{ github.event.pull_request.head.ref }}) instead of a trusted base commit. - Executing scripts (
bin/console) from that untrusted checkout.
This aligns with CWE-94: Improper Control of Generation of Code, as attacker-controlled changes in the pull request can alter the script or workflow-executed logic, causing arbitrary commands to run within the CI environment.
Potential impact
- Attacker-controlled execution of arbitrary commands on the GitHub Actions runner.
- Exfiltration of repository secrets, tokens, or credentials available to the workflow.
- Tampering with build artifacts or CI outputs, potentially poisoning releases.
- Lateral movement into other services integrated with the CI pipeline (e.g., package registries, deployment systems) if corresponding credentials are exposed.
- Abuse of GitHub tokens to modify the repository, open issues, or push malicious commits, depending on workflow permissions.
General mitigation guidance
Effective mitigation focuses on isolating untrusted pull request code from privileged CI contexts and avoiding direct execution of fork-controlled code:
- Avoid using
pull_request_targetfor workflows that checkout and execute pull request code; preferpull_requestwhen code is executed, which runs with reduced permissions and no repository secrets by default. - If
pull_request_targetmust be used (e.g., for labeling or triage), restrict it to metadata-only operations and do not checkout or run PR code. - Use the trusted base commit (
github.base_ref/github.event.pull_request.base.sha) for any script execution that requires access to secrets or write permissions. - Apply least-privilege permissions in workflows (
permissions:block) so that tokens used in CI have only the minimal required scopes. - Introduce policy guidelines that any workflow executing code from forks must run in hardened, ephemeral environments without access to sensitive secrets or write scopes.
How teams detect issues like this
Detection approaches generally focus on CI configuration review and policy enforcement:
- Static analysis of GitHub Actions YAML files to flag uses of
pull_request_targetcombined withactions/checkoutofgithub.event.pull_request.head.*refs. - Policy-as-code tools (e.g., Open Policy Agent, custom linters) that enforce rules such as "do not execute scripts from untrusted PR heads with a token that has write or secret access."
- Code review checklists that highlight workflows which:
- Use
pull_request_target - Checkout PR head commits
- Run project binaries or scripts (
bin/console,npm run, etc.) - Periodic scanning of CI configurations with security-focused tooling that understands GitHub Actions best practices and flags dangerous trigger/checkout combinations.

