Learn all you can from the mistakes of others. You won't have time to make them all yourself.

?Alfred P. Sheinwold, Author of Five Weeks to Winning Bridge

What's so hard about writing secure code? These days, we consumers get a few dozen security patch notices per week from the world's software product vendors and watchdog teams such as the Computer Emergency Response Team Coordination Center (CERT/CC) at Carnegie Mellon University. Terms such as buffer overflow and race condition foam out of the bulletins like poisonous vapors. Explore those terms a bit, and you'll find whole categories of mistakes that are possible to make?easy, in fact?while developing a piece of software.

In this book, we take you on a virtual tour through the software development process, from inception to deployment. We focus on four broad stages?initial architecture, detailed design, implementation ("coding"), and operation?and discuss the security issues a developer faces at each stage. We also explore, of course, many of the specific software flaws we've studied and cataloged during our careers.

We present expert technical advice, too, based on our decades of hands-on experience and tempered by some of our more notable failures. And while we invite you to learn from our mistakes, we also invite you to think with us?think hard?about why security vulnerabilities exist to begin with and why they seem impossible to stamp out. In this book, we try to shed new light on the variety of reasons we can see. And we explain in detail how developers, compensating for these factors with appropriate techniques and processes, can produce software "just secure enough" for the needs of their enterprises, users, and customers.