Skip to content

Commit 361ca17

Browse files
[AutoPR- Security] Patch kubernetes for CVE-2025-65637, CVE-2025-13281 [MEDIUM] (#15301)
Co-authored-by: Archana Shettigar <v-shettigara@microsoft.com>
1 parent a60fa8b commit 361ca17

File tree

3 files changed

+298
-1
lines changed

3 files changed

+298
-1
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
From d18f6f8ba355fc300aab99fe64ab7ebf73ccdf68 Mon Sep 17 00:00:00 2001
2+
From: Ankit Gohil <agohil@purestorage.com>
3+
Date: Mon, 3 Nov 2025 22:38:58 +0000
4+
Subject: [PATCH] Clean up event messages for errors in Portworx in-tree driver
5+
6+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
7+
Upstream-reference: https://github.com/kubernetes/kubernetes/commit/7506ce804c20696ba32cdb72126270ceaed06e24.patch
8+
---
9+
pkg/volume/portworx/portworx.go | 33 +++++++++++++++++++++++++--------
10+
1 file changed, 25 insertions(+), 8 deletions(-)
11+
12+
diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go
13+
index 6b9243f5..4866739b 100644
14+
--- a/pkg/volume/portworx/portworx.go
15+
+++ b/pkg/volume/portworx/portworx.go
16+
@@ -311,8 +311,9 @@ func (b *portworxVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterAr
17+
notMnt, err := b.mounter.IsLikelyNotMountPoint(dir)
18+
klog.Infof("Portworx Volume set up. Dir: %s %v %v", dir, !notMnt, err)
19+
if err != nil && !os.IsNotExist(err) {
20+
- klog.Errorf("Cannot validate mountpoint: %s", dir)
21+
- return err
22+
+ // don't log error details from client calls in events
23+
+ klog.V(4).Infof("Cannot validate mountpoint %s: %v", dir, err)
24+
+ return fmt.Errorf("failed to validate mountpoint: see kube-controller-manager.log for details")
25+
}
26+
if !notMnt {
27+
return nil
28+
@@ -322,7 +323,9 @@ func (b *portworxVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterAr
29+
attachOptions[attachContextKey] = dir
30+
attachOptions[attachHostKey] = b.plugin.host.GetHostName()
31+
if _, err := b.manager.AttachVolume(b, attachOptions); err != nil {
32+
- return err
33+
+ // don't log error details from client calls in events
34+
+ klog.V(4).Infof("Failed to attach volume %s: %v", b.volumeID, err)
35+
+ return fmt.Errorf("failed to attach volume: see kube-controller-manager.log for details")
36+
}
37+
38+
klog.V(4).Infof("Portworx Volume %s attached", b.volumeID)
39+
@@ -332,7 +335,9 @@ func (b *portworxVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterAr
40+
}
41+
42+
if err := b.manager.MountVolume(b, dir); err != nil {
43+
- return err
44+
+ // don't log error details from client calls in events
45+
+ klog.V(4).Infof("Failed to mount volume %s: %v", b.volumeID, err)
46+
+ return fmt.Errorf("failed to mount volume: see kube-controller-manager.log for details")
47+
}
48+
if !b.readOnly {
49+
volume.SetVolumeOwnership(b, dir, mounterArgs.FsGroup, mounterArgs.FSGroupChangePolicy, util.FSGroupCompleteHook(b.plugin, nil))
50+
@@ -363,12 +368,16 @@ func (c *portworxVolumeUnmounter) TearDownAt(dir string) error {
51+
klog.Infof("Portworx Volume TearDown of %s", dir)
52+
53+
if err := c.manager.UnmountVolume(c, dir); err != nil {
54+
- return err
55+
+ // don't log error details from client calls in events
56+
+ klog.V(4).Infof("Failed to unmount volume %s: %v", c.volumeID, err)
57+
+ return fmt.Errorf("failed to unmount volume: see kube-controller-manager.log for details")
58+
}
59+
60+
// Call Portworx Detach Volume.
61+
if err := c.manager.DetachVolume(c); err != nil {
62+
- return err
63+
+ // don't log error details from client calls in events
64+
+ klog.V(4).Infof("Failed to detach volume %s: %v", c.volumeID, err)
65+
+ return fmt.Errorf("failed to detach volume: see kube-controller-manager.log for details")
66+
}
67+
68+
return nil
69+
@@ -385,7 +394,13 @@ func (d *portworxVolumeDeleter) GetPath() string {
70+
}
71+
72+
func (d *portworxVolumeDeleter) Delete() error {
73+
- return d.manager.DeleteVolume(d)
74+
+ err := d.manager.DeleteVolume(d)
75+
+ if err != nil {
76+
+ // don't log error details from client calls in events
77+
+ klog.V(4).Infof("Failed to delete volume %s: %v", d.volumeID, err)
78+
+ return fmt.Errorf("failed to delete volume: see kube-controller-manager.log for details")
79+
+ }
80+
+ return nil
81+
}
82+
83+
type portworxVolumeProvisioner struct {
84+
@@ -406,7 +421,9 @@ func (c *portworxVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopo
85+
86+
volumeID, sizeGiB, labels, err := c.manager.CreateVolume(c)
87+
if err != nil {
88+
- return nil, err
89+
+ // don't log error details from client calls in events
90+
+ klog.V(4).Infof("Failed to create volume: %v", err)
91+
+ return nil, fmt.Errorf("failed to create volume: see kube-controller-manager.log for details")
92+
}
93+
94+
pv := &v1.PersistentVolume{
95+
--
96+
2.45.4
97+
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
From a78e87c21580bd4264706f21e2cac6369757ee73 Mon Sep 17 00:00:00 2001
2+
From: Chris <straight.chris@gmail.com>
3+
Date: Fri, 10 Mar 2023 13:45:41 -0800
4+
Subject: [PATCH 1/2] This commit fixes a potential denial of service
5+
vulnerability in logrus.Writer() that could be triggered by logging text
6+
longer than 64kb without newlines. Previously, the bufio.Scanner used by
7+
Writer() would hang indefinitely when reading such text without newlines,
8+
causing the application to become unresponsive.
9+
10+
Upstream Reference : https://github.com/sirupsen/logrus/commit/766cfece3701d0b1737681ffb5e6e40b628b664d.patch
11+
---
12+
vendor/github.com/sirupsen/logrus/writer.go | 33 ++++++++++++++++++++-
13+
1 file changed, 32 insertions(+), 1 deletion(-)
14+
15+
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
16+
index 72e8e3a1..36032d06 100644
17+
--- a/vendor/github.com/sirupsen/logrus/writer.go
18+
+++ b/vendor/github.com/sirupsen/logrus/writer.go
19+
@@ -4,6 +4,7 @@ import (
20+
"bufio"
21+
"io"
22+
"runtime"
23+
+ "strings"
24+
)
25+
26+
// Writer at INFO level. See WriterLevel for details.
27+
@@ -20,15 +21,18 @@ func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
28+
return NewEntry(logger).WriterLevel(level)
29+
}
30+
31+
+// Writer returns an io.Writer that writes to the logger at the info log level
32+
func (entry *Entry) Writer() *io.PipeWriter {
33+
return entry.WriterLevel(InfoLevel)
34+
}
35+
36+
+// WriterLevel returns an io.Writer that writes to the logger at the given log level
37+
func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
38+
reader, writer := io.Pipe()
39+
40+
var printFunc func(args ...interface{})
41+
42+
+ // Determine which log function to use based on the specified log level
43+
switch level {
44+
case TraceLevel:
45+
printFunc = entry.Trace
46+
@@ -48,23 +52,50 @@ func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
47+
printFunc = entry.Print
48+
}
49+
50+
+ // Start a new goroutine to scan the input and write it to the logger using the specified print function.
51+
+ // It splits the input into chunks of up to 64KB to avoid buffer overflows.
52+
go entry.writerScanner(reader, printFunc)
53+
+
54+
+ // Set a finalizer function to close the writer when it is garbage collected
55+
runtime.SetFinalizer(writer, writerFinalizer)
56+
57+
return writer
58+
}
59+
60+
+// writerScanner scans the input from the reader and writes it to the logger
61+
func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
62+
scanner := bufio.NewScanner(reader)
63+
+
64+
+ // Set the buffer size to the maximum token size to avoid buffer overflows
65+
+ scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize)
66+
+
67+
+ // Define a split function to split the input into chunks of up to 64KB
68+
+ chunkSize := 64 * 1024 // 64KB
69+
+ splitFunc := func(data []byte, atEOF bool) (int, []byte, error) {
70+
+ if len(data) > chunkSize {
71+
+ return chunkSize, data[:chunkSize], nil
72+
+ }
73+
+ return 0, nil, nil
74+
+ }
75+
+
76+
+ //Use the custom split function to split the input
77+
+ scanner.Split(splitFunc)
78+
+
79+
+ // Scan the input and write it to the logger using the specified print function
80+
for scanner.Scan() {
81+
- printFunc(scanner.Text())
82+
+ printFunc(strings.TrimRight(scanner.Text(), "\r\n"))
83+
}
84+
+
85+
+ // If there was an error while scanning the input, log an error
86+
if err := scanner.Err(); err != nil {
87+
entry.Errorf("Error while reading from Writer: %s", err)
88+
}
89+
+
90+
+ // Close the reader when we are done
91+
reader.Close()
92+
}
93+
94+
+// WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected
95+
func writerFinalizer(writer *io.PipeWriter) {
96+
writer.Close()
97+
}
98+
--
99+
2.45.4
100+
101+
102+
From 2d51c47131bb31ebe41a9fa85552987bb9225a09 Mon Sep 17 00:00:00 2001
103+
From: Chris <straight.chris@gmail.com>
104+
Date: Fri, 10 Mar 2023 13:45:41 -0800
105+
Subject: [PATCH 2/2] Scan text in 64KB chunks
106+
107+
This commit fixes a potential denial of service
108+
vulnerability in logrus.Writer() that could be
109+
triggered by logging text longer than 64KB
110+
without newlines. Previously, the bufio.Scanner
111+
used by Writer() would hang indefinitely when
112+
reading such text without newlines, causing the
113+
application to become unresponsive.
114+
115+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
116+
Upstream-reference: https://github.com/sirupsen/logrus/pull/1376.patch
117+
---
118+
vendor/github.com/sirupsen/logrus/writer.go | 3 ++-
119+
1 file changed, 2 insertions(+), 1 deletion(-)
120+
121+
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
122+
index 36032d06..7e7703c7 100644
123+
--- a/vendor/github.com/sirupsen/logrus/writer.go
124+
+++ b/vendor/github.com/sirupsen/logrus/writer.go
125+
@@ -75,7 +75,8 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...
126+
if len(data) > chunkSize {
127+
return chunkSize, data[:chunkSize], nil
128+
}
129+
- return 0, nil, nil
130+
+
131+
+ return len(data), data, nil
132+
}
133+
134+
//Use the custom split function to split the input
135+
--
136+
2.45.4
137+
138+
From d40e25cd45ed9c6b2b66e6b97573a0413e4c23bd Mon Sep 17 00:00:00 2001
139+
From: Paul Holzinger <pholzing@redhat.com>
140+
Date: Wed, 17 May 2023 15:39:49 +0200
141+
Subject: [PATCH] fix panic in Writer
142+
143+
Commit 766cfece introduced this bug by defining an incorrect split
144+
function. First it breaks the old behavior because it never splits at
145+
newlines now. Second, it causes a panic because it never tells the
146+
scanner to stop. See the bufio.ScanLines function, something like:
147+
```
148+
if atEOF && len(data) == 0 {
149+
return 0, nil, nil
150+
}
151+
```
152+
is needed to do that.
153+
154+
This commit fixes it by restoring the old behavior and calling
155+
bufio.ScanLines but also keep the 64KB check in place to avoid buffering
156+
for to long.
157+
158+
Two tests are added to ensure it is working as expected.
159+
160+
Fixes #1383
161+
Upstream Reference Patch: https://github.com/sirupsen/logrus/commit/d40e25cd45ed9c6b2b66e6b97573a0413e4c23bd.patch
162+
163+
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
164+
---
165+
vendor/github.com/sirupsen/logrus/writer.go | 8 ++++----
166+
1 file changed, 4 insertions(+), 4 deletions(-)
167+
168+
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
169+
index 7e7703c7..074fd4b8 100644
170+
--- a/vendor/github.com/sirupsen/logrus/writer.go
171+
+++ b/vendor/github.com/sirupsen/logrus/writer.go
172+
@@ -70,16 +70,16 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...
173+
scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize)
174+
175+
// Define a split function to split the input into chunks of up to 64KB
176+
- chunkSize := 64 * 1024 // 64KB
177+
+ chunkSize := bufio.MaxScanTokenSize // 64KB
178+
splitFunc := func(data []byte, atEOF bool) (int, []byte, error) {
179+
- if len(data) > chunkSize {
180+
+ if len(data) >= chunkSize {
181+
return chunkSize, data[:chunkSize], nil
182+
}
183+
184+
- return len(data), data, nil
185+
+ return bufio.ScanLines(data, atEOF)
186+
}
187+
188+
- //Use the custom split function to split the input
189+
+ // Use the custom split function to split the input
190+
scanner.Split(splitFunc)
191+
192+
// Scan the input and write it to the logger using the specified print function
193+
--
194+
2.45.4
195+

SPECS/kubernetes/kubernetes.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Summary: Microsoft Kubernetes
1111
Name: kubernetes
1212
Version: 1.28.4
13-
Release: 20%{?dist}
13+
Release: 21%{?dist}
1414
License: ASL 2.0
1515
Vendor: Microsoft Corporation
1616
Distribution: Mariner
@@ -33,6 +33,8 @@ Patch11: CVE-2025-30204.patch
3333
Patch12: CVE-2024-51744.patch
3434
Patch13: CVE-2025-22872.patch
3535
Patch14: CVE-2025-31133.patch
36+
Patch15: CVE-2025-13281.patch
37+
Patch16: CVE-2025-65637.patch
3638
BuildRequires: flex-devel
3739
BuildRequires: glibc-static >= 2.35-7%{?dist}
3840
BuildRequires: golang
@@ -278,6 +280,9 @@ fi
278280
%{_exec_prefix}/local/bin/pause
279281

280282
%changelog
283+
* Tue Dec 16 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.28.4-21
284+
- Patch for CVE-2025-65637, CVE-2025-13281
285+
281286
* Tue Nov 25 2025 Ratiranjan Behera <v-ratbehera@microsoft.com> - 1.28.4-20
282287
- Patch CVE-2025-31133
283288

0 commit comments

Comments
 (0)