Commit 7498ffbd authored by Joakim Andersson's avatar Joakim Andersson Committed by Anas Nashif
Browse files

Bluetooth: SMP: Add option to disallow unauthenticated re-pairing

Disallows all unauthenticated pairing attempts made by the
peer where an unauthenticated bond already exists.
This would enable cases where an attacker could copy the peer device
address to connect and start an unauthenticated pairing procedure
to replace the existing bond. Now in order to create a new bond the old
bond has to be explicitly deleted with bt_unpair.

Added option to disable this rule in order to maintain backwards
compatibility in case this behavior is accepted.

Signed-off-by: default avatarJoakim Andersson <joakim.andersson@nordicsemi.no>
parent 2ae9e277
Loading
Loading
Loading
Loading
+11 −0
Changes for subsys/bluetooth/host/Kconfig: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -300,6 +300,17 @@ config BT_SMP_SC_ONLY
	  Security Mode 1 Level 4 stands for authenticated LE Secure Connections
	  pairing with encryption. Enabling this option disables legacy pairing.

config BT_SMP_ALLOW_UNAUTH_OVERWRITE
	bool "Allow unauthenticated pairing for paired device"
	help
	  This option allows all unauthenticated pairing attempts made by the
	  peer where an unauthenticated bond already exists.
	  This would enable cases where an attacker could copy the peer device
	  address to connect and start an unauthenticated pairing procedure
	  to replace the existing bond. When this option is disabled in order
	  to create a new bond the old bond has to be explicitly deleted with
	  bt_unpair.

config BT_FIXED_PASSKEY
	bool "Use a fixed passkey for pairing"
	help
+6 −0
Changes for subsys/bluetooth/host/smp.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -581,6 +581,12 @@ bool update_keys_check(struct bt_smp *smp)
		return false;
	}

	if (!IS_ENABLED(CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE) &&
	    (!(conn->le.keys->flags & BT_KEYS_AUTHENTICATED)
	     && smp->method == JUST_WORKS)) {
		return false;
	}

	return true;
}