Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-56548 Overview
CVE-2024-56548 is an out-of-bounds write vulnerability [CWE-787] in the Linux kernel's HFS Plus (hfsplus) filesystem implementation. The flaw occurs because hfsplus queries the device logical block size multiple times during mount, allowing the size to change between reads. A loop device whose block size is modified via the LOOP_SET_BLOCK_SIZE ioctl triggers the bug. When hfsplus_read_wrapper subsequently calls hfsplus_submit_bio, the function reads a different io_size than the one used to allocate the buffer, producing a slab use-after-free and out-of-bounds write.
Critical Impact
A local user with the ability to mount crafted filesystems or manipulate loop device block sizes can corrupt kernel memory, leading to privilege escalation or system compromise.
Affected Products
- Linux kernel versions prior to the fix commits in stable branches
- Debian LTS distributions tracking affected kernel versions
- Any Linux distribution shipping the hfsplus filesystem module
Discovery Timeline
- 2024-12-27 - CVE-2024-56548 published to NVD
- 2025-03 - Debian LTS advisories issued referencing the fix
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-56548
Vulnerability Analysis
The vulnerability resides in the HFS Plus filesystem wrapper code, specifically in hfsplus_read_wrapper. During mount, the code queries the underlying block device's logical block size to allocate an I/O buffer. The same size is then queried again when submitting a bio request through hfsplus_submit_bio. If the block size changes between these two calls, the buffer allocated during the first query becomes undersized relative to the data read during submission.
The KASAN report in the kernel changelog confirms a slab-use-after-free on a 2-byte read at hfsplus_read_wrapper+0x659, triggered during hfsplus_fill_super as part of mount_bdev. The out-of-bounds write condition arises when the second block size exceeds the first, causing writes past the allocated buffer boundary.
Root Cause
The root cause is a time-of-check / time-of-use (TOCTOU) pattern in hfsplus that assumes a stable logical block size across multiple queries. Loop devices can change their block size through ioctl(LOOP_SET_BLOCK_SIZE), invalidating that assumption. The fix introduces a cached min_io_size field, initially set to sb_min_blocksize, so the filesystem uses a consistent sizing value derived from the maximum of HFSPLUS_SECTOR_SIZE and the first observed logical block size.
Attack Vector
Exploitation requires local access and the privileges necessary to mount a filesystem or configure a loop device. An attacker prepares a crafted HFS Plus image on a loop device, triggers LOOP_SET_BLOCK_SIZE to switch the block size at an opportune moment, and mounts the filesystem. The resulting out-of-bounds write into kernel slab memory can be shaped to corrupt adjacent objects, enabling privilege escalation. The vulnerability is not remotely reachable, and no public proof-of-concept exploit is listed in the CVE record.
See the upstream fix in Kernel Git Commit #f57725b for the full patch set.
Detection Methods for CVE-2024-56548
Indicators of Compromise
- Kernel log entries containing KASAN: slab-use-after-free in hfsplus_read_wrapper on instrumented kernels
- Unexpected mount syscalls targeting hfsplus from non-administrative user contexts
- ioctl activity invoking LOOP_SET_BLOCK_SIZE on loop devices immediately before hfsplus mount operations
Detection Strategies
- Audit execve and mount syscalls for hfsplus filesystem types originating from unprivileged processes or containers
- Correlate loop device configuration changes with subsequent filesystem mount events on the same device
- Monitor kernel ring buffer (dmesg) output for KASAN, oops, or general protection fault messages referencing hfsplus_read_wrapper or hfsplus_fill_super
Monitoring Recommendations
- Enable auditd rules on mount(2) and ioctl(2) syscalls with filtering for loop device and hfsplus activity
- Centralize kernel logs and alert on crash signatures tied to filesystem helpers
- Track installed kernel versions across the fleet to confirm patch coverage against the stable commits listed on git.kernel.org
How to Mitigate CVE-2024-56548
Immediate Actions Required
- Apply the kernel update from your distribution containing the upstream hfsplus fix
- Restrict the CAP_SYS_ADMIN capability and remove the ability for unprivileged users to mount arbitrary filesystems
- Blacklist the hfsplus kernel module on systems that do not require HFS Plus support
Patch Information
The fix was merged across multiple stable branches. Reference the upstream commits at Kernel Git Commit #06cbfbb, Kernel Git Commit #1c82587, and Kernel Git Commit #f57725b. Debian LTS users should apply updates from Debian LTS Announcement #1 and Debian LTS Announcement #2.
Workarounds
- Prevent automatic loading of the hfsplus module by adding blacklist hfsplus to /etc/modprobe.d/
- Disable user namespaces or restrict unprivileged_userns_clone to block unprivileged mount paths
- Enforce mount policies via AppArmor, SELinux, or seccomp profiles that deny hfsplus mounts from untrusted contexts
# Configuration example: disable the hfsplus module
echo "blacklist hfsplus" | sudo tee /etc/modprobe.d/disable-hfsplus.conf
sudo modprobe -r hfsplus 2>/dev/null || true
sudo update-initramfs -u
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

