Skip to main content

CVE-2023-52705: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2023-52705cvecve-2023-52705
Published: Tue May 21 2024 (05/21/2024, 15:22:54 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: nilfs2: fix underflow in second superblock position calculations Macro NILFS_SB2_OFFSET_BYTES, which computes the position of the second superblock, underflows when the argument device size is less than 4096 bytes. Therefore, when using this macro, it is necessary to check in advance that the device size is not less than a lower limit, or at least that underflow does not occur. The current nilfs2 implementation lacks this check, causing out-of-bound block access when mounting devices smaller than 4096 bytes: I/O error, dev loop0, sector 36028797018963960 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 NILFS (loop0): unable to read secondary superblock (blocksize = 1024) In addition, when trying to resize the filesystem to a size below 4096 bytes, this underflow occurs in nilfs_resize_fs(), passing a huge number of segments to nilfs_sufile_resize(), corrupting parameters such as the number of segments in superblocks. This causes excessive loop iterations in nilfs_sufile_resize() during a subsequent resize ioctl, causing semaphore ns_segctor_sem to block for a long time and hang the writer thread: INFO: task segctord:5067 blocked for more than 143 seconds. Not tainted 6.2.0-rc8-syzkaller-00015-gf6feea56f66d #0 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:segctord state:D stack:23456 pid:5067 ppid:2 flags:0x00004000 Call Trace: <TASK> context_switch kernel/sched/core.c:5293 [inline] __schedule+0x1409/0x43f0 kernel/sched/core.c:6606 schedule+0xc3/0x190 kernel/sched/core.c:6682 rwsem_down_write_slowpath+0xfcf/0x14a0 kernel/locking/rwsem.c:1190 nilfs_transaction_lock+0x25c/0x4f0 fs/nilfs2/segment.c:357 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2486 [inline] nilfs_segctor_thread+0x52f/0x1140 fs/nilfs2/segment.c:2570 kthread+0x270/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 </TASK> ... Call Trace: <TASK> folio_mark_accessed+0x51c/0xf00 mm/swap.c:515 __nilfs_get_page_block fs/nilfs2/page.c:42 [inline] nilfs_grab_buffer+0x3d3/0x540 fs/nilfs2/page.c:61 nilfs_mdt_submit_block+0xd7/0x8f0 fs/nilfs2/mdt.c:121 nilfs_mdt_read_block+0xeb/0x430 fs/nilfs2/mdt.c:176 nilfs_mdt_get_block+0x12d/0xbb0 fs/nilfs2/mdt.c:251 nilfs_sufile_get_segment_usage_block fs/nilfs2/sufile.c:92 [inline] nilfs_sufile_truncate_range fs/nilfs2/sufile.c:679 [inline] nilfs_sufile_resize+0x7a3/0x12b0 fs/nilfs2/sufile.c:777 nilfs_resize_fs+0x20c/0xed0 fs/nilfs2/super.c:422 nilfs_ioctl_resize fs/nilfs2/ioctl.c:1033 [inline] nilfs_ioctl+0x137c/0x2440 fs/nilfs2/ioctl.c:1301 ... This fixes these issues by inserting appropriate minimum device size checks or anti-underflow checks, depending on where the macro is used.

AI-Powered Analysis

AILast updated: 07/01/2025, 06:10:35 UTC

Technical Analysis

CVE-2023-52705 is a vulnerability identified in the Linux kernel's NILFS2 (New Implementation of a Log-structured File System version 2) filesystem implementation. The core issue arises from an underflow in the calculation of the second superblock's position via the macro NILFS_SB2_OFFSET_BYTES when the device size is less than 4096 bytes. Specifically, the macro does not validate the device size before performing the calculation, leading to an underflow condition. This results in out-of-bound block access during mounting operations on devices smaller than 4096 bytes, causing I/O errors and failure to read the secondary superblock. Furthermore, attempts to resize the filesystem to below 4096 bytes trigger a similar underflow in the nilfs_resize_fs() function. This passes an excessively large number of segments to nilfs_sufile_resize(), corrupting superblock parameters such as segment counts. The corruption leads to excessive loop iterations during subsequent resize ioctl calls, causing semaphore blocking (ns_segctor_sem) and hanging the writer thread (segctord). The vulnerability thus impacts filesystem stability and reliability, potentially causing system hangs and I/O errors. The fix involves adding minimum device size checks and anti-underflow validations around the macro usage to prevent these erroneous calculations and out-of-bound accesses. This vulnerability affects Linux kernel versions identified by the given commit hash (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) and is relevant to systems using NILFS2 on devices smaller than 4KB, which is an uncommon but possible configuration in embedded or specialized environments. No known exploits are reported in the wild at this time.

Potential Impact

For European organizations, the impact of CVE-2023-52705 is primarily on systems running Linux with NILFS2 filesystems, especially where small block devices (under 4096 bytes) are used. While such configurations are rare in mainstream enterprise environments, they may exist in embedded systems, IoT devices, or specialized storage setups. The vulnerability can lead to filesystem corruption, I/O errors, and system hangs, potentially causing denial of service conditions on affected hosts. This could disrupt critical services, data processing, or storage availability. Organizations relying on Linux-based infrastructure for critical operations, including telecommunications, industrial control systems, or cloud services, may face operational instability if vulnerable devices are present. Additionally, the semaphore blocking and thread hangs could degrade system performance or require manual intervention to recover. Although no direct data breach or privilege escalation is indicated, the loss of availability and potential data corruption poses a significant risk to business continuity and data integrity. European entities with embedded Linux deployments or those using NILFS2 for specific use cases should assess their exposure carefully.

Mitigation Recommendations

1. Immediate application of the official Linux kernel patches that address the underflow checks in NILFS2 is essential. Organizations should update to kernel versions that include the fix corresponding to commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 or later. 2. Audit and inventory all Linux systems to identify usage of NILFS2 filesystems, particularly on devices with sizes below 4096 bytes. 3. Avoid deploying NILFS2 on devices smaller than 4KB; if such devices are necessary, ensure that kernel versions are patched and tested for stability. 4. Implement monitoring for filesystem I/O errors and hung kernel threads (e.g., segctord) to detect early signs of exploitation or malfunction. 5. For embedded and IoT devices, coordinate with vendors to ensure firmware updates include the fix. 6. Consider alternative filesystems if NILFS2 is not a strict requirement, especially in environments where device sizes are constrained. 7. Establish robust backup and recovery procedures to mitigate potential data corruption consequences. 8. Restrict access to systems with NILFS2 filesystems to trusted administrators to reduce risk of intentional misuse or accidental triggering of the vulnerability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-03-07T14:49:46.891Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9830c4522896dcbe73ce

Added to database: 5/21/2025, 9:09:04 AM

Last enriched: 7/1/2025, 6:10:35 AM

Last updated: 7/27/2025, 9:03:15 AM

Views: 8

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats