REDHAT-BUG-2520693: High severity libgit2 libgit2 vulnerability
libgit2 is a portable C implementation of the Git core methods provided as a linkable library with a solid API, allowing to build Git functionality into your application. Prior to 1.8.6 and 1.9.5, libgit2 performs a fixed-size strncmp in setdata in src/libgit2/transports/smartpkt.c without first verifying that the smart-protocol pkt-line capability buffer contains 14 bytes. A malicious Git server can make bytes after the pkt-line complete object-format=, causing formatstr to advance beyond the pkt-line and the following memchr length calculation to underflow. The resulting heap out-of-bounds walk can crash a client during the first refs-advertisement packet over HTTP, HTTPS, SSH, or the Git protocol. This issue is fixed in versions 1.8.6 and 1.9.5.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
libgit2to a version that resolves this vulnerability.Fixed in 1.8.6 - Upgrade
Upgrade
libgit2to a version that resolves this vulnerability.Fixed in 1.9.5
Event History
Frequently Asked Questions
Which client operations are exposed to this issue?
Clients using affected libgit2 versions can be crashed when they receive the first refs-advertisement packet from a malicious Git server. The affected transports are HTTP, HTTPS, SSH, and the Git protocol.
What does an attacker need to exploit the vulnerability?
An attacker needs to operate or control a Git server that a vulnerable client connects to. They must send a malformed smart-protocol pkt-line capability value during the initial refs advertisement.
Is this limited to a specific libgit2 release line?
The issue affects libgit2 versions prior to 1.8.6 and prior to 1.9.5. Updating to 1.8.6 or 1.9.5 addresses the flaw.
What is the expected impact of a successful attack?
The malformed packet can trigger a heap out-of-bounds walk and crash the client. The provided information describes a denial-of-service impact.