Thursday, October 19, 2006

Vista RC2 vs. pagefile attack (and some thoughts about Patch Guard)

Eventually, after I got back home from some traveling, I had a chance to download Vista RC2 x64 and test it against cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile attack...

It quickly turned out that our exploit doesn’t work anymore! The reason: Vista RC2 now blocks write-access to raw disk sectors for user mode applications, even if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y are executed with elevated administrative rights.

In my Subverting Vista Kernel speech, which I gave at several major conferences over cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 past few months, I discussed three possible solutions to mitigate cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile attack. Just to remind you, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 solutions mentioned were cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following:
1. Block raw disk access from usermode.
2. Encrypt pagefile (alternatively, use hashing to ensure cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 integrity of paged out pages, as it was suggested by Elad Efrat from NetBSD).
3. Disable kernel mode paging (sacrificing probably around 80MB of memory in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 worst case).

And I also made a clear statement that solution #1 is actually something which is a bad idea. I explained that if MS decided to disable write-access to raw disk sectors from usermode, not only that might cause some incompatibility problems (think about all those disk editors, un-deleters, etc…), but also that would not be a real solution to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem…

Imagine a company wanting to release e.g. a disk editor. Now, with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 blocked write access to raw disk sectors from usermode, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 company would have to provide cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir own custom, but 100% legal, kernel driver for allowing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir, again 100% legal, application (disk editor), to access those disk sectors, right? Of course, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk editor's auxiliary driver would have to be signed – after all it’s a legal driver, designed for legal purposes and ideally having neicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r implementation nor design bugs! But, on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r hand, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is nothing which could stop an attacker from “borrowing” such a signed driver and using it to perform cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile attack. The point here is, again, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is no bug in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver, so cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is no reason for revoking a signature of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver. Even if we discovered that such driver is actually used by some people to conduct cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 attack!

But it seems that MS actually decided to ignore those suggestions and implemented cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 easiest solution, ignoring cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fact that it really doesn’t solve cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem…

Actually, if we weren't such nice guys, we could develop a disk editor togecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r with a raw-disk-access kernel driver, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n sign it and post it on COSEINC's website. But we're cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 good guys, so I guess somebody else will have to do that instead ;)

Kernel Protection vs. Kernel Patch Protection (Patch Guard)


Anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r thing - lots of people confuse kernel protection (i.e. cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 policy for allowing only digitally signed kernel drivers to be loaded) with Kernel Patch Protection, also known as Patch Guard.

In short, pagefile attack, which I demoed at SyScan/BackHat is a way to load unsigned code into kernel, thus it’s a way to bypass Vista kernel protection. Bypassing kernel patch protection (Patch Guard) is a different story. E.g. Blue Pill, a piece of malware which abuses AMD Pacifica hardware virtualization, which I also demoed during my talk, “bypasses” PG. The word “bypass” is a little bit misleading here though, as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 BP does not make any special effort to disable or bypass PG explicitly, it simply doesn’t care about PG, because it’s located above (or below, depending on where your eyes are located) cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 whole operating system, including PG. Yes, it’s that simple :)

Also, almost any malware of type II (see my BH Federal talk for details about this malware classification) is capable of “bypassing” PG, simply because PG is not designed to detect changes introduced by type II malware. So, e.g. deepdoor, backdoor which I demonstrated in January at BH Federal, is undetectable by PG. Again, not a big deal – it’s just that PG was not designed to detect type II malware (nor type III, like BP). So, I'm a little bit surprised to hear people talking about "how hard would it be to bypass PG...", as that is something which has been done already (and I'm not referring to Metasploit's explicit technique here) - you just need to design your malware as type II or type III and your done!

But even that all being said, I still think that PG is actually a very good idea. PG should not be thought as of a direct security feature. PG's main task is to keep legal programs from acting like popular rootkits. Keeping malware away is not it's main task. However, by ensuring that legal applications do not introduce rootkit-like tricks, PG makes it easier and more effective to create robust malware detection tools.

I spent a few years developing various rootkit detection tools and one of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 biggest problems I came across was how to distinguish between a hooking introduced by a real malware and... a hooking introduced by some A/V products like personal firewalls and Host IDS/IPS programs. Many of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 well known A/V products do use exactly cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same hooking techniques as some popular malware, like rootkits! This is not good, not only because it may have potential impact on system stability, but, and this is cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 most important thing IMO, it confuses malware detection tools.

Patch Guard, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 technology introduced in 64 bit versions of Windows XP and 2003 (yes, PG is not a new thing in Vista!) is a radical, but probably cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 only one, way to force software vendors to not use undocumented hooking in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir products. Needles to say, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r, documented ways to implement e.g. a personal firewall or an A/V monitor, without using those undocumented hooking techniques.

Just my 2 cents to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 ongoing battle for Vista kernel...

33 comments:

90210 said...

Needles to say, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r, documented ways to implement e.g. a personal firewall or an A/V monitor, without using those undocumented hooking techniques.

Well, it's always easier to bypass something 100%-documented. Also, it means that all firewalls/AVs will use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same interfaces, and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir "hooking" engines will be identical.

Joanna Rutkowska said...

I disagree. After all, if you e.g. consider a file system filter, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are still many ways of how you’re A/V can determine whecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file in question (cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 one which triggered file system hook) is “good” or “bad” – this is where cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 A/V can actually show off. If you consider e.g. a personal firewall, even though cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y all will be using e.g. an extra officially registered NDIS protocol or NDIS filter, still cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re might differentiate among cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365mselves e.g. by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 ability to detect and stop different covert channels.

Many people would argue cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n, that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 deeper cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 hook is, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 better “tamper-proof” protection it offers – that’s a myth! Hey Alex, weren’t you cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 one, who was claiming that once a malware is in kernel it can bypass *any* type of personal firewall, no matter how deep cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 hooking is located – for those who missed that should see Alex’s BH presentation about bypassing PFWs. The truth is – once malware gets into kernel, no matter what tricks cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 AV/HIDS/HIPS/PFW uses, it will always lose. Unless we moved our security products into ring -1, but cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r problems connected with this and this is a totally different story.

So, in my opinion, it’s not worth to agree for all this “hooking mess” in kernel for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sake of false sense of better security…

Anonymous said...

If someone wants to create a driver which offers raw disk access to user mode applications, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver has to be signed by Microsoft, as you sayd. I haven't ever used raw disk access, so I only have a simple question: Would it be posible to block from within that driver those IOCTLs which require raw access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile? If so, can't Microsoft refuse signing those drivers which don't implement some protection mechanism against this kind of attacks? May be this is a stupid question because as I sayd I haven't ever used raw disk access and I don't know how you did to find cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile whithin hard drive using raw disk access (dwelling through sectors and so).

viraptor said...

Hello. It seems you take for granted, that disabling raw write access was cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 only change made. Are you sure about this?
Reading cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 article, I understood, that you didn't try to bypass it with "official" driver.
Could it be possible, that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y disabled it and additionally check for page hash value? Write disable seems redundant now, but maybe cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y just wanted to prevent errors, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y don't know how to recover from - writing anything to driver's area in swap and crashing system.
Crashing because, what else can system do, if it's swapped out driver has been changed. They know from hash, that it's been corrupted and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y can't even close system in normal way, because some code could be added to driver's unload / device stop routine and doing anything will trigger it one way or anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r.
Or is it possible to just unload that driver safely?

90210 said...

I think you misunderstood: I didn't say anything about upper-level logic engines of AV or firewalls - cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y will certainly differ from each ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r. But if MS prohibits arbitrary hooking cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y all will be forced to use very similar "monitoring" engines, and this similarity simplifies cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 bypassing techniques.
Of course, if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 malware gets to kernel it can defeat any ring0 av/fw engine, but things become a lot simpler with such documented interfaces.

Anonymous said...

But it seems that MS actually decided to ignore those suggestions and implemented cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 easiest solution, ignoring cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fact that it really doesn’t solve cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem…


I would like to believe that its a stop-gap measure implemented for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 purpose of allowing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 release of vista to go on undelayed while giving cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m time to develop a more realistic solution. probably not though. Its likely that pressure from third party vendors would eventually cause Microsoft to have to fix this properly anyway. Maybe you should write that disk editor just to mess with m. :)

Joanna Rutkowska said...

To Zori: MS doesn’t need to sign anything – it is cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 ISV who is supposed to sign its kernel drivers: http://www.microsoft.com/whdc/winlogo/drvsign/kmcs_walkthrough.mspx

To Viraptor: If you read my article carefully you will notice that I used cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 word “seems” :) And I would love to hear from MS if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y actually implemented anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r protection, like e.g. hashing for paged out pages…

To 90210: We’re talking about how to help creating an effective compromise detection (PG helps here by eliminating false positives). And you would like to sacrifice this in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 name of what? Making it slightly harder to bypass HIDS/HIPS/PFWs? Come on, we want real security, not something which is just slightly harder to bypass!

90210 said...

Why are you so sure that malware will not be able to use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365se legitimate hooking interfaces for its own good? PG will reduce false positives, but I doubt cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y will disappear completely.
How can we speak about "real security" if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 malware is already in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 kernel? :)

Anonymous said...

You say that you're 'good guys' and that is respectable :).
But I think that while a product is still in Beta (I know cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 countdown has started but...) all exploits should be publicly released to force cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 software manufacturer to fix it before going to press. By not releasing a POC example, someone else will be able to write a malitious variant ONCE cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 product is released and installed on lots of machines worldwide.

Stephen

Anonymous said...

blocking write-access to raw disk sectors for user mode applications is cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 best solution because this also will block any ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r attacks and not only this specific pagefile attack.

Joanna Rutkowska said...

"any ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r attacks"? like what? remember that you are (were) required to have admin rights to get (got) access to raw disk…

Anonymous said...

What do you think of "ProcessGuard" for Windows XP? Does it not already offer protections similar to some of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 'new' ones Money$oft is introducing in Vista?

Anonymous said...

Hi Joanna,

An application may write to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors on which a volume resides, but will need to acquire exclusive access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume (by locking or dismounting it) before doing so.

Ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rwise, its writes can collide with writes being issued by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system and end up corrupting cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume and possibly even destabilizing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system.

So a disk partitioning or management application should not need a kernel-mode counterpart to accomplish its tasks.

Regards

Joanna Rutkowska said...

Karan, but it’s cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 WriteFile() function which fails (see cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 picture) and not cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 CreateFile() – so I don’t see how this could have failed because of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 lock…

Anonymous said...

Hi Joanna,

To gain exclusive access to a volume, an application needs to do cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 following:

1. Open a handle to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume
2. Send down eicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r FSCTL_LOCK_VOLUME or FSCTL_DISMOUNT_VOLUME

If cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 above operations succeed, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n any write sent down via that handle will be honored.

Regards

Joanna Rutkowska said...

Hi Karan,

Correct me if I’m wrong, but that means that, starting from RC2, you can not create e.g. a disk wiping utility or something like that, which would be able to run on a main system volume, right? So, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 question is – if somebody created such a tool with a necessary kernel driver, would Microsoft revoke a signature for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 driver?

Anonymous said...

Hi Joanna,

The sectors that make up a volume eicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r hold file data or file system meta-data. An application may wipe cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors that hold file data and should use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file handle to do so. Writing to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system meta-data directly requires ensuring that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system itself isn’t writing to those sectors at that same moment and this can only be achieved by locking cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume.

For instance, say an application wishes to update cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 boot code. It would open a handle to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume and write to sector 0. Now if cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume happens to be formatted as FAT32 and a file is being added/deleted around cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same time, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system will want to write to sector 0 as well because that's where cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 dirty flag is stored. These two writes will go down in parallel and depending on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 order in which cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y get executed, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 boot code update may or may not happen.

Having said that, updating cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 boot code happens to be a common operation. So for application compatibility, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is no restriction on writes to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume where cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 boot code resides.

Writes to sectors outside cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volumes, where cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 partition tables reside, are not blocked as well. So disk partitioning applications should continue to work.

If an application wishes to wipe out cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 entire disk, it should first delete cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 partitions on it before zeroing out cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors. Ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rwise, it might wipe out a sector that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system was reading at cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same time and end up destabilizing cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 machine. Also, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file system might write out to a sector that was just zeroed out; so when cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 operation completes cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user assumes that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk has been wiped clean when that isn't necessarily cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 case.

So it seems to me that any application that relies on writing to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors of a 'live' volume can have an adverse effect on system stability and has cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 potential for data loss. The recent change protects against this.

Regards

Joanna Rutkowska said...

Hi Karan – you wrote:

“An application may wipe cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 sectors that hold file data and should use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file handle to do so.”

But, according to Mark Russinovich, this is not enough (http://www.sysinternals.com/Utilities/SDelete.html):
Compressed, encrypted and sparse are managed by NTFS in 16-cluster blocks. If a program writes to an existing portion of such a file NTFS allocates new space on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk to store cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 new data and after cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 new data has been written, deallocates cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 clusters previously occupied by cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file. NTFS takes this conservative approach for reasons related to data integrity, and in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 case of compressed and sparse files, in case a new allocation is larger than what exists (cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 new compressed data is bigger than cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 old compressed data). Thus, overwriting such a file will not succeed in deleting cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file's contents from cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk.

To handle cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365se types of files SDelete relies on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 defragmentation API. Using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 defragmentation API SDelete can determine precisely which clusters on a disk are occupied by data belonging to compressed, sparse and encrypted files. Once SDelete knows which clusters contain cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file's data, it can open cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk for raw access and overwrite those clusters.


To be fair – I haven’t checked myself whecá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r this is still an issue with Vista… Karan?

Anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r example – lets forget about file wiping utilities – now we want to write a file undeleter – something like e.g. Wininternals’ FileRestore… I don’t have a full version of FileRestore, but from cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 trial I managed to download it seems to me that it allows for file recovery on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 live system volume…

So, can we write such a undeleter for Vista RC2?

Anonymous said...

cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fight agianst cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 VISTA kernel goes fucá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r

Anonymous said...

Before granting access to a block device, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 OS should check if it is using it (filesystems/page file). If block device is in use, access to it should be restricted.

If a block device is just being used to swapping kernel pages, trying to open it should push cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 page file to RAM and wipe disk.

Anonymous said...

I found that starting with build 5728, write access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system/boot volume is locked. You can open cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume and write to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 first 8K (16 sectors on a 512 byte sector drive). If you open cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 physical drive, you can write to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 physical boot sector, and also and hidden sectors (i.e. cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 partition gap). Writing to any ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r sectors on ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r areas, using eicá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r a drive/volume handle, will fail. You cannot lock cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system volume handle using cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 IOCTL mentioned above.

In ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r words, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re is no way to access cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 physical sectors of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 system drive that are not cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 partition gap, MBR, or boot sector.

My guess is that this will break existing utilities, such as cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 above mentioned SDelete.

Anonymous said...

I still don't understand why do you need a raw disk access. Tasks like sector editing can (and should) be done with system offline, with linux distro or windows pe. Using defragmentation API can also be limited in driver to one function like DefragmentDevice(device).

Anonymous said...

I suppose that disk editors, undeleters, disk wipers, etc., can still be implemented by being put on live CDs with some ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r OS, and having cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user boot cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 live CD, no?

Anonymous said...

Was it so hard for Microsoft to create separate swap-partition or at least reserve some region on filesystem and do not allow anybody (even filesystem) to write to it ?

Working with pagefile/paging was always such a pain in file system device drivers.

I've actively used raw disk access in my work in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 past for legit reasons. LiveCD does not fit in some of those scenarios as once I've to to be able both load device driver (like SATA or RAID) and verify resulting data/algorithm assumptions in application (like own one loaded in debug session in Visual Studio).

Joanna Rutkowska said...

Why do we need a file wiping utility working on a live filesystem? Well, imagine this:

You are a freedom fighter in one of those countries which have problems with respecting human rights. It’s late in cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 evening; you’re sitting at your computer, hacking your government’s websites for fun and profit (to save cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 country actually), while suddenly you hear knocking to your doors and raised voices outside – you have no illusions – cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y just went after you… You may only wish now you had installed Truecrypt before and kept all your sensitive files on a Truecrypt’s hidden volume exploiting its cool plausible deniability feature… But you did not! So, you need a file wiping utility, but I guess what you want here is something which could be run immediately, on a running system and not something which requires rebooting cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 machine from a special CD. Remember, cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365re are at your doors… So, should all those freedom fighters upgrade to Vista? ;)

Anonymous said...

The capacity to read/write physical/logical sectors has been available in Windows since it's inception. It has been used by numerous applications and utilities for useful and beneficial purposes.

What MS has done is to break a lot of programs on a lot of machines a mere month before RTM. This not only blocks support for Vista in a timeframe that independent software developers/companies are trying to meet, but it now incurs an extra cost to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir implementation.

This is unfortunate for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 developers of utilities and add-on applications. I foresee this "security feature" being worked around, and regardless of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 next hack patch that is implemented, it will be worked around again.

Anonymous said...

Hi Joanna,

You've brought up two very interesting scenarios:

1. SDelete will no longer function correctly on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 boot volume on Vista for compressed, encrypted and sparse files (it still needs to be modified to lock cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume before writing to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 extents via cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume handle so as to work on non-boot volumes). However, Vista does include a mechanism (FSCTL_SET_ZERO_ON_DEALLOCATION) to help zero out that data clusters on any give file. While this may not be a "secure" erase, it does eliminate cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 simple case of someone trying to read cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 old clusters.

2. As for file un-deletion, I would presume cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 correct way to approach this on a live volume would be to locate cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 file record, identify cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 extents and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365n copy cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 contents over to a new file. This should continue to work.

Regards

Anonymous said...

to undelete a file, program should first prevent possible usage of deleted blocks, which is now not possible.

Ocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365rwise data of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 deleted file can be overwritten, for example, with cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 pagefile.

Joanna Rutkowska said...

Hi Karan,

I agree with you on point #2 – it seems that we can create an on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fly un-deleter without having a raw write-access to disk sectors. The problem of possible overwrites of sectors belonging to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 deleted file always exist – so, I don’t agree with an anonymous person posting above.

However, still cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem remains with creating a secure file wiping utility…

So, I thought – why doesn’t MS create a flexible API to allow for creation of usermode based file wiping utilities? You could go even furcá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r and create an API to allow for on cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 fly disk wiping… The important point here IMO would be to allow cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 application to provide a buffer which is used for wiping (overwriting).

That should pretty much solve cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 problem, as we agreed that file un-deleting can be done without raw write-access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk and that it’s still possible to implement a diskeditor, provided cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 volume accessed is un-mounted or locked. BTW, would be nice if MS updated SDK entry for cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 CreateFile() function, to let people know that volume locking or un-mounting is now necessary when opening it for a raw access…

Anonymous said...

Hi Joanna,

Updating cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 documentation on some of cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 Win32 APIs to reflect cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 new change is an excellent suggestion.

There does exist a mechanism (FSCTL_SET_ZERO_DATA) to zero a range of blocks that a file resides on. A variation on this that allows cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 user to provide cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 'pattern' or 'data' to write out is anocá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365r very good suggestion.

In cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 meanwhile, I'd recommend that cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 freedom fighters keep all cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365ir sensitive files on a separate volume :)

Regards

Anonymous said...

Yeah, Johanna (Trinity) rules ! And Microsoft ... still cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 same !
You gave cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m solutions and cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y still can't use cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365m, so why are cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365y paid for ? For cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 stress I think ...
Thanks to share your thoughts and your works, it's amazing (for me) !

Unknown said...

Just for information: EldoS Corporation yesterday announced release of RawDisk, a disk driver that lets you use raw disk access from your user-mode application.
So blocked direct access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk is no longer a problem.

Anonymous said...

>>
So blocked direct access to cá cược thể thao bet365_cách nạp tiền vào bet365_ đăng ký bet365 disk is no longer a problem.
<<

It's a problem if you don't have 500 euros to spend on a 9K sys file.
:-(