tun: zero the whole vnet header in tun_put_user()
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.
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 6.18.36, 7.0.13
- CVEs
- CVE-2026-52940
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 6 Nov 2026, 08:43 UTC · Revision 1
Source evidence
tun: zero the whole vnet header in tun_put_user()
core-osv · Original sourcePublished 24 Jun 2026, 07:14 UTC
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.
osv:CVE-2026-52940
Kernel
Fixed versions: 6.18.36, 7.0.13
Complete source record
{
"id": "fa2740700393714e781025b586f9ce18de700d9e4d20735212da03d94305440b",
"url": "https://osv.dev/vulnerability/CVE-2026-52940",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "tun: zero the whole vnet header in tun_put_user()",
"summary": "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.",
"evidence": "osv:CVE-2026-52940",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "6.18.36",
"evidence": "/affected/1/ranges"
},
{
"value": "7.0.13",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "CVE-2026-52940",
"aliases": [
"CVE-2026-52940"
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "GIT",
"events": [
{
"introduced": "288f30435132d2f9e7a29ec9b9745a4f9dc7fd37"
},
{
"fixed": "5fd1fa5a4254bfdd70571c77f5e3bcb4e43738d5"
},
{
"fixed": "585cb85e9a29185be05f326369573c2663cf4380"
},
{
"fixed": "7f2fcff15e99bb852f6967396ed12b38376e2c8d"
}
]
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-52940.json"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.17.0"
},
{
"fixed": "6.18.36"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.19.0"
},
{
"fixed": "7.0.13"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-52940.json"
}
}
],
"modified": "2026-10-28T02:30:47.024562174Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/585cb85e9a29185be05f326369573c2663cf4380",
"https://git.kernel.org/stable/c/5fd1fa5a4254bfdd70571c77f5e3bcb4e43738d5",
"https://git.kernel.org/stable/c/7f2fcff15e99bb852f6967396ed12b38376e2c8d",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/52xxx/CVE-2026-52940.json",
"https://nvd.nist.gov/vuln/detail/CVE-2026-52940",
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
],
"provider_metadata": {
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/52xxx/CVE-2026-52940.json"
}
},
"related_cves": [
{
"value": "CVE-2026-52940",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 515010,
"published_at": "2026-06-24T07:14:29.281+00:00"
}