TECHNOLOGY

Keras CVE-2025-9906: archive configuration and safe-mode enforcement

In this article
THE QUICK TAKE

A caller’s safe-mode setting needs a library that enforces it; archive restoration, custom objects and model compilation have separate meanings.

An archive could alter the protection expected by its caller

CVE-2025-9906 concerns specially constructed Keras model archives. The reviewed advisory lists Keras versions below 3.11.0 as affected and 3.11.0 as patched. It describes archive configuration invoking unsafe-deserialization behavior before a later Lambda reconstruction, despite the caller requesting safe_mode=True.

The important failure is a trust-boundary inversion: data supplied by the artifact could undermine a restriction chosen by the application. Seeing the protective argument in a notebook or service configuration therefore does not establish that an affected library enforced it. The environment that first opens the archive is the relevant one, even if a different process later performs prediction.

Read the concrete patch instead of expanding the claim

The linked upstream change adds the unsafe-deserialization API to a blocked loading-API set and restricts module-and-name reconstruction to appropriate KerasSaveable subclasses. The code evidence supports specific restrictions on object resolution. It should not be restated as a claim that every configuration value in every supported format has become inert data.

This distinction helps when an update causes an old model to fail loading. A newly rejected object can reflect the intended enforcement rather than corrupted weights. Automatically disabling protection to restore compatibility would change the acceptance decision and deserves explicit review. A useful error record preserves the rejected object identity and selected artifact, without treating every failure as a reason to download the same bytes again.

The API separates format, custom objects and compilation

The official loading reference states that safe mode disallows unsafe lambda deserialization and applies to the Keras v3 model format. It separately documents custom objects and whether to compile the restored model. The archive includes configuration, weights and potentially optimizer state; it is more than an unnamed tensor array.

Those options describe different operations. Choosing whether to compile a model does not, by its name alone, establish which reconstruction functions are permitted. Similarly, a trusted custom-object mapping is part of the accepted program environment and should be retained beside the model revision. An inspection that records only the weight filename omits information needed to understand restoration behavior.

The artifact-validation guide provides related background on separating data storage from code-loading decisions. This Keras case adds a concrete configuration-driven bypass, rather than establishing that all model formats share the same deserialization mechanism.

Make remediation evidence follow the archive

For a reproducible review, connect the accepted archive digest, Keras build, loading entry point and effective arguments. Include conversion or inspection utilities that may open the file before deployment. A patched inference image does not retroactively describe an older preprocessing environment that already restored the model.

The checksum guide explains why matching bytes answer an integrity question, while this CVE concerns permitted behavior during restoration. Preserve both findings separately, including any compatibility rejection after remediation. This article reviewed the advisory, patch and API documentation; it did not construct or execute a malicious archive, inspect private installations or verify a real compromise.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles