passwords in SWAP on OS X?

According to IPWrangler, passwords are stored in swap, which means it could allow a local user with sudo access to retreive passwords out of swap. Currently there's not much you can do at this point other than to reboot your machiine periodically to clear swap.

However, this might not be true, and only root user (or perhaps sudo users) can read swap. Not sure if this happens to all UNIX machines.

We are waiting for solutions from Apple.


Subject: Mac OS X stores login/Keychain/FileVault passwords on disk

Date: Jun 25 2004 9:48AM

Author: Matt Johnston

It seems that Mac OS X (10.3.4 tested) doesn't bother clearing memory containing sensitive data, or using mlock() to avoid swapping.

A quick grep of the swapfiles will show up various morsels:

rez:~> sudo strings -8 /var/vm/swapfile0 |grep -A 4 -i longname

... various other occurrences follow

Grepping for context around "password" also shows up results, and grepping
for portions of a Keychain password (differing from the login password)
will also get results. It appears that loginwindow is one of the apps involved,
I haven't investigated what else is involved. The amount of memory and usage
patterns of the machine will affect what gets swapped, though loginwindow seems
likely to get swapped early since it is seldom used after login.

Obviously this is only of interest if an attacker has root (or physical)
access to a machine, however it does make FileVault or Keychain encryption
fairly useless. It appears that the swapfiles are removed on shutdown or
startup, though not wiped - pulling the power from a sleeping machine, and/or
booting from CD, would quite easily retrieve the password(s).

Reported to Apple on 21 June, I haven't had any response. It'd be nice if
they at least said "we're taking a look if it's an issue".


Posted by Antony at June 28, 2004 12:39 AM

>> more MacCentre701 June 2004 reports.