Repository navigation
Description
Overview
A daily VulnHunter scan of the ranked scope (40 files, injection class) found 1 finding that survived falsification. Findings from the other files I read were eliminated (see the end). I did not reach the whole list: I stopped after the high-risk JS and Go entry points to stay inside the run budget.
| # | Component | Type | Severity |
|---|---|---|---|
| 1 | actions/setup/js/artifact_client.cjs → createZipFromFiles |
Argument injection → command execution (CWE-88) | High |
I confirmed this by static trace only. I did not run a PoC. The zip -T -TT <cmd> behaviour is documented publicly (the GTFOBins zip entry).
Finding 1: zip option injection via agent-controlled artifact filenames
Affected code
- Sink:
actions/setup/js/artifact_client.cjs:222-229,createZipFromFiles. - Source path:
actions/setup/js/upload_artifact.cjs,resolveFiles,listFilesRecursive,autoCopyToStaging. The call site isclient.uploadArtifact(artifactName, absoluteFiles, stagingDirectory(), uploadOpts)at about line 726.
Data flow
- The agent controls the file names in the
upload_artifactstaging directory. It can also name a workspace file for auto-copy, which keeps the basename. listFilesRecursivereturnspath.relative(stagingDir, file). A top-level file named-Tcomes out as-T.createZipFromFilescomputespath.relative(rootDirectory, file). Its only check is!rel || rel.startsWith("..") || path.isAbsolute(rel). A leading-is not rejected.- The names go straight into
spawnSync("zip", ["-q", "-r", outputPath, ...relativeFiles]). There is no--separator, so zip parses a name like-Tas an option.
Attacker path and preconditions
-
A prompt-injected or malicious agent, running with the sandbox's no-write token, creates these files at the top level of the staging directory:
-T-TT-TT sh -c <cmd> #(this name sorts right after-TT, so zip takes it as the-TTvalue)- one ordinary file
-
The agent then calls
upload_artifact, withpathpointing at the directory or with the default filters. -
zip treats
-Tas "test the archive" and-TT <cmd>as "use<cmd>as the test command", and runs it. -
The workflow must enable the
upload-artifactsafe output withskip-archiveoff (the default zip path).allowed-pathsandfilters-includedefault to match-all. -
The command runs in the safe-outputs job. That job holds the write-scoped
GITHUB_TOKENand theACTIONS_RUNTIME_TOKENand runs outside the agent sandbox, so this crosses the agent → safe-outputs trust boundary that safe outputs exist to enforce.
Why it is credible after falsification
-
Gate 1 (reachable):
upload_artifact.cjs:726callsuploadArtifacton the production path, andskipArchiveis false by default. -
Gate 2 (attacker-controlled): file names inside the staging directory belong to the agent.
-
Existing defenses do not cover the attack:
isWithinRootandlstatGuardblock traversal and symlinks, not leading dashes.- The
startsWith("..")check increateZipFromFilesdoes not match-. - No other file name validation exists on this path.
-
Gate 3 (new capability): arbitrary command execution in a job with credentials the agent was denied.
Remediation
- Add
--before the file list:["-q", "-r", outputPath, "--", ...relativeFiles]. - Better, prefix every relative path with
./or pass absolute paths. Alternatively, write the list to a file and usezip -@so no name is parsed as an option. - Also reject staged file names that start with
-inresolveFiles. - Check other
spawnSyncandexeccalls that pass user- or agent-derived file lists without--.
Candidates examined and eliminated
| Candidate | Reason eliminated |
|---|---|
pkg/parser/remote_download_file.go: git archive/clone argument injection and path traversal |
ValidateGitRef and ValidateGitPath run first (lines 305-310, 422-430), with -- in the git archive call. readFileFromClone uses ResolvePathWithinBase, which calls EvalSymlinks (pkg/fileutil/fileutil.go:84-106), so a symlink in the clone cannot escape. |
artifact_client.cjs:446: Content-Disposition filename → copyFileSync |
parseFilenameFromContentDisposition applies path.basename (line 176). |
git_helpers.cjs: stageRawGitFiles |
Rejects ., .. and .git segments, absolute paths and symlinked ancestors. It uses O_NOFOLLOW and pinned descriptors (lines 545-590). |
apply_samples.cjs: runGit and the temp patch |
Arguments are passed as an array with no shell. The patch and branch come from author-controlled workflow samples, not from an untrusted source. |
Go exec.Command call sites that I read (trial_helpers.go, git.go, grype.go, poutine.go, graders_run.go, branch_git.go) |
They pass arguments as arrays with no shell, and the values come from the local CLI user or validated inputs. |
I did not review the remaining pkg/workflow/* and pkg/cli/* candidates in the scope list because the run budget was nearly used up.
Next actions
- Patch
createZipFromFilesto add--or a./prefix, and add a regression test with a staged file named-T. - Reject leading-dash filenames at staging time.
- Audit other archive and CLI invocations that take agent-influenced names.
Generated by 🛡️ Daily VulnHunter Scan · claude · routed: sonnet55 high · ~38 AIC · ⌖ ~1 AIC · ⊞ 3.3K · ◷
Activity
github-actions commentedon Nov 15, 2026
🍪 Issue Monster selected this for Copilot
I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.
If assignment succeeds, Copilot will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪