In this chapter, we
Security can be grouped into seven main technology fields: authentication, authorization, auditing, privacy, integrity, availability, and nonrepudiation. When considering any security solution, you must consider all these disciplines and the eventual environment for your solution. All systems are subject to attack. Threats in vulnerable systems with inappropriate countermeasures are simply waiting to be acted on.
It's
Although building secure Web applications can seem daunting, following a few simple steps will make the task a little easier. In this chapter, we'll thoroughly describe the security design process that we'll advocate and use throughout this book. Following that discussion, we'll take a look at general application design—at first divorced from security concerns—and then map the process for building secure Web applications to the application design model we've described. To tie everything together, we'll end the chapter with a
You'll note in Figure 2-1, which diagrams the security design process, that the process is cyclical. The rationale for this is quite simple: threats, both business and technical, change
Figure 2-1. An iterative process for determining security requirements and technologies.
As you can see, the process begins (and begins again) with business and product requirements: the details of what you want your business and its tools to be able to do. The process has no room for the notion of technology for technology's sake. You must choose technology because it's the right tool for the job, not because it happens to be the technology de jour.
Note also how much of the process involves information gathering and decision making prior to any actual development work. Only at the last step—indicated by the Security Services box—does the nuts-and-bolts development begin. This is not a fluke; the process comprises a lot of research and planning to help ensure that the solution you ultimately build is the best response to your security needs. I hope you'll see that each step is necessary and commonsensical, and I strongly
Each part of the process is described in further detail in the following sections.
Determining your business and product requirements is by far the most important stage in developing a security solution for your applications. No solution is useful unless it
Examples of high-level business requirements include the following:
Now let's
Once you've defined your business requirements, you need to determine the information required to support those business processes. Each business process requires raw data, which it turns into useful information. Without that data, the business process is meaningless. Hence, the data and intellectual capital that a company owns needs protecting. Also, the information used by a business helps it gain competitive advantage, which is another reason protecting information is so important. Obviously, without competitive advantage a business might eventually
Examples of information requirements include a sales-oriented application requiring access to sales history, product, client, commission, discount, and delivery schedule information and a medical application requiring access to surgeon timetables, private patient medical histories, drug interaction data, insurance company policies, and so on.
Now that you know the capabilities your application must provide—dictated by your business requirements—and the information required by the application, you can turn your attention to the first of the security-
Different companies have differing threats. Banks don't want money stolen,
The first order of business at this step of the security design process is to establish your company's risk tolerance—that is, the degree to which the company is willing to take risks to achieve its objectives. A high-profile bank's risk tolerance might be low as it has a reputation to uphold. However, a small start-up company might be willing to take more risks to gain exposure or market share. Once you have a general feel for what your company's risk tolerance is, you can better analyze the threats and risks for the business.
Analyze the threats
Analyzing threats can be difficult, but it's important that a good deal of effort be spent in this phase. Indeed, you simply cannot build a secure application without understanding the threats to your application. Without such understanding, you can't determine the appropriate technology to use to counter the threats, as covered in the remaining steps of the process.
A basic taxonomy of attacks—that is, threats that have been carried out—was discussed in the previous chapter, and it included
This taxonomy serves as a good starting point, but I'll use a much more granular taxonomy used at Microsoft called STRIDE. The STRIDE model includes
As the bulleted list indicates, the STRIDE model includes the three types of threats I've discussed before and adds some others that need to be
Let's look at each threat in a bit more detail.
Spoofing user identity
An example of user identity spoofing is the breaching of a user's authentication information. In this case, the hacker has obtained the user's personal information or something that enables him or her to replay the authentication procedure. Spoofing threats are usually associated with a wily hacker being able to impersonate a valid system user or resource to get access to the system and thereby compromise system security.
Tampering with data
Tampering with data involves the malicious modification of system or user data with or without detection. An unauthorized change made to stored or in-transit information, the formatting of a hard disk, the introduction by a malicious intruder of an undetectable network packet in a communication, and an undetectable change made to a sensitive file are all examples of tampering threats.
Repudiability
Repudiability threats are associated with users—malicious or otherwise—who can deny performing an action without administrators having any way to
Information disclosure
Information disclosure threats involve the
Denial of service
Denial of service (DoS) threats when carried out deny service to valid users—for example, by making the system temporarily unavailable or unusable or by forcing a reboot or restart of the user's machine. You must protect against certain types of DoS threats simply to improve system availability and reliability. Other types of DoS threats, however, are very hard to protect against; at a minimum, you should identify and rationalize such threats.
Elevation of privilege
In this type of threat, an
Because it requires thorough understanding of
Prioritize the threats
Once you've determined which risks and threats prevail, you might be amazed at the number of them. Chances are you won't be able to address every threat. Therefore, after compiling your list of threats, you need to prioritize them.
Prioritization is a simple process of determining how much it will cost to counter the threat and comparing that cost to the cost of the asset the countermeasure will protect. Is it worth spending $100,000 to protect an asset worth only $1,000? Probably not! Of course, you might decide that the cost is outweighed by the possible loss of credibility with the public if the asset is successfully
It's also important to note that it's likely at this stage that you won't know the real cost of protecting the asset because the technology you'll use for the protection hasn't been
Because certain aspects of the prioritization process—such as intangibles like public image and the fact that you might decide to pay the price of protecting an asset if the chance of attack on it is high—make the process a little complicated, you should apply a simple formula to each threat:
Risk = Criticality / Effort
Criticality is the overall importance of the resource being protected, and effort is the degree of difficulty required to mount an attack on the resource. Risk, then, gauges the overall danger a particular threat poses. You'll use this risk rating in conjunction with your analysis of security cost vs. asset value to make your prioritization decisions.
For example, a threat is found regarding access to client medical data—an information disclosure threat. Obviously, if the data is compromised in any way, there could be serious implications for both the patient and the hospital or doctor's office in question. Therefore, this threat's criticality is given a rating of 10, on a scale of 1 (least critical) through 10 (most critical). You determine that the effort to mount an attack based on this threat is minimal, so you rate the threat's effort at 1, on a scale of 1 (attack
The risk posed by this threat is 10 / 1, or 10. This is a very high-risk threat indeed; in fact, it's the highest rated threat possible. When you're prioritizing your threats, such a rating would balance any discrepancy between countermeasure cost and asset value and would encourage you to rank the threat as one crucial to address. For a more detailed discussion of this formula, see Edward Amoroso's Fundamentals of Computer Security Technology (Prentice Hall, 1994).
Once you have a list of raw prioritized threats, you've completed the third stage of the security design process. The next phase, application of the company's security policy, will help you fine-tune the list of prioritized threats and begin determining what to do in response to each threat.
The next step is to refer to corporate security policy to see which threats are tolerable and which are not. Despite a threat's low-risk rating, for example, security policy might
You have three choices with regard to a threat, each of which will be driven by taking into account your threat prioritization list and security policy:
Security policy documents should be drafted by every company and regularly updated because
An old security policy is useless; the policy document should be a living document, evaluated at least every six months. I've seen a number of instances in which a company had either
Make sure you have a security policy document, and make sure it's up-to-date!
Now that you have guidance from your security policy on how to deal with each threat—that is, whether to accept, assign, or defend against it—you can begin to look at the technologies you'll use to counter those threats you've chosen to defend against.
There are many security technologies to choose from when building solutions, so many in fact that it can be difficult to determine which ones to choose. To make this process easier, break it into two steps. First, before considering the actual products you'll use, determine the generic types of technology that can be used to solve specific threats—that is, map general countermeasures (not yet linked with specific products) to the threats you're defending against. For example, Table 2-1 maps various possible countermeasures to each of the threats in the STRIDE model.
Table 2-1. Countermeasures mapped to each threat in the STRIDE model.
| Threat | Countermeasures |
|---|---|
| Spoofing user identity |
Strong authentication. Don't store secrets (such as passwords) in configuration files. If you must store secrets, use secure mechanisms. |
| Tampering with data |
Strong access control mechanisms. Hashes/digital signatures on resources. End-to-end tamper-resistant data transfer protocols. |
| Repudiability |
Secure logging. Digital signatures and time stamping. |
| Information disclosure |
Strong access control mechanisms. Perform correct file canonicalization. Limit specific file operations. End-to-end encrypted data transfer protocols. Don't store secrets (such as passwords) in configuration files. If you must store secrets, use secure mechanisms. |
| Denial of service |
Bandwidth throttling. Resource throttling. Quality of service. Packet filtering. |
| Elevation of privilege |
Run process in low privileged account. Safe buffer management. |
Microsoft Windows 2000 includes many technologies, most of which are discussed in
Table 2-2. Some Windows 2000 security technologies mapped to the countermeasures in Table 2-1.
| Countermeasure | Technologies and Best Practices |
|---|---|
| Strong authentication |
|
| Storing secrets |
|
| Access control |
|
| Hashes and digital signatures |
|
| Secure end-to-end protocols |
|
| File canonicalization |
|
| Limiting specific file operations |
|
| Bandwidth throttling |
|
| Resource throttling |
|
|
Quality of service
(QoS) |
|
| Packet filtering |
|
| Buffer management |
|
| Low privilege context |
|
The final step of the security design process is designing security services that use security technologies. The purpose of security services is to mitigate all risks to a tolerable level. Any security service that does not mitigate one or more risks should not be built; if the service doesn't counter a threat, there's no reason to build it.
In a well-designed solution, security services are
You can find more information on loose coupling and other good software development practices in the Microsoft Solutions Framework (MSF), a software development framework produced by Microsoft Consulting Services (MCS) based on Microsoft's internal development methodology and find-