The maintainers of the Git source code version control system urge to update the software to fix two critical vulnerabilities.
The flaws were discovered as part of a security source code audit of the source code version control system sponsored by the OSTIF, which was performed by a team of security experts from X41 and GitLab.
The vulnerabilities can be exploited by a threat actor to achieve remote code execution.
The vulnerabilities impacts versions <= v2.30.6, v2.31.5, v2.32.4, v2.33.5, v2.34.5, v2.35.5, v2.36.3, v2.37.4, v2.38.2, and v2.39.0.
Patched versions include v2.30.7, v2.31.6, v2.32.5, v2.33.6, v2.34.6, v2.35.6, v2.36.4, v2.37.5, v2.38.3, and v2.39.1.
The CVE-2022-41903 is an integer overflow in `git archive`, `git log –format` that can lead to remote code execution in git.
“Git is distributed revision control system. `git log` can display commits in an arbitrary format using its `–format` specifiers. This functionality is also exposed to `git archive` via the `export-subst` gitattribute. When processing the padding operators, there is a integer overflow in `pretty.c::format_and_pad_commit()` where a `size_t` is stored improperly as an `int`, and then added as an offset to a `memcpy()`.” reads the advisory for this issue. “This overflow can be triggered directly by a user running a command which invokes the commit formatting machinery (e.g., `git log –format=…`). It may also be triggered indirectly through git archive via the export-subst mechanism, which expands format specifiers inside of files within the repository during a git archive.”
The maintainers of the preject recommend users who cannot immediately update their install to disable “git archive” in untrusted repositories to mitigate the CVE-2022-41903 flaw.
The second issue, tracked as CVE-2022-23521, is a gitattributes parsing integer overflow.
“Git is distributed revision control system. gitattributes are a mechanism to allow defining attributes for paths. These attributes can be defined by adding a `.gitattributes` file to the repository, which contains a set of file patterns and the attributes that should be set for paths matching this pattern. When parsing gitattributes, multiple integer overflows can occur when there is a huge number of path patterns, a huge number of attributes for a single pattern, or when the declared attribute names are huge.” reads the advisory. “These overflows can be triggered via a crafted `.gitattributes` file that may be part of the commit history. Git silently splits lines longer than 2KB when parsing gitattributes from a file, but not when parsing them from the index. Consequentially, the failure mode depends on whether the file exists in the working tree, the index or both. This integer overflow can result in arbitrary heap reads and writes, which may result in remote code execution.”
“In conclusion, the Git codebase shows several security issues and the sheer size of the codebase makes it challenging to address all potential instances of these issues. The use of safe wrappers can improve the overall security of the software as a short term strategy. As a long term improvement strategy, we recommend to alternate between time-boxed code base refactoring sprints and subsequent security reviews.” concludes the report published by Eric Sesterhenn,and Markus Vervier who discovered the issues.
|[adrotate banner=”9″]||[adrotate banner=”12″]|
(SecurityAffairs – hacking, integer overflow)