Where
-Infinity
0

Vendor Risk Score

See how gitoxide compares to other vendors in security performance

View Risk Score →
Severity
7.5
Path Traversal
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

gitoxide before 0.52.1 fails to validate submodule names from .gitmodules configuration, allowing path traversal when deriving submodule git directories. Attackers can craft malicious submodule names with traversal segments to redirect state() and open() functions to repositories outside .git/modules, causing repository confusion and inspection of attacker-controlled repositories.

First published (updated )
Severity
7.5
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

gitoxide before 0.52.1 follows symlinks when reading the worktree .gitmodules file, allowing attackers to inject out-of-repository bytes into submodule metadata. Attackers can create a malicious repository with a symlinked .gitmodules pointing outside the repository tree, causing gitoxide to parse arbitrary external files as submodule configuration and expose attacker-controlled name, path, and url values.

First published (updated )
Severity
3.1
AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N

gitoxide before 0.38.2 fails to validate carriage return characters in URL values passed to credential helpers. Attackers can supply URLs containing bare carriage returns to inject additional helper protocol fields and cause credential helpers to return credentials for attacker-specified hosts instead of the requested URL.

First published (updated )
Severity
5.3
AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N

gix-worktree-state before 0.33.0 (part of gitoxide) allows writing files outside the worktree on Windows. gixworktreestate::checkout() follows an existing terminal symlink during non-exclusive (incremental) materialization (destinationisinitiallyempty: false) when core.symlinks is true. If a symlink entry (mode 120000) is first checked out at a path P pointing outside the worktree, a subsequent incremental checkout of a regular-file entry (mode 100644) at the same path follows the existing reparse point and writes the blob content through the link, overwriting files outside the worktree.

First published (updated )
Severity
6.8
EPSS
0.02%
AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N

Summary gitoxide uses SHA-1 hash implementations without any collision detection, leaving it vulnerable to hash collision attacks.

Details gitoxide uses the sha1smol or sha1 crate, both of which implement standard SHA-1 without any mitigations for collision attacks. This means that two distinct Git objects with colliding SHA-1 hashes would break the Git object model and integrity checks when used with gitoxide.

The SHA-1 function is considered cryptographically insecure. However, in the wake of the SHAttered attacks, this issue was mitigated in Git 2.13.0 in 2017 by using the sha1collisiondetection algorithm by default and producing an error when known SHA-1 collisions are detected. Git is in the process of migrating to using SHA-256 for object hashes, but this has not been rolled out widely yet and gitoxide does not support SHA-256 object hashes.

PoC The following program demonstrates the problem, using the two SHAttered PDFs:

rust use sha1checked::{CollisionResult, Digest};

fn sha1oidoffile(filename: &str) -> gix::ObjectId { let mut hasher = gix::features::hash::hasher(gix::hash::Kind::Sha1); hasher.update(&std::fs::read(filename).unwrap()); gix::ObjectId::Sha1(hasher.digest()) }

fn sha1dcoidoffile(filename: &str) -> Result<gix::ObjectId, String> { // Matches Git’s behaviour. let mut hasher = sha1checked::Builder::default().safehash(false).build(); hasher.update(&std::fs::read(filename).unwrap()); match hasher.tryfinalize() { CollisionResult::Ok(digest) => Ok(gix::ObjectId::Sha1(digest.into())), CollisionResult::Mitigated() => unreachable!(), CollisionResult::Collision(digest) => Err(format!( "Collision attack: {}", gix::ObjectId::Sha1(digest.into()).tohex() )), } }

fn main() { dbg!(sha1oidoffile("shattered-1.pdf")); dbg!(sha1oidoffile("shattered-2.pdf")); dbg!(sha1dcoidoffile("shattered-1.pdf")); dbg!(sha1dcoidoffile("shattered-2.pdf")); }

The output is as follows:

[src/main.rs:24:5] sha1oidoffile("shattered-1.pdf") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a) [src/main.rs:25:5] sha1oidoffile("shattered-2.pdf") = Sha1(38762cf7f55934b34d179ae6a4c80cadccbb7f0a) [src/main.rs:26:5] sha1dcoidoffile("shattered-1.pdf") = Err( "Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a", ) [src/main.rs:27:5] sha1dcoidoffile("shattered-2.pdf") = Err( "Collision attack: 38762cf7f55934b34d179ae6a4c80cadccbb7f0a", )

The latter behaviour matches Git.

Since the SHAttered PDFs are not in a valid format for Git objects, a direct proof‐of‐concept using higher‐level APIs cannot be immediately demonstrated without significant computational resources.

Impact An attacker with the ability to mount a collision attack on SHA-1 like the SHAttered or SHA-1 is a Shambles attacks could create two distinct Git objects with the same hash. This is becoming increasingly affordable for well‐resourced attackers, with the Shambles researchers in 2020 estimating $45k for a chosen‐prefix collision or $11k for a classical collision, and projecting less than $10k for a chosen‐prefix collision by 2025. The result could be used to disguise malicious repository contents, or potentially exploit assumptions in the logic of programs using gitoxide to cause further vulnerabilities.

This vulnerability affects any user of gitoxide, including gix- library crates, that reads or writes Git objects.

1 / 2
Source: GitHub
First published (updated )
Severity
5
EPSS
0.04%
AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N

Summary

gix-worktree-state specifies 0777 permissions when checking out executable files, intending that the umask will restrict them appropriately. But one of the strategies it uses to set permissions is not subject to the umask. This causes files in a repository to be world-writable in some situations.

Details

Git repositories track executable bits for regular files. In tree objects and the index, regular file modes are stored as 0644 if not executable, or 0755 if executable. But this is independent of how the permissions are set in the filesystem (where supported).

gixworktreestate::checkout has two strategies for checking out a file and marking it executable on a Unix-like operating system, one of which is vulnerable:

- If the file is created by assuming it does not already exist, correct permissions are applied, because permissions specified when opening a file are subject to the umask. - If the file is considered possibly already to exist—even in a clean checkout if the application does not specify the option to treat the destination directory as empty—then permissions conferring unrestricted access to any user account on the system are wrongly applied, because permissions specified when calling chmod on an existing file are not subject to the umask.

Specifically, checkout::entry::checkout chooses the strategy for each file. The same strategy is usually chosen for each executable file, if no process (i.e. long running) smudge filter is in use. The strategy depends on the checkout::Options::destinationisinitiallyempty value, which is passed along to checkout::entry::openfile, whose return value includes a flag indicating whether permissions still need to be set:

- With destinationisinitiallyempty: true, executable permissions are specified when opening the file, via OpenOptionsEx::mode, by its effect on the behavior of OpenOptions::open. A mode of 0777 is safe here, for the same reason the default mode of 0666 is safe. When creating a file, the applied mode is the specified mode with any bits unset from it that are set in the umask.

https://github.com/GitoxideLabs/gitoxide/blob/8d84818240d44e1f5fe78a231b5d9bffd0283918/gix-worktree-state/src/checkout/entry.rs#L265-L268

The setexecutableaftercreation flag in the openfile return value is then false.

- With destinationisinitiallyempty: false, executable permissions are set in a separate step, via PermissionsExt::setmode and setpermissions. A mode of 0777 is not safe here, because the umask is not applied. The vulnerable code appears in checkout::entry::finalizeentry, which receives the setexecutableaftercreation flag originally from openfile:

https://github.com/GitoxideLabs/gitoxide/blob/8d84818240d44e1f5fe78a231b5d9bffd0283918/gix-worktree-state/src/checkout/entry.rs#L288-L293

The file has unrestricted permissions.

finalizeentry is likewise called from checkout::chunk::processdelayedfilterresults.

PoC

1. On a Unix-like system such as GNU/Linux or macOS, create a new project and define its dependencies. While the vulnerability is in gix-worktree-state, this example will use vulnerable code through the gix crate, which exposes it. Run:

sh cargo new checkout-index cd checkout-index cargo add gix gix-object

2. In the checkout-index directory, edit src/main.rs so that its entire contents are:

rust fn main() -> Result<(), Box<dyn std::error::Error>> { let repo = gix::discover("has-executable")?; let mut index = repo.openindex()?; gix::worktree::state::checkout( &mut index, repo.workdir().okor("need non-bare repo")?, gixobject::find::Never, // Can also use: repo.objects.clone() &gix::progress::Discard, &gix::progress::Discard, &Default::default(), Default::default(), )?; Ok(()) }

3. Create the test repository that the vulnerable program will operate on. Still in the checkout-index directory, run:

sh git init has-executable touch has-executable/a has-executable/b chmod +x has-executable/b git -C has-executable add .

It is not necessary to commit the changes, only to stage them, since the test program will check out the index.

4. Optionally, run rm has-executable/[ab] to remove the staged files from disk.

5. Run the program by issuing cargo run. The program uses gix-worktree-state to check out the index. It should terminate successfully and not issue any errors.

6. Run ls -l has-executable to inspect the permissions of the checked out files. Observe that owner, group, and other all have read, write, and execute permissions on b.

text -rw-r--r-- 1 ek ek 0 Jan 9 03:38 a -rwxrwxrwx 1 ek ek 0 Jan 9 03:38 b

With affected versions of gix-worktree-state, the output shows -rwxrwxrwx for b, whether the files were removed in step 4 or not.

7. It was not necessary to set destinationisinitiallyempty to false explicitly to trigger the bug, because that is its default value. If desired, modify the program to pass true and rerun the experiment to verify that b is no longer created with excessive permissions. The modified program would change the last checkout argument from Default::default(), to:

rust gix::worktree::state::checkout::Options { destinationisinitiallyempty: true, ..Default::default() },

Impact

Setting unlimited file permissions is a problem on systems where a user account exists on the system that should not have the ability to access and modify the files. That applies to multi-user systems, or when an account is used to run software with reduced abilities. (Some programs may also treat broad write permissions to mean less validation is required.)

This bug affects Unix-like systems but not Windows. The gix clone command is not believed to be affected, due to checkoutexclusive's use of destinationisinitiallyempty: true. Specialized uses in which repositories are known never to have any files marked executable are unaffected. Repositories that no untrusted users can access, due to not having the ability to traverse the directories to them or due to sufficiently restrictive ACLs, are likewise unaffected.

The default value of destinationisinitiallyempty is false, so some applications may be affected even if they don't attempt checkouts in nonempty directories. The 0777 permissions are applied to files that are created earlier in the same checkout, as well as those that already existed, regardless of their prior permissions. On preexisting files, 0777 is set even if overwriteexisting is false, as that prevents the checkout from changing file contents but not permissions.

Files not tracked/staged as executable are not checked out with insecure permissions. Such a file that previously existed keeps its old permissions. However, this may include executable permissions that no longer match repository metadata, as well as undesired write permissions acquired from a previous vulnerable checkout. setmode(0o777) clears other bits, so the bug is not exacerbated by the presence of setuid/setgid bits. In some applications, the vulnerable strategy may be used only for files rewritten by a long running smudge filter or only in the presence of delays.

1 / 2
Source: GitHub
First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203