<<< Date Index >>>     <<< Thread Index >>>

NetBSD Security Advisory 2005-001: Crypto leaks across HyperThreaded CPUs (i386, P4, HTT+SMP only)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


                 NetBSD Security Advisory 2005-001
                 =================================

Topic:          Crypto leaks across HyperThreaded CPUs (i386, P4, HTT+SMP only)

Version:        NetBSD-current: affected, i386 on P4 with HTT and SMP kernels
                NetBSD 2.0:     affected, i386 on P4 with HTT and SMP kernels
                NetBSD 1.6 and earlier: not affected, i386 SMP was not in these 
releases

Severity:       Possible exposure of cryptographic key information to local 
users

Fixed:          Best Practices are under discussion. See below.


Abstract
========

The Pentium CPU shares caches between HyperThreads. This permits a local
process to gain a side-channel against cryptographic processes running
on the other HyperThread. Testing for cached data can be accomplished by
timing reads. Under some circumstances, this permits the spying process
to extract bits of the key. This has been demonstrated against OpenSSL.


Technical Details
=================

The full explanation of the issue can be found here:

http://www.daemonology.net/papers/htt.pdf


This issue affects only a subset of i386 systems. 

Your system is not affected if you are running a CPU without HyperThreading.

Your system is not affected if you are running a non-SMP kernel.

Your system is not affected if you have disabled HyperThreading in your
BIOS, and confirmed that the virtual CPUs are not detected by the kernel
during boot.

Your system is affected, but probably not at risk, if you do not permit
shell access by untrusted users.


Additional resources:

http://www.daemonology.net/hyperthreading-considered-harmful/
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:09.htt.asc


Solutions and Workarounds
=========================

This issue is fundamental to the design and implementation of
HyperThreading in Intel processors. Avoiding the problem is possible,
and two workarounds are available now. Others which may appear later are
also discussed.

Option 1. Disable HyperThreading in the BIOS.

        Disabling HyperThreading is a complete workaround for the issue.

Option 2. Run a non-SMP kernel.

        On single physical CPU systems, running a non-SMP kernel
        effectively disables HyperThreading. On a multi-CPU system, this
        option is not the best solution, since it will disable
        additional physical CPUs as well.


Later potential workarounds:

1. Reimplement all cryptographic code to use constant time, and constant
cache-access execution patterns. There is some interest along these
lines from various groups, as a result of this issue.  NetBSD's Security
Officers will monitor the availability of such code.

2. Implement some form of locking which prevents the sibling
HyperThread from running while cryptographic or other sensitive code is
active on a processor.

Additionally, FreeBSD has chosen to offer a tunable bootloader option to
disable spinup of HyperThread Virtual CPUs, without requiring a change
to BIOS settings. The NetBSD Security Officer has not seen a demand from
the NetBSD community for a similar workaround, but would discuss the
possibility in the appropriate forums, if asked to.


Thanks To
=========

Colin Percival

Jacques A. Vidrine


Revision History
================

        2005-06-30      Initial release


More Information
================

Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at 
  ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2005-001.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/.


Copyright 2005, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

$NetBSD: NetBSD-SA2005-001.txt,v 1.3 2005/06/22 05:44:50 wiz Exp $

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (NetBSD)

iQCVAwUBQsQHlj5Ru2/4N2IFAQI6egQAoUSxClcXFCSwtO1e5DFRu+QhKVR3cczl
TBh4i7nGYKiZqJiV5N1EnfGMFgwRgR1pvaVpt+0f7/BaibqYd0LOE4QOJx2usIuZ
vjxcP3IT8MUXpi3jDnzsamst1hIc14i35nquGGKmBV1L71qBqv6bDp5QWj2U5XUw
pnsE1AJBPeY=
=JklU
-----END PGP SIGNATURE-----