Summary
In affected isomorphic-git versions, checkout may write a file through a symlinked directory without verifying that the resolved path stays inside the working tree. Processing a malicious repository can therefore allow writes to files outside that tree, with possible code execution depending on the host and the files affected.
In affected isomorphic-git versions, checkout may write a file through a symlinked directory without verifying that the resolved path stays inside the working tree. Processing a malicious repository can therefore allow writes to files outside that tree, with possible code execution depending on the host and the files affected.
Affected context
The issue affects isomorphic-git applications that use git.checkout with a filesystem provider capable of creating and following symlinks. A common scenario involves a clone followed by a later pull, though other tree states or application access patterns may also trigger the vulnerable write behavior.
On Linux and macOS, Node.js filesystem operations may follow the symlink and write outside the working tree. Windows generally blocks creation of the symlink without additional privilege. Browser and in-memory providers limit impact to their virtual filesystem and are affected only if they support symlink creation and following.
The issue affects isomorphic-git applications that use git.checkout with a filesystem provider capable of creating and following symlinks. A common scenario involves a clone followed by a later pull, though other tree states or application access patterns may also trigger the vulnerable write behavior.
On Linux and macOS, Node.js filesystem operations may follow the symlink and write outside the working tree. Windows generally blocks creation of the symlink without additional privilege. Browser and in-memory providers limit impact to their virtual filesystem and are affected only if they support symlink creation and following.
Exploit preconditions
- Attack surface: An application processes repository content using
git.checkout. - Required access: An attacker must be able to supply or influence repository content or the relevant filesystem tree state.
- Trigger point: Checkout writes a child file beneath a directory path that is a symlink.
- Why exploitation is possible: The write path is not checked to ensure that symlink resolution remains within the working tree.
- Attack surface: An application processes repository content using
git.checkout. - Required access: An attacker must be able to supply or influence repository content or the relevant filesystem tree state.
- Trigger point: Checkout writes a child file beneath a directory path that is a symlink.
- Why exploitation is possible: The write path is not checked to ensure that symlink resolution remains within the working tree.
Why this happens
Checkout writes child paths without adequately checking whether leading directory components are symlinks. When the filesystem follows such a symlink, a write intended for the working tree can resolve to a location outside it. This is an improper link-resolution issue (CWE-59) that can also result in path traversal beyond the intended directory boundary (CWE-22).
Checkout writes child paths without adequately checking whether leading directory components are symlinks. When the filesystem follows such a symlink, a write intended for the working tree can resolve to a location outside it. This is an improper link-resolution issue (CWE-59) that can also result in path traversal beyond the intended directory boundary (CWE-22).
Potential impact
- An attacker may cause writes to files outside the working tree on affected host filesystem providers.
- Modified host files could disrupt applications or alter configuration.
- Writes to executable or startup-related files could contribute to code execution.
- Impact may be limited to a virtual filesystem for browser or in-memory providers, depending on their symlink behavior.
- An attacker may cause writes to files outside the working tree on affected host filesystem providers.
- Modified host files could disrupt applications or alter configuration.
- Writes to executable or startup-related files could contribute to code execution.
- Impact may be limited to a virtual filesystem for browser or in-memory providers, depending on their symlink behavior.
General mitigation guidance
Defensive patterns focus on ensuring that filesystem writes cannot escape their intended root:
- Use filesystem operations or abstractions that prevent following symlinks in path components where supported.
- Resolve and validate destination paths against the working-tree root before writing, accounting for symlink resolution and race conditions.
- Treat repository contents as untrusted and reduce the ability of untrusted sources to influence checkout operations.
- Run repository-processing workloads with least privilege and limit access to sensitive host paths.
- Prefer providers with constrained filesystem boundaries when host filesystem access is not required.
Defensive patterns focus on ensuring that filesystem writes cannot escape their intended root:
- Use filesystem operations or abstractions that prevent following symlinks in path components where supported.
- Resolve and validate destination paths against the working-tree root before writing, accounting for symlink resolution and race conditions.
- Treat repository contents as untrusted and reduce the ability of untrusted sources to influence checkout operations.
- Run repository-processing workloads with least privilege and limit access to sensitive host paths.
- Prefer providers with constrained filesystem boundaries when host filesystem access is not required.
How teams detect issues like this
Review checkout and file-writing code for paths built from repository-controlled names, especially where leading directory components may be symlinks. Static analysis and code review can look for filesystem writes that do not enforce containment or protect against symlink following.
Policy checks can require symlink-aware path validation for writes rooted in a working directory and restrict repository-processing processes from accessing sensitive host locations. Automated code review tools may help identify risky filesystem patterns.
Review checkout and file-writing code for paths built from repository-controlled names, especially where leading directory components may be symlinks. Static analysis and code review can look for filesystem writes that do not enforce containment or protect against symlink following.
Policy checks can require symlink-aware path validation for writes rooted in a working directory and restrict repository-processing processes from accessing sensitive host locations. Automated code review tools may help identify risky filesystem patterns.

