CVE-2021-3348
Linux Kernel vulnerability analysis and mitigation

Overview

CVE-2021-3348 is a use-after-free vulnerability discovered in the network block device (nbd) driver of the Linux kernel through version 5.10.12. The vulnerability was discovered by ADLab of venustech and reported on January 25, 2021. The issue exists in the nbdaddsocket function within drivers/block/nbd.c, where a race condition during device setup could allow local attackers with access to the nbd device to trigger a use-after-free condition (Kernel Commit, Ubuntu Security).

Technical details

The vulnerability stems from a race condition in the nbd ioctl operations. When NBDSETSIZEBLOCKS ioctl calls nbdsizeset() to change the block size, and NBDSETSOCK ioctl calls nbdaddsocket() which invokes krealloc() to update a block, a race condition occurs. The nbdqueuerq() function, which runs concurrently, calls nbdhandle_cmd() and accesses config->socks without proper locking mechanisms, leading to a use-after-free condition. The vulnerability has been assigned a CVSS v3.1 base score of 7.0 (High) (NVD, OSS Security).

Impact

The vulnerability could allow local attackers with access to the nbd device to cause a denial of service (system crash or memory corruption) or potentially execute arbitrary code. The impact is particularly severe in systems where users have access to nbd devices (Ubuntu Security, Debian LTS).

Mitigation and workarounds

The issue was patched in the Linux kernel by adding queue freezing mechanisms during socket addition. The fix involves freezing the queue while adding connections to prevent errant requests during the reallocation of the socks array. The patch was committed with ID b98e762e3d71 and has been backported to various distribution kernels. Users should update their systems to patched versions (Kernel Commit).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management