CVE-2021-47082·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: tun: avoid double free in tun_free_netdev Avoid double free in tun_free_netdev() by moving the dev->tstats and tun->security allocs to a new ndo_init routine (tun_net_init()) that will be called by register_netdevice(). ndo_init is paired with the desctructor (tun_free_netdev()), so if there's an error in register_netdevice() the destructor will handle the frees. BUG: KASAN: double-free or invalid-free in selinux_tun_dev_free_security+0x1a/0x20 security/selinux/hooks.c:5605 CPU: 0 PID: 25750 Comm: syz-executor416 Not tainted 5.16.0-rc2-syzk #1 Hardware name: Red Hat KVM, BIOS Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106 print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:247 kasan_report_invalid_free+0x55/0x80 mm/kasan/report.c:372 ____kasan_slab_free mm/kasan/common.c:346 [inline] __kasan_slab_free+0x107/0x120 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook mm/slub.c:1749 [inline] slab_free mm/slub.c:3513 [inline] kfree+0xac/0x2d0 mm/slub.c:4561 selinux_tun_dev_free_security+0x1a/0x20 security/selinux/hooks.c:5605 security_tun_dev_free_security+0x4f/0x90 security/security.c:2342 tun_free_netdev+0xe6/0x150 drivers/net/tun.c:2215 netdev_run_todo+0x4df/0x840 net/core/dev.c:10627 rtnl_unlock+0x13/0x20 net/core/rtnetlink.c:112 __tun_chr_ioctl+0x80c/0x2870 drivers/net/tun.c:3302 tun_chr_ioctl+0x2f/0x40 drivers/net/tun.c:3311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.15.12
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at <0.1% — higher than 11% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Read the two together. CVE-2021-47082 scores 7.8 on CVSS, so a successful attack would be serious — but at <0.1%, almost nobody is currently attempting it. That is a different situation from a flaw under mass exploitation, and it is usually the difference between patching on your next maintenance window and patching tonight.
Affected versions
From: 5.11
Until: 5.15.12
Fixed in: 5.15.12
How to fix this CVE
Update your Linux kernel to version 5.15.12 or later to resolve a critical double-free vulnerability in the TUN network device driver. This flaw can allow a local attacker with minimal privileges to trigger a kernel panic or potentially escalate privileges. Ensure you test the kernel update in a staging environment before deploying to production systems.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your kernel version with `uname -r` and verify it is 5.15.12 or newer
- Step 2: Verify TUN module is loaded with `lsmod | grep tun` to identify if the vulnerable component is active
- Step 3: Search kernel logs for double-free errors with `sudo dmesg | grep -i 'double.free\|invalid.free\|kasan'` to detect exploitation attempts
- Step 4: After updating, confirm the fix with `uname -r` and reboot if necessary, then verify TUN module still loads correctly with `sudo modprobe tun && lsmod | grep tun`
FAQ
What is CVE-2021-47082?
CVE-2021-47082 is a double-free vulnerability in the Linux kernel's TUN network device driver that occurs during device initialization and cleanup. A local attacker with standard user privileges can trigger this flaw by creating a malformed TUN device, leading to kernel crashes or potential privilege escalation.
Is CVE-2021-47082 being actively exploited?
No, CVE-2021-47082 is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently available. However, the vulnerability is straightforward to trigger locally and should be patched promptly.
What versions of Kernel are affected by CVE-2021-47082?
Linux kernel versions 5.11 through 5.15.11 are vulnerable. The vulnerability was fixed in kernel version 5.15.12 and later. Users of older stable branches (5.10, 5.4) may have received backported fixes.
How do I check if my server is vulnerable to CVE-2021-47082?
Run `uname -r` to display your kernel version. If the output shows a version between 5.11 and 5.15.11 (inclusive), your system is vulnerable. Additionally, check if TUN module is enabled with `grep CONFIG_TUN /boot/config-$(uname -r)`.
Does Defensia detect CVE-2021-47082?
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-47082 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/0c0e566f0387490d16f166808c72e9c772027681
- https://git.kernel.org/stable/c/158b515f703e75e7d68289bf4d98c664e1d632df
- https://git.kernel.org/stable/c/3cb5ae77799e8ed6ec3fec0b6b4cd07f01650cc5
- https://git.kernel.org/stable/c/8eb43d635950e27c29f1e9e49a23b31637f37757
- https://git.kernel.org/stable/c/a01a4e9f5dc93335c716fa4023b1901956e8c904
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47082. Free for 1 server.
Get started free