Skip to content

Commit 43dfa39

Browse files
authored
[MEDIUM] Patch packer for CVE-2025-22872 (#13532)
1 parent 8a29e28 commit 43dfa39

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

SPECS/packer/CVE-2025-22872.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From c87c77a12e5554d376945bd488e56d4fc5b9e5ac Mon Sep 17 00:00:00 2001
2+
From: archana25-ms <[email protected]>
3+
Date: Tue, 22 Apr 2025 06:32:35 +0000
4+
Subject: [PATCH] Address CVE-2025-22872
5+
Upstream Patch Reference: https://github.com/golang/net/commit/e1fcd82abba34df74614020343be8eb1fe85f0d9
6+
7+
---
8+
vendor/golang.org/x/net/html/token.go | 18 ++++++++++++++++--
9+
1 file changed, 16 insertions(+), 2 deletions(-)
10+
11+
diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go
12+
index 3c57880..6598c1f 100644
13+
--- a/vendor/golang.org/x/net/html/token.go
14+
+++ b/vendor/golang.org/x/net/html/token.go
15+
@@ -839,8 +839,22 @@ func (z *Tokenizer) readStartTag() TokenType {
16+
if raw {
17+
z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end]))
18+
}
19+
- // Look for a self-closing token like "<br/>".
20+
- if z.err == nil && z.buf[z.raw.end-2] == '/' {
21+
+ // Look for a self-closing token (e.g. <br/>).
22+
+ //
23+
+ // Originally, we did this by just checking that the last character of the
24+
+ // tag (ignoring the closing bracket) was a solidus (/) character, but this
25+
+ // is not always accurate.
26+
+ //
27+
+ // We need to be careful that we don't misinterpret a non-self-closing tag
28+
+ // as self-closing, as can happen if the tag contains unquoted attribute
29+
+ // values (i.e. <p a=/>).
30+
+ //
31+
+ // To avoid this, we check that the last non-bracket character of the tag
32+
+ // (z.raw.end-2) isn't the same character as the last non-quote character of
33+
+ // the last attribute of the tag (z.pendingAttr[1].end-1), if the tag has
34+
+ // attributes.
35+
+ nAttrs := len(z.attr)
36+
+ if z.err == nil && z.buf[z.raw.end-2] == '/' && (nAttrs == 0 || z.raw.end-2 != z.attr[nAttrs-1][1].end-1) {
37+
return SelfClosingTagToken
38+
}
39+
return StartTagToken
40+
--
41+
2.45.3
42+

SPECS/packer/packer.spec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Summary: Tool for creating identical machine images for multiple platforms from a single source configuration.
55
Name: packer
66
Version: 1.9.5
7-
Release: 8%{?dist}
7+
Release: 9%{?dist}
88
License: MPLv2.0
99
Vendor: Microsoft Corporation
1010
Distribution: Azure Linux
@@ -42,6 +42,7 @@ Patch7: CVE-2025-22868.patch
4242
Patch8: CVE-2025-30204.patch
4343
Patch9: CVE-2025-22870.patch
4444
Patch10: CVE-2024-51744.patch
45+
Patch11: CVE-2025-22872.patch
4546

4647
BuildRequires: golang >= 1.21
4748
BuildRequires: kernel-headers
@@ -51,10 +52,7 @@ BuildRequires: glibc-devel
5152
Packer is a tool for building identical machine images for multiple platforms from a single source configuration.
5253

5354
%prep
54-
%autosetup -N
55-
# Apply vendor before patching
56-
tar --no-same-owner -xf %{SOURCE1}
57-
%autopatch -p1
55+
%autosetup -p1 -a1
5856

5957
%build
6058
export GOPATH=%{our_gopath}
@@ -76,6 +74,8 @@ go test -mod=vendor
7674
%{_bindir}/packer
7775

7876
%changelog
77+
* Tue Apr 22 2025 Archana Shettigar <[email protected]> - 1.9.5-9
78+
- Patch CVE-2025-22872
7979

8080
* Tue Apr 15 2025 Sreeniavsulu Malavathula <[email protected]> - 1.9.5-8
8181
- Fix CVE-2025-22870, CVE-2024-51744 with upstream patches

0 commit comments

Comments
 (0)