public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Bluetooth: SMP: honor local MITM requirements for legacy pairing
@ 2026-03-30 15:33 Oleh Konko
  2026-03-30 15:33 ` [PATCH v3 2/2] Bluetooth: SMP: derive legacy responder STK authentication from MITM state Oleh Konko
  2026-03-30 15:33 ` [PATCH v3 1/2] Bluetooth: SMP: honor local HIGH security when selecting legacy pairing method Oleh Konko
  0 siblings, 2 replies; 7+ messages in thread
From: Oleh Konko @ 2026-03-30 15:33 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
  Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
	linux-kernel@vger.kernel.org

hi,

this series follows up on the private security discussion around legacy
LE pairing and BT_SECURITY_HIGH.

1/2 fixes the primary issue in tk_request(): when the local side
requires HIGH security, method selection must still consider that local
MITM requirement even if the remote auth_req does not set SMP_AUTH_MITM.

2/2 keeps the stored responder STK authentication bit aligned with the
pairing result by deriving it from the achieved MITM state rather than
from pending_sec_level. that keeps the legacy path consistent with the
existing Secure Connections handling and acts as defense in depth.

both patches carry Fixes and Cc: stable.

if anyone with recent Bluetooth qualification access can run this
against PTS as well, that would be very helpful.

thanks,
Oleh


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH v4 1/2] Bluetooth: SMP: force responder MITM requirements before building the pairing response
@ 2026-03-31 11:52 Oleh Konko
  2026-03-31 13:25 ` Bluetooth: SMP: honor local MITM requirements for legacy pairing bluez.test.bot
  0 siblings, 1 reply; 7+ messages in thread
From: Oleh Konko @ 2026-03-31 11:52 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
  Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
	linux-kernel@vger.kernel.org

smp_cmd_pairing_req() currently builds the pairing response from the
initiator auth_req before enforcing the local BT_SECURITY_HIGH
requirement. If the initiator omits SMP_AUTH_MITM, the response can
also omit it even though the local side still requires MITM.

tk_request() then sees an auth value without SMP_AUTH_MITM and may
select JUST_CFM, making method selection inconsistent with the pairing
policy the responder already enforces.

When the local side requires HIGH security, first verify that MITM can
be achieved from the IO capabilities and then force SMP_AUTH_MITM in the
response before build_pairing_cmd(). This keeps the responder auth bits
and later method selection aligned.

Fixes: 2b64d153a0cc ("Bluetooth: Add MITM mechanism to LE-SMP")
Cc: stable@vger.kernel.org
Suggested-by: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Signed-off-by: Oleh Konko <security@1seal.org>
---
 net/bluetooth/smp.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index e67bf7b34ea..4eaadbe0d2f 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1809,6 +1809,19 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
 		return 0;
 	}
 
+	/* If we need MITM check that it can be achieved. */
+	if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) {
+		u8 method;
+
+		method = get_auth_method(smp, conn->hcon->io_capability,
+					 req->io_capability);
+		if (method == JUST_WORKS || method == JUST_CFM)
+			return SMP_AUTH_REQUIREMENTS;
+
+		/* Force MITM bit if it isn't set by the initiator. */
+		auth |= SMP_AUTH_MITM;
+	}
+
 	build_pairing_cmd(conn, req, &rsp, auth);
 
 	if (rsp.auth_req & SMP_AUTH_SC) {
@@ -1826,16 +1839,6 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
 	if (sec_level > conn->hcon->pending_sec_level)
 		conn->hcon->pending_sec_level = sec_level;
 
-	/* If we need MITM check that it can be achieved */
-	if (conn->hcon->pending_sec_level >= BT_SECURITY_HIGH) {
-		u8 method;
-
-		method = get_auth_method(smp, conn->hcon->io_capability,
-					 req->io_capability);
-		if (method == JUST_WORKS || method == JUST_CFM)
-			return SMP_AUTH_REQUIREMENTS;
-	}
-
 	key_size = min(req->max_key_size, rsp.max_key_size);
 	if (check_enc_key_size(conn, key_size))
 		return SMP_ENC_KEY_SIZE;
-- 
2.50.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-31 13:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 15:33 [PATCH v3 0/2] Bluetooth: SMP: honor local MITM requirements for legacy pairing Oleh Konko
2026-03-30 15:33 ` [PATCH v3 2/2] Bluetooth: SMP: derive legacy responder STK authentication from MITM state Oleh Konko
2026-03-30 15:33 ` [PATCH v3 1/2] Bluetooth: SMP: honor local HIGH security when selecting legacy pairing method Oleh Konko
2026-03-30 16:25   ` Bluetooth: SMP: honor local MITM requirements for legacy pairing bluez.test.bot
2026-03-30 16:27   ` [PATCH v3 1/2] Bluetooth: SMP: honor local HIGH security when selecting legacy pairing method Luiz Augusto von Dentz
2026-03-30 19:36   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2026-03-31 11:52 [PATCH v4 1/2] Bluetooth: SMP: force responder MITM requirements before building the pairing response Oleh Konko
2026-03-31 13:25 ` Bluetooth: SMP: honor local MITM requirements for legacy pairing bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox