Skip to main content
Vulnerability Database/CVE-2021-33656

CVE-2021-33656: OpenEuler Buffer Overflow Vulnerability

CVE-2021-33656 is a buffer overflow vulnerability in Openatom OpenEuler triggered by malicious PIO_FONT ioctl commands. Attackers can exploit this to write memory out of bounds. This article covers technical details, affected versions, impact, and mitigation strategies.

Updated:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2021-33656 Overview

CVE-2021-33656 is an out-of-bounds write vulnerability in the Linux kernel virtual terminal (VT) subsystem. The flaw resides in the legacy PIO_FONT ioctl handler, which fails to properly validate font data supplied from user space. A local attacker with physical access can issue a crafted PIO_FONT ioctl call to write beyond allocated kernel memory. This memory corruption can compromise confidentiality, integrity, and availability of the affected system. The vulnerability impacts the Linux kernel, openEuler, and Debian Linux distributions that ship kernels predating the upstream removal of the old font ioctls. The issue is classified under CWE-787 (Out-of-bounds Write).

Critical Impact

A local user issuing a malicious PIO_FONT ioctl triggers a kernel out-of-bounds write, enabling memory corruption that can lead to privilege escalation or system crash on affected Linux kernels.

Affected Products

  • Linux kernel versions predating the vt-drop-old-font-ioctls.patch (fixed in stable release 5.10.127)
  • openEuler 20.03 LTS, 20.03 LTS SP1, and 20.03 LTS SP3
  • Debian Linux 10.0

Discovery Timeline

Technical Details for CVE-2021-33656

Vulnerability Analysis

The vulnerability exists in the Linux kernel's virtual terminal console font handling code. The PIO_FONT ioctl command allows a user-space process to load a custom font into the console. The ioctl handler accepts a user-supplied buffer describing font glyph data but does not adequately validate the size or layout of that data before copying it into kernel-managed font storage. When an attacker supplies malicious font metadata, the kernel writes glyph bytes past the end of the destination buffer. This out-of-bounds write corrupts adjacent kernel memory structures.

The upstream maintainers chose to remove the legacy font ioctls entirely rather than patch them in place. The stable fix is delivered through vt-drop-old-font-ioctls.patch in the 5.10.127 stable queue, which drops PIO_FONT, GIO_FONT, PIO_SCRNMAP, GIO_SCRNMAP, PIO_UNISCRNMAP, and GIO_UNISCRNMAP support. Modern applications use the KDFONTOP ioctl, which performs proper bounds checking.

Root Cause

The root cause is missing bounds validation on the font data length parameter passed through the PIO_FONT ioctl path. The legacy interface predates current kernel input validation conventions and lacks length checks against the destination buffer size. Glyph data exceeding the expected 256-character, 32-byte-per-glyph layout overruns the allocated region.

Attack Vector

Exploitation requires physical access to the target system, as indicated by the attack vector classification. An attacker with console access opens a virtual terminal device (for example, /dev/tty0) and issues the PIO_FONT ioctl with a crafted font payload. No authentication or user interaction is required beyond local console access. Successful exploitation produces kernel memory corruption that an attacker can shape into privilege escalation or denial of service.

No public proof-of-concept exploit is currently linked from the NVD entry, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog.

Detection Methods for CVE-2021-33656

Indicators of Compromise

  • Unexpected kernel oops or panic messages in dmesg referencing the console font subsystem or con_font_set call paths.
  • Unprivileged processes opening /dev/tty* devices and issuing PIO_FONT (ioctl number 0x4B60) calls outside of legitimate console configuration utilities.
  • System instability or crashes shortly after local console interaction by non-administrative users.

Detection Strategies

  • Audit kernel package versions across Linux endpoints to identify hosts running kernels older than 5.10.127 or unpatched distribution builds.
  • Enable Linux audit rules (auditctl) to log ioctl syscalls targeting TTY device files and review for PIO_FONT command usage.
  • Correlate kernel crash telemetry with local logon events to surface suspicious console activity.

Monitoring Recommendations

  • Forward /var/log/kern.log, dmesg, and audit logs to a centralized analytics platform for kernel exception correlation.
  • Alert on repeated kernel oops events on the same host, particularly involving VT or console subsystems.
  • Monitor local logon and console access patterns on systems exposed to shared physical environments such as kiosks, lab machines, and shared workstations.

How to Mitigate CVE-2021-33656

Immediate Actions Required

  • Apply vendor kernel updates from your Linux distribution that incorporate the upstream vt-drop-old-font-ioctls.patch.
  • Update openEuler 20.03 LTS systems to fixed kernel packages referenced in the openEuler advisory.
  • Update Debian 10 hosts following the Debian LTS announcement.
  • Restrict physical and console access to multi-user Linux systems through hardware controls and BIOS protections.

Patch Information

The upstream fix is the vt-drop-old-font-ioctls.patch included in the Linux stable 5.10.127 release. The patch removes the legacy PIO_FONT, GIO_FONT, PIO_SCRNMAP, GIO_SCRNMAP, PIO_UNISCRNMAP, and GIO_UNISCRNMAP ioctls. Distribution-specific backports are available from openEuler and Debian as referenced above.

Workarounds

  • Where patching is delayed, restrict access to /dev/tty* and /dev/vcs* devices to trusted administrative users through group permissions.
  • Disable physical console logon for non-administrative accounts using PAM access.conf rules to limit who can interact with the virtual terminal.
  • Enforce full-disk encryption and locked-down boot configurations to deter attackers from gaining local console access.
bash
# Verify the running kernel version and check for the fix
uname -r

# Debian/Ubuntu: apply distribution kernel updates
sudo apt-get update && sudo apt-get install --only-upgrade linux-image-$(uname -r)
sudo reboot

# openEuler: update the kernel package
sudo dnf update kernel
sudo reboot

# Restrict access to console device nodes as a hardening measure
sudo chmod o-rw /dev/tty[0-9]*

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.