Skip to main content
Vulnerability Database/CVE-2020-36158

CVE-2020-36158: Linux Kernel mwifiex RCE Vulnerability

CVE-2020-36158 is a remote code execution vulnerability in the Linux Kernel mwifiex driver that allows attackers to execute arbitrary code via a long SSID value. This article covers technical details, affected versions, and mitigations.

Published:

CVE-2020-36158 Overview

CVE-2020-36158 is a buffer overflow vulnerability in the Marvell WiFi driver (mwifiex) within the Linux kernel. The vulnerability exists in the mwifiex_cmd_802_11_ad_hoc_start function located in drivers/net/wireless/marvell/mwifiex/join.c. An attacker who can provide a long SSID value may be able to exploit this flaw to execute arbitrary code with kernel privileges. This vulnerability affects Linux kernel versions through 5.10.4.

Critical Impact

Successful exploitation of this buffer overflow vulnerability could allow an attacker with local access and elevated privileges to execute arbitrary code in kernel context, potentially leading to complete system compromise.

Affected Products

  • Linux Kernel (through version 5.10.4)
  • Fedora 33
  • Debian Linux 9.0 and 10.0
  • NetApp Cloud Backup
  • NetApp SolidFire Baseboard Management Controller

Discovery Timeline

  • 2021-01-05 - CVE CVE-2020-36158 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2020-36158

Vulnerability Analysis

The vulnerability is classified as CWE-120 (Buffer Copy without Checking Size of Input), a classic buffer overflow condition. The flaw exists in the ad-hoc network initialization code path within the Marvell wireless driver. When processing SSID values, the mwifiex_cmd_802_11_ad_hoc_start function copies the SSID data into a fixed-size buffer without properly validating that the input length does not exceed the maximum allowed SSID length (IEEE80211_MAX_SSID_LEN, which is 32 bytes).

This lack of bounds checking allows an oversized SSID to overflow the destination buffer, potentially corrupting adjacent memory structures. Since this code executes in kernel space, successful exploitation could lead to arbitrary code execution with full kernel privileges, enabling an attacker to bypass security controls, install rootkits, or completely compromise the affected system.

Root Cause

The root cause of CVE-2020-36158 is the absence of input length validation before the memcpy operation in the mwifiex_cmd_802_11_ad_hoc_start function. The code directly copies req_ssid->ssid_len bytes from the SSID source to the adhoc_start->ssid buffer without verifying that the length does not exceed IEEE80211_MAX_SSID_LEN. This allows an attacker-controlled SSID length value to specify a copy operation larger than the destination buffer can safely accommodate.

Attack Vector

The attack requires local access to the system with high privileges (as indicated by the local attack vector). An attacker could craft a malicious SSID value exceeding 32 bytes and trigger the ad-hoc network start functionality through the Marvell WiFi driver interface. When the vulnerable code processes this oversized SSID, the buffer overflow occurs, potentially allowing the attacker to overwrite adjacent kernel memory and hijack control flow to execute arbitrary code.

c
 
 	memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN);
 
+	if (req_ssid->ssid_len > IEEE80211_MAX_SSID_LEN)
+		req_ssid->ssid_len = IEEE80211_MAX_SSID_LEN;
 	memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len);
 
 	mwifiex_dbg(adapter, INFO, "info: ADHOC_S_CMD: SSID = %s\n",

Source: GitHub Linux Commit

The patch adds a bounds check to truncate req_ssid->ssid_len to IEEE80211_MAX_SSID_LEN (32 bytes) before the memcpy operation, preventing the buffer overflow.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2020-36158

Indicators of Compromise

  • Unusual kernel crashes or system instability related to wireless network operations
  • Unexpected ad-hoc network connection attempts with abnormally long SSID values
  • Signs of privilege escalation or unauthorized root access following wireless activity
  • Kernel panic logs referencing the mwifiex driver or mwifiex_cmd_802_11_ad_hoc_start function

Detection Strategies

  • Monitor kernel logs for crashes or errors originating from the mwifiex driver module
  • Implement runtime kernel integrity monitoring to detect unauthorized kernel memory modifications
  • Deploy endpoint detection solutions capable of identifying buffer overflow exploitation patterns
  • Audit systems for Marvell WiFi hardware and verify kernel versions are patched

Monitoring Recommendations

  • Enable detailed wireless driver logging on systems with Marvell WiFi adapters
  • Configure centralized log aggregation for kernel-level events across the infrastructure
  • Implement network-level monitoring for unusual ad-hoc network creation attempts
  • Regularly scan systems to identify unpatched Linux kernel installations

How to Mitigate CVE-2020-36158

Immediate Actions Required

  • Update the Linux kernel to a version containing the security patch (commit 5c455c5ab332773464d02ba17015acdca198f03d)
  • Apply vendor-specific security updates from Debian, Fedora, or NetApp as applicable
  • Consider disabling the mwifiex driver module on systems where Marvell WiFi functionality is not required
  • Restrict local access to affected systems while awaiting patch deployment

Patch Information

The vulnerability has been addressed in the upstream Linux kernel through commit 5c455c5ab332773464d02ba17015acdca198f03d. The fix adds proper bounds checking to ensure the SSID length is clamped to IEEE80211_MAX_SSID_LEN before the copy operation. Distribution-specific patches are available:

Workarounds

  • Blacklist the mwifiex kernel module to prevent it from loading on systems where Marvell WiFi is not essential
  • Restrict local privileged access to systems until patches can be applied
  • Implement host-based intrusion prevention to block kernel exploitation attempts
  • Disable ad-hoc WiFi network functionality if supported by your wireless configuration
bash
# Disable mwifiex driver module by blacklisting
echo "blacklist mwifiex" >> /etc/modprobe.d/blacklist-mwifiex.conf
echo "blacklist mwifiex_pcie" >> /etc/modprobe.d/blacklist-mwifiex.conf
echo "blacklist mwifiex_sdio" >> /etc/modprobe.d/blacklist-mwifiex.conf
echo "blacklist mwifiex_usb" >> /etc/modprobe.d/blacklist-mwifiex.conf

# Apply changes without reboot (if module is currently loaded)
modprobe -r mwifiex_pcie mwifiex_sdio mwifiex_usb mwifiex 2>/dev/null

# Update initramfs to persist changes across reboots
update-initramfs -u

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

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.