Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Defense in Depth


Software Development

Read part 1 and part 2.

Last month, we introduced our first principle for building secure software: Secure the weakest link. This month, we discuss the concept of practicing defense in depth. Over the next several months, we'll cover each of our 10 security principles in turn, putting some flesh on the bones of our tenets.

To practice defense in depth is to manage risk with diverse defensive strategies, so that if one layer of defense turns out to be inadequate, another layer will prevent a full breach. This doesn't apply only to security—it's also a tenet for programming language design proposed by Bruce MacLennan in his Principles of Programming Languages (Holt Rinehart, Winston, 1983, 1st ed.).

The Value of Redundancy
The defense-in-depth principle may seem contradictory to the secure-the-weakest-link principle. There is no contradiction, however; "secure the weakest link" applies when security functionality does not overlap. But when it comes to redundant security measures, it's indeed possible that the sum protection offered is far greater than the protection offered by any single component.

Principles to Build By

  1. Secure the weakest link.
  2. Defense in depth
  3. Fail securely.
  4. Follow the principle of least privilege.
  5. Compartmentalize.
  6. Keep it simple.
  7. Promote privacy.
  8. Remember—hiding secrets is hard.
  9. Be reluctant to trust.
  10. Use your community resources.
—G. McGraw and J. Viega

A good real-world example in which defense in depth can be useful, but is rarely applied, is in the protection of data that travels between various server components in enterprise systems. Most companies, assuming that a corporate-wide firewall is sufficient security, will erect one and let their application server talk to their database in the clear. However, if an attacker manages to penetrate the firewall, if the data is also encrypted, the attacker won't be able to get at it without breaking the encryption, or (more likely) breaking into one of the servers that stores the data in an unencrypted form. If we put up another firewall, around just the application this time, we can protect ourselves from people who get inside the corporate firewall. Now they'd have to find a flaw in some service that our application's subnetwork explicitly exposes—a situation that we can easily control.

When designing and building a piece of software, treat it as a complicated system that requires multiple lines of defense. Use both passwords and physical tokens to authenticate users; double-check that the operating system is enforcing access control in a reasonable way; make use of advanced sandboxing technologies in your design; and, by all means, monitor your software automatically as it runs.

Protecting the Organization
Defense in depth can also be applied at an organizational level. Try to avoid having the same people design and analyze a system. It's all too easy to overlook problems in a system that you've designed.

By the same token, make sure your software development process manages risks at both the architecture level and the implementation level. Using a code scanner is a great idea, but no substitute for an architectural analysis. Finally, you'll find defense in depth to be an especially powerful concept when each layer works in concert with the others.

Watch for next month's column, "Fail Securely." Failure is unavoidable. What can be avoided are security problems related to failure.

What Goes Wrong
Attackers don't do what they're supposed to.

Some organizations do acceptance testing for functionality, but never test for security. This is a common oversight, especially in today's fast-paced software development world. The problem is that attackers don't do what they're supposed to—they do precisely what they're not supposed to! The art of exploiting software is about revealing assumptions made by designers—and then undermining those assumptions.

Exacerbating the security-testing problem is the fact that standard-issue QA people can't really do security testing without some expert guidance. Any such testing must be done with the help of people who understand how software is exploited in the real world. Finally, a solid and thorough risk analysis must inform the testing process.



Gary McGraw, Ph.D., is CTO of Cigital and coauthor of Building Secure Software (Addison-Wesley, 2001). He is the author of Java Security (Wiley, 1996) and Software Fault Injection (Wiley, 1999). Reach him at [email protected]. John Viega is Chief Scientist at Secure Software, author of Network Security with Open SSL (O'Reilly, 2002) and coauthor of Building Secure Software. Reach him at [email protected].


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.