Update dependency keras to v3.11.0 [SECURITY] #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==3.3.2
->==3.11.0
Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
GitHub Vulnerability Alerts
CVE-2025-1550
Impact
The Keras
Model.load_model
function permits arbitrary code execution, even withsafe_mode=True
, through a manually constructed, malicious.keras
archive. By altering theconfig.json
file within the archive, an attacker can specify arbitrary Python modules and functions, along with their arguments, to be loaded and executed during model loading.Patches
This problem is fixed starting with version
3.9
.Workarounds
Only load models from trusted sources and model archives created with Keras.
References
CVE-2025-8747
Summary
It is possible to bypass the mitigation introduced in response to CVE-2025-1550, when an untrusted Keras v3 model is loaded, even when “safe_mode” is enabled, by crafting malicious arguments to built-in Keras modules.
The vulnerability is exploitable on the default configuration and does not depend on user input (just requires an untrusted model to be loaded).
Impact
Details
Keras’ safe_mode flag is designed to disallow unsafe lambda deserialization - specifically by rejecting any arbitrary embedded Python code, marked by the “lambda” class name.
https://github.com/keras-team/keras/blob/v3.8.0/keras/src/saving/serialization_lib.py#L641 -
A fix to the vulnerability, allowing deserialization of the object only from internal Keras modules, was introduced in the commit bb340d6780fdd6e115f2f4f78d8dbe374971c930.
However, it is still possible to exploit model loading, for example by reusing the internal Keras function
keras.utils.get_file
, and download remote files to an attacker-controlled location.This allows for arbitrary file overwrite which in many cases could also lead to remote code execution. For example, an attacker would be able to download a malicious
authorized_keys
file into the user’s SSH folder, giving the attacker full SSH access to the victim’s machine.Since the model does not contain arbitrary Python code, this scenario will not be blocked by “safe_mode”. It will bypass the latest fix since it uses a function from one of the approved modules (
keras
).Example
The following truncated
config.json
will cause a remote file download from https://raw.githubusercontent.com/andr3colonel/when_you_watch_computer/refs/heads/master/index.js to the local/tmp
folder, by sending arbitrary arguments to Keras’ builtin functionkeras.utils.get_file()
-PoC
Download malicious_model_download.keras to a local directory
Load the model -
index.js
was created in the/tmp
directoryFix suggestions
block_all_lambda
that allows users to completely disallow loading models with a Lambda layer.keras
,keras_hub
,keras_cv
,keras_nlp
modules and remove/block all “gadget functions” which could be used by malicious ML models.lambda_whitelist_functions
that allows users to specify a list of functions that are allowed to be invoked by a Lambda layerCredit
The vulnerability was discovered by Andrey Polkovnichenko of the JFrog Vulnerability Research
Release Notes
keras-team/keras (keras)
v3.11.0
: Keras 3.11.0Compare Source
What's Changed
fit()
/evaluate()
/predict()
.keras.ops.kaiser
function.keras.ops.hanning
function.keras.ops.cbrt
function.keras.ops.deg2rad
function.keras.ops.layer_normalization
function to leverage backend-specific performance optimizations.Backend-specific changes
JAX backend
TensorFlow backend
Flatten
layer.OpenVINO backend
New Contributors
Full Changelog: keras-team/keras@v3.10.0...v3.11.0
v3.10.0
: Keras 3.10.0Compare Source
New features
model.save()
. It is controlled via themax_shard_size
argument. Specifying this argument will split your Keras model weight file into chunks of this size at most. Useload_model()
to reload the sharded files.keras.optimizers.Muon
keras.layers.RandomElasticTransform
keras.losses.CategoricalGeneralizedCrossEntropy
(with functional versionkeras.losses.categorical_generalized_cross_entropy
)axis
argument toSparseCategoricalCrossentropy
lora_alpha
to all LoRA-enabled layers. If set, this parameter scales the low-rank adaptation delta during the forward pass.keras.activations.sparse_sigmoid
keras.ops.image.elastic_transform
keras.ops.angle
keras.ops.bartlett
keras.ops.blackman
keras.ops.hamming
keras.ops.view_as_complex
,keras.ops.view_as_real
PyTorch backend
TensorFlow backend
tf.RaggedTensor
support toEmbedding
layersynchronization
argumentOpenVINO backend
New Contributors
Full Changelog: keras-team/keras@v3.9.0...v3.10.0
v3.9.2
: Keras 3.9.2Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.9.1...v3.9.2
v3.9.1
: Keras 3.9.1Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.9.0...v3.9.1
v3.9.0
: Keras 3.9.0Compare Source
New features
keras.RematScope
andkeras.remat
. It can be used to turn on rematerizaliation for certain layers in fine-grained manner, e.g. only for layers larger than a certain size, or for a specific set of layers, or only for activations.keras.ops.rot90
keras.ops.rearrange
(Einops-style)keras.ops.signbit
keras.ops.polar
keras.ops.image.perspective_transform
keras.ops.image.gaussian_blur
keras.layers.RMSNormalization
keras.layers.AugMix
keras.layers.CutMix
keras.layers.RandomInvert
keras.layers.RandomErasing
keras.layers.RandomGaussianBlur
keras.layers.RandomPerspective
dtype
argument toJaxLayer
andFlaxLayer
layersBinaryAccuracy
metricantialias
argument tokeras.layers.Resizing
layer.npz
model files (numpy format). Thanks to Peng Zhou for reporting the vulnerability.New Contributors
Full Changelog: keras-team/keras@v3.8.0...v3.9.0
v3.8.0
: Keras 3.8.0Compare Source
New: OpenVINO backend
OpenVINO is now available as an infererence-only Keras backend. You can start using it by setting the
backend
field to"openvino"
in yourkeras.json
config file.OpenVINO is a deep learning inference-only framework tailored for CPU (x86, ARM), certain GPUs (OpenCL capable, integrated and discrete) and certain AI accelerators (Intel NPU).
Because OpenVINO does not support gradients, you cannot use it for training (e.g.
model.fit()
) -- only inference. You can train your models with the JAX/TensorFlow/PyTorch backends, and when trained, reload them with the OpenVINO backend for inference on a target device supported by OpenVINO.New: ONNX model export
You can now export your Keras models to the ONNX format from the JAX, TensorFlow, and PyTorch backends.
Just pass
format="onnx"
in yourmodel.export()
call:New: Scikit-Learn API compatibility interface
It's now possible to easily integrate Keras models into Sciki-Learn pipelines! The following wrapper classes are available:
keras.wrappers.SKLearnClassifier
: implements the sklearnClassifier
APIkeras.wrappers.SKLearnRegressor
: implements the sklearnRegressor
APIkeras.wrappers.SKLearnTransformer
: implements the sklearnTransformer
APIOther feature additions
keras.ops.diagflat
keras.ops.unravel_index
sparse_plus
activationsparsemax
activationkeras.layers.RandAugment
keras.layers.Equalization
keras.layers.MixUp
keras.layers.RandomHue
keras.layers.RandomGrayscale
keras.layers.RandomSaturation
keras.layers.RandomColorJitter
keras.layers.RandomColorDegeneration
keras.layers.RandomSharpness
keras.layers.RandomShear
axis
totversky
lossJAX specific changes
TensorFlow specific changes
keras.random.shuffle
XLA compilablePyTorch specific changes
model.export()
andkeras.export.ExportArchive
with the PyTorch backend, supporting both the TF SavedModel format and the ONNX format.New Contributors
Full Changelog: keras-team/keras@v3.7.0...v3.8.0
v3.7.0
: Keras 3.7.0Compare Source
API changes
flash_attention
argument tokeras.ops.dot_product_attention
and tokeras.layers.MultiHeadAttention
.keras.layers.STFTSpectrogram
layer (to extract STFT spectrograms from inputs as a preprocessing step) as well as its initializerkeras.initializers.STFTInitializer
.celu
,glu
,log_sigmoid
,hard_tanh
,hard_shrink
,squareplus
activations.keras.losses.Circle
loss.keras.visualization.draw_bounding_boxes
,keras.visualization.draw_segmentation_masks
,keras.visualization.plot_image_gallery
,keras.visualization.plot_segmentation_mask_gallery
.double_checkpoint
argument toBackupAndRestore
to save a fallback checkpoint in case the first checkpoint gets corrupted.CenterCrop
,RandomFlip
,RandomZoom
,RandomTranslation
,RandomCrop
.keras.ops.exp2
,keras.ops.inner
operations.Performance improvements
bias_add
.New Contributors
Full Changelog: keras-team/keras@v3.6.0...v3.7.0
v3.6.0
: Keras 3.6.0Compare Source
Highlights
keras.saving.KerasFileEditor
. Use it to inspect, diff, modify and resave Keras weights files. See basic workflow here.keras.utils.Config
class for managing experiment config parameters.BREAKING changes
keras.utils.get_file
, withextract=True
oruntar=True
, the return value will be the path of the extracted directory, rather than the path of the archive.Other changes and additions
fit()
,evaluate()
,predict()
. This enables 100% compact stacking oftrain_step
calls on accelerators (e.g. when running small models on TPU).on_batch_end
, this will disable async logging. You can force it back by addingself.async_safe = True
to your callbacks. Note that theTensorBoard
callback isn't considered async safe by default. Default callbacks like the progress bar are async safe.keras.saving.KerasFileEditor
utility to inspect, diff, modify and resave Keras weights file.keras.utils.Config
class. It behaves like a dictionary, with a few nice features:config.foo = 2
orconfig["foo"]
are both valid)config.to_json()
.config.freeze()
.bitwise_and
bitwise_invert
bitwise_left_shift
bitwise_not
bitwise_or
bitwise_right_shift
bitwise_xor
keras.ops.logdet
.keras.ops.trunc
.keras.ops.dot_product_attention
.keras.ops.histogram
.PyDataset
instances to use multithreading.verbose
inkeras.saving.ExportArchive.write_out()
method for exporting TF SavedModel.epsilon
argument inkeras.ops.normalize
.Model.get_state_tree()
method for retrieving a nested dict mapping variable paths to variable values (either as numpy arrays or backend tensors (default)). This is useful for rolling out custom JAX training loops.keras.layers.AutoContrast
,keras.layers.Solarization
.keras.layers.Pipeline
class, to apply a sequence of layers to an input. This class is useful to build a preprocessing pipeline. Compared to aSequential
model,Pipeline
features a few important differences:Model
, just a plain layer.tf.data
, the pipeline will also remaintf.data
compatible, independently of the backend you use.New Contributors
Full Changelog: keras-team/keras@v3.5.0...v3.6.0
v3.5.0
: Keras 3.5.0Compare Source
What's Changed
keras.Model.save()
and load.keras
models directly from Hugging Face Hub withkeras.saving.load_model()
.keras.optimizers.Lamb
optimizer.keras.distribution
API support for very large models.keras.ops.associative_scan
op.keras.ops.searchsorted
op.keras.utils.PyDataset.on_epoch_begin()
method.data_format
argument tokeras.layers.ZeroPadding1D
layer.Full Changelog: keras-team/keras@v3.4.1...v3.5.0
v3.4.1
: Keras 3.4.1Compare Source
This is a minor bugfix release.
v3.4.0
: Keras 3.4.0Compare Source
Highlights
keras.dtype_policies.DTypePolicyMap
for easy configuration of dtype policies of nested sublayers of a subclassed layer/model.keras.ops.argpartition
keras.ops.scan
keras.ops.lstsq
keras.ops.switch
keras.ops.dtype
keras.ops.map
keras.ops.image.rgb_to_hsv
keras.ops.image.hsv_to_rgb
What's changed
float8
inference forDense
andEinsumDense
layers.name
argument in all Keras Applications models.axis
argument inkeras.losses.Dice
.keras.utils.FeatureSpace
to be used in atf.data
pipeline even when the backend isn't TensorFlow.StringLookup
layer can now taketf.SparseTensor
as input.Metric.variables
is now recursive.training
argument toModel.compute_loss()
.dtype
argument to all losses.keras.utils.split_dataset
now supports nested structures in dataset.Full Changelog: keras-team/keras@v3.3.3...v3.4.0
v3.3.3
: Keras 3.3.3Compare Source
This is a minor bugfix release.
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.