Skip to main content

CVE-2021-47636: Vulnerability in Linux Linux

High
VulnerabilityCVE-2021-47636cvecve-2021-47636
Published: Wed Feb 26 2025 (02/26/2025, 01:54:10 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: ubifs: Fix read out-of-bounds in ubifs_wbuf_write_nolock() Function ubifs_wbuf_write_nolock() may access buf out of bounds in following process: ubifs_wbuf_write_nolock(): aligned_len = ALIGN(len, 8); // Assume len = 4089, aligned_len = 4096 if (aligned_len <= wbuf->avail) ... // Not satisfy if (wbuf->used) { ubifs_leb_write() // Fill some data in avail wbuf len -= wbuf->avail; // len is still not 8-bytes aligned aligned_len -= wbuf->avail; } n = aligned_len >> c->max_write_shift; if (n) { n <<= c->max_write_shift; err = ubifs_leb_write(c, wbuf->lnum, buf + written, wbuf->offs, n); // n > len, read out of bounds less than 8(n-len) bytes } , which can be catched by KASAN: ========================================================= BUG: KASAN: slab-out-of-bounds in ecc_sw_hamming_calculate+0x1dc/0x7d0 Read of size 4 at addr ffff888105594ff8 by task kworker/u8:4/128 Workqueue: writeback wb_workfn (flush-ubifs_0_0) Call Trace: kasan_report.cold+0x81/0x165 nand_write_page_swecc+0xa9/0x160 ubifs_leb_write+0xf2/0x1b0 [ubifs] ubifs_wbuf_write_nolock+0x421/0x12c0 [ubifs] write_head+0xdc/0x1c0 [ubifs] ubifs_jnl_write_inode+0x627/0x960 [ubifs] wb_workfn+0x8af/0xb80 Function ubifs_wbuf_write_nolock() accepts that parameter 'len' is not 8 bytes aligned, the 'len' represents the true length of buf (which is allocated in 'ubifs_jnl_xxx', eg. ubifs_jnl_write_inode), so ubifs_wbuf_write_nolock() must handle the length read from 'buf' carefully to write leb safely. Fetch a reproducer in [Link].

AI-Powered Analysis

AILast updated: 06/30/2025, 15:41:10 UTC

Technical Analysis

CVE-2021-47636 is a vulnerability identified in the Linux kernel's UBIFS (UBI File System) component, specifically within the function ubifs_wbuf_write_nolock(). UBIFS is a file system designed for flash memory devices, commonly used in embedded systems and devices relying on NAND flash storage. The vulnerability arises due to improper handling of buffer lengths that are not aligned to 8 bytes. In the vulnerable function, the parameter 'len' represents the true length of the buffer to be written, but the function aligns this length to the nearest multiple of 8 bytes without adequately ensuring that the buffer access stays within bounds. This misalignment can lead to an out-of-bounds read, as the function attempts to write more data than the buffer actually contains. The issue is demonstrated by kernel address sanitizer (KASAN) detecting a slab-out-of-bounds read during the execution of ubifs_wbuf_write_nolock(), which can cause memory corruption or kernel crashes. The vulnerability is subtle because the function expects 'len' to be potentially unaligned, but the subsequent write operations do not correctly handle this, leading to reads beyond the allocated buffer. Although no known exploits are reported in the wild, the flaw could be triggered by malicious or malformed data written to UBIFS volumes, potentially causing denial of service or other unpredictable kernel behavior. The vulnerability affects specific Linux kernel versions identified by commit hashes, indicating it is present in certain kernel builds prior to the patch. Since UBIFS is primarily used in embedded Linux systems, devices such as routers, IoT devices, and specialized industrial equipment are most likely to be impacted. The vulnerability requires local code execution context or the ability to write to UBIFS volumes, which may limit remote exploitation but still poses a significant risk in multi-user or exposed environments.

Potential Impact

For European organizations, the impact of CVE-2021-47636 depends largely on their use of Linux-based embedded systems or devices utilizing UBIFS on NAND flash storage. Many industrial control systems, telecommunications infrastructure, and IoT deployments in Europe rely on embedded Linux, making this vulnerability relevant. Successful exploitation could lead to kernel crashes, causing denial of service conditions on critical devices, potentially disrupting operations in sectors such as manufacturing, energy, and telecommunications. In environments where devices are shared or exposed to untrusted users, the vulnerability could be leveraged to escalate privileges or destabilize systems. Although no remote exploit is currently known, the risk remains for insider threats or malware that can write to UBIFS volumes. The confidentiality and integrity of data stored on affected devices could be compromised if attackers manipulate the kernel memory through this flaw. Given the increasing reliance on embedded Linux in European critical infrastructure and industrial IoT, the vulnerability poses a moderate to high operational risk if left unmitigated.

Mitigation Recommendations

To mitigate CVE-2021-47636, European organizations should: 1) Apply the official Linux kernel patches that fix the ubifs_wbuf_write_nolock() function to ensure proper bounds checking and buffer handling. 2) Identify and inventory all devices running affected Linux kernel versions with UBIFS enabled, focusing on embedded systems and IoT devices. 3) For devices where patching the kernel is not immediately feasible, implement strict access controls to limit write operations to UBIFS volumes only to trusted users and processes. 4) Monitor kernel logs and system behavior for signs of memory corruption or crashes related to UBIFS operations. 5) Engage with device vendors to obtain updated firmware or kernel versions that incorporate the fix. 6) In environments with high security requirements, consider isolating vulnerable devices from untrusted networks to reduce the attack surface. 7) Employ runtime security tools capable of detecting anomalous kernel memory accesses or KASAN-like protections if supported. These steps go beyond generic advice by focusing on embedded device management, vendor coordination, and runtime monitoring specific to UBIFS and Linux kernel vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2025-02-26T01:48:21.519Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9834c4522896dcbe9621

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

Last enriched: 6/30/2025, 3:41:10 PM

Last updated: 7/29/2025, 6:58:06 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