From 55efe5f6ec1095bac2041031da0b4daa63b61523 Mon Sep 17 00:00:00 2001 From: hanchao Date: Thu, 15 Sep 2022 10:39:15 +0800 Subject: [PATCH] golang: fix CVE-2022-27664 Score: 7.5 Reference: https://go-review.googlesource.com/c/go/+/428635/ Conflict: NA Reason: fix CVE-2022-27664 --- ...o1.18-net-http-update-bundled-golang.patch | 85 +++++++++++++++++++ golang.spec | 9 +- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 0078-release-branch.go1.18-net-http-update-bundled-golang.patch diff --git a/0078-release-branch.go1.18-net-http-update-bundled-golang.patch b/0078-release-branch.go1.18-net-http-update-bundled-golang.patch new file mode 100644 index 0000000..0236818 --- /dev/null +++ b/0078-release-branch.go1.18-net-http-update-bundled-golang.patch @@ -0,0 +1,85 @@ +From 2afe499bc3ce4d9706e91b43522b6eca9ff4f43a Mon Sep 17 00:00:00 2001 +From: Damien Neil +Date: Mon, 22 Aug 2022 16:21:02 -0700 +Subject: [PATCH] [release-branch.go1.18] net/http: update bundled + golang.org/x/net/http2 + +Disable cmd/internal/moddeps test, since this update includes PRIVATE +track fixes. + +Fixes CVE-2022-27664 +Fixes #53977 +For #54658. + +Change-Id: I84b0b8f61e49e15ef55ef8d738730107a3cf849b +Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1554415 +Reviewed-by: Roland Shoemaker +Reviewed-by: Tatiana Bradley +Reviewed-on: https://go-review.googlesource.com/c/go/+/428635 +Reviewed-by: Tatiana Bradley +Run-TryBot: Michael Knyszek +TryBot-Result: Gopher Robot +Reviewed-by: Carlos Amedee + +Conflict: NA +Reference: https://go-review.googlesource.com/c/go/+/428635/ +--- + src/net/http/h2_bundle.go | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go +index 06f8808dc6..dc30e077ae 100644 +--- a/src/net/http/h2_bundle.go ++++ b/src/net/http/h2_bundle.go +@@ -3247,10 +3247,11 @@ func (s http2SettingID) String() string { + // name (key). See httpguts.ValidHeaderName for the base rules. + // + // Further, http2 says: +-// "Just as in HTTP/1.x, header field names are strings of ASCII +-// characters that are compared in a case-insensitive +-// fashion. However, header field names MUST be converted to +-// lowercase prior to their encoding in HTTP/2. " ++// ++// "Just as in HTTP/1.x, header field names are strings of ASCII ++// characters that are compared in a case-insensitive ++// fashion. However, header field names MUST be converted to ++// lowercase prior to their encoding in HTTP/2. " + func http2validWireHeaderFieldName(v string) bool { + if len(v) == 0 { + return false +@@ -3441,8 +3442,8 @@ func (s *http2sorter) SortStrings(ss []string) { + // validPseudoPath reports whether v is a valid :path pseudo-header + // value. It must be either: + // +-// *) a non-empty string starting with '/' +-// *) the string '*', for OPTIONS requests. ++// *) a non-empty string starting with '/' ++// *) the string '*', for OPTIONS requests. + // + // For now this is only used a quick check for deciding when to clean + // up Opaque URLs before sending requests from the Transport. +@@ -4895,6 +4896,9 @@ func (sc *http2serverConn) startGracefulShutdownInternal() { + func (sc *http2serverConn) goAway(code http2ErrCode) { + sc.serveG.check() + if sc.inGoAway { ++ if sc.goAwayCode == http2ErrCodeNo { ++ sc.goAwayCode = code ++ } + return + } + sc.inGoAway = true +@@ -6090,8 +6094,9 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) { + // prior to the headers being written. If the set of trailers is fixed + // or known before the header is written, the normal Go trailers mechanism + // is preferred: +-// https://golang.org/pkg/net/http/#ResponseWriter +-// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers ++// ++// https://golang.org/pkg/net/http/#ResponseWriter ++// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers + const http2TrailerPrefix = "Trailer:" + + // promoteUndeclaredTrailers permits http.Handlers to set trailers +-- +2.30.2 + diff --git a/golang.spec b/golang.spec index b2d3f6c..115c477 100644 --- a/golang.spec +++ b/golang.spec @@ -58,7 +58,7 @@ Name: golang Version: 1.15.7 -Release: 18 +Release: 19 Summary: The Go Programming Language License: BSD and Public Domain URL: https://golang.org/ @@ -219,6 +219,7 @@ Patch6074: 0074-release-branch.go1.17-math-big-check-buffer-lengths-.patch Patch6075: 0075-path-filepath-do-not-remove-prefix-.-when-following-.patch Patch6076: 0076-release-branch.go1.17-syscall-check-correct-group-in.patch Patch6077: 0077-release-branch.go1.16-runtime-consistently-access-po.patch +Patch6078: 0078-release-branch.go1.18-net-http-update-bundled-golang.patch Patch9001: 0001-drop-hard-code-cert.patch Patch9002: 0002-fix-patch-cmd-go-internal-modfetch-do-not-sho.patch @@ -459,6 +460,12 @@ fi %changelog +* Thu Spe 15 2022 hanchao - 1.15.7-19 +- Type:CVE +- CVE:CVE-2022-27664 +- SUG:NA +- DESC:fix CVE-2022-27664 + * Thu Spe 8 2022 hanchao - 1.15.7-18 - Type:bugfix - CVE:NA -- Gitee