Skip to content

Conversation

@glennsong09
Copy link
Collaborator

@glennsong09 glennsong09 commented Sep 8, 2025

This PR fixes #5329. Previously, the message flags field was able to be modified such that a message that is not sharable according to the share_flags field in H5O_msg_class_t could be treated as sharable. A check has been added to make sure messages that are not sharable can't be modified so that they indicate they can be shared.

The bug was first reproduced using the fuzzer and the POC file from #5329. With this change, the heap based buffer overflow no longer occurs.


Important

Fixes CVE-2025-2153 by preventing non-sharable messages from being modified to appear sharable in H5O__msg_write_real().

  • Security Fix:
    • Adds a check in H5O__msg_write_real() in H5Omessage.c to prevent non-sharable messages from being modified to appear sharable, addressing CVE-2025-2153.
    • Fixes a heap-based buffer overflow issue when processing non-sharable messages.
  • Documentation:

This description was created by Ellipsis for 4be883f. You can customize this summary. It will automatically update as commits are pushed.

vchoi-hdfgroup
vchoi-hdfgroup previously approved these changes Sep 8, 2025
- Fixed messages being able to be modified to shared when they are
not sharable

The message flags field can be modified such that a message that is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be modified -> could be modified to indicate past tense.

mattjala
mattjala previously approved these changes Sep 9, 2025
@jhendersonHDF jhendersonHDF linked an issue Sep 15, 2025 that may be closed by this pull request
@lrknox lrknox dismissed stale reviews from mattjala and vchoi-hdfgroup via 0ed7ab1 September 16, 2025 14:18
/* Check to see if the type is not sharable */
if (!(type->share_flags & H5O_SHARE_IS_SHARABLE))
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "message is not sharable");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it also be worth switching the assert statements above into real error checks?

Copy link
Member

@fortnern fortnern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really try to catch these things as early as possible. Can you move this check to H5O__chunk_deserialize()? An assertion in the current location (H5O__msg_write_real()) is fine.

@github-project-automation github-project-automation bot moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Sep 19, 2025
src/H5Ocache.c Outdated
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"message of unshareable class flagged as shareable");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace (why wasn't this picked up by the formatter?)


Fixes GitHub issue #4952

- Fixed messages being able to be modified to shared when they are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't add new notes to release_archive.txt, just Changelog.md

Copy link
Member

@fortnern fortnern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after two minor suggested changes

H5O_msg_class_g[id] && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"message of unshareable class flagged as shareable");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to delete the line, just the blank spaces in it


### Fixed security issue CVE-2025-2153

The message flags field could be modified such that a message that is not sharable according to the share_flags field in H5O_msg_class_t can be treated as sharable. An assert has been added in H5O__msg_write_real to make sure messages that are not sharable can't be modified to shared. Additionally, the check in H5O__chunk_deserialize that catche unsharable messages being marked as sharable has been improved.
Copy link
Member

@fortnern fortnern Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that catche -> that catches? that caught? for?

@lrknox lrknox merged commit 3895461 into HDFGroup:develop Oct 9, 2025
90 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in HDF5 - TRIAGE & TRACK Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - C Library Core C library issues (usually in the src directory)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Heap-based Buffer Overflow in H5SM_delete

7 participants