Re: [TLS] TLS and hardware security modules - some issues related to PKCS11

Michael StJohns <> Tue, 24 September 2013 18:52 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id E2FCF11E8160 for <>; Tue, 24 Sep 2013 11:52:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -3.424
X-Spam-Status: No, score=-3.424 tagged_above=-999 required=5 tests=[AWL=-0.140, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1, SARE_MILLIONSOF=0.315]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 3z6u1Ud8cRrw for <>; Tue, 24 Sep 2013 11:52:51 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id CD27B11E8158 for <>; Tue, 24 Sep 2013 11:52:50 -0700 (PDT)
Received: by with SMTP id n9so3359508qcw.5 for <>; Tue, 24 Sep 2013 11:52:50 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=hb92/HngNotZSgZFnFIYbCMvYyGAwAfz80/TrNh8NtA=; b=AMTEl6EDKZyOXkO6fPPfnELYjtzWEagJ8SGRTuP7BNYUt0iMRd2qN2eW+Rrh7xzTEA cjVnIIM1vbvbZf/fgNJ2O4rQU09LxnSaS1MuihXV60yOfNwACtzYo8juAQKv0YXdLocH viR/JnkclCg4K8aYaPDwf0fwGDSJRyhZJG1dQkca200JAMr7vOgaAnhYb/3c0+HMZtU7 jqQ3lYV0168y7D7GIxndJmV4kY/lCS7wvDijLCSf71m3TUiDErsCnx74xY+PFL5nqdsc feKuVxEEj5hXW1Wh0AZPAZu9V1tTxwGcefrOP6TWcjO4xzt9W9V6HhIl6A24kn1H2/kx w0mA==
X-Gm-Message-State: ALoCoQnxsMWfYoB7RMJ2FOleQui0xkzWu41jLN7d8vF3Te9IS4FnzMHIHKb8fIr3GTNuAccq6HLz
X-Received: by with SMTP id a16mr8268600qag.89.1380048770069; Tue, 24 Sep 2013 11:52:50 -0700 (PDT)
Received: from [] ( []) by with ESMTPSA id x8sm2745317qam.2.1969. (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Sep 2013 11:52:49 -0700 (PDT)
Message-ID: <>
Date: Tue, 24 Sep 2013 14:52:50 -0400
From: Michael StJohns <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: Nico Williams <>
References: <> <> <> <> <>
In-Reply-To: <>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: "" <>
Subject: Re: [TLS] TLS and hardware security modules - some issues related to PKCS11
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 24 Sep 2013 18:52:57 -0000

On 9/23/2013 7:00 PM, Nico Williams wrote:
> On Mon, Sep 23, 2013 at 04:47:44PM -0400, Michael StJohns wrote:
>> On 9/23/2013 4:00 PM, Nico Williams wrote:
>>> On Tue, Sep 17, 2013 at 10:45 AM, Michael StJohns
>>> <> wrote:
>>> But evidently you must care about the application plaintext.  Why not
>>> move the application into the HSM as well then?
>>> That deserves a tongue-in-cheek smiley, of course :^)
>> There are SSL/TLS accelerators that move a whole bunch more of the
>> crypto stuff inside the HSM, but PKCS11 is designed to be useful for
>> more than just TLS.
> That's not responsive though.  The fundamental question is: why should
> anyone treat session keys as more valuable than the plaintext they are
> used to protect?

1) Smuggling out the keys is easier than smuggling out the whole plaintext.
    a) Consider a web site running TLS, it extracts the session keys and 
posts them as a stego picture on the self same website (e.g. the photo 
of the company headquarters?).
2) We generally assume (for design purposes) that ciphertext may be 
captured without detection.
3) Attacker gathers picture and ciphertext together, extracts the keys 
and then extracts the plain text.

I generally assume that targets of value (e.g. banks, etc) have decent 
self-monitoring capabilities both at the network and system level.  That 
tends to suggest that less is more when it comes to exporting data from 
an attack.

> I think there is an acceptable answer, namely: where the TLS (or
> whatever) channel carries some data that is not trusted and where you
> want privilege separation, and where you really just don't trust the
> hardware furnishing the plaintext.  But you kinda have to say that
> that's what you're after, and then consider other issues that come up as
> a result.  For example, you might actually need a significant part of
> your application to live in the HSM.

Its not that I don't trust the "hardware" furnishing the plaintext, I 
don't trust any general purpose computer system to be immune from 
hacking attacks (and I'm of the firm belief that any one that does is 
delusional).  I would like to use HSM policy and security guarantees to 
reduce the impact of those attacks.  For TLS, this may ultimately come 
down to doing everything inside a HSM purpose built for TLS, but that's 
not the problem I'm trying to solve.

  I'm trying to get the policy controls of PKCS11 to do the correct 
things with derived keys (general problem, not just TLS).  The current 
TLS KDF math has holes in it that are inconsistent with this goal (e.g. 
any policy control absent doing all of the TLS negotiations inside the 
secure perimeter of an HSM [NOT a PKCS11 possibility] may be trivially 
defeated due to the way the key expansion step is defined).  I'd like to 
revise that math in a fairly straightforward way to close those holes 
and make it possible to apply appropriate policy controls.


>> Consider a specific field of use - 10s of Millions of smart grid
>> capable electric power meters.  Consider that I have a back office
>> system that talks to each and every one of them securely.  Consider
>> that I'm worried about insider threats with respect to reading and
>> controlling (e.g. remote disconnection of the meters) these devices.
>> Consider that I never ever ever want a control key to be present
>> outside of an HSM in plaintext form.  Consider that some smart grid
>> technologies are using TLS as the sole credential layer for
>> controlling substantial amounts of power.
> I've considered these things.  See above.
>> TLS should be designed so this is possible.  I believe it currently
>> has a limitation that makes this goal difficult or impossible to
>> achieve.
> Or you could design a better HSM.  Why isn't that an answer?  PKCS#11
> may not be the hammer that you're looking for.
> Nico