Posted
by
CowboyNeal
on Saturday August 12, 2006 @09:18AM
from the setting-the-record-straight dept.

njyoder writes "As previously posted about, Joanna Rutkowska claimed to have discovered an allegedly undetectable vulnerability in Vista that takes advantage of AMD cpu's virtualization capabilities. a virtualization professional (Anthony Liguori of the Xen project) has now voiced his opinion to state this is bunkum.
There are two parts two this — the ability to take over the machine and seamlessly drop the OS into a VM (which is very difficult, but possible) and the ability to have windows run in the VM undetectably (which is impossible). In fact, Rutkowska's prototype is VERY detectable.
This is unfortunate mistake that people make when they jump to conclusions based on what is unfounded speculation and that includes the assumption that this would somehow be Vista specific, if it worked (noting that Vista doesn't run with administrator privileges by default)."

I think the problem is not whether or not it can be detected by a professional, or a malware detection program, but whether or not it can be detected by the user of the computer. If you can run the entire OS in a VM, without the user knowing, then there's a lot of stuff you can do that would probably be a lot harder to do if you were just running regular malware. Although it's reassuring that this wasn't as bad as we expected, I still expect to see a few exploits that use this method to install malware, and spy on what the user is doing.

You know there are programs to evade those particular programs from the kernel. And they are pretty good at that. Now a VM outside your OS might be detectable (nothing installed on your computer isn't), but it may be harder than to run that latest "vista-running-inside-vm-detector-by-microsoft" thingie. But hey! maybe I'm wrong and rootkits are still the way to go:)

When people talk about Blue Pill as being "undetectable" they mean "through the use of a program."

And that's Joanna's point. Properly constructed, Blue Pill 2 (the successor with full emulation support coded in--she herself admitted that her prototype is imperfect) would be undetectable by software running inside the VM. She discusses the possibility of a timing attack using an external clock, but also notes that this is infeasible in a large deployment. Certainly it would be infeasible for your average person running a computer (evidence by the fact that some of them don't even run antivirus/antimalware programs at all and get horribly infected!)

I was at Joanna's Black Hat briefing. Not once did she imply that this was Vista specific--in fact, she mentioned another briefing with the same sort of rootkit--only running on a MacBook. Her briefing was entitled "Subverting the Vista Kernel for Fun and Profit" because the first half of her talk was about elevating privileges in Vista, which would allow a rootkit such as Blue Pill to run.

I think that the danger here lies somewhere between "The end is very fucking nigh" and "This is absolutely nothing to worry about." Yes, it's extremely hard to implement. But that shouldn't mean we don't worry about it, because one implementation and it will be much easier to reverse engineer/modify to do other nasty things. Also, the eventual inability to detect in software means that if such an attack ever comes to pass, it will be extremely difficult to clean en masse (virtually requiring a reinstall or a livecd).

I'm curious if this will not give rise to a new breed of network bootups. This breed would be initiated from a BIOS that only allows itself to be flashed with very visible and bright red user confirmation off a non-bootable physically attached disk (such as CD or floppy). This BIOS will only boot off the network, and what it boots would be anti-VM software which confirms the local boot process of your machine, then once determined to be clean, transfers control back to the local machine. The BIOS would h

Right. As has been said, "undetectable" means "from within the VM itself". You're also talking about prevention, which is equally important. TPM could also prevent virtualization-based exploits, already exists in a fairly convenient form, is more robust (doesn't require an external server which could be down or bogged down), and fits in fairly well with corporate culture.

When people talk about Blue Pill as being "undetectable" they mean "through the use of a program."And that's Joanna's point. Properly constructed, Blue Pill 2 (the successor with full emulation support coded in--she herself admitted that her prototype is imperfect) would be undetectable by software running inside the VM.

This is the fundamental problem I have. So she has a crappy prototype but claims that the next version will be undetectable? Where's the paper? What is she exploiting to make this actuall

The paper was presented at Black Hat. She explained what is required in order to fully "emulate" the instructions required to make it undetectable. Essentially, Blue Pill would need a shim that passes virtualization instructions back up the chain until they could be executed for real, then return everything back down. It's not as huge as everyone thinks, but it's not trivial, either. But yes, she's outlined what has to be done.

I bet you can find a PDF of her slides somewhere online, if you're interested.

You're talking about two different types of VMs. #1 applies to software VM (like VMWare) and #2 applies to hardware virtualization.

That said, I don't recall making claim #1 at all, so I don't know what you're talking about or why you bring it up. Even if a virus could detect that it was running in a VM, unless it could escape the VM, it still would be contained.

I am a VMware consultant and work with virtualization every day. There are two reasons why I don't believe that this is much of a threat.

Virtualization presents static virtual hardware - whatever virtualization method that they utilize would present the same hardware to every vrtual machine (unless they coded it with a huge library of different virtual devices, which involves recoding the drivers for each device). From the device manager, you could check to see if the hardware in your system matches the

The problem is that you're thinking of software virtualization rather than hardware virtualization (as in the Core Duo chips and AMD's newer chips). Both of your cases outlined above are dealt with using the instruction sets in these chips.1) The hardware is the same unless the hypervisor changes what the software sees. All the hardware in the device manager will look just like it did pre-virtualization. This was demonstrated at Black Hat.

I agree and disagree.Yes, I believe that Blue Pill is perfectly possible. (The fact that a functioning prototype exists aside.) The suggested objections are trivial. However, they have nothing to do with hardware virtualization vs software virtualization. Hardware virtualization makes the process much easier, but it doesn't enable it.

The difference is in function of the package. A virtualization product like VMWare presents a virtual machine to the user. As that is what the GP is used to, I can unders

I wasn't aware that a software virtualizer could pass all instructions directly on to the hardware such as the video card. Nevertheless, I don't know of any that do it, and thus even if my statements aren't accurate from a technical standpoint, they appear to be accurate from a pragmatic standpoint.Is it possible (in software) to replace the OS with a virtualized one, passing all but privileged instructions to the hardware, and trap certain key instructions to be handled by your virtualizer, all while the

With traditional packages like VMWare, virtualization is like creating an empty box and filling it with the guest OS. However, the actual virtualization isn't the filling, it is just the box, and it is entirely possible to build a box around a running OS. It just doesn't make sense for typical applications, because to build a box around an OS, you need an OS to host the virtualization. (The Blue Pill code serves as both the virtualization and the host OS.)The only gotcha is that the computer has constrai

So would the best solution is to try to run 3d FPS games to see if they work?

Well, this is Vista. In theory, most PCs should be able to run some of the 3D effects (maybe not all of them). So you should notice a lack of the 3D effects all of a sudden, and a huge slowdown as Windows is no longer relying on the video card for desktop drawing.

Well, that's mostly not because of virtualization, but because of coexistence with the host OS. In this case, there is no host, just a hypervisor hacking specific calls. Any call to the graphics hardware could be let through, if desired. The performance hit would be acceptable for the non-inquisitive user.

This is hardware virtualization we're talking about, not software. The processor manufacturers have built virtualization calls into their chipsets. The side-effect of this is that the hypervisor can simply tell the bios "I'm the hypervisor...but, only call me when these specific requests are made." So, the hypervisor could simply choose to ignore the sound and video hardware, leaving those as fast as they were before.

The only way to tell the hypervisor is there is to find a CPU call that the hypervisor *does* care about, and compare how long it takes to run that command before & after the rootkit pushes the OS to a guest OS. That's what the Xen guy is talking about.

(I was at Rutkowska's talk...I'm not sure I buy the Xen guy's response.)

It was quite an amazing talk, wasn't it?She admitted that timing attacks were her weakness, as did the other guy who talked about virtualization-based rootkits. The problem is that you have to have a benchmark to compare it to, and you have to assume that the hypervisor doesn't modify the time whenever it is called. If the time does get modified, then the only way we know of to detect the rootkit is to measure clock skew on the infected PC using a real time source. This, of course, assumes that there isn

She admitted that timing attacks were her weakness, as did the other guy who talked about virtualization-based rootkits. The problem is that you have to have a benchmark to compare it to, and you have to assume that the hypervisor doesn't modify the time whenever it is called.

The difference is order of magnitudes. Hypervisor exits incur penalties on the order of thousands of cycles. If you don't know the specifics of the system you're on, you can always compare the cost relative to a similiar instruction.

If I understand your method correctly, it still requires the use of an external clock. If that's the case, there's still no programmatic way to do it, you're still relying on external sources, which is something your average end-user is unlikely to do.

If I understand your method correctly, it still requires the use of an external clock. If that's the case, there's still no programmatic way to do it, you're still relying on external sources, which is something your average end-user is unlikely to do.

We're talking about anti-virus software here--not the average end-user. Anti-virus software just has to use NTP (or invent it's own time-keeping protocol) to check external time. There is of course a skew when checking time over the internet so you just make

An excellent idea, however if AV companies start doing this, what will BluePill++ start doing? Blocking NTP? Blocking whatever ports the AV software uses to chec the external time? Is the AV software's inability to function necessarily indicative of BluePill, or could there be something else wrong?This is a whole new battlefield, and while (as I've said before) I don't think this is the doomsday exploit that some people are claiming it is, I think it's something to be taken seriously if you're concerned a

Blocking NTP would be an obvious sign that something is wrong. Modifying NTP packets would be clever, but as I said in an earlier reply you can simply use a companion program on the timing computer to "invent" your own protocol that Blue Pill could never know and could never modify.

(I was at the Black Hat talk also.)I agree that comparing the run times of instructions that will be trapped to those that won't is the way to go. I also agree that using an external time source would work well. I work with phototiming for a living, and have an external device with a 1PPM (part per million) clock in it. I can ask for the time over the network on any port using any arbitrary format that Blue Pill could not possibly know about. In that situation I know that the time I'm getting is reliable. (

Not just the TSC. Remember that you can't rely on any PC devices (like the PIT or the ACPI timer, or the RTC), since the HV could trap all I/O accesses to these and provide emulated versions, which from your POV will seem fine.

Now obviously you can glance at your watch at see if some operation takes longer...

The side-effect of this is that the hypervisor can simply tell the bios "I'm the hypervisor...but, only call me when these specific requests are made."

VT/SVM have absolutely nothing to do with the BIOS. Instead, they both introduce a new processor mode that can be entered at any point that allow certain operations to be trapped. These operations are more or less the set of classic x86-sensitive instructions.

So, the hypervisor could simply choose to ignore the sound and video hardware, leaving those as fast as they were before.

Yup. But we're not talking about hardware here. Keep in mind, that if you do allow direct access to hardware, one now has a channel to access all of memory which could be used to detect a virus in RAM. Let's ignore that for now though:-)

The only way to tell the hypervisor is there is to find a CPU call that the hypervisor *does* care about, and compare how long it takes to run that command before & after the rootkit pushes the OS to a guest OS.

Yup, and as I pointed out to Joanna, there are a number of CPU operations that one would *have* to trap. Things like %cr3 moves, msr reads/writes, etc. Otherwise, one can just search memory for a signature. BTW, how does she hide the memory of the VMM from the guest? I didn't address this because there are some potential solutions (like memory hotplug) but this, in practice, would be a very hard problem to solve. You can just take away memory from an Operating System and expect things to function normally.

Why do you think she addressed this in her talk? I brought it up to her before she presented...

Anyway, you have to take a trap at some point. There are only a small number of possible instructions that trap. A very thorough "detector" could simply check the timing of every trapable instruction.

If she's not trapping any instructions, then the monitor is never getting run so is it really a monitor anymore?

BTW, on VT at least, the VMM doesn't get a choice for certain instructions. They always trap no matter what.

Feel free to correct me if I've mis-understood, but your position seems to be that while it may be prohibitively hard to detect the a trojan hypervisor, it's still technically possible. Joanna presented as if BluePill were undetectable, you're contesting that it's detectable, just hard.

From a practical point of view, there's little difference between those two positions. In fact, if it's so hard that no one will do it, there's operationally zero differ

Uh, just make sure you own the "topmost" hypervisor in the first place, then you put vista or whatever in it.The blue pill can continue running vista within itself, but it's not going to be able to put the first hypervisor in it;).

Go figure.

Any time you suspect something fishy is going on, you could pause the entire thing using the "top most" hypervisor and scan.

IMO it's high level malware that will be harder.

Example: whether the following actually executes malicious code or not is dependent on what the se

Ummm...the whole problem here is that a running OS can be moved to a guest OS. You can't "own the topmost hypervisor", because anything can still be moved to a guest OS even if it started at the "top." The whole question here isn't whether you can be moved down (you can), but whether you can detect that it's happened.

I don't think that's true. Once you become the first hypervisor nobody can unseat you. You provide a simulation for other hypervisors that might come along, so they also think they are the first hypervisor. They are, in fact, "below" you and you have complete control of them.

Feel free to correct me if I've mis-understood, but your position seems to be that while it may be prohibitively hard to detect the a trojan hypervisor, it's still technically possible. Joanna presented as if BluePill were undetectable, you're contesting that it's detectable, just hard.

No, not really. I'm saying that in all circumstances, it's detectable. I'm claiming that even with all the engineers in the world working on this thing, it's still detectable (although it may be hard).

Its nice that you were are Rutkowksa's talk, but try actaully reading the SVM/VT docs, so you don't sound like an incompetent goof.
"The side-effect of this is that the hypervisor can simply tell the bios " - wtf? What BIOS? What the hell are you talking about?

I don't, the size of the app alone to get the OS into a VM would take days to download on most people's "broadband". Knowing most mom and pops the computer would be turned off long before it could finish.

Though there is a littlee war the authors neglect to mention. If I am writing a blue pill virus vm, and I KNOW there is software out there that is trying to detect me, it's completely worthless. Since I own the machine at that point, I can modify the programs running, with impunity. That's like all the viruses that are out there right now that are more or less immune to Norton... they know what the "threat" is, and they plan accordingly, they know its weaknesses and simply sidestep right around it.

A vm that sees you load BluePillDetect.exe just goes in and twiddles a few bits here and there in the app before it actually puts it in the execute queue, or subtly mucks with its registers while it's executing. Now the program blissfully reports just what the VM wants it to report... "no VM detected.".

Now how are you going to get around THAT? If you are running on a totally owned system, you cannot tell me there is anything you can do that is guaranteed to work, especiially if you are using a commonly available tool that the vm author had access to..

You simply cannot win at their game if they are the ones writing the rules. You can claim victory for a day or two, until the VM authors get their hands on your tool and make the necessary modifications to their VM to cripple your tool, and then you are back to the drawing board.

A vm that sees you load BluePillDetect.exe just goes in and twiddles a few bits here and there in the app before it actually puts it in the execute queue, or subtly mucks with its registers while it's executing. Now the program blissfully reports just what the VM wants it to report... "no VM detected.".

Yes, but writing code from the VM to reach inside OS-specific structures (or even read their contents) is difficult and fragile -- you need to find structures with known memory locations and find a way to fol

If you're expanding out of an encrypted archive into an encrypted partition (think TrueCrypt or Norton's equivalent tools), no, it's never going to touch disk in raw form. Decrypting from memory makes more sense, though, in terms of not requiring an additional 3rd-party tool to be involved.

You can claim victory for a day or two, until the VM authors get their hands on your tool and make the necessary modifications to their VM to cripple your tool, and then you are back to the drawing board.

:%s/VM/virus/g

and you've just described the state of the art in virus scanning as it's been since more-or-less forever.

A vm that sees you load BluePillDetect.exe just goes in and twiddles a few bits here and there in the app

There exists an infinite number of bit patterns performing the task of BluePillDetect.exe. 99.99999% of them will be unrecognized by the malware. If the user can install one of them, or even type one in, then the malware is not "100% undetectable." So the claim has been debunked.

Unfortunately, it will most likely be exploited. Amazing how intangible effort is quite so easily mis-used; at least in the good ol' days, you keep the kids out with either a harsh word or a baseball bat.:)

Yes, and it's the whole point of this supposed exploit. Rutkowska runs AMD's "Pacifica" instructions in Ring -1 that wrap around your usual OS kernel in Ring 0.

Which, by the way, brings up a THIRD faulty assumption from the demo: this tactic is absolutely NOT AMD-specific. Intel's "Vanderpool" offers a slightly different ISA but ends up at an equivalent Ring -1, with the same theoretical risks and rewards.

This really has nothing to do with Vista. The premise of the "exploit" is that some piece of malware obtains enough access to the machine to effectively install it's own OS shim which acts as a virtual machine host, or VMM, or hypervisor, which then launches the original natively-executing OS as a guest OS. The shim would be able to perform nefarious acts with full access to the memory and execution of the guest OS while being effectively undetected by the guest OS, since it's not technically running in t

While i agree it would really really damned hard to do it, you could create a VM that the host os wont reconize as being a VM. Sure, it would have to accomodate for each new PC out there as hardware changes, and that it would be a massively complex beast that more then likely could never be turned into a worm/virus/trojan that you wouldnt see coming a mile away, but it could be done.

Never say impossible when logic says it could be done. Just say impractical..

I think that it would be impossible to provably show that a complete Blue Pill implementation is on your system from within that system. The idea being, it might be possible to detect anomalies by using software on the infected VM. It would be impossible to definitively say "You are infected with Blue Pill." The most it could do is say, "I found X, Y, and Z timing/instruction anomalies which lead me to believe that I am running in a VM. User, am I running in a VM to the best of your knowledge?" This is

If mosquito and similar tools are not moving towards VMMs, I'd be very suprised. After all, it is a logical step (From VM as a payload, to a VMM as a payload).

Of course, VMM's can be used to do all sorts of nasty things. VMM-level virus could certainly be nasty. And, an important point to note, is that it may be entirely possible for a virus to be hidden in a VMM and for a virtual machine not to be able to detect that virus. Will VMM's need anti-virus software? I hope they don't suck that much.

What "blue pill" is though is something much different. It's claim is that you can take a native Operating System and turn it into a virtual machine without the OS knowing about it.

Very few will buy Vista to reinstall over XP. Most will just get it with a new PC. And if they DO reinstall, most will probably completely blow away the drive, and do a full install instead of an upgrade install.

You mean everyone except just about every engineering desktop in America, right? Installing all the S/W required for non-admin types is an IT killer. Even if they don't fuck up the installs, it takes them forever to prep each new machine. Hell, we figure one to two weeks of end-user downtime into every machine upgrade.

At least with Beta 2 Vista did run with admin privledges, just as all previous versions of Windows. But you have that box that pops up when ever you use those privledges. MS has done a good PR campaign to make people think it doesn't, but install beta 2 for yourself, the user created in setup is an admin just like in XP. I sincerely hope that this is changed with RC1.

Five minutes on Google would have told you that this is how UAC is supposed to work. "Administrator" accounts are still limited by UAC, but instead of requiring a separate "root" account, UAC allows elevation using your existing credentials.

The first account created during setup is an Administrator, all the rest are limited users. The default 'Administrator' account is disabled -- in Beta 2, you could boot into safemode and log in to the account, in RC1 it will be disabled except in the recovery console. What's cool, IMHO, is that even logged in as Administrator all your apps run with limited privileges by default, and IE runs with even less privileges. Since Beta 2 they've made tons of progress removing unecessary prompts, and even preventing

The exploit is the first of its kind for Vista. Give this a few years and add the high motivation of criminals who make millions by exploiting PCs and you can be sure we'll eventually see some quite nasty stuff.

I'm thinking any subversive VM thing would be like an uber-rootkit. When infected, the user's ntldr or winload.exe (for Vista) would be overwritten to load our new OS instead of Windows. On the next boot (which could come early by the delivery system resetting the computer), the new OS would load which would be little more than a very thin VM wrapper around windows. It would immediately boot up windows, and the user would be none the wiser. Basic things it would do (that would classify it as a rootkit)

With Open source there's no problem. I can hear about a thing, test it, look at code, and decide whether it's an issue to me. Or if it's outside of my abilities, That wonderful peer review process can do the job for me. People who are being paid to say good things soon fall silent or get drowned out in the face of proof to the contrary from many sources who are not being paid, but do it out of interest.

With closed source code of any type I have no such option. Instead all I get is 'experts' to tell me. But these guys have to eat, so they get paid by someone, and have a vested interest in being paid tomorrow. Therefore there can be no impartial advice.

Heck, if the cheif engineer on the shuttle program can be convinced to retract his refusal to sign off the shuttle because of O-ring problems, what hope is there for trustworthy answer from anyone regarding closed source software?

Ok, possibly I'm being too extreme with my example, but seriously I worry about the *true* safety of using an operating system which has not, in fact, been designed with consumers in mind. It is, by microsofts own cheerful admission, purposely built to help 'rights holders' of stuff you use keep you from deviating from their precious business plan.Perhaps this is fair enough, but there should be a trade off. I see no evidence that the rights of the OS purchaser are being properly considered. Even XP assumes you are a pirate unless proven otherwise. That reveals a lot about their views of the lowly home consumer.

His complaint is not about a technical matter. Openness may have a very limited (or no) effect on whether or not a compromise is possible. But it does have an effect on whether or not the threat is analysed and whether or not you can trust that analysis.

It's really a question of integrity and loyalty. It may be strange to talk about an inanimate object (software) having "loyalty" but it's the best analogy I can come up with. Free software gives its ultimate loyalty and allegiance to the user. You can

(I never believed that story, and my opinion is that Ken was pulling peoples' legs. But it's nevertheless a valid point about a theoretical weakness in toolchains, so..) That is a potential weakness that would be equally likely in both free and proprietary software. Free software is still much more open to unbiased analysis.

AL: If a virus cannot be removed or detected, it's pretty much a worse case scenario for corporate security. Once there was an outbreak, you couldn't trust any of your systems at all. I'm not sure how one could even mitigate such a threat--perhaps do frequent reinstalls of every system on your network?

I'm still just amazed that people don't do this anyway. My understanding is that today's approach to AV is that people run AV applications on possibly infected systems,

Booting from read-only media and cleaning a compromised machine works well for *nix systems, but there isn't a usable live CD malware removal tool for Windows. Unmodified Windows won't run from read-only media, the lack of a complete, free, legal NTFS driver and automated tools for removing Windows-specific malware makes Linux live DC distros impractical, and the pain of dealing with BartPE makes that a non-starter for all but the most technically adept admins. Until you can pop a disc in the drive, rebo

The lack of proper AV tools doesn't make the users any less doomed. Malware isn't interested in excuses.

If Windows installations cannot be properly diagnosed and repaired, then it either needs to be made bulletproof so that compromises are impossible, or else it just isn't ready for use on The Internet.

I predict this "Internet" fad is going to take off, and by 1994 we're going to see more Internet users than ever before. Microsoft better start thinking about addressing this, or else MacOS 7.5, OS/2 War

Am I the only person that thought this posting was going to be about Viagra? Must just be the email I've been getting lately.

Going offtopic, the spam I've been getting recently has taken the curious (and some might say disturbing) turn of offering not Viagra-like products, but things that can reputedly increase, er, raw throughput. Quite why anyone would want to make any more mess than necessary is beyond me (unless they're trying to appeal to the subconscious male intent to sire as many offspring as possi

May be he should attend the presentation before making such bold statements as well. I attended her presentation in person, amd she addressed all the issues he claims are able to detect the virtualization.

There was a instruction to reboot the Pentium regardless of CPL? The only instruction I'd remember like that is "lock cmpxchg8b eax" (or any other normal register). That instruction caused the CPU to lock up due to an incorrect implementation of the "invalid opcode" exception. This was called the "f00f bug" because its bytes were F0 0F C7 C8.