Skip to content

Commit c83b0e8

Browse files
authored
git-lfs: upgrade version 3.4.1 -> 3.5.1 to address CVE-2023-39325 & CVE-2023-45288 (#8871)
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
1 parent 48b5197 commit c83b0e8

4 files changed

Lines changed: 102 additions & 7 deletions

File tree

SPECS/git-lfs/CVE-2023-45288.patch

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From 18bc0c1f8e741738490aa0a8415c372db4b20d62 Mon Sep 17 00:00:00 2001
2+
From: Muhammad Falak R Wani <falakreyaz@gmail.com>
3+
Date: Tue, 23 Apr 2024 10:07:19 +0530
4+
Subject: [PATCH] http2: close connections when receiving too many headers
5+
6+
Adapted by @mfrw to apply on vendor directory for v0.17 to drop test
7+
files
8+
9+
Maintaining HPACK state requires that we parse and process
10+
all HEADERS and CONTINUATION frames on a connection.
11+
When a request's headers exceed MaxHeaderBytes, we don't
12+
allocate memory to store the excess headers but we do
13+
parse them. This permits an attacker to cause an HTTP/2
14+
endpoint to read arbitrary amounts of data, all associated
15+
with a request which is going to be rejected.
16+
Set a limit on the amount of excess header frames we
17+
will process before closing a connection.
18+
19+
Thanks to Bartek Nowotarski for reporting this issue.
20+
21+
Fixes CVE-2023-45288
22+
Fixes golang/go#65051
23+
24+
Change-Id: I15df097268df13bb5a9e9d3a5c04a8a141d850f6
25+
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2130527
26+
Reviewed-by: Roland Shoemaker <bracewell@google.com>
27+
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
28+
Reviewed-on: https://go-review.googlesource.com/c/net/+/576155
29+
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
30+
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
31+
Reviewed-by: Than McIntosh <thanm@google.com>
32+
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
33+
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
34+
---
35+
vendor/golang.org/x/net/http2/frame.go | 31 ++++++++++++++++++++++++++
36+
1 file changed, 31 insertions(+)
37+
38+
diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go
39+
index c1f6b90..175c154 100644
40+
--- a/vendor/golang.org/x/net/http2/frame.go
41+
+++ b/vendor/golang.org/x/net/http2/frame.go
42+
@@ -1565,6 +1565,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
43+
if size > remainSize {
44+
hdec.SetEmitEnabled(false)
45+
mh.Truncated = true
46+
+ remainSize = 0
47+
return
48+
}
49+
remainSize -= size
50+
@@ -1577,6 +1578,36 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
51+
var hc headersOrContinuation = hf
52+
for {
53+
frag := hc.HeaderBlockFragment()
54+
+
55+
+ // Avoid parsing large amounts of headers that we will then discard.
56+
+ // If the sender exceeds the max header list size by too much,
57+
+ // skip parsing the fragment and close the connection.
58+
+ //
59+
+ // "Too much" is either any CONTINUATION frame after we've already
60+
+ // exceeded the max header list size (in which case remainSize is 0),
61+
+ // or a frame whose encoded size is more than twice the remaining
62+
+ // header list bytes we're willing to accept.
63+
+ if int64(len(frag)) > int64(2*remainSize) {
64+
+ if VerboseLogs {
65+
+ log.Printf("http2: header list too large")
66+
+ }
67+
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
68+
+ // but the struture of the server's frame writer makes this difficult.
69+
+ return nil, ConnectionError(ErrCodeProtocol)
70+
+ }
71+
+
72+
+ // Also close the connection after any CONTINUATION frame following an
73+
+ // invalid header, since we stop tracking the size of the headers after
74+
+ // an invalid one.
75+
+ if invalid != nil {
76+
+ if VerboseLogs {
77+
+ log.Printf("http2: invalid header: %v", invalid)
78+
+ }
79+
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
80+
+ // but the struture of the server's frame writer makes this difficult.
81+
+ return nil, ConnectionError(ErrCodeProtocol)
82+
+ }
83+
+
84+
if _, err := hdec.Write(frag); err != nil {
85+
return nil, ConnectionError(ErrCodeCompression)
86+
}
87+
--
88+
2.40.1
89+
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Signatures": {
3-
"git-lfs-3.4.1-vendor.tar.gz": "a7b525a15b71a92ab789853a172345a4e4815de71ebe3486d5b843651b74cf1e",
4-
"git-lfs-3.4.1.tar.gz": "2a36239d7968ae18e1ba2820dc664c4ef753f10bf424f98bccaf44d527f19a17"
3+
"git-lfs-3.5.1-vendor.tar.gz": "ebe825559dba3bdc835ad510ed8c3468c9933f945086406a4ec6b79fd31bc104",
4+
"git-lfs-3.5.1.tar.gz": "d682a12c0bc48d08d28834dd0d575c91d53dd6c6db63c45c2db7c3dd2fb69ea4"
55
}
6-
}
6+
}

SPECS/git-lfs/git-lfs.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%global debug_package %{nil}
22
Summary: Git extension for versioning large files
33
Name: git-lfs
4-
Version: 3.4.1
4+
Version: 3.5.1
55
Release: 1%{?dist}
66
Group: System Environment/Programming
77
Vendor: Microsoft Corporation
@@ -28,6 +28,7 @@ Source0: https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz#/%{
2828
# See: https://reproducible-builds.org/docs/archives/
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
31+
Patch0: CVE-2023-45288.patch
3132

3233
BuildRequires: golang
3334
BuildRequires: which
@@ -41,10 +42,11 @@ Requires: git
4142
Git LFS is a command line extension and specification for managing large files with Git
4243

4344
%prep
44-
%autosetup
45+
%autosetup -N
4546

4647
%build
4748
tar --no-same-owner -xf %{SOURCE1}
49+
%autopatch -p1
4850
export GOPATH=%{our_gopath}
4951
export GOFLAGS="-buildmode=pie -trimpath -mod=vendor -modcacherw -ldflags=-linkmode=external"
5052
go generate ./commands
@@ -77,6 +79,10 @@ git lfs uninstall
7779
%{_mandir}/man5/*
7880

7981
%changelog
82+
* Tue Apr 23 2024 Muhammad Falak <mwani@microsoft.com> - 3.5.1-1
83+
- Bump version to 3.5.1 to address CVE-2023-39325
84+
- Introduce patch to address CVE-2023-45288
85+
8086
* Thu Apr 18 2024 Andrew Phelps <anphel@microsoft.com> - 3.4.1-1
8187
- Bump version to 3.4.1 based on AZL3 spec
8288
- Add BR on asciidoctor & drop un-needed BR

cgmanifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4290,8 +4290,8 @@
42904290
"type": "other",
42914291
"other": {
42924292
"name": "git-lfs",
4293-
"version": "3.4.1",
4294-
"downloadUrl": "https://github.com/git-lfs/git-lfs/archive/v3.4.1.tar.gz"
4293+
"version": "3.5.1",
4294+
"downloadUrl": "https://github.com/git-lfs/git-lfs/archive/v3.5.1.tar.gz"
42954295
}
42964296
}
42974297
},

0 commit comments

Comments
 (0)