Zephyr's Bluetooth Mesh subnet key management leaks one PSA Crypto key slot on every subnet-key teardown. In subsys/bluetooth/mesh/subnet.c, net_keys_create() imports the Private Beacon Key into a PSA key slot under CONFIG_BT_MESH_PRIV_BEACONS (enabled by default), but subnet_keys_destroy() guarded the matching psa_destroy_key() with CONFIG_BT_MESH_V1d1. That Kconfig symbol was removed when explicit Mesh 1.0.1 support was dropped, so the destroy branch became permanently dead code and the import is never balanced by a destroy.
The imbalanced teardown is reached every time subnet keys are destroyed: deleting a subnet (Config Server NetKey Delete), completing a Key Refresh Procedure (which retires the old key set), and resetting/re-provisioning the node. The over-the-air triggers are processed only under the node's device key, so they are exercisable by the provisioner or network administrator that owns the node, reachable over the Bluetooth Mesh network.
With the default CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT of 16, repeated add/delete or key-refresh cycles exhaust the shared PSA key-slot pool after roughly a dozen rounds. Once exhausted, bt_mesh_private_beacon_key() and thus subnet creation fail: the node can no longer add subnets or complete key refresh, and other PSA crypto consumers on the device may be starved, until the device is rebooted. The fix aligns the destroy guard with the import guard (CONFIG_BT_MESH_PRIV_BEACONS) so each slot is freed.
Affected components
Affected versions
>= 3.6.0, <= 4.4.1
Fix
Fixed (merged) in f573da9
Projected fixed version: 4.5.0 (the fix is merged on main but not yet released; this forecast should be confirmed against the actual release).
Introduced by: 981c79b ("Bluetooth: Mesh: Drop explicit support for Bluetooth Mesh 1.0.1") removed CONFIG_BT_MESH_V1d1 but left subnet_keys_destroy() guarding the priv_beacon destroy with it, making the branch dead
Evidence
- subsys/bluetooth/mesh/subnet.c:205-207 — post-fix destroy guard now CONFIG_BT_MESH_PRIV_BEACONS; pre-fix was CONFIG_BT_MESH_V1d1 (dead) per diff
- subsys/bluetooth/mesh/subnet.c:355-363 — net_keys_create imports priv_beacon under CONFIG_BT_MESH_PRIV_BEACONS, the mismatched (live) guard
- subsys/bluetooth/mesh/crypto.c:239 + crypto.h:77-80 — bt_mesh_private_beacon_key -> bt_mesh_id128 -> bt_mesh_key_import (psa_import_key), confirming a PSA slot is consumed
- subsys/bluetooth/mesh/crypto_psa.c:494-496 — bt_mesh_key_destroy calls psa_destroy_key, the freeing call that was skipped
- subsys/bluetooth/mesh/subnet.c:233,289,876 — three subnet_keys_destroy call sites: KRP phase-3, subnet_del, and stack reset
- subsys/bluetooth/mesh/cfg_srv.c:1673,1718,2488,2490 — OP_NET_KEY_ADD/DEL Config Server handlers (DevKey-authenticated) reaching subnet add/del over the air
- modules/mbedtls/Kconfig.tf-psa-crypto:387 — CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT default 16, the exhaustible pool
- git tag --contains 981c79b -> v3.6.0+ : the dead guard shipped in releases (reportable)
Patches
For more information
If you have any questions or comments about this advisory:
embargo: 2026-08-02
Zephyr's Bluetooth Mesh subnet key management leaks one PSA Crypto key slot on every subnet-key teardown. In
subsys/bluetooth/mesh/subnet.c,net_keys_create()imports the Private Beacon Key into a PSA key slot underCONFIG_BT_MESH_PRIV_BEACONS(enabled by default), butsubnet_keys_destroy()guarded the matchingpsa_destroy_key()withCONFIG_BT_MESH_V1d1. That Kconfig symbol was removed when explicit Mesh 1.0.1 support was dropped, so the destroy branch became permanently dead code and the import is never balanced by a destroy.The imbalanced teardown is reached every time subnet keys are destroyed: deleting a subnet (Config Server NetKey Delete), completing a Key Refresh Procedure (which retires the old key set), and resetting/re-provisioning the node. The over-the-air triggers are processed only under the node's device key, so they are exercisable by the provisioner or network administrator that owns the node, reachable over the Bluetooth Mesh network.
With the default
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNTof 16, repeated add/delete or key-refresh cycles exhaust the shared PSA key-slot pool after roughly a dozen rounds. Once exhausted,bt_mesh_private_beacon_key()and thus subnet creation fail: the node can no longer add subnets or complete key refresh, and other PSA crypto consumers on the device may be starved, until the device is rebooted. The fix aligns the destroy guard with the import guard (CONFIG_BT_MESH_PRIV_BEACONS) so each slot is freed.Affected components
subsys/bluetooth/meshAffected versions
>= 3.6.0, <= 4.4.1Fix
Fixed (merged) in f573da9
Projected fixed version: 4.5.0 (the fix is merged on
mainbut not yet released; this forecast should be confirmed against the actual release).Introduced by: 981c79b ("Bluetooth: Mesh: Drop explicit support for Bluetooth Mesh 1.0.1") removed CONFIG_BT_MESH_V1d1 but left subnet_keys_destroy() guarding the priv_beacon destroy with it, making the branch dead
Evidence
Patches
mainv4.4-branchv4.3-branchv3.7-branchFor more information
If you have any questions or comments about this advisory:
embargo: 2026-08-02