Skip to content

Commit 3304dc2

Browse files
authored
Patch nodejs18 to address CVE-2023-21100 (#9250)
1 parent 07800af commit 3304dc2

7 files changed

Lines changed: 56 additions & 363 deletions

SPECS/nodejs/CVE-2023-21100.patch

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 901960817a6dc7b40c68c47bcd77037d5fc5d1ea Mon Sep 17 00:00:00 2001
2+
From: Mitch Zhu <mitchzhu@microsoft.com>
3+
Date: Wed, 29 May 2024 19:11:14 +0000
4+
Subject: [PATCH] Address CVE-2023-21100
5+
6+
If the extra field was larger than the space the user provided with
7+
inflateGetHeader(), and if multiple calls of inflate() delivered
8+
the extra header data, then there could be a buffer overflow of the
9+
provided space. This commit assures that provided space is not
10+
exceeded.
11+
---
12+
deps/v8/third_party/zlib/contrib/optimizations/inflate.c | 5 +++--
13+
deps/v8/third_party/zlib/inflate.c | 5 +++--
14+
2 files changed, 6 insertions(+), 4 deletions(-)
15+
16+
diff --git a/deps/v8/third_party/zlib/contrib/optimizations/inflate.c b/deps/v8/third_party/zlib/contrib/optimizations/inflate.c
17+
index 4841cd96..1007f062 100644
18+
--- a/deps/v8/third_party/zlib/contrib/optimizations/inflate.c
19+
+++ b/deps/v8/third_party/zlib/contrib/optimizations/inflate.c
20+
@@ -772,8 +772,9 @@ int flush;
21+
if (copy > have) copy = have;
22+
if (copy) {
23+
if (state->head != Z_NULL &&
24+
- state->head->extra != Z_NULL) {
25+
- len = state->head->extra_len - state->length;
26+
+ state->head->extra != Z_NULL &&
27+
++ (len = state->head->extra_len - state->length) <
28+
++ state->head->extra_max) {
29+
zmemcpy(state->head->extra + len, next,
30+
len + copy > state->head->extra_max ?
31+
state->head->extra_max - len : copy);
32+
diff --git a/deps/v8/third_party/zlib/inflate.c b/deps/v8/third_party/zlib/inflate.c
33+
index 7543c33d..384af93f 100644
34+
--- a/deps/v8/third_party/zlib/inflate.c
35+
+++ b/deps/v8/third_party/zlib/inflate.c
36+
@@ -761,8 +761,9 @@ int flush;
37+
if (copy > have) copy = have;
38+
if (copy) {
39+
if (state->head != Z_NULL &&
40+
- state->head->extra != Z_NULL) {
41+
- len = state->head->extra_len - state->length;
42+
+ state->head->extra != Z_NULL &&
43+
++ (len = state->head->extra_len - state->length) <
44+
++ state->head->extra_max) {
45+
zmemcpy(state->head->extra + len, next,
46+
len + copy > state->head->extra_max ?
47+
state->head->extra_max - len : copy);
48+
--
49+
2.34.1
50+

SPECS/nodejs/CVE-2023-42282.patch

Lines changed: 0 additions & 111 deletions
This file was deleted.

SPECS/nodejs/CVE-2024-22025.patch

Lines changed: 0 additions & 144 deletions
This file was deleted.

SPECS/nodejs/CVE-2024-24806.patch

Lines changed: 0 additions & 31 deletions
This file was deleted.

SPECS/nodejs/CVE-2024-27983.patch

Lines changed: 0 additions & 34 deletions
This file was deleted.

SPECS/nodejs/disable-tlsv1-tlsv1-1.patch

Lines changed: 0 additions & 42 deletions
This file was deleted.

SPECS/nodejs/nodejs18.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name: nodejs18
66
# WARNINGS: MUST check and update the 'npm_version' macro for every version update of this package.
77
# The version of NPM can be found inside the sources under 'deps/npm/package.json'.
88
Version: 18.20.2
9-
Release: 1%{?dist}
9+
Release: 2%{?dist}
1010
License: BSD and MIT and Public Domain and NAIST-2003 and Artistic-2.0
1111
Group: Applications/System
1212
Vendor: Microsoft Corporation
@@ -16,6 +16,7 @@ URL: https://github.com/nodejs/node
1616
# !!!! because it contains patented algorithms.
1717
# !!! => use clean-source-tarball.sh script to create a clean and reproducible source tarball.
1818
Source0: https://nodejs.org/download/release/v%{version}/node-v%{version}.tar.xz
19+
Patch0: CVE-2023-21100.patch
1920
BuildRequires: brotli-devel
2021
BuildRequires: coreutils >= 8.22
2122
BuildRequires: gcc
@@ -116,6 +117,10 @@ make cctest
116117
%{_datadir}/systemtap/tapset/node.stp
117118

118119
%changelog
120+
* Wed May 29 2024 Mitch Zhu <mitchzhu@microsoft.com> - 18.20.2-2
121+
- Patch CVE-2023-21100.
122+
- Remove unused patches.
123+
119124
* Fri Apr 26 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 18.20.2-1
120125
- Auto-upgrade to 18.20.2 - address multiple CVEs.
121126
- Remove patches as the upgrade already has these changes.

0 commit comments

Comments
 (0)