From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Watson Subject: Re: Security enhancement proposal for kernel TLS Date: Wed, 25 Jul 2018 08:59:46 -0700 Message-ID: <20180725155946.GA37315@davejwatson-mba.local> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: "netdev@vger.kernel.org" , Peter Doliwa , Boris Pismenny To: Vakul Garg Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:55604 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728564AbeGYRMU (ORCPT ); Wed, 25 Jul 2018 13:12:20 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: You would probably get more responses if you cc the relevant people. Comments inline On 07/22/18 12:49 PM, Vakul Garg wrote: > The kernel based TLS record layer allows the user space world to use a decoupled TLS implementation. > The applications need not be linked with TLS stack. > The TLS handshake can be done by a TLS daemon on the behalf of applications. > > Presently, as soon as the handshake process derives keys, it pushes the negotiated keys to kernel TLS . > Thereafter the applications can directly read and write data on their TCP socket (without having to use SSL apis). > > With the current kernel TLS implementation, there is a security problem. > Since the kernel TLS socket does not have information about the state of handshake, > it allows applications to be able to receive data from the peer TLS endpoint even when the handshake verification has not been completed by the SSL daemon. > It is a security problem if applications can receive data if verification of the handshake transcript is not completed (done with processing tls FINISHED message). > > My proposal: > - Kernel TLS should maintain state of handshake (verified or unverified). > In un-verified state, data records should not be allowed pass through to the applications. > > - Add a new control interface using which that the user space SSL stack can tell the TLS socket that handshake has been verified and DATA records can flow. > In 'unverified' state, only control records should be allowed to pass and reception DATA record should be pause the receive side record decryption. It's not entirely clear how your TLS handshake daemon works - Why is it necessary to set the keys in the kernel tls socket before the handshake is completed? Or, why do you need to hand off the fd to the client program before the handshake is completed? Waiting until after handshake solves both of these issues. I'm not aware of any tls libraries that send data before the finished message, is there any reason you need to support this? > > - The handshake state should fallback to 'unverified' in case a control record is seen again by kernel TLS (e.g. in case of renegotiation, post handshake client auth etc). Currently kernel tls sockets return an error unless you explicitly handle the control record for exactly this reason. If you want an external daemon to handle control messages after handshake, there definitely might be some synchronization that would make sense to push in the kernel. However, with TLS 1.3 removing renegotiation (and currently reneg is not implemented in kernel tls anyway), there's much less reason to do so.