From 50d95dc4ce93d881544551a557eb3b5f29d669c4 Mon Sep 17 00:00:00 2001 From: Azure Linux Security Servicing Account Date: Thu, 12 Feb 2026 14:57:29 +0000 Subject: [PATCH 1/2] Patch application-gateway-kubernetes-ingress for CVE-2025-58190, CVE-2025-47911 --- .../CVE-2025-47911.patch | 100 ++++++++++++++ .../CVE-2025-58190.patch | 126 ++++++++++++++++++ ...pplication-gateway-kubernetes-ingress.spec | 7 +- 3 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 SPECS/application-gateway-kubernetes-ingress/CVE-2025-47911.patch create mode 100644 SPECS/application-gateway-kubernetes-ingress/CVE-2025-58190.patch diff --git a/SPECS/application-gateway-kubernetes-ingress/CVE-2025-47911.patch b/SPECS/application-gateway-kubernetes-ingress/CVE-2025-47911.patch new file mode 100644 index 00000000000..b41a61f04ae --- /dev/null +++ b/SPECS/application-gateway-kubernetes-ingress/CVE-2025-47911.patch @@ -0,0 +1,100 @@ +From 827a9738fa121994c1fc20b99872414039752e51 Mon Sep 17 00:00:00 2001 +From: Roland Shoemaker +Date: Mon, 29 Sep 2025 16:33:18 -0700 +Subject: [PATCH] html: impose open element stack size limit + +The HTML specification contains a number of algorithms which are +quadratic in complexity by design. Instead of adding complicated +workarounds to prevent these cases from becoming extremely expensive in +pathological cases, we impose a limit of 512 to the size of the stack of +open elements. It is extremely unlikely that non-adversarial HTML +documents will ever hit this limit (but if we see cases of this, we may +want to make the limit configurable via a ParseOption). + +Thanks to Guido Vranken and Jakub Ciolek for both independently +reporting this issue. + +Fixes CVE-2025-47911 +Fixes golang/go#75682 + +Change-Id: I890517b189af4ffbf427d25d3fde7ad7ec3509ad +Reviewed-on: https://go-review.googlesource.com/c/net/+/709876 +Reviewed-by: Damien Neil +LUCI-TryBot-Result: Go LUCI +Signed-off-by: Azure Linux Security Servicing Account +Upstream-reference: https://github.com/golang/net/commit/59706cdaa8f95502fdec64b67b4c61d6ca58727d.patch +--- + vendor/golang.org/x/net/html/escape.go | 2 +- + vendor/golang.org/x/net/html/parse.go | 21 +++++++++++++++++---- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/vendor/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go +index 04c6bec..12f2273 100644 +--- a/vendor/golang.org/x/net/html/escape.go ++++ b/vendor/golang.org/x/net/html/escape.go +@@ -299,7 +299,7 @@ func escape(w writer, s string) error { + case '\r': + esc = " " + default: +- panic("unrecognized escape character") ++ panic("html: unrecognized escape character") + } + s = s[i+1:] + if _, err := w.WriteString(esc); err != nil { +diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go +index bf1715b..3d3ae4a 100644 +--- a/vendor/golang.org/x/net/html/parse.go ++++ b/vendor/golang.org/x/net/html/parse.go +@@ -231,7 +231,14 @@ func (p *parser) addChild(n *Node) { + } + + if n.Type == ElementNode { +- p.oe = append(p.oe, n) ++ p.insertOpenElement(n) ++ } ++} ++ ++func (p *parser) insertOpenElement(n *Node) { ++ p.oe = append(p.oe, n) ++ if len(p.oe) > 512 { ++ panic("html: open stack of elements exceeds 512 nodes") + } + } + +@@ -810,7 +817,7 @@ func afterHeadIM(p *parser) bool { + p.im = inFramesetIM + return true + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: +- p.oe = append(p.oe, p.head) ++ p.insertOpenElement(p.head) + defer p.oe.remove(p.head) + return inHeadIM(p) + case a.Head: +@@ -2324,9 +2331,13 @@ func (p *parser) parseCurrentToken() { + } + } + +-func (p *parser) parse() error { ++func (p *parser) parse() (err error) { ++ defer func() { ++ if panicErr := recover(); panicErr != nil { ++ err = fmt.Errorf("%s", panicErr) ++ } ++ }() + // Iterate until EOF. Any other error will cause an early return. +- var err error + for err != io.EOF { + // CDATA sections are allowed only in foreign content. + n := p.oe.top() +@@ -2355,6 +2366,8 @@ func (p *parser) parse() error { + // s. Conversely, explicit s in r's data can be silently dropped, + // with no corresponding node in the resulting tree. + // ++// Parse will reject HTML that is nested deeper than 512 elements. ++// + // The input is assumed to be UTF-8 encoded. + func Parse(r io.Reader) (*Node, error) { + return ParseWithOptions(r) +-- +2.45.4 + diff --git a/SPECS/application-gateway-kubernetes-ingress/CVE-2025-58190.patch b/SPECS/application-gateway-kubernetes-ingress/CVE-2025-58190.patch new file mode 100644 index 00000000000..89e38a93307 --- /dev/null +++ b/SPECS/application-gateway-kubernetes-ingress/CVE-2025-58190.patch @@ -0,0 +1,126 @@ +From 7adedf22a25575a212d641a5445302d47bb0b051 Mon Sep 17 00:00:00 2001 +From: Roland Shoemaker +Date: Mon, 29 Sep 2025 19:38:24 -0700 +Subject: [PATCH] html: align in row insertion mode with spec + +Update inRowIM to match the HTML specification. This fixes an issue +where a specific HTML document could cause the parser to enter an +infinite loop when trying to parse a and implied next to +each other. + +Fixes CVE-2025-58190 +Fixes golang/go#70179 + +Change-Id: Idcb133c87c7d475cc8c7eb1f1550ea21d8bdddea +Reviewed-on: https://go-review.googlesource.com/c/net/+/709875 +LUCI-TryBot-Result: Go LUCI +Reviewed-by: Damien Neil +Signed-off-by: Azure Linux Security Servicing Account +Upstream-reference: https://github.com/golang/net/commit/6ec8895aa5f6594da7356da7d341b98133629009.patch +--- + vendor/golang.org/x/net/html/parse.go | 36 ++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 12 deletions(-) + +diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go +index 643c674..bf1715b 100644 +--- a/vendor/golang.org/x/net/html/parse.go ++++ b/vendor/golang.org/x/net/html/parse.go +@@ -136,7 +136,7 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { + return -1 + } + default: +- panic("unreachable") ++ panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s)) + } + } + switch s { +@@ -179,7 +179,7 @@ func (p *parser) clearStackToContext(s scope) { + return + } + default: +- panic("unreachable") ++ panic(fmt.Sprintf("html: internal error: clearStackToContext unknown scope: %d", s)) + } + } + } +@@ -1678,7 +1678,7 @@ func inTableBodyIM(p *parser) bool { + return inTableIM(p) + } + +-// Section 12.2.6.4.14. ++// Section 13.2.6.4.14. + func inRowIM(p *parser) bool { + switch p.tok.Type { + case StartTagToken: +@@ -1690,7 +1690,9 @@ func inRowIM(p *parser) bool { + p.im = inCellIM + return true + case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Tfoot, a.Thead, a.Tr: +- if p.popUntil(tableScope, a.Tr) { ++ if p.elementInScope(tableScope, a.Tr) { ++ p.clearStackToContext(tableRowScope) ++ p.oe.pop() + p.im = inTableBodyIM + return false + } +@@ -1700,22 +1702,28 @@ func inRowIM(p *parser) bool { + case EndTagToken: + switch p.tok.DataAtom { + case a.Tr: +- if p.popUntil(tableScope, a.Tr) { ++ if p.elementInScope(tableScope, a.Tr) { ++ p.clearStackToContext(tableRowScope) ++ p.oe.pop() + p.im = inTableBodyIM + return true + } + // Ignore the token. + return true + case a.Table: +- if p.popUntil(tableScope, a.Tr) { ++ if p.elementInScope(tableScope, a.Tr) { ++ p.clearStackToContext(tableRowScope) ++ p.oe.pop() + p.im = inTableBodyIM + return false + } + // Ignore the token. + return true + case a.Tbody, a.Tfoot, a.Thead: +- if p.elementInScope(tableScope, p.tok.DataAtom) { +- p.parseImpliedToken(EndTagToken, a.Tr, a.Tr.String()) ++ if p.elementInScope(tableScope, p.tok.DataAtom) && p.elementInScope(tableScope, a.Tr) { ++ p.clearStackToContext(tableRowScope) ++ p.oe.pop() ++ p.im = inTableBodyIM + return false + } + // Ignore the token. +@@ -2222,16 +2230,20 @@ func parseForeignContent(p *parser) bool { + p.acknowledgeSelfClosingTag() + } + case EndTagToken: ++ if strings.EqualFold(p.oe[len(p.oe)-1].Data, p.tok.Data) { ++ p.oe = p.oe[:len(p.oe)-1] ++ return true ++ } + for i := len(p.oe) - 1; i >= 0; i-- { +- if p.oe[i].Namespace == "" { +- return p.im(p) +- } + if strings.EqualFold(p.oe[i].Data, p.tok.Data) { + p.oe = p.oe[:i] ++ return true ++ } ++ if i > 0 && p.oe[i-1].Namespace == "" { + break + } + } +- return true ++ return p.im(p) + default: + // Ignore the token. + } +-- +2.45.4 + diff --git a/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec b/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec index 0ec80d015fe..3d8f2048761 100644 --- a/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec +++ b/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec @@ -2,7 +2,7 @@ Summary: Application Gateway Ingress Controller Name: application-gateway-kubernetes-ingress Version: 1.7.7 -Release: 2%{?dist} +Release: 3%{?dist} License: MIT Vendor: Microsoft Corporation Distribution: Azure Linux @@ -14,6 +14,8 @@ Source0: https://github.com/Azure/application-gateway-kubernetes-ingress/ # After fixing any possible CVE for the vendored source, we must bump v1 -> v2 Source1: %{name}-%{version}-govendor-v1.tar.gz Patch0: CVE-2025-30204.patch +Patch1: CVE-2025-47911.patch +Patch2: CVE-2025-58190.patch BuildRequires: golang >= 1.23 @@ -45,6 +47,9 @@ cp appgw-ingress %{buildroot}%{_bindir}/ %{_bindir}/appgw-ingress %changelog +* Thu Feb 12 2026 Azure Linux Security Servicing Account - 1.7.7-3 +- Patch for CVE-2025-58190, CVE-2025-47911 + * Sat Mar 29 2025 Kanishk Bansal - 1.7.7-2 - Patch CVE-2025-30204 From c31206fe9d7e92ba2ec40a75de80f59a25bf852f Mon Sep 17 00:00:00 2001 From: Kanishk Bansal <103916909+Kanishk-Bansal@users.noreply.github.com> Date: Thu, 12 Feb 2026 20:57:44 +0530 Subject: [PATCH 2/2] Modify application-gateway-kubernetes-ingress.spec setup Updated the spec file to change the autosetup and removed unnecessary commands. --- .../application-gateway-kubernetes-ingress.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec b/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec index 3d8f2048761..405eb3ab84e 100644 --- a/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec +++ b/SPECS/application-gateway-kubernetes-ingress/application-gateway-kubernetes-ingress.spec @@ -24,11 +24,7 @@ This is an ingress controller that can be run on Azure Kubernetes Service (AKS) to act as the ingress for an AKS cluster. %prep -%autosetup -N - -rm -rf vendor -tar -xf %{SOURCE1} --no-same-owner -%autopatch -p1 +%autosetup -p1 -a1 %build export VERSION=%{version}