Skip to content
Race condition Write-up Advanced

Persistent Threat: New Exploit Puts Thousands of GitHub Repositories and Millions of Users at Risk

A race condition between creating a repository and renaming a username allowed an attacker to bypass GitHub's popular repository namespace retirement protection. This could enable hijacking of popular repositories and packages, potentially affecting millions of users.

Elad Rapoport Follow

Published on checkmarx.com

A new vulnerability has been discovered that could allow an attacker to exploit a race condition within GitHub’s repository creation and username renaming operations. This technique could be used to perform a Repojacking attack (hijacking popular repositories to distribute malicious code).

Elad Rapoport (@eladrapoport), Yehuda Gelb, on checkmarx.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

Impact

Successful exploitation could allow hijacking of over 4,000 code packages and popular GitHub actions, potentially leading to supply chain attacks affecting millions of users; GitHub has fixed the bypass.

What the attacker needed

Victim renames username; attacker owns a username; API access to GitHub

The fix

GitHub fixed the bypass after responsible disclosure.

How it was found

  1. The victim owns a namespace and renames their username, which retires the old namespace.
  2. The attacker prepares a command that almost simultaneously creates a repository and renames their username to the victim's old username.
  3. The attacker uses an API request for repository creation and intercepts the username change request.

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 you rename your account, and your old username becomes free for anyone to take. To stop someone from grabbing an old username and recreating a popular repository under it, GitHub 'retires' that name so it cannot be reused. This report found a timing trick that let an attacker get around that block.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from GitHub

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.