/

CVE-2026-42298

Severity:

CRITICAL RISK

(10.0)

Code Injection in CI/CD Workflow in Postiz

CVE-2026-42298

Analyzed

Vulnerability type

Category:

Code Injection in CI/CD Workflow

CWE:

CWE-94

Impact:

Full Repository Compromise via CI GITHUB_TOKEN Abuse

Severity:

CRITICAL RISK

(10.0)

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

A code injection flaw in Postiz's GitHub Actions workflow for building and publishing PR Docker images allowed arbitrary command execution during the Docker build process.

Any unauthenticated user could open a pull request from a fork with a malicious Dockerfile.dev, execute attacker-controlled code in CI, and exfiltrate a highly privileged GITHUB_TOKEN with write-all permissions.

Affected context

The vulnerability occurs in the .github/workflows/pr-docker-build.yml GitHub Actions workflow used to build and publish Docker images for pull requests.

It affects repositories where:

  • The PR build workflow is automatically triggered for forks
  • The workflow uses a privileged GITHUB_TOKEN with broad write-all permissions
  • Docker build contexts or Dockerfiles are taken directly from untrusted pull request changes without isolation

In this setup, the Docker build step becomes an execution environment for attacker-supplied instructions from the PR.

Exploit preconditions

  • Attack surface: GitHub Actions CI pipeline, specifically the PR Docker build workflow.
  • Required access: Ability to create a public fork and open a pull request against the target repository (no prior authentication to the upstream project required beyond a standard GitHub account).
  • Trigger point: Automated execution of .github/workflows/pr-docker-build.yml on the malicious PR, building the modified Dockerfile.dev.
  • Why exploitation is possible: The workflow trusted Docker build instructions from the PR branch while exposing a highly privileged GITHUB_TOKEN in the same job context, enabling injected build steps to run arbitrary commands and access secrets.

Why this happens

This issue stems from treating untrusted pull request content as trusted build instructions in a privileged CI environment.

The PR-controlled Dockerfile.dev is effectively code that is executed by the Docker build process, and the workflow configuration allowed this execution to occur with access to a powerful GITHUB_TOKEN.

This maps to CWE-94: Improper Control of Code Generation (Code Injection), where dynamically supplied instructions (here, Dockerfile directives and build-time commands) from an untrusted source are executed without sufficient isolation or reduction of privileges, enabling attackers to run arbitrary code in the CI runner.

Potential impact

  • Exfiltration of the CI job's GITHUB_TOKEN with write-all permissions
  • Unauthorized creation, modification, or deletion of repository contents (branches, tags, releases)
  • Tampering with source code, workflows, or release artifacts to introduce backdoors or supply-chain implants
  • Manipulation of issues, pull requests, and repository settings accessible via the token
  • Potential compromise of dependent repositories or automation that trusts artifacts from the affected project

General mitigation guidance

Effective mitigation focuses on separating untrusted PR code from privileged CI contexts and reducing token power:

  • Use least-privilege tokens for CI workflows, limiting scopes to read-only where possible and disabling write-all for PR-triggered jobs.
  • Configure GitHub Actions so that fork-based pull requests run in a restricted context, e.g., using pull_request_target carefully or dedicated workflows that do not expose sensitive secrets.
  • Avoid building or executing Dockerfiles or scripts directly from untrusted PR branches in jobs that have access to sensitive secrets; use pinned, trusted Dockerfiles and static build definitions.
  • Introduce manual approval or additional checks before running workflows that require elevated privileges or write access to the repository.
  • Apply a defense-in-depth approach by segmenting workflows: one pipeline for untrusted PR validation (no secrets, no write access) and another for maintainers with elevated privileges.

How teams detect issues like this

Detection revolves around analyzing CI configuration and monitoring unusual CI behavior:

  • Perform static analysis of workflow files (.github/workflows/*.yml) to detect patterns where:
  • PR-triggered jobs use broadly scoped GITHUB_TOKEN or custom secrets
  • Docker builds or scripts are sourced directly from PR branches without restriction
  • During code review, flag workflows that:
  • Combine untrusted PR inputs with high-privilege tokens
  • Run arbitrary build commands or shell steps based on PR-controlled files
  • Use policy enforcement (e.g., GitHub branch protection and organization-wide Action policies) to require:
  • Low-privilege tokens for PR workflows
  • Approval gates for workflows that can push code or publish artifacts
  • Monitor CI logs and audit trails for:
  • Unexpected network exfiltration attempts from build steps
  • Suspicious pushes or force-pushes originating from CI accounts

Sources

SourceLink
github.comgithub.com/gitroomhq/postiz-app/commit/da448012dd87e94944cbe83a38e7fd023269ec46
github.comgithub.com/gitroomhq/postiz-app/security/advisories/GHSA-v975-9h5p-xhm4

Frequently asked

questions

Any GitHub user capable of forking the repository and opening a pull request could attempt exploitation, because the vulnerable workflow automatically executed Docker builds from PR content with elevated privileges.

No elevated collaborator access is required beyond a regular GitHub account; the attacker only needs to submit a PR from a fork, relying on the CI system to run the vulnerable workflow.

The safest pattern is to ensure that untrusted PR workflows run in a highly restricted environment: no sensitive secrets, minimal or read-only tokens, and trusted, pinned build definitions that are not directly modifiable by contributors.

Design CI pipelines with a strict trust model: separate untrusted contributions from privileged operations, enforce least privilege on tokens and secrets, avoid executing contributor-controlled code in jobs with write access, and regularly review workflow definitions with security-focused checks or automated linters.

Find out what's already
exploitable in your codebase.