Go-git is an incredibly versatile and high-performance Git implementation library written in pure Go. It is designed to be extensible and fill various use cases, from a simple interface for Git repositories to complex implementations that require complete control over the Git process. Nonetheless, even the most robust libraries can have their vulnerabilities – and go-git is no exception.
Recently, a denial of service (DoS) vulnerability has been discovered in go-git versions prior to v5.13. This vulnerability has been assigned the CVE identifier CVE-2025-21614. If you are using go-git between version 4 and above, it is highly recommended to upgrade to version 5.13 to safeguard your application from potential attacks.
Vulnerability Details
The vulnerability allows an attacker to perform DoS attacks by providing specially crafted responses from a Git server, which in turn triggers resource exhaustion in go-git clients. This would prevent the client application from functioning as intended, ultimately leading to a denial of service.
Here's an example of code snippet that uses the go-git library
import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/storage/memory"
)
func main() {
_, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
URL: "https://example.com/repo.git";,
})
if err != nil {
// Handle error
}
}
In this example, if the Git server at "https://example.com/repo.git" sends a malicious response, it could trigger the DoS vulnerability in the go-git client.
Mitigation
The vulnerability has been fixed in version v5.13 of the go-git library. You should upgrade your go-git dependent application to v5.13 by running the following command:
go get -u github.com/go-git/go-git/v5
This will update your go-git library to the latest version and help mitigate the vulnerability.
You can also find the official release notes via the go-git releases page on GitHub, which provides details about the fix and associated changes in the library.
Conclusion
Even though the go-git library is widely known for its extensibility and efficiency, it is essential to keep your dependencies up-to-date to ensure the security of your applications. By upgrading to version v5.13, users can better protect their systems from the CVE-2025-21614 DoS vulnerability. As a general reminder, always stay informed about security updates and patches for all your software dependencies to maintain a secure and robust environment.
Timeline
Published on: 01/06/2025 17:15:47 UTC