{"id":"CVE-2025-40213","state":"PUBLISHED","title":"Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nBluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete\n\nThere is a BUG: KASAN: stack-out-of-bounds in set_mesh_sync due to\nmemcpy from badly declared on-stack flexible array.\n\nAnother crash is in set_mesh_complete() due to double list_del via\nmgmt_pending_valid + mgmt_pending_remove.\n\nUse DEFINE_FLEX to declare the flexible array right, and don't memcpy\noutside bounds.\n\nAs mgmt_pending_valid removes the cmd from list, use mgmt_pending_free,\nand also report status on error.","publishedAt":"2025-11-24T15:59:44.000Z","updatedAt":"2026-10-21T12:37:53.837Z","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":"0b60eb04b8524e1b4b3f07fea0d16fda9a677d9a","status":"affected","lessThan":"31d6c9216aa1be18ba317239738f73b0b0c7b691","versionType":"git"},{"version":"d71b98f253b079cbadc83266383f26fe7e9e103b","status":"affected","lessThan":"5c19daa93d9af29f1f46251b47e1ea66bcc8d679","versionType":"git"},{"version":"302a1f674c00dd5581ab8e493ef44767c5101aab","status":"affected","lessThan":"1c9aca1787e8395a2c59fef20e914467958969c5","versionType":"git"},{"version":"302a1f674c00dd5581ab8e493ef44767c5101aab","status":"affected","lessThan":"e8785404de06a69d89dcdd1e9a0b6ea42dc6d327","versionType":"git"},{"version":"87a1f16f07c6c43771754075e08f45b41d237421","status":"affected","versionType":"git"},{"version":"6.6.140","status":"affected","lessThan":"6.6.160","versionType":"semver"},{"version":"6.16.10","status":"affected","lessThan":"6.17","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/bluetooth/mgmt.h","net/bluetooth/mgmt.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.17","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.17","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.17.8","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/bluetooth/mgmt.h","net/bluetooth/mgmt.c"]}],"references":["https://git.kernel.org/stable/c/31d6c9216aa1be18ba317239738f73b0b0c7b691","https://git.kernel.org/stable/c/5c19daa93d9af29f1f46251b47e1ea66bcc8d679","https://git.kernel.org/stable/c/1c9aca1787e8395a2c59fef20e914467958969c5","https://git.kernel.org/stable/c/e8785404de06a69d89dcdd1e9a0b6ea42dc6d327"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40213.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40213","state":"PUBLISHED","datePublished":"2025-11-24T15:59:44.000Z","dateUpdated":"2026-10-21T12:37:53.837Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.179Z"},"containers":{"cna":{"title":"Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nBluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete\n\nThere is a BUG: KASAN: stack-out-of-bounds in set_mesh_sync due to\nmemcpy from badly declared on-stack flexible array.\n\nAnother crash is in set_mesh_complete() due to double list_del via\nmgmt_pending_valid + mgmt_pending_remove.\n\nUse DEFINE_FLEX to declare the flexible array right, and don't memcpy\noutside bounds.\n\nAs mgmt_pending_valid removes the cmd from list, use mgmt_pending_free,\nand also report status on error."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"0b60eb04b8524e1b4b3f07fea0d16fda9a677d9a","status":"affected","lessThan":"31d6c9216aa1be18ba317239738f73b0b0c7b691","versionType":"git"},{"version":"d71b98f253b079cbadc83266383f26fe7e9e103b","status":"affected","lessThan":"5c19daa93d9af29f1f46251b47e1ea66bcc8d679","versionType":"git"},{"version":"302a1f674c00dd5581ab8e493ef44767c5101aab","status":"affected","lessThan":"1c9aca1787e8395a2c59fef20e914467958969c5","versionType":"git"},{"version":"302a1f674c00dd5581ab8e493ef44767c5101aab","status":"affected","lessThan":"e8785404de06a69d89dcdd1e9a0b6ea42dc6d327","versionType":"git"},{"version":"87a1f16f07c6c43771754075e08f45b41d237421","status":"affected","versionType":"git"},{"version":"6.6.140","status":"affected","lessThan":"6.6.160","versionType":"semver"},{"version":"6.16.10","status":"affected","lessThan":"6.17","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/bluetooth/mgmt.h","net/bluetooth/mgmt.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.17","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.17","versionType":"semver"},{"version":"6.6.160","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.17.8","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/bluetooth/mgmt.h","net/bluetooth/mgmt.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/31d6c9216aa1be18ba317239738f73b0b0c7b691"},{"url":"https://git.kernel.org/stable/c/5c19daa93d9af29f1f46251b47e1ea66bcc8d679"},{"url":"https://git.kernel.org/stable/c/1c9aca1787e8395a2c59fef20e914467958969c5"},{"url":"https://git.kernel.org/stable/c/e8785404de06a69d89dcdd1e9a0b6ea42dc6d327"}],"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 vulnerability is triggered entirely through a local AF_BLUETOOTH HCI control (mgmt) socket by sending a MGMT_OP_SET_MESH_RECEIVER command via sendmsg(); no over-the-air interaction is needed to reach or corrupt memory.\nAC:L - Both defects fire deterministically — any SET_MESH_RECEIVER with param_len > 6 causes the stack out-of-bounds read, and every successful completion hits the double list_del; the optional sock use-after-free variant is a race whose both sides (issuing the command and closing the mgmt fd) are fully attacker-controlled.\nPR:L - Requires a trusted mgmt socket (CAP_NET_ADMIN), the privilege level held by the ordinary non-root Bluetooth daemon on Linux desktops and by Android's sandboxed bluetooth process, so a compromised Bluetooth stack — itself remotely attackable — reaches this with low effective privilege.\nUI:N - The attacker issues the management command directly and no victim action, configuration change, or interaction is required.\nS:U - The out-of-bounds access, list corruption and freed-socket reuse all occur within the kernel's own security authority with no crossing of a VM, IOMMU or sandbox boundary.\nC:H - Up to 16 bytes of adjacent kernel stack are copied into the persistent hdev->mesh_ad_types filter and can be read back byte-by-byte through the mesh_device_found() advertisement-forwarding oracle, and the use-after-free on the released sock additionally exposes reclaimed slab contents.\nI:H - The second list_del writes through LIST_POISON pointers, and the premature sock_put lets mgmt_cmd_complete() write into a freed, sprayable hci_pinfo/sock object (sk_receive_queue, sk_data_ready), which is a control-flow hijack primitive rather than a bounded modification.\nA:H - The double list_del reliably oopses on poison-pointer dereference (or WARNs under CONFIG_DEBUG_LIST), the stack out-of-bounds read is a hard KASAN BUG, and the error path leaks the cmd, its parameters and a socket reference on every failure."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-21T12:37:53.837Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6.140","versionEndExcluding":"6.6.160"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.17","versionEndExcluding":"6.17.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.17","versionEndExcluding":"6.18"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.16.10"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}