Join our Newsletter — 33% off our NHI Course
Home› Guides› RepoJacking and Namespace Takeover Guide: Finding and Fixing…
Guide Software & AI Supply Chain

RepoJacking and Namespace Takeover Guide: Finding and Fixing Dangling Repository References

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 14 November 2026 13 min read
On this page

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.

EventWhat GitHub doesResidual risk
Repository renamedRedirects web, issues, wikis and Git operations to the new name; project site URLs are not redirectedRedirect ends if a repository is created at the old name; Actions references are not redirected
User or organisation renamedWeb links and pushes to old remote URLs continue to work; old name and repository combination retired if usage thresholds are metBelow 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 renameOld owner and repository name combination permanently retired; reuse is refused with a "has been retired" messageResearchers have reported bypasses of retirement in the past, so do not rely on it alone
Public container image with over 5,000 downloads, owner renamedFormer full image name permanently retiredImages below the threshold, and packages moved to the new namespace, can break or be reclaimed
Account deletedNot covered by the rename redirects described aboveTreat 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.

LocationTypical referenceWhy it is exposedSafer form
Go modulesModule path github.com/owner/repo in go.modNew module versions are fetched from the repository pathCommitted go.sum, checksum database verification, internal module proxy, vendoring
Swift Package Manager and CocoaPodsRepository URL in Package.swift or a PodspecPackage resolves from the Git URLExact revision pins, committed Package.resolved, internal mirror
PHP ComposerVCS repository entries and Packagist source URLsSource fetched from the repositorycomposer.lock with commit references, private Packagist mirror
GitHub Actions workflowsuses: owner/action@tagTags are mutable and the owner can changeFull-length commit SHA, internal copies of critical actions
Git submodulesURL in .gitmodulesRecursive clones follow the URLRecorded commit plus a URL under an owner you control
Infrastructure as codeTerraform module source on a Git host, Ansible roles from GitModule fetched at init or installPinned ref to a commit, private registry
Install scripts and Dockerfilescurl of a raw file or release asset from a repository pathFetches the latest content, often run with high privilegeDownload from a mirror with a checksum check, no pipe-to-shell
Documentation and READMEs"Clone from" and "install with" instructionsUsers and AI coding assistants copy themRegular 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
MetricTarget
External repository references resolved through a redirectZero open for more than 30 days
Third-party actions pinned to a full commit SHAAll, measured across every workflow in the organisation
Builds resolving dependencies through the internal proxy or mirrorAll production builds
Former organisation and user names held as placeholdersEvery rename since the programme started
Checksum or lockfile verification failures closed with a security review100 percent

Framework mapping

ControlNIST CSF 2.0NIST SP 800-53 Rev 5ATT&CK and D3FEND
Inventory of external repository referencesID.AM-02CM-8Counters T1195.001
Supplier and open source dependency riskGV.SC-07SR-3Counters T1195.001, T1195.002
Pinning, checksums and provenancePR.PS-02SR-4, SR-11, CM-14D3-SFA System File Analysis
Stale reference findings tracked as vulnerabilitiesID.RA-01RA-5Not applicable
Monitoring of dependency sourcesDE.CM-09SR-3Not 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 14 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.