{"id":"CVE-2024-56720","state":"PUBLISHED","title":"bpf, sockmap: Several fixes to bpf_msg_pop_data","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, sockmap: Several fixes to bpf_msg_pop_data\n\nSeveral fixes to bpf_msg_pop_data,\n1. In sk_msg_shift_left, we should put_page\n2. if (len == 0), return early is better\n3. pop the entire sk_msg (last == msg->sg.size) should be supported\n4. Fix for the value of variable \"a\"\n5. In sk_msg_shift_left, after shifting, i has already pointed to the next\nelement. Addtional sk_msg_iter_var_next may result in BUG.","publishedAt":"2024-12-29T11:29:58.345Z","updatedAt":"2026-08-05T11:46:18.145Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"d3f5763b3062514a234114e97bbde74d8d702449","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"d26d977633d1d0b8bf9407278189bd0a8d973323","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"e1f54c61c4c9a5244eb8159dce60d248f7d97b32","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"f58d3aa457e77a3d9b3df2ab081dcf9950f6029f","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"98c7ea7d11f2588e8197db042e0291e4ac8f8346","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"785180bed9879680d8e5c5e1b54c8ae8d948f4c8","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"275a9f3ef8fabb0cb282a62b9e164dedba7284c5","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"5d609ba262475db450ba69b8e8a557bd768ac07a","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/filter.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.0","versionType":"semver"},{"version":"5.4.287","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.231","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.174","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.120","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.64","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.11.11","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12.2","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/filter.c"]}],"references":["https://git.kernel.org/stable/c/d3f5763b3062514a234114e97bbde74d8d702449","https://git.kernel.org/stable/c/d26d977633d1d0b8bf9407278189bd0a8d973323","https://git.kernel.org/stable/c/e1f54c61c4c9a5244eb8159dce60d248f7d97b32","https://git.kernel.org/stable/c/f58d3aa457e77a3d9b3df2ab081dcf9950f6029f","https://git.kernel.org/stable/c/98c7ea7d11f2588e8197db042e0291e4ac8f8346","https://git.kernel.org/stable/c/785180bed9879680d8e5c5e1b54c8ae8d948f4c8","https://git.kernel.org/stable/c/275a9f3ef8fabb0cb282a62b9e164dedba7284c5","https://git.kernel.org/stable/c/5d609ba262475db450ba69b8e8a557bd768ac07a","https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html","https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"],"weaknesses":["CWE-401"],"ingestedAt":"2026-10-29T20:08:12.933Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/56xxx/CVE-2024-56720.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-56720","state":"PUBLISHED","datePublished":"2024-12-29T11:29:58.345Z","dateUpdated":"2026-08-05T11:46:18.145Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-27T15:00:39.858Z"},"containers":{"cna":{"title":"bpf, sockmap: Several fixes to bpf_msg_pop_data","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, sockmap: Several fixes to bpf_msg_pop_data\n\nSeveral fixes to bpf_msg_pop_data,\n1. In sk_msg_shift_left, we should put_page\n2. if (len == 0), return early is better\n3. pop the entire sk_msg (last == msg->sg.size) should be supported\n4. Fix for the value of variable \"a\"\n5. In sk_msg_shift_left, after shifting, i has already pointed to the next\nelement. Addtional sk_msg_iter_var_next may result in BUG."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"d3f5763b3062514a234114e97bbde74d8d702449","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"d26d977633d1d0b8bf9407278189bd0a8d973323","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"e1f54c61c4c9a5244eb8159dce60d248f7d97b32","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"f58d3aa457e77a3d9b3df2ab081dcf9950f6029f","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"98c7ea7d11f2588e8197db042e0291e4ac8f8346","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"785180bed9879680d8e5c5e1b54c8ae8d948f4c8","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"275a9f3ef8fabb0cb282a62b9e164dedba7284c5","versionType":"git"},{"version":"7246d8ed4dcce23f7509949a77be15fa9f0e3d28","status":"affected","lessThan":"5d609ba262475db450ba69b8e8a557bd768ac07a","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/filter.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.0","versionType":"semver"},{"version":"5.4.287","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.231","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.174","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.120","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.64","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.11.11","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12.2","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/filter.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/d3f5763b3062514a234114e97bbde74d8d702449"},{"url":"https://git.kernel.org/stable/c/d26d977633d1d0b8bf9407278189bd0a8d973323"},{"url":"https://git.kernel.org/stable/c/e1f54c61c4c9a5244eb8159dce60d248f7d97b32"},{"url":"https://git.kernel.org/stable/c/f58d3aa457e77a3d9b3df2ab081dcf9950f6029f"},{"url":"https://git.kernel.org/stable/c/98c7ea7d11f2588e8197db042e0291e4ac8f8346"},{"url":"https://git.kernel.org/stable/c/785180bed9879680d8e5c5e1b54c8ae8d948f4c8"},{"url":"https://git.kernel.org/stable/c/275a9f3ef8fabb0cb282a62b9e164dedba7284c5"},{"url":"https://git.kernel.org/stable/c/5d609ba262475db450ba69b8e8a557bd768ac07a"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable helper runs from `sk_psock_msg_verdict()` on the local egress path, requiring a locally loaded BPF_PROG_TYPE_SK_MSG program attached to a sockmap plus a local `sendmsg()` on a sockmap'd socket; there is no remote packet path into `bpf_msg_pop_data()` since SK_MSG programs only process data the local host is sending.\nAC:L - The bug is fully deterministic and entirely attacker-controlled — the sender chooses the write size that splits the message across scatterlist elements (making `offset != 0`), and the BPF program chooses a `start` that lands in a later element, so `a = start` is guaranteed to exceed `sge->length` with no race, timing, or memory-layout dependency.\nPR:L - Setting up the sockmap and SK_MSG program requires CAP_BPF and CAP_NET_ADMIN, but `bpf_token_capable()` grants these at `ns_capable()` level inside a user namespace via delegated BPF tokens, and both capabilities are routinely handed to container workloads, so an ordinary unprivileged-in-init-ns user can reach this path.\nUI:N - No victim action is required — the attacker loads the SK_MSG program and issues the triggering `sendmsg()` entirely on their own, with no file to open, filesystem to mount, or third party to interact with.\nS:U - The out-of-bounds reads, heap overflow, and scatterlist-ring corruption are all confined to the kernel's own memory and the socket's psock state; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The corrupted scatterlist entry carries an inflated `length` (up to ~4 GB after the signed-to-unsigned wrap of `b`) and an `offset` past the page, and `tcp_bpf_push()` hands those verbatim to `tcp_sendmsg_locked()` with MSG_SPLICE_PAGES, transmitting arbitrary adjacent kernel heap memory to the socket peer; the `!space` path additionally performs `memcpy(to, from, a)` reading far past the source element.\nI:H - In the no-space branch `memcpy(to, from, a)` and `memcpy(to + a, from + a + pop, b)` write attacker-sized data past an undersized `alloc_pages()` allocation — a controlled heap buffer overflow — and the missing `put_page()` plus the stray `sk_msg_iter_var_next()` rotate the entire sg ring, installing stale `struct page *` values that produce refcount imbalance and use-after-free of pages.\nA:H - A negative `b` passed to `memcpy()` as `size_t`, a scatterlist entry pointing far outside its page, and `sk_msg_shift_left()` corrupting the whole fragment ring all lead directly to kernel oops/panic, while the missing `put_page()` permanently leaks a page per popped element."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:46:18.145Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"5.4.287"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"5.10.231"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"5.15.174"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.1.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.6.64"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.11.11"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.12.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.0","versionEndExcluding":"6.13"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":5.5,"attackVector":"LOCAL","baseSeverity":"MEDIUM","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","integrityImpact":"NONE","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"NONE"}},{"other":{"type":"ssvc","content":{"id":"CVE-2024-56720","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2025-10-01T19:58:21.307610Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-401","lang":"en","type":"CWE","description":"CWE-401 Missing Release of Memory after Effective Lifetime"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-10-01T20:07:06.140Z"}},{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html"},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T20:53:12.383Z"}}]}}}