Renaming accounts opened the door to hijacking

GitHub patches bug that could allow access to another user's repo

UPDATED A flaw in GitHub’s namespace retirement feature could have allowed attackers to potentially access another user’s repository.

Coined ‘repojacking’ by researchers from Checkmarx, the technique could have enabled malicious actors to bypass protections against the takeover of “retired” GitHub namespaces.

GitHub repositories have a unique URL which is nested under the user account that created it. The linked URL and username together are called a ‘namespace’.

When a user chooses to rename their GitHub account, the platform will redirect their old URLs to the new URL.

However, this feature was found to be vulnerable to “a logical flaw that breaks the original redirect”.


Read more of the latest news about web security vulnerabilities


If a malicious actor created an account using the previous account name of another user, they were able to link the old repository URL to their account, gaining access to code and other content in the process.

In addition, and compounding the problem, the default redirect was disabled, so if an attack was successful then all existing traffic was immediately routed to the attackers malicious GitHub repository.

To protect against this, GitHub initially introduced the “popular repository namespace retirement” feature, meaning that any repository with more than 100 clones at the time its user account is renamed is considered “retired” and the namespace cannot be used by others.

Timeline

In a blog post, Checkmarx researchers explained that they found two bypasses that allowed them to exploit the feature, noting that a successful attack would enable the takeover of popular code packages in several popular package managers including Packagist, Go, Swift, and more.

The team discovered an initial bypass in November 2021 and reported this to GitHub, which “fixed” it In March 2022.

In May 2022, it was still deemed to be exploitable and was again patched later that month.

Then in June, Checkmarx researchers found a second bypass, which was patched in September and disclosed this week (October 26).

The researchers were awarded an undisclosed bug bounty reward for the discovery. Checkmarx warns that thousands of repos could be at risk if any further bypasses were found.

“We have identified over 10,000 packages in those package managers using renamed usernames and are at risk of being vulnerable to this technique in case a new bypass is found,” the researchers said in a blog post.

Checkmarx’s Aviad Gershon, who authored the blog post, told The Daily Swig: “After the second bypass was fixed, our team investigated further and couldn’t find another bypass.

“As mentioned, this isn’t to say that another one can not be found. GitHub allows developers great flexibility with a variety of features, this sometimes comes with the possibility of security vulnerabilities, but it doesn’t mean that this protection measure is vulnerable by design.”

Gershon added: “The disclosure process was smooth and straightforward and was done through the HackerOne platform without any unusual steps. We filled out the standard form and eventually got the final reply.”

This article has been updated to include further comment.


RECOMMENDED Login spoofing issue in GitHub nets researcher $10k bug bounty reward