Register your product to gain access to bonus material or receive a coupon.
Most organizations have a firewall, antivirus software, and intrusion detection systems, all of which are intended to keep attackers out. So why is computer security a bigger problem today than ever before? The answer is simple--bad software lies at the heart of all computer security problems. Traditional solutions simply treat the symptoms, not the problem, and usually do so in a reactive way. This book teaches you how to take a proactive approach to computer security.
Building Secure Software cuts to the heart of computer security to help you get security right the first time. If you are serious about computer security, you need to read this book, which includes essential lessons for both security professionals who have come to realize that software is the problem, and software developers who intend to make their code behave. Written for anyone involved in software development and use—from managers to coders—this book is your first step toward building more secure software. Building Secure Software provides expert perspectives and techniques to help you ensure the security of essential software. If you consider threats and vulnerabilities early in the devel-opment cycle you can build security into your system. With this book you will learn how to determine an acceptable level of risk, develop security tests, and plug security holes before software is even shipped.
Inside you'll find the ten guiding principles for software security, as well as detailed coverage of:
Only by building secure software can you defend yourself against security breaches and gain the confidence that comes with knowing you won't have to play the "penetrate and patch" game anymore. Get it right the first time. Let these expert authors show you how to properly design your system; save time, money, and credibility; and preserve your customers' trust.
Application Security for Visual C++.NET Developers
Click below for Web Resources related to this title:
Author's Web Site
Building Secure Software: Race Conditions
Introduction to Software Security
Click below for Sample Chapter related to this title:
viegach1.pdf
Foreword.
Preface.
Organization.
Code Examples.
Contacting Us.
It's All about the Software.
Dealing with Widespread Security Failures.
Bugtraq.
CERT Advisories.
RISKS Digest.
Technical Trends Affecting Software Security.
The 'ilities.
What Is Security?.
Isn't That Just Reliability?
Penetrate and Patch Is Bad.
On Art and Engineering.
Security Goals.
Prevention.
Traceability and Auditing.
Monitoring.
Privacy and Confidentiality.
Multilevel Security.
Anonymity.
Authentication.
Integrity.
Know Your Enemy: Common Software Security Pitfalls.
Software Project Goals.
Conclusion.
An Overview of Software Risk Management for Security.
The Role of Security Personnel.
Software Security Personnel in the Life Cycle.
Deriving Requirements.
Risk Assessment.
Design for Security.
Implementation.
Security Testing.
A Dose of Reality.
Getting People to Think about Security.
Software Risk Management in Practice.
When Development Goes Astray.
When Security Analysis Goes Astray.
The Common Criteria.
Conclusion.
Choosing a Language.
Choosing a Distributed Object Platform.
CORBA.
DCOM.
EJB and RMI.
Choosing an Operating System.
Authentication Technologies.
Host-Based Authentication.
Physical Tokens.
Biometric Authentication.
Cryptographic Authentication.
Defense in Depth and Authentication.
Conclusion.
Security by Obscurity.
Reverse Engineering.
Code Obfuscation.
Security for Shrink-Wrapped Software.
Security by Obscurity Is No Panacea.
The Flip Side: Open-Source Software.
Is the “Many-Eyeballs Phenomenon<170) Real?
Why Vulnerability Detection Is Hard.
Other Worries.
On Publishing Cryptographic Algorithms.
Two More Open-Source Fallacies.
The Microsoft Fallacy.
The Java Fallacy.
An Example: GNU Mailman Security.
More Evidence: Trojan Horses.
To Open Source or Not to Open Source.
Another Security Lesson from Buffer Overflows.
Beating the Drum.
Conclusion.
Principle 1: Secure the Weakest Link.
Principle 2: Practice Defense in Depth.
Principle 3: Fail Securely.
Principle 4: Follow the Principle of Least Privilege.
Principle 5: Compartmentalize.
Principle 6: Keep It Simple.
Principle 7: Promote Privacy.
Principle 8: Remember That Hiding Secrets Is Hard.
Principle 9: Be Reluctant to Trust.
Principle 10: Use Your Community Resources.
Conclusion.
Architectural Security Analysis.
Attack Trees.
Reporting Analysis Findings.
Implementation Security Analysis.
Auditing Source Code.
Source-level Security Auditing Tools.
Using RATS in an Analysis.
The Effectiveness of Security Scanning of Software.
Conclusion.
What Is a Buffer Overflow?
Why Are Buffer Overflows a Security Problem?
Defending against Buffer Overflow.
Major Gotchas.
Internal Buffer Overflows.
More Input Overflows.
Other Risks.
Tools That Can Help.
Smashing Heaps and Stacks.
Heap Overflows.
Stack Overflows.
Decoding the Stack.
To Infinity and Beyond!
Attack Code.
A UNIX Exploit.
What About Windows?
Conclusion.
The UNIX Access Control Model.
How UNIX Permissions Work.
Modifying File Attributes.
Modifying Ownership.
The umask.
The Programmatic Interface.
Setuid Programming.
Access Control in Windows NT.
Compartmentalization.
Fine-Grained Privileges.
Conclusion.
What Is a Race Condition?
Time-of-Check, Time-of-Use.
Broken passwd.
Avoiding TOCTOU Problems.
Secure File Access.
Temporary Files.
File Locking.
Other Race Conditions.
Conclusion.
Pseudo-random Number Generators.
Examples of PRNGs.
The Blum-Blum-Shub PRNG.
The Tiny PRNG.
Attacks Against PRNGs.
How to Cheat in On-line Gambling.
Statistical Tests on PRNGs.
Entropy Gathering and Estimation.
Hardware Solutions.
Software Solutions.
Poor Entropy Collection: How to Read “Secret” Netscape Messages.
Handling Entropy.
Practical Sources of Randomness.
Tiny.
Random Numbers for Windows.
Random Numbers for Linux.
Random Numbers in Java.
Conclusion.
General Recommendations.
Developers Are Not Cryptographers.
Data Integrity.
Export Laws.
Common Cryptographic Libraries.
Cryptlib.
OpenSSL.
Crypto++.
BSAFE.
Cryptix.
Programming with Cryptography.
Encryption.
Hashing.
Public Key Encryption.
Threading.
Cookie Encryption.
More Uses for Cryptographic Hashes.
SSL and TLS (Transport Layer Security.
Stunnel.
One-Time Pads.
Conclusion.
A Few Words on Trust.
Examples of Misplaced Trust.
Trust Is Transitive.
Protection from Hostile Callers.
Invoking Other Programs Safely.
Problems from the Web.
Client-side Security.
Perl Problems.
Format String Attacks.
Automatically Detecting Input Problems.
Conclusion.
Password Storage.
Adding Users to a Password Database.
Password Authentication.
Password Selection.
More Advice.
Throwing Dice.
Passphrases.
Application-Selected Passwords.
One-Time Passwords.
Conclusion.
The Basics.
Access Control.
Using Views for Access Control.
Field Protection.
Security against Statistical Attacks.
Conclusion.
Copy Protection Schemes.
License Files.
Thwarting the Casual Pirate.
Other License Features.
Other Copy Protection Schemes.
Authenticating Untrusted Clients.
Tamperproofing.
Antidebugger Measures.
Checksums.
Responding to Misuse.
Decoys.
Code Obfuscation.
Basic Obfuscation Techniques.
Encrypting Program Parts.
Conclusion.
Basic Strategies.
Client Proxies.
Server Proxies.
SOCKS.
Peer to Peer.
Conclusions.
The Ultimate Goals of Cryptography.
Attacks on Cryptography.
Types of Cryptography.
Symmetric Cryptography.
Types of Symmetric Algorithms.
Security of Symmetric Algorithms.
Public Key Cryptography.
Cryptographic Hashing Algorithms.
Other Attacks on Cryptographic Hashes.
What's a Good Hash Algorithm to Use?
Digital Signatures.
Conclusions.
"A book is a machine to think with."
--I.A. Richards PRINCIPLES OF LITERARY CRITICISM
This book exists to help people involved in the software development process learn the principles necessary for building secure software. The book is intended for anyone involved in software development, from managers to coders, although it contains the low-level detail that is most applicable to programmers. Specific code examples and technical details are presented in the second part of the book. The first part is more general and is intended to set an appropriate context for building secure software by introducing security goals, security technologies, and the concept of software risk management.
There are plenty of technical books that deal with computer security, but until now, none have applied significant effort to the topic of developing secure programs. If you want to learn how to set up a firewall, lock down a single host, or build a virtual private network, there are other resources to which to turn outside this book. Because most security books are intended to address the pressing concerns of network-level security practitioners, they tend to focus on how to promote secrecy and how to protect networked resources in a world in which software is chronically broken.
Unfortunately, many security practitioners have gotten used to a world in which having security problems in software is common, and even acceptable. Some people even assume that it is too hard to get developers to build secure software, so they don't raise the issue. Instead, they focus their efforts on "best-practice" network security solutions, erecting firewalls, and trying to detect intrusions and patch known security problems in a timely manner.
We are optimistic that the problem of bad software security can be addressed. The truth is, writing programs that have no security flaws in them is difficult. However, we assert that writing a "secure-enough" program is much easier than writing a completely bug-free program. Should people give up on removing bugs from software just because it's essentially impossible to eliminate them all? Of course not. By the same token, people shouldn't just automatically throw in the software security towel before they even understand the problem.
A little bit of education can go a long way. One of the biggest reasons why so many products have security problems is that many technologists involved in the development process have never learned very much about how to produce secure code. One problem is that until now there have been very few places to turn for good information. A goal of this book is to close the educational gap and to arm software practitioners with the basic techniques necessary to write secure programs.
This said, you should not expect to eradicate all security problems in your software simply by reading this book. Claiming that this book provides a silver bullet for security would ignore the realities of how difficult it is to secure computer software. We don't ignore reality--we embrace it, by treating software security as a risk management problem.
In the real world, your software will likely never be totally secure. First of all, there is no such thing as 100% security. Most software has security risks that can be exploited. It's a matter of how much money and effort are required to break the system in question. Even if your software is bug free and your servers are protected by firewalls, someone who wants to target you may get an insider to attack you. Or they may perform a "black bag" (break-in) operation. Because security is complicated and is a system-wide property, we not only provide general principles for secure software design, but we also focus on the most common risks, and how to mitigate them.
This book is divided into two parts. The first part focuses on the things you should know about software security before you even think about producing code. We focus on how to integrate security into your software engineering practice. Emphasis is placed on methodologies and principles that reduce security risk by getting started early in the development life cycle. Designing security into a system from the beginning is much easier and orders of magnitude cheaper than retrofitting a system for security later. Not only do we focus on requirements and design, we also provide significant emphasis on analyzing the security of a system, which we believe to be a critical skill. The first part of this book should be of general interest to anyone involved in software development at any level, from business-level leadership to developers in the trenches.
In the second part, we get our hands dirty with implementation-level issues. Even with a solid architecture, there is plenty of room for security problems to be introduced at development time. We show developers in gory detail how to recognize and to avoid common implementation-level problems such as buffer overflows and race conditions. The second part of the book is intended for those who feel comfortable around code.
We purposely cover material that we believe to be of general applicability. That is, unless a topic is security critical, we try to stay away from anything that is dependent on a particular operating system or programming language. For example, we do not discuss POSIX "capabilities" because they are not widely implemented. However, we devote an entire chapter to buffer overflows because they are a problem of extraordinary magnitude, even though a majority of buffer overflows are specific to C and C++.
Because our focus is on technologies that are applicable at the broadest levels, there are plenty of worthy technologies that we do not cover, including Kerberos, PAM (pluggable authentication modules), and mobile code sandboxing, to name a few. Many of these technologies merit their own books (although not all of them are adequately covered today). This book's companion Web site, http://www.buildingsecuresoftware.com/, provides links to information sources covering interesting security technologies that we left out.
Although we cover material that is largely language independent, most of our examples are written in C, mainly because it is so widely used, but also because it is harder to get things right in C than in other languages. Porting our example code to other programming languages is often a matter of finding the right calls or constructs for the target programming language. However, we do include occasional code examples in Python, Java, and Perl, generally in situations in which those languages are significantly different from C. All of the code in this book is available at
http://www.buildingsecuresoftware.com/.
There is a large UNIX bias to this book even though we tried to stick to operating system-independent principles. We admit that our coverage of specifics for other operating systems, particularly Windows, leaves something to be desired. Although Windows NT is loosely POSIX compliant, in reality Windows programmers tend not to use the POSIX application programming interface (API). For instance, we hear that most Windows programmers do not use the standard C string library, in favor of Unicode string-handling routines. As of this writing, we still don't know which common functions in the Windows API are susceptible to buffer overflow calls, so we can't provide a comprehensive list. If someone creates such a list in the future, we will gladly post it on the book's Web site.
The code we provide in this book has all been tested on a machine running stock Red Hat 6.2. Most of it has been tested on an OpenBSD machine as well. However, we provide the code on an "as-is" basis. We try to make sure that the versions of the code posted on the Web site are as portable as possible; but be forewarned, our available resources for ensuring portability are low. We may not have time to help people who can't get code to compile on a particular architecture, but we will be very receptive to readers who send in patches.
We welcome electronic mail from anyone with comments, bug fixes, or other suggestions. Please contact us through
http://www.buildingsecuresoftware.com.
Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.
This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.
To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:
For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.
For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.
Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.
Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.
If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.
On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.
We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.
Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.
Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.
This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.
This site currently does not respond to Do Not Track signals.
Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.
This site is not directed to children under the age of 13.
Pearson may send or direct marketing communications to users, provided that
Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.
If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.
Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.
Pearson does not rent or sell personal information in exchange for any payment of money.
While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.
California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.
Pearson may disclose personal information, as follows:
This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.
Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.
We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.
Last Update: November 17, 2020