FreeBSD: Hyper-Threading Vulnerability

Submitted by Jeremy
on May 12, 2005 - 8:02pm

Colin Percival, a FreeBSD committer and security team member, has found a local exploit against the current implementation of Intel's Hyper-Threading Technology. "Hyper-Threading, as currently implemented on Intel Pentium Extreme Edition, Pentium 4, Mobile Pentium 4, and Xeon processors, suffers from a serious security flaw," Colin explains. "This flaw permits local information disclosure, including allowing an unprivileged user to steal an RSA private key being used on the same machine. Administrators of multi-user systems are strongly advised to take action to disable Hyper-Threading immediately."

Colin will present the details behind the attack at BSDCan 2005 at 10:00 AM EDT on May 13'th. "At the conclusion of my talk I will also be releasing a paper describing the attack and possible mitigation strategies," Colin explains. The flaw affects all operating systems, and for a secure multi-user environment essentially requires that Hyper-Threading be disabled. More information can be found on Colin's web page on the topic. The formentioned paper can be downloaded here in pdf format.


Hyper-Threading allows multi-threaded applications to execute threads in parallel on a single CPU. Intel's website explains, "Hyper-Threading Technology enables this thread-level parallelism (TLP) by duplicating the architectural state on each processor, while sharing one set of processor execution resources. When scheduling threads, the operating system treats the two distinct architectural states as separate 'logical' processors. This allows multiprocessor capable software to run unmodified on twice as many logical processors."

From the BSDCan website, "Colin Percival is 23 years old and lives in Vancouver, Canada. He received his B.Sc. in Mathematics from Simon Fraser University at age 19, and is currently awaiting his D.Phil. in Computer Science from Oxford University." More recently Colin was elected to the Senate of Simon Fraser University.

Oh my god! This is big :(

Anonymous (not verified)
on
May 12, 2005 - 9:09pm

Oh my god! This is big :(

Although I wouldnt lose sleep

sanman (not verified)
on
May 13, 2005 - 12:01am

Although I wouldnt lose sleep over this but any further infomation about this would be really appreciated.

Thanks

San

You think

The real Anonymous coward (not verified)
on
May 18, 2005 - 6:30pm

You need local access ( the comms tasks and interrupt code will fluch the cache) and a system that runs very few threads and few interrupts ( the other tasks and interrupts will flush the cashe).

It sure is no reason to add code or hardware that will slow down the execution of real world loads.

I won't lose any sleep over it...yet

Wiseguy (not verified)
on
May 12, 2005 - 10:40pm

HT is a technology that has its supporters and its share of detractors. Until I see a published proof of the alleged security problem I won't be losing any sleep, disabling HT in my multi-processor machines, or worrying about the security of my crypto-keys.

I'm actually more worried about the rumors floating around regarding shortcuts for factoring large numbers and attacking public key crypto-systems by computing the private exponent component of keys.

PowerPC pawaaaa! :oD More po

sky (not verified)
on
May 13, 2005 - 5:32am

PowerPC pawaaaa! :oD
More power, less trouble :o)

AMD pawaa

Anonymous (not verified)
on
May 13, 2005 - 8:57am

Waaaaaay more power, less trouble.

Microcode

on
May 13, 2005 - 6:44am

Finally I have a reason to try out the Microcode feature in the Linux kernel...

Oh, this seems interesting. I

Anonymous (not verified)
on
May 13, 2005 - 8:38am

Oh, this seems interesting. I didn't know you could do that with production CPUs. Can you edit all instructions or just a few of them? And do you know of any editors for microcode?

Re: Oh, this seems interesting. I

on
May 13, 2005 - 9:05am

You can't edit any instructions with it. It exists solely for uploading microcode published by Intel.

I'm actually more worried

on
December 13, 2008 - 12:45pm

I'm actually more worried about the rumors floating around regarding shortcuts for factoring large numbers and attacking public key crypto-systems by computing the private exponent component of keys.
security monitoring

Linux?

Anonymous (not verified)
on
May 13, 2005 - 7:30am

Any suggestions about the inpact on Linux Kernels?

I'd imagine the same in Linux

Anonymous (not verified)
on
May 13, 2005 - 9:02am

I'd imagine the same in Linux.

Relevant answers here.

on
May 13, 2005 - 2:34pm

Relevant answers here.

Any information on other OSes affected?

Anonymous (not verified)
on
May 13, 2005 - 11:33am

Any information on other OSes affected? What about the precious NT kernel?

Did you even read this? Read

Anonymous (not verified)
on
May 13, 2005 - 12:25pm

Did you even read this?
Read. Comprehend. Post.

"The flaw affects all operating systems..."

OpenBSD do not support HT technology

Anonymous (not verified)
on
May 15, 2005 - 8:40am

All Operating system with HT technology, OpenBSD do not support it :-(

AFAIK it does not need specif

Nico57 (not verified)
on
May 15, 2005 - 6:37pm

AFAIK it does not need specific support.
Running an HT processor as a SMP processor set gets you exposed.

But,

Merlin (not verified)
on
May 18, 2005 - 9:39am

2.6 linux kernels contain special option to improve workability on HT processors. Thus, can this alleviate the problem?

A few weeks ago, there was a

Anonymous Peon (not verified)
on
May 13, 2005 - 12:21pm

A few weeks ago, there was a flurry of press relating to AMD's use of the 'Hyperthreading bit.' My assumption has been that this is acting in the fashion of either a 'License OK' or 'Enable something resembling SMP despite licensing' flag, riding on the existing 'goodwill' towards HyperThreading to ensure that, say, XP Home users can make use of the cores without an upgrade.

Can someone confirm whether this is correct, and that AMD has not actually implemented a vulnerable form of SMT on these chips?

(If a dual-core package reports dual CPUIDs, and each reports 2 logical CPUs despite a lack of SMT, this seems rather confusing, and suggests some minor annoyance when it comes to detection of vulnerable vs. non-vulnerable 'implementations.')

From what i'm seeing on that,

Anonymous (not verified)
on
May 13, 2005 - 12:28pm

From what i'm seeing on that, it looks like AMD has just turned on the Hyperthreading bit to take advantage of code written to use Hyperthreading, as a dual-core proc can emulate that quite nicely. It shouldn't be vulnerable to any Hyperthreading exploits, however, as it is NOT Hyperthreading, just SMP.

Eww.

Anonymous (not verified)
on
May 13, 2005 - 5:57pm

That's awful. That will cause software to inappropriately use HT optimizations when they're not needed on dual core chips.

You misunderstand

Anonymous (not verified)
on
May 13, 2005 - 9:53pm

Software "optimized" for HT usually use multiple threads if they find the HT bit set, and use a single thread if not. If the bit is not set in the DC AMD64, the software will only use a single thread and the extra core will go to waste. So AMD set the bit so the program in question will use multiple threads which will run on both cores in the DC AMD64. It's as simple as that.

Not necessarily

Anonymous (not verified)
on
May 13, 2005 - 9:53pm

I agree that using "HT" mode on a true SMP processor wouldn't be that optimal.

However, I'd suggest that any OS that supports HT also supports true SMP, and therefore is ulikely to be purely relying on the HT flag to determine whether or not to optimise for HT style multi-processing verses true SMP.

If the OS in question does purely rely on the HT flag, or rather, chooses not to take full advantage of the SMP hardware (and I'd suspect Windows XP might fall into this catagory), then at least having your SMP processor being used as a HT processor would be better than the other alternative, namely, having the OS consider that the CPU can only execute a single thread. Specifically in the case of the new AMD dual CPUs, I'd think that would mean that only one of the CPU cores on the chip would be used, which is a 100% waste verses the few percent that would be lost when running true SMP in HT mode.

Why not just use GetSystemInf

Anonymous (not verified)
on
May 15, 2005 - 7:11pm

Why not just use GetSystemInfo?

SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
DWORD numprocs = sysInfo.dwNumberOfProcessors;

Portable. Accurate. Reliable.

wow. is it...

Anonymous (not verified)
on
May 16, 2005 - 1:08pm

PORTABLE???!

Portable among all recent Win

on
May 18, 2005 - 4:39pm

Portable among all recent Win32 systems, I'm guessing...

Exploit requires shared cache

on
May 13, 2005 - 8:34pm

The exploit described in the paper requires a shared data cache. Both the dual core processor designs from AMD and Intel have each core having 2 separate caches.

So, this flaw basically only affects machine with HyperThreading. Dual core processors are immune.

Not quite

Anonymous (not verified)
on
May 13, 2005 - 9:57pm

The current "dual-core" from Intel is really just two separate CPUs wired together in the same package, so they have separate caches. Intel's REAL dual-core CPU is another year off and SHARES the data cache between the two cores. They practically crow about the fact that both cores get to see the whole cache compared to AMD's dual-core.

So while Intel's current offering is okay, their real dual-core chip will be vulnerable. Hopefully, by the time they actually ship it, they will have taken care of this issue.

What about other processors

Aurelien (not verified)
on
May 14, 2005 - 1:27pm

After reading the article of Colin Percival, it seems that this flaw only concerns the platforms equiped with the Hyper Threading (so far Intel only ?) My question is, in the section of workarround and recommendations, the author suggests to turn off the HT mechanism, but can we not immagine a similar attack on other platforms ?
I'm thinking of ARM processors with Trust Zone technology and the third level privilege dedicated for the security...

Why would an ARM processor be

pinniped (not verified)
on
May 24, 2005 - 10:14pm

Why would an ARM processor be vulnerable? When did ARM (I presume you mean XScale now) get hyperthreading? :P

You always have to be careful with the less-capable CPUs - some of them don't have the hardware to enforce priviledges (user/kernel modes) and some don't have a virtual memory system -- for those processors, no data is secure. Just think about the original 8086 and the 80286 - with some effort you could implement a multiprocess OS but you will have absolutely no data security because the CPUs were lacking the basic hardware support.

ARM has MMU; TrustZone is a "secure" code area

on
May 25, 2005 - 1:19am

The interesting vulnerability with ARM is if a similar trick lets you break the TrustZone security. Currently, the most likely uses of TrustZone are DRM implementations, which will use TrustZone to keep the DRM algorithm and keys secret. If it could be cracked, the keys and algorithm are exposed.

ARM TDMI series have no MMU,

Miliardo (not verified)
on
June 17, 2005 - 12:09pm

ARM TDMI series have no MMU, But ARM***T and Strong ARM have.

HT mistake

on
May 13, 2005 - 8:12pm

I need more information about this~~~

where I more datail information?

Somebody know this please reply comment~~~

RTFA....

Anonymous (not verified)
on
May 14, 2005 - 1:10am

There's a link on the article to the research paper regarding this issue...Please rtfa... (f = fine :-) )

Does Intel reply on it?

Plaintext (not verified)
on
May 14, 2005 - 1:59am

Does anybody know what Intel said about this issue?

Other vulnerabilities?

Anthony (not verified)
on
May 14, 2005 - 3:27am

After reading the paper it seems to me that there may be other vulnerabilities. I can certainly understand the author wanting to make a really strong case for a really bad vulnerability in order to kick everyone into gear ASAP, rather than spewing FUD about all sorts of other things... but if this algorithm allows a malicious process to see when another process is accessing memory, I imagine plenty of other algorithms are vulnerable.

For example, hash tables don't generally use a cryptographic hash function because there's no point. But this might (might) allow a malicious process to watch a hash table insert. You would probably be able to tell if there was a collision, for example. You might then combine this with an attack where you can choose the key to be inserted (perhaps you can cause a string to be inserted into a Python dictionary for example), and then observe which keys cause collisions. That would probably be easier than gathering hundreds of bits from a key.

These attacks would be very tricky to pull off, but a) we don't know that this is the first time this has been discovered and b) we don't have a good understanding of what kinds of programs are vulnerable.

IMO it is only prudent to disable hyperthreading for the time being, or maybe only allow threads belonging to the same process to run together.

The paper is available at her

anon2 (not verified)
on
May 14, 2005 - 12:58pm

The paper is available at here. Basically the claimed exploit is to starve the OpenSSH process of accesses to cache lines to get information of what cache lines get used. However, the paper makes a lot of assumptions which if exist can be exploited in other ways. One assumption made is that you can accurately measure the time taken when the other thread is executing specific sections of code. The author does not mention that there is a way to do this.
The section of code published uses the "rdtsc" instruction to measure time. The Intel Architecture spec clearly states that RDTSC is a non serializing instruction. This means that the time stamp returned can be a speculative one - one from before the cache access completed. Even if a serializing instruction were used before this; there is no specific way to ensure that this thread which is competing for the same resources with the OpenSSH process ensures that it gets them in a particular order. For example the 'long integer multiplication' instructions that the author refers needs to compete for the same ALU as that used by the OpenSSH algorithm. There is no suggestion in the paper that would indicate that the process can get this deterministically. If this were possible - there can be other exploits possible as well such as seeing how long do arithmetic operations take - and trying to determine what the other thread did during this time.

AMD64 - Rulezzz :) Intel - S

Anonymous (not verified)
on
May 14, 2005 - 6:31am

AMD64 - Rulezzz :)
Intel - Suxxx

Really! Even AMD32 =) If

XWider (not verified)
on
May 14, 2005 - 3:28pm

Really!
Even AMD32 =)

If it's true, Intel gets royal pain-in-the-ass... %)

AMD forever

no_one (not verified)
on
May 30, 2005 - 8:05am

AMD forever

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.