From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Ken Goldman <kgoldman-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC] tpm2-space: add handling for global session exhaustion
Date: Mon, 30 Jan 2017 14:13:08 -0800 [thread overview]
Message-ID: <1485814388.2518.28.camel@HansenPartnership.com> (raw)
In-Reply-To: <20170130215815.4lr42ob7e4cycwgi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On Mon, 2017-01-30 at 23:58 +0200, Jarkko Sakkinen wrote:
> On Mon, Jan 30, 2017 at 08:04:55AM -0800, James Bottomley wrote:
> > On Sun, 2017-01-29 at 19:52 -0500, Ken Goldman wrote:
> > > On 1/27/2017 5:04 PM, James Bottomley wrote:
> > >
> > > > > Beware the nasty corner case:
> > > > >
> > > > > - Application asks for a session and gets 02000000
> > > > >
> > > > > - Time elapses and 02000000 gets forcibly flushed
> > > > >
> > > > > - Later, app comes back, asks for a second session and again
> > > > > gets
> > > > > 02000000.
> > > > >
> > > > > - App gets very confused.
> > > > >
> > > > > May it be better to close the connection completely, which
> > > > > the
> > > > > application can detect, than flush a session and give this
> > > > > corner
> > > > > case?
> > > >
> > > > if I look at the code I've written, I don't know what the
> > > > session
> > > > number is, I just save sessionHandle in a variable for later
> > > > use
> > > > (lets say to v1). If I got the same session number returned at
> > > > a
> > > > later time and placed it in v2, all I'd notice is that an
> > > > authorization using v1 would fail. I'm not averse to killing
> > > > the
> > > > entire connection but, assuming you have fallback, it might be
> > > > kinder simply to ensure that the operations with the reclaimed
> > > > session fail (which is what the code currently does).
> > >
> > > My worry is that this session failure cannot be detected by the
> > > application. An HMAC failure could cause the app to tell a user
> > > that
> > > they entered the wrong password. Misleading. On the TPM, it
> > > could
> > > trigger the dictionary attack lockout. For a PIN index, it could
> > > consume a failure count. Killing a policy session that has e.g.,
> > > a
> > > policy signed term could cause the application to go back to some
> > > external entity for another authorization signature.
> > >
> > > Let's go up to the stack. What's the attack?
> > >
> > > If we're worried about many simultaneous applications (wouldn't
> > > that
> > > be wonderful), why not just let startauthsession fail? The
> > > application can just retry periodically.
> >
> > How in that scenario do we ensure that a session becomes available?
> > Once that's established, there's no real difference between
> > retrying
> > the startauthsession in the kernel when we know the session is
> > available and forcing userspace to do the retry except that the
> > former
> > has a far greater chance of success (and it's only about 6 lines of
> > code).
> >
> > > Just allocate them in triples so there's no deadlock.
> >
> > Is this the application or the kernel? If it's the kernel, that
> > adds a
> > lot of complexity.
> >
> > > If we're worried about a DoS attack, killing a session just helps
> > > the
> > > attacker. The attacker can create a few connections and spin on
> > > startauthsession, locking everyone out anyway.
> >
> > There are two considerations here: firstly we'd need to introduce a
> > mechanism to "kill" the connection. Probably we'd simply error
> > every
> > command on the space until it was closed. The second is which
> > scenario
> > is more reasonable: Say the application simply forgot to flush the
> > session and will never use it again. Simply reclaiming the session
> > would produce no effect at all on the application in this scenario.
> > However, I have no data to say what's likely.
> >
> > > ~~
> > >
> > > Also, let's remember that this is a rare application. Sessions
> > > are
> > > only needed for remote access (requiring encryption, HMAC or
> > > salt),
> > > or policy sessions.
> >
> > This depends what your threat model is. For ssh keys, you worry
> > that
> > someone might be watching, so you use HMAC authority even for a
> > local
> > TPM. In the cloud, you don't quite know where the TPM is, so again
> > you'd use HMAC sessions ... however, in both use cases the sessions
> > should be very short lived.
> >
> > > ~~
> > >
> > > Should the code also reserve a session for the kernel? Mark it
> > > not
> > > kill'able?
> >
> > At the moment, the kernel doesn't use sessions, so let's worry
> > about
> > that problem at the point it arises (if it ever arises).
> >
> > James
>
> It does. My trusted keys implementation actually uses sessions.
But as I read the code, I can't find where the kernel creates a
session. It looks like the session and hmac are passed in as option
arguments, aren't they?
> I'm kind dilating to an opinion that we would leave this commit out
> from the first kernel release that will contain the resource manager
> with similar rationale as Jason gave me for whitelisting: get the
> basic stuff in and once it is used with some workloads whitelisting
> and exhaustion will take eventually the right form.
>
> How would you feel about this?
As long as we get patch 1/2 then applications using sessions will
actually work with spaces, so taking more time with 2/2 is fine by me.
James
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
WARNING: multiple messages have this Message-ID (diff)
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: tpmdd-devel@lists.sourceforge.net,
linux-security-module@vger.kernel.org,
Ken Goldman <kgoldman@us.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [RFC] tpm2-space: add handling for global session exhaustion
Date: Mon, 30 Jan 2017 14:13:08 -0800 [thread overview]
Message-ID: <1485814388.2518.28.camel@HansenPartnership.com> (raw)
In-Reply-To: <20170130215815.4lr42ob7e4cycwgi@intel.com>
On Mon, 2017-01-30 at 23:58 +0200, Jarkko Sakkinen wrote:
> On Mon, Jan 30, 2017 at 08:04:55AM -0800, James Bottomley wrote:
> > On Sun, 2017-01-29 at 19:52 -0500, Ken Goldman wrote:
> > > On 1/27/2017 5:04 PM, James Bottomley wrote:
> > >
> > > > > Beware the nasty corner case:
> > > > >
> > > > > - Application asks for a session and gets 02000000
> > > > >
> > > > > - Time elapses and 02000000 gets forcibly flushed
> > > > >
> > > > > - Later, app comes back, asks for a second session and again
> > > > > gets
> > > > > 02000000.
> > > > >
> > > > > - App gets very confused.
> > > > >
> > > > > May it be better to close the connection completely, which
> > > > > the
> > > > > application can detect, than flush a session and give this
> > > > > corner
> > > > > case?
> > > >
> > > > if I look at the code I've written, I don't know what the
> > > > session
> > > > number is, I just save sessionHandle in a variable for later
> > > > use
> > > > (lets say to v1). If I got the same session number returned at
> > > > a
> > > > later time and placed it in v2, all I'd notice is that an
> > > > authorization using v1 would fail. I'm not averse to killing
> > > > the
> > > > entire connection but, assuming you have fallback, it might be
> > > > kinder simply to ensure that the operations with the reclaimed
> > > > session fail (which is what the code currently does).
> > >
> > > My worry is that this session failure cannot be detected by the
> > > application. An HMAC failure could cause the app to tell a user
> > > that
> > > they entered the wrong password. Misleading. On the TPM, it
> > > could
> > > trigger the dictionary attack lockout. For a PIN index, it could
> > > consume a failure count. Killing a policy session that has e.g.,
> > > a
> > > policy signed term could cause the application to go back to some
> > > external entity for another authorization signature.
> > >
> > > Let's go up to the stack. What's the attack?
> > >
> > > If we're worried about many simultaneous applications (wouldn't
> > > that
> > > be wonderful), why not just let startauthsession fail? The
> > > application can just retry periodically.
> >
> > How in that scenario do we ensure that a session becomes available?
> > Once that's established, there's no real difference between
> > retrying
> > the startauthsession in the kernel when we know the session is
> > available and forcing userspace to do the retry except that the
> > former
> > has a far greater chance of success (and it's only about 6 lines of
> > code).
> >
> > > Just allocate them in triples so there's no deadlock.
> >
> > Is this the application or the kernel? If it's the kernel, that
> > adds a
> > lot of complexity.
> >
> > > If we're worried about a DoS attack, killing a session just helps
> > > the
> > > attacker. The attacker can create a few connections and spin on
> > > startauthsession, locking everyone out anyway.
> >
> > There are two considerations here: firstly we'd need to introduce a
> > mechanism to "kill" the connection. Probably we'd simply error
> > every
> > command on the space until it was closed. The second is which
> > scenario
> > is more reasonable: Say the application simply forgot to flush the
> > session and will never use it again. Simply reclaiming the session
> > would produce no effect at all on the application in this scenario.
> > However, I have no data to say what's likely.
> >
> > > ~~
> > >
> > > Also, let's remember that this is a rare application. Sessions
> > > are
> > > only needed for remote access (requiring encryption, HMAC or
> > > salt),
> > > or policy sessions.
> >
> > This depends what your threat model is. For ssh keys, you worry
> > that
> > someone might be watching, so you use HMAC authority even for a
> > local
> > TPM. In the cloud, you don't quite know where the TPM is, so again
> > you'd use HMAC sessions ... however, in both use cases the sessions
> > should be very short lived.
> >
> > > ~~
> > >
> > > Should the code also reserve a session for the kernel? Mark it
> > > not
> > > kill'able?
> >
> > At the moment, the kernel doesn't use sessions, so let's worry
> > about
> > that problem at the point it arises (if it ever arises).
> >
> > James
>
> It does. My trusted keys implementation actually uses sessions.
But as I read the code, I can't find where the kernel creates a
session. It looks like the session and hmac are passed in as option
arguments, aren't they?
> I'm kind dilating to an opinion that we would leave this commit out
> from the first kernel release that will contain the resource manager
> with similar rationale as Jason gave me for whitelisting: get the
> basic stuff in and once it is used with some workloads whitelisting
> and exhaustion will take eventually the right form.
>
> How would you feel about this?
As long as we get patch 1/2 then applications using sessions will
actually work with spaces, so taking more time with 2/2 is fine by me.
James
next prev parent reply other threads:[~2017-01-30 22:13 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 20:48 [RFC] tpm2-space: add handling for global session exhaustion James Bottomley
2017-01-18 20:48 ` James Bottomley
[not found] ` <1484772489.2396.2.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-01-19 12:25 ` Jarkko Sakkinen
2017-01-19 12:25 ` [tpmdd-devel] " Jarkko Sakkinen
[not found] ` <20170119122533.d7h5rgatpwl3qmcl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-01-19 12:41 ` Jarkko Sakkinen
2017-01-19 12:41 ` [tpmdd-devel] " Jarkko Sakkinen
[not found] ` <20170119124101.nw7a7m735zhiivfo-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-01-27 21:20 ` Ken Goldman
2017-01-27 21:59 ` James Bottomley
2017-01-27 21:59 ` [tpmdd-devel] " James Bottomley
2017-01-19 12:59 ` James Bottomley
2017-01-19 12:59 ` [tpmdd-devel] " James Bottomley
2017-01-20 13:40 ` Jarkko Sakkinen
2017-01-27 21:42 ` Ken Goldman
2017-01-27 22:04 ` James Bottomley
2017-01-27 22:04 ` [tpmdd-devel] " James Bottomley
[not found] ` <1485554699.3229.20.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-01-27 23:35 ` Jason Gunthorpe
2017-01-27 23:35 ` [tpmdd-devel] " Jason Gunthorpe
[not found] ` <20170127233513.GA28995-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-27 23:48 ` James Bottomley
2017-01-27 23:48 ` [tpmdd-devel] " James Bottomley
2017-01-30 0:52 ` Ken Goldman
2017-01-30 0:52 ` Ken Goldman
2017-01-30 16:04 ` James Bottomley
2017-01-30 16:04 ` [tpmdd-devel] " James Bottomley
[not found] ` <1485792295.2518.23.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-01-30 21:58 ` Jarkko Sakkinen
2017-01-30 21:58 ` [tpmdd-devel] " Jarkko Sakkinen
[not found] ` <20170130215815.4lr42ob7e4cycwgi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-01-30 22:13 ` James Bottomley [this message]
2017-01-30 22:13 ` James Bottomley
[not found] ` <1485814388.2518.28.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-01-30 22:46 ` Ken Goldman
2017-01-31 13:31 ` Jarkko Sakkinen
2017-01-31 13:31 ` [tpmdd-devel] " Jarkko Sakkinen
2017-02-10 17:22 ` Kenneth Goldman
2017-01-31 19:28 ` Ken Goldman
2017-01-31 19:55 ` James Bottomley
2017-01-31 19:55 ` [tpmdd-devel] " James Bottomley
[not found] <jarkko.sakkinen@linux.intel.com>
2017-02-09 9:06 ` Dr. Greg Wettstein
[not found] ` <201702090906.v1996c6a015552-DHO+NtfOqB5PEDpkEIzg7wC/G2K4zDHf@public.gmane.org>
2017-02-09 15:19 ` Jarkko Sakkinen
[not found] ` <20170209151922.cqo32h4io5dqyvvw-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-09 19:04 ` Jason Gunthorpe
[not found] ` <20170209190426.GA1104-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-09 19:29 ` James Bottomley
[not found] ` <1486668591.2616.45.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-02-09 21:54 ` Jason Gunthorpe
2017-02-10 8:48 ` [tpmdd-devel] " Jarkko Sakkinen
[not found] ` <20170210084837.lq3mofgfwvjx623m-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-02-10 23:13 ` Kenneth Goldman
2017-02-09 20:05 ` James Bottomley
[not found] <James.Bottomley@HansenPartnership.com>
2017-02-10 10:03 ` Dr. Greg Wettstein
[not found] ` <201702101003.v1AA3plF029882-DHO+NtfOqB5PEDpkEIzg7wC/G2K4zDHf@public.gmane.org>
2017-02-10 16:46 ` James Bottomley
[not found] ` <1486745163.2502.26.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-02-10 21:13 ` Kenneth Goldman
2017-02-14 14:38 ` [tpmdd-devel] " Dr. Greg Wettstein
[not found] ` <20170214143829.GA28175-DHO+NtfOqB5PEDpkEIzg7wC/G2K4zDHf@public.gmane.org>
2017-02-14 16:47 ` James Bottomley
2017-02-10 21:18 ` Kenneth Goldman
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=1485814388.2518.28.camel@HansenPartnership.com \
--to=james.bottomley-d9phhud1jfjcxq6kfmz53/egyhegw8jk@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=kgoldman-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.