CVE-2021-47636: ubifs: Fix read out-of-bounds in ubifs_wbuf_write_nolock()
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].
Security readout for executives and security teams
Plain-English summary
CVE-2021-47636 is a Linux kernel UBIFS flaw where certain filesystem writes can read past the end of a memory buffer. The CVE rates it high because a local, low-privileged user could potentially expose kernel memory or crash the system on affected kernels.
Executive priority
Treat this as high priority for embedded, appliance, or flash-storage Linux fleets using UBIFS. It is less urgent for general servers where UBIFS is absent. Patch through normal kernel vendor channels, with accelerated handling for local multi-user or tenant-accessible systems.
Technical view
The issue is in ubifs_wbuf_write_nolock(). When len is not 8-byte aligned, aligned_len can exceed the true buffer length after write-buffer handling, causing ubifs_leb_write() to read beyond buf. The CVE maps this to CWE-125 with CVSS 7.1, local attack vector, low complexity, and low privileges required.
Likely exposure
Exposure is most likely on Linux systems running affected kernel versions with UBIFS in use, commonly flash-backed or embedded environments. Systems not using UBIFS are less likely exposed, but kernel build configuration and mounted filesystems should be verified.
Exploitation context
The CVE describes local exploitation requirements: low privileges, no user interaction, and no network attack vector. The bundle says KEV is false and provides no cited evidence of active exploitation. A reproducer is mentioned, but details are not included in the supplied sources.
Researcher notes
The key failure is length accounting after ALIGN(len, 8). The true buffer length remains unaligned, but the later write path can pass a larger aligned size into ubifs_leb_write(), producing a small out-of-bounds read. Source evidence does not establish remote reachability or active exploitation.
Mitigation direction
Update to a vendor-supported Linux kernel containing the referenced UBIFS stable fixes.
Check Linux distribution or device vendor guidance for backported kernel fixes.
Prioritize systems using UBIFS or flash-backed embedded storage.
Restrict untrusted local shell or workload access on affected systems until patched.
Monitor kernel crash or memory-safety telemetry on UBIFS-enabled hosts.
Validation and detection
Inventory Linux kernel versions against the CVE affected version data.
Confirm whether UBIFS is enabled, mounted, or used by products in scope.
Verify vendor kernel packages include the referenced UBIFS fix commits or backports.
Review crash reports for UBIFS, KASAN, or writeback traces matching the CVE description.
Document non-UBIFS systems separately as lower-likelihood exposure.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-125: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-125 · source CWE mapping
Out-of-bounds Read
Out-of-bounds Read represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.