2020-02-12 15:38:24

by Johan Hedberg

[permalink] [raw]
Subject: Re: [Bluez PATCH v3] bluetooth: secure bluetooth stack from bluedump attack

Hi Marcel,

On 12. Feb 2020, at 17.19, Marcel Holtmann <[email protected]> wrote:
>> + key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
>> + hcon->role);
>> +
>> + /* If there already exists link key in local host, leave the
>> + * decision to user space since the remote device could be
>> + * legitimate or malicious.
>> + */
>> + if (smp->method == JUST_WORKS && key) {
>> + err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
>> + hcon->type,
>> + hcon->dst_type, passkey,
>> + 1);
>> + if (err)
>> + return SMP_UNSPECIFIED;
>> + set_bit(SMP_FLAG_WAIT_USER, &smp->flags);
>> + }
>> }
>
> while this looks good, I like to optimize this to only look up the LTK when needed.
>
> /* comment here */
> if (smp->method != JUST_WORKS)
> goto mackey_and_ltk;
>
>
> /* and command here */
> if (hci_find_ltk()) {
> mgmt_user_confirm_request()
> ..
> }
>
> And my preference that we also get an Ack from Johan or Luiz that double checked that this is fine.

Acked-by: Johan Hedberg <[email protected]>

Johan


2020-02-12 21:30:21

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [Bluez PATCH v3] bluetooth: secure bluetooth stack from bluedump attack

Hi Howard,

On Wed, Feb 12, 2020 at 7:39 AM Johan Hedberg <[email protected]> wrote:
>
> Hi Marcel,
>
> On 12. Feb 2020, at 17.19, Marcel Holtmann <[email protected]> wrote:
> >> + key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
> >> + hcon->role);
> >> +
> >> + /* If there already exists link key in local host, leave the
> >> + * decision to user space since the remote device could be
> >> + * legitimate or malicious.
> >> + */
> >> + if (smp->method == JUST_WORKS && key) {
> >> + err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
> >> + hcon->type,
> >> + hcon->dst_type, passkey,
> >> + 1);
> >> + if (err)
> >> + return SMP_UNSPECIFIED;
> >> + set_bit(SMP_FLAG_WAIT_USER, &smp->flags);
> >> + }
> >> }
> >
> > while this looks good, I like to optimize this to only look up the LTK when needed.

I wonder why we don't just call user confirm everytime? That way the
new policy preference applies to both a new pair or when already
paired, and we don't have to really do the key lookup here since the
userspace can do the check if really needed.

> >
> > /* comment here */
> > if (smp->method != JUST_WORKS)
> > goto mackey_and_ltk;
> >
> >
> > /* and command here */
> > if (hci_find_ltk()) {
> > mgmt_user_confirm_request()
> > ..
> > }
> >
> > And my preference that we also get an Ack from Johan or Luiz that double checked that this is fine.
>
> Acked-by: Johan Hedberg <[email protected]>
>
> Johan



--
Luiz Augusto von Dentz