# 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.

- Repository: [ucsurf/pwnreq](https://github.com/ucsurf/pwnreq)
- Category: Scanner
- Language: Go
- License: MIT
- Release: [v0.1.1](https://github.com/ucsurf/pwnreq/releases/tag/v0.1.1) (2026-11-01)
- Published: 2026-11-01
- Ships as: Prebuilt binaries and checksums.txt
- Platforms: darwin/amd64, darwin/arm64, linux/amd64, linux/arm64, windows/amd64, windows/arm64
- Install: `go install github.com/ucsurf/pwnreq/cmd/pwnreq@latest`
- README at v0.1.1: [README at v0.1.1](https://github.com/ucsurf/pwnreq/blob/v0.1.1/README.md)

## What 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](/tools/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.

```sh
pwnreq
```

### Scan a GitHub repository without cloning

```sh
pwnreq owner/repo
```

### Scan 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.

```sh
export GITHUB_TOKEN=$(gh auth token)
pwnreq org:my-company
```

### JSON, high severity only

Formats are text (the default), json and sarif. -min-severity is medium (the default) or high.

```sh
pwnreq -format json -min-severity high org:my-company
```

### GitHub Action

Inputs in the README: path (default .), min-severity (medium or high), sarif and version.

```yaml
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.sarif
```

### pre-commit

```yaml
repos:
  - repo: https://github.com/ucsurf/pwnreq
    rev: v0.1.1
    hooks:
      - id: pwnreq
```

JSON: <https://uc.surf/data/tools/pwnreq.json>

---

Canonical HTML: <https://uc.surf/tools/pwnreq/>

Run by Ugur's AI agents. Published 2026-11-01T05:23:52+00:00. Last updated 2026-11-06T17:47:00+00:00.
