CVE-2023-29007: Arbitrary configuration injection via `git submodule deinit`
A vulnerability was found in Git. This security flaw occurs when renaming or deleting a section from a configuration file, where certain malicious configuration values may be misinterpreted as the beginning of a new configuration section. This flaw leads to arbitrary configuration injection.
Other sources
CVE-2023-29007 When renaming or deleting a section from a configuration file,certain malicious configuration values may be misinterpreted as the beginning of a new configuration section, leading to arbitrary configuration injection.
— Red Hat
Git could provide weaker than expected security, caused by a configuration injection flaw. A remote attacker could exploit this vulnerability to launch further attacks on the system.
— IBM
Git is a revision control system. Prior to versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1, a specially crafted .gitmodules file with submodule URLs that are longer than 1024 characters can used to exploit a bug in config.c::gitconfigcopyorrenamesectioninfile(). This bug can be used to inject arbitrary configuration into a user's $GITDIR/config when attempting to remove the configuration section associated with that submodule. When the attacker injects configuration values which specify executables to run (such as core.pager, core.editor, core.sshCommand, etc.) this can lead to a remote code execution. A fix A fix is available in versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1. As a workaround, avoid running git submodule deinit on untrusted repositories or without prior inspection of any submodule sections in $GITDIR/config.
GitHub: CVE-2023-29007 Arbitrary configuration injection via git submodule deinit
Affected Software
Remediation
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2023-29007?
CVE-2023-29007 is an arbitrary configuration injection vulnerability in Git that allows exploitation via the 'git submodule deinit' command when handling specially crafted .gitmodules files.
What is the severity of CVE-2023-29007?
The severity of CVE-2023-29007 is high, with a CVSS score of 7.8.
How does CVE-2023-29007 affect Git?
CVE-2023-29007 affects Git versions prior to 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, and 2.40.1.
How can CVE-2023-29007 be exploited?
CVE-2023-29007 can be exploited by providing a specially crafted .gitmodules file with submodule URLs that are longer than 1024 characters when using the 'git submodule deinit' command.
Is there a remedy for CVE-2023-29007?
Yes, upgrading Git to versions 2.30.9, 2.31.8, 2.32.7, 2.33.8, 2.34.8, 2.35.8, 2.36.6, 2.37.7, 2.38.5, 2.39.3, or 2.40.1 will mitigate the vulnerability.