When a GitHub user or organisation is renamed or deleted, every build, script and document that still points at the old path is trusting whoever registers that name next. RepoJacking is the takeover of such an abandoned namespace so that existing references, which used to follow a redirect to the real project, now resolve to an attacker's repository instead. It affects ecosystems that fetch code straight from repository URLs, such as Go modules, Swift packages, PHP packages and GitHub Actions, as well as install scripts and submodules. This guide explains how the redirect and retirement mechanisms work, where dangling references hide in a typical estate, how to find them, and which controls make a hijacked namespace harmless. It is written for application security, platform and build engineers and for anyone who owns an organisation on a code hosting platform.
Key takeaways
- Redirects are a convenience, not a guarantee. GitHub redirects web and Git traffic from a renamed repository, but the redirect stops working once someone creates a repository at the old path.
- Retirement protects only popular names. GitHub permanently retires an owner and repository name combination only when usage thresholds are met, so most renamed projects keep no protection beyond the redirect.
- Actions are not redirected at all. A workflow that references an action in a renamed repository fails with "repository not found", which pushes teams to fix references quickly, sometimes to the wrong place.
- Immutable references defeat most takeovers. Pinning to full commit SHAs, checksum verification and internal mirrors mean a newly registered namespace cannot change what your build receives.
- Your own renames are the easiest fix. Keep old organisation and user names registered as placeholders after a rename, and check for internal references before deleting any account.
How namespace takeover works
Repository URLs on GitHub include the owner's name, so the full path is owner/repository. When the owner is renamed, GitHub's username reference says web links to existing repositories continue to work and command-line pushes to the old remote URLs continue to work. When a single repository is renamed, GitHub's documentation says existing information, except project site URLs, is redirected to the new name, and Git clone, fetch and push operations against the previous location continue to work as if made on the new location.
The weakness is what happens next. GitHub's renaming documentation warns that if a new repository is later created with the original name, the redirects to the renamed repository stop working. Checkmarx and Aqua Nautilus both describe the same consequence at owner level: once the old owner name is free and someone registers it and recreates the repository path, consumers that still use the old path silently start pulling the new owner's code. Nothing in the consuming build changes, which is what makes it dangerous.
MITRE ATT&CK classifies the outcome under T1195.001 Compromise Software Dependencies and Development Tools; where the hijacked repository supplies a released product rather than a dependency, T1195.002 Compromise Software Supply Chain is the closer fit. For the wider family of package-name attacks such as typosquatting and dependency confusion, see the Malicious Package and Dependency Confusion Guide; this page covers only repository and namespace reuse.
| Event | What GitHub does | Residual risk |
|---|---|---|
| Repository renamed | Redirects web, issues, wikis and Git operations to the new name; project site URLs are not redirected | Redirect ends if a repository is created at the old name; Actions references are not redirected |
| User or organisation renamed | Web links and pushes to old remote URLs continue to work; old name and repository combination retired if usage thresholds are met | Below the thresholds, the old owner name can be registered and the path recreated |
| Namespace with Marketplace action, or over 100 clones or over 100 Actions uses in the week before rename | Old owner and repository name combination permanently retired; reuse is refused with a "has been retired" message | Researchers have reported bypasses of retirement in the past, so do not rely on it alone |
| Public container image with over 5,000 downloads, owner renamed | Former full image name permanently retired | Images below the threshold, and packages moved to the new namespace, can break or be reclaimed |
| Account deleted | Not covered by the rename redirects described above | Treat any path under a deleted owner as claimable until proven otherwise |
How big the problem is
- Research sampling: Aqua Nautilus took one month of GHTorrent activity logs from June 2019, about 125 million unique repository names, checked a random 1 percent, and found 36,983 vulnerable repositories, roughly 2.95 percent. It extrapolated that millions of GitHub repositories may be exposed and named Google and Lyft among the organisations it notified, both of which fixed their exposure.
- Package ecosystems: Checkmarx identified over 10,000 packages in Go, Swift and Packagist that referenced renamed usernames and were at risk, and warned that popular GitHub Actions referenced by namespace are exposed in the same way.
- Exploitation: Checkmarx reported that around May 2022 two of three compromises of popular open source packages used RepoJacking against accounts whose owners had been renamed, after a bypass of GitHub's retirement protection it had reported in November 2021.
The numbers are research estimates from 2022 and 2023 and the platform's protections have changed since. Treat them as evidence that the class is real and common, not as a current count.
Where dangling references hide
Any place that names an owner/repository path and fetches it at build, deploy or install time is in scope. The table lists the common locations and the matching immutable alternative.
| Location | Typical reference | Why it is exposed | Safer form |
|---|---|---|---|
| Go modules | Module path github.com/owner/repo in go.mod | New module versions are fetched from the repository path | Committed go.sum, checksum database verification, internal module proxy, vendoring |
| Swift Package Manager and CocoaPods | Repository URL in Package.swift or a Podspec | Package resolves from the Git URL | Exact revision pins, committed Package.resolved, internal mirror |
| PHP Composer | VCS repository entries and Packagist source URLs | Source fetched from the repository | composer.lock with commit references, private Packagist mirror |
| GitHub Actions workflows | uses: owner/action@tag | Tags are mutable and the owner can change | Full-length commit SHA, internal copies of critical actions |
| Git submodules | URL in .gitmodules | Recursive clones follow the URL | Recorded commit plus a URL under an owner you control |
| Infrastructure as code | Terraform module source on a Git host, Ansible roles from Git | Module fetched at init or install | Pinned ref to a commit, private registry |
| Install scripts and Dockerfiles | curl of a raw file or release asset from a repository path | Fetches the latest content, often run with high privilege | Download from a mirror with a checksum check, no pipe-to-shell |
| Documentation and READMEs | "Clone from" and "install with" instructions | Users and AI coding assistants copy them | Regular link audits, canonical links only |
For Go, the go command's module reference describes a version as an immutable snapshot, and go.sum plus the public checksum database mean an already recorded version cannot silently change content. That protects versions you have already locked; it does not protect a build that resolves a new version, a pseudo-version or a first-time dependency from a hijacked path. See the Go Vulnerability Management Guide for module proxy settings and the CocoaPods and Swift Package Manager Security Guide for Apple ecosystems.
Finding dangling references
- Extract every repository path. Search all repositories for owner/repository references in go.mod, Package.swift, Package.resolved, composer.json, .gitmodules, workflow files, Terraform and Ansible sources, Dockerfiles, shell scripts and documentation. Code search across your organisation or an SBOM pipeline is a good starting point. See the SBOM operations page.
- Resolve each path against the platform. For each external path, check whether the owner and repository still exist under that exact name, whether requests are being redirected to a different owner or name, and whether the owner account was created recently. A redirect means the reference is stale and should be updated to the canonical path today.
- Flag owners that no longer exist. A path whose owner returns not found is either already free for registration or will be. Update or remove it before anyone else claims it.
- Check history for ownership changes. For paths that resolve, compare the current owner's account age and repository creation date against the date you adopted the dependency. A repository created after your first use, at the same path, is a red flag.
- Use purpose-built scanners as a supplement. Checkmarx released an open source tool, ChainJacking, to find Go dependencies on renamed accounts; software composition analysis and dependency tools may report similar findings. Validate their output, because coverage of this weakness varies.
- Record and track. Treat each stale reference as a vulnerability with an owner and a due date, mapped to the affected build.
Controls that make a takeover harmless
- Pin by content, not by name: GitHub's secure use reference tells workflow authors to pin actions to a commit SHA to reduce the risk of a backdoor being added to the action's repository, to verify the SHA comes from the action's repository and not a fork, and warns that tags can be moved or deleted. As of November 2026 it also describes workflow dependency lockfiles as the strongest protection where a repository adopts them. See How to Pin GitHub Actions to Commit SHAs.
- Commit lockfiles and verify checksums: go.sum, Package.resolved and composer.lock make a silent content swap fail verification rather than build.
- Resolve through an internal proxy or mirror: a repository manager or module proxy caches the versions you approved, so a change upstream does not reach builds until someone reviews it. See the Private Package Repository and Proxy Guide.
- Vendor critical dependencies: for small, rarely updated dependencies from individual maintainers, copying the code into your repository (Go's vendor directory, for example) removes the live fetch entirely.
- Keep update automation honest: GitHub notes that Dependabot does not create alerts for actions pinned to SHA values, so SHA pinning needs a version update process to avoid stale actions. See the Dependency Update Automation Guide.
- Restrict which actions can run: organisation-level allowed actions settings that limit workflows to your own and selected verified actions shrink the set of namespaces you depend on.
Protecting your own namespaces
Most organisations are both consumers and publishers. Your users, customers and internal teams reference your paths, so your renames and deletions create their exposure.
- Before renaming an organisation or user: search for internal and public references to the old name, plan the update window, and decide who will hold the old name afterwards.
- Immediately after renaming: register the old name again as a placeholder account or organisation you control, as Aqua Nautilus recommends, so nobody else can recreate the path. Lock it down with MFA and no repositories that build anything.
- For Actions you publish: GitHub does not redirect action references after a repository rename and recommends creating the action under the new name and archiving the old repository. Communicate the new path and keep the archived repository in your ownership.
- For project sites: GitHub recommends a custom domain before renaming a repository that hosts a Pages site, because project site URLs are not redirected. A custom domain then carries its own dangling DNS risk; see the Subdomain Takeover and Dangling DNS Guide.
- Before deleting an account: treat deletion as releasing the name. Leavers' personal accounts that hosted shared tooling are a common case: transfer repositories to the organisation first, then update references.
- Track machine and bot accounts too: automation accounts that own repositories are namespaces as well. Include them in the organisation's account inventory. See How to audit GitHub outside collaborators and machine users.
Detection and measurement
Detection here is mostly preventive scanning, because the build itself sees nothing unusual. Useful signals:
- Build-time redirects: dependency fetch logs or proxy logs showing redirects for repository paths; any redirect is a stale reference.
- New-owner signals: a dependency path whose owner account or repository was created after your first use of it.
- Checksum failures: go.sum, lockfile or integrity mismatches in CI should fail the build and raise a security ticket, not be "fixed" by regenerating the lockfile.
- Unexpected content changes: mirror or proxy alerts when an upstream tag now points at a different commit.
| Metric | Target |
|---|---|
| External repository references resolved through a redirect | Zero open for more than 30 days |
| Third-party actions pinned to a full commit SHA | All, measured across every workflow in the organisation |
| Builds resolving dependencies through the internal proxy or mirror | All production builds |
| Former organisation and user names held as placeholders | Every rename since the programme started |
| Checksum or lockfile verification failures closed with a security review | 100 percent |
Framework mapping
| Control | NIST CSF 2.0 | NIST SP 800-53 Rev 5 | ATT&CK and D3FEND |
|---|---|---|---|
| Inventory of external repository references | ID.AM-02 | CM-8 | Counters T1195.001 |
| Supplier and open source dependency risk | GV.SC-07 | SR-3 | Counters T1195.001, T1195.002 |
| Pinning, checksums and provenance | PR.PS-02 | SR-4, SR-11, CM-14 | D3-SFA System File Analysis |
| Stale reference findings tracked as vulnerabilities | ID.RA-01 | RA-5 | Not applicable |
| Monitoring of dependency sources | DE.CM-09 | SR-3 | Not applicable |
For a build-system view of the same controls, see the SLSA Source Track Guide and the CIS Software Supply Chain Benchmark Guide.
Common failure patterns
- Trusting the redirect. Teams see builds still working after an upstream rename and never update the path, leaving it claimable indefinitely.
- Fixing a broken action reference by searching for the name. When a renamed action fails, the quickest fix is to find a repository with a similar name, which may be a fork or an impostor. Verify the canonical owner from the publisher's own announcement.
- Regenerating lockfiles on checksum errors. A content mismatch is the control working; rerunning the tool accepts whatever is now at the path.
- Releasing old organisation names. Rebrands and acquisitions rename organisations and leave the old name free for registration.
- Deleting leavers' accounts that hosted shared scripts. Install scripts and Dockerfiles across the company keep pointing at the personal path.
- Relying on platform retirement. Retirement thresholds are usage based and researchers have reported bypasses, so low-usage internal dependencies get no protection.
Practitioner checklist
- Inventory every external owner/repository reference across code, workflows, IaC, scripts and documentation.
- Resolve each reference and update any that redirect or point at a missing owner.
- Pin third-party actions to full commit SHAs and keep them updated through a version update process.
- Commit lockfiles and checksum files and fail builds on mismatch.
- Route dependency resolution through an internal proxy or mirror; vendor small critical dependencies.
- Hold former organisation and user names as locked placeholder accounts after any rename.
- Add a pre-deletion check for accounts that own repositories referenced elsewhere.
- Track stale references as vulnerabilities with owners and due dates.
Standards and references
- GitHub Docs: Renaming a repository
- GitHub Docs: Username reference
- GitHub Docs: Secure use reference for GitHub Actions
- Go: Go Modules Reference
- Aqua Security: GitHub dataset research reveals millions potentially vulnerable to RepoJacking
- Checkmarx: Attacking the software supply chain with a simple rename
- Checkmarx: GitHub RepoJacking weakness exploited in the wild by attackers
- MITRE ATT&CK: T1195.001 Compromise Software Dependencies and Development Tools
Related NHI Mgmt Group resources: Git Repository Security Guide · GitHub and GitHub Actions Security Guide · Software Supply Chain Security Guide · Malicious Package and Dependency Confusion Guide