Skip to content

Commit 1876aa2

Browse files
[AUTO-CHERRYPICK] Fix CVE-2023-44487 in local-path-provisioner - branch 3.0-dev (#12812)
Co-authored-by: corvus-callidus <[email protected]>
1 parent 2751334 commit 1876aa2

File tree

2 files changed

+83
-2
lines changed

2 files changed

+83
-2
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From a0fd4b065528566eec54fe207aa5e3131babc378 Mon Sep 17 00:00:00 2001
2+
From: Monis Khan <[email protected]>
3+
Date: Sat, 7 Oct 2023 21:50:37 -0400
4+
Subject: [PATCH] Prevent rapid reset http2 DOS on API server
5+
6+
This change fully addresses CVE-2023-44487 and CVE-2023-39325 for
7+
the API server when the client is unauthenticated.
8+
9+
The changes to util/runtime are required because otherwise a large
10+
number of requests can get blocked on the time.Sleep calls.
11+
12+
For unauthenticated clients (either via 401 or the anonymous user),
13+
we simply no longer allow such clients to hold open http2
14+
connections. They can use http2, but with the performance of http1
15+
(with keep-alive disabled).
16+
17+
Since this change has the potential to cause issues, the
18+
UnauthenticatedHTTP2DOSMitigation feature gate can be disabled to
19+
remove this protection (it is enabled by default). For example,
20+
when the API server is fronted by an L7 load balancer that is set up
21+
to mitigate http2 attacks, unauthenticated clients could force
22+
disable connection reuse between the load balancer and the API
23+
server (many incoming connections could share the same backend
24+
connection). An API server that is on a private network may opt to
25+
disable this protection to prevent performance regressions for
26+
unauthenticated clients.
27+
28+
For all other clients, we rely on the golang.org/x/net fix in
29+
https://github.com/golang/net/commit/b225e7ca6dde1ef5a5ae5ce922861bda011cfabd
30+
That change is not sufficient to adequately protect against a
31+
motivated client - future changes to Kube and/or golang.org/x/net
32+
will be explored to address this gap.
33+
34+
The Kube API server now uses a max stream of 100 instead of 250
35+
(this matches the Go http2 client default). This lowers the abuse
36+
limit from 1000 to 400.
37+
38+
Signed-off-by: Monis Khan <[email protected]>
39+
40+
Modified-by: corvus-callidus <[email protected]>
41+
- Adjust paths to apply to AzL3 package source
42+
- Remove runtime_test.go portion of patch since AzL3 package source doesn't
43+
contain that file
44+
45+
Kubernetes-commit: 800a8eaba7f25bd223fefe6e7613e39a5d7f1eeb
46+
---
47+
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go | 15 +++++++++------
48+
1 files changed, 9 insertions(+), 6 deletions(-)
49+
50+
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
51+
index d738725ca..3674914f7 100644
52+
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
53+
+++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
54+
@@ -126,14 +126,17 @@ type rudimentaryErrorBackoff struct {
55+
// OnError will block if it is called more often than the embedded period time.
56+
// This will prevent overly tight hot error loops.
57+
func (r *rudimentaryErrorBackoff) OnError(error) {
58+
+ now := time.Now() // start the timer before acquiring the lock
59+
r.lastErrorTimeLock.Lock()
60+
- defer r.lastErrorTimeLock.Unlock()
61+
- d := time.Since(r.lastErrorTime)
62+
- if d < r.minPeriod {
63+
- // If the time moves backwards for any reason, do nothing
64+
- time.Sleep(r.minPeriod - d)
65+
- }
66+
+ d := now.Sub(r.lastErrorTime)
67+
r.lastErrorTime = time.Now()
68+
+ r.lastErrorTimeLock.Unlock()
69+
+
70+
+ // Do not sleep with the lock held because that causes all callers of HandleError to block.
71+
+ // We only want the current goroutine to block.
72+
+ // A negative or zero duration causes time.Sleep to return immediately.
73+
+ // If the time moves backwards for any reason, do nothing.
74+
+ time.Sleep(r.minPeriod - d)
75+
}
76+
77+
// GetCaller returns the caller of the function that calls it.

SPECS/local-path-provisioner/local-path-provisioner.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
Summary: Provides a way for the Kubernetes users to utilize the local storage in each node
22
Name: local-path-provisioner
33
Version: 0.0.24
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: ASL 2.0
66
URL: https://github.com/rancher/local-path-provisioner
77
Group: Applications/Text
88
Vendor: Microsoft Corporation
99
Distribution: Azure Linux
1010
Source0: https://github.com/rancher/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
11-
#Note that the source file should be renamed to the format {name}-%{version}.tar.gz
11+
#Note that the source file should be renamed to the format {name}-%%{version}.tar.gz
1212
Patch0: CVE-2023-45288.patch
1313
Patch1: CVE-2023-39325.patch
14+
Patch2: CVE-2023-44487.patch
1415
BuildRequires: golang
1516

1617
%description
@@ -31,6 +32,9 @@ install local-path-provisioner %{buildroot}%{_bindir}/local-path-provisioner
3132
%{_bindir}/local-path-provisioner
3233

3334
%changelog
35+
* Tue Mar 04 2025 corvus-callidus <[email protected]> - 0.0.24-4
36+
* Address CVE-2023-44487
37+
3438
* Fri Feb 14 2025 Kanishk Bansal <[email protected]> - 0.0.24-3
3539
- Address CVE-2023-45288, CVE-2023-39325
3640

0 commit comments

Comments
 (0)