This chapter is from the book

This chapter is from the book

To have a secured workstation, all aspects of the machines' security
need to be considered. From physical security to account management to boot
options, the quality of the base configuration of your operating system makes a
huge difference in the overall security of the host. There are many analogies
that can be used to describe the need for secure OS configuration; A house needs
a solid foundation to survive a storm, a chain is only as good as its weakest
link, a tree with shallow roots is easily toppled. Regardless of which analogy
you prefer, realize that the more effort and attention to detail you provide to
your base configuration, the more secure and reliable your host will be.

This advice holds particularly true for Mac OS X. OS X is a powerful, modern
operating system with a UNIX core. When using the operating system for
day-to-day activities, it is easy to use and provides a stable platform for
your applications. However, in the hands of a malicious user attempting to gain
access to your data or resources, it is powerful and dangerous. Through proper
configuration and maintenance, your Mac OS X workstation can provide a stable
and secure platform for your applications.

Mac OS X as it ships out of the box is designed to be user friendly. However,
to be user friendly, some sacrifices have been made that make it less secure.
Also, there are some common configuration practices that can further reduce the
overall security of the core operating system. This chapter presents techniques
that you can employ that make Mac OS X more secure and have a minimal impact on
the usability of the system.

Concerns About Physical Access

Physical security is a trait often overlooked when attempting to secure a
host. However, it is an important aspect of information security. Lack of
physical security in a workplace can allow illicit and almost untraceable
access. According to various reports, between 38% and 70% of all computer
attacks are insider attacks. Insider attacks are violations of the
security of a resource by someone within your organization. These attacks are
common because not only will an insider potentially have the motivation to
attack, they will have easier access to trusted resources than an outside
entity. Controlling physical access to a host is the first step in preventing an
insider attack.

Physical Security in the Workplace

At a previous job, one of us (Bruce) shared an office with seven other system
administrators. They worked around the clock on a shift basis, so it was not
unusual for only one or two people to be in the office at a time. This gave some
workers unsupervised physical access to their coworkers machines for hours on
end. They took great joy in breaking into each others' computers and
performing various acts of mischief. Over time, the administrators became
skilled at locking down their workstations to make it difficult for those trying
to play tricks on them. It was increasingly a real cat-and-mouse game as their
defensive and offensive skills became refined.

In the end, the activity caused the workers to become much more security
conscious and better administrators. Luckily, they were all friends and knew
their boundaries with each other and the company. However, if the situation had
been slightly different and there was a malicious user in the group, there could
have been great harm done. It is easy to imagine situations where someone could
impersonate a coworker in an effort to get them fired or harm the company. Many
insider attacks are actually due to a disgruntled employee. Physical security is
not simply a matter for data centers and security systems. It is something every
employee needs to be concerned with.

Doors, Locks, and Guards

The first step in keeping a machine secure from prying fingers is keeping the
host in a restricted location. How restricted you keep the host depends on the
risk and potential loss of someone gaining illicit physical access. Depending on
your level of risk, you may use locked doors, electronic security systems, or
even armed guards. Even in an office environment, a coworker may be your worst
enemy. Simply closing and locking your office door while you are away from your
host may be enough to keep your machine secure from prying hands and eyes.

Remember, you are not securing only your host. Any resource your host can
access is vulnerable if your host is compromised. Your host is only a link in a
chain.

Open Firmware Password

Assuming someone gains access to your host, all is not lost. There are ways
to prevent a person from gaining various types of access. Unfortunately, there
are things that you can't stop. A malicious user can steal a whole machine
or open it up and steal sensitive parts such as the hard drive or other storage
media. Some computer cases have locks or places where antitheft devices can be
attached. These mechanisms can make theft much more difficult for the casual
attacker. The antitheft techniques differ from machine to machine, so consult
the documentation that came with your computer.

Your Mac's bootstrapping process is controlled by something called Open
Firmware. Open Firmware is a small program contained on a chip within your
computer that controls its boot process. Open Firmware was developed many years
ago and is used for many different computing platforms, including Sun and
Apple's Macintosh series. It is similar to a BIOS on a PC but provides much
more functionality and extensibility than a typical BIOS implementation.

Newer versions of Open Firmware password-protect your boot process. To make
use of this functionality, you must be running Open Firmware version 4.1.7 or
newer. You can find what version your machine is running by launching System
Profiler and looking for the Boot ROM Version section (see Figure
3.1). If you need to upgrade your Open Firmware, go to http://www.info.apple.com/
and search for the correct upgrade based on your platform. Alternatively, firmware
updates are also available on your Mac OS X 10.2 installation CD.

After you have updated your machine, download the Open Firmware Password
application from
http://docs.info.apple.com/article.html?artnum=120095
or install it from the Mac OS X 10.2 installation CD. This application allows
you to password-protect certain functions of Open Firmware when the system is
being booted, including

Booting to CD-ROM, NetBoot, or a specific disk

Booting in verbose mode

Booting into single user mode

Booting to the Open Firmware prompt (Command-Option-O-F at startup) and
issuing commands

Figure 3.2 shows the Open Firmware Password
utility in action. Be sure you use a difficult-to-guess password.

These features are great in a lab environment when a normal unattended boot
is desired, but booting to a CD would generally only be done by a malicious
user. Unfortunately, many people would like to have a higher degree of security
by requiring a password at boot time to simply bring the operating system up.
This functionality is analogous to a POST password on a PC. Although Apple does
not supply a tool for directly configuring a boot password, Open Firmware does
support this concept.

nvram is a program accessible via the Terminal program that displays
the contents of many variables stored within Open Firmware. Running it as a
normal user allows you to view the public values and not modify any of the
values. Running it via sudonvram prints any private fields,
such as the password, and allows modification of the Open Firmware contents. The
p flag prints the contents of Open Firmware:

Rather than use the nvram command, a machine can be booted directly
to the Open Firmware prompt. Pressing Command-Option-O-F as a machine is being
booted, bypasses the normal boot process and provides you with a prompt that
directly controls Open Firmware. The security mode can be reset to none by
issuing the setenv security-mode none command at the Open Firmware
prompt. printenv displays all Open Firmware variables. Typing
reset-all reboots the host after resetting the password. For a complete
discussion of Open Firmware commands, see Apple Tech Note 1061 at
http://developer.apple.com/technotes/tn/tn1061.html.

The security mode set by the Apple Open Firmware Password application is set
to command. This provides the level of functionality listed earlier. To
set the security mode to the original value that shipped with your machine,
execute sudo nvram security-mode="none". To enable password
protection for all Open Firmware activities, including booting to the
default disk, set the security-mode to full. This forces a user who
wants to boot a machine to know the Open Firmware password to access the normal
operating system. To make brute forcing the password unlikely, be sure to set a
password that is difficult to guess and contains a variety of characters.

NOTE

The security password displayed by the nvram command is not a
cryptographically secured password. The password is simply displayed in its
hexadecimal representation. This is merely an obfuscation of the password, not
actual protection. Be aware that a user with administrative privileges can
easily decrypt this password and use it later without your knowledge.

Password-protecting Open Firmware does not ensure the host cannot be booted
in a manner counter to what you intend. An attacker who can open the case of the
computer can force a password reset. By adding or removing memory, the host is
put into a mode where it is possible to reset the PRAM by pressing
Command-Option-P-R at boot time. Once the PRAM is reset three times, the
password protection is removed. This quirk in the Open Firmware architecture
underscores the reason for physical locks on your hosts.

Also, a utility called FWSucker allows an attacker, once logged in to a host,
to harvest the Open Firmware password. Even guest users can decrypt the
password. FWSucker is available from
http://www.msec.net/software/.
Again, Open Firmware password protection must be treated as a tool in protecting
your host, not absolute protection.

Login Window

If a malicious user manages to successfully boot your machine, there are
still more configuration options that will make their life difficult. By
default, Mac OS X logs in automatically to the primary account on the machine.
This gives anyone with the capability to boot the machine full access to the
operating system. This can be disabled in the Accounts System Preferences panel.
Under the Users tab, uncheck the line labeled Log in Automatically as
[username]. This causes a login window to be displayed after the next boot.

In the Login Options tab (see Figure 3.3),
there are several other default options that should be changed. The Login Window
can display a list of user accounts on the machine and allow you to select one
or it can simply display a blank username input field. By selecting Name and
password you force a local attacker to know both the account name and
the password. This might not be a huge barrier, but it is one more thing the
attacker must know. Please note that starting in Mac OS X 10.2, the previous
login name is not shown.

You also might want to check the Hide the Restart and Shutdown Buttons check
box. This prevents users from shutting down or restarting the machine by one
mouse click from the login screen. However, be aware that the power button still
works so it is still possible to power off the machine.

Finally, uncheck the check box for Show Password Hint After 3 Attempts to
Enter a Password. Selecting this causes the hint that was entered when the user
was created to be displayed on the login screen. This can be handy if you have
forgotten your password, but it can also be handy for an attacker. Make a point
of remembering your password and you will need this option. Besides, after you
get used to logging into your machine, entering your password will become second
nature to you.

Screen Locking

All these configuration steps are useful if an attacker gains access to a
host that is powered off. Things are a bit different when you are logged into a
host and have stepped away for a moment. If you leave your machine unattended
while you are logged in, you have bypassed all boot security mechanisms for an
attacker with physical access.

Luckily, the screen saver for Mac OS X can be password-protected. Under the
Activation tab in the Screen Effects Preferences panel there is a radio button
to force the screen saver to ask for your password when normal operation resumes
(see Figure 3.4). This effectively locks
the screen while Screen Effects are active. There is also a slider on the same
tab that controls how long the machine needs to be idle before the screen is
locked.

This timer is great in instances when you forget to lock your workstation.
However, it is not practical to stand watch over your machine for a series of
minutes while you wait for Screen Effects to turn on. On the Hot Corners tab of
the Screen Effects Preferences panel you can specify a corner (or corners) where
you can drag your mouse to lock your screen. This allows you to lock your
workstation at will without having to wait.

Mac OS X Screen Locking

Mac OS X screen locking is not as robust and secure as other operating
systems' locking mechanisms. Under Windows XP you must press
Control-Alt-Delete, a special key sequence that sends an interrupt to the core
processor to make sure some other application is not pretending to be the
Windows Lock screen. OS X has no such mechanisms. In fact, you can send some
commands to the operating system while the screen is locked. For instance, you
can force the system to take a screen capture of the lock screen by pressing
Command-Shift-3. It is obvious that the OS X password protected Screen Effects
does not provide the highest level of security in locked screen. However, it is
important to note that the attacker at this point would have physical access
anyway so even a bulletproof screen lock can be bypassed with a screwdriver and
a few minutes to pry out the hard drive.

System Preferences Locking

You may have noticed a lock in the bottom-left corner of some System Preferences
panes. The capability to lock a preference pane is present in the Network and
System panes primarily and may also be available in panes provided by third-party
software. This lock enables you to password-protect sensitive system settings,
preventing unauthorized or unintentional changes. By clicking the lock within
a pane, users of the workstation cannot change the configuration of that pane.
When a change needs to be made, click the lock again and you will be prompted
for a username and password. Type the credentials of your administrative user
account and the pane will once again allow modification. Figure
3.5 shows a pane as it looks before and after locking has been utilized.
The locking mechanism provided by the preferences lock only applies to the current
user. It is not a global lock for all users, therefore its utility is limited.
Use specific attributes for user rights to control their ability to modify Preferences
panes. See User Accounts and Access Control later in this chapter for more information
on per user access control.