Skip to content
RCE Advisory Intermediate

GHSL-2021-031: Script injection in a GitHub workflow of hasura/graphql-engine

The GitHub workflow used a pull request title to build an inline script, allowing an attacker to inject arbitrary JavaScript. This could let an attacker modify the base repository and exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The shadow-pr.yml GitHub workflow is vulnerable to script injection.

jarlob, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The workflow inserted the pull request title directly into a JavaScript string without sanitisation, allowing script injection.

Impact

An attacker could modify the base repository and exfiltrate secrets, and the permissions of the bot token do not prevent this because a read-write GITHUB_TOKEN is available in the pull_request_target case.

What the attacker needed

Ability to create a pull request

The fix

The issue was fixed.

How it was found

  1. Create a pull request with a title containing a JavaScript injection payload.
  2. The workflow runs and executes the injected script.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A GitHub workflow is an automated script that runs when something happens, like a new pull request. Here, the workflow took the title of the pull request and put it directly into a script without checking it. An attacker could put special characters in the title to run their own code, which could then change the repository or steal secret tokens.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.