Summary
isomorphic-git may accept a crafted tree entry containing a Windows NTFS reserved pathname alias that resolves to the repository's active .git directory. On Windows with NTFS, cloning or checking out such a tree could let an attacker write to repository metadata; a later Git-compatible tool may act on that poisoned state.
Affected context
The issue occurs when isomorphic-git materializes attacker-controlled tree entries during clone or checkout on Windows using an NTFS filesystem. The vulnerable validation does not reject the .git::$INDEX_ALLOCATION alias, which NTFS can resolve to the active .git directory. Strict hosting that rejects objects with hasDotgit can block this scenario, and non-NTFS systems do not interpret the alias as the active git directory.
Exploit preconditions
- Attack surface: Clone or checkout of a repository or object stream containing a crafted tree entry.
- Required access: The attacker must be able to supply or influence the repository data being processed; local filesystem access may also be needed to deliver that data.
- Trigger point: isomorphic-git materializes the tree on Windows with an NTFS filesystem.
- Why exploitation is possible: Tree-entry validation does not reject the NTFS alias, allowing writes intended for a worktree path to reach trusted gitdir metadata.
- Further impact condition: A later native Git or compatible-tool action must process the modified metadata for configured behavior, such as a poisoned setting, to have effects. isomorphic-git does not itself execute a written hook or configuration.
Why this happens
The underlying bug is insufficient validation of filesystem paths before materializing tree entries. The validator does not account for a Windows NTFS reserved pathname alias that resolves to the active .git directory, so a path treated as a normal worktree entry can target repository metadata instead. This is a path traversal weakness mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- Repository configuration, hooks, refs, attributes, or other gitdir state may be modified.
- A later Git-compatible tool may process poisoned metadata and behave in an unintended way.
- Configured commands could potentially execute under the victim developer's or CI identity if a later tool action triggers them.
- Repository integrity or CI workflows could be compromised.
General mitigation guidance
Defensive approaches focus on validating paths according to the target filesystem and preventing worktree entries from resolving into repository metadata.
- Reject reserved names, alternate path representations, and platform-specific aliases that can target protected directories.
- Canonicalize and validate destination paths before writing, ensuring they remain within the intended worktree and outside the gitdir.
- Treat repository trees and object streams from untrusted sources as untrusted input, and apply strict validation at ingestion boundaries.
- Use hosting policies that reject entries targeting
.gitor equivalent aliases. - Limit the privileges of developer and CI processes, and avoid automatically invoking tools that process repository-controlled configuration or hooks.
How teams detect issues like this
- Use static analysis and code review to find tree-entry validation that checks textual path components without accounting for platform-specific aliases or canonical destinations.
- Review clone and checkout write paths for checks that ensure materialized files remain within the worktree and cannot target the gitdir.
- Enforce repository-ingestion policies that reject
.gitentries and platform-specific aliases, including checks in hosting and CI workflows. - Monitor for unexpected changes to repository metadata following clone or checkout operations.
- Automated code review tools can help identify path validation and filesystem-boundary risks.

