Summary
An insecure GitHub Actions workflow in the CloudPirates Open Source Helm Charts project executes attacker-controlled code from forked pull requests with access to repository secrets.
An attacker can craft a pull request that, when the workflow runs, exfiltrates secrets such as Docker Hub credentials and tokens without requiring maintainer approval, enabling full compromise of associated registries and supply-chain assets.
Affected context
This vulnerability appears in the project's GitHub Actions configuration, specifically the pull-request.yaml workflow.
It affects repositories where:
- Pull request workflows are triggered for forks,
- Untrusted pull request code is executed with the same permissions and secrets as trusted branches, and
- Secrets (such as Docker Hub credentials and access tokens) are made available to the workflow without isolation.
The issue is specific to CI/CD execution contexts rather than the runtime behavior of deployed Helm charts themselves.
Exploit preconditions
- Attack surface: GitHub Actions workflow triggered by pull requests from forks.
- Required access: Ability to submit a pull request to the repository (typically any GitHub user, if the project is open source and accepts PRs from forks).
- Trigger point: Creation or update of a pull request that causes the vulnerable
pull-request.yamlworkflow to run. - Why exploitation is possible: The workflow executes steps that run code under control of the pull request author while concurrently exposing repository secrets to that job, without requiring explicit maintainer review or using restricted tokens.
Why this happens
The core issue is the execution of untrusted code with high-privilege credentials in an automated workflow, mapping to CWE-94: Improper Control of Generation of Code ('Code Injection') in a CI/CD context.
The pull-request.yaml GitHub Actions workflow treats code and configuration from forked pull requests as trusted, allowing them to run commands in the workflow environment where repository-level secrets (e.g., Docker Hub credentials and tokens) are available.
This creates an implicit code injection channel: an attacker-controlled pull request can embed arbitrary shell commands or scripts in the workflow execution path, which then run with the repository's secret context and network access, enabling secret exfiltration and downstream resource compromise.
Potential impact
- Exfiltration of repository secrets, including Docker Hub credentials and various access tokens.
- Unauthorized pushes of malicious container images to Docker Hub or other registries, facilitating supply-chain attacks on downstream consumers.
- Tampering with build artifacts or Helm chart images to inject backdoors, cryptominers, or data exfiltration logic.
- Impersonation of the project in registries, damaging project reputation and trust.
- Potential pivoting into other systems or services that trust the compromised tokens or credentials (e.g., other CI/CD pipelines or cloud environments).
General mitigation guidance
Effective mitigation focuses on separating trust boundaries in CI/CD and eliminating execution of untrusted code with privileged credentials.
Recommended patterns include:
- Avoid exposing sensitive secrets to workflows triggered by pull requests from forks; use GitHub's default behavior of withholding secrets for fork-based PRs and do not override it.
- Design PR workflows to run in an unprivileged context using ephemeral or restricted tokens with minimal scopes.
- Restrict workflow permissions via fine-grained
permissions:settings in GitHub Actions, granting only what is strictly necessary. - Use separate, manually triggered workflows (e.g.,
workflow_dispatch) for operations that require elevated privileges or push to registries, only runnable by trusted maintainers. - Introduce explicit review or approval steps before any untrusted code path can interact with sensitive resources such as registries or signing keys.
- Prefer build architectures where the CI pulls code from trusted branches only, and treats PR builds as untrusted previews without publication authority.
How teams detect issues like this
High-level detection approaches for similar CI/CD vulnerabilities include:
- Static review of GitHub Actions workflows to identify:
- Workflows triggered by
pull_requestorpull_request_targetthat exposesecrets.*. - Steps that run arbitrary shell commands (
run:) or scripts sourced from pull request changes with access to privileged tokens. - Overly broad
permissions:configurations (e.g.,contents: write,packages: write) for PR workflows. - Policy-based checks (e.g., using GitHub Advanced Security, Open Policy Agent, or custom linters) to enforce that fork-based PR workflows:
- Do not have access to high-value secrets.
- Run with restricted tokens and read-only permissions.
- Periodic audits of CI logs and artifact publication history for signs of anomalous activity, such as unexpected image pushes or registry changes.
- Incorporating automated CI configuration scanning tools that understand common CI platforms and flag misconfigurations where untrusted code can run with privileged credentials.

