From 9ad7e698bdfb7ba5d5908d6c895eca4bf1eb41ca Mon Sep 17 00:00:00 2001 From: jichao wu Date: Mon, 23 Jun 2025 15:45:19 +0800 Subject: [PATCH] [backport]fix CVE-2025-4673 (cherry picked from commit b8b4ded28422d562a3f34814ae8a320560c46e20) --- ...t-http-strip-sensitive-proxy-headers.patch | 67 +++++++++++++++++++ golang.spec | 9 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 backport-0032-CVE-2025-4673-net-http-strip-sensitive-proxy-headers.patch diff --git a/backport-0032-CVE-2025-4673-net-http-strip-sensitive-proxy-headers.patch b/backport-0032-CVE-2025-4673-net-http-strip-sensitive-proxy-headers.patch new file mode 100644 index 0000000..20f2e9e --- /dev/null +++ b/backport-0032-CVE-2025-4673-net-http-strip-sensitive-proxy-headers.patch @@ -0,0 +1,67 @@ +From 4ebe7fd8c28d4e023b4806ef914c03b830d075ca Mon Sep 17 00:00:00 2001 +From: Neal Patel +Date: Wed, 21 May 2025 14:11:44 -0400 +Subject: [PATCH] net/http: strip sensitive proxy headers from redirect + requests + +Similarly to Authentication entries, Proxy-Authentication entries should be stripped to ensure sensitive information is not leaked on redirects outside of the original domain. + +https://fetch.spec.whatwg.org/#authentication-entries + +Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this issue. + +Updates golang/go#73816 +Fixes golang/go#73905 +Fixes CVE-2025-4673 + +Confict: no +Reference:https://go-review.googlesource.com/c/go/+/679255 + +Change-Id: I1615f31977a2fd014fbc12aae43f82692315a6d0 +Reviewed-on: https://go-review.googlesource.com/c/go/+/679255 +LUCI-TryBot-Result: Go LUCI +Reviewed-by: Michael Knyszek +Signed-off-by: jichao wu +--- + src/net/http/client.go | 3 ++- + src/net/http/client_test.go | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/net/http/client.go b/src/net/http/client.go +index 6323448..69fec4b 100644 +--- a/src/net/http/client.go ++++ b/src/net/http/client.go +@@ -805,7 +805,8 @@ func (c *Client) makeHeadersCopier(ireq *Request) func(req *Request, stripSensit + for k, vv := range ireqhdr { + sensitive := false + switch CanonicalHeaderKey(k) { +- case "Authorization", "Www-Authenticate", "Cookie", "Cookie2": ++ case "Authorization", "Www-Authenticate", "Cookie", "Cookie2", ++ "Proxy-Authorization", "Proxy-Authenticate": + sensitive = true + } + if !(sensitive && stripSensitiveHeaders) { +diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go +index dba1aa1..f654df9 100644 +--- a/src/net/http/client_test.go ++++ b/src/net/http/client_test.go +@@ -1555,6 +1555,8 @@ func testClientStripHeadersOnRepeatedRedirect(t *testing.T, mode testMode) { + if r.Host+r.URL.Path != "a.example.com/" { + if h := r.Header.Get("Authorization"); h != "" { + t.Errorf("on request to %v%v, Authorization=%q, want no header", r.Host, r.URL.Path, h) ++ } else if h := r.Header.Get("Proxy-Authorization"); h != "" { ++ t.Errorf("on request to %v%v, Proxy-Authorization=%q, want no header", r.Host, r.URL.Path, h) + } + } + // Follow a chain of redirects from a to b and back to a. +@@ -1583,6 +1585,7 @@ func testClientStripHeadersOnRepeatedRedirect(t *testing.T, mode testMode) { + req, _ := NewRequest("GET", proto+"://a.example.com/", nil) + req.Header.Add("Cookie", "foo=bar") + req.Header.Add("Authorization", "secretpassword") ++ req.Header.Add("Proxy-Authorization", "secretpassword") + res, err := c.Do(req) + if err != nil { + t.Fatal(err) +-- +2.33.0 + diff --git a/golang.spec b/golang.spec index efbe552..fc8388b 100644 --- a/golang.spec +++ b/golang.spec @@ -66,7 +66,7 @@ Name: golang Version: 1.21.4 -Release: 32 +Release: 33 Summary: The Go Programming Language License: BSD and Public Domain URL: https://golang.org/ @@ -151,6 +151,7 @@ Patch6028: backport-0028-release-branch.go1.21-runtime-allow-update-of-system.pa Patch6029: backport-0029-CVE-2024-45341-crypto-x509-properly-check-for-IPv6-h.patch Patch6030: backport-0030-CVE-2024-45336-net-http-persist-header-stripping-acr.patch Patch6031: backport-0031-CVE-2025-22870.patch +Patch6032: backport-0032-CVE-2025-4673-net-http-strip-sensitive-proxy-headers.patch ExclusiveArch: %{golang_arches} @@ -390,6 +391,12 @@ fi %files devel -f go-tests.list -f go-misc.list -f go-src.list %changelog +* Mon Jun 23 2025 wujichao - 1.21.4-33 +- Type:CVE +- CVE:CVE-2025-4673 +- SUG:NA +- DESC:fix CVE-2025-4673 + * Thu Mar 20 2025 changtao - 1.21.4-32 - Type:CVE - CVE:CVE-2025-22870 -- Gitee