CVE-2021-47596

7.8 HIGH

📋 TL;DR

A use-after-free vulnerability in the Linux kernel's HNS3 network driver allows attackers to potentially crash the system or execute arbitrary code with kernel privileges. This affects systems using Huawei HNS3 network adapters with vulnerable kernel versions. Attackers need local access to exploit this vulnerability.

💻 Affected Systems

Products:
  • Linux kernel with HNS3 network driver
Versions: Linux kernel versions before the fix commits (specific versions vary by distribution)
Operating Systems: Linux distributions using vulnerable kernel versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems with Huawei HNS3 network adapters installed and using the hns3 driver. The vulnerability triggers during device removal/uninstallation.

📦 What is this software?

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Kernel panic leading to system crash, or potential arbitrary code execution with kernel privileges resulting in complete system compromise.

🟠

Likely Case

System crash or kernel panic causing denial of service, requiring system reboot to restore functionality.

🟢

If Mitigated

Limited impact if proper access controls prevent local attackers from reaching vulnerable code paths.

🌐 Internet-Facing: LOW - Requires local access to exploit, cannot be triggered remotely.
🏢 Internal Only: MEDIUM - Local attackers or malicious users could exploit this to crash systems or potentially gain elevated privileges.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires local access and ability to trigger device removal operations. The use-after-free occurs during specific driver cleanup sequences.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in Linux kernel stable releases containing commits 12512bc8f25b8ba9795dfbae0e9ca57ff13fd542 and related patches

Vendor Advisory: https://git.kernel.org/stable/c/12512bc8f25b8ba9795dfbae0e9ca57ff13fd542

Restart Required: Yes

Instructions:

1. Update Linux kernel to version containing the fix commits. 2. Check distribution-specific security advisories. 3. Reboot system to load patched kernel.

🔧 Temporary Workarounds

Disable HNS3 driver if not needed

linux

Prevent loading of vulnerable hns3 driver module

echo 'blacklist hns3' >> /etc/modprobe.d/blacklist.conf
rmmod hns3

Restrict device removal operations

linux

Limit access to device management operations that could trigger the vulnerability

chmod 600 /sys/bus/pci/drivers/hns3/unbind
setfacl -m u:root:rw /sys/bus/pci/drivers/hns3/unbind

🧯 If You Can't Patch

  • Restrict local user access to systems with HNS3 adapters
  • Implement strict access controls to prevent unauthorized users from performing device management operations

🔍 How to Verify

Check if Vulnerable:

Check kernel version and if hns3 module is loaded: 'uname -r' and 'lsmod | grep hns3'

Check Version:

uname -r

Verify Fix Applied:

Verify kernel version includes fix commits: 'grep -i hclgevf_send_mbx_msg /proc/kallsyms' should not show vulnerable function if properly patched

📡 Detection & Monitoring

Log Indicators:

  • Kernel panic messages in /var/log/kern.log or dmesg
  • Use-after-free warnings in kernel logs
  • HNS3 driver error messages during device removal

Network Indicators:

  • Sudden network interface disappearance on HNS3 adapters

SIEM Query:

source="kernel" AND ("use-after-free" OR "hns3" OR "hclgevf" OR "kernel panic")

🔗 References

📤 Share & Export