Skip to content
OpenAdvisories
High ALAS2023-2023-065 6 CVEs

Important: git security update (Amazon Linux 2023)

Published Feb 17, 2023 · Updated Feb 22, 2023

Summary

Package updates are available for Amazon Linux 2023 that fix the following vulnerabilities: CVE-2022-41903: 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()`. 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. This integer overflow can result in arbitrary heap writes, which may result in arbitrary code execution. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. Users who are unable to upgrade should disable `git archive` in untrusted repositories. If you expose git archive via `git daemon`, disable it by running `git config --global daemon.uploadArch false`. CVE-2022-39260: Git is an open source, scalable, distributed revision control system. git shell is a restricted login shell that can be used to implement Git's push/pull functionality via SSH. In versions prior to 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and 2.37.4, the function that splits the command arguments into an array improperly uses an int to represent the number of entries in the array, allowing a malicious actor to intentionally overflow the return value, leading to arbitrary heap writes. Because the resulting array is then passed to execv(), it is possible to leverage this attack to gain remote code execution on a victim machine. Note that a victim must first allow access to git shell as a login shell in order to be vulnerable to this attack. This problem is patched in versions 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and 2.37.4 and users are advised to upgrade to the latest version. Disabling git shell access via remote logins is a viable short-term workaround. CVE-2022-39253: Git is an open source, scalable, distributed revision control system. Versions prior to 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and 2.37.4 are subject to exposure of sensitive information to a malicious actor. When performing a local clone (where the source and target of the clone are on the same volume), Git copies the contents of the source's /objects directory into the destination by either creating hardlinks to the source contents, or copying them (if hardlinks are disabled via --no-hardlinks). A malicious actor could convince a victim to clone a repository with a symbolic link pointing at sensitive information on the victim's machine. This can be done either by having the victim clone a malicious repository on the same machine, or having them clone a malicious repository embedded as a bare repository via a submodule from any source, provided they clone with the --recurse-submodules option. Git does not create symbolic links in the /objects directory. The problem has been patched in the versions published on 2022-10-18, and backported to v2.30.x. Potential workarounds: Avoid cloning untrusted repositories using the --local optimization when on a shared machine, either by passing the --no-local option to git clone or cloning from a URL that uses the file:// scheme. Alternatively, avoid cloning repositories from untrusted sources with --recurse-submodules or run git config --global protocol.file.allow user. CVE-2022-29187: A vulnerability was found in Git. This flaw occurs due to Git not checking the ownership of directories in a local multi-user system when running commands specified in the local repository configuration. This issue allows the owner of the repository to cause arbitrary commands to be executed by other users who access the repository. CVE-2022-24765: A vulnerability was found in Git. This flaw occurs due to Git not checking the ownership of directories in a local multi-user system when running commands specified in the local repository configuration. This allows the owner of the repository to cause arbitrary commands to be executed by other users who access the repository. CVE-2022-23521: 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. 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. The problem has been patched in the versions published on 2023-01-17, going back to v2.30.7. Users are advised to upgrade. There are no known workarounds for this issue.

Fixed packages 22

ReleasePackageFixed in
Amazon Linux · 2023 git 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-all 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-core 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-core-debuginfo 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-core-doc 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-credential-libsecret 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-credential-libsecret-debuginfo 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-cvs 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-daemon 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-daemon-debuginfo 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-debuginfo 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-debugsource 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-email 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-gui 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-instaweb 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-p4 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-subtree 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 git-svn 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 gitk 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 gitweb 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 perl-Git 0:2.39.1-1.amzn2023.0.2
Amazon Linux · 2023 perl-Git-SVN 0:2.39.1-1.amzn2023.0.2

Vulnerabilities 6

  • Critical 9.8
    CVE-2022-23521 EPSS 56%

    gitattributes parsing integer overflow in git

    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 tha…

  • Critical 9.8
    CVE-2022-41903 Public exploit EPSS 44%

    Integer overflow in `git archive`, `git log --format` leading to RCE 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, t…

  • High 8.5

    Git vulnerable to Remote Code Execution via Heap overflow in `git shell`

    Git is an open source, scalable, distributed revision control system. `git shell` is a restricted login shell that can be used to implement Git's push/pull functionality via SSH. In versions prior to 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and…

  • High 7.8

    Bypass of safe.directory protections in Git

    Git is a distributed revision control system. Git prior to versions 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5, is vulnerable to privilege escalation in all platforms. An unsuspecting user could still be affected by the issue reported …

  • Medium 6.0
    CVE-2022-24765 Public exploit

    Uncontrolled search for the Git directory in Git for Windows

    Git for Windows is a fork of Git containing Windows-specific patches. This vulnerability affects users working on multi-user machines, where untrusted parties have write access to the same hard disk. Those untrusted parties could create the folder `C:\.git`, …

  • Medium 5.5
    CVE-2022-39253 Public exploit

    Git subject to exposure of sensitive information via local clone of symbolic links

    Git is an open source, scalable, distributed revision control system. Versions prior to 2.30.6, 2.31.5, 2.32.4, 2.33.5, 2.34.5, 2.35.5, 2.36.3, and 2.37.4 are subject to exposure of sensitive information to a malicious actor. When performing a local clone (wh…

References

  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-23521.html
  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-24765.html
  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-29187.html
  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-39253.html
  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-39260.html
  • web
    https://alas.aws.amazon.com/cve/html/CVE-2022-41903.html