Because the UNIX system was originally designed by programmers for use by other programmers, it was used in an environment of open cooperation where security was of minimal concern. Now that its use has spread to universities, businesses, and government, the confidential and sensitive nature of the data stored on UNIX systems has made the security of these systems of paramount importance.
Despite all the technical papers and workshops on UNIX security, this book is unique. UNIX System Security is the first up-to-date source to provide the UNIX system user or administrator with the information needed to protect the data and system from unauthorized use. By following the procedures described in this book and making use of the C programs and shell scripts provided as examples, you can protect your UNIX system from most attackers.
The author begins by examining four high-profile breaches of UNIX security as illustrations of how a UNIX system can be attacked. He then provides the information necessary to protect against these forms of attack, and offers the tools that can be used to do so. Focusing on the most recent release of Berkeley and System V UNIX, and such vendor derivatives as SunOS and ULTRIX, the book gives information that can be applied to any version of UNIX since Seventh Edition.
Issues discussed include account and password security, securing the file system, encryption and authentication systems, TCP/IP network security, the Network Information Service (NIS), NFS, RFS, workstation security, terminals and modems, and UUCP. Other chapters describe how to respond if your system is attacked and how to develop a comprehensive security policy for your organization. The book also gives comprehensive lists of freely available security software, and publications and mailing lists dealing with UNIX security.
"UNIX System Security should become popular among site administrators struggling to get a handle on security needs - especially since most vendor-specific manuals don't cover those well-known security 'holes' which can cause grief."
-Dr. Dobb's Journal
"David A. Curry's UNIX System Security: A Guide for Users and Administrators is highly recommended. This should end the morbid joke that UNIX Security books belong to the 'thin-book' category that includes The Dan Quayle Spell Checker and The Woody Allen Family Values Guide."
-Stan Kelly-Bootle, UNIX Review
"UNIX System Security: A Guide for Users and Administrators by David Curry, provides a comprehensive overview of key issues and offers practical advice for making UNIX systems more secure."
"UNIX System Security: A Guide for Users and Administrators by David A. Curry, presents a rigorous look at security issues on BDS 4 and Systme V Release 4, enlivened by references to four well-known security breakdowns from real life."
"UNIX System Security is so clearly written that even some of the more complex topics become easy to understand, and there are sections that even the most inexperienced user will comprehend. Curry has provided an essential text in security for both the beginning and experienced user."
1. UNIX Security Stories.
The Internet Worm.
The Wily Hacker.
A True UNIX Trojan Horse.
Attacking UNIX with Viruses.
2. Account Security.
Group Accounts vs. Groups.
Protecting an Account.
Monitoring Account Security.
3. File System Security.
The umask Value.
The write System Call.
The Sticky Bit on Directories.
The Set-Group-Id Bit on Directories.
Set-User-Id and Set-Group-Id Shell Scripts.
Monitoring File System Security.
4. Network Security.
The inetd Program.
The File Transfer Protocol (FTP).
Forgery and Spoofing.
Sophisticated Network Attacks.
Monitoring Network Security.
5. NIS, NFS, and RFS.
The Network Information Service (NIS).
The Network File System (NFS).
The Remote File Sharing Service (RFS).
The PROM Monitor.
7. Terminals, Modems, and UUCP.
The UNIX-to-UNIX Copy Program (UUCP).
8. Responding to Attacks.
9. Encryption and Authentication.
Encrypting and Authenticating Electronic Mail.
10. Security Policies.
Establishing Policies and Why.
Access to the System.
System Staff Rights and Responsibilities.
Copyrights and Licenses.
Guidelines for the Secure Operation of the Internet.
11. Security Software.
Obtaining Fixes and New Versions.
Publicly Available Software.
RSA Privacy-Enhanced Mail.
The National Computer Security Center.
12. Obtaining Security Information.
Computer Security Incident Response Capabilities.
Forming a CSIRC.
Vendor Security Notification.
A Password Cracker.
A File System Checker.
A Complete Security Policy.
UNIX Security Checklist.
The UNIX operating system, although now in widespread use in environments concerned about security, was not really designed with security in mind (Ritchie, 1975). This does not mean that UNIX does not provide any security mechanisms; indeed, several very good ones are available. However, most "out of the box" installation procedures from companies such as Sun Microsystems, Digital Equipment Corporation, and AT&T still set up the system in much the same way as it was originally shipped 15 years ago: with little or no security enabled.
The reasons for this state of affairs are largely historical. UNIX was originally designed by programmers for use by other programmers. The environment in which it was used was one of open cooperation, not one of privacy. Programmers typically collaborated with each other on projects, and hence preferred to be able to share their files with each other without having to jump over security hurdles. Because the first sites outside of Bell Laboratories to install UNIX were university research laboratories, where a similar environment existed, no real need for greater security was seen until some time later.
In the early 1980s, many universities began to move their UNIX systems out of the laboratories and into the computer centers, allowing (or forcing) the user population as a whole to use this new and wonderful system. Many businesses and government sites began to install UNIX systems as well, particularly as desktop workstations became more powerful and affordable. Thus, the UNIX operating system is no longer being used only in environments where open collaboration is the primary goal. Universities require their students to use the system for class assignments, yet they do not want the students to be able to copy from each other. Businesses use their UNIX systems for confidential tasks such as bookkeeping and payroll. And the government uses UNIX for numerous unclassified yet sensitive purposes.
To complicate matters, new features have been added to UNIX over the years, making security even more difficult to control. Perhaps the most problematic features are those relating to networking: remote login, remote command execution, file transfer, network file systems, and electronic mail. All of these features have increased the utility and usability of UNIX by untold amounts. However, these same features, along with the widespread connection of UNIX systems to the Internet (Quarterman and Hoskins, 1986) and other networks, have opened up many new areas of vulnerability to unauthorized abuse of the system.
Over the years, a great deal has been written about UNIX system security. Papers are presented at almost every USENIX and Uniforum conference as well as others, and the USENIX Association sponsors an annual workshop on UNIX security. Electronic mailing lists exist for the purposes of reporting security problems and receiving fixes for them. Freely available software exists to analyze UNIX systems for security problems and report or correct them. But, in spite of all the work being done in this area, the results of this work have never been collected in one place, and average users or system administrators of UNIX system still do not have the information necessary to protect their data and their systems from unauthorized use.
This book provides the information necessary to protect a UNIX system from unauthorized access. The methods an attacker can use to gain access to a UNIX system are described, as well as how to defend against them. In describing the bugs and loopholes used by attackers, it is sometimes necessary to provide information on how they are used. However, we try to strike a midway point between providing enough information so that the reader can understand the problem, while not providing enough information for an attacker to use the text as a cookbook for breaking into systems.
The primary focus of the book is on the most recent versions of UNIX (4.2BSD and 4.3BSD from Berkeley) and their most recent vendor derivatives (SunOS4.x, ULTRIX 4.x, etc.), and System V Release 4 from AT&T . However, most of the information presented can be applied, with minor changes, to any version of UNIX since Seventh Edition. An attempt has been made to make the shell scripts and C programs used in the examples as portable as possible by avoiding many of the "convenience" features added in some versions of the operating system. While this means that some of the examples are not as efficient or "clean" as they could be, it also means that they will work on more systems. Industrious readers may feel free to recode any of the examples to use whatever new features are desired.
By following the procedures described in the text, and making use of the programs and shell scripts provided as examples, it is possible to secure a UNIX system against most attackers, even if it is connected to wide-area networks such as the Internet.
The book is divided into five parts.
In Chapter 1, we begin our discussion by considering four well-known cases of UNIX security being broken. This serves to make the reader aware of some possible types of attack on UNIX systems, as well as to provide a framework for later discussion.
Most of the information required to protect a single UNIX system is presented in the next three chapters. Chapter 2 discusses account and password security. File system security is covered in Chapter 3. Chapter 4 describes network security.
The third part of the book discusses some topics in more detail. These topics pertain primarily to networks of UNIX systems and systems that provide remote access. Chapter 5 describes the Network Information Service (NIS) (formerly called Sun Yellow Pages, or YP), the Network File System (NFS), and the Remote File Sharing (RFS) service. Workstations and the particular security problems they present are covered in Chapter 6.Terminals, modems, and the UNIX-to-UNIX copy program (UUCP) are discussed in Chapter 7. Chapter 8 describes methods for detecting and responding to break-ins, and serves to separate the discussion of specific UNIX security issues from the material in the last part of the book.
The last chapters of the book cover topics that are directly related to UNIX system security, but are not part of the UNIX system itself. Chapter 9 discusses encryption and authentication, and the software and hardware devices used to implement them. Security policies are discussed in Chapter 10. Chapters 11 and 12 discuss publicly available security-related software and how to obtain information about current threats to UNIX security.
This book assumes that the reader is familiar with the UNIX system, its commands, and its terminology. Readers who are unfamiliar with UNIX should consult A Practical Guide to the UNIX System, Third Edition by Mark G. Sobell, published by Addison-Wesley. Readers who wish to learn more about UNIX system administration (which will be helpful, but not necessary, in understanding some parts of this book) should consult the UNIX System Administration Handbook by Evi Nemeth, Garth Snyder, and Scott Seebass, published by Prentice Hall. Readers who would like to learn more about the history and "culture" of UNIX may wish to consult Life With UNIX by Don Libes and Sandy Ressler, published by Prentice Hall.
First and foremost, I am grateful to my wife, Cathy, and our sons, Trevor and Sean. Their love, patience, and encouragement helped make this book a reality.
Many thanks to the people who reviewed the book and provided technical and editorial critiques: Ralph Droms (Bucknell University), Tom Duff (AT&T Bell Laboratories), Fred Grampp (AT&T Bell Laboratories), Dan Farmer (Sun Microsystems), Brian Kernighan (AT&T Bell Laboratories), Rich Kulawiec (Hospital of the University of Pennsylvania), Doug McIlroy (AT&T Bell Laboratories), Michael Merritt (AT&T Bell Laboratories), Jim Reeds (AT&T Bell Laboratories), Jeff Schwab (Purdue University), and Steve Simmons (Industrial Technology Institute). Thanks also to John Wait and Alan Apt, my editors at Addison-Wesley, for their support and assistance while writing the book.
A good portion of the information about UNIX security presented in this book has come from discussions with friends and colleagues, and from suggestions received from the readers of an earlier paper I wrote on UNIX security (Curry, 1990). Thanks to all of you, especially Matt Bishop, Dan Farmer, Phil Klimbal, Doug Moran, Donn Parker, Peter Neumann, and Jeff Schwab. Finally, special thanks go to Rich Lynn of Digital Equipment Corporation, who obtained a copy of the ULTRIX Security Guide for Administrators for me, to Ken van Wyk of the CERT/CC, who answered my several requests for information, and to John Wack of NIST, who provided a wealth of information about how to form a response team, and about the FIRST.
This book was produced using AT&T's Documenter's Workbench, Release 2.0 (eqn, tbl, troff) with the -ms macro package on a Sun Microsystems SPARC station 1 running SunOS 4.1.1. PostScript output was produced by the TransScript package from Adobe Systems. The index was generated using a set of awk and sh programs described in (Bentley and Kernighan, 1988).
The author would like to hear from any readers with comments, suggestions, or bug reports: email@example.com.