Skip to main content

CVE-2022-48631: Vulnerability in Linux Linux

High
VulnerabilityCVE-2022-48631cvecve-2022-48631
Published: Sun Apr 28 2024 (04/28/2024, 12:59:06 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 When walking through an inode extents, the ext4_ext_binsearch_idx() function assumes that the extent header has been previously validated. However, there are no checks that verify that the number of entries (eh->eh_entries) is non-zero when depth is > 0. And this will lead to problems because the EXT_FIRST_INDEX() and EXT_LAST_INDEX() will return garbage and result in this: [ 135.245946] ------------[ cut here ]------------ [ 135.247579] kernel BUG at fs/ext4/extents.c:2258! [ 135.249045] invalid opcode: 0000 [#1] PREEMPT SMP [ 135.250320] CPU: 2 PID: 238 Comm: tmp118 Not tainted 5.19.0-rc8+ #4 [ 135.252067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 [ 135.255065] RIP: 0010:ext4_ext_map_blocks+0xc20/0xcb0 [ 135.256475] Code: [ 135.261433] RSP: 0018:ffffc900005939f8 EFLAGS: 00010246 [ 135.262847] RAX: 0000000000000024 RBX: ffffc90000593b70 RCX: 0000000000000023 [ 135.264765] RDX: ffff8880038e5f10 RSI: 0000000000000003 RDI: ffff8880046e922c [ 135.266670] RBP: ffff8880046e9348 R08: 0000000000000001 R09: ffff888002ca580c [ 135.268576] R10: 0000000000002602 R11: 0000000000000000 R12: 0000000000000024 [ 135.270477] R13: 0000000000000000 R14: 0000000000000024 R15: 0000000000000000 [ 135.272394] FS: 00007fdabdc56740(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000 [ 135.274510] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 135.276075] CR2: 00007ffc26bd4f00 CR3: 0000000006261004 CR4: 0000000000170ea0 [ 135.277952] Call Trace: [ 135.278635] <TASK> [ 135.279247] ? preempt_count_add+0x6d/0xa0 [ 135.280358] ? percpu_counter_add_batch+0x55/0xb0 [ 135.281612] ? _raw_read_unlock+0x18/0x30 [ 135.282704] ext4_map_blocks+0x294/0x5a0 [ 135.283745] ? xa_load+0x6f/0xa0 [ 135.284562] ext4_mpage_readpages+0x3d6/0x770 [ 135.285646] read_pages+0x67/0x1d0 [ 135.286492] ? folio_add_lru+0x51/0x80 [ 135.287441] page_cache_ra_unbounded+0x124/0x170 [ 135.288510] filemap_get_pages+0x23d/0x5a0 [ 135.289457] ? path_openat+0xa72/0xdd0 [ 135.290332] filemap_read+0xbf/0x300 [ 135.291158] ? _raw_spin_lock_irqsave+0x17/0x40 [ 135.292192] new_sync_read+0x103/0x170 [ 135.293014] vfs_read+0x15d/0x180 [ 135.293745] ksys_read+0xa1/0xe0 [ 135.294461] do_syscall_64+0x3c/0x80 [ 135.295284] entry_SYSCALL_64_after_hwframe+0x46/0xb0 This patch simply adds an extra check in __ext4_ext_check(), verifying that eh_entries is not 0 when eh_depth is > 0.

AI-Powered Analysis

AILast updated: 06/30/2025, 17:42:55 UTC

Technical Analysis

CVE-2022-48631 is a vulnerability identified in the Linux kernel's ext4 filesystem implementation. Specifically, the flaw exists in the ext4 extent parsing logic within the ext4_ext_binsearch_idx() function. This function assumes that the extent header has been validated previously, but it lacks a critical check to ensure that the number of entries (eh_entries) is non-zero when the depth (eh_depth) is greater than zero. Extents are data structures used by ext4 to efficiently map file blocks. When eh_entries is zero while eh_depth is greater than zero, the EXT_FIRST_INDEX() and EXT_LAST_INDEX() macros return invalid values, leading to the kernel attempting to access invalid memory or perform illegal operations. This results in a kernel BUG and an invalid opcode exception, causing the kernel to crash (kernel panic). The vulnerability can be triggered during file read operations that involve extent mapping, as demonstrated by the kernel call trace provided. The patch for this vulnerability adds an additional validation step in the __ext4_ext_check() function to verify that eh_entries is not zero when eh_depth is greater than zero, preventing the invalid memory access and subsequent kernel crash. This vulnerability affects Linux kernel versions prior to the patch and can be exploited by providing specially crafted ext4 filesystem metadata or files that trigger the faulty extent parsing logic. There are no known exploits in the wild at this time, and the vulnerability does not have an assigned CVSS score. However, the impact is a denial of service through kernel panic, which can disrupt system availability.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to systems running Linux with ext4 filesystems, which is a common default filesystem on many Linux distributions widely used in enterprise, government, and cloud environments across Europe. Exploitation leads to a kernel crash, causing denial of service (DoS). This can disrupt critical services, especially in environments where uptime is essential such as financial institutions, healthcare providers, and public sector infrastructure. While the vulnerability does not appear to allow privilege escalation or data corruption directly, repeated or targeted exploitation could be used to cause persistent outages or to facilitate further attacks by forcing reboots or triggering recovery procedures. Organizations relying on Linux-based servers, virtual machines, or embedded devices using ext4 are at risk. The lack of known exploits reduces immediate threat but does not eliminate the risk, especially as attackers may develop exploits once the vulnerability details become widely known. The impact on confidentiality and integrity is low, but availability impact is medium to high depending on the criticality of affected systems.

Mitigation Recommendations

1. Apply the official Linux kernel patch that adds the necessary validation check in the ext4 extent parsing code as soon as it becomes available from your Linux distribution vendor. 2. Regularly update Linux kernel versions to incorporate security patches and improvements. 3. For critical systems, consider implementing kernel live patching solutions to minimize downtime during patch application. 4. Monitor system logs for kernel BUG messages or crashes related to ext4 operations to detect potential exploitation attempts. 5. Use filesystem integrity checking tools to verify ext4 metadata consistency and detect malformed extents that could trigger the vulnerability. 6. Limit access to systems and filesystems that could be used to trigger the vulnerability, especially restricting untrusted users from mounting or manipulating ext4 filesystems. 7. Employ intrusion detection systems (IDS) and endpoint detection and response (EDR) solutions capable of detecting unusual kernel crashes or filesystem anomalies. 8. In virtualized environments, isolate and monitor guest VMs to prevent propagation of kernel crashes or denial of service conditions.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-02-25T13:44:28.315Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d982ec4522896dcbe5cf7

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

Last enriched: 6/30/2025, 5:42:55 PM

Last updated: 7/26/2025, 2:34:28 PM

Views: 12

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