GHSA-pg4w-g64p-qwhj: gix and gitoxide's symlinked .gitmodules are followed and parsed from outside of the repository
Summary attachments: 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.
Published May 5, 2026
Affected packages
gitoxide
- Ecosystem
- Rust (crates.io)
- Affected
- <= 0.52.0
- Fixed in
- 0.52.1
- Check
cargo tree -i gitoxide
gix
- Ecosystem
- Rust (crates.io)
- Affected
- < 0.83.0
- Fixed in
- 0.83.0
- Check
cargo tree -i gix
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
attachments: 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.
Root cause analysis
The relevant flow is:
- `gix/src/repository/location.rs` derives the worktree
.gitmodulespath asworkdir/.gitmodules. - `gix/src/repository/submodule.rs` reads that path with
std::fs::read(&path)and immediately parses the bytes as a submodule configuration file. 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.
Reproduction steps
Use the attached PoC zip that contains the pocs/ workspace.
- Unzip the PoC archive.
- Enter
pocs/F001. - Run:
cargo run --quiet- 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.git
These outputs show that gitoxide parsed the submodule configuration from the symlink target outside the repository, not from repository-local bytes.
Impact
Confirmed impact:
- out-of-repository bytes can be injected into the result of
Repository::submodules(); - callers can be misled about submodule metadata such as
name,path, andurl; - any downstream workflow that uses those values to decide clone, fetch, update, or policy behavior is operating on attacker-controlled data that did not actually originate from the repository tree.
This report does not claim direct command execution from this code path by itself. The demonstrated impact is metadata injection across the repository boundary.
Recommended fix
A safe fix is to stop silently following symlinks for the worktree .gitmodules path in this loading path.
Reasonable options include:
- use
symlink_metadata()/lstatstyle checks and reject symlinked.gitmoduleswhen loading from the worktree; - canonicalize the target and verify that it still resides under the repository worktree before reading it;
- for security-sensitive callers, prefer loading
.gitmodulesfrom the index orHEADtree rather than following the worktree path.
At minimum, the worktree path should not silently follow symlinks to arbitrary external files.
Credited to N0zoM1z0.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Rust (crates.io) vulnerabilities
All Rust (crates.io) entriesGHSA-q54r-jf2p-rfr2
gitoxide gix: untrusted .git/config disables filesystem .git-protection path checks via unfiltered protect_options()
high7.3Oct 23, 2026CVE-2026-40034
gitoxide: CommandForbiddenInModulesConfiguration Bypass in gix_submodule::File::update() Enables Arbitrary Command Execution via .gitmodules
high7.8May 5, 2026GHSA-fr8x-3vfx-f45h
gix and gitoxide: unvalidated submodule name traverses out of .git/modules and redirects state() / open() to another repository
high7.7May 5, 2026GHSA-p3hw-mv63-rf9w
gix's submodule name validation bypass + trust inheritance flaw enables path traversal and credential disclosure
high7.5May 5, 2026CVE-2025-31130
gitoxide does not detect SHA-1 collision attacks
medium6.8Apr 4, 2025CVE-2024-43785
gitoxide-core does not neutralize special characters for terminals
low2.5No fixAug 22, 2024
