15 easy fixes for Mac security risks (from macworld.com)

No replies
neotek's picture
SX Retired
Joined: 2008/06/11

**NOTE: I did not write this, it's just some copy pasta**
(from http://www.macworld.com/article/140268/2009/04/macsecurityfixes.html )

Fifteen easy fixes for Mac security risks

by Ryan Faas, Computerworld

Editor's Note: This story is excerpted from Computerworld. For more Mac coverage, visit Computerworld's Macintosh Knowledge Center.

One of the commonly touted advantages to using a Mac is that it’s more secure and less prone to malware than a PC running Windows. It’s easy to see where this attitude comes from: The prevalence of viruses and network attacks against Windows machines is greater by several orders of magnitude.

In fact, a recent Trojan horse virus hidden in a pirated copy of iWork ’09 that circulated on peer-to-peer file-sharing sites was big news because it was the first Macintosh virus to be widely circulated on the Internet (though there have been a handful of proof-of-concept malware iterations over the past few years). But the much lower rate of malware and network attacks isn’t proof that the Mac is immune to such things.

Indeed, there has been an ongoing debate over the years as to whether Mac users truly have more-secure machines or simply enjoy “security through obscurity” because they represent a relatively modest fraction of all computer users. While this debate will continue—and there are valid arguments on both sides—this article isn’t about that debate; it’s about a pair of simple questions: “How safe is your Mac?” and “How can you make it safer?”

The truth is that Apple does provide a pretty safe platform. The company leverages a number of advanced technologies to keep users and their data safe from harm. For a detailed list, see this Apple white paper (download PDF). But no system is perfect, and there are a number of security holes—many of them easily closed—that are common on Mac OS X systems. Here are 15 ways to fix the most frequently exploited security risks and protect your Mac.

Note: Unless we specifically say a tip applies only to Leopard, it should work with most recent versions of OS X, though the actual steps involved might vary somewhat.

Disable automatic opening of “safe” downloads in Safari

Probably one of the biggest Mac holes is in Apple’s Safari Web browser, which downloads files that you click on or that are embedded in a Web page. That presents a problem because, by default, Safari is designed to open “safe” files as soon as they’ve been downloaded. Unfortunately, the definition of “safe” includes package-installer and disk image files, which can contain malware. If the malware files are embedded in a Web site, they could be downloaded and opened automatically.

Apple has done a good job of combating the potential damage in Mac OS X Leopard, which automatically detects disk images and applications that have been downloaded from the Internet via Apple’s applications (Safari, Mail and iChat). However, to be truly safe, one of the best and easiest things you can do is disable the automatic opening of such files in the Safari preferences.

From the Safari menu in the menu bar, select Preferences, click the General tab, and uncheck “Open ‘safe’ files after downloading.” From now on, you’ll need to manually open downloaded files by double-clicking them in your Downloads folder or in Safari’s list of downloaded items.

Make sure not to click the “Do not show” option in the warning dialogs that Leopard displays when you open downloaded files; that way, you’ll always be warned the first time each downloaded item is opened. (Note: This tagged file feature was introduced in Leopard and doesn’t apply to earlier versions of Mac OS X.)

A similar security feature in Leopard is support for code signing, which places a digital signature in application files; your Mac checks them at launch to be sure that they haven’t changed and alerts you if they have. Although many third-party applications don’t yet support this, it is a powerful feature, and you should pay attention to any such warning. As with the tagging of downloaded files, do not click the “Do not show option” if you do see one of these alerts.

Install antivirus software

The limited number of viruses that target Mac OS X often leads Mac users into a false sense of security. Although there are few Mac viruses out there now, that doesn’t mean there will never be a virulent form of malware that threatens the Mac. And the lackadaisical approach of assuming that Macs can’t be infected by a virus increases the chances of widespread infection and damage when (not if) such a virus is developed and released into the wild of the Internet.

Besides, even if it doesn’t affect you directly, you might receive and inadvertently pass on a Windows-specific virus. The most common of these are macro viruses found inside Office documents—some of which have a limited ability to affect machines with a version of Office for Mac that has macro support enabled.

Finally, if you are running Windows—either in a dual-boot configuration with Apple’s Boot Camp or under a virtualization tool such as Parallels Desktop—your Mac is just as susceptible to viruses as any PC. In fact, if you have a Windows operating system on your Mac, you should really consider virus protection for both Mac OS X and Windows.

When it comes to antivirus programs for the Mac, a good open-source option is the Unix-based ClamAV (which works with Mac OS X but is command-line based) and its Mac graphical user interface port ClamXav.

If you want a more full-featured commercial offering that provides constantly running protection, check out Intego Systems’s VirusBarrier ($70 for one device; $200 for up to five devices), Sophos Anti-Virus SBE (variable pricing depending on number of users and years of service, beginning around $45 for a single license or $190 for five users), Norton AntiVirus from Symantec ($50 for one user) or McAfee’s VirusScan ($37 per device for up to 25 devices).

Don’t allow remote guest access or enable Leopard’s guest account

Macs have always supported guest access for file sharing, in which a remote user can connect to a Mac without providing a username, password or other identifying information. The idea of allowing remote access to your Mac has always been fraught with potential for security compromises. It should never be allowed because it presents a grave security threat that could prevent you from easily tracking the source of a breach.

In Leopard, Apple extended guest access to the local level: Users can log in and use a Mac with a guest account that requires no username or password. The idea of a guest account is a convenient one. If you have friends or family visiting, you can let them use your Mac without allowing them access to your user account or files. When they log out as a guest, their home folder and any files they created are automatically deleted.

There are, however, some system directories, such as the Unix /tmp directory, that the guest account can write data to that may or may not be deleted at logout (or forced restart). The guest also has access to any installed applications, which could be used to perform malicious actions from your computer. If you must use the guest account, limit its access using Parental Controls.

You can turn off both the guest account and remote guest access in the Accounts pane of System Preferences in Leopard. Select Guest Account on the left, then uncheck both “Allow guests to log into this computer” and “Allow guests to connect to shared folders.”

If you’d rather keep the guest account but limit its access to files and apps, keep “Allow guests to log into this computer” checked and click the Open Parental Controls button for options.

Use secure passwords

User passwords are one of the foundations of security. If you use a password that is simple or easy to guess, you’re just asking for someone to break into your computer or user account.

Mac OS X includes a password assistant that automatically generates random passwords according a specified level of complexity; it also checks the complexity of passwords that you create. Make use of this feature whenever you need to generate a password — for Web sites or other services as well as for your Mac OS X user account.

To get to the password assistant, go to the Accounts pane in System Preferences, select a user account, click the Change Password option, and then click the button with a key icon next to the New Password field.

Even the most complex password can be cracked, however, so remember to change your password frequently. If you don’t trust yourself to remember, try setting a monthly reminder in iCal.

Disable automatic log-in

As part of the Setup Assistant that runs when you install Mac OS X or start up a new Mac, Mac OS X enables automatic log-in for the first user account that you create—which means you can log in without providing a username and password whenever you start up.

While automatic log-in is convenient, particularly if you’re the only user of your Mac, it also means that anyone who has physical access to your Mac can simply restart it to gain full access to your account and your files. This is a particularly significant risk for Mac laptop users.

You can disable automatic log-in in the Accounts pane of System Preferences by clicking the Login Options button at the bottom of the user accounts list on the left. The automatic log-in option appears at the top of the area on the right; select Disabled from its pop-up menu.

Don’t display usernames or password hints at log-in

By default, Mac OS X’s log-in window displays a list of all users on a Mac (or all users who can access a Mac in a network). This makes it easier for anyone who has physical access to a Mac to gain access to it, since they need only guess a password. Disabling the display of users adds another layer of security because it requires that a malicious user know the username associated with an account.

Another simple act to help secure an account is to disable password hints (which Mac OS X will normally display to help you remember your password after three failed log-in attempts). This significantly undermines the security of using a password and should always be disabled.

Both of these options can be configured in the same Accounts pane where you disabled automatic log-in. To disable password hints, simply uncheck the box next to “Show password hints.” To choose not to display usernames in the log-in window, select the “Name and password” radio button next to “Display log-in window as,” which means users will have to type both a username and its password to log in.

Set a firmware password

The biggest security risks occur if your Mac is stolen or physically compromised. Even if thieves can’t log into your account, they can gain access to the data on your Mac using one of the many special start-up modes built into all Macs, such as booting from an install DVD and resetting your password, using Target Disk Mode to make your Mac act as an external hard drive, or booting into the Unix-style Single User Mode.

You can, however, place a firmware password on your Mac. This password is written into the firmware chips on the Mac’s motherboard using either the Open Firmware standard on PowerPC Macs or Extensible Firmware Interface (EFI) on Intel Macs. Regardless of platform, the free tool from Apple for implementing a firmware password is called the Open Firmware Password Utility. Apple provides complete steps for setting a firmware password on its support site.

If you or anyone else tries to use a special start-up mode, the user will be required to enter the firmware password. This can significantly secure personal, business or educational Macs against tampering. However, be warned that if you forget a firmware password, there is no way to reset or remove it.

Use the Security pane options in System Preferences

The Security pane in System Preferences offers Mac users a number of simple but powerful options for securing their systems—requiring a password for waking from sleep or a screensaver, disabling automatic log-in (and thus requiring authentication at start-up), requiring an admin account username and password to modify settings in System Preferences, automatically logging out after a period of inactivity, and disabling the use of Apple’s infrared remotes with the computer or pairing the computer to only one specific remote.

Each of these can go a long way to securing access to your data if someone has physical access to your Mac. This is particularly important if you have a Mac laptop or are working with a Mac that offers any form of public access.

The option to use secure virtual memory is also located here. When secure virtual memory is enabled, the swap file that a Mac uses to store running data if it begins to run short of RAM will be encrypted. This drastically reduces the chance that if a Mac is physically compromised, any data for active applications or processes will be retrievable. This is important because virtual memory may contain sensitive information that can be used to compromise a Mac even if data on a drive is secure.

Disable unused network interfaces

If you look in the Network pane of System Preferences, you’ll notice that most Macs include multiple network interfaces, such as Ethernet, AirPort/802.11, FireWire and Bluetooth. In theory, any active network interface could be used to access your Mac in a remote attack—particularly wireless technologies, which don’t require a physical connection to a network.

For this reason, it’s a good idea to disable any interfaces you’re not using to connect to a network or the Internet. To do so, launch System Preferences, and select the Network pane. Select each interface you want to disable, and for each one, select the button that looks like a gear at the bottom of the interface list, and choose Make Inactive from the pop-up menu.

This disables the interface, but doesn’t delete it—so you can easily change it back to Make Active to restore access to the interface.

Make use of encryption options

Mac OS X offers a number of options for encrypting your data to prevent access to it if your Mac is lost or stolen. I’ve already touched on a couple of these, but the biggest example is FileVault, which can also be activated and managed from the Security pane in System Preferences.

FileVault converts your entire home folder into an encrypted disk image. The image is mounted and accessible only when you are logged in. At all other times, it is unreadable. FileVault uses industry-standard encryption, and if you use Time Machine, any backups of your home folder’s contents are equally encrypted.

Note: FileVault must be enabled by each user who wants to have an encrypted home directory. Each home directory will be encrypted as a separate disk image file.

FileVault supports the use of a master password as a safety net that can be used to reset user passwords and access encrypted home folders if users forget their passwords. If both a user password and a master password are lost or forgotten, however, there is no way to retrieve data from the encrypted home folder.

To enable FileVault, launch System Preferences, select the Security pane, and then select the FileVault tab. You can set or change a master password using the Change button next to the master password description. (You must be an administrative user of the computer to do this, and you must know the current master password if one is already set.)

Next, click the Turn On FileVault button. Enabling FileVault for the first time can take a significant amount of time because the entire contents of your home folder are copied into a newly created encrypted disk image. If you have tens or hundreds of gigabytes of data, this could take hours or even days (much like an initial Time Machine backup).

For this reason, it’s easiest to set up FileVault when you first create a user account (and thus there is little data in the home folder). During this initial copy, you will also need to ensure that you have at least as much free space on your hard drive as the size of your home folder, since all the data will be copied. Once enabled, FileVault encrypts and decrypts items on the fly when you log in or log out, and it generally won’t slow down performance significantly.

Disk Utility also lets you create encrypted disk images. Disk images look and act like virtual hard drives and can be created as blank images or copies of existing disks or folders. Mounting an encrypted disk image and accessing the contents requires a password. This makes encrypted disk images helpful if you want to secure only a portion of your files, if you need to securely store files outside your home folder, or if you need to securely share files by e-mail or other mechanisms.

To create an encrypted disk image, launch Disk Utility, and click the New Image button in the tool bar. You can select the size, name (which will be displayed as a disk/volume name when image is mounted), file name and location of the image file itself, and various other disk format options (which can typically be left as their default selections). To enable encryption, choose 128-bit or 256-bit AES encryption from the Encryption pop-up menu.

After you’ve made your selections, click the Create button. When Disk Utility creates the image, it will prompt you to enter and verify a password that will be required to open the disk image file. The password assistant is available in this prompt (in the form of a button with a key icon, just as when changing a user account password).

Use Keychains wisely

The Mac OS X Keychain is a feature that securely collects passwords for a vast number of functions—including e-mail and instant messaging accounts, Web services, Wi-Fi networks and file servers. The Keychain stores this information in encrypted format and is decrypted only when you provide a master password.

Keychains can also contain encrypted notes (such as bank account information) and security certificates, all of which can be accessed and managed from the Keychain Access application in the Utilities folder on your Mac. In the Keychain Access window, right-click or control-click on an available Keychain to change the password, lock the keychain or alter settings that will cause the keychain to lock automatically. You can also create or delete Keychains here.

By default, each user account has a Keychain associated with it that is unlocked with the user’s password at log-in. If a user’s password is reset through a method other than the Accounts pane in System Preferences (such as by an administrator account or from the Mac OS X Install DVD), the account and Keychain passwords will become out of sync. You can fix this by manually changing the Keychain password to match your log-in password, or you can reset the Keychain using Apple’s Keychain First Aid feature, which can also help troubleshoot other types of Keychain problems.

Keychains offer both security and convenience. You can improve security by using multiple Keychains (each of which contains different information) with different passwords or by simply changing your account’s Keychain password. This ensures that even if your user account password is compromised, the data in your Keychain(s)—including passwords to other services—will remain securely encrypted. As with a firmware password, if you forget a Keychain’s password, its contents will be irretrievable.

Get the most out of Leopard’s firewall

Mac OS X has included an optional firewall for some time, traditionally based on the open-source Unix ipfw firewall. Leopard introduced a newer, dynamic firewall option. This new firewall (click the Firewall tab in the Security pane in System Preferences) is straightforward, which is helpful for users who simply want their computers protected without having to create and manage complex firewall rules.

You can choose to block all incoming traffic, which prevents your Mac from accepting any data that it didn’t explicitly request, such as a Web page. You can also allow only core system services to accept incoming data or allow access based on specific applications or system processes.

This last option is the most commonly used, and it will cause Leopard to alert you any time an application wants to accept nonrequested incoming data. If you allow incoming data for an application, it gets added to the list of allowed applications. Applications such as iChat require incoming connections to function properly.

You can use the list in System Preferences to selectively remove applications from the allowed list or even just as a quick way of verifying which applications are on the list. You can also change an allow rule into a block rule, which will prevent an application from receiving incoming data or asking you to allow access.

Two other options—enable logging and enable stealth mode—are available via the Advanced button. Logging, as you might guess, logs all traffic that is received by your Mac and how that traffic is filtered. Stealth mode will cause your Mac to ignore ping requests from other computers and prevent outside users from easily detecting your Mac on a network. This increases security but can also limit the effectiveness of remote troubleshooting of network problems.

Leopard’s new dynamic firewall interface is really a simple way to establish basic firewall rules. Connections are still evaluated based on the network port numbers used by each request, but the firewall has been made much simpler for everyday users to enable and configure. For power users, the full ipfw suite, which lets you develop much more complex firewall rules, is still included as part of Leopard and can be accessed via the Terminal. And as with any computer, you can use port-scanning tools to verify the effectiveness of your firewall configuration in shielding your Mac.

One reason to understand and use the firewall is the common use of public Wi-Fi networks. Such networks are often unprotected, meaning that any data you exchange over the network can easily be snooped on. However, it also means that any malicious user connected to the same network has the capacity to port-scan your Mac and attempt to determine vulnerabilities. Working with the firewall and enabling stealth mode are two good ways to protect your Mac in these situations.

Delete files and erase disks securely

While you may think that you’re permanently deleting files when you empty the Trash or erase a disk using Disk Utility, the truth is that you aren’t. You’re really just marking the disk sectors where files were stored as available to store new data. Until the disk space occupied by the “deleted” files is overwritten at least once, many hard drive recovery and forensic tools can recover deleted files.

Fortunately, Macs offer a couple of ways to ensure that deleted data stays deleted. First up and simplest is the Secure Empty Trash command, located just under the normal Empty Trash command in the Finder’s File menu. This performs a simple overwrite of the disk sectors containing any files being trashed. In some instances, serious forensic investigators could reconstruct files that have been overwritten with a single pass, but for most users, this option offers ample security by preventing easy recovery of deleted items.

If you really want to ensure that items can’t be recovered, Disk Utility’s secure-erase features allow you to erase an entire disk or the free space of a disk, which includes both disk space that was never used and space where files had existed before being deleted.

Whether you’re erasing the entire disk or just the free space, you can choose to securely erase data with a single pass of blank data (also known as zeroing out a disk), seven passes or 35 passes. A seven-pass erase meets U.S. Department of Defense standards for secure data removal; a 35-pass erase typically takes hours or days to complete but will ensure that nothing is recoverable. When erasing an entire disk, click the Security Options button to choose the number of passes; when erasing free space, click the Erase Free Space button to see these options.

To use either feature, select the hard drive or volume that contains data you want to erase securely in the list to the left of the Disk Utility window, then select the Erase tab on the right side. If you want to erase only free space, click the Erase Free Space button.

To erase an entire disk/volume, click the Security Options button, select the number of passes to be made, and choose the appropriate disk format and the name for the newly erased disk. Then click Erase to erase the disk. (Note: You can’t erase the start-up disk that a Mac is using — if you want to securely erase the primary/startup drive, you’ll need to boot from an alternate disk, such as an external hard drive or the Mac OS X Install DVD.)

Don’t share anything you don’t have to

Macs offer users a lot of ways to share information. The Sharing pane in Leopard’s System Preferences offers 11 different choices (though one them, Xgrid computational cluster sharing, isn’t likely to be used by the majority of people).

The list ranges from general file and printer sharing to remote log-in and control of your Mac using Leopard’s screen sharing, Apple Remote Desktop, and secure shell (SSH) command-line access. Even personal Web site hosting (Internet sharing) and Bluetooth sharing are supported, as are Remote Apple Events, which allow applications on one Mac to trigger actions on another.

The simple advice here is “Don’t enable any type of sharing you’re not actively using.” Every time you enable sharing of any service, it opens up an avenue for someone to remotely access and/or manipulate your Mac. This could mean accessing shared files or taking complete control of the computer. If you need to share something, then by all means do so—but if not, keep everything as locked down as you can.

Another danger is the Back to My Mac service offered by Apple’s MobileMe, which lets your MobileMe account automatically connect you to your Mac using file, printer or screen sharing over the Internet. This is a highly convenient feature, but not only does it rely on leaving sharing services running and open; it also relies on making those services accessible from the Internet at large. If your MobileMe account is compromised, then so is your entire Mac.

If you need to enable sharing, and chances are that you will at some point, do it in as restrictive a manner as possible. Virtually every sharing service offers at least minimal controls. In the case of DVD and CD sharing, you can opt to have your Mac ask you before allowing remote access. In the case of many services that are user-based, you can choose which users are allowed to access the service remotely.

Most importantly, in the case of file sharing, you can designate both which folders are shared and who has access to those folders. Even though the default setting is to allow all users access to the general Shared folder and to allow everyone access to the Public folder inside each user’s home folder, you can add and remove specific folders from the list of those being shared. Share only what is needed, and limit access to as few users as possible.

Also, keep in mind that anyone connecting to a remote Mac using an administrative account will be able to mount not just the explicitly shared folders, but any connected hard drive. This is another reason to disable file sharing if it isn’t needed and to be sure you use good password policies for admin users. (It’s also a good reason to create administrative accounts with names other than “admin” or “administrator.”)

On a final note about file sharing, Mac OS X supports file sharing with three different protocols: AFP (the native file-sharing protocol for Macs), SMB (the native protocol for Windows) and FTP. You can select which ones to enable using the Options button in the Sharing pane in System Preferences.

SMB must be enabled for individual users because it stores passwords in less secure form on your Mac (though it still encrypts their transmission over the network). FTP should be avoided because it offers no encryption whatsoever. Again, limit the protocols to those you need, and leave the others disabled.

Disable Bonjour

Bonjour is Apple’s zero-configuration networking system that allows Macs ( and PCs and iPhones) to automatically broadcast resources they are sharing over a network and to discover resources shared by other devices. Bonjour can be used for file sharing, printing (many printers ship with Bonjour built in), sharing of iTunes libraries, instant messaging without the use of an IM service, and many other things.

Since Bonjour works by your Mac broadcasting its presence and its available shared resources, it can easily alert malicious users not only to its location, but also to vectors that can be used to target it for attack. Most applications that support Bonjour also allow you to disable Bonjour broadcasting, though you may need to dig around in their Preferences to find the option.

As with sharing services, if you don’t need Bonjour for an application, turn it off. If you want to see which applications on your Mac are actively advertising themselves using Bonjour, check out the open-source Bonjour Browser, which lists the various Bonjour services actively running at any one time. You can use this to determine which applications to disable Bonjour support in. (One of the most common is iTunes, which uses Bonjour to share libraries, locate/sync to Apple TVs, and remotely control Apple’s Remote application for the iPhone and iPod Touch.)

You can even go a step further from the command line, where you can disable Bonjour as a whole. Ali Karbassi provides instructions on his blog.

Keep your software up to date

The most important security option available to Mac users is keeping software up to date. This applies to Mac OS X itself, Apple-branded applications and any third-party apps on your system. Maintaining an up-to-date operating system and application set means that publicly known vulnerabilities are more likely to have been patched in the software on your system.

The Mac’s built-in Software Update feature checks for updates to OS X and Apple applications on a weekly basis by default, and it notifies you when updates are available—which lets you choose whether to download and install them all immediately or to wait until a later time.

You can also choose to check monthly or daily, or disable automatic checking altogether (not recommended), using the Startup Disk pane in System Preferences. Another option is to have critical updates such as security updates downloaded automatically; you’ll be informed when the download has been completed and is ready for installation.

The Software Update pane also lets you check for updates at any time (which can also be done via the Apple menu) and view a list of updates that have been installed on your Mac.

Most third-party apps include an option to check for updates each time they are launched. This should be left enabled because updates often improve performance, stability and security. VersionTracker Pro ($30 for up to three Macs) and the free App Update Dashboard widget are two utilities that can help ensure that all applications on your Mac are up to date.

Additional resources

Although this article covers the most common ways in which Macs are left vulnerable, it is by no means a complete guide to Mac security. More information is available from the following sources:

* Corsaire ‘s “Securing Mac OS X Leopard” white paper (download PDF)
* Apple’s Mac OS X Security Configuration Guides
* Mac OS X Security Updates
* SecureMac.com
* Home PC Firewall Guide’s Macintosh Security Guide
* Intego’s Mac Security Blog

Life is just a dream that seems never ending...