Skip to main content
CVE Vulnerability Database

CVE-2021-3753: Linux Kernel Race Condition Vulnerability

CVE-2021-3753 is a race condition flaw in Linux Kernel's vt_k_ioctl that may cause out of bounds read due to unprotected write access to vc_mode. This article covers technical details, affected versions, and mitigation.

Updated:

CVE-2021-3753 Overview

CVE-2021-3753 is a race condition in the Linux kernel's virtual terminal subsystem. The flaw resides in vt_k_ioctl within drivers/tty/vt/vt_ioctl.c, where write access to vc_mode is not protected by a lock during the KDSETMDE ioctl operation. A local attacker with low privileges can trigger an out-of-bounds read in the virtual terminal code. The primary impact is data confidentiality, as the vulnerability can leak kernel memory contents. The flaw affects the upstream Linux kernel, Red Hat Enterprise Linux, and multiple NetApp products that ship Linux-based firmware.

Critical Impact

Local attackers can exploit a race condition in the Linux kernel virtual terminal subsystem to trigger an out-of-bounds read, exposing kernel memory contents.

Affected Products

  • Linux Kernel (upstream, prior to commit 2287a51ba822384834dafc1c798453375d1107c7)
  • Red Hat Enterprise Linux 7 and 8
  • NetApp HCI, SolidFire, Element Software, Active IQ Unified Manager, and H-Series storage nodes (H300S, H500S, H700S, H410S, H410C)

Discovery Timeline

  • 2021-09-01 - Vulnerability disclosed publicly on the OpenWall OSS-Security mailing list
  • 2022-02-16 - CVE-2021-3753 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-3753

Vulnerability Analysis

The vulnerability is a race condition [CWE-125] in the Linux kernel's virtual terminal (vt) ioctl handler. The vt_k_ioctl function processes ioctls for keyboard and console mode control. When handling the KDSETMDE ioctl, the kernel writes to the vc_mode field of a virtual console structure without acquiring the console lock.

Concurrent execution paths in the vt subsystem read vc_mode to determine bounds and branching logic for subsequent operations. When two threads race — one updating vc_mode and another using it to index or validate access — the reader can observe an inconsistent or stale value. This inconsistency leads to an out-of-bounds read condition in adjacent virtual terminal code paths.

The disclosed memory contents can include kernel data adjacent to virtual console buffers. Attackers can leverage the leak for kernel memory disclosure, which is useful for bypassing Kernel Address Space Layout Randomization (KASLR) or staging further exploitation.

Root Cause

The root cause is missing lock acquisition around writes to vc_mode in vt_k_ioctl. The Linux virtual terminal subsystem relies on the console semaphore (console_lock) to serialize access to shared console state. The KDSETMDE code path bypassed this serialization, allowing concurrent ioctls and read paths to operate on inconsistent state.

Attack Vector

Exploitation requires local access with the ability to issue ioctls against a tty or virtual console device such as /dev/tty1. The attacker spawns two threads: one repeatedly invoking the KDSETMDE ioctl to mutate vc_mode, and a second performing operations that read vc_mode during boundary checks. Successfully winning the race causes the kernel to access memory outside the intended buffer, returning data that the attacker can read back through the affected interface.

The upstream fix is documented in the kernel commit torvalds/linux@2287a51, which introduces proper locking around vc_mode access. No public proof-of-concept exploit code is currently associated with this CVE.

Detection Methods for CVE-2021-3753

Indicators of Compromise

  • Unexpected processes opening /dev/tty* or /dev/vcs* devices and issuing rapid sequential ioctls
  • Anomalous kernel log entries referencing the virtual terminal subsystem or unexpected console mode transitions
  • Unprivileged user processes spawning multiple threads that interact with tty ioctls in tight loops

Detection Strategies

  • Audit ioctl() syscalls targeting tty devices using auditd rules to identify processes issuing KDSETMDE (0x4B3A) calls
  • Monitor for race-pattern behavior: short-lived processes creating thread pairs that hammer the same file descriptor
  • Correlate kernel warnings or KASAN reports referencing vt_k_ioctl or vt_ioctl.c across the fleet

Monitoring Recommendations

  • Enable kernel auditing for ioctl operations on virtual console devices for non-root users
  • Centralize syslog and kernel ring buffer collection to detect repeated tty mode changes from unprivileged accounts
  • Track package and kernel versions to identify hosts still running vulnerable kernels

How to Mitigate CVE-2021-3753

Immediate Actions Required

  • Apply vendor-supplied kernel updates from your Linux distribution that incorporate upstream commit 2287a51
  • For Red Hat Enterprise Linux 7 and 8, install errata kernels referenced in Red Hat Bugzilla 1999589
  • For NetApp HCI, SolidFire, Element Software, and H-Series nodes, follow remediation guidance in the NetApp Security Advisory NTAP-20221028-0003
  • Restrict local shell access to trusted users until patching is complete

Patch Information

The upstream fix is committed to the Linux kernel as commit 2287a51ba822, which adds the missing lock around vc_mode writes in vt_k_ioctl. Distribution-specific patches are available from Red Hat and NetApp. Refer to the OpenWall OSS-Security discussion for additional technical context.

Workarounds

  • Remove or restrict access to virtual console devices for non-administrative users where the use case permits
  • Limit which users can log in on physical or virtual TTYs by adjusting PAM access.conf and securetty configurations
  • Enforce least privilege and disable unused virtual terminal devices on servers that do not require console access
bash
# Restrict access to virtual console devices to root and tty group only
chmod 0600 /dev/tty[1-6]
chown root:tty /dev/tty[1-6]

# Verify currently running kernel version against patched releases
uname -r
rpm -q --changelog kernel | grep -i CVE-2021-3753

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.