Skip to content

Commit fe78f4f

Browse files
chore(core): Address CVE-2024-3094 and CVE-2025-31115 for xz/lzma dependency (fixes #1093). (#1094)
Co-authored-by: Lin Zhihao <[email protected]>
1 parent 5d4c676 commit fe78f4f

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

components/core/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,16 @@ if(CLP_NEED_LZMA)
312312
message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}")
313313
message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}")
314314
message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}")
315+
316+
# Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115.
317+
set(REQUIRED_LIBLZMA_VERSION "5.8.1")
318+
if(LIBLZMA_VERSION_STRING VERSION_LESS ${REQUIRED_LIBLZMA_VERSION})
319+
message(
320+
FATAL_ERROR
321+
"Detected LibLZMA version ${LIBLZMA_VERSION_STRING} is older than required"
322+
" ${REQUIRED_LIBLZMA_VERSION}"
323+
)
324+
endif()
315325
else()
316326
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma")
317327
endif()

components/core/tools/scripts/lib_install/centos-stream-9/install-packages-from-source.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ lib_install_scripts_dir="${script_dir}/.."
1212
# NOTE: The remaining installation scripts depend on boost, so we install it beforehand.
1313
"${lib_install_scripts_dir}/install-boost.sh" 1.87.0
1414

15+
"${lib_install_scripts_dir}/liblzma.sh" 5.8.1
1516
"${lib_install_scripts_dir}/msgpack.sh" 7.0.0

components/core/tools/scripts/lib_install/centos-stream-9/install-prebuilt-packages.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ dnf install -y \
2020
mariadb-connector-c-devel \
2121
openssl-devel \
2222
python3-pip \
23-
unzip \
24-
xz \
25-
xz-devel
23+
unzip
2624

2725
# Determine architecture for `task` release to install
2826
rpm_arch=$(rpm --eval "%{_arch}")

components/core/tools/scripts/lib_install/liblzma.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,45 @@ if [ "$#" -lt 1 ] ; then
2626
fi
2727
version=$1
2828

29+
# Ensure version must be greater or equal to 5.8.1 to mitigate both CVE-2024-3094 (resolved in
30+
# version >5.6.1) and CVE-2025-31115 (resolved in version >5.8.0).
31+
validate_minimum_required_version() {
32+
min_required_major=5
33+
min_required_minor=8
34+
min_required_patch=1
35+
36+
local major minor patch
37+
38+
IFS='.' read -r major minor patch <<< "$version"
39+
40+
# Check the major version
41+
if (( major > min_required_major )); then
42+
return 0
43+
elif (( major < min_required_major )); then
44+
return 1
45+
fi
46+
47+
# Check the minor version
48+
if (( minor > min_required_minor )); then
49+
return 0
50+
elif (( minor < min_required_minor )); then
51+
return 1
52+
fi
53+
54+
# Check the patch version
55+
if (( patch >= min_required_patch )); then
56+
return 0
57+
fi
58+
59+
return 1
60+
}
61+
62+
if ! validate_minimum_required_version "$version"; then
63+
echo "Error: Version $version must be greater or equal to 5.8.1 to mitigate CVE-2024-3094 and" \
64+
" CVE-2025-31115."
65+
exit 1
66+
fi
67+
2968
package_name=liblzma
3069
temp_dir=/tmp/${package_name}-installation
3170
deb_output_dir=${temp_dir}

components/core/tools/scripts/lib_install/ubuntu-jammy/install-packages-from-source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ lib_install_scripts_dir=$script_dir/..
1313
"$lib_install_scripts_dir"/install-boost.sh 1.87.0
1414

1515
"$lib_install_scripts_dir"/libarchive.sh 3.5.1
16-
"$lib_install_scripts_dir"/liblzma.sh 5.4.6
16+
"$lib_install_scripts_dir"/liblzma.sh 5.8.1
1717
"$lib_install_scripts_dir"/lz4.sh 1.8.2
1818
"$lib_install_scripts_dir"/msgpack.sh 7.0.0
1919
"$lib_install_scripts_dir"/zstandard.sh 1.4.9

0 commit comments

Comments
 (0)