<Vulnerability name="CVE-2026-12481">
    <DocumentDistribution xml:lang="en">Copyright © 2012 Red Hat, Inc. All rights reserved.</DocumentDistribution>
    <ThreatSeverity>Important</ThreatSeverity>
    <PublicDate>2026-07-03T20:36:05</PublicDate>
    <Bugzilla id="2496942" url="https://bugzilla.redhat.com/show_bug.cgi?id=2496942" xml:lang="en:us">
keras: Keras: Arbitrary code execution via deserialization vulnerability
    </Bugzilla>
    <CVSS3 status="draft">
        <CVSS3BaseScore>8.8</CVSS3BaseScore>
        <CVSS3ScoringVector>CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H</CVSS3ScoringVector>
    </CVSS3>
    <CWE>CWE-502</CWE>
    <Details xml:lang="en:us" source="Mitre">
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.
    </Details>
    <Details xml:lang="en:us" source="Red Hat">
A flaw was found in the Keras deep learning library. This vulnerability allows a remote attacker to execute arbitrary code on the system by exploiting improper handling of deserialization in the `Lambda` layer. Specifically, a security safeguard designed to prevent unsafe deserialization is bypassed when the `safe_mode` setting is not explicitly enabled, allowing malicious code to be processed. This can lead to complete compromise of the affected server or user process.
    </Details>
    <Statement xml:lang="en:us">
This is an Important arbitrary code execution vulnerability in the Keras deep learning library, impacting Red Hat OpenShift AI components. The flaw arises from improper deserialization in the `Lambda` layer, where a security safeguard is bypassed if `safe_mode` is not explicitly enabled. Exploitation requires user interaction, such as loading a specially crafted Keras model.
    </Statement>
    <Mitigation xml:lang="en:us">
To reduce exposure, only deserialize Keras models from trusted sources. When deserializing models, explicitly enable `safe_mode` by wrapping the deserialization call within a `SafeModeScope(True)` context. This ensures the deserialization safeguard is enforced, preventing the execution of arbitrary code.
    </Mitigation>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>rhoai/odh-kserve-agent-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>rhoai/odh-kserve-controller-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>rhoai/odh-kserve-router-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-kserve-storage-initializer-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-modelmesh-runtime-adapter-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-pipeline-runtime-tensorflow-cuda-py312-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-pipeline-runtime-tensorflow-rocm-py312-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-workbench-jupyter-tensorflow-cuda-py312-rhel9</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:openshift_ai">
        <ProductName>Red Hat OpenShift AI (RHOAI)</ProductName>
        <FixState>Affected</FixState>
        <PackageName>rhoai/odh-workbench-jupyter-tensorflow-rocm-py312-rhel9</PackageName>
    </PackageState>
    <References xml:lang="en:us">
https://www.cve.org/CVERecord?id=CVE-2026-12481
https://nvd.nist.gov/vuln/detail/CVE-2026-12481
https://huntr.com/bounties/59ceaed1-c8a3-4135-8f94-169ade02823d
    </References>
</Vulnerability>