go-runtime: Security fix for CVE-2022-41723
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Steve,
I think you missed the patch for the Kirkstone branch. It's showing an *Unpatched* in the latest CVE metrics for kirkstone.
I had sent patches for CVE-2022-41723 in separate emails for both dunfell & kirkstone with different subjects (mentioned branch). Dunfell patch is already merged into dunfell-nut. I am not sure how kirkstone patch mail is showing as a *reply* on dunfell patch mail. In the mail details as well as on the list, it's showing the correct subject:
https://lists.openembedded.org/g/openembedded-core/message/179232
Apologies for the inconvenience caused. Please consider this patch for kirkstone to fix CVE-2022-41723 golang.org/x/net/http2: avoid quadratic complexity in HPACK decoding.
Regards,
Shubham Kulkarni
Quoted 222 lines · Shubham Kulkarni via lists.openembedded.org
From: Shubham Kulkarni <[email protected]>
Disable cmd/internal/moddeps test, since this update includes PRIVATE track fixes.
Backport from
https://github.com/golang/go/commit/5c3e11bd0b5c0a86e5beffcd4339b86a902b21c3Signed-off-by Shubham Kulkarni <[email protected]>--- meta/recipes-devtools/go/go-1.17.13.inc | 1 + .../go/go-1.18/CVE-2022-41723.patch | 156 ++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patchmeta/recipes-devtools/go/go-1.17.13.inc +1
-0@@ -20,6 +20,7 @@ SRC_URI += "\ file://0001-net-http-httputil-avoid-query-parameter-smuggling.patch \ file://CVE-2022-41715.patch \ file://CVE-2022-41717.patch \ + file://CVE-2022-41723.patch \ " SRC_URI[main.sha256sum] ="
a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd"meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +14
-0@@ -0,0 +1,156 @@ +From 451766789f646617157c725e20c955d4a9a70d4e Mon Sep 17 00:00:00 2001 +From: Roland Shoemaker <[email protected]> +Date: Mon, 6 Feb 2023 10:03:44 -0800 +Subject: [PATCH] net/http: update bundled golang.org/x/net/http2 + +Disable cmd/internal/moddeps test, since this update includes PRIVATE +track fixes. + +Fixes CVE-2022-41723 +Fixes #58355 +Updates #57855 + +Change-Id: Ie870562a6f6e44e4e8f57db6a0dde1a41a2b090c +Reviewed-on:https://team-review.git.corp.google.com/c/golang/go-private/+/1728939
+Reviewed-by
<https://team-review.git.corp.google.com/c/golang/go-private/+/1728939+Reviewed-by>:
Damien Neil <[email protected]>meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +10
-0+Reviewed-by: Julie Qiu <[email protected]> +Reviewed-by: Tatiana Bradley <[email protected]> +Run-TryBot: Roland Shoemaker <[email protected]> +Reviewed-on: https://go-review.googlesource.com/c/go/+/468118 +TryBot-Result: Gopher Robot <[email protected]> +Run-TryBot: Michael Pratt <[email protected]> +Auto-Submit: Michael Pratt <[email protected]> +Reviewed-by: Than McIntosh <[email protected]> + +Upstream-Status: Backport [https://github.com/golang/go/commit/5c3e11bd0b5c0a86e5beffcd4339b86a902b21c3
]meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +8
-0+CVE: CVE-2022-41723 +Signed-off-by: Shubham Kulkarni <[email protected]> +--- + src/vendor/golang.org/x/net/http2/hpack/hpack.go | 79 +++++++++++++++--------- + 1 file changed, 49 insertions(+), 30 deletions(-) + +diff --git a/src/vendor/golang.org/x/net/http2/hpack/hpack.gob/src/vendor/golang.org/x/net/http2/hpack/hpack.go
+index 85f18a2..02e80e3 100644
+--- a/src/vendor/golang.org/x/net/http2/hpack/hpack.go ++++ b/src/vendor/golang.org/x/net/http2/hpack/hpack.go +@@ -359,6 +359,7 @@ func (d *Decoder)parseFieldLiteral(n uint8, it indexType)error {meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +8
-0+ + var hf HeaderField + wantStr := d.emitEnabled || it.indexed() ++ var undecodedName undecodedString + if nameIdx > 0 { + ihf, ok := d.at(nameIdx) + if !ok { +@@ -366,15 +367,27 @@ func (d *Decoder) parseFieldLiteral(n uint8, itindexType) error {
meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +30
-0+ } + hf.Name = ihf.Name + } else { +- hf.Name, buf, err = d.readString(buf, wantStr) ++ undecodedName, buf, err = d.readString(buf) + if err != nil { + return err + } + } +- hf.Value, buf, err = d.readString(buf, wantStr) ++ undecodedValue, buf, err := d.readString(buf) + if err != nil { + return err + } ++ if wantStr { ++ if nameIdx <= 0 { ++ hf.Name, err = d.decodeString(undecodedName) ++ if err != nil { ++ return err ++ } ++ } ++ hf.Value, err = d.decodeString(undecodedValue) ++ if err != nil { ++ return err ++ } ++ } + d.buf = buf + if it.indexed() { + d.dynTab.add(hf) +@@ -459,46 +472,52 @@ func readVarInt(n byte, p []byte) (i uint64, remain[]byte, err error) {
meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +11
-0+ return 0, origP, errNeedMore + } + +-// readString decodes an hpack string from p. ++// readString reads an hpack string from p. + // +-// wantStr is whether s will be used. If false, decompression and +-// []byte->string garbage are skipped if s will be ignored +-// anyway. This does mean that huffman decoding errors for non-indexed +-// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server +-// is returning an error anyway, and because they're not indexed, theerror
+-// won't affect the decoding state. +-func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain[]byte, err error) {
++// It returns a reference to the encoded string data to permit deferring decode costs
++// until after the caller verifies all data is present. ++func (d *Decoder)readString(p []byte)(u undecodedString, remain []byte, err error) {meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +39
-0+ if len(p) == 0 { +- return "", p, errNeedMore ++ return u, p, errNeedMore + } + isHuff := p[0]&128 != 0 + strLen, p, err := readVarInt(7, p) + if err != nil { +- return "", p, err ++ return u, p, err + } + if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { +- return "", nil, ErrStringLength ++ // Returning an error here means Huffman decoding errors ++ // for non-indexed strings past the maximum string length ++ // are ignored, but the server is returning an error anyway ++ // and because the string is not indexed the error will not ++ // affect the decoding state. ++ return u, nil, ErrStringLength + } + if uint64(len(p)) < strLen { +- return "", p, errNeedMore +- } +- if !isHuff { +- if wantStr { +- s = string(p[:strLen]) +- } +- return s, p[strLen:], nil ++ return u, p, errNeedMore + } ++ u.isHuff = isHuff ++ u.b = p[:strLen] ++ return u, p[strLen:], nil ++} + +- if wantStr { +- buf := bufPool.Get().(*bytes.Buffer) +- buf.Reset() // don't trust others +- defer bufPool.Put(buf) +- if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err!= nil {
+- buf.Reset() +- return "", nil, err +- }++type undecodedString struct {
++ isHuff bool
++ b []byte
++}
++
++func (d *Decoder) decodeString(u undecodedString) (string, error) {
++ if !u.isHuff {
++ return string(u.b), nil++ } ++ buf := bufPool.Get().(*bytes.Buffer) ++ buf.Reset() // don't trust others ++ var s string ++ err := huffmanDecode(buf, d.maxStrLen, u.b) ++ if err == nil {meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +10
-1+ s = buf.String() +- buf.Reset() // be nice to GC + } +- return s, p[strLen:], nil ++ buf.Reset() // be nice to GC ++ bufPool.Put(buf) ++ return s, err + } +-- +2.7.4 --2.33.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#179232):
https://lists.openembedded.org/g/openembedded-core/message/179232
Mute This Topic: https://lists.openembedded.org/mt/97904222/7032091
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 8 lines · Shubham Kulkarni
Hi Steve,
I think you missed the patch for the Kirkstone branch. It's showing an Unpatched in the latest CVE metrics for kirkstone.
I had sent patches for CVE-2022-41723 in separate emails for both dunfell & kirkstone with different subjects (mentioned branch). Dunfell patch is already merged into dunfell-nut. I am not sure how kirkstone patch mail is showing as a reply on dunfell patch mail. In the mail details as well as on the list, it's showing the correct subject: https://lists.openembedded.org/g/openembedded-core/message/179232
Apologies for the inconvenience caused. Please consider this patch for kirkstone to fix CVE-2022-41723 golang.org/x/net/http2: avoid quadratic complexity in HPACK decoding.
Apologies on my end for not sorting this out!
I've got it now, thanks for the reminder.
Steve
Quoted 202 lines · Shubham Kulkarni via lists.openembedded.org
Quoted 201 lines
From: Shubham Kulkarni <[email protected]>
Disable cmd/internal/moddeps test, since this update includes PRIVATE track fixes.
Backport from https://github.com/golang/go/commit/5c3e11bd0b5c0a86e5beffcd4339b86a902b21c3
Signed-off-by Shubham Kulkarni <[email protected]>--- meta/recipes-devtools/go/go-1.17.13.inc | 1 + .../go/go-1.18/CVE-2022-41723.patch | 156 ++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patchmeta/recipes-devtools/go/go-1.17.13.inc +1
-0@@ -20,6 +20,7 @@ SRC_URI += "\ file://0001-net-http-httputil-avoid-query-parameter-smuggling.patch \ file://CVE-2022-41715.patch \ file://CVE-2022-41717.patch \ + file://CVE-2022-41723.patch \ " SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd"meta/recipes-devtools/go/go-1.18/CVE-2022-41723.patch new file +156
-1@@ -0,0 +1,156 @@ +From 451766789f646617157c725e20c955d4a9a70d4e Mon Sep 17 00:00:00 2001 +From: Roland Shoemaker <[email protected]> +Date: Mon, 6 Feb 2023 10:03:44 -0800 +Subject: [PATCH] net/http: update bundled golang.org/x/net/http2 + +Disable cmd/internal/moddeps test, since this update includes PRIVATE +track fixes. + +Fixes CVE-2022-41723 +Fixes #58355 +Updates #57855 + +Change-Id: Ie870562a6f6e44e4e8f57db6a0dde1a41a2b090c +Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1728939 +Reviewed-by: Damien Neil <[email protected]> +Reviewed-by: Julie Qiu <[email protected]> +Reviewed-by: Tatiana Bradley <[email protected]> +Run-TryBot: Roland Shoemaker <[email protected]> +Reviewed-on: https://go-review.googlesource.com/c/go/+/468118 +TryBot-Result: Gopher Robot <[email protected]> +Run-TryBot: Michael Pratt <[email protected]> +Auto-Submit: Michael Pratt <[email protected]> +Reviewed-by: Than McIntosh <[email protected]> + +Upstream-Status: Backport [https://github.com/golang/go/commit/5c3e11bd0b5c0a86e5beffcd4339b86a902b21c3] +CVE: CVE-2022-41723 +Signed-off-by: Shubham Kulkarni <[email protected]> +--- + src/vendor/golang.org/x/net/http2/hpack/hpack.go | 79 +++++++++++++++--------- + 1 file changed, 49 insertions(+), 30 deletions(-) + +diff --git a/src/vendor/golang.org/x/net/http2/hpack/hpack.go b/src/vendor/golang.org/x/net/http2/hpack/hpack.go +index 85f18a2..02e80e3 100644 +--- a/src/vendor/golang.org/x/net/http2/hpack/hpack.go ++++ b/src/vendor/golang.org/x/net/http2/hpack/hpack.go +@@ -359,6 +359,7 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { + + var hf HeaderField + wantStr := d.emitEnabled || it.indexed() ++ var undecodedName undecodedString + if nameIdx > 0 { + ihf, ok := d.at(nameIdx) + if !ok { +@@ -366,15 +367,27 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { + } + hf.Name = ihf.Name + } else { +- hf.Name, buf, err = d.readString(buf, wantStr) ++ undecodedName, buf, err = d.readString(buf) + if err != nil { + return err + } + } +- hf.Value, buf, err = d.readString(buf, wantStr) ++ undecodedValue, buf, err := d.readString(buf) + if err != nil { + return err + } ++ if wantStr { ++ if nameIdx <= 0 { ++ hf.Name, err = d.decodeString(undecodedName) ++ if err != nil { ++ return err ++ } ++ } ++ hf.Value, err = d.decodeString(undecodedValue) ++ if err != nil { ++ return err ++ } ++ } + d.buf = buf + if it.indexed() { + d.dynTab.add(hf) +@@ -459,46 +472,52 @@ func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) { + return 0, origP, errNeedMore + } + +-// readString decodes an hpack string from p. ++// readString reads an hpack string from p. + // +-// wantStr is whether s will be used. If false, decompression and +-// []byte->string garbage are skipped if s will be ignored +-// anyway. This does mean that huffman decoding errors for non-indexed +-// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server +-// is returning an error anyway, and because they're not indexed, the error +-// won't affect the decoding state. +-func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) { ++// It returns a reference to the encoded string data to permit deferring decode costs ++// until after the caller verifies all data is present. ++func (d *Decoder) readString(p []byte) (u undecodedString, remain []byte, err error) { + if len(p) == 0 { +- return "", p, errNeedMore ++ return u, p, errNeedMore + } + isHuff := p[0]&128 != 0 + strLen, p, err := readVarInt(7, p) + if err != nil { +- return "", p, err ++ return u, p, err + } + if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { +- return "", nil, ErrStringLength ++ // Returning an error here means Huffman decoding errors ++ // for non-indexed strings past the maximum string length ++ // are ignored, but the server is returning an error anyway ++ // and because the string is not indexed the error will not ++ // affect the decoding state. ++ return u, nil, ErrStringLength + } + if uint64(len(p)) < strLen { +- return "", p, errNeedMore +- } +- if !isHuff { +- if wantStr { +- s = string(p[:strLen]) +- } +- return s, p[strLen:], nil ++ return u, p, errNeedMore + } ++ u.isHuff = isHuff ++ u.b = p[:strLen] ++ return u, p[strLen:], nil ++} + +- if wantStr { +- buf := bufPool.Get().(*bytes.Buffer) +- buf.Reset() // don't trust others +- defer bufPool.Put(buf) +- if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil { +- buf.Reset() +- return "", nil, err +- } ++type undecodedString struct { ++ isHuff bool ++ b []byte ++} ++ ++func (d *Decoder) decodeString(u undecodedString) (string, error) { ++ if !u.isHuff { ++ return string(u.b), nil ++ } ++ buf := bufPool.Get().(*bytes.Buffer) ++ buf.Reset() // don't trust others ++ var s string ++ err := huffmanDecode(buf, d.maxStrLen, u.b) ++ if err == nil { + s = buf.String() +- buf.Reset() // be nice to GC + } +- return s, p[strLen:], nil ++ buf.Reset() // be nice to GC ++ bufPool.Put(buf) ++ return s, err + } +-- +2.7.4 --2.33.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179232): https://lists.openembedded.org/g/openembedded-core/message/179232
Mute This Topic: https://lists.openembedded.org/mt/97904222/7032091
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-