Skip to content

Commit 0262b43

Browse files
[AUTO-CHERRYPICK] [Medium] patch reaper for CVE-2024-28863 - branch main (#13014)
Co-authored-by: Kevin Lockwood <57274670+kevin-b-lockwood@users.noreply.github.com>
1 parent f63c0f3 commit 0262b43

2 files changed

Lines changed: 83 additions & 5 deletions

File tree

SPECS/reaper/CVE-2024-28863.patch

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From d5c11013abfd08ccbdf829de8070e0ed275d0c61 Mon Sep 17 00:00:00 2001
2+
From: Kevin Lockwood <v-klockwood@microsoft.com>
3+
Date: Fri, 14 Mar 2025 14:01:06 -0700
4+
Subject: [PATCH] [Medium] patch reaper for CVE-2024-28863
5+
6+
Link: https://github.com/isaacs/node-tar/commit/fe8cd57da5686f8695415414bda49206a545f7f7.patch
7+
---
8+
npm/node_modules/tar/lib/unpack.js | 25 +++++++++++++++++++++----
9+
1 file changed, 21 insertions(+), 4 deletions(-)
10+
11+
diff --git a/npm/node_modules/tar/lib/unpack.js b/npm/node_modules/tar/lib/unpack.js
12+
index 726c457..7225361 100644
13+
--- a/npm/node_modules/tar/lib/unpack.js
14+
+++ b/npm/node_modules/tar/lib/unpack.js
15+
@@ -174,6 +174,12 @@ class Unpack extends Parser {
16+
this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?
17+
process.getgid() : null
18+
19+
+ // prevent excessively deep nesting of subfolders
20+
+ // set to `Infinity` to remove this restriction
21+
+ this.maxDepth = typeof opt.maxDepth === 'number'
22+
+ ? opt.maxDepth
23+
+ : DEFAULT_MAX_DEPTH
24+
+
25+
// mostly just for testing, but useful in some cases.
26+
// Forcibly trigger a chown on every entry, no matter what
27+
this.forceChown = opt.forceChown === true
28+
@@ -219,11 +225,12 @@ class Unpack extends Parser {
29+
}
30+
31+
[CHECKPATH] (entry) {
32+
+ const p = normPath(entry.path)
33+
+ const parts = p.split('/')
34+
+
35+
if (this.strip) {
36+
- const parts = normPath(entry.path).split('/')
37+
if (parts.length < this.strip)
38+
return false
39+
- entry.path = parts.slice(this.strip).join('/')
40+
41+
if (entry.type === 'Link') {
42+
const linkparts = normPath(entry.linkpath).split('/')
43+
@@ -232,11 +239,21 @@ class Unpack extends Parser {
44+
else
45+
return false
46+
}
47+
+ parts.splice(0, this.strip)
48+
+ entry.path = parts.join('/')
49+
+ }
50+
+
51+
+ if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
52+
+ this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {
53+
+ entry,
54+
+ path: p,
55+
+ depth: parts.length,
56+
+ maxDepth: this.maxDepth,
57+
+ })
58+
+ return false
59+
}
60+
61+
if (!this.preservePaths) {
62+
- const p = normPath(entry.path)
63+
- const parts = p.split('/')
64+
if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) {
65+
this.warn(`path contains '..'`, p)
66+
return false
67+
--
68+
2.34.1
69+

SPECS/reaper/reaper.spec

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Summary: Reaper for cassandra is a tool for running Apache Cassandra repairs against single or multi-site clusters.
77
Name: reaper
88
Version: 3.1.1
9-
Release: 16%{?dist}
9+
Release: 17%{?dist}
1010
License: ASL 2.0
1111
Vendor: Microsoft Corporation
1212
Distribution: Mariner
@@ -47,6 +47,7 @@ Patch11: CVE-2024-21538.patch
4747
Patch12: CVE-2020-28458.patch
4848
Patch13: CVE-2024-52798.patch
4949
Patch14: CVE-2020-24025.patch
50+
Patch15: CVE-2024-28863.patch
5051

5152
BuildRequires: git
5253
BuildRequires: javapackages-tools
@@ -102,11 +103,16 @@ ln -sf ../lib/node_modules/npm/bin/npm-cli.js bin/npm
102103
ln -sf ../lib/node_modules/npm/bin/npx-cli.js bin/npx
103104

104105
cp n/versions/node/14.18.0/bin/node bin
105-
106-
ls -al
107106
popd
108107

109-
%autopatch -p1
108+
%autopatch -p1 -M 14
109+
110+
pushd $tmp_local_dir/lib/node_modules/
111+
%autopatch -p1 15
112+
popd
113+
pushd $tmp_local_dir/n/versions/node/14.18.0/lib/node_modules/
114+
%autopatch -p1 15
115+
popd
110116

111117
rsync -azvhr $tmp_local_dir/ "%{_prefix}/local"
112118
rm -rf $tmp_local_dir
@@ -184,6 +190,9 @@ fi
184190
%{_unitdir}/cassandra-%{name}.service
185191

186192
%changelog
193+
* Thu Mar 13 2025 Kevin Lockwood <v-klockwood@microsoft.com> - 3.1.1-17
194+
- Patch CVE-2024-28863
195+
187196
* Mon Feb 17 2025 Kanishk Bansal <kanbansal@microsoft.com> - 3.1.1-16
188197
- Patch CVE-2020-24025 and CVE-2024-52798
189198

@@ -194,7 +203,7 @@ fi
194203
* Fri Oct 18 2024 Rohit Rawat <rohitrawat@microsoft.com> - 3.1.1-14
195204
- Patch CVE-2024-45590 in body-parser module
196205

197-
* Thu Oct 15 2024 Rohit Rawat <rohitrawat@microsoft.com> - 3.1.1-13
206+
* Thu Oct 17 2024 Rohit Rawat <rohitrawat@microsoft.com> - 3.1.1-13
198207
- CVE-2024-45296: upgrade path-to-regexp from 0.1.7 to 1.1.11 in reaper-srcui-node-modules
199208
- CVE-2024-43799: patch send in reaper-srcui-node-modules
200209
- CVE-2024-43800: patch serve-static in reaper-srcui-node-modules

0 commit comments

Comments
 (0)