Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
J.D. Meier, Alex Mackman, Blaine Wastell
Microsoft Corporation
May 2005
Home Page for Threat Modeling Web Applications
This How To describes an approach for creating a threat model for a Web application. The threat modeling activity helps you to model your security design so that you can expose potential security design flaws and vulnerabilities before you invest significant time or resources in a flawed design and/or problems become difficult to reverse. This How To provides prioritized vulnerability categories and a threat list to make the threat modeling activity easier.
This How To contains the following information:
Objectives
Overview
How to Use This Module
Input
Output
Steps
What to Do Next
Agile Considerations
MSF Agile Considerations
Additional Resources
Contributors and Reviewers
By performing the steps in this module, you will:
Threat modeling is a structured activity for identifying and evaluating application threats and vulnerabilities. This How To presents a question-driven approach to threat modeling that can help you identify security design problems early in the application design process. This approach allows you to quickly create a basic threat model for your application scenario. Then you can use this threat model to help refine your application's design early and for communication among team members.
The threat modeling approach presented here focuses on identifying and addressing vulnerabilities. The security objectives, threats, and attacks that you identify in the early steps of the activity are the scoping mechanisms designed to help you find vulnerabilities in your application. You can use the identified vulnerabilities to help shape your design and direct and scope your security testing.
Use this module to quickly create an effective threat model for your application. When using this module, keep the following in mind:
Do not get blocked on steps or implementation. Focus on the approach. If you do get blocked on a particular step, skip ahead to step 4, "Identify Threats." The primary objective of the activity is to improve security design, not to model for the sake of modeling.
Use scenarios to scope the modeling activity. Identify scenarios that are out of scope to help limit your threat modeling activity. What are you not going to talk about? For example, are operational practices out of scope?
Use your existing design documents if you have them. Use items such as documented use cases or user stories, data flow diagrams, architecture diagrams, and other design documentation if you have them.
Start with a whiteboard. It can be easier to get started by modeling on a whiteboard before you start capturing information in documents or getting lost in details. A helpful technique is to use a digital camera or whiteboard with print capability to document and distribute the information from the whiteboard.
Use an iterative approach. Add more detail and evolve your threat model as you continue design and development. Use ongoing modeling to reduce risk and to inform your design decisions. For example, when early in the design process, you may have only basic use cases, an initial deployment topology, and an idea of how you will layer your application. By using an iterative approach, you become familiar with the modeling process and can evolve your threat model to examine "what if" scenarios as more information becomes available to you.
You might choose to adopt a more formal approach and identify milestones for revisiting your model. What is most important is that you revisit the model when you need to make an engineering decision, as you introduce new levels of risk, and when you contemplate significant design choices.
Review and use the Template: Web Application Threat Model. Use the companion template while creating your threat model. The template includes exit criteria for each step described in this How To.
Use the Cheat Sheet. Use the companion document, "Cheat Sheet: Web Application Security Frame," to help you identify threats and vulnerabilities in step 4, "Identify Threats," and step 5, "Identify Vulnerabilities." The cheat sheet contains sample threats, attacks, vulnerabilities, and countermeasures.
Adapt the activity for your situation. If you are new to threat modeling, consider reading this document and then reading the companion walkthrough, "Walkthrough: Creating a Threat Model for a Web Application," to become more familiar with the approach. If you have existing applications, you can use the threat and vulnerability identification approaches in steps 4 and 5. With this information, you can determine where to focus your efforts.
Obtain input about host and network constraints from your system and network administrators. To be able to draw and understand your end-to-end deployment scenario, you need to have information about the host configuration, firewall policies, allowed protocols and ports, and so on. Obtain this information by talking to your system and network administrators.
The following input is useful for threat modeling:
Although all of these are useful, none of them are essential. However, you do need to have knowledge of your application's primary function and architecture.
The output of the threat modeling activity is a threat model. The main items captured by the threat model include the following:
The five major threat modeling steps are shown in Figure 1.
Figure 1. The iterative threat modeling process
These steps are:
You add progressively more detail to your threat model as you move through your application development life cycle and discover more details about your application design. Because key resources identified in threat modeling are also likely to be key resources from a performance and functionality perspective, you can expect to revisit and adjust your model as you balance all of your needs. This is normal and is a valuable outcome of the process.
Security objectives are goals and constraints related to the confidentiality, integrity, and availability of your data and application. They include:
Security-specific objectives are a subset of project objectives, and you should use them to guide your threat modeling efforts. You may find it helpful to think of security objectives in terms of constraints. Consider the question, "What do you not want to happen?" For example, an attacker must not be able to steal user credentials.
By identifying your key security objectives, you can determine where to focus your efforts. Identifying your objectives also helps you to understand the goals of potential attackers and concentrate on those areas of your application that require closer attention. For example, if you identify customer account details as sensitive data that needs protecting, you can examine how securely the data is stored and how access to the data is controlled and audited.
To determine your security objectives, consider the following questions:
The following are examples of some common security objectives:
In this step, you outline what your Web application does. Your goal is to identify your application's key functionality, characteristics, and clients. This will help you to identify relevant threats during step 4.
Note Remember that threat modeling is an iterative process. Do not let this step block your progress. Identify as much detail as you can and then add more detail as your design evolves. For example, if you are in the middle of your design and have not tackled physical deployment, you can still perform this step, although with less data. Itemize what you can as soon as you can.
To create an application overview:
The next sections describe each of these.
Use a whiteboard to draw the end-to-end deployment scenario. First, draw a rough diagram that describes the composition and structure of your application, its subsystems, and its deployment characteristics. Add details about the authentication, authorization, and communication mechanisms as you discover them. Remember that you may not have all of the details early in the design process.
Figure 2 is an example of an initial whiteboard diagram that shows the application architecture with some details.
Figure 2. Example whiteboard drawing depicting an application architecture
Your deployment diagram should generally include the following:
Note As your design evolves, you should regularly revisit the threat model to add more detail. For example, you might not know all of the components initially. Subdivide your application as necessary to get enough detail to find your threats.
Identify your application's roles: that is, identify who can do what within your application. What can your users do? What higher-privileged groups of users do you have? For example, who can read data, who can update data, who can delete data?
Use role identification to determine both what is supposed to happen and what is not supposed to happen.
What are the important features of your application? What does it do? Use your application's use cases to derive this information. Identify the dominant application functionality and usage, and capture the Create, Read, Update, and Delete aspects.
Key features are often explained in the context of use cases. They can help you and others to understand how your application is intended to be used and how it can be misused. Use cases help you identify data flows and provide focus when you identify threats later in the modeling process.
Avoid attempting to list every possible use case. Instead, start by identifying the main use cases that exercise the predominant Create, Read, Update, and Delete functionality of your application. For example, a self-service, employee human resources application might include the following use cases:
In these cases, you can look at the possibilities of the business rules being misused. For example, consider a user trying to modify personal details of another user. You often need to consider several use cases happening simultaneously to perform a complete analysis.
Also identify what scenarios are out of scope, and use your key scenarios to constrain the discussion. For example, you might decide that operational practices, such as backup and restore, are out of scope for the initial threat modeling exercise.
Where you can identify them, list the technologies and key features of the software and technologies that you use. Identify the following:
Identifying technologies helps you to focus on technology-specific threats later in the threat modeling activity. It also helps you determine the correct and most appropriate mitigation techniques.
Identify any key points that you know about the following:
The purpose of this effort is to identify interesting details and be able to add detail where necessary, or to identify where you might need to learn more.
For example, you might know how your application is authenticated by the database or how your users are authorized. You might know the other areas where your application performs authentication and authorization. You might also know certain details about how input validation is to be performed. Highlight these and other key elements of your application security mechanisms.
In this step, you break down your application to identify trust boundaries, data flows, entry points, and exit points. The more you know about the mechanics of your application, the easier it is to uncover threats and discover vulnerabilities. To decompose your application:
The next sections describe each of these.
Identify your application's trust boundaries to help focus your analysis on areas of concern. Trust boundaries indicate where trust levels change. You can think of trust from the perspective of confidentiality and integrity. For example, a change in access control levels in your application where a specific role or privilege level is required to access a resource or operation would be a change in trust level. Another example would be at an entry point in your application where you might not fully trust the data passed to the entry point.
To help identify trust boundaries:
Some example trust boundaries are:
Trace your application's data input through the application from entry to exit. You do this to understand how your application interacts with external systems and clients and how internal components interact. Pay particular attention to data flow across trust boundaries and how that data is validated at the trust boundary entry point. Also pay close attention to sensitive data items and how these flow through your system, where they are passed over a network, and where they are persisted.
A good approach is to start at the highest level and then deconstruct the application by analyzing the data flow between individual subsystems. For example, start by analyzing the data flow between your Web application, your middle tier servers, and your database server. Then consider page-to-page and component-to-component data flows.
The entry points of your application also serve as entry points for attacks. Entry points can include the front-end Web application listening for HTTP requests. This entry point is intended to be exposed to clients. Other entry points, such as internal entry points exposed by subcomponents across the layers of your application, may exist only to support internal communication with other components. However, you should know where these are and what types of input they receive in case an attacker manages to bypass the front door of the application and directly attack an internal entry point. Additional levels of checking provides defense in depth but may be costly in terms of money and performance.
Consider the trust levels required to access an entry point and the type of functionality exposed by the entry point. Early in the threat modeling activity, focus your attention on entry points that expose privileged functionality, such as administration interfaces.
Identify the points where your application sends data to the client or to external systems. Prioritize the exit points where your application writes data that includes client input or includes data from untrusted sources, such as shared databases.
In this step, you identify threats and attacks that might affect your application and compromise your security objectives. These threats are the bad effects that could happen to your application. To conduct this identification process, bring members of the development and test teams together to conduct an informed brainstorming session. Use a whiteboard to identify potential threats. Ideally, the team consists of application architects, security professionals, developers, testers, and system administrators.
You can use two basic approaches:
While identifying threats, examine the application tier by tier, layer by layer, and feature by feature. By focusing on vulnerability categories, you focus on the areas where security mistakes are most frequently made. The threats identified at this stage do not necessarily indicate vulnerabilities. Identify potential threats and the actions that an attacker might try to use to exploit the application.
During this step, you perform the following tasks:
The next sections describe each of these.
There are a number of common threats and attacks that rely on common vulnerabilities. As a starting point, use the companion document, "Cheat Sheet: Web Application Security Frame." The cheat sheet will help you identify threats and attacks relevant to your application.
The following vulnerability categories were developed by security experts who have examined and analyzed the top security issues across many Web applications. They have been refined with input from Microsoft consultants, product support engineers, customers, and Microsoft partners. This section identifies a set of key questions to ask for each category.
Review authentication by asking the following:
Review authorization by asking the following:
Review configuration management by asking the following:
Review sensitive data by asking the following:
Review session management by asking the following:
Review cryptography by asking the following:
Review parameter manipulation by asking the following:
Review exception management by asking the following:
Review auditing and logging by asking the following:
Examine each of your application's key use cases that you identified earlier, and examine ways in which a user could maliciously or unintentionally coerce the application into performing an unauthorized operation or into disclosing sensitive or private data.
Ask questions and try to think as an attacker would. Examples of the types of question you should ask include the following:
Review the key use cases and scenarios, and analyze the data flows. Analyze the data flow between individual components in your architecture. Data flow across trust boundaries is particularly important. A piece of code should assume that any data from outside the code's trust boundary is malicious. The code should perform thorough validation of the data.
When identifying threats associated with data flows, ask the following questions:
Note Use existing documentation if you have it. For example, data flow diagrams (DFDs) and Unified Modeling Language (UML) sequence diagrams can help you to analyze your application and identify data flows.
The previous activities have helped you to identify the more obvious and pervasive security issues. You can now explore additional threats and attacks. (It is helpful to set a time limit so that you do not become blocked by this activity.)
Attack trees and attack patterns are the primary tools that many security professionals use. They allow you to analyze threats in greater depth, going beyond what you already know to identify other threat possibilities.
The categorized lists of known threats only reveal the common, known threats. Additional approaches, such as using threat/attack trees and attack patterns, can help you identify other potential threats.
An attack tree is a way of identifying and documenting the potential attacks on your system in a structured and hierarchical manner. The tree structure gives you a detailed picture of various attacks that the attacker uses to compromise the system. By creating attack trees, you create a reusable representation of security issues that will help to focus your threat and mitigation efforts. Your test team can use the trees to create test plans that validate security design. Architects or developer leads can use the trees to evaluate the security cost of alternative approaches. Developers can use the trees to make informed coding decisions during implementation.
Attack patterns are a formalized approach to capturing attack information in your enterprise. These patterns can help you identify common attack techniques.
When creating an attack tree, assume the role of the attacker. Consider what you must do to launch a successful attack and identify goals and sub-goals of the attack. You can use a hierarchical diagram to represent your attack tree, or you can use a simple outline. What is important is that you construct something that portrays the attack profile of your application. Then you can evaluate security risks and use the appropriate countermeasures to mitigate them, such as correcting a design approach, hardening a configuration setting, and other solutions.
Start building an attack tree by creating root nodes that represent the goals of the attacker. Then add the leaf nodes, which are the attack methodologies that represent unique attacks. Figure 3 shows a simple example.
Figure 3. Attack tree example
You can label leaf nodes with AND and OR labels. For example, in Figure 3, both 1.1 and 1.2 must occur for the threat to result in an attack.
Attack trees like the one in Figure 3 have a tendency to become complex quickly. They are also time-consuming to create. An alternative approach is to structure your attack tree using an outline, such as the following.
1. Goal One
1.1 Sub-goal one
1.2 Sub-goal two
2. Goal Two
2.1 Sub-goal one
2.2 Sub-goal two
Note In addition to goals and sub-goals, attack trees include methodologies and required conditions.
The following is a more complete example of the outline approach.
Threat #1 Attacker obtains authentication credentials by monitoring the network
1.1 Clear text credentials sent over the network AND
1.2 Attacker uses network-monitoring tools
1.2.1 Attacker recognizes credential data
In this step, you review the Web application security frame and explicitly look for vulnerabilities. Focus on the vulnerability categories as you did while identifying threats in the previous step. However, note that the sample questions presented in this section are designed to help you identify vulnerabilities, not threats. A useful way of proceeding is to examine your application layer by layer, considering each of the vulnerability categories in each layer.
Identify authentication vulnerabilities by asking the following:
Review authentication by looking for these common vulnerabilities:
Identify authorization vulnerabilities by asking the following:
Review authorization by looking for these common vulnerabilities:
Review input validation by looking for these common vulnerabilities:
Identify configuration management vulnerabilities by asking the following:
Review configuration management by looking for these common vulnerabilities:
Identify sensitive data vulnerabilities by asking the following:
Review sensitive data by looking for these common vulnerabilities:
Identify session management vulnerabilities by asking the following:
Review session management by looking for these common vulnerabilities:
Identify cryptography vulnerabilities by asking the following:
Review cryptography by looking for these common vulnerabilities:
Identify parameter manipulation parameters by asking the following:
Review parameter manipulation by looking for these common vulnerabilities:
Identify exception management vulnerabilities by asking the following:
Review exception management by looking for these common vulnerabilities:
Identify auditing and logging vulnerabilities by asking the following:
Review auditing and logging by looking for these common vulnerabilities:
After you complete the threat modeling activity, do the following:
You should begin the threat modeling exercise early in your project so that the threat model influences the design of your application. To create and update the threat model, develop user stories. A user story describes what the application should do from the point of view of the customer. In this case, you would create stories around the threats, attacks, and security objectives. You should be able to complete a story in a single iteration. You may need to develop new stories as you create and update the threat model.
Consider the following when you plan your stories:
The Microsoft Solutions Framework (MSF) Agile Software Development processes use the architecture diagrams found in the Microsoft Visual Studio Team System. These processes use scenarios instead of use cases. Therefore, when applying the threat modeling activity to MSF for Agile Software Development or MSF for CMMI Process Improvement, use scenarios and system and logical data center diagrams as input.
For more information about building threat models using the system and logical data center diagrams, see the MSF process guidance or the MSF Web site.
For more information about a related threat modeling process from which the current one has evolved, see Chapter 3, "Threat Modeling," in Improving Web Application Security: Threats and Countermeasures, on MSDN at https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh03.asp.
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Please sign in to use this experience.
Sign in