{"id":"CVE-2025-38162","state":"PUBLISHED","title":"netfilter: nft_set_pipapo: prevent overflow in lookup table allocation","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: nft_set_pipapo: prevent overflow in lookup table allocation\n\nWhen calculating the lookup table size, ensure the following\nmultiplication does not overflow:\n\n- desc->field_len[] maximum value is U8_MAX multiplied by\n  NFT_PIPAPO_GROUPS_PER_BYTE(f) that can be 2, worst case.\n- NFT_PIPAPO_BUCKETS(f->bb) is 2^8, worst case.\n- sizeof(unsigned long), from sizeof(*f->lt), lt in\n  struct nft_pipapo_field.\n\nThen, use check_mul_overflow() to multiply by bucket size and then use\ncheck_add_overflow() to the alignment for avx2 (if needed). Finally, add\nlt_size_check_overflow() helper and use it to consolidate this.\n\nWhile at it, replace leftover allocation using the GFP_KERNEL to\nGFP_KERNEL_ACCOUNT for consistency, in pipapo_resize().","publishedAt":"2025-07-03T08:36:03.731Z","updatedAt":"2026-10-15T21:52:09.997Z","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":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"91edc076439c9e2f34b176149f1c84a47a8ec32f","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"a9e757473561da93c6a4136f0e59aba91ec777fc","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"c1360ac8156c0a3f2385baef91d8d26fd9d39701","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"43fe1181f738295624696ae9ff611790edb65b5e","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"4c5c6aa9967dbe55bd017bb509885928d0f31206","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/nft_set_pipapo.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.6","versionType":"semver"},{"version":"6.1.167","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.125","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","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":["net/netfilter/nft_set_pipapo.c"]}],"references":["https://git.kernel.org/stable/c/91edc076439c9e2f34b176149f1c84a47a8ec32f","https://git.kernel.org/stable/c/a9e757473561da93c6a4136f0e59aba91ec777fc","https://git.kernel.org/stable/c/c1360ac8156c0a3f2385baef91d8d26fd9d39701","https://git.kernel.org/stable/c/43fe1181f738295624696ae9ff611790edb65b5e","https://git.kernel.org/stable/c/4c5c6aa9967dbe55bd017bb509885928d0f31206","https://cert-portal.siemens.com/productcert/html/ssa-082556.html","https://cert-portal.siemens.com/productcert/html/ssa-019113.html","https://cert-portal.siemens.com/productcert/html/ssa-457936.html","https://cert-portal.siemens.com/productcert/html/ssa-784472.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38162.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38162","state":"PUBLISHED","datePublished":"2025-07-03T08:36:03.731Z","dateUpdated":"2026-10-15T21:52:09.997Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.990Z"},"containers":{"cna":{"title":"netfilter: nft_set_pipapo: prevent overflow in lookup table allocation","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: nft_set_pipapo: prevent overflow in lookup table allocation\n\nWhen calculating the lookup table size, ensure the following\nmultiplication does not overflow:\n\n- desc->field_len[] maximum value is U8_MAX multiplied by\n  NFT_PIPAPO_GROUPS_PER_BYTE(f) that can be 2, worst case.\n- NFT_PIPAPO_BUCKETS(f->bb) is 2^8, worst case.\n- sizeof(unsigned long), from sizeof(*f->lt), lt in\n  struct nft_pipapo_field.\n\nThen, use check_mul_overflow() to multiply by bucket size and then use\ncheck_add_overflow() to the alignment for avx2 (if needed). Finally, add\nlt_size_check_overflow() helper and use it to consolidate this.\n\nWhile at it, replace leftover allocation using the GFP_KERNEL to\nGFP_KERNEL_ACCOUNT for consistency, in pipapo_resize()."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"91edc076439c9e2f34b176149f1c84a47a8ec32f","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"a9e757473561da93c6a4136f0e59aba91ec777fc","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"c1360ac8156c0a3f2385baef91d8d26fd9d39701","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"43fe1181f738295624696ae9ff611790edb65b5e","versionType":"git"},{"version":"3c4287f62044a90e73a561aa05fc46e62da173da","status":"affected","lessThan":"4c5c6aa9967dbe55bd017bb509885928d0f31206","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/nft_set_pipapo.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.6","versionType":"semver"},{"version":"6.1.167","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.125","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","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":["net/netfilter/nft_set_pipapo.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/91edc076439c9e2f34b176149f1c84a47a8ec32f"},{"url":"https://git.kernel.org/stable/c/a9e757473561da93c6a4136f0e59aba91ec777fc"},{"url":"https://git.kernel.org/stable/c/c1360ac8156c0a3f2385baef91d8d26fd9d39701"},{"url":"https://git.kernel.org/stable/c/43fe1181f738295624696ae9ff611790edb65b5e"},{"url":"https://git.kernel.org/stable/c/4c5c6aa9967dbe55bd017bb509885928d0f31206"}],"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 allocation is reached only through nftables set creation and element insertion via the nfnetlink netlink socket (NFT_MSG_NEWSET/NFT_MSG_NEWSETELEM), which requires local system access. Per kernel scoring guidance, netfilter/nftables netlink paths are Local.\nAC:L - Every input that feeds the overflowing expression — field count, per-field length via NFTA_SET_DESC_CONCAT, group-bit width, and the rule count that drives bsize — is chosen directly by the attacker, with no race to win and no memory layout or victim state outside their control. The attack is deterministic and repeatable.\nPR:L - nfnetlink_rcv() enforces only netlink_net_capable(skb, CAP_NET_ADMIN), which is namespace-relative, so any unprivileged local user obtains it with unshare -Urn and can then create pipapo sets and insert elements. This is Low, not High, since no real root in the init namespace is needed.\nUI:N - The attacker performs the whole sequence themselves through netlink syscalls; no victim needs to open a file, mount a filesystem, or take any other action.\nS:U - The integer overflow and the resulting memory corruption are both confined to the kernel's own security authority, with no crossing of a VM, IOMMU, or sandbox boundary. This is a standard in-kernel privilege-escalation shape.\nC:H - The undersized lookup table is subsequently indexed by pipapo_bucket_set() and by the AVX2/generic lookup routines using the un-truncated groups/buckets/bsize geometry, producing out-of-bounds reads of adjacent kernel memory that can be observed through set matching results and element dumps. Heap corruption of this kind is treated as enabling arbitrary read.\nI:H - After the wrap, pipapo_resize()'s memcpy loop and every __set_bit() in pipapo_insert() write beyond the allocation, giving a controlled out-of-bounds heap write into adjacent objects. An OOB write of this form is exploitable for control-flow hijacking or arbitrary modification of kernel structures.\nA:H - Writing past the end of a kvzalloc()'d region corrupts neighbouring allocations and slab/vmalloc metadata, reliably producing an oops or panic (immediately under KASAN or hardened allocators). Any such kernel crash is High."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:59:56.562Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.1.167"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.6.125"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.12.34"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.15.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"affected":[{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 TM MFP - GNU/Linux subsystem","defaultStatus":"unknown","versions":[{"version":"0","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]}],"references":[{"url":"https://cert-portal.siemens.com/productcert/html/ssa-082556.html"},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-019113.html"},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-457936.html"},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-784472.html"}],"providerMetadata":{"shortName":"siemens-SADP","orgId":"0b142b55-0307-4c5a-b3c9-f314f3fb7c5e","dateUpdated":"2026-10-15T01:06:39.723Z"},"x_adpType":"supplier"},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-38162","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:47:58.834521Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T21:52:09.997Z"}}]}}}