/

CVE-2026-41249

Severity:

HIGH RISK

(8.2)

Code Injection via Insecure GitHub Actions Workflow (CWE-94) in CoreShop Static Analysis Pipeline

CVE-2026-41249

Deferred

Vulnerability type

Category:

Code Injection in CI/CD Workflow

CWE:

CWE-94

Impact:

Remote Code Execution on CI Runner

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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 out github.event.pull_request.head.ref, then executes bin/console or 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_target for workflows that checkout and execute pull request code; prefer pull_request when code is executed, which runs with reduced permissions and no repository secrets by default.
  • If pull_request_target must 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_target combined with actions/checkout of github.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.

Sources

SourceLink
github.comgithub.com/coreshop/CoreShop/blob/5.1.0-beta.1/.github/workflows/static.yml#L14
github.comgithub.com/coreshop/CoreShop/commit/cc1e3f547228ec5ebfc1dc0472f9a3cc5f4137a4
github.comgithub.com/coreshop/CoreShop/security/advisories/GHSA-q58j-g3f4-h26h

Frequently asked

questions

Yes. Any external user who can open a pull request against the affected repository can attempt to exploit the vulnerability, without needing direct access to the CI infrastructure.

The attacker only needs permission to create a pull request (e.g., from a fork of the repository). No prior authentication to the CI environment is required beyond access to the GitHub repository's public contribution model.

The safest pattern is to avoid executing untrusted pull request code in a privileged context:

  • Replace pull_request_target with pull_request for workflows that build or test PR code, or
  • Ensure that workflows triggered by pull_request_target never checkout or execute code from the PR head and instead operate only on trusted base commits and metadata.

Establish CI/CD security guidelines and automated checks that:

  • Prohibit execution of fork-controlled code with access to secrets or write permissions.
  • Enforce least-privilege permissions on workflow tokens.
  • Require security review of new or modified workflows, especially those using pull_request_target or similar powerful triggers.
Find out what's already
exploitable in your codebase.