Bug 2162055 (CVE-2022-23521) - CVE-2022-23521 git: gitattributes parsing integer overflow
Summary: CVE-2022-23521 git: gitattributes parsing integer overflow
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2022-23521
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2162059 2162060 2162061 2162062 2162063 2162064 2162065 2162066 2162067 2162068 2162069 2162070 2162071 2184001
Blocks: 2161783
TreeView+ depends on / blocked
 
Reported: 2023-01-18 17:01 UTC by Sandipan Roy
Modified: 2023-04-10 01:30 UTC (History)
25 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in Git, a distributed revision control system. When parsing gitattributes, a mechanism to allow defining attributes for paths, multiple integer overflows can occur when there is a huge number of path patterns, attributes for a single pattern, or declared attribute names. 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 allow remote code execution.
Clone Of:
Environment:
Last Closed: 2023-02-10 03:36:53 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2023:0614 0 None None None 2023-02-07 01:23:56 UTC
Red Hat Product Errata RHBA-2023:0615 0 None None None 2023-02-07 01:24:20 UTC
Red Hat Product Errata RHBA-2023:0619 0 None None None 2023-02-07 14:08:27 UTC
Red Hat Product Errata RHBA-2023:0636 0 None None None 2023-02-07 19:48:19 UTC
Red Hat Product Errata RHBA-2023:0694 0 None None None 2023-02-09 05:20:20 UTC
Red Hat Product Errata RHBA-2023:0695 0 None None None 2023-02-09 05:20:46 UTC
Red Hat Product Errata RHBA-2023:0703 0 None None None 2023-02-09 10:10:08 UTC
Red Hat Product Errata RHBA-2023:0704 0 None None None 2023-02-09 10:08:09 UTC
Red Hat Product Errata RHBA-2023:1022 0 None None None 2023-02-28 18:24:06 UTC
Red Hat Product Errata RHBA-2023:1051 0 None None None 2023-03-02 08:50:26 UTC
Red Hat Product Errata RHBA-2023:1078 0 None None None 2023-03-06 15:20:05 UTC
Red Hat Product Errata RHBA-2023:1249 0 None None None 2023-03-15 12:26:35 UTC
Red Hat Product Errata RHBA-2023:1353 0 None None None 2023-03-20 15:34:00 UTC
Red Hat Product Errata RHBA-2023:1374 0 None None None 2023-03-21 12:56:59 UTC
Red Hat Product Errata RHSA-2023:0596 0 None None None 2023-02-06 16:42:07 UTC
Red Hat Product Errata RHSA-2023:0597 0 None None None 2023-02-06 16:37:14 UTC
Red Hat Product Errata RHSA-2023:0599 0 None None None 2023-02-06 16:42:18 UTC
Red Hat Product Errata RHSA-2023:0609 0 None None None 2023-02-06 19:36:29 UTC
Red Hat Product Errata RHSA-2023:0610 0 None None None 2023-02-06 19:45:55 UTC
Red Hat Product Errata RHSA-2023:0611 0 None None None 2023-02-06 19:39:23 UTC
Red Hat Product Errata RHSA-2023:0627 0 None None None 2023-02-07 15:39:44 UTC
Red Hat Product Errata RHSA-2023:0628 0 None None None 2023-02-07 15:47:48 UTC
Red Hat Product Errata RHSA-2023:0978 0 None None None 2023-02-28 09:19:55 UTC
Red Hat Product Errata RHSA-2023:1677 0 None None None 2023-04-10 01:30:27 UTC

Description Sandipan Roy 2023-01-18 17:01:17 UTC
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.

https://github.com/git/git/security/advisories/GHSA-c738-c5qq-xg89
https://github.com/git/git/commit/508386c6c5857b4faa2c3e491f422c98cc69ae76

Comment 1 Sandipan Roy 2023-01-18 17:24:49 UTC
Created git tracking bugs for this issue:

Affects: fedora-36 [bug 2162065]
Affects: fedora-37 [bug 2162066]

Comment 5 Wadeck 2023-02-03 10:46:14 UTC
Hello there,

If it's not the correct location for this comment, please redirect me to a better place ;-)

Do you have any ETA about the availability of the fix in the affected lines of your Docker images?

UBI 7-9 are affected since more than 2 weeks, usually you are providing the corrections in a very reactive (and appreciated) way, making this one a bit weird (along with CVE-2022-41903).
Also I saw that the score was moving from Critical to High and now back to Critical.

In the meantime, do you have a workaround recommendation?

Wadeck

Comment 9 errata-xmlrpc 2023-02-06 16:37:12 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7

Via RHSA-2023:0597 https://access.redhat.com/errata/RHSA-2023:0597

Comment 10 errata-xmlrpc 2023-02-06 16:42:05 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.4 Extended Update Support

Via RHSA-2023:0596 https://access.redhat.com/errata/RHSA-2023:0596

Comment 11 errata-xmlrpc 2023-02-06 16:42:15 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.1 Update Services for SAP Solutions

Via RHSA-2023:0599 https://access.redhat.com/errata/RHSA-2023:0599

Comment 12 errata-xmlrpc 2023-02-06 19:36:27 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Advanced Update Support
  Red Hat Enterprise Linux 8.2 Update Services for SAP Solutions
  Red Hat Enterprise Linux 8.2 Telecommunications Update Service

Via RHSA-2023:0609 https://access.redhat.com/errata/RHSA-2023:0609

Comment 13 errata-xmlrpc 2023-02-06 19:39:21 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2023:0611 https://access.redhat.com/errata/RHSA-2023:0611

Comment 14 errata-xmlrpc 2023-02-06 19:45:53 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2023:0610 https://access.redhat.com/errata/RHSA-2023:0610

Comment 15 errata-xmlrpc 2023-02-07 15:39:41 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.0 Extended Update Support

Via RHSA-2023:0627 https://access.redhat.com/errata/RHSA-2023:0627

Comment 16 errata-xmlrpc 2023-02-07 15:47:46 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.6 Extended Update Support

Via RHSA-2023:0628 https://access.redhat.com/errata/RHSA-2023:0628

Comment 17 Product Security DevOps Team 2023-02-10 03:36:49 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2022-23521

Comment 18 errata-xmlrpc 2023-02-28 09:19:53 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2023:0978 https://access.redhat.com/errata/RHSA-2023:0978

Comment 20 errata-xmlrpc 2023-04-10 01:30:24 UTC
This issue has been addressed in the following products:

  Red Hat Virtualization 4 for Red Hat Enterprise Linux 8

Via RHSA-2023:1677 https://access.redhat.com/errata/RHSA-2023:1677


Note You need to log in before you can comment on or make changes to this bug.