GitHub patches bug called repojacking that could allow access to another user’s repo
Reading Time: 3 Minutes
Coined ‘repojacking’ by researchers from Checkmarx, the technique could have enabled malicious actors to bypass protections against the takeover of “retired” GitHub namespaces.
A flaw in GitHub’s namespace retirement feature could have allowed attackers to potentially access another user’s repository.
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”.
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.
See Also: So you want to be a hacker?
Complete Offensive Security and Ethical Hacking Course
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.
Trending: Offensive Security Tool: Monkey365
“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.
Are u a security researcher? Or a company that writes articles or write ups about Cyber Security, Offensive Security (related to information security in general) that match with our specific audience and is worth sharing?
If you want to express your idea in an article contact us here for a quote: [email protected]
Source: portswigger.net