gix and gitoxide's symlinked .gitmodules are followed and parsed from outside of the repository
attachments:
[pocs.zip](https://github.com/user-attachments/files/26431422/pocs.zip)
When Repository::submodules() loads submodule metadata, it prefers the worktree .gitmodules file if that path exists. In the current implementation, the path is read with std::fs::read(), which follows symlinks. As a result, a repository can present a symlinked .gitmodules that points outside the repository, and gitoxide will parse the out-of-repository bytes as submodule configuration.
This is a repository-boundary violation. A caller using the high-level submodule API can believe it is reading repository-local submodule metadata, while the bytes are actually coming from an arbitrary file outside the repository tree.
The relevant flow is:
1. [gix/src/repository/location.rs](https://github.com/GitoxideLabs/gitoxide/blob/v0.52.0/gix/src/repository/location.rs) derives the worktree .gitmodules path as workdir/.gitmodules.
2. [gix/src/repository/submodule.rs](https://github.com/GitoxideLabs/gitoxide/blob/v0.52.0/gix/src/repository/submodule.rs) reads that path with std::fs::read(&path) and immediately parses the bytes as a submodule configuration file.
3. Repository::submodules() exposes the parsed entries through the high-level API.
The issue is not in the parser. The issue is that the worktree path is treated as an ordinary file without checking whether it is a symlink, and without checking whether the canonicalized target remains inside the repository worktree.
Because std::fs::read() follows symlinks, a malicious repository can cause gitoxide to ingest bytes from an attacker-chosen location outside the repository. The resulting Submodule objects then expose name, path, and url values derived from that external file.
Use the attached PoC zip that contains the pocs/ workspace.
1. Unzip the PoC archive.
2. Enter pocs/F001.
3. Run:
```bash
cargo run --quiet
```
4. Compare the output with pocs/F001/result.txt.
Important outputs include:
gitmodules_symlink=.../victim-repo/.gitmodulessymlink_target=.../outside/modules.confparsed_name=symlinkedparsed_path=deps/symlinkedparsed_url=https://attacker.example/symlinked.gitThese outputs show that gitoxide parsed the submodule configuration from the symlink target outside the repository, not from repository-local bytes.
Confirmed impact:
Repository::submodules();name, path, and url;This report does not claim direct command execution from this code path by itself. The demonstrated impact is metadata injection across the repository boundary.
A safe fix is to stop silently following symlinks for the worktree .gitmodules path in this loading path.
Reasonable options include:
1. use symlink_metadata() / lstatstyle checks and reject symlinked .gitmodules when loading from the worktree;
2. canonicalize the target and verify that it still resides under the repository worktree before reading it;
3. for security-sensitive callers, prefer loading .gitmodules from the index or HEAD tree rather than following the worktree path.
At minimum, the worktree path should not silently follow symlinks to arbitrary external files.
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. Rated impact: confidentiality high, integrity none, availability none.
The score comes from this vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P
GHSA-pg4w-g64p-qwhj is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.
GHSA-pg4w-g64p-qwhj is recorded against 2 packages.
Published on 5 May 2026 and last revised on 8 May 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.
github.com (Web)
github.com (Package)
gitoxide has other advisories on record. If you are patching this one, these are worth checking on the same host:
These advisories are the same class of weakness (CWE-22: Path Traversal) in other software:
Details
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| gitoxide | — | — |
| gix | — | — |
References
Similar Threats
Site Security Check
GHSA-pg4w-g64p-qwhj is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.