{"id":"CVE-2025-38413","state":"PUBLISHED","title":"virtio-net: xsk: rx: fix the frame's length check","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nvirtio-net: xsk: rx: fix the frame's length check\n\nWhen calling buf_to_xdp, the len argument is the frame data's length\nwithout virtio header's length (vi->hdr_len). We check that len with\n\n\txsk_pool_get_rx_frame_size() + vi->hdr_len\n\nto ensure the provided len does not larger than the allocated chunk\nsize. The additional vi->hdr_len is because in virtnet_add_recvbuf_xsk,\nwe use part of XDP_PACKET_HEADROOM for virtio header and ask the vhost\nto start placing data from\n\n\thard_start + XDP_PACKET_HEADROOM - vi->hdr_len\nnot\n\thard_start + XDP_PACKET_HEADROOM\n\nBut the first buffer has virtio_header, so the maximum frame's length in\nthe first buffer can only be\n\n\txsk_pool_get_rx_frame_size()\nnot\n\txsk_pool_get_rx_frame_size() + vi->hdr_len\n\nlike in the current check.\n\nThis commit adds an additional argument to buf_to_xdp differentiate\nbetween the first buffer and other ones to correctly calculate the maximum\nframe's length.","publishedAt":"2025-07-25T13:20:17.394Z","updatedAt":"2026-08-05T12:01:42.803Z","severity":{"score":7.7,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"892f6ed9a4a38bb3360fdff091b9241cfa105b61","versionType":"git"},{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"6013bb6bc24c2cac3f45b37a15b71b232a5b00ff","versionType":"git"},{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"5177373c31318c3c6a190383bfd232e6cf565c36","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/virtio_net.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.11","versionType":"semver"},{"version":"6.12.37","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.6","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/virtio_net.c"]}],"references":["https://git.kernel.org/stable/c/892f6ed9a4a38bb3360fdff091b9241cfa105b61","https://git.kernel.org/stable/c/6013bb6bc24c2cac3f45b37a15b71b232a5b00ff","https://git.kernel.org/stable/c/5177373c31318c3c6a190383bfd232e6cf565c36"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38413.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38413","state":"PUBLISHED","datePublished":"2025-07-25T13:20:17.394Z","dateUpdated":"2026-08-05T12:01:42.803Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.013Z"},"containers":{"cna":{"title":"virtio-net: xsk: rx: fix the frame's length check","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nvirtio-net: xsk: rx: fix the frame's length check\n\nWhen calling buf_to_xdp, the len argument is the frame data's length\nwithout virtio header's length (vi->hdr_len). We check that len with\n\n\txsk_pool_get_rx_frame_size() + vi->hdr_len\n\nto ensure the provided len does not larger than the allocated chunk\nsize. The additional vi->hdr_len is because in virtnet_add_recvbuf_xsk,\nwe use part of XDP_PACKET_HEADROOM for virtio header and ask the vhost\nto start placing data from\n\n\thard_start + XDP_PACKET_HEADROOM - vi->hdr_len\nnot\n\thard_start + XDP_PACKET_HEADROOM\n\nBut the first buffer has virtio_header, so the maximum frame's length in\nthe first buffer can only be\n\n\txsk_pool_get_rx_frame_size()\nnot\n\txsk_pool_get_rx_frame_size() + vi->hdr_len\n\nlike in the current check.\n\nThis commit adds an additional argument to buf_to_xdp differentiate\nbetween the first buffer and other ones to correctly calculate the maximum\nframe's length."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"892f6ed9a4a38bb3360fdff091b9241cfa105b61","versionType":"git"},{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"6013bb6bc24c2cac3f45b37a15b71b232a5b00ff","versionType":"git"},{"version":"a4e7ba7027012f009f22a68bcfde670f9298d3a4","status":"affected","lessThan":"5177373c31318c3c6a190383bfd232e6cf565c36","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/virtio_net.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.11","versionType":"semver"},{"version":"6.12.37","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.6","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/virtio_net.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/892f6ed9a4a38bb3360fdff091b9241cfa105b61"},{"url":"https://git.kernel.org/stable/c/6013bb6bc24c2cac3f45b37a15b71b232a5b00ff"},{"url":"https://git.kernel.org/stable/c/5177373c31318c3c6a190383bfd232e6cf565c36"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","baseScore":7.7,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The malicious input is the used-ring length reported by the virtio-net backend (untrusted hypervisor/host, vDPA/VDUSE backend, or virtio offload hardware), which is local to the guest kernel rather than delivered over the network. A remote network peer cannot trigger it, since a conforming backend can never report more bytes than the posted buffer holds.\nAC:L - The backend fully and deterministically controls the reported length field and can set it to `frame_size + 2*hdr_len` on every received packet; there is no race, no memory-layout dependency, and no condition outside the attacker's control.\nPR:N - The attacking device backend needs no credentials or privileges inside the target guest — the overflow is processed automatically in the virtio-net NAPI RX path with no guest-side authentication or capability check.\nUI:N - No victim action is required; the malformed length is consumed by `virtnet_receive_xsk_buf()` during normal NAPI packet reception once an AF_XDP zero-copy pool is bound to the queue.\nS:U - The out-of-bounds read and the resulting disclosure/crash are confined to the guest kernel that owns the vulnerable driver, so the vulnerable and impacted components share the same security authority.\nC:H - `xdp->data_end` is pushed past the end of the XSK chunk, and `xsk_construct_skb()`/`xsk_append_merge_buffer()` copy that out-of-bounds memory into an skb that is delivered to the guest network stack or retransmitted via XDP_TX/XDP_REDIRECT, leaking adjacent memory repeatedly at packet rate.\nI:N - Both copy destinations (`napi_alloc_skb()` and `napi_alloc_frag()`) are sized from the same inflated length that is copied, so no out-of-bounds write or kernel data modification occurs — the defect is a read-side bounds error only.\nA:H - The umem is a `vmap()` of pinned user pages, so reading past the final chunk lands on a vmalloc guard page and produces an unhandled kernel page fault/oops (and a KASAN BUG on hardened kernels), crashing the guest."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:01:42.803Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.12.37"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.15.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}