linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Seyfried <stefan.seyfried@googlemail.com>
To: Pavel Machek <pavel@ucw.cz>,
	kernel list <linux-kernel@vger.kernel.org>,
	security@kernel.org, linux-bluetooth@vger.kernel.org,
	johan.hedberg@gmail.com, marcel@holtmann.org
Subject: Re: (Small) bias in generation of random passkeys for pairing
Date: Thu, 20 Jun 2019 14:00:38 +0200	[thread overview]
Message-ID: <66098773-4d88-ebdb-02d5-8af0cc4ea99c@message-id.googlemail.com> (raw)
In-Reply-To: <20190619162456.GA9096@amd>

Hi Pavel,

Am 19.06.19 um 18:24 schrieb Pavel Machek:
> Hi!
> 
> There's a (small) bias in passkey generation in bluetooth:
> 
>                 get_random_bytes(&passkey, sizeof(passkey));
>  		passkey %= 1000000;
> 		put_unaligned_le32(passkey, smp->tk);
> 
> (there are at least two places doing this).
> 
> All passkeys are not of same probability, passkey "000000" is more
> probable than "999999", but difference is small.

It is slightly different IMHO.

Unsigned 32bits passkey assumed (and all users I found were u32),
the passkeys "000000" to "967295" are slightly more probable than
"967296" to "999999".

If my math is right (which I doubt), the difference in probability
for both entities is 4294:4293.

> Do we care?

I, personally, don't (yet).
But then, I'm not a real security expert.

Have fun,
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
 public relations, for nature cannot be fooled." -- Richard Feynman

      reply	other threads:[~2019-06-20 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 16:24 (Small) bias in generation of random passkeys for pairing Pavel Machek
2019-06-20 12:00 ` Stefan Seyfried [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66098773-4d88-ebdb-02d5-8af0cc4ea99c@message-id.googlemail.com \
    --to=stefan.seyfried@googlemail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pavel@ucw.cz \
    --cc=security@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).