CVE-2021-47013·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send In emac_mac_tx_buf_send, it calls emac_tx_fill_tpd(..,skb,..). If some error happens in emac_tx_fill_tpd(), the skb will be freed via dev_kfree_skb(skb) in error branch of emac_tx_fill_tpd(). But the freed skb is still used via skb->len by netdev_sent_queue(,skb->len). As i observed that emac_tx_fill_tpd() haven't modified the value of skb->len, thus my patch assigns skb->len to 'len' before the possible free and use 'len' instead of skb->len later.
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.12.4
- Published
- 2024-02-28
Affected versions
From: 5.12
Until: 5.12.4
Fixed in: 5.12.4
How to fix this CVE
Update your Linux kernel to version 5.12.4 or later to resolve a use-after-free vulnerability in the EMAC network driver's packet transmission logic. This flaw occurs when memory is freed prematurely during error handling while references to that memory remain active. Apply the update immediately to prevent potential kernel instability or memory corruption attacks from local authenticated users.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Check installed kernel version: uname -r — Confirm if version is between 5.12 and 5.12.3 (vulnerable)
- Verify EMAC driver presence: lsmod | grep emac — Confirm if the EMAC network driver is loaded on your system
- Monitor dmesg for memory errors: dmesg | tail -50 — Look for kernel warnings about use-after-free, memory access violations, or EMAC-related errors
- Validate fix after reboot: uname -r — Confirm kernel version is 5.12.4 or higher, then verify EMAC driver loads cleanly: dmesg | grep -i emac
FAQ
What is CVE-2021-47013?
This vulnerability is a use-after-free bug in the Linux kernel's EMAC (Ethernet MAC) driver where freed network packet buffers are still accessed after deallocation during error conditions, potentially leading to kernel memory corruption or denial of service.
Is CVE-2021-47013 being actively exploited?
No, this vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog and no public exploits are documented, though local authenticated users with network privileges could potentially trigger it.
What versions of Kernel are affected by CVE-2021-47013?
Linux kernel versions 5.12 through 5.12.3 are vulnerable; version 5.12.4 and later contain the fix.
How do I check if my server is vulnerable to CVE-2021-47013?
Run uname -r to check your kernel version — if it reports 5.12.0 through 5.12.3 and your system uses an EMAC-compatible network interface (verify with lsmod | grep emac), your system is vulnerable.
Does Defensia detect CVE-2021-47013?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the Linux kernel is installed on a monitored server, CVE-2021-47013 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/16d8c44be52e3650917736d45f5904384a9da834
- https://git.kernel.org/stable/c/55fcdd1258faaecca74b91b88cc0921f9edd775d
- https://git.kernel.org/stable/c/6d72e7c767acbbdd44ebc7d89c6690b405b32b57
- https://git.kernel.org/stable/c/8c06f34785068b87e2b560534c77c163d6c6dca7
- https://git.kernel.org/stable/c/9dc373f74097edd0e35f3393d6248eda8d1ba99d
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47013. Free for 1 server.
Get started free