diff options
| author | Archana Polampalli <archana.polampalli@windriver.com> | 2025-11-07 15:51:03 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-11-14 06:45:29 -0800 |
| commit | c973f0e00687c5803f89230bd8f2815ec777f321 (patch) | |
| tree | b308401a741ea7f3f116e27f6e7315b6fb678289 /meta/recipes-devtools | |
| parent | 79aeef5d3545ad4ab3c424dfdba07d36ce2a5dc7 (diff) | |
| download | poky-c973f0e00687c5803f89230bd8f2815ec777f321.tar.gz | |
go: fix CVE-2025-61724
The Reader.ReadResponse function constructs a response string through
repeated string concatenation of lines. When the number of lines in a
response is large, this can cause excessive CPU consumption.
(From OE-Core rev: 512c36af3b9d344606b2ebf54bc2f99b88dfea63)
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/go/go-1.22.12.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/go/go/CVE-2025-61724.patch | 75 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.22.12.inc b/meta/recipes-devtools/go/go-1.22.12.inc index 9996cfb870..825b8f4d68 100644 --- a/meta/recipes-devtools/go/go-1.22.12.inc +++ b/meta/recipes-devtools/go/go-1.22.12.inc | |||
| @@ -27,6 +27,7 @@ SRC_URI += "\ | |||
| 27 | file://CVE-2025-58189.patch \ | 27 | file://CVE-2025-58189.patch \ |
| 28 | file://CVE-2025-47912.patch \ | 28 | file://CVE-2025-47912.patch \ |
| 29 | file://CVE-2025-61723.patch \ | 29 | file://CVE-2025-61723.patch \ |
| 30 | file://CVE-2025-61724.patch \ | ||
| 30 | " | 31 | " |
| 31 | SRC_URI[main.sha256sum] = "012a7e1f37f362c0918c1dfa3334458ac2da1628c4b9cf4d9ca02db986e17d71" | 32 | SRC_URI[main.sha256sum] = "012a7e1f37f362c0918c1dfa3334458ac2da1628c4b9cf4d9ca02db986e17d71" |
| 32 | 33 | ||
diff --git a/meta/recipes-devtools/go/go/CVE-2025-61724.patch b/meta/recipes-devtools/go/go/CVE-2025-61724.patch new file mode 100644 index 0000000000..a91c24508e --- /dev/null +++ b/meta/recipes-devtools/go/go/CVE-2025-61724.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | From a402f4ad285514f5f3db90516d72047d591b307a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Damien Neil <dneil@google.com> | ||
| 3 | Date: Tue, 30 Sep 2025 15:11:16 -0700 | ||
| 4 | Subject: [PATCH] net/textproto: avoid quadratic complexity in | ||
| 5 | Reader.ReadResponse | ||
| 6 | |||
| 7 | Reader.ReadResponse constructed a response string from repeated | ||
| 8 | string concatenation, permitting a malicious sender to cause excessive | ||
| 9 | memory allocation and CPU consumption by sending a response consisting | ||
| 10 | of many short lines. | ||
| 11 | |||
| 12 | Use a strings.Builder to construct the string instead. | ||
| 13 | |||
| 14 | Thanks to Jakub Ciolek for reporting this issue. | ||
| 15 | |||
| 16 | Fixes CVE-2025-61724 | ||
| 17 | For #75716 | ||
| 18 | Fixes #75717 | ||
| 19 | |||
| 20 | Change-Id: I1a98ce85a21b830cb25799f9ac9333a67400d736 | ||
| 21 | Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2940 | ||
| 22 | Reviewed-by: Roland Shoemaker <bracewell@google.com> | ||
| 23 | Reviewed-by: Nicholas Husin <husin@google.com> | ||
| 24 | Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2980 | ||
| 25 | Reviewed-by: Damien Neil <dneil@google.com> | ||
| 26 | Reviewed-on: https://go-review.googlesource.com/c/go/+/709837 | ||
| 27 | Reviewed-by: Carlos Amedee <carlos@golang.org> | ||
| 28 | TryBot-Bypass: Michael Pratt <mpratt@google.com> | ||
| 29 | Auto-Submit: Michael Pratt <mpratt@google.com> | ||
| 30 | |||
| 31 | CVE: CVE-2025-61724 | ||
| 32 | |||
| 33 | Upstream-Status: Backport [https://github.com/golang/go/commit/a402f4ad285514f5f3db90516d72047d591b307a] | ||
| 34 | |||
| 35 | Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> | ||
| 36 | --- | ||
| 37 | src/net/textproto/reader.go | 11 ++++++++--- | ||
| 38 | 1 file changed, 8 insertions(+), 3 deletions(-) | ||
| 39 | |||
| 40 | diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go | ||
| 41 | index 7930211..0027efe 100644 | ||
| 42 | --- a/src/net/textproto/reader.go | ||
| 43 | +++ b/src/net/textproto/reader.go | ||
| 44 | @@ -283,8 +283,10 @@ func (r *Reader) ReadCodeLine(expectCode int) (code int, message string, err err | ||
| 45 | // | ||
| 46 | // An expectCode <= 0 disables the check of the status code. | ||
| 47 | func (r *Reader) ReadResponse(expectCode int) (code int, message string, err error) { | ||
| 48 | - code, continued, message, err := r.readCodeLine(expectCode) | ||
| 49 | + code, continued, first, err := r.readCodeLine(expectCode) | ||
| 50 | multi := continued | ||
| 51 | + var messageBuilder strings.Builder | ||
| 52 | + messageBuilder.WriteString(first) | ||
| 53 | for continued { | ||
| 54 | line, err := r.ReadLine() | ||
| 55 | if err != nil { | ||
| 56 | @@ -295,12 +297,15 @@ func (r *Reader) ReadResponse(expectCode int) (code int, message string, err err | ||
| 57 | var moreMessage string | ||
| 58 | code2, continued, moreMessage, err = parseCodeLine(line, 0) | ||
| 59 | if err != nil || code2 != code { | ||
| 60 | - message += "\n" + strings.TrimRight(line, "\r\n") | ||
| 61 | + messageBuilder.WriteByte('\n') | ||
| 62 | + messageBuilder.WriteString(strings.TrimRight(line, "\r\n")) | ||
| 63 | continued = true | ||
| 64 | continue | ||
| 65 | } | ||
| 66 | - message += "\n" + moreMessage | ||
| 67 | + messageBuilder.WriteByte('\n') | ||
| 68 | + messageBuilder.WriteString(moreMessage) | ||
| 69 | } | ||
| 70 | + message = messageBuilder.String() | ||
| 71 | if err != nil && multi && message != "" { | ||
| 72 | // replace one line error message with all lines (full message) | ||
| 73 | err = &Error{code, message} | ||
| 74 | -- | ||
| 75 | 2.40.0 | ||
