Skip to content
Access control Write-up Beginner

Attackers Can Bypass GitHub Required Reviewers to Submit Malicious Code

GitHub's required reviewers setting can be bypassed because a user with reviewer permissions can modify an existing pull request opened by another user, then approve and merge it without additional review. An attacker with a compromised reviewer account could submit malicious code to the main branch while appearing to satisfy code review requirements.

Noam Dotan Follow

Published on legitsecurity.com

Code reviews are an essential security guardrail, but GitHub’s required code reviewers' settings might be giving you a false sense of security – they can easily be bypassed by any collaborator with reviewer permissions.

Noam Dotan, on legitsecurity.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.

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

How it worked

Root cause

Likely GitHub does not track who last modified a pull request when enforcing required approvals, so a reviewer can alter another user's pull request and then approve it as if it were the original author's work.

Impact

An attacker with a compromised reviewer account could merge malicious code into the main branch without an independent review, though the text notes GitHub later added a mitigation to require approval for the most recent pusher.

What the attacker needed

A GitHub account with reviewer permissions; an open pull request by another user; required reviewers enabled on the branch

The fix

GitHub later added a setting to require approval for the most recent pusher, and the text also recommends requiring at least two reviewers or restricting who can push to matching branches.

How it was found

  1. Find an open pull request.
  2. Modify it or replace the entire branch content.
  3. Approve your own modifications.
  4. Bypass required approvals for your modified code.

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 write-up has not been written yet. The Original tab links to the source.

GitHub lets teams require that someone else approves code before it is merged, to catch mistakes or malicious changes. This report shows that a person who is allowed to approve code can also edit someone else's pending change, then approve their own edit, so the required check is effectively skipped. An attacker who takes over such an account could slip harmful code into the main project.

What is Access control?

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.

More by Noam Dotan

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.