Описание
act: Unrestricted set-env and add-path command processing enables environment injection
Summary
act unconditionally processes the deprecated ::set-env:: and ::add-path:: workflow commands, which GitHub Actions disabled in October 2020 (CVE-2020-15228, GHSA-mfwh-5m23-j46w) due to environment injection risks. When a workflow step echoes untrusted data to stdout, an attacker can inject these commands to set arbitrary environment variables or modify the PATH for all subsequent steps in the job. This makes act strictly less secure than GitHub Actions for the same workflow file.
Vulnerable Code
pkg/runner/command.go, lines 52-58:
There is no check for the ACTIONS_ALLOW_UNSECURE_COMMANDS environment variable. The string ACTIONS_ALLOW_UNSECURE_COMMANDS does not appear anywhere in the act codebase.
On GitHub Actions, these commands are rejected unless ACTIONS_ALLOW_UNSECURE_COMMANDS=true is set:
PoC: Environment and PATH Injection via PR Title
Tested on: act 0.2.84, Docker Desktop 29.1.2, macOS Darwin 24.5.0
Step 1 — Create a workflow that logs PR metadata:
.github/workflows/vuln.yml:
Step 2 — Create a malicious event payload:
event.json:
Step 3 — Run:
Result:
All three injections succeeded silently:
EVIL_VAR=INJECTED_BY_ATTACKER— arbitrary env var injected into subsequent stepNODE_OPTIONS=--require=/tmp/evil.js— Node.js code execution vector/tmp/evil-binprepended to PATH — command hijacking vector
Attack Scenarios
Scenario 1: Malicious PR title/body. An attacker opens a PR with ::set-env name=NODE_OPTIONS::--require=/tmp/evil.js embedded in the title. If any workflow step echoes the title (common for build summaries, Slack notifications, changelog generation), the injection fires. On GitHub Actions this is blocked. On act, it succeeds.
Scenario 2: Malicious branch name. ${{ github.head_ref }} is attacker-controlled. A branch named fix-typo%0A::set-env name=LD_PRELOAD::/tmp/evil.so can inject LD_PRELOAD, which causes every subsequent dynamically-linked binary to load the attacker's shared library.
Scenario 3: Commit message injection. If a step runs git log --oneline and the output flows to stdout, an attacker's commit message containing ::set-env:: commands will be processed.
Impact
- Command injection via env vars:
LD_PRELOAD,NODE_OPTIONS,PYTHONPATH,BASH_ENV,PERL5OPTall enable arbitrary code execution - PATH hijacking: attacker-controlled directory prepended to PATH hijacks any subsequent command
- Cross-step escalation: a step that merely logs untrusted data compromises all subsequent steps
- Supply chain risk: workflows that are safe on GitHub Actions become exploitable when run locally with act — developers have a false sense of security
Suggested Fix
Add a check matching GitHub Actions' behavior:
This is a minimal, backwards-compatible fix — users who genuinely need these deprecated commands can opt in via ACTIONS_ALLOW_UNSECURE_COMMANDS=true, matching GitHub's approach.
Written by Golan Myers
Пакеты
github.com/nektos/act
<= 0.2.85
0.2.86
Связанные уязвимости
act is a project which allows for local running of github actions. Prior to version 0.2.86, act unconditionally processes the deprecated ::set-env:: and ::add-path:: workflow commands, which was disabled due to environment injection risks. When a workflow step echoes untrusted data to stdout, an attacker can inject these commands to set arbitrary environment variables or modify the PATH for all subsequent steps in the job. This issue has been patched in version 0.2.86.