Skip to content

Commit dffc563

Browse files
CBL-Mariner-Botazurelinux-securityjslobodzian
authored
Merge PR "[AUTO-CHERRYPICK] [AutoPR- Security] Patch flannel for CVE-2025-65637 [HIGH] - branch main" #15317
Co-authored-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent b10e116 commit dffc563

2 files changed

Lines changed: 141 additions & 1 deletion

File tree

SPECS/flannel/CVE-2025-65637.patch

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
From 0929ddaa205e193f744d6b023dd882d583d9122c 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+
---
11+
vendor/github.com/sirupsen/logrus/writer.go | 33 ++++++++++++++++++++-
12+
1 file changed, 32 insertions(+), 1 deletion(-)
13+
14+
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
15+
index 7bdebed..d50ce9c 100644
16+
--- a/vendor/github.com/sirupsen/logrus/writer.go
17+
+++ b/vendor/github.com/sirupsen/logrus/writer.go
18+
@@ -4,6 +4,7 @@ import (
19+
"bufio"
20+
"io"
21+
"runtime"
22+
+ "strings"
23+
)
24+
25+
func (logger *Logger) Writer() *io.PipeWriter {
26+
@@ -14,15 +15,18 @@ func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
27+
return NewEntry(logger).WriterLevel(level)
28+
}
29+
30+
+// Writer returns an io.Writer that writes to the logger at the info log level
31+
func (entry *Entry) Writer() *io.PipeWriter {
32+
return entry.WriterLevel(InfoLevel)
33+
}
34+
35+
+// WriterLevel returns an io.Writer that writes to the logger at the given log level
36+
func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
37+
reader, writer := io.Pipe()
38+
39+
var printFunc func(args ...interface{})
40+
41+
+ // Determine which log function to use based on the specified log level
42+
switch level {
43+
case DebugLevel:
44+
printFunc = entry.Debug
45+
@@ -40,23 +44,50 @@ func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
46+
printFunc = entry.Print
47+
}
48+
49+
+ // Start a new goroutine to scan the input and write it to the logger using the specified print function.
50+
+ // It splits the input into chunks of up to 64KB to avoid buffer overflows.
51+
go entry.writerScanner(reader, printFunc)
52+
+
53+
+ // Set a finalizer function to close the writer when it is garbage collected
54+
runtime.SetFinalizer(writer, writerFinalizer)
55+
56+
return writer
57+
}
58+
59+
+// writerScanner scans the input from the reader and writes it to the logger
60+
func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
61+
scanner := bufio.NewScanner(reader)
62+
+
63+
+ // Set the buffer size to the maximum token size to avoid buffer overflows
64+
+ scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize)
65+
+
66+
+ // Define a split function to split the input into chunks of up to 64KB
67+
+ chunkSize := 64 * 1024 // 64KB
68+
+ splitFunc := func(data []byte, atEOF bool) (int, []byte, error) {
69+
+ if len(data) > chunkSize {
70+
+ return chunkSize, data[:chunkSize], nil
71+
+ }
72+
+ return 0, nil, nil
73+
+ }
74+
+
75+
+ //Use the custom split function to split the input
76+
+ scanner.Split(splitFunc)
77+
+
78+
+ // Scan the input and write it to the logger using the specified print function
79+
for scanner.Scan() {
80+
- printFunc(scanner.Text())
81+
+ printFunc(strings.TrimRight(scanner.Text(), "\r\n"))
82+
}
83+
+
84+
+ // If there was an error while scanning the input, log an error
85+
if err := scanner.Err(); err != nil {
86+
entry.Errorf("Error while reading from Writer: %s", err)
87+
}
88+
+
89+
+ // Close the reader when we are done
90+
reader.Close()
91+
}
92+
93+
+// WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected
94+
func writerFinalizer(writer *io.PipeWriter) {
95+
writer.Close()
96+
}
97+
--
98+
2.45.4
99+
100+
101+
From dbba3795634c798a716e22c188896ee3e804eeff Mon Sep 17 00:00:00 2001
102+
From: Chris <straight.chris@gmail.com>
103+
Date: Fri, 10 Mar 2023 13:45:41 -0800
104+
Subject: [PATCH 2/2] Scan text in 64KB chunks
105+
106+
This commit fixes a potential denial of service
107+
vulnerability in logrus.Writer() that could be
108+
triggered by logging text longer than 64KB
109+
without newlines. Previously, the bufio.Scanner
110+
used by Writer() would hang indefinitely when
111+
reading such text without newlines, causing the
112+
application to become unresponsive.
113+
114+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
115+
Upstream-reference: https://github.com/sirupsen/logrus/pull/1376.patch
116+
---
117+
vendor/github.com/sirupsen/logrus/writer.go | 3 ++-
118+
1 file changed, 2 insertions(+), 1 deletion(-)
119+
120+
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
121+
index d50ce9c..7b8c99a 100644
122+
--- a/vendor/github.com/sirupsen/logrus/writer.go
123+
+++ b/vendor/github.com/sirupsen/logrus/writer.go
124+
@@ -67,7 +67,8 @@ func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...
125+
if len(data) > chunkSize {
126+
return chunkSize, data[:chunkSize], nil
127+
}
128+
- return 0, nil, nil
129+
+
130+
+ return len(data), data, nil
131+
}
132+
133+
//Use the custom split function to split the input
134+
--
135+
2.45.4
136+

SPECS/flannel/flannel.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Summary: Simple and easy way to configure a layer 3 network fabric designed for Kubernetes
55
Name: flannel
66
Version: 0.14.0
7-
Release: 26%{?dist}
7+
Release: 27%{?dist}
88
License: ASL 2.0
99
Vendor: Microsoft Corporation
1010
Distribution: Mariner
@@ -13,6 +13,7 @@ URL: https://github.com/flannel-io/flannel
1313
#Source0: https://github.com/flannel-io/flannel/archive/refs/tags/v0.14.0.tar.gz
1414
Source0: %{name}-%{version}.tar.gz
1515
Patch0: CVE-2021-44716.patch
16+
Patch1: CVE-2025-65637.patch
1617

1718
BuildRequires: gcc
1819
BuildRequires: glibc-devel
@@ -49,6 +50,9 @@ install -p -m 755 -t %{buildroot}%{_bindir} ./dist/flanneld
4950
%{_bindir}/flanneld
5051

5152
%changelog
53+
* Mon Dec 08 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 0.14.0-27
54+
- Patch for CVE-2025-65637
55+
5256
* Thu Sep 04 2025 Akhila Guruju <v-guakhila@microsoft.com> - 0.14.0-26
5357
- Bump release to rebuild with golang
5458

0 commit comments

Comments
 (0)