GitHub Actions Workflow Scanner: Pwn-Request Detection
Learn how JFrog Advanced Security detects Pwn-Request risks in GitHub Actions workflows.
This scanner, available as part of JFrog Advanced Security, detects the Pwn-Request vulnerability in GitHub Actions workflows.
What Is a Pwn-Request?
A GitHub workflow that runs on pull_request_target and checks out the pull request code may be vulnerable to GitHub Actions code injection. An attacker can open a pull request from a forked repository and include malicious code that executes within the workflow's context. Depending on the workflow's permissions and environment, the attacker's code may perform unauthorized or harmful actions.
What Is the Risk?
An attacker may exploit the workflow to access sensitive data available in the workflow's environment, such as API keys or other secrets. Additionally, if the workflow has write permissions to the repository, the attacker may be able to modify the project by pushing malicious code.
What Are the Conditions for a Vulnerable Workflow?
This attack pattern requires two conditions to be present simultaneously in a workflow definition:
- The workflow uses the
pull_request_targettrigger, which runs with the target repository's privileges. - The workflow checks out the pull request head code, which is untrusted attacker-controlled code, and runs it in that privileged context.
How Does the Scanner Work?
The scanner performs static analysis on GitHub Actions workflow YAML files. It flags a vulnerable configuration only when all of the following conditions are true:
- The workflow YAML has a
pull_request_targettrigger. - A step using
actions/checkoutsets itsrefto the pull request head, such asgithub.event.pull_request.head.sha,github.head_ref, orrefs/pull/.../merge. Untrusted code from the pull request fork would get checked out at runtime. - No known mitigation is in place. Any one of these marks the workflow as safe:
- Fork restriction: The workflow definition contains a condition that would prevent execution when the pull request originates from a fork, either at the workflow level or on every job. This makes the checkout safe, because an attacker can't submit code from a fork.
- Trusted actor restriction: The workflow definition contains a condition that would restrict execution to trusted bots, such as Dependabot or Renovate, either at the workflow level or on every job. Such bots are considered safe, so checking out code from their pull requests shouldn't trigger an alert.
How to Use the Scanner?
The scanner analyzes GitHub Actions workflow files that match .github/workflows/*.yml or .github/workflows/*.yaml. You can trigger it in either of the following ways:
- Frogbot V3, version 3.6.0 and later: Run a Frogbot pull request scan or commit scan on a Git repository that contains workflow files under
.github/workflows/. Frogbot reports Pwn-Request findings with the other scan results. For more information, see Scanning Commits and Pull Requests. - Docker image scan: Scan a Docker image that contains a workflow YAML file at
.github/workflows/inside the image.
Here is an example of the scanner's output:

JFrog Xray Scan Results for a Vulnerable GitHub Actions Workflow
Related Topics
Updated about 1 month ago
