Skip to content

[AutoPR- Security] Patch keras for CVE-2026-0897 [HIGH]#15517

Merged
jslobodzian merged 2 commits intomicrosoft:fasttrack/3.0from
azurelinux-security:azure-autosec/keras/3.0/1027993
Jan 23, 2026
Merged

[AutoPR- Security] Patch keras for CVE-2026-0897 [HIGH]#15517
jslobodzian merged 2 commits intomicrosoft:fasttrack/3.0from
azurelinux-security:azure-autosec/keras/3.0/1027993

Conversation

@azurelinux-security
Copy link
Contributor

@azurelinux-security azurelinux-security commented Jan 16, 2026

Auto Patch keras for CVE-2026-0897.

Autosec pipeline run -> https://dev.azure.com/mariner-org/mariner/_build/results?buildId=1027993&view=results

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

What does the PR accomplish, why was it needed?

Change Log
Does this affect the toolchain?

YES/NO

Associated issues
  • N/A
Links to CVEs
Test Methodology

@akhila-guruju
Copy link
Contributor

akhila-guruju commented Jan 21, 2026

AI backport seems correct.
The upstream fix prevents DoS conditions caused by malicious HDF5 dataset metadata by validating dataset shape and total byte size before loading.

In keras v3.3.3, the file keras/src/saving/file_editor.py is not present. However, HDF5 datasets are still loaded via keras/src/saving/saving_lib.py. The patch introduces explicit shape validation and a 4 GiB maximum size check, ensuring oversized datasets are rejected safely and deterministically without attempting allocation.

Verified the AI backported patch with PoC (PoC is created locally to check functionality and not available in upstream). PFA.

patch with extra print inside __getitem__ func: 0001-Address-CVE.patch
1st PoC: poc3.py
2nd PoC: poc4-2gb.py

1st PoC: run -> $python3 poc3.py
With Patch: The message “HDF5 dataset too large to load safely” is raised by the patch, and “ENTERED H5Entry.getitem” was added to explicitly confirm execution of the guarded code path.
image

Without Patch: Although the script fails due to the extremely large dataset size, the resulting error does not originate from Keras and occurs only after an unbounded allocation attempt.
image

2nd PoC with dataset size of 4.2GiB: run -> $python3 poc4-2gb.py
With Patch: The msg "HDF% dataset too large to load safely" is from patch and "ENTERED H5Entry.getitem" was added to explicitly confirm execution of the guarded code path.
image

Without Patch: No error message is raised by keras instead, the OS kernel terminates the process due to memory exhaustion. I feel this behavior may vary from system to system.
image

@Kanishk-Bansal Kanishk-Bansal marked this pull request as ready for review January 21, 2026 20:49
@Kanishk-Bansal Kanishk-Bansal requested a review from a team as a code owner January 21, 2026 20:49
@Kanishk-Bansal
Copy link
Contributor

/azurepipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jslobodzian jslobodzian merged commit de7079d into microsoft:fasttrack/3.0 Jan 23, 2026
15 checks passed
CBL-Mariner-Bot pushed a commit that referenced this pull request Jan 23, 2026
Co-authored-by: jslobodzian <joslobo@microsoft.com>
(cherry picked from commit de7079d)
@CBL-Mariner-Bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants