Impact
Repositories with submodules can be crafted in a way that exploits a bug in Git whereby it can be fooled into writing files not into the submodule's worktree but into a .git/
directory. This allows writing a hook that will be executed while the clone operation is still running, giving the user no opportunity to inspect the code that is being executed.
Patches
The problem has been patched in the versions published on Tuesday, May 14th, 2024.
Workarounds
If symbolic link support is disabled in Git (e.g. via git config --global core.symlinks false
), the described attack won't work.
As always, it is best to avoid cloning repositories from untrusted sources.
References
Impact
Repositories with submodules can be crafted in a way that exploits a bug in Git whereby it can be fooled into writing files not into the submodule's worktree but into a
.git/
directory. This allows writing a hook that will be executed while the clone operation is still running, giving the user no opportunity to inspect the code that is being executed.Patches
The problem has been patched in the versions published on Tuesday, May 14th, 2024.
Workarounds
If symbolic link support is disabled in Git (e.g. via
git config --global core.symlinks false
), the described attack won't work.As always, it is best to avoid cloning repositories from untrusted sources.
References
git clone --recurse-submodules
core.symlinks