Home > Articles > Security > Network Security

Security Expert Gary McGraw on Black Hats, the U.S. Government, and Good vs. Evil

Seth Fogie and Gary McGraw discuss McGraw's latest book, Exploiting Software, black hats, the current security situation in the U.S. government, what a software security specialist needs to know to get started in this industry and whether people are fundamentally good or evil.
Like this article? We recommend

Like this article? We recommend


Gary McGraw, Ph.D., CTO of Cigital, Inc. (http://www.cigital.com, http://www.cigital.com/~gem), researches software security and sets technical vision in the area of software quality management. Dr. McGraw has coauthored five books:

A noted authority on software and application security, Dr. McGraw consults with major software producers and consumers. He has written more than 60 peer-reviewed technical publications and functions as principal investigator on grants from Air Force Research Labs, DARPA, the National Science Foundation, and NIST's Advanced Technology Program. He serves on the advisory boards of Authentica, Counterpane, Fortify Software, and Indigo Security, as well as advising the CS Department at University of California Davis. Dr. McGraw holds a dual Ph.D. in cognitive science and computer science from Indiana University and a BA in philosophy from University of Virginia. He regularly contributes to popular trade publications and is often quoted in national press articles.

Seth: Give us a little background on how you got started in information security.

Gary: I came into computer security through my interest in programming languages. I got my Ph.D. in computer science and cognitive science at Indiana University, where I studied with Doug Hofstadter and wrote the Letter Spirit program. Dan Friedman, another professor at IU, ensured that all IU computer science students were indoctrinated with his excellent thinking about programming languages (with a strong Scheme flavoring). So I was a part-time languages junkie in grad school.

I also had a strong interest in the web, having helped get Hofstadter's lab on the web in late 1993. I recall when Yahoo! was a complete list of all web sites.

I got my Ph.D. and joined Cigital (called Reliable Software Technologies back then) in late 1995 as one of the first few employees. I was slated to work as a research scientist on fault injection for computer security. Java was released in beta form, and I immediately downloaded it and started playing. I was pretty disappointed in Java, actually, since it didn't take advantage of the functional programming paradigm I loved as a languages junkie. The claims about security really intrigued me, though, and I began to ponder how a programming language could possibly be "secure."

I met Ed Felten and his Princeton Ph.D. students Dan Wallach and Drew Dean at IEEE Security & Privacy (Oakland) in 1996. They were presenting a seminal paper on mobile code security. Ed and I hit it off, and we decided to collaborate on a book called Java Security, which we released in August 1996. The book was an instant top seller, and really helped me to get started in computer security.

After writing the second edition (Securing Java) in 1999, I started thinking hard about why such excellent engineers and languages guys like Guy Steele and James Gosling had such a hard time making Java secure. After digging into software security, it was clear that there was a dearth of information on security for people who build stuff (software stuff, that is). So I wrote Building Secure Software with John Viega in 2001. In that book, we described some of the thinking behind Cigital's early software security services. Cigital has been helping customers with software security since 1997.

Exploiting Software and Building Secure Software were mapped out at the same time. You'll notice that each features a cowboy hat on the cover; I refer to them collectively as the "black and white" series. Viega was instrumental in getting the ball rolling with the first one, but the second required a different sort of coauthor—somebody with deep technical experience on the hacker side. Greg Hoglund was a perfect fit.

I'm psyched about the amount of progress we've made in the last few years on software security. When Building Secure Software first came out, the idea that software was the problem was not as obvious as it seems to be now. For the first time, people who build things are getting interested in security (as opposed to general interest being limited to operations people—the usual "go to" guys for corporate security). This bodes well for the future of computer security.

Seth: What do you think the black hat on the cover of Exploiting Software tells someone who picks it up?

Gary: Building Secure Software (the antidote book) has a white cowboy hat, signifying the good guys. Exploiting Software has a black cowboy hat, signifying the bad guys. A cowboy movie just wouldn't be the same without both good guys and bad guys! Plus, malicious hackers are known as "black hats," so there you have it—a nice double entendre.

I'm always very meticulous about covers and cover art for my books and tend to be somewhat more involved than many authors. Java Security had an image of the Holy Grail on the front (plus a hidden message in the subtitle). Securing Java had a broken egg in a nest (poking fun at Sun's Java Security book). Software Fault Injection had a needle (well, Cleopatra's, anyway). My favorite cover has to be that of Exploiting Software. It just looks cool. Hopefully lots of people will buy the book for its cover.

Seth: This book represents one of a very few of a new breed of books that goes into in-depth detail on how to crack software. Since most publishers like to have some type of writing history on which to base their potential profits, what convinced you that Exploiting Software and its sister book were going to sell?

Gary: I really don't worry too much about whether books I write are going to sell well. That said, I've been very fortunate that most of the books I've written (especially the security books) have done extremely well. I think that's because I'm truly passionate about what I'm doing. I feel compelled to get the word out, and get people working on these great hard problems. The passion seems to appeal to people. That's lucky!

Seth: Many of the concepts discussed in this book could be used illegally. With the explicit mention and illustration of several programs (such as Microsoft C++ compiler, hlpctr.exe, I-Planet 6), do you worry about ending up attempting to justify your actions before a court?

Gary: Nope.

Seth: With in-depth coverage of a wide range of material, I'm sure you could say that this book took a lifetime to write. But even with all your knowledge, there's a lot of heavy material in the book. What personal commitment did it take to turn Exploiting Software from an idea into a tangible book?

Gary: Exploiting Software was a long time coming. Greg and I started writing it shortly after Building Secure Software was published in 2001. It took about three and a half years to write. The hardest part was taking the "pile" (as we affectionately called our collection of examples and actual attacks) and organizing it into coherent sets of stuff. The resulting 48 attack patterns should be very helpful to those people charged with security design and analysis.

We did lots of refinement, mungification, building of tools, review, etc. during the process. Addison-Wesley was great about lining up reviewers for us. And they nicely tolerated our sometimes torturous progress. In the end, we came out with a strong book that has lots of depth.

Seth: Why do you think complex books are becoming all the rage? In the last few months, books have pushed the barrier of the security community to the point where many readers will be left scratching their heads after page 10. What's the reason for this complexity?

Gary: The days of very simple security books are coming to an end as the field matures and moves from "comic book stage" to college textbook stage. But hardcore technical books don't have to be unapproachable. I think that my books are readable by any smart person, regardless of his or her personal geek factor.

The thing is, we have to start getting more serious about how things break. Early writings focused too much attention on the easy stuff (script-kiddie level), and didn't really get across what you need to do to defend yourself. Books like Exploiting Software do plenty to jolt us all back into reality about the nature of the security problem. I believe (as do many others) that the only way to build things to defend themselves is to know precisely how they're likely to be attacked.

Seth: What advice would you give to young information-security practitioners who are trying to get a first book published?

Gary: Writing takes practice. I've been writing in a serious way since high school. My undergrad degree is in philosophy, which involved creating boatloads of clear and lucid argumentation in written form. But my main writing influence involved working with Doug Hofstadter (who earned the Pulitzer Prize in 1980 for writing Gödel, Escher, Bach: An Eternal Golden Braid [Basic Books, 1979]). Doug taught me to make my writing sparkle. He follows a regimen of constant refinement, rereading, rewriting, tweaking, etc. in what he calls the "creative feedback loop." Practice, practice, practice. Redo, refine, rewrite.

I guess what you ultimately need to do is find your voice. My best friends say that they can hear me in my books. That's interesting.

Seth: When books have more than one author, each has something to offer to the book, which generally makes the content well-rounded. What would you consider to be your specialty with regard to Exploiting Software?

Gary: Probably writing style, clarity, science, and organization. We both worked extremely hard with this collaboration, and we both did lots of things. Greg wrote most of the code and furnished lots of raw material. I wrote lots of stuff, moved things around radically, promoted and demoted ideas, and so on. By the time the book was finally declared "done," we were both pretty tired of reading it! Now comes the fun part—watching people react to our product. We've been very gratified by the reaction to all our hard work.

Seth: Suppose I have a friend who wants to break into information security (no pun intended). What advice would you give him? Do you need a four-year degree to get in the door? After that, then what?

Gary: I believe that some people are naturally good at breaking systems (and defending them) and others just aren't. It helps to question assumptions and have a healthy skeptical streak. It also helps if you've taken stuff apart your entire life to see how it really works. All that is much more important than a four-year degree!

In any case, good academic computer security programs are few and far between, especially at the undergraduate university level. The state of the practice is such that the formal aspects of education are not as important as the informal aspects. This is likely to change over time, but only slowly.

Now is an excellent time for anyone to get into software security, on either side of the field (building or breaking). The field is young, there's lots to do, and there simply are not enough good software security people to go around. I predict phenomenal growth in this area over the next ten years. My advice to someone who wants to start a new career in information security is to focus on security engineering. We need more builders who understand security. Digest Ross Anderson's excellent book Security Engineering: A Guide to Building Dependable Distributed Systems [John Wiley & Sons, 2001] and go from there.

Seth: How important is hands-on experience when learning information security, and how can those who don't have this experience gain it when they're first learning?

Gary: Absolutely critical. Get a computer and start playing.

End of Part 1. Part 2 of this interview will appear at InformIT next week.

Seth: Your Ph.D. is in cognitive science and computer science. How did this affect your perspective of computer security? How has your education helped—or hindered—your career with regard to computer security? Would you recommend a certain type of education over another (for example, CERTS verse hacker school verses practical experience)?

Gary: I learned to think in undergrad school, and I learned to publish and advance the edge of science in grad school. It's hard to say what my formal education has done for me with regard to security, since my education certainly permeates my way of being. Strangely, though, I've never taken a course in computer security.

More important than education was probably the fact that I got my first computer (an Apple II+ with 48K) in 1981. I was coding the day Santa left the machine, showing dad how to use lores and hires mode. In high school, I was one of those guys that the teachers turned to in order to make stuff work. We had a LAN and a 20MB hard drive in 1983 (fun stuff) at Dobyns-Bennett High. I do recall one time that an admin password was imposed on us (for about a day)...

Back to the topic at hand. CERTS seem to be good for operations people, but not very useful for builders. Builders need to write lots of code and supplement that with software engineering and software testing courseware. Getting an MS or a Ph.D. in computer science will certainly teach you how to build things (one would hope, anyway). If you're interested in software security, become a software guy first and foremost and only then go for the security part.

With regard to experience, there's no substitute for working with other security people for many years. We're stuck in an apprenticeship situation in security these days, though formal education in security has more to offer now than it did ten years ago.

Seth: You've done a lot of research with the U.S. government (including Air Force Research Labs, DARPA, National Science Foundation, and NIST's Advanced Technology Program). Security is obviously a concern of the government. Do you think they're fully aware of software and network security issues? Are they taking appropriate measures to combat these dangers?

Gary: Yes and no. The government is huge. Inside the government there are a host of excellent people working hard on software security issues. There are strong research programs at the NSF, at DARPA, and at the newly-formed SARPA (part of DHS). All in all, the security research community is in okay shape. Things were better four years ago, but that's another story.

On the operations side, many government agencies really need help. Sometimes they're clueless, sometimes they're cash-strapped, and other times nobody seems to be thinking about the security problem. September 11 jolted the government into action on many fronts, but it will take years to see how that all plays out.

I think the commercial world is significantly ahead of the government when it comes to applied software security.

Seth: You recently coauthored "Processes to Produce Security Software" with the National Cyber Security Partnership. This report to the Department of Homeland Security issued preliminary recommendations for improving software security. Was there much debate or disagreement among the committee as to what those recommendations should be?

Gary: The committee was on the large size, but in the end, our part of the report was written by just a few people working like crazy for the last week. Sam Redwine coordinated comments and suggestions. All in all, there was general agreement over the content. We all agree that software security is something critical from a national security perspective. We hope that the best practices that we describe will be widely adopted by software producers everywhere.

Seth: Your recommendations call for process improvement, redesign of flawed systems, and the implementation of security best practices for software design. How do you envision these recommendations taking root and becoming more entrenched in software development policies and procedures? Is seems that you're fighting an uphill battle against developers who are up against too-short deadlines and too-tight budgets.

Gary: I think we've already made tons of progress in software security since the publication of Building Secure Software, and I'm optimistic that there will be more to come. First of all, many more developers and architects understand that they need to think about securing their systems from the get-go. Second, the application of best practices is clearly evolving from simple "outside the software" black-box penetration testing toward "inside the software" source-code review in the tools space. Third, many companies seek out architectural risk analysis help (and have been doing so for years). Market pressures are helping to drive some of this process improvement and best-practice adoption. Simply put, software consumers (think GM here) are demanding better software that's more secure and reliable.

Seth: What's the worst example of sloppy/security-unaware programming you've seen?

Gary: Probably one of the silliest things we saw was a design that called for a "hash algorithm" to be used for integrity purposes where the implementation somehow made use of a hash table. This made us laugh, and it was indicative of the other major problems we found. Ironically, the system was supposed to be a mobile code security system!

Alas, most of the really fun things that we find are "untalkaboutable." But I can assure you that breaking systems remains a blast even after ten years of doing it.

Seth: What's the worst hack you've recovered from?

Gary: Back when I was helping with sysadmin duties in my grad school days, we had somebody turn our FTP server into a warez site for about four hours. We found the hole, plugged it, cleaned out the FTP site, and got back up within a few hours.

Around the same time, we almost got hit by the Morris worm at Indiana. Fortunately, the guys at Purdue spotted the anomaly and called the "red phone" before the worm made it down to us. That one shut down 10% of the Internet at the time.

Lately, my wife's machine at home was zapped by the Welchia worm. Bad on me for not having that machine as well protected then as it is now. Recovering from that was a pain.

Seth: Give us a worst-case scenario for a major breach in software security.

Gary: I'm not sure that counterfactualizing about worst-case scenarios is all that useful in a forum like this.

Seth: Is anything not happening in the industry that you think should be?

Gary: I think there's still an overemphasis on security technology instead of security as an emergent phenomenon. Mike Howard says "software security is not security software," and he is absolutely right about that. I would like more people to become attuned to the idea that security must be designed in and can't be bolted on. Magic crypto fairy dust application won't miraculously cure everything.

Seth: What are your five favorite security books?

Gary: I list my favorite 13 security books on Amazon.com. Briefly, these are my top five:

Security Engineering: A Guide to Building Dependable Distributed Systems (John Wiley & Sons, 2001), by Ross J. Anderson

Exploiting Software: How To Break Code (Addison-Wesley, 2004), by Greg Hoglund and me

Building Secure Software: How To Avoid Security Problems the Right Way (Addison-Wesley, 2001), by John Viega and me

Secrets and Lies: Digital Security in a Networked World (John Wiley & Sons, 2000), by Bruce Schneier

Writing Secure Code, Second Edition (Microsoft Press, 2002), by Mike Howard and David C. LeBlanc

I'm excited by the new breed of more deeply technical security books that are just now coming out. Fun stuff! I'm currently reading The Shellcoders Handbook: Discovering and Exploiting Security Holes (John Wiley & Sons, 2004), by Litchfield et al.

Seth: Who are your mentors?

Gary: My first mentor, back in my University of Virginia days, was Richard Rorty. As an impressionable young scholar, I took a few graduate-level courses from him. He didn't know I thought of him as a mentor, although I told him so several years later when I attended a lecture of his at Indiana! My second mentor was Doug Hofstadter, whose brilliant work continues to serve as an inspiration to many people. Doug was a great advisor in grad school, and I loved working with him.

As I got into security, I developed very close relationships with many people in the community. I consider these people more colleagues than mentors, and there are too many to list here exhaustively, but among my most trusted advisors are Avi Rubin, Ed Felten, Crispin Cowan, Dave Evans, Paul Kocher, Carl Landwehr, Peter Neumann, Jon Pincus, Marcus Ranum, Fred Schneider, and Bruce Schneier. My work would not be the same without their regular input.

Seth: Which conferences look interesting to you? Which ones do you plan to attend?

Gary: I don't attend conferences regularly anymore, but I do poke my head in every few years. Conferences that I like to attend include USENIX Security, IEEE S&P, the Internet Society's NDSS, and the occasional academic workshop. I enjoyed RSA this year for the first time, too.

Seth: If you weren't consulting and writing, what would you be doing?

Gary: I am doing now exactly what I love to do.

Seth: What are your interests outside the industry you work in?

Gary: I'm a musician; I've played the violin since age three. I also play the mandolin and the guitar. I was classically trained (played concertos in high school), but got into improvisation in college. Just for fun, I record original music with my best friend from college, Rhine Singleton, under the name "Where's Aubrey."

I'm also a huge fan of nature and the outdoors. I live on a farm on the banks of the Shenandoah River with my wife and two boys. You can see the Blue Ridge from my bedroom window. We have lots of animals: horse, pony, goats, dogs, cats, rabbits, chickens, and sometimes pigs. We camp and hike when we can, and spend most weekends working outside on our land.

I'm a voracious reader, too. I read everything I can get my hands on, but especially love reading great fiction. I'm currently reading Michael Chabon's The Amazing Adventures of Kavalier and Clay (Random House, 2000), another Pulitzer Prize winner.

Seth: Are people fundamentally good or evil?

Gary: People are complicated, context-sensitive, and unpredictable. That's why life is so interesting.

Seth: What are the most valuable words you want to share with your audience?

Gary: Never forget that this is it—right now. Live your life today like you mean it.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


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.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

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.

Online Store

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.

Contests and Drawings

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.

Service Announcements

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.

Customer Service

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.

Other Collection and Use of Information

Application and System Logs

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.

Web Analytics

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.

Cookies and Related Technologies

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.

Do Not Track

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 will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

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.

Correcting/Updating Personal Information

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.

Sale of Personal Information

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.

Supplemental Privacy Statement for California Residents

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.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


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.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

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