CVE-2021-47596
📋 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
- Linux kernel with HNS3 network driver
📦 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.
🎯 Exploit Status
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
linuxPrevent loading of vulnerable hns3 driver module
echo 'blacklist hns3' >> /etc/modprobe.d/blacklist.conf
rmmod hns3
Restrict device removal operations
linuxLimit 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
- https://git.kernel.org/stable/c/12512bc8f25b8ba9795dfbae0e9ca57ff13fd542
- https://git.kernel.org/stable/c/27cbf64a766e86f068ce6214f04c00ceb4db1af4
- https://git.kernel.org/stable/c/4f4a353f6fe033807cd026a5de81c67469ff19b0
- https://git.kernel.org/stable/c/12512bc8f25b8ba9795dfbae0e9ca57ff13fd542
- https://git.kernel.org/stable/c/27cbf64a766e86f068ce6214f04c00ceb4db1af4
- https://git.kernel.org/stable/c/4f4a353f6fe033807cd026a5de81c67469ff19b0