Skip to content

Commit 35ed337

Browse files
[AUTO-CHERRYPICK] Fix CVE-2024-53263 in git-lfs - branch main (#12115)
Co-authored-by: Rohit Rawat <[email protected]>
1 parent ca99dab commit 35ed337

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

SPECS/git-lfs/CVE-2024-53263.patch

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 52f3cb58093cdccffd87af9c97fd4ba61a0b848d Mon Sep 17 00:00:00 2001
2+
From: Rohit Rawat <[email protected]>
3+
Date: Mon, 27 Jan 2025 12:36:21 +0000
4+
Subject: [PATCH] Fix CVE-2024-53263
5+
6+
Backported from https://github.com/git-lfs/git-lfs/commit/0345b6f816e611d050c0df67b61f0022916a1c90
7+
8+
---
9+
creds/creds.go | 12 +++++++++---
10+
1 file changed, 9 insertions(+), 3 deletions(-)
11+
12+
diff --git a/creds/creds.go b/creds/creds.go
13+
index 0cc6762..f4e1432 100644
14+
--- a/creds/creds.go
15+
+++ b/creds/creds.go
16+
@@ -53,11 +53,14 @@ func (credWrapper *CredentialHelperWrapper) FillCreds() error {
17+
// as input.
18+
type Creds map[string][]string
19+
20+
-func bufferCreds(c Creds) *bytes.Buffer {
21+
+func bufferCreds(c Creds) (*bytes.Buffer, error) {
22+
buf := new(bytes.Buffer)
23+
24+
for k, v := range c {
25+
for _, item := range v {
26+
+ if strings.Contains(item, "\n") {
27+
+ return nil, errors.Errorf(tr.Tr.Get("credential value for %s contains newline: %q", k, item))
28+
+ }
29+
buf.Write([]byte(k))
30+
buf.Write([]byte("="))
31+
buf.Write([]byte(item))
32+
@@ -65,7 +68,7 @@ func bufferCreds(c Creds) *bytes.Buffer {
33+
}
34+
}
35+
36+
- return buf
37+
+ return buf, nil
38+
}
39+
40+
type CredentialHelperContext struct {
41+
@@ -323,7 +326,10 @@ func (h *commandCredentialHelper) exec(subcommand string, input Creds) (Creds, e
42+
if err != nil {
43+
return nil, errors.New(tr.Tr.Get("failed to find `git credential %s`: %v", subcommand, err))
44+
}
45+
- cmd.Stdin = bufferCreds(input)
46+
+ cmd.Stdin, err = bufferCreds(input)
47+
+ if err != nil {
48+
+ return nil, errors.New(tr.Tr.Get("invalid input to `git credential %s`: %v", subcommand, err))
49+
+ }
50+
cmd.Stdout = output
51+
/*
52+
There is a reason we don't read from stderr here:
53+
--
54+
2.40.4
55+

SPECS/git-lfs/git-lfs.spec

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: Git extension for versioning large files
33
Name: git-lfs
44
Version: 3.5.1
5-
Release: 3%{?dist}
5+
Release: 4%{?dist}
66
Group: System Environment/Programming
77
Vendor: Microsoft Corporation
88
Distribution: Mariner
@@ -29,6 +29,7 @@ Source0: https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz#/%{
2929
# - For the value of "--mtime" use the date "2021-04-26 00:00Z" to simplify future updates.
3030
Source1: %{name}-%{version}-vendor.tar.gz
3131
Patch0: CVE-2023-45288.patch
32+
Patch1: CVE-2024-53263.patch
3233

3334
BuildRequires: golang
3435
BuildRequires: which
@@ -79,6 +80,9 @@ git lfs uninstall
7980
%{_mandir}/man5/*
8081

8182
%changelog
83+
* Mon Jan 27 2025 Rohit Rawat <[email protected]> - 3.5.1-4
84+
- Add patch for CVE-2024-53263
85+
8286
* Mon Sep 09 2024 CBL-Mariner Servicing Account <[email protected]> - 3.5.1-3
8387
- Bump release to rebuild with go 1.22.7
8488

0 commit comments

Comments
 (0)