Skip to main content
Vulnerability Database/CVE-2024-47757

CVE-2024-47757: Linux Kernel Buffer Overflow Vulnerability

CVE-2024-47757 is a buffer overflow in Linux Kernel nilfs2 filesystem that causes out-of-bounds memory access when processing b-tree nodes. This article covers technical details, affected versions, and mitigation.

Published:

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-47757 Overview

CVE-2024-47757 is an out-of-bounds read vulnerability [CWE-125] in the Linux kernel's nilfs2 filesystem. The flaw resides in the nilfs_btree_check_delete() function, which validates whether a b-tree degenerates to a direct mapping before deleting an entry. When the root node contains no entries, the function reads memory outside the block buffer while retrieving the maximum key. A local attacker who can mount a crafted nilfs2 filesystem image can trigger the condition, leading to information disclosure or system crash. The vulnerability affects multiple Linux kernel branches and has been patched in stable trees.

Critical Impact

A local user able to mount a malformed nilfs2 image can trigger an out-of-bounds kernel memory read, resulting in denial of service or disclosure of adjacent kernel memory.

Affected Products

  • Linux Kernel (multiple stable branches prior to the fix)
  • Debian LTS distributions shipping affected kernels
  • Any Linux distribution exposing nilfs2 filesystem mounting to local users

Discovery Timeline

  • 2024-10-21 - CVE-2024-47757 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-47757

Vulnerability Analysis

The nilfs2 filesystem driver implements b-tree structures to map file blocks to on-disk locations. Before deleting a b-tree entry, nilfs_btree_check_delete() evaluates whether the tree should degenerate into a direct mapping. This check involves looking up the maximum key stored in the root node.

When the root node has zero child entries, the maximum-key lookup indexes past the end of the valid entries in the block buffer. The resulting read accesses memory outside the allocated buffer, which can leak kernel heap data or dereference invalid memory. The vulnerability maps to [CWE-125: Out-of-bounds Read].

Root Cause

The root cause is a missing bounds check for the empty-root-node case. Normal nilfs2 tooling such as mkfs.nilfs2 never produces b-tree mappings with zero child nodes, so the condition was not anticipated in the original logic. However, the root node is read directly from the storage device, and a maliciously constructed on-disk image can set the entry count to zero while still passing initial validation. The fix adds an explicit check for the empty-entries case before attempting the maximum-key retrieval.

Attack Vector

Exploitation requires local access and the ability to mount a crafted filesystem image. An attacker prepares a nilfs2 image with a b-tree root node reporting zero entries, then mounts it on the target system. Depending on kernel configuration and distribution policies, mounting may be available to unprivileged users via automounters, removable media handlers, or user namespaces. Triggering a delete operation on the mounted filesystem invokes nilfs_btree_check_delete() and reads memory beyond the block buffer.

No verified public proof-of-concept code is available. See the kernel commit fix for technical details of the patched logic.

Detection Methods for CVE-2024-47757

Indicators of Compromise

  • Kernel log entries referencing nilfs2 errors, b-tree corruption, or KASAN out-of-bounds read reports in nilfs_btree_check_delete
  • Unexpected mount events for nilfs2 filesystems from removable media or user-provided images
  • Kernel oops or panic traces originating from fs/nilfs2/btree.c

Detection Strategies

  • Enable Kernel Address Sanitizer (KASAN) in test or canary systems to detect out-of-bounds reads in nilfs2 code paths
  • Audit /proc/mounts and systemd mount journals for nilfs2 activity on hosts where it is not expected
  • Monitor dmesg output for filesystem corruption warnings related to b-tree structures

Monitoring Recommendations

  • Alert on kernel version strings matching unpatched builds across the fleet via configuration management inventory
  • Collect and centralize kernel ring buffer events to a SIEM for correlation with mount activity
  • Track processes invoking the mount syscall with filesystem type nilfs2, especially from non-root users

How to Mitigate CVE-2024-47757

Immediate Actions Required

  • Apply the stable kernel updates containing the fix commits (a8abfda7, d20674f3, c4cbcc64, and related backports) from the upstream Linux kernel
  • Install Debian LTS kernel updates referenced in the January and March 2025 advisories
  • Blacklist the nilfs2 kernel module on systems that do not require it

Patch Information

The fix adds a check for empty root node entries before retrieving the maximum key in nilfs_btree_check_delete(). Patched commits are available in multiple stable branches, including commit a8abfda7, commit d20674f3, and commit c4cbcc64. Debian users should consult the Debian LTS Announcement January 2025 and Debian LTS Announcement March 2025.

Workarounds

  • Prevent automatic mounting of nilfs2 filesystems from removable media by adjusting udisks or systemd policies
  • Disable user namespaces or restrict unprivileged mount capabilities where feasible
  • Add nilfs2 to the module blacklist in /etc/modprobe.d/ on systems that do not require it
bash
# Blacklist the nilfs2 kernel module
echo "blacklist nilfs2" | sudo tee /etc/modprobe.d/blacklist-nilfs2.conf
sudo update-initramfs -u

# Verify the module is not loaded
lsmod | grep nilfs2

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.