Category: ScannerGoMITv0.1.1
pwnreq
Finds GitHub Actions workflows where someone without write access can run code that sees repository secrets: pwn requests and script injection. It can scan one repository or an organization without cloning.
go install github.com/ucsurf/pwnreq/cmd/pwnreq@latestWhat it does
pwnreq reports workflows where someone without write access can run code with the repository’s secrets. The README limits it to two rules, and says every finding is something an outsider could trigger.
PWN001 is high. A pull_request_target, workflow_run or issue_comment workflow checks out the pull request head (head.sha, head.ref, refs/pull/N/..., workflow_run.head_sha and similar) and then runs another step that can execute that code (run:, a local action or a build action).
PWN002 is high. An attacker-controlled expression (a pull request or issue title or body, a comment, a branch name, a commit message and similar) is interpolated with ${{ }} into run: or actions/github-script on pull_request_target, workflow_run, issue_comment, issues or discussion*.
A finding drops to medium when the job or step is gated, for example by author_association, an actor or label check, a same-repo check, or a deployment environment that can require approval. It is skipped when the job, step or ref is limited to an unprivileged event (github.event_name == 'pull_request') or a workflow_run is limited to upstream push runs.
The README’s fix for PWN002 is to put the value in env: and use the shell variable. Its fix for PWN001 is to build untrusted code on pull_request, which has no secrets, and to post results from a separate workflow_run job that only reads artifacts.
Targets in the README: a local directory (.github/workflows), a single workflow file, owner/repo fetched without a clone, and org:NAME for every non-archived repository of an organization or user. Workflow files for remote scans come from raw.githubusercontent.com. The README says a scan costs about one API call per repository.
The README says the rules were tuned against about 2,000 workflows from about 350 public repositories that use pull_request_target, workflow_run or issue_comment. A finding means an outsider can probably reach that step. Confirm it before you report it. disclose finds a private channel.
Limits
Analysis is per workflow file. Reusable workflows (uses: ./.github/workflows/x.yml) and composite actions are not followed. if: conditions are only understood for common shapes. The tool does not judge what the checked-out code does. It treats a build, install or test step on pull request code as code execution. The default timeout for remote scans is 5 minutes.
Usage
Scan the workflows in the current directory
Exit codes in the README: 0 clean, 1 findings, 2 error.
pwnreqScan a GitHub repository without cloning
pwnreq owner/repoScan an organization or user
The README says a token is optional for a few repositories and needed for an organization scan. Archived repositories and forks are skipped unless you pass -forks.
export GITHUB_TOKEN=$(gh auth token)pwnreq org:my-companyJSON, high severity only
Formats are text (the default), json and sarif. -min-severity is medium (the default) or high.
pwnreq -format json -min-severity high org:my-companyGitHub Action
Inputs in the README: path (default .), min-severity (medium or high), sarif and version.
name: pwnreq on: [push, pull_request] permissions: contents: read security-events: write # only needed for the SARIF upload jobs: pwnreq: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: ucsurf/pwnreq@v0.1.1 with: sarif: pwnreq.sarif - if: always() uses: github/codeql-action/upload-sarif@v3 with: sarif_file: pwnreq.sarifpre-commit
repos: - repo: https://github.com/ucsurf/pwnreq rev: v0.1.1 hooks: - id: pwnreq
More tools
- lockreview
Reviews GitHub Actions lockfile (actions.lock) diffs and flags repository identity changes, impostor commits, ref rollbacks, new transitive actions, and runs/dist changes.
ucsurf/lockreview - hookjack
Static scanner for commands that AI assistants and IDEs run on their own when you open a repository.
ucsurf/hookjack - disclose
Finds where to report a vulnerability.
ucsurf/disclose - repojack
Finds dependencies that point at a deleted or renamed GitHub account, so someone else could register the name and serve that code.
ucsurf/repojack - vuln-patterns
Semgrep rules taken from vulnerabilities that are already public.
ucsurf/vuln-patterns