Skip to main content
Vulnerability Database/CVE-2024-50073

CVE-2024-50073: Linux Kernel Use-After-Free Vulnerability

CVE-2024-50073 is a use-after-free flaw in the Linux Kernel n_gsm TTY driver that occurs during gsm_cleanup_mux operations. This vulnerability can be exploited through multi-threaded ioctl calls, potentially leading to unauthorized code execution. This article covers the technical details, impact analysis, affected kernel versions, and recommended mitigation strategies.

Published:

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-2024-50073 Overview

CVE-2024-50073 is a use-after-free vulnerability [CWE-416] in the Linux kernel's n_gsm TTY line discipline driver. The flaw resides in the gsm_cleanup_mux function within drivers/tty/n_gsm.c. Concurrent ioctl calls can free gsm_msg structures on the tx_ctrl_list or tx_data_list of a gsm_mux while another thread still references them. KASAN reports a slab-use-after-free when the freed memory is subsequently read. The issue affects the Linux kernel including 6.12 release candidates rc1, rc2, and rc3. Local, authenticated attackers can trigger the race to corrupt kernel memory, enabling privilege escalation or system compromise.

Critical Impact

Local attackers with access to the n_gsm line discipline can trigger a use-after-free in kernel memory, leading to privilege escalation, kernel crash, or arbitrary code execution in kernel context.

Affected Products

  • Linux Kernel (multiple stable branches prior to patched commits)
  • Linux Kernel 6.12-rc1, 6.12-rc2, 6.12-rc3
  • Debian LTS distributions shipping affected kernel versions

Discovery Timeline

  • 2024-10-29 - CVE-2024-50073 published to NVD
  • 2025-01 - Debian LTS advisory released
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-50073

Vulnerability Analysis

The n_gsm driver implements the 3GPP 27.010 multiplexing protocol as a TTY line discipline. It maintains two transmit queues per multiplexer, tx_ctrl_list for control frames and tx_data_list for data frames. Each queue holds gsm_msg objects allocated via gsm_data_alloc.

The KASAN report shows allocation occurring in the receive path through gsm1_receive and gsm_send, invoked from the TTY buffer workqueue. The free path originates from gsmld_ioctl calling gsm_cleanup_mux, which releases queued messages during multiplexer teardown. When two threads invoke ioctl concurrently, one thread can free a gsm_msg while another still holds a reference, producing the slab-use-after-free at n_gsm.c:3160.

The upstream fix introduces a gsm tx lock to serialize access to the transmit lists during cleanup and send operations.

Root Cause

The root cause is missing synchronization around the tx_ctrl_list and tx_data_list traversal in gsm_cleanup_mux. Message objects dequeued and freed by one thread remain accessible to concurrent paths, violating object lifetime guarantees in the slab allocator.

Attack Vector

Exploitation requires local access and the ability to open a TTY and attach the n_gsm line discipline via ioctl. The attacker then issues concurrent GSMIOC_SETCONF or related ioctls from multiple threads to race the cleanup path against the send path. Successful exploitation leverages the dangling pointer dereference to corrupt kernel memory and escalate privileges to root. No user interaction is required.

The vulnerability mechanism is a classic concurrency-induced use-after-free; no synthetic proof-of-concept is reproduced here. Refer to the upstream kernel commits linked below for the exact code paths and patch diffs.

Detection Methods for CVE-2024-50073

Indicators of Compromise

  • KASAN kernel log entries reporting slab-use-after-free in gsm_cleanup_mux within drivers/tty/n_gsm.c
  • Unexpected kernel oops or panic traces referencing gsm_cleanup_mux, gsmld_ioctl, or gsm_data_alloc
  • Unprivileged processes loading or interacting with the n_gsm module on systems where it is not operationally required

Detection Strategies

  • Audit ioctl calls targeting TTY devices with the n_gsm line discipline attached, correlating multi-threaded access patterns from a single process
  • Monitor for modprobe or auto-load events for the n_gsm kernel module on hosts that do not use GSM multiplexing
  • Enable kernel KASAN or lockdep in test environments to surface race-condition reports before production exposure

Monitoring Recommendations

  • Collect dmesg and /var/log/kern.log output centrally and alert on KASAN or BUG traces
  • Track process creation events invoking ioctl on /dev/tty* from non-interactive workloads
  • Inventory running kernel versions and flag hosts matching the vulnerable version ranges listed in the NVD CPE entries

How to Mitigate CVE-2024-50073

Immediate Actions Required

  • Apply the stable kernel updates referenced in the upstream commits as soon as vendor packages are available
  • Blacklist the n_gsm kernel module on systems that do not require GSM multiplexing to eliminate the attack surface
  • Restrict access to TTY devices and the CAP_NET_ADMIN and CAP_SYS_ADMIN capabilities needed to attach line disciplines

Patch Information

The fix is distributed across upstream stable branches via the following commits: 0eec592c6a74, 9462f4ca56e7, bf171b5e86e4, and c29f192e0d44. Debian users should consult the Debian LTS Announcement for distribution-specific package versions.

Workarounds

  • Add blacklist n_gsm and install n_gsm /bin/true entries to /etc/modprobe.d/ to prevent module loading
  • Remove or restrict access to TTY devices for untrusted local users via group and permission hardening
  • Deploy module-loading restrictions via kernel.modules_disabled=1 on hosts where runtime module loading is not required
bash
# Prevent n_gsm module from loading
echo "blacklist n_gsm" | sudo tee /etc/modprobe.d/disable-n_gsm.conf
echo "install n_gsm /bin/true" | sudo tee -a /etc/modprobe.d/disable-n_gsm.conf
sudo update-initramfs -u

# Verify the module is not loaded
lsmod | grep n_gsm

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.