Skip to content

HFS+: Validate compressed attribute record bounds#1708

Merged
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2969-hfs-heap-read
Apr 27, 2026
Merged

HFS+: Validate compressed attribute record bounds#1708
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2969-hfs-heap-read

Conversation

@val-ms
Copy link
Copy Markdown
Contributor

@val-ms val-ms commented Apr 9, 2026

The HFS+ compressed-file attribute parser validated the attribute name length as a UTF-16 character count, but later used that same field as a byte offset by multiplying it by two. A crafted attribute record could therefore place the inline attribute record header near the end of the node and trigger an out-of-bounds read when ClamAV copied the record header or payload.
This read does not cause a crash on any systems we tested and we do not consider this issue to be a security issue.

Fix this by converting the attribute name length to a checked byte count before using it in offset calculations. Validate that the inline attribute record header fits in the node before reading it, and verify that the claimed attribute payload also fits before copying it.

Credit: Sebastián Alba Vives

CLAM-2969

The HFS+ compressed-file attribute parser validated the attribute name
length as a UTF-16 character count, but later used that same field as a
byte offset by multiplying it by two. A crafted attribute record could
therefore place the inline attribute record header near the end of the
node and trigger an out-of-bounds read when ClamAV copied the record
header or payload.

Fix this by converting the attribute name length to a checked byte count
before using it in offset calculations. Validate that the inline
attribute record header fits in the node before reading it, and verify
that the claimed attribute payload also fits before copying it.

Credit: Sebastián Alba Vives

CLAM-2969
@val-ms val-ms merged commit a136d00 into Cisco-Talos:main Apr 27, 2026
25 of 27 checks passed
@val-ms val-ms deleted the CLAM-2969-hfs-heap-read branch April 27, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants