Skip to content
Access control Write-up Advanced

Messing with pull request inputs

GitHub validated the base branch of a pull request only when it was created, not when it was edited, so an attacker could change the base ref to a commit hash from their own fork. Because workflows triggered by pull_request_target run with the base repository's secrets, this let an attacker run a malicious workflow with those secrets and gain write access to the repository.

Teddy Katz Follow

Published on blog.teddykatz.com

Bounty$25,000 View original

I’m a big fan of the “try weird stuff and see what happens” approach to security research. Modern software has a huge number of bugs, and engineering teams often have to prioritize which bugs to fix, based in part on the number of users affected by each bug.

Teddy Katz (@not_aardvark), on blog.teddykatz.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

GitHub pull requests normally compare a set of proposed changes against a base branch (also called a base ref), often the repository's main branch. The author of a pull request chooses that base branch, for example a work-in-progress branch or a less frequently updated release branch. The base ref is supplied as a string through the API, so the researcher asked what happens when it is not a branch name at all.

The report is about a logic flaw in how GitHub validated the base ref of a pull request, and how that flaw interacted with GitHub Actions, GitHub's built-in automation platform. GitHub Actions runs workflows stored in .github/workflows/ in a repository, in response to events in that repository. Maintainers can add secrets through repository settings and inject them into environment variables for a workflow. Secrets are only supposed to be accessible to people with write access to the repository, and they are not copied when a repository is forked. Every repository also has a GITHUB_TOKEN secret by default, a GitHub API token with write access to that repository.

Two events matter here:

  • pull_request simulates a merge of the pull request and runs workflows based on the configuration and code at the merge commit. Because the pull request code is potentially malicious, these workflows run without access to the repository's secrets.
  • pull_request_target runs workflows based on the configuration and code at the base branch of the pull request. Since the base branch is part of the base repository and not part of a fork, these workflows are trusted and run with access to secrets. This is intended for tasks such as adding comments and labels to new pull requests, which needs an API token.

Setup

The researcher used a test repository and GitHub's GraphQL API, specifically the createPullRequest mutation. No special role on the victim repository is described: the precondition is that the attacker can fork a public repository and that the repository has used GitHub Actions in some fashion before the attack. The report notes that if a repository had never used GitHub Actions, the malicious workflow would not trigger, presumably as a result of some optimisation.

Finding it

The starting point was the observation that the base ref is user input supplied as a string. The researcher tried to create a pull request whose base ref was a commit hash rather than a branch name:

Text
mutation {
  createPullRequest(input: {
    repositoryId: "..."
    title: "Update README.md"
    headRefName: "not-an-aardvark:patch-1"

    # ??? this is a commit hash, not a ref
    baseRefName: "[redacted]"
  }) {
    __typename
  }
}

GitHub rejected this with an error:

JSON
{
  "errors": [{ "message": "Base ref must be a branch" }]
}

That looked reasonable. But the researcher had just found another issue where GitHub applied stricter validation when creating a pull request than when editing one. On that hunch, the researcher created a pull request with a valid base branch and then edited the base branch name to a commit hash afterwards. This worked, producing a pull request whose base branch is a commit.

A pull request whose base branch is a commit does not make sense as a concept. In git terminology branches and commits are different types of things and are not interchangeable. A pull request is normally merged by updating the base branch to point to a new commit that includes the changes. Commits identified by a particular hash are immutable, so other commits cannot simply be merged into them. The software did it anyway.

A screenshot of a GitHub pull request. The title is "Update README.md". The pull request is in an "open" state, and at the top it says, "not-an-aardvark wants to merge 1 commit into an-organization:fd9cfdc590e789ae559b5a7878e7e6b929a249d9 from not-an-aardvark:patch-1". The screenshot is annotated wi
A screenshot of a GitHub pull request. The title is "Update README.md". The pull request is in an "open" state, and at the top it says, "not-an-aardvark wants to merge 1 commit into an-organization:fd9cfdc590e789ae559b5a7878e7e6b929a249d9 from not-an-aardvark:patch-1". The screenshot is annotated wi From the original on blog.teddykatz.com

The screenshot shows the resulting pull request: the title is "Update README.md", the state is open, and the header says "not-an-aardvark wants to merge 1 commit into an-organization:[redacted] from not-an-aardvark:patch-1". The only odd thing in the UI is that it reports merge conflicts. There were no merge conflicts by the usual definition; the researcher suspects something on the backend tried to simulate a merge, failed because merging made no sense, and the UI assumed the failure was due to merge conflicts.

The researcher also tried a commit shorthash instead of a full 40-character hash, with similar results in the UI. After pushing another commit with the same shorthash, the link to the base branch in the UI started returning a 404 because it linked to an ambiguous shorthash, but everything else kept working.

At this point the behaviour was self-inflicted and did not look security-relevant: even on someone else's repository, the owner could simply close the pull request.

Exploitation

The side effect that made the bug serious was in the GitHub Actions permission model. The trust argument for pull_request_target is that only people with write access to the base repository can push to branches in it, so the base branch is trusted. That argument holds only if the base branch is actually a branch. With a base ref that is a commit hash, anyone can create a new commit hash in the base repository, because GitHub shares commits between forks.

Step 1: fork a public repository that uses GitHub Actions

The attacker needs to be able to create a fork of the repository. The victim repository must have used GitHub Actions in some fashion before the attack.

Step 2: create a pull request to the repository

A harmless change such as updating the readme is enough. The pull request is created with a valid base branch.

Step 3: commit a malicious workflow to the fork

The attacker creates a malicious Actions workflow using the pull_request_target event and commits it to the fork. The report links to an example gist but does not reproduce the workflow contents in the text.

Step 4: change the base ref to the commit hash

The attacker updates the base branch of the pull request from step 2 to the commit hash from step 3. The malicious workflow then runs immediately, with the secrets from the victim repository.

At that point the attacker has write access to the repository through the GITHUB_TOKEN secret, and access to any services the repository had integrated with via GitHub Actions secrets.

Root cause

The flaw is a validation asymmetry: the base ref was validated when a pull request was created but not when it was edited, so an existing pull request could be given a base ref that is a commit hash or another symbolic ref rather than a branch. The researcher's guess about why this pattern existed is that when validity checks were added it was more convenient to apply them only to new pull requests rather than migrating existing ones, and validating only on creation was meant to achieve that. The downside is that all new code still has to account for the invalid case because old data exists, which can undermine the benefit of the validation.

The existing defence was the trust assumption behind pull_request_target: workflows run from the base branch, and only writers can push to branches in the base repository. That assumption silently depended on the base ref being a branch. Once the base ref could be a commit hash, and commits are shared between forks, the attacker could supply the code that the trusted event would run. The report suggests preventing the base ref from being set to a non-branch at all, in addition to detecting bad base refs from Actions after the fact.

Impact

An attacker could run a workflow of their choosing with the victim repository's secrets, gaining write access to the repository through GITHUB_TOKEN and access to any services integrated through Actions secrets. Many open-source projects publish directly to package managers from GitHub using a credential saved as an Actions secret, so the researcher states it likely would have been possible to carry out a much larger-scale version of the eslint-scope supply chain attack by exploiting this on many open-source projects at once, stealing their package manager credentials and publishing package updates containing malware.

The researcher explicitly states having no reason to believe the issue was exploited in the wild. The attack would be publicly visible in a pull request's event history as a base-branch change, although it could be mistaken for a benign action if the maintainer was not paying close attention.

Fix

GitHub partially patched the issue on github.com on 2021-02-04. After that, an Actions build no longer triggered for a pull request if the base ref was a 40-character commit hash. The researcher found that a build still triggered if the base ref was a shorthash, or another symbolic ref in the base repo that the attacker can modify, such as refs/pull/5/head, which always points to the head branch of an existing pull request, so the issue was still exploitable.

The researcher suggested preventing the base ref of a pull request from being set to a non-branch at all, in addition to detecting bad base refs from Actions after the fact. The issue was then fully patched on github.com, apparently implementing that suggestion; the report notes the fix might already have been in progress as a secondary mitigation. GitHub Enterprise Server 3.0.1 was released on 2021-03-02 with a fix, as CVE-2021-22862. GitHub awarded a $25000 bug bounty on 2021-03-03.

Variants to test

  1. Create-then-edit validation gaps. Create an object with a valid value, then edit the same field to an invalid type or format. A positive result is that the edit is accepted where creation was rejected.
  2. Non-branch refs in trusted CI events. On repositories using pull_request_target or similar trusted triggers, try setting the base ref to a commit hash, a shorthash, or a symbolic ref such as refs/pull/N/head. A positive result is that a workflow from attacker-controlled code runs with secrets.
  3. Shorthash ambiguity. Push a commit whose shorthash collides with an existing one and observe whether links or lookups break while other behaviour continues. A positive result is inconsistent resolution of the same ref.
  4. Trust assumptions that depend on write access. For any feature that treats a ref as trusted because only writers can push to it, check whether the ref can be made to point at fork-shared objects. A positive result is trusted code execution from a fork.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A security researcher found a way to make GitHub run code from an attacker's fork with the victim repository's secrets. The trick was to give a pull request a "base branch" that was not a branch at all, but a commit hash. GitHub's validation allowed this when editing an existing pull request, even though it blocked it when creating one. Because GitHub shares commits between forks, an attacker could put malicious automation code in their fork, point the pull request's base at that commit, and have GitHub Actions run it with access to the repository's secrets. That gave the attacker write access to the repository and to any services the repository used through GitHub Actions secrets. GitHub fixed the issue and awarded a $25,000 bounty.

This article explains the whole story from scratch, for someone who has never done security research. It covers what pull requests, branches, commits, APIs, tokens, secrets and GitHub Actions are, then walks through each step the researcher took, with the exact requests and responses from the original report.

Background: the pieces involved

GitHub and pull requests

GitHub is a website where people store and collaborate on software code. The code lives in a repository (often shortened to "repo"): a project folder with a history of every change ever made to it.

A pull request is a proposal to change a repository. You say "here are my changes, please consider adding them". Other people can review the proposal, comment on it, and eventually accept it (merge it) or reject it (close it).

Every pull request compares two things:

  • The base branch: the branch you want your changes to go into. Often this is the repository's main branch, the main line of development.
  • The head branch: the branch that contains your proposed changes. This can be a branch in the same repository or, for contributions from outside, a branch in your own copy (a fork) of the repository.

A branch is a named line of development. Think of it as a label that points to a particular version of the code and moves forward as new changes are added. A commit is a single saved snapshot of the code, identified by a long string of letters and numbers called a hash (for example, [redacted]). A branch points to a commit, and as you add commits the branch label moves to the newest one.

Branches and commits are different kinds of things. A branch is a movable label; a commit is a fixed snapshot. You can move a branch to a new commit, but you cannot "move" a commit: its hash is derived from its contents, so changing it would change the hash. This distinction matters later.

The GitHub API

An API (Application Programming Interface) is a way for one program to talk to another. A website's API lets you perform actions (create a pull request, edit a setting) by sending structured requests, instead of clicking buttons in a browser. GitHub offers a GraphQL API, where you send a query describing what you want to do or read, and the server responds with data in JSON format.

A GraphQL request for an action is called a mutation. The researcher used a mutation called createPullRequest to try creating a pull request programmatically. This matters because the API accepts values as text strings, and the researcher could put anything into those strings, including values the web interface might not offer.

Tokens and secrets

A token is a long random string that acts like a password for a program. When a program sends a request to an API, it includes a token to prove who it is. If someone steals a token, they can act as the token's owner until the token is revoked.

A secret in GitHub Actions is a sensitive value (such as a password or API key) that a repository maintainer stores in the repository settings. Workflows can use secrets without printing them, and GitHub tries to keep them away from untrusted code. Secrets are not copied when someone forks a repository, so a fork does not automatically get the original repository's secrets.

Every repository also has a built-in secret called GITHUB_TOKEN. It is a GitHub API token that can write to that repository. If an attacker obtains it, they can modify the repository through the API.

GitHub Actions

GitHub Actions is GitHub's built-in automation service. It runs small programs, called workflows, in response to events on GitHub. For example, a workflow might run a project's tests every time someone proposes a change, or post a comment on a new pull request.

Workflows are stored in a folder called .github/workflows/ inside the repository. Each workflow file says which event it listens for and what to do.

Two events are central to this story:

  • pull_request: this event simulates merging the pull request and runs the workflow using the code from the pull request. Because that code comes from a contributor and could be malicious, workflows triggered this way run without access to the repository's secrets. This is the safe option for running tests on outside contributions.
  • pull_request_target: this event runs the workflow using the code and configuration from the base branch of the pull request, not from the contributor's fork. The reasoning is that the base branch belongs to the repository itself, and only people with write access can change it. So workflows triggered this way are trusted and run with access to secrets. This is meant for tasks like labelling or commenting on new pull requests, which need an API token.

The trust in pull_request_target rests on one assumption: that the base branch really is a branch in the base repository, which only trusted people can modify. The researcher found a way to break that assumption.

Messing with pull request inputs

The researcher's approach was to try unusual inputs and see what happens. The base branch of a pull request is chosen by the person creating the pull request, and it is sent to GitHub as a text string. Normally you would send a branch name such as main. But since it is just a string, what if you send something else, like a commit hash?

The researcher tried creating a pull request through the GraphQL API with the base ref set to a commit hash:

Text
mutation {
  createPullRequest(input: {
    repositoryId: "..."
    title: "Update README.md"
    headRefName: "not-an-aardvark:patch-1"

    # ??? this is a commit hash, not a ref
    baseRefName: "[redacted]"
  }) {
    __typename
  }
}

Line by line:

  • mutation { starts a GraphQL request that will change something (as opposed to just reading data).
  • createPullRequest(input: { calls the operation that creates a pull request, and opens a block of input values.
  • repositoryId: "..." identifies which repository the pull request belongs to. The actual ID is omitted here.
  • title: "Update README.md" sets the title of the pull request.
  • headRefName: "not-an-aardvark:patch-1" says where the proposed changes come from: a branch called patch-1 in a fork owned by not-an-aardvark.
  • The comment line # ??? this is a commit hash, not a ref is the researcher's note that the next value is not a branch name.
  • baseRefName: "[redacted]" sets the base to a commit hash instead of a branch name. This is the unusual input being tested.
  • }) { closes the input block and opens a block describing what to return.
  • __typename asks GitHub to return the type name of the result, a minimal way to confirm the operation succeeded.
  • } closes the request.

GitHub rejected the request with an error:

JSON
{
  "errors": [{ "message": "Base ref must be a branch" }]
}

This JSON response has an errors list containing one object with a message field. The message says the base ref must be a branch. That seems like sensible validation: GitHub is refusing to create a pull request whose base is not a branch.

The hunch: create versus edit

The researcher had recently found another issue where GitHub applied stricter checks when creating a pull request than when editing one. That suggested a pattern: validation might only run at creation time. So the researcher tried a two-step approach:

  1. Create a pull request with a valid base branch.
  2. Edit the pull request afterwards to change the base branch to a commit hash.

This worked. The edit was accepted, and the pull request ended up with a commit hash as its base.

Why does this matter? Because it shows a gap between two code paths that should enforce the same rule. The create path checked the input; the edit path did not. The researcher's later guess (in a footnote) was that when validation was added, it was easier to apply it only to new pull requests than to migrate existing ones, and that validating only on creation was meant to achieve that. The downside is that all other code still has to cope with invalid data left over from before, which weakens the benefit of the validation.

Nonsensical pull requests

A pull request whose base is a commit does not make sense. In git, a branch is a movable pointer and a commit is a fixed snapshot. Normally, merging a pull request means moving the base branch forward to a new commit that includes the proposed changes. But you cannot move a commit: its identity is its hash, and changing its contents would change the hash. So "merging into a commit" has no clear meaning.

GitHub's software did it anyway. The screenshot shows the result:

A screenshot of a GitHub pull request. The title is "Update README.md". The pull request is in an "open" state, and at the top it says, "not-an-aardvark wants to merge 1 commit into an-organization:fd9cfdc590e789ae559b5a7878e7e6b929a249d9 from not-an-aardvark:patch-1". The screenshot is annotated wi
A screenshot of a GitHub pull request. The title is "Update README.md". The pull request is in an "open" state, and at the top it says, "not-an-aardvark wants to merge 1 commit into an-organization:fd9cfdc590e789ae559b5a7878e7e6b929a249d9 from not-an-aardvark:patch-1". The screenshot is annotated wi From the original on blog.teddykatz.com

The image shows a GitHub pull request page. The title is "Update README.md", the state is open, and the header reads "not-an-aardvark wants to merge 1 commit into an-organization:[redacted] from not-an-aardvark:patch-1". In other words, the destination (base) is shown as a commit hash rather than a branch name. The only odd thing in the interface is that it reports merge conflicts. According to the researcher, there were no real merge conflicts; the likely explanation is that some backend process tried to simulate a merge, failed because merging into a commit makes no sense, and the interface assumed the failure meant conflicts.

The researcher also tried a shorthash: the first few characters of a commit hash, which git can often use as an abbreviation. The interface behaved similarly. Then the researcher pushed another commit whose shorthash was the same as the existing one. After that, the link to the base branch in the interface started returning a 404 (not found), because the short hash was now ambiguous, but everything else kept working.

At this point, the behaviour was self-inflicted and did not look security-relevant. Even if you created such a pull request on someone else's repository, the owner could simply close it. The researcher spent a bit of time trying to figure out whether the bug was actually useful for anything.

GitHub Actions crash course

To understand why the bug mattered, you need to understand GitHub Actions and its permission model.

GitHub Actions is a hosted automation service. It lets a project run code in a sandbox in response to events on GitHub. Common uses include running tests when someone pushes a commit, deploying changes to a server, and adding labels to new issues.

The permission model, in summary:

  • Workflows live in .github/workflows/ in a repository. Each workflow listens for specific events and runs code in response.
  • Maintainers can store secrets in the repository settings and have workflows read them through environment variables. Secrets are meant to be available only to people with write access to the repository, and they are not copied when the repository is forked.
  • Every repository has a default secret called GITHUB_TOKEN, an API token with write access to that repository.

How GitHub Actions handles pull requests

Pull requests from forks are special. It is useful to run automation on them (for example, running tests so a contributor can see whether their change breaks anything), but the contributor's code could be malicious. If a workflow ran that code with secrets, the contributor could simply print the secrets and steal them.

GitHub solves this with two events:

  • pull_request: runs workflows based on the code at the simulated merge of the pull request. Because that code may be malicious, these workflows run without secrets. This is for running tests and checking whether the change would work.
  • pull_request_target: runs workflows based on the code and configuration at the base branch. Because the base branch is part of the base repository and not part of a fork, these workflows are trusted and run with secrets. This is for tasks like commenting and labelling, which need an API token.

The trust in pull_request_target depends on the base branch being a real branch that only writers can change. The researcher's bug broke that dependency.

Nonsensical pull requests vs. GitHub Actions

The key sentence from the previous section is this: workflows triggered by pull_request_target are trusted and run with access to secrets, because the base branch is part of the base repository and not part of a fork. Only people with write access can push to branches in the base repository, so this seems safe, provided the base branch is actually a branch.

But the researcher had created pull requests whose base was a commit hash, not a branch. And anyone can create a commit hash in the base repository, because GitHub shares commits between forks. When you fork a repository and add a commit, that commit becomes part of the shared history and can be referenced from the original repository too.

So an attacker could:

  1. Fork any public repository that uses GitHub Actions.
  2. Create a pull request to the repository, for example updating the readme.
  3. Create a malicious Actions workflow that uses the pull_request_target event, and commit it to the fork. The report links to an example gist but does not reproduce the workflow contents in the text.
  4. Change the base branch of the pull request from step 2 to the commit hash from step 3.

The malicious workflow would then run immediately, with the victim repository's secrets. The attacker would gain write access to the repository through GITHUB_TOKEN, and access to any services the repository had integrated through GitHub Actions secrets.

Why is this serious? Many open-source projects publish packages directly to package managers from GitHub, using a credential stored as a GitHub Actions secret. If an attacker could steal those credentials from many projects at once, they could publish malicious package updates. The researcher notes this would likely have allowed a much larger-scale version of the eslint-scope supply chain attack, in which malicious package versions were published. A supply chain attack is one that compromises the tools or dependencies that others rely on, so that the compromise spreads to their users.

The researcher explicitly states having no reason to believe the issue was exploited in the wild. The attack would be visible in a pull request's event history as a base-branch change, though a maintainer not paying close attention might mistake it for a benign action.

Timeline

  • 2021-02-04 08:37:44 UTC: the researcher reported the issue to GitHub's bug bounty program via HackerOne.
  • 2021-02-04 14:34:56 UTC: GitHub replied, saying they were looking into it.
  • 2021-02-04 16:30:36 UTC: GitHub's security team confirmed the issue.
  • 2021-02-04 22:14:32 UTC: GitHub partially patched the issue on github.com and asked the researcher to confirm the fix. After this patch, an Actions build no longer triggered for a pull request whose base ref was a full 40-character commit hash. But the researcher found that a build still triggered if the base ref was a shorthash, or another symbolic ref in the base repository that an attacker can modify, such as refs/pull/5/head, which always points to the head branch of an existing pull request. So the issue was still exploitable.
  • 2021-02-04 22:36:05 UTC: the researcher replied to GitHub explaining the above and suggested preventing the base ref of a pull request from being set to a non-branch at all, in addition to detecting bad base refs from Actions after the fact.
  • A few hours later: the issue was fully patched on github.com, apparently implementing the researcher's suggestion. The report notes the fix might already have been in progress as a secondary mitigation.
  • 2021-03-02, around 20:45 UTC: GitHub Enterprise Server 3.0.1 was released with a fix, tracked as CVE-2021-22862. GitHub Enterprise Server is the self-hosted version of GitHub that organisations run on their own servers. A CVE is a public identifier for a known security vulnerability.
  • 2021-03-03 14:45:24 UTC: GitHub awarded a $25,000 bug bounty.

Root cause

The flaw is a validation asymmetry: the base ref was checked when a pull request was created but not when it was edited. So an existing pull request could be given a base ref that was a commit hash or another symbolic ref rather than a branch.

The existing defence was the trust assumption behind pull_request_target: workflows run from the base branch, and only writers can push to branches in the base repository. That assumption silently depended on the base ref being a branch. Once the base ref could be a commit hash, and commits are shared between forks, an attacker could supply the code that the trusted event would run. The report suggests preventing the base ref from being set to a non-branch at all, in addition to detecting bad base refs from Actions after the fact.

Impact

An attacker could run a workflow of their choosing with the victim repository's secrets. That gave write access to the repository through GITHUB_TOKEN, and access to any services integrated through Actions secrets. Because many open-source projects publish to package managers using credentials stored as Actions secrets, the researcher states it likely would have been possible to carry out a much larger-scale version of the eslint-scope supply chain attack by exploiting this on many open-source projects at once, stealing their package manager credentials and publishing package updates containing malware.

The attack would be publicly visible in a pull request's event history as a base-branch change, although it could be mistaken for a benign action if the maintainer was not paying close attention.

Fix

GitHub partially patched the issue on github.com on 2021-02-04. After that, an Actions build no longer triggered for a pull request if the base ref was a 40-character commit hash. The researcher found that a build still triggered if the base ref was a shorthash, or another symbolic ref in the base repository that the attacker can modify, such as refs/pull/5/head, which always points to the head branch of an existing pull request. So the issue was still exploitable.

The researcher suggested preventing the base ref of a pull request from being set to a non-branch at all, in addition to detecting bad base refs from Actions after the fact. The issue was then fully patched on github.com, apparently implementing that suggestion; the report notes the fix might already have been in progress as a secondary mitigation. GitHub Enterprise Server 3.0.1 was released on 2021-03-02 with a fix, as CVE-2021-22862. GitHub awarded a $25,000 bug bounty on 2021-03-03.

Variants to test

These are general lessons for testing similar systems, derived from the report.

  1. Create-then-edit validation gaps. Create an object with a valid value, then edit the same field to an invalid type or format. A positive result is that the edit is accepted where creation was rejected.
  2. Non-branch refs in trusted CI events. On repositories using pull_request_target or similar trusted triggers, try setting the base ref to a commit hash, a shorthash, or a symbolic ref such as refs/pull/N/head. A positive result is that a workflow from attacker-controlled code runs with secrets.
  3. Shorthash ambiguity. Push a commit whose shorthash collides with an existing one and observe whether links or lookups break while other behaviour continues. A positive result is inconsistent resolution of the same ref.
  4. Trust assumptions that depend on write access. For any feature that treats a ref as trusted because only writers can push to it, check whether the ref can be made to point at fork-shared objects. A positive result is trusted code execution from a fork.

Glossary

  • API: a way for programs to talk to each other, usually by sending structured requests and receiving structured responses.
  • Base branch (base ref): the branch a pull request proposes to merge into.
  • Branch: a named, movable pointer to a commit in a repository's history.
  • Bug bounty: a program that pays researchers for reporting security vulnerabilities.
  • Commit: a saved snapshot of a repository's code, identified by a hash.
  • Commit hash: the long string of letters and numbers that uniquely identifies a commit.
  • CVE: a public identifier for a known security vulnerability.
  • Fork: a personal copy of someone else's repository, usually on the same hosting service.
  • GitHub Actions: GitHub's built-in automation service that runs workflows in response to events.
  • GitHub Enterprise Server: the self-hosted version of GitHub that organisations run on their own infrastructure.
  • GraphQL: a query language for APIs where the client describes the data or action it wants.
  • GITHUB_TOKEN: a default secret in every repository, an API token with write access to that repository.
  • Head branch: the branch containing the proposed changes in a pull request.
  • JSON: a text format for structured data, commonly used in API requests and responses.
  • Merge: combining the changes from one branch into another.
  • Mutation: in GraphQL, a request that changes data rather than only reading it.
  • Pull request: a proposal to merge changes from one branch into another, with review and discussion.
  • pull_request event: a GitHub Actions trigger that runs workflows using the pull request's code, without secrets.
  • pull_request_target event: a GitHub Actions trigger that runs workflows using the base branch's code, with secrets.
  • Repository: a project folder on GitHub with its full change history.
  • Secret: a sensitive value stored in repository settings for use by workflows, not copied to forks.
  • Shorthash: an abbreviated commit hash, which can be ambiguous if two commits share the same prefix.
  • Supply chain attack: an attack that compromises tools or dependencies so that the compromise spreads to their users.
  • Symbolic ref: a reference that points to another reference rather than directly to a commit, such as refs/pull/5/head.
  • Token: a random string used like a password by a program to authenticate to an API.
  • Workflow: a GitHub Actions configuration file that says which event to listen for and what code to run.
  • 404: the HTTP status code meaning "not found".

More by Teddy Katz

View all

5 more disclosed reports, best first.

More from GitHub

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.