blog.world3.net

Attacking data in RAM

Today’s Hack a Day post linked to this article on recovering encryption keys from RAM, so I thought I’d look into defences against this kind of attack.

There are simple ways to defeat this, and although not 100% reliable they are pretty effective.

You have to consider what sort of situation this attack is likely to be used in. The attacker would have to get to the machine while it is powered on, but be unable to access it due to software security (passwords etc). So, they reboot the system and try to recover the encryption keys from RAM, or remove the RAM from your computer (possibly after freezing it) and install it in their own machine.

Why would you need to put the RAM in another machine if you could just hit the reset button? Well, the reset button might be disconnected, or the BIOS might be set up to do a full memory check which would overwrite every byte in RAM. The only way to be sure to avoid the BIOS wiping RAM would be to power the machine off, reset the BIOS and power it back on. Note that in laptops, even resetting the BIOS (which is typically very difficult as it involved opening the laptop up) often does not clear the power-on password.

A note about UK law here. The RIP Act means that the police can force you to hand over passwords. Luckily Truecrypt features plausible deniability, but it might be hard to argue that you didn’t know the power-on password for your laptop. That’s the biggest problem with that law – instead of the police having to prove you are guilty, you have to prove you are innocent. So, it’s probably not a good idea to rely on the power-on password.

So, the attacker wants to freeze the RAM and put it into their own machine for reading. It’s going to be hard to freeze it, transport it to the new machine and install it without data loss, but for arguments sake let’s say it’s possible. Certainly, the CITP paper seems to think it is.

Most machines have a case open switch, which could be used to trigger a memory wiping program. Assuming the program was intelligent things like encryption keys could be erased in nanoseconds, and the entire RAM in a few seconds. The attacker would have to power off before opening the case, increasing the time before they can freeze the RAM and thus increasing data loss. The power button itself could also be used as a trigger, in case the attacker is stupid enough to press it instead of pulling the plug.

Anyone worried about being raided should probably set up a panic switch, or at least be ready to hit the reset button to allow the BIOS to clear the RAM. Truecrypt should ideally be configured to dismount any encrypted volumes when the machine is sleeping or the screensaver is engaged, although that’s not always practical (e.g. with boot volume encryption).

The ideal solution would be a PCI-e card with a small amount of RAM for encryption keys, a microprocessor and battery/capacitor. As soon as power goes off, the uproc would securely erase the RAM. Maxim make ICs that do just that, all we need is an implementation. It’s a shame USB can’t be used, or any cheap uproc would do, but USB devices cannot be mapped to memory address space.

Of course, even this wouldn’t prevent any open documents, cached directory listings etc from being recovered.

A program to wipe the physical RAM on shut-down of Windows would be ideal, but not trivial to write since it would need a complex driver to access RAM and figure out which bits can be cleared (because you don’t want to crash the OS). A simpler but less effective method would be a program that simply requests allocation of non-paged RAM (i.e. physical RAM) repeatedly until allocation fails (and presumably RAM is filled up) – similar to how Eraser‘s free disk space wipe works.

Really, this kind of attack, assuming you are reasonably well prepared for it, is not particularly effective. For anyone worried about law enforcement, setting the BIOS to do a full memory test and setting a BIOS password is probably enough to prevent it in most cases. An improvement would be to make sure your BIOS does a full memory test by default (i.e. after being reset). Some mobos do that, if yours doesn’t a BIOS editor might fix that.

This entry was written by mojo, posted on 14/05/2008 at 11:52, filed under hardware, law, privacy, security, software, windows. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.
« BNP using BBC Have Your Say as a platform?
Student arrested under the Terrorism Act for Al Qaida research »

Post a Comment

Your email is never shared. Required fields are marked *

*
*

たとえ溺れても梦はゆめでしかない
  •  

    May 2008
    M T W T F S S
    « Apr   Jun »
     1234
    567891011
    12131415161718
    19202122232425
    262728293031  
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Categories

    • audio (1)
    • avr (15)
    • electronics (24)
    • genius (4)
    • hardware (21)
    • idiots (33)
    • Internet (13)
    • law (17)
    • microcontrollers (11)
    • networking (17)
    • politics (27)
    • privacy (18)
    • Retro Adapter (4)
    • security (16)
    • software (27)
    • Uncategorized (16)
    • windows (19)
  • Archives

    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • November 2005
  • Links:

    Main site: world3.net

    Electronics: denki.world3.net

WordPress | Sandbox