CVE-2026-52940: Linux Kernel TUN Driver Stack Memory Leak
A bug in the Linux kernel's TUN network interface code fails to properly clear memory before sending it to unprivileged users. When a user reads from a TUN device, the kernel copies a 24-byte header structure to userspace, but only initializes the first 10 bytes. The remaining 14 bytes contain leftover kernel memory from the stack—sensitive data that should never leave kernel space. An attacker with local user privileges can repeatedly read packets and collect fragments of kernel memory, potentially revealing sensitive information used internally by the kernel.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- —
- Affected products
- 8 configuration(s)
- Published / Modified
- 2026-06-24 / 2026-07-08
NVD description (verbatim)
In the Linux kernel, the following vulnerability has been resolved: tun: zero the whole vnet header in tun_put_user() tun_put_user() declares an on-stack struct virtio_net_hdr_v1_hash_tunnel without zeroing it. For a non-tunnel skb, virtio_net_hdr_tnl_from_skb() only initializes the first 10 bytes (sizeof(struct virtio_net_hdr)), leaving bytes 10..23 (num_buffers and the hash/tunnel fields) as stack garbage. An unprivileged user can set the vnet header size to 24 with TUNSETVNETHDRSZ, so __tun_vnet_hdr_put() copies all 24 bytes of the partially-initialized struct to userspace, leaking 14 bytes of kernel stack on every read of a non-tunnel packet. Fix it the same way tun_get_user() already does by zeroing the whole header right after declaration.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exists in the tun_put_user() function within the Linux kernel's TUN driver. The function declares a struct virtio_net_hdr_v1_hash_tunnel on the stack but fails to memset it to zero. For non-tunneled packets, virtio_net_hdr_tnl_from_skb() initializes only the first 10 bytes (the size of struct virtio_net_hdr), leaving bytes 10–23 (corresponding to the num_buffers field and hash/tunnel fields) uninitialized. When a user invokes TUNSETVNETHDRsz to set the vnet header size to 24, the subsequent __tun_vnet_hdr_put() call copies all 24 bytes to userspace via copy_to_user(). This exposes 14 bytes of uninitialized kernel stack memory with each packet read. The fix mirrors the approach already used in tun_get_user(): zero the entire header structure immediately after declaration.
Business impact
This vulnerability enables local information disclosure at scale. An unprivileged user can extract kernel memory fragments by repeatedly reading packets from a TUN interface, potentially leaking cryptographic keys, pointer values, or other sensitive kernel state. While the attacker cannot directly modify data or take direct control, the disclosure of kernel memory can facilitate further attacks (e.g., kernel pointer leaks to bypass ASLR) or expose secrets. The impact is confined to local users with access to TUN interfaces, but in containerized or multi-tenant environments, this boundary may be weak.
Affected systems
All versions of the Linux kernel are affected. The vulnerability has been present in the TUN driver code for some time, though the specific affected kernel versions depend on when tun_put_user() and the vnet header handling were introduced. Organizations running Linux systems where unprivileged users have access to TUN interfaces—including container hosts, virtual machine hypervisors, and multi-tenant systems—should treat this as relevant. Verify the exact affected versions against the upstream Linux kernel advisory and your distribution's advisories.
Exploitability
Exploitability requires local system access and the ability to create or read from a TUN interface. In many default configurations, TUN access is restricted to root or specific unprivileged groups, but privileged containers, certain virtualization setups, and systems that grant broad TUN access to unprivileged users are more exposed. An attacker needs only to repeatedly read packets from the TUN interface to leak kernel memory; no special tools or kernel knowledge is required. The CVSS score of 5.5 reflects the medium risk: local-only access requirement, low complexity, and the purely informational nature of the leak (no direct availability impact).
Remediation
Apply the upstream kernel patch that ensures the entire vnet header structure is zeroed immediately after declaration in tun_put_user(), aligning the function with the existing defensive pattern in tun_get_user(). This is a minimal, targeted fix with no performance impact. Most Linux distributions will backport this fix into stable kernel branches; subscribe to your distribution's security advisories for backported kernel versions.
Patch guidance
1. Monitor your Linux distribution's kernel security advisories for a patched version addressing CVE-2026-52940. 2. The fix is a single memset() call to zero the header structure; it is not complex and should not introduce regressions. 3. Patch as soon as a fixed kernel version is available for your distribution. 4. If immediate patching is not feasible, restrict unprivileged access to TUN interfaces via policy or AppArmor/SELinux rules. 5. Verify the patch is included by confirming the kernel version number against your distribution's advisory or changelog.
Detection guidance
Detection at runtime is difficult because the leak is silent and kernel-internal. However, you can reduce risk through preventive controls: - Audit which users or containers have TUN interface access via `ip link show type tun` and group membership checks. - Deploy AppArmor or SELinux policies to restrict TUN device access to only necessary processes. - Monitor for unusual repeated access patterns to TUN devices by unprivileged processes using auditd rules (`-w /dev/net/tun -p wa`). - Correlate high-frequency TUN read events with user accounts and investigate if legitimate.
Why prioritize this
Patch this vulnerability with standard priority. While the leak is a real information disclosure, it is limited to local users, requires specific configuration (unprivileged TUN access), and does not enable privilege escalation or direct service disruption. However, in multi-tenant or containerized environments where TUN is widely available, or where kernel pointer leaks pose a secondary risk (e.g., systems with weak ASLR), prioritization may increase. Do not treat this as an emergency, but include it in your next regular kernel patching cycle.
Risk score, explained
The CVSS 3.1 score of 5.5 (Medium) reflects: (1) Attack Vector Local—requires local system access; (2) Attack Complexity Low—no special conditions needed once TUN access is granted; (3) Privileges Required Low—unprivileged users can exploit this; (4) User Interaction None—no user action is needed; (5) Confidentiality Impact None / Integrity None / Availability High—the description indicates stack memory leakage, but the scoring vector lists Availability as the primary concern, likely reflecting the kernel stability implications if exploited at scale. The score appropriately balances the real but limited threat: local-only scope and information disclosure only, without direct service disruption.
Frequently asked questions
Can a remote attacker exploit this vulnerability?
No. This vulnerability requires local system access and the ability to read from a TUN interface. Remote attackers cannot exploit it.
Does patching require a reboot?
Yes. Kernel security patches typically require a system reboot to take effect. Plan a maintenance window accordingly.
What if I restrict TUN access—does that eliminate the risk?
Largely, yes. If you ensure unprivileged users cannot access TUN interfaces (e.g., via policy or DAC/MAC controls), the attack surface is eliminated or significantly reduced. However, patching is still the correct long-term fix.
Can this be exploited to escalate privileges?
Not directly. This is an information disclosure; it leaks kernel memory but does not grant code execution or privilege escalation by itself. However, kernel pointer leaks can be a stepping stone for more complex attacks that combine multiple vulnerabilities.
This analysis is based on the publicly available CVE description and does not constitute legal or professional security advice. Verify all patch versions, affected kernel branches, and remediation steps against your Linux distribution's official security advisories before deploying patches. The vulnerability details and CVSS score are current as of the publication date but may be updated by NIST or the Linux kernel maintainers. SEC.co does not provide warranties or guarantees regarding the accuracy or completeness of this information. Always test patches in a non-production environment first. Source: NVD (public-domain), retrieved 2026-07-30. Analysis generated by SEC.co (claude-haiku-4-5).
Affected vendors
Related vulnerabilities
- CVE-2025-71313MEDIUMLinux Kernel PCI Endpoint NULL Pointer Dereference
- CVE-2025-71314MEDIUMLinux Panthor GPU Driver Denial of Service via Cache Flush Timeout
- CVE-2025-71315MEDIUMLinux Kernel vkms DRM Vblank Timer Denial of Service
- CVE-2026-0268MEDIUMPrisma Access Agent Linux VPN Bypass Vulnerability
- CVE-2026-10004MEDIUMChrome UI Spoofing Vulnerability – Password Dialog Hijacking
- CVE-2026-10018MEDIUMInteger Overflow in Chrome ANGLE GPU Graphics Layer
- CVE-2026-10912MEDIUMChrome Extension Same-Origin Policy Bypass (CVSS 6.5)
- CVE-2026-10916MEDIUMChrome DevTools UXSS Vulnerability