Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    At Least We Know the Washington Post Isn’t Buying Views

    May 13, 2026

    aria2c Improper Certificate Validation – Research Advisory

    May 13, 2026

    PSIRT | FortiGuard Labs

    May 13, 2026
    Facebook X (Twitter) Instagram
    • Demos
    • Technology
    • Gaming
    • Buy Now
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Canadian Cyber WatchCanadian Cyber Watch
    • Home
    • News
    • Alerts
    • Tips
    • Tools
    • Industry
    • Incidents
    • Events
    • Education
    Subscribe
    Canadian Cyber WatchCanadian Cyber Watch
    Home»News»Hijackable Go Module Repositories | Blog
    News

    Hijackable Go Module Repositories | Blog

    adminBy adminMay 6, 2026No Comments7 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    VulnCheck analyzed the Go module ecosystem looking for modules whose source code repository could be vulnerable to repository hijacking (repojacking).

    VulnCheck found more than 9,000 repositories are vulnerable to repojacking due to GitHub username changes.

    VulnCheck found more than 6,000 repositories were vulnerable to repojacking due to account deletion.

    Combined, these 15,000 repositories support more than 800,000 Go module-versions.

    The Go module ecosystem is unique because it’s decentralized. Other packaging systems like Pypi or NPM require developers to create accounts to upload their packages. This gives the package platform the ability to moderate users and content. That isn’t the case with Go. Go developers publish modules by pushing their code to source control platforms like GitHub. Anyone can then instruct the Go module mirror and pkg.go.dev to cache the module’s details.

    This decentralization makes Go module repositories particularly vulnerable to repojacking. A repository becomes vulnerable when the module author changes their username or deletes their account. At that time, an attacker can register the newly unused username, duplicate the module repository, and publish a new module to proxy.golang.org and go.pkg.dev. A detailed step-by-step breakdown of how that is done and what the resulting go.pkg.dev page looks like can be found in Appendix A.

    GitHub does have some protections against repojacking. Their popular repository namespace retirement feature prevents repojacking of any repository “that had more than 100 clones in the week leading up to the owner’s account being renamed or deleted.” That might sound reasonable, but it isn’t necessarily for Go. Go modules are typically cached by the Module mirror, so there is no real need to interact with or clone from the source repository. For some context, VulnCheck has an open source library hosted on GitHub that we use daily and has 170+ stars, but that repository has only seen 20 clones in the last week. Based on that, the 100 clones protection isn’t necessarily as good as GitHub might think it is.

    In June 2023, Aquasec published research positing millions of hijackable GitHub repositories. Knowing that Go is particularly vulnerable to this attack vector, we set out to enumerate exactly how many Go module-versions might be affected. By module-version, we mean a module plus all its versions. This is important to note because, as detailed in Appendix A, after successfully hijacking the attacker’s new module will be listed as an “updated” module for all of the old module-versions.

    VulnCheck tracks more than 20 million Go module-versions. It’s not exactly a small dataset, but the algorithm for tracking down the repojackable modules is relatively straightforward:

    1. For each module, infer the repository URL from the module name. For example, github.com/vulncheck-oss/go-exploit is a Go module whose source is hosted at https://github.com/vulncheck-oss/go-exploit.
    2. Attempt to connect to each repository.
    3. An HTTP 301 response indicates a username change, a repository name change, or both. For our purposes, we validated that the repository name was the same (e.g. go-exploit), but the username had changed. We also validated that the original user account (e.g. vulncheck-oss) didn’t exist. That further weeded out things like repository transfers. The repositories that made it through all those steps were considered potentially vulnerable to repojacking.
    4. An HTTP 404 response indicated the repository no longer exists. We then would see if the username still existed. If not, then this, too, is potentially vulnerable to repojacking.
    5. An HTTP 200 response indicated the repository was not vulnerable.
    6. We then validated that the potentially hijackable repository actually had an entry in go.pkg.dev (you can cache pretty much anything with the Module mirror, so it’s important to weed out non-Go module stuff).

    What you have left over is a lot of repositories that could be repojacked (assuming the 100 clones in the last seven days issue isn’t a problem). Our first finding is that more than 9,000 Go module GitHub repositories are vulnerable to repojacking due to a username change. The potential repojacking affects more than 500,000 Go module-versions.

    In order to determine how popular the repositories are, we grabbed each repositories’ number of GitHub stars. We’ve graphed the results in buckets from 0 to 1000.

    Hijackable Go Module Repositories Grouped by Stars

    The majority of the repositories have zero stars. Those are of little to no value to an attacker. The remaining 3,000 repositories have between 1 and 1000 stars. The likelihood of a repository being valuable to an attacker increases with stars, but stars alone can’t say how useful an attack might be. The actual usage within the Go ecosystem matters, because exploitation relies on a developer updating to the new module.

    The other category we tracked is repositories that are hijackable because the GitHub account had been deleted. We identified more than 6,000 of this type of repository, ultimately affecting nearly 300,000 module-versions. Because the repositories have been deleted, we can’t find how many stars they have. An attacker would have to rely on finding usage patterns – ultimately searching for imports of the code.

    Searching abandoned usage on GitHub

    That’s a heavy lift, but worthwhile for the right attacker. Still, even finding use in the wild isn’t enough. Ultimately, the victim will need to update to the attacker’s new module, because the attacker cannot overwrite old modules. So, while the threat is real, repojacking within the Go ecosystem is not an immediate win for the attacker.

    Unfortunately, mitigating all of these repojackings is something that either Go or GitHub will have to take on. A third-party can’t reasonably register 15,000 GitHub accounts. Until then, it’s important for Go developers to be aware of the modules they use, and the state of the repository that the modules originated from.

    Once published, a Go module is available via proxy.golang.org. This ensures that modules can’t be deleted. Disappearing modules would break downstream software, which is something no one wants. However, proxy.golang.org is not a centralized repository like Pypi, Gem, or NPM. It’s simply a proxy and cache. When the source of the Go module is deleted or moved, proxy.golang.org is unaware (or doesn’t care). The result is that anyone can hijack those modules. Let’s walk through the steps of how that works.

    Step 1: Dev-A creates a GitHub repository and makes a Go module

    In the example below, Dev-A created https://github.com/vcresearcher/helloworld. They added code to create the Helloworld module, and tagged it version 1.0.0.

    A wild new repo appears

    The module’s hello.go file contains one function for other developers to use:

    hello.go

    package helloworld
    
    import "fmt"
    
    func Hello() {
        fmt.Println("hi.")
    }
    

    Another developer, Dev-B, sees the super cool Helloworld module and decides to use it in their new project.

    main.go

    
    package main
    
    import "github.com/vcresearcher/helloworld"
    
    func main() {
        helloworld.Hello()
    }
    

    After running go mod init and go mod tidy, Dev-B’s go.mod looks like so:

    module github.com/vcresearcher/helloworld-impl
    
    go 1.21.0
    
    require github.com/vcresearcher/helloworld v1.0.0
    

    Dev-B’s project dependency listing (go list -m -u all) now looks like:

    github.com/vcresearcher/helloworld-impl
    github.com/vcresearcher/helloworld v1.0.0
    

    And, finally, when Dev-B executes their program they get the following output:

    albinolobster@mournland:~/helloworld-impl$ ./helloworld-impl
    hi.
    

    Dev-A changes their username from vcresearch to vclabresearch. GitHub automatically moves the helloworld repository to https://github.com/vclabresearch/helloworld.

    What is old is new again

    When Dev-A changed its name from vcresearcher to vclabresearch, GitHub moved their repositories to the new username, and set up HTTP redirects so that any request to vcresearcher/helloworld would redirect to vclabresearch/helloworld.

    Attacker registers as vcresearcher, creates a repository called helloworld, and uploads the original repositories content. This perfectly matches the original repository created by Dev-A. Attacker then updates hello.go with “malicious” code.

    helloworld.go

    
    package helloworld
    
    import "fmt"
    
    func Hello() {
        fmt.Println("hi world 😈")
    }
    

    Attacker then publishes the module as version v1.0.3.

    What is old is new again

    Finally, Attacker tells the Go Module Proxy to grab the updated version. The new version is merged with the old versions in go.pkg.dev.

    What is old is new again

    Step 5: Dev-B checks for helloworld module updates and pulls in Attacker’s “malicious” package

    In the output below, Dev-B checks the available updates for their Go program. They see a new version of the helloworld module, they fetch it, and subsequently execute Attacker’s code.

    albinolobster@mournland:~/helloworld-impl$ go list -m -u all
    github.com/vcresearcher/helloworld-impl
    github.com/vcresearcher/helloworld v1.0.1 [v1.0.3]
    albinolobster@mournland:~/helloworld-impl$ nano go.mod
    albinolobster@mournland:~/helloworld-impl$ go mod tidy
    go: downloading github.com/vcresearcher/helloworld v1.0.3
    albinolobster@mournland:~/helloworld-impl$ go build
    albinolobster@mournland:~/helloworld-impl$ ./helloworld-impl
    hi world. 😈
    

    The VulnCheck Exploit & Vulnerability team tracks more than a dozen package managers including NPM, Pypi, and Maven. For details, sign up to start a trial of our Exploit & Vulnerability Intelligence product today.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleCVE-2026-41640 | THREATINT
    Next Article The Long Con: How “Pig Butchering” Scammers Are Stealing Millions Through Fake Romance and Investment Schemes
    admin
    • Website

    Related Posts

    News

    At Least We Know the Washington Post Isn’t Buying Views

    May 13, 2026
    News

    Windows BitLocker zero-day gives access to protected drives, PoC released

    May 13, 2026
    News

    War and Data Centers Are Driving Up the Cost of Fiber-Optic Cable

    May 13, 2026
    Add A Comment

    Comments are closed.

    Demo
    Top Posts

    Catchy & Intriguing

    March 17, 202674 Views

    Defending Canada’s Digital Frontier: Combating Phishing, Social Engineering, Ransomware, and Malware

    March 23, 202624 Views

    IP Address Investigations and Local OSINT

    March 20, 202624 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews
    85
    Featured

    Pico 4 Review: Should You Actually Buy One Instead Of Quest 2?

    January 15, 2021 Featured
    8.1
    Uncategorized

    A Review of the Venus Optics Argus 18mm f/0.95 MFT APO Lens

    January 15, 2021 Uncategorized
    8.9
    Editor's Picks

    DJI Avata Review: Immersive FPV Flying For Drone Enthusiasts

    January 15, 2021 Editor's Picks

    Subscribe to Updates

    Get the latest tech news from FooBar about tech, design and biz.

    Demo
    Most Popular

    Catchy & Intriguing

    March 17, 202674 Views

    Defending Canada’s Digital Frontier: Combating Phishing, Social Engineering, Ransomware, and Malware

    March 23, 202624 Views

    IP Address Investigations and Local OSINT

    March 20, 202624 Views
    Our Picks

    At Least We Know the Washington Post Isn’t Buying Views

    May 13, 2026

    aria2c Improper Certificate Validation – Research Advisory

    May 13, 2026

    PSIRT | FortiGuard Labs

    May 13, 2026

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest
    • Home
    • Technology
    • Gaming
    • Phones
    • Buy Now
    © 2026 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.