I've recently read about the cold boot method, where it's possible to obtain the key for an encrypted filesystem from DRAM. This can be done even after the computer is turned off, but it requires special equipment that is very difficult for most people to obtain. Then it occurred to me that there's a security risk where an attacker could gain the key to an encrypted disk without having access to expensive hardware: if the page containing the key is ever swapped out to the hard drive, the attacker would only need to read the swap space to get the key. I don't think on-the-fly disk encryption programs encrypt the swap space, since it's conceptually part of RAM, so an attacker would be able to read the unencrypted contents of the swap space and get the key.

I've been thinking of using FileVault to encrypt my Macbook's data in the future, since I'm one of those paranoid types. I came to this decision after learning that it uses AES encryption, which IMO is the best cipher out there. But I'm just concerned about this vulnerability. Do programs like FileVault have a means to protect against the key being swapped out to an unencrypted swap space for an attacker to read? If so, what is it?

EDIT: Actually, I just realized, that, at least on Mac OS X, the swap space is part of the filesystem, and it's stored in /var/vm as I just recently discovered, so in the case of OS X, FileVault would probably encrypt any pages that are swapped to the hard drive. This might not be the case with Linux, since swapping is done with a separate swap partition. I'm not sure how it's done in Windows.

  • 2
    Possible duplicate of Swap file may contain sensitive data Dec 25, 2015 at 13:03
  • 1
    The first answer to that question tells you how to clear your swap file in Windows and Linux, but not in Mac OS X. I'd like to know how to do it in Mac OS X.
    – Zen Hacker
    Dec 25, 2015 at 13:17
  • That question has no Mac OS X solution. Dec 25, 2015 at 20:25

1 Answer 1


Not every part of the memory can be swapped (or correctly paged) to disk. Proper code dealing with sensitive data like encryption keys will mark the relevant part of the memory so that they will not be paged. This is true for both user-space and kernel-space encryption.

Which means you can find such key in memory but with proper applications you will not find these on disk. And I would think that FileFault on OS X and also dm-crypt and similar stuff on Linux behaves safe in this area.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .