Skip to content

Commit 7c1df70

Browse files
CBL-Mariner-Botazurelinux-securityakhila-gurujujslobodzian
authored
Merge PR "[AUTO-CHERRYPICK] [AutoPR- Security] Patch tensorflow for CVE-2026-2492 [HIGH] - branch 3.0-dev" #16038
Co-authored-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> Co-authored-by: Akhila Guruju <v-guakhila@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent bf11b18 commit 7c1df70

2 files changed

Lines changed: 101 additions & 1 deletion

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
From aea471bdcb78188fbee20a081e5cebcbbd9d34a9 Mon Sep 17 00:00:00 2001
2+
From: "A. Unique TensorFlower" <gardener@tensorflow.org>
3+
Date: Mon, 15 Dec 2025 13:20:46 -0800
4+
Subject: [PATCH] Disable HDF5 plugin loading when importing h5py in
5+
Tensorflow.
6+
7+
Set the HDF5_PLUGIN_PATH environment variable to "disable" before importing h5py to prevent the loading of external HDF5 plugins.
8+
9+
PiperOrigin-RevId: 844896565
10+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
11+
Upstream-reference: https://github.com/tensorflow/tensorflow/commit/46e7f7fb144fd11cf6d17c23dd47620328d77082.patch
12+
---
13+
tensorflow/python/keras/engine/training.py | 3 +++
14+
tensorflow/python/keras/keras_parameterized.py | 4 ++++
15+
tensorflow/python/keras/saving/hdf5_format.py | 3 +++
16+
tensorflow/python/keras/saving/save.py | 5 ++++-
17+
4 files changed, 14 insertions(+), 1 deletion(-)
18+
19+
diff --git a/tensorflow/python/keras/engine/training.py b/tensorflow/python/keras/engine/training.py
20+
index 1e94ca45..182db7b0 100644
21+
--- a/tensorflow/python/keras/engine/training.py
22+
+++ b/tensorflow/python/keras/engine/training.py
23+
@@ -83,6 +83,9 @@ from tensorflow.tools.docs import doc_controls
24+
25+
# pylint: disable=g-import-not-at-top
26+
try:
27+
+ # Disable loading HDF5 plugins from a default path and prevent ZDI-CAN-25480.
28+
+ # Importing h5py prior to importing tensorflow will restore the old behavior.
29+
+ os.environ['HDF5_PLUGIN_PATH'] = 'disable'
30+
import h5py
31+
except ImportError:
32+
h5py = None
33+
diff --git a/tensorflow/python/keras/keras_parameterized.py b/tensorflow/python/keras/keras_parameterized.py
34+
index 054df939..1a44e6b7 100644
35+
--- a/tensorflow/python/keras/keras_parameterized.py
36+
+++ b/tensorflow/python/keras/keras_parameterized.py
37+
@@ -17,6 +17,7 @@
38+
import collections
39+
import functools
40+
import itertools
41+
+import os
42+
import unittest
43+
44+
from absl.testing import parameterized
45+
@@ -30,6 +31,9 @@ from tensorflow.python.platform import test
46+
from tensorflow.python.util import nest
47+
48+
try:
49+
+ # Disable loading HDF5 plugins from a default path and prevent ZDI-CAN-25480.
50+
+ # Importing h5py prior to importing tensorflow will restore the old behavior.
51+
+ os.environ['HDF5_PLUGIN_PATH'] = 'disable'
52+
import h5py # pylint:disable=g-import-not-at-top
53+
except ImportError:
54+
h5py = None
55+
diff --git a/tensorflow/python/keras/saving/hdf5_format.py b/tensorflow/python/keras/saving/hdf5_format.py
56+
index 1f6bbc43..05a2c928 100644
57+
--- a/tensorflow/python/keras/saving/hdf5_format.py
58+
+++ b/tensorflow/python/keras/saving/hdf5_format.py
59+
@@ -34,6 +34,9 @@ from tensorflow.python.platform import tf_logging as logging
60+
61+
# pylint: disable=g-import-not-at-top
62+
try:
63+
+ # Disable loading HDF5 plugins from a default path and prevent ZDI-CAN-25480.
64+
+ # Importing h5py prior to importing tensorflow will restore the old behavior.
65+
+ os.environ['HDF5_PLUGIN_PATH'] = 'disable'
66+
import h5py
67+
HDF5_OBJECT_HEADER_LIMIT = 64512
68+
except ImportError:
69+
diff --git a/tensorflow/python/keras/saving/save.py b/tensorflow/python/keras/saving/save.py
70+
index eee85923..b9ba0bc2 100644
71+
--- a/tensorflow/python/keras/saving/save.py
72+
+++ b/tensorflow/python/keras/saving/save.py
73+
@@ -13,7 +13,7 @@
74+
# limitations under the License.
75+
# ==============================================================================
76+
"""Keras model saving code."""
77+
-
78+
+import os
79+
from tensorflow.python import tf2
80+
from tensorflow.python.keras.saving import hdf5_format
81+
from tensorflow.python.keras.saving import saving_utils
82+
@@ -25,6 +25,9 @@ from tensorflow.python.keras.utils.io_utils import path_to_string
83+
84+
# pylint: disable=g-import-not-at-top
85+
try:
86+
+ # Disable loading HDF5 plugins from a default path and prevent ZDI-CAN-25480.
87+
+ # Importing h5py prior to importing tensorflow will restore the old behavior.
88+
+ os.environ['HDF5_PLUGIN_PATH'] = 'disable'
89+
import h5py
90+
except ImportError:
91+
h5py = None
92+
--
93+
2.45.4
94+

SPECS/tensorflow/tensorflow.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: TensorFlow is an open source machine learning framework for everyone.
22
Name: tensorflow
33
Version: 2.16.1
4-
Release: 10%{?dist}
4+
Release: 11%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -17,6 +17,7 @@ Patch4: CVE-2024-35195.patch
1717
Patch5: CVE-2024-5569.patch
1818
Patch6: CVE-2024-6923.patch
1919
Patch7: CVE-2026-21441.patch
20+
Patch8: CVE-2026-2492.patch
2021
BuildRequires: bazel
2122
BuildRequires: binutils
2223
BuildRequires: build-essential
@@ -105,6 +106,8 @@ popd
105106

106107
popd
107108

109+
patch -p1 < %{PATCH8}
110+
108111
export TF_PYTHON_VERSION=3.12
109112
ln -s %{_bindir}/python3 %{_bindir}/python
110113

@@ -134,6 +137,9 @@ bazel --batch build //tensorflow/tools/pip_package:build_pip_package
134137
%{_bindir}/toco_from_protos
135138

136139
%changelog
140+
* Tue Feb 24 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.16.1-11
141+
- Patch for CVE-2026-2492
142+
137143
* Tue Jan 13 2026 Aditya Singh <v-aditysing@microsoft.com> - 2.16.1-10
138144
- Patch for CVE-2026-21441
139145

0 commit comments

Comments
 (0)