Skip to content

[vulnhunter] VulnHunter findings in github/gh-aw #78012

Done

Description

@github-actions

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 is client.uploadArtifact(artifactName, absoluteFiles, stagingDirectory(), uploadOpts) at about line 726.

Data flow

  1. The agent controls the file names in the upload_artifact staging directory. It can also name a workspace file for auto-copy, which keeps the basename.
  2. listFilesRecursive returns path.relative(stagingDir, file). A top-level file named -T comes out as -T.
  3. createZipFromFiles computes path.relative(rootDirectory, file). Its only check is !rel || rel.startsWith("..") || path.isAbsolute(rel). A leading - is not rejected.
  4. The names go straight into spawnSync("zip", ["-q", "-r", outputPath, ...relativeFiles]). There is no -- separator, so zip parses a name like -T as 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 -TT value)
    • one ordinary file
  • The agent then calls upload_artifact, with path pointing at the directory or with the default filters.

  • zip treats -T as "test the archive" and -TT <cmd> as "use <cmd> as the test command", and runs it.

  • The workflow must enable the upload-artifact safe output with skip-archive off (the default zip path). allowed-paths and filters-include default to match-all.

  • The command runs in the safe-outputs job. That job holds the write-scoped GITHUB_TOKEN and the ACTIONS_RUNTIME_TOKEN and 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:726 calls uploadArtifact on the production path, and skipArchive is false by default.

  • Gate 2 (attacker-controlled): file names inside the staging directory belong to the agent.

  • Existing defenses do not cover the attack:

    • isWithinRoot and lstatGuard block traversal and symlinks, not leading dashes.
    • The startsWith("..") check in createZipFromFiles does 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 use zip -@ so no name is parsed as an option.
  • Also reject staged file names that start with - in resolveFiles.
  • Check other spawnSync and exec calls 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

  1. Patch createZipFromFiles to add -- or a ./ prefix, and add a regression test with a staged file named -T.
  2. Reject leading-dash filenames at staging time.
  3. 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

  1. added
    cookie
    on Nov 15, 2026
  2. github-actions commented on Nov 15, 2026

    @github-actions
    ContributorAuthor

    🍪 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! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt50 · ~1 AIC · ⌖ ~1 AIC · ⊞ 9.4K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

cookiesecurityvulnhunter

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions