Complete Hard Disk Encryption
Complete Hard Disk Encryption
GEOM Framework
Marc Schiesser
m.schiesser [at] quantentunnel.de
October 20th 2005
Abstract
Most technologies and techniques intended for securing digital
data focus on protection while the machine is turned on – mostly by
defending against remote attacks. An attacker with physical access
to the machine, however, can easily circumvent these defenses by
reading out the contents of the storage medium on a different, fully
accessible system or even compromise program code in order to
leak encrypted information.
Especially for mobile users, that threat is real. And for those
carrying around sensitive data, the risk is most likely high.
This paper describes a method of mitigating that particular risk
by protecting not only the data through encryption, but also the
applications and the operating system from being compromised
while the machine is turned off.
The platform of choice will be FreeBSD, as its GEOM framework
provides the flexibility to accomplish this task. The solution does
not involve programming, but merely relies on the tools already
provided by FreeBSD.
Table of Contents
1 Background & motivation......................................................................................................2
2 Partial disk encryption...........................................................................................................3
2.1 Filebased encryption.....................................................................................................4
2.2 Partitionbased encryption............................................................................................5
2.3 The leakage risk...............................................................................................................5
2.4 New attack vectors..........................................................................................................6
3 Complete disk encryption.....................................................................................................6
3.1 Tools provided by FreeBSD............................................................................................6
3.2 The problem with complete disk encryption...............................................................7
3.3 Requirements..................................................................................................................8
3.4 Complete hard disk encryption using GBDE................................................................8
3.4.1 Erasing previously stored data...............................................................................8
3.4.2 Initialization & the lockfile......................................................................................9
3.4.3 Attaching the encrypted medium..........................................................................9
3.4.4 Partitioning............................................................................................................10
3.4.5 Creating the filesystem..........................................................................................11
3.4.6 Installing FreeBSD.................................................................................................11
3.4.7 Preparing the removable medium.......................................................................12
3.4.8 The kernel modules...............................................................................................12
3.4.9 The problem with GBDE.......................................................................................13
3.4.10 The memory disk.................................................................................................13
3.4.11 Populating the memory disk filesystem............................................................14
3.4.12 The booting process............................................................................................14
3.4.13 Creating the symlinks..........................................................................................15
3.4.14 Integrating the memory disk image...................................................................15
3.4.15 The swap partition...............................................................................................16
3.4.16 Postinstallation issues.......................................................................................16
3.5 Complete hard disk encryption using GELI................................................................16
3.5.1 Readying the hard disk..........................................................................................17
3.5.2 Improvements and new problems with GELI.....................................................17
3.5.3 Initializing, attaching and partitioning................................................................18
3.5.4 Filesystem creation and system installation.......................................................19
3.5.5 The removable medium........................................................................................19
3.5.6 Mounting the encrypted partition.......................................................................19
4 Complete hard disk encryption in context.........................................................................20
4.1 New defenses & new attack vectors – again................................................................20
4.2 Tradeoffs......................................................................................................................22
4.3 GBDE vs. GELI...............................................................................................................23
5 Conclusion............................................................................................................................23
References & further reading.................................................................................................24
1 Background & motivation
As more and more data enters the digital world, appropriate measures must be taken in
order to protect it.
Considering the everincreasing number of networked devices and the inherent
exponential growth of the Internet, it is imperative that a large amount of effort go into
securing devices against remote attacks. Common technologies and techniques include
firewalls, intrusion detection systems (IDS), encryption of all kinds of network
transmissions as well as hardening network stacks and fixing buffer overflows.
At the same time, we are witnessing increasingly sophisticated and complex mobile
devices such as PDAs, smartphones and cell phones becoming pervasive and assuming
all kinds of important tasks. Between the generalpurpose laptop and the (once) special
purpose cell phone, pretty much anything in between is available.
As people use these devices, they also generate data – either explicitly or implicitly.
Explicitly stored data might for example include: entering a meeting into the electronic
schedule, storing a telephone number and associating a name with it, or saving an email
message draft in order to finish it later.
But then there is also the data which is stored implicitly. Examples include the
history of the telephone numbers called or received, browser caches, recently accessed
files, silently by the software archived or backedup data such as email messages, log
files and so on.
Even if the user remembers to delete the explicitly stored files after they are no longer
needed, it is possible to trace a lot of his or her activity on the device by looking at the
aforementioned, implicitly stored data. The more sophisticated the device is, the more
such data will usually be generated, mostly without the user's knowledge.
In terms of performance, laptop computers hardly lag behind their desktop
counterparts – enabling them to run the same powerful and complex software. It also
means that the users tend to generate far more data – both explicitly and implicitly –
than on simpler devices.
In addition to being exposed to remote attacks, laptop users are also faced with an
increased exposure of the machine itself. While stationary computers are physically
accessible by usually only a limited number of people, a laptop computer is intended to
be used anywhere and anytime.
This paper does not try to provide any solutions to mitigating the risks of remote
attacks. Instead, it concentrates on the risks posed by attackers with physical access to
the device. An attacker with physical access to a machine can either:
• boot his own operating system, thus circumventing restrictions such as login
procedures, filesystem and network access control and sandboxes
• or remove the hard disk from the targeted machine and install it in a system
which is under the control of the attacker – in case the target's booting
sequence is protected (e.g. by a BIOS password)
Unfortunately, most people and companies take quite lax an approach when it comes to
protecting their data instorage, while the machine is turned off. The following quotes
illustrate just how serious a problem the lack of instorage encryption can become:
• „Thieves stole computer equipment from Fort Carson containing soldiers'
Social Security numbers and other personal records, the Army said ...” [Sarche,
2005]
• „Personal devices "are carrying incredibly sensitive information," said Joel
2
Yarmon, who, as technology director for the staff of Sen. Ted Stevens (R
Alaska), had to scramble over a weekend last month after a colleague lost one of
the office's wireless messaging devices. In this case, the data included "personal
phone numbers of leaders of Congress. . . . If that were to leak, that would be
very embarrassing," Yarmon said.” [Noguchi, 2005]
• „A customer database and the current access codes to the supposedly secure
Intranet of one of Europe's largest financial services group was left on a hard
disk offered for sale on eBay.” [Leyden, 2004]
• „ ... Citigroup said computer tapes containing account data on 3.9 million
customers, including Social Security numbers, were lost by United Parcel
Service.” [Reuters, 2005]
• „Earlier this year, a laptop computer containing the names and Social Security
numbers of 16,500 current and former MCI Inc. employees was stolen from the
car of an MCI financial analyst in Colorado. In another case, a former Morgan
Stanley employee sold a used BlackBerry on the online auction site eBay with
confidential information still stored on the device. And in yet another incident,
personal information for 665 families in Japan was recently stolen along with a
handheld device belonging to a Japanese powercompany employee.”
[Noguchi, 2005]
• „ ... trading firm Ameritrade acknowledged that the company that handles its
backup data had lost a tape containing information on about 200,000
customers. ” [Lemos, 2005]
• „MCI last month lost a laptop that stores Social Security numbers of 16,500
current and former employees. Iron Mountain, an outside data manager for
Time Warner, also lost tapes holding information on 600,000 current and
former Time Warner workers.” [Reuters, 2005]
Even though the number of press articles reporting damage due to stolen mobile
computers – or more specifically: storage media – does not reach the amount of publicity
that remotely attacked and compromised machines provoke, it must also be taken into
account that data on a laptop does not face as much exposure as it does on an Internet
server.
A laptop computer can be insured and data regularly be backed up in order to limit
the damage in case of loss or theft; but protecting the data from unauthorized access
requires a different approach.
1 http://aescrypt.sourceforge.net/
2 http://ncrypt.sourceforge.net/
3
vncrypt3 project is an example that takes this approach.
Scenario: filebased encryption of huge files
The file might be a database or multimedia container: if the cryptographic functions
are not performed onthefly (usually through modified system calls), the entire file
content must be temporarily stored in plain text – therefore consuming twice the space.
Then the unencrypted copy must be opened by the application. After the file has
been closed, it obviously must be encrypted again – unless no modification has taken
place. The application will therefore save the data in plain text, which must then be
encrypted and written out in its cipher text form again – but by a program capable of
doing the appropriate encryption.
The unencrypted (temporary) copy could of course just be unlinked (removed from
the name space), but in that case the unencrypted data would still remain on the
medium until physically completely overwritten. So, if one wants to really destroy the
temporary copy, several overwrites are required – which can consume a lot of time with
large files. Therefore, a lot of unnecessary I/O must be performed.
Scenario: filebased encryption of many files
If one wants to encrypt more than just a small bunch of files, it actually does not
matter how small or large they are – the procedure described above still must be adhered
to unless encryption and decryption is performed onthefly.
Aside from its lack of scalability, filebased encryption also suffers from the leakage
3 http://sourceforge.net/projects/vncrypt/
4
risk “phenomenon” – which will be discussed in chapter 2.3. In most cases, encryption is
therefore either abandoned or the following, more effective and efficient scheme is
chosen.
Scenario: editing a sensitive document stored on an encrypted partition
A mobile user needs to have a lot of data at his immediate disposal. Since some
information is sensitive, he decides to put it on an encrypted partition.
Unfortunately, the encryption becomes basically useless as soon as encrypted files
are opened with applications that create temporary copies of the files currently being
worked on, often in the /tmp directory. So unless the user happens to have /tmp
encrypted, his sensitive data is leaked to an unencrypted part of the medium. Even if the
application deletes the temporary copy afterwards, the data still remains on the medium
until it is physically overwritten. Meta data such as file name, size and ownership may
also have leaked and may therefore remain accessible for some time.
This phenomenon happens equally implicitly with printing. Even if the application
itself does not leak any data, the spooler will usually create a Postscript document in a
subdirectory of /var/spool/lpd/, which is not encrypted unless specifically done so.
Even though it is possible to symlink the “hot” directories such as /tmp, /var/tmp, as
well as the complete /home or /var/spool/lpd/ to directories on the encrypted partition,
the leakage risk can never be avoided completely. It is something that users of partition
based encryption just have to be aware of and learn to live with by minimizing the
amount of leaked data as much as possible.
5
The leakage risk is also another reason why filebased encryption is virtually useless.
While this issue is certainly a problem for sensitive data, there is a far bigger problem,
which so far has been quietly ignored.
The key motivation behind complete disk encryption is illustrated in the last point: the
OS and the applications are now the target. Instead of breaking the encryption, an
attacker can try and subvert the kernel or the applications, so they leak the desired data
or the encryption key.
The goal is therefore to encrypt the OS and all the applications as well. Just as any
security measure that is taken, this scheme involves tradeoffs, such as less convenience
and decreased performance. These issues will be discussed later. Every user considering
this scheme must therefore decide for him or herself, whether the increase in security is
worth the tradeoffs.
6
encrypt entire partitions and even hard disks or other media.
When the 5.x branch was finally declared STABLE and therefore ready for
production use, 6.x became the new developer branch, carrying all the new, more
disruptive features. Into this branch added was also a new module and userland utility
called GELI [Dawidek, 2005b]. In addition to containing most of the GBDE features, GELI
was designed to enable the kernel to mount the root filesystem (/) from an encrypted
partition. GBDE does not allow to do this and therefore requires a “detour“ in order to
make complete hard disk encryption work.
This paper will discuss the realization of complete hard disk encryption with both
tools without having to rely on programming. GELI is a more elegant solution, because it
was designed with this application in mind. GBDE, on the other hand, has seen more
exposure because it has been available for much longer then GELI and therefore is more
likely to have received more testing. Using GBDE for complete hard disk encryption also
illustrates some interesting problems inherent with the booting process and how these
can be solved.
Which approach is in the end chosen, is left to the user. The following table lists the
most important features of GBDE and GELI [Dawidek, 2005b].
GBDE GELI
First released in FreeBSD 5.0 6.0
Cryptographic algorithms AES AES, Blowfish, 3DES
Variable key length No Yes
Allows kernel to mount encrypted root partition No Yes
Dedicated hardware encryption acceleration No Yes, crypto(9)
Passphrase easily changeable Yes Yes
Filesystem independent Yes Yes
Automatic detach on last close No Yes
Table 1: the most important GBDE and GELI features
7
3.3 Requirements
Independent of whether GBDE or GELI is used, the following things are required:
• A bootable, removable medium. It will carry the boot code as well as the kernel.
This medium is preferably a USB memory stick, because it is small, light and
offers a lot of easily rewritable space.
• The device intended for complete disk encryption. Is is very important that this
device is capable of booting from the removable medium mentioned above.
Especially older BIOSes may not be able to boot from USB mass storage.
Bootable CDs will probably work on most machines. Although they work
equally well (r/w access is not a requirement for operation), they are harder to
set up and maintain.
• In order to set up and install everything, a basic FreeBSD system is required.
The FreeBSD installation discs carry a “live filesystem” – a FreeBSD system
which can be booted directly from the CD. It can be accessed via the
sysinstall menu entry 'Fixit'.
All following instructions are assumed to be executed from the aforementioned “live
filesystem” provided by the FreeBSD installation discs.
Before proceeding any further, the user is strongly urged to back up all data on the media
and the devices in question.
Furthermore, it will be assumed that the hard disk to be encrypted is accessible
through the device node /dev/ad0 and the removable (USB) medium through /dev/da0.
These paths must be adjusted to the actual setup!
8
space with zero values. The required amount of time may therefore be too great a trade
off for the additional increase in security – especially on older, slower hardware.
9
explicitly detached via the gbde command or the system is shut down. In the period
between attaching and detaching, there is no additional protection by GBDE.
3.4.4 Partitioning
The next step is to partition the hard disk. This is usually done using sysinstall(8) –
which, unfortunately, does not support GBDE partitions and fails to list device nodes
with a .bde suffix. Therefore, this work has to be done using the tool bsdlabel.
# bsdlabel -w /dev/ad0.bde
# bsdlabel -e /dev/ad0.bde
First, a standard label is written to the encrypted disk, so that it can be edited
afterwards. bsdlabel will display the current disk label in a text editor, so it can be
modified. In order to make the numbers in the following example easier to read, the disk
size is assumed to be 100 MB. The contents of the temporary file generated by bsdlabel
might look like this:
# /dev/ad0.bde:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 198544 16 unused 0 0
c: 198560 0 unused 0 0 # "raw" part, don't edit
Each partition occupies one line. The values have the following meaning:
column description
1 a=boot partition; b=swap partition ; c=whole disk; d, e, f, g, h=freely available
2 and 3 partition size and its offset in sectors
4 filesystem type: 4.2BSD, swap or unused
5, 6 and 7 optional parameters, no changes required
Table 2: bsdlabel(8) file format
After the temporary file has been edited and the editor closed, bsdlabel will write
the label to the encrypted hard disk – provided no errors have been found (e.g.
overlapping partitions).
It is important to understand the device node names of the newly created partitions.
The encrypted boot partition (usually assigned the letter 'a'), is now accessible via device
node /dev/ad0.bdea. The swap partition is ad0.bdeb and so on. Just as adding a boot
partition to an unencrypted disk would result in a ad0a device node, adding an
encrypted slice holding several partitions inside would result in ad0s1.bdea, ad0s1.bdeb
and so on.
An easy way to keep the naming concept in mind is to remember that everything
written after the .bde suffix is encrypted and therefore hidden even to the kernel until the
device is attached.
For example: ad0s1.bdea means that the data on the first slice is encrypted –
including the information that there is a boot partition inside that slice. If the slice is not
attached, it is only possible to tell that there is a slice on the disk – neither the contents of
the slice, nor the fact that there is at least one partition inside the slice can be unveiled.
10
In fact, the node ad0s1.bdea does not even exist until the slice has been successfully
attached, because without having the key (and the lockfile), the kernel cannot know that
there is a partition inside the encrypted slide.
Scenario: multiple operating systems on the same disk
It is also possible to have multiple operating systems on the same disk – each on its
own slice. The slice containing FreeBSD can be encrypted completely, hiding even the
fact that the FreeBSD slice contains multiple partitions inside (boot, swap, etc). This way,
all data on the FreeBSD slice remains protected, while the other operating systems on
the machine can function normally on their unencrypted slices. In fact, they cannot even
compromise the data on the FreeBSD slice – even if an attacker manages to get root
access to a system residing on an unencrypted slice.
Note that the swap partition does not need a filesystem; the 'c' partition represents
the entire (encrypted) disk. This partition must not be formated or otherwise be
modified!
11
# cd /dist/5.4-RELEASE/base && ./install.sh
You are about to extract the base distribution into /fixed - are you SURE
you want to do this over your installed system (y/n)?
After all desired distributions have been installed, there is a complete FreeBSD
installation on the encrypted disk and the swap partition is also ready. But since this
system cannot be booted from the hard disk, it is necessary to set up the removable
medium.
12
# gzip kernel geom_bde.ko acpi.ko
Binary code compresses to about half of the original size and thus brings a noticeable
decrease in loading time. The modules which will not be used or later will be loaded
from the hard disk can be deleted from the removable medium.
It is important, however, that the code on the removable medium (kernel, modules,
etc) is kept in sync with the system on the hard disk.
13
Then a device node for the image is needed, so that a filesystem can be created on it
and then mounted.
# mdconfig -a -t vnode -f /removable/boot/mfsroot
md1
# newfs /dev/md1
# mount /dev/md1 /memdisk
If the output of mdconfig(8) differs from 'md1', the path in the following
instructions must be adjusted. The assumed mounting point for the memory disk will be
/memdisk.
/rescue/gbde attach /dev/ad0 l /etc/lockfile && \
/rescue/mount /dev/ad0.bdea /safe && \
/rescue/mount w f /dev/md0 / && \
/rescue/rm R /etc && \
/rescue/ln s safe/etc /etc
14
The commands first attach the encrypted boot partition, mount it on /safe and then
erase the /etc directory from the memory disk, so that it can be symlinked to the
directory on the encrypted disk.
Obviously, the utilities in the /rescue directory need to be on the memory disk. The
/rescue directory is already part of a FreeBSD default installation and provides statically
linked executables of the most important tools. Although the size of the /rescue directory
seems at first glance to be huge (~470 MB!), there is in fact one binary which has been
hardlinked to the various names of the utilities. The /rescue directory therefore contains
about 130 tools which can be executed without any dependencies on libraries. The total
size is less than 4 MB. Although this fits easily on the created memory disk, the directory
cannot be just copied. The following example uses tar(1) in order to preserve the
hardlinks.
# cd /fixed
# tar -cvf tmp.tar rescue
# cd /memdisk
# tar -xvf /fixed/tmp.tar
# rm /fixed/tmp.tar
15
must be explicitly specified as such in the configuration file, so the kernel knows how to
handle the file's contents. The following three lines are required in /boot/loader.conf on
the removable medium:
mfsroot_load="YES"
mfsroot_type="mfs_root"
mfsroot_name="/boot/mfsroot"
It is also important to note that there is no need to maintain an extra copy of the
/etc/fstab file on the removable medium as the kernel automatically mounts the first
memory disk that has been preloaded. Although this /etc/fstab issue is not a major
problem, it is a necessary measure in order to make this scheme work with GELI – which
is able to mount an encrypted partition as the root filesystem.
16
root filesystem – without the need for a memory disk.
Many of the steps required to make complete hard disk encryption work with GBDE
are also necessary with GELI – regardless of whether a memory disk is used or not.
Therefore the description and explanation of some steps will be shortened or omitted
completely here. The necessary commands will of course be given, but for a more
detailed explanation the respective chapters in the GBDE part are recommended for
reference.
17
encrypted partition as the root filesystem comes therefore at the price of having to rely
only on the passphrase to protect the data. The memory disk approach that was
discussed in order to make complete hard disk encryption work with GBDE also works
with GELI. Although it is harder to set up and maintain, it combines the advantages of
“something you know” and “something you have”, namely a passphrase and a
lockfile/keyfile. Especially on mobile devices it is risky to rely only on a passphrase, since
it will face intensive exposure as it must be typed in each time the system is booted up.
The choice between better usability and increased security is therefore left to user.
Attaching the hard disk is also largely the same as with GBDE, again except that the
keyfile parameter must be omitted from the command.
# geli attach /dev/ad0
Enter passphrase:
Upon successful attachment, a new device node will be created in the /dev directory
which carries the name of the specified device plus a '.eli' suffix. Just like the '.bde'
device node created by GBDE, this node provides access to the plain text. The output of
geli after successful attachment looks something like this (details depend on the
parameters used and the available hardware):
GEOM_ELI: Device ad0.eli created.
GEOM_ELI: Cipher: AES
GEOM_ELI: Key length: 128
GEOM_ELI: Crypto: software
Since sysinstall cannot read GELI encrypted partitions either, the partitioning
must be done using the bsdlabel tool.
# bsdlabel -w /dev/ad0.eli
# bsdlabel -e /dev/ad0.eli
Partition management was discussed in more detail in chapter 3.4.4.
18
3.5.4 Filesystem creation and system installation
Now that the partition layout has been set, the filesystem(s) can be created, so FreeBSD
can be installed.
# newfs /dev/ad0.elia
# newfs /dev/ad0.elid
etc.
The actual installation of the system on the encrypted hard disk must also be done
manually, since sysinstall does not support GELI encrypted partitions.
# mount /dev/ad0.elia /fixed
# export DESTDIR=/fixed/
# cd /dist/6.0-RELEASE/base && ./install.sh
You are about to extract the base distribution into /fixed - are you SURE
you want to do this over your installed system (y/n)?
19
# echo “/dev/ad0.elia / ufs rw 1 1” >> /removable/etc/fstab
It is important to note that this file must be stored on the removable medium and
serves only the purpose of specifying the device for the root filesystem. As soon as the
kernel has read out the contents of the file, it will mount the specified device as the root
filesystem and the files on the removable medium (including fstab) will be outside of the
filesystem name space. This means that the removable medium must first be mounted
before the files on it can be accessed through the filesystem name space. It also means,
however, that the removable medium can actually be removed after the root filesystem
has been mounted from the encrypted hard disk – thus reducing unnecessary exposure.
It is crucial that the removable medium be always in the possession of the user, because
the whole concept of complete hard disk encryption relies on the assumption that the
boot medium – therefore the removable medium, not the hard disk – is uncompromised
and its contents are trusted.
If any other partitions need to be mounted in order to boot up the system – for
example /dev/ad0.elid for /usr – they must be specified in /etc/fstab as well. Since most
installations use at least one swap partition, the command for adding the appropriate
entry to /etc/fstab is given below.
# echo “/dev/ad0.elib none swap sw 0 0“ > /fixed/etc/fstab
The system is now ready for use and can be booted from the removable medium. As
the different storage devices in the system are found, GELI searches them for any
partitions that were initialized with the geli init -b parameter and asks for the
passphrase. If the correct one has been provided, GELI will create new device nodes for
plain text access to the hard disk and the partitions on it (e.g. /dev/ad0.elia), which then
can then be mounted as specified in /etc/fstab.
After that, the rest of the system is loaded. sysinstall can then be used in order to
adjust the various settings that could not be set during the installation procedure – such
as timezone, keyboard map and especially the root password!
20
in most cases not encrypted by default either. Since all encryption and decryption of the
data on the hard disk is done transparently to the user once the passphrase has been
provided, it is easy to forget that some directories might contain data which is stored on
a different machine and made available through NFS, for example – in which case the
data is transferred in the clear over the network, unless explicitly set up otherwise.
The mounting facility in UNIX is very powerful; but it also makes it difficult to keep
track of which medium actually holds what data.
The network poses of course an additional threat, because of an attacker's ability to
target the machine remotely. The problem has already been discussed in chapter 1. If a
particular machine is easier to attack remotely than locally, any reasonable attacker will
not even bother with getting physical access to the machine. In that case it would make
no sense to use complete hard disk encryption, because it does not eliminate the
weakest link (the network connectivity).
If, on the other hand, not the network, but the unencrypted or not fully encrypted
hard disk is the weakest link and the attacker is also capable of getting physical access to
the machine (for reasons discussed in chapter 2.4), then complete hard disk encryption
makes sense.
A key point to remember is that as long as a particular storage area is attached, the
data residing on it is not protected any more than any other data accessible to the
system. This applies to both GBDE and GELI; even unmounting an encrypted storage
area will not protect the data from compromise since the corresponding device node
providing access to the plain text still exists. In order to remove this plain text device
node, the storage area in question must be detached. With GBDE this must be done
manually, GELI has a feature that allows for automatic detachment on the last close –
but this option must be explicitly specified.
Since the partition holding the operating system must always be attached and
mounted, its contents are also vulnerable during the entire time the system is up. This
means that remotely or even locally introduced viruses, worms and trojans can
compromise the system in the same way they can do it on a system without complete
hard disk encryption.
Another way to attack the system would be by compromising the hardware itself, for
example by installing a hardware keylogger. This kind of attack is very hard to defend
against and this paper makes no attempt to solve this issue.
What complete hard disk encryption does protect against, is attacks which aim at
either accessing data by reading out the contents of the hard disk on a different system
in order to defeat the defenses on the original system or by compromising the system
stored on the hard disk, so the encryption key or the data itself can be leaked. Encryption
does not, however, prevent the data from being destroyed, both accidentally and
intentionally.
If it is chosen that the encrypted partition is mounted directly as the root filesystem –
without the need for a memory disk, then it is crucial that a strong passphrase be
chosen, because that will be the only thing required to access the encrypted data.
Choosing the memory disk approach makes for a more resilient security model, since it
enables the user to use a lockfile (GBDE) or a keyfile (GELI) – in order to get access to the
data.
While all these previously mentioned conditions and precautions matter, it is
absolutely crucial to understand that the concept of complete hard disk encryption
depends upon the assumption that the data on the removable medium is trusted.
The removable medium must be used because the majority of the hardware is not
capable of booting encrypted code. Since the kernel and all the other code necessary for
mounting the encrypted partition(s) must be stored in the clear on the removable
21
medium, the problem of critical code getting compromised has, in fact, not really been
solved. The most efficient way to attack a system like this would most likely be by
compromising the code on the removable medium.
It is therefore crucial that the user keep the removable medium with him or her at all
times. If there is the slightest reason to believe that the data on it may have been
compromised, its contents must be erased and reconstructed according to the instructions
in the respective GBDE or GELI chapters.
If the removable medium has been lost or stolen and there was a keyfile or lockfile
stored on it, then two issue must be taken into account:
• The user will not be able to access to encrypted data even with the passphrase.
It is therefore strongly recommended that a backup of the keyfile/lockfile be
made and kept in a secure place – preferably without network connectivity.
• The second possibility can be equally devastating, since the keyfile/lockfile
could fall into the hands of someone who is determined to break into the
system. In that case, all the attacker needs is the passphrase – which can be very
hard to keep secret for a mobile device. It is therefore recommended that both
the passphrase and the keyfile/lockfile are changed in the event of a removable
medium loss or theft.
4.2 Trade-offs
Complete hard disk encryption offers protection against specific attacks as discussed in
chapter 4.1. This additional protection, however, comes at a cost – which is usually why
security measures are not enabled by default. In the case of complete hard disk
encryption, the tradeoffs worth mentioning the most are the following:
• Performance. Encryption and decryption consume a lot of processing power.
Since each I/O operation on the encrypted hard disk requires additional
computation, the throughput is often limited by the power of the CPU(s) and
not the bandwidth of the storage medium. Especially write operations, which
must be encrypted, are noticeably slower than read operations, where
decryption is performed. Systems which must frequently swap out data to
secondary storage and therefore usually to the encrypted hard disk can suffer
from an enormous performance penalty. In cases where performance becomes
too big a problem it is suggested that dedicated hardware be used for
cryptographic operations. GELI supports this by using the crypto(9) framework,
GBDE unfortunately does so far not allow for dedicated hardware to be used
and must therefore rely on the CPU(s) instead.
• Convenience. Each time the system is booted, the user is required to attach or
insert the removable medium and enter the passphrase. Booting off a
removable medium is usually slower than booting from a hard disk and the
passphrase introduces an additional delay.
• Administrative work. Obviously the whole scheme must first be set up before it
can be used. The majority of this quite lengthy process must also be repeated
with each system upgrade as the code on the removable medium must not get
out of sync with the code on the hard disk. As this setup or upgrade process is
also prone to errors such as typos, it may be considered an additional risk to the
data stored on the device.
22
This list is by no means exhaustive and every user thinking about using complete hard
disk encryption is strongly encouraged to carefully evaluate its benefits and drawbacks.
5 Conclusion
Mobile devices are intended to be used anywhere and anytime. As these devices get
increasingly sophisticated, they allow the users to store massive amounts of data – a lot
of which may often be sensitive. Encrypting individual files simply does not scale and on
top of that does nothing to prevent the data from leaking to other places. Partitionbased
encryption scales much better but still, a lot of information can be compiled from
unencrypted sources such as system log files, temporary working copies of opened files
or the swap partition. In addition to that, both schemes do nothing to protect the
operating system or the applications from being compromised.
In order to defend against this kind of attack, it is necessary to encrypt the operating
system and the applications as well and boot the core parts such as the kernel from a
removable medium. Since the boot code must be stored unencrypted in order to be
loaded, it must be kept on a medium that can easily be looked after.
FreeBSD provides two tools capable of encrypting disks: GBDE and GELI. Complete
hard disk encryption can be accomplished by using either a memory disk as the root
filesystem and then mount the encrypted hard disk in a subdirectory or by directly
mounting the encrypted hard disk as the root filesystem.
The first approach can be done with both GBDE and GELI and has the advantage
that a lockfile or keyfile can be used in addition to the passphrase, therefore providing
more robust security. The second approach omits the memory disk and therefore saves
some administrative work. It works only with GELI, however, and does not allow for a
keyfile to be used – therefore requiring a tradeoff between better usability/maintain
ability and security.
23
Under no circumstances does complete hard disk encryption solve all problems
related to security or protect against any kind of attack. What it does protect against, is
attacks which are aimed at accessing data by reading out the contents of the particular
hard disk on a different system in order to defeat the original defenses or to compromise
the operating system or applications in order to leak the encryption key or the encrypted
data itself.
As with any security measure, complete hard disk encryption requires the users to
make tradeoffs. The increase in security comes at the cost of decreased performance,
less convenience and more administrative work.
Complete hard disk encryption makes sense if an unencrypted or partially encrypted
hard disk is the weakest link to a particular kind of attack.
24
Noguchi, 2005
Y. Noguchi, Lost a BlackBerry? Data Could Open A Security Breach
http://www.washingtonpost.com/wpdyn/content/article/2005/07/24/
AR2005072401135.html
July 25, 2005
OpenBSD, 1993
vnconfig configure vnode disks for file swapping or pseudo file systems
OpenBSD manual page
http://www.openbsd.org/cgibin/man.cgi?query=vnconfig&sektion=8&arch=i386&
apropos=0&manpath=OpenBSD+Current
July 8, 1993
Reuters, 2005
Reuters, Stolen PCs contained Motorola staff records
http://news.zdnet.co.uk/internet/security/0,39020375,39203514,00.htm
June 13, 2005
Sarche, 2005
J. Sarche, Hackers hit U.S. Army computers,
http://www.globetechnology.com/ servlet/story/RTGAM.20050913.gtarmysep13/
BNStory/Technology/
September 13, 2005
25