/

CVE-2026-34041

Severity:

CRITICAL RISK

(9.8)

Environment Injection in act GitHub Actions Runner

CVE-2026-34041

Analyzed

Vulnerability type

Category:

Environment Injection

CWE:

CWE-74

Impact:

Command and Environment Manipulation in CI Workflows

Severity:

CRITICAL RISK

(9.8)

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

The local GitHub Actions runner act processes deprecated workflow commands ::set-env:: and ::add-path:: without restriction, allowing environment injection when untrusted data is echoed to stdout.

An attacker who can influence workflow step output may set arbitrary environment variables or alter the PATH for subsequent steps in a job, enabling command hijacking and unintended code execution in CI pipelines.

Affected context

This vulnerability occurs in local or self-managed CI environments that use act to run GitHub Actions workflows and rely on workflow step output that includes untrusted or partially untrusted data.

It becomes risky when workflows:

  • Echo or print user-controlled data directly to stdout,
  • Do not sanitize or encode this output,
  • And run additional steps whose behavior depends on environment variables or PATH ordering.

Exploit preconditions

  • Attack surface: GitHub Actions workflows executed via act on developer machines or CI runners.
  • Required access: Ability to control or influence the content emitted by a workflow step to stdout (e.g., via pull request inputs, repository contents, or task parameters).
  • Trigger point: A workflow step that echoes the crafted ::set-env:: or ::add-path:: sequences as part of its output.
  • Why exploitation is possible: act continues to interpret deprecated command syntax as control directives, so attacker-controlled output is parsed as workflow commands rather than inert data.

Why this happens

The core issue is treating plain text output from workflow steps as trusted command input, without constraining who can emit those commands or whether they contain untrusted data.

act unconditionally honors the deprecated ::set-env:: and ::add-path:: command formats, which GitHub disabled upstream due to environment injection concerns.

This aligns with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because special command markers in stdout are not neutralized before being interpreted by the workflow runner as instructions to modify the execution environment.

Potential impact

  • An attacker could set arbitrary environment variables for subsequent workflow steps.
  • An attacker could prepend malicious directories to the PATH, potentially hijacking commands executed later in the workflow.
  • Workflows may unintentionally run attacker-controlled binaries or scripts instead of trusted system tools.
  • Secrets or tokens accessed by later steps could be exfiltrated via manipulated environment variables.
  • Build outputs or test results may be tampered with, corrupting CI integrity and supply-chain trust.

General mitigation guidance

Effective mitigation focuses on eliminating or strictly controlling interpretation of special command syntax in workflow output and reducing trust in step output:

  • Stop honoring deprecated workflow command formats (::set-env::, ::add-path::), or gate them behind explicit configuration.
  • Treat all step stdout as data by default, and avoid interpreting it as control input unless it comes from trusted components.
  • Where commands must be supported, validate and constrain the allowable environment keys and values, and restrict PATH changes to known-safe locations.
  • Minimize reliance on environment variables for security-sensitive behavior; prefer explicit configuration and scoped tokens.
  • Run workflows with least privilege and avoid granting unnecessary filesystem or network capabilities to steps that process untrusted input.

How teams detect issues like this

Detection can combine workflow review, static policy checks, and runtime monitoring:

  • Use static analysis or policy-as-code tools to scan workflow definitions for steps that echo untrusted inputs directly to stdout.
  • During code review, flag patterns where workflow commands are constructed from user-controlled data or repository content that can be modified by external contributors.
  • Instrument act or wrapper scripts to log and optionally block usage of deprecated command syntaxes, especially when originating from untrusted steps.
  • Apply CI guardrails that distinguish trusted and untrusted workflows or jobs, enforcing stricter rules on those processing external contributions.

Sources

SourceLink
github.comgithub.com/nektos/act/commit/0c739c8e39c41aa5a07665f732da9cab6df0097a
github.comgithub.com/nektos/act/releases/tag/v0.2.86
github.comgithub.com/nektos/act/security/advisories/GHSA-xmgr-9pqc-h5vw

Frequently asked

questions

Yes. If a repository accepts external contributions (for example, via pull requests) and runs them with act, an attacker can remotely influence workflow content or inputs so that untrusted data is echoed and interpreted as commands.

The attacker needs a way to control or significantly influence what a workflow step prints to stdout. This often means the ability to submit or modify workflow inputs, repository files, or scripts that are executed during the workflow.

The safest pattern is to treat step output as data only: disable or remove support for deprecated text-based workflow commands and avoid interpreting stdout as control instructions. Where environment changes are necessary, make them explicit in workflow configuration rather than driven by step output.

Design CI workflows so that control channels are clearly separated from data channels, avoid using textual markers in general stdout for control, and enforce policies that sanitize or encode any untrusted data before it is emitted. Regularly review CI tooling behavior against upstream security guidance and deprecation notices to avoid reintroducing deprecated, unsafe features.

Find out what's already
exploitable in your codebase.