A Hybrid Approach To Threat Modelling
A Hybrid Approach To Threat Modelling
Date: 25-Febraury-2017
Abstract
1. Introduction
The current business world is Information Centric. Information is critical,
information is money and information is at large. All the more, it is transacted over the
internet. It requires no additional motivation for any group to obtain the information to
monetise or use for other purposes that would benefit them. It goes without saying that
it is the inherent responsibility of an organization to provide a secure operating
environment for their customers and employees to protect their interest. At this state it
is an eternal obligation of any organization to look at security just not as a function but
a key business driver.
Threat modelling is the fundamental building block for building secure software.
Unless one understands the threats that they are exposed to in a structured way, it will
not be possible to build a secure operative environment and software. It is needless to
say that threats grow along with evolution of technology and delivery models. A SANS
survey (2015 State of Application Security: Closing the Gap [1]) indicates that threat
assessment (which can also be referred to as threat modelling) is the second leading
application security practise (next to penetration testing) for building secure web
applications. Thus threat modelling is a pro-active security practice that organizations
should adopt.
2. Threat Modelling
2.1 An Overview
Where to start?
How to identify the threats?
What are the targets of an attacker?
Who could attack and how can they attack?
A Hybrid Approach to Threat Modelling 3
When any organization plans to build a new application, add features to an existing
application or change their delivery model (move to cloud), their primary objective
should be to build a secure design for the application. Threat Modelling is a technique
that helps achieve this objective in a simplified and structured way.
Countermeasures
How to defend /
Attacks prevent the attack?
How it is going to
Vulnerabilities happen?
What is the cause
Threats of attack?
Probability of
occurance of an
adverse incident
2.2.1 STRIDE
Please note that the above table provides an example of how to use STRIDE to
enumerate threats but does not contain exhaustive set of threats given the context. Each
attack property is mapped to the application functionality to identify the threats. In a
real-world scenario the entire ecosystem of application and its technology stack should
also be taken into consideration during threat enumeration.
External Entity: Represents the source from which the data is sent to the application or
destination to which the application sends the data.
Data Flow: Represents the data flow from and to the application.
This technique should be used when the team is motivated to find additional or
intricate threats (on top of already identified threats) specific to these elements. This
method could be perceived as one which is tightly-coupled with such elements. An
organization should identify elements that need further threat analysis. Continuing with
the payroll application example, consider the following DFD:
From the DFD it is evident that confidential data is transacted between user
(admin and employee) and application, and that XML is used for transporting the data.
Also, the application parses XML data before storing the values in the payroll details
table. Another key point to note is that XML can present an attractive target for
adversaries as it has been widely used and susceptible to different types of attack. Thus
data flow becomes one of the elements that need additional focus. To break down, let
us consider the following two points to decide whether an element represented in the
DFD requires additional focus:
Table 3 – STRIDE-per-Element
Since the focus is related to data flow via XML, various threats relating to
XML are enumerated so that defence in depth can be achieved.
Table 4 – STRIDE-per-Interaction
In the attack tree, the ultimate goal of the attack is the root node, while the
children and leaf nodes represent the sub goals. In the tree, nodes can be either
represented as “AND” or “OR” nodes. Let us consider the following diagram:
AND
OR OR
“AND” represents different or multiple steps required to achieve the goal. In figure
3 the goal is to modify the /etc/passwd file. Without legitimate access to the server
A Hybrid Approach to Threat Modelling 10
an attacker must gain access to the server (remote login) AND escalate to root
privilege.
“OR” represents different ways to achieve the goal. In figure 3, an attacker can
either exploit the vulnerability of the webserver OR SSH service to establish remote
login or access to the server. Similarly, to escalate to root privilege, an attacker can
either exploit linux-kernal vulnerability OR a vulnerable service that runs as root.
Once the possible attacks against an application have been modelled in a tree
structure, one can assign attributes to those attacks. Following are the attributes that can
be applied:
Other than considering the attacker’s goal, an attack tree can be built based on:
STEP-1: Identify the goals – each goal can be a separate attack tree, in case of large
attack vector even sub-goals can be represented in separate tree structures.
STEP-2: Identify the various categories of attacks required to accomplish the goals.
STEP-3: If a generic attack tree library exists, it can be plugged into the attack tree
being constructed.
A Hybrid Approach to Threat Modelling 11
Organizations can either develop their own library or leverage formal lists or
dictionaries published by the security community or consortium such as Open Web
Application Security Project (OWASP), Common Weakness and Enumeration (CWE),
and Common Attack Pattern Enumeration and Classification (CAPEC). Let us look at
each of these libraries:
zone, payload activation impact, security requirements, CIA impact, and technical
context. Although this list is rich with information, how much of these details are
necessary for performing an effective threat modelling exercise?
STEP 1: Build an attack library or identify an existing library that can provide
information about attack patterns.
STEP 2: Identify the area (based on the development scope or project) for which threat
modelling exercise is applicable.
STEP 3: Review the application that was developed against each of the attack /
vulnerability / weakness in the attack library
STEP 4: Document the potential threats and countermeasures.
Suitable as a check-list model, hence cannot be applied during the design phase.
A Hybrid Approach to Threat Modelling 16
Information rich and needs referencing which may lead to time consuming and a
tedious exercise (trade-off between exhaustive details vs productivity).
Countermeasures suggested in the attack library (OWASP, CAPEC, CWE) are
abstract or at high-level, and may not align to programming language or framework
used in the organization.
This technique helps to think from attacker’s perspective, but poses a challenge to
structure a way to address the defence against these attacks.
As discussed in the previous sections, there are limitations when each of these
threat modelling techniques are implemented independently. When implemented as
separate techniques, some of the key aspects required for threat modelling may be
missed, thus impacting the productivity and comprehensiveness of the exercise.
Therefore the optimal approach is to adopt a hybrid model drawing from the best of
each of these techniques.
Structured approach
Optimum detail
Readability
Optimum Detail: Providing information that can be easily interpreted and acted
upon serves as a critical factor to the successful outcome of a process. The consumers
A Hybrid Approach to Threat Modelling 17
of this exercise are mostly software developers / architects / testers who might not
necessarily be security experts. Hence providing either excessive information or
minimal details will not only impact the result of the exercise but also the security of
the software application. Therefore publishing the optimum amount of detail will
immensely contribute to the successful outcome of the exercise.
Design Analysis: The first step is the study of DFD or architecture diagrams to
obtain knowledge about the data flow in the application component. If required the
A Hybrid Approach to Threat Modelling 18
areas that may require further consideration from the application security context
should be marked.
Threat Identification: To identify the threat or what could go wrong, the following
elements are considered:
o Establish Trust Boundary: Trust boundary is a line beyond which the web
application will not have control over the data. This indicates that any data sent
from elements beyond this line should always be validated before being
processed. The objective of establishing a trust boundary is to define the
potential threat actors i.e. users who can launch an attack against the application.
In a diagram, the trust boundary is often depicted as dotted lines representing
trust for components within the lines. Any component beyond this boundary
should be treated as unknown and should be scrutinized.
o Identity Threat Actors: Once a trust boundary is established the threat modellers
will know the entities whose request or input should always be validated.
Anyone who poses a threat to the web application can be classified as a threat
actor. This can include legitimate users of the application or adversaries (not
having approved access to the web application) on the internet trying to attack
the web application. While analysing complex enterprise applications that
contain multiples user roles with varying privileges, it is often essential to create
a list of threat actors. Defining these threat actors is completely based on the
criticality and business context of that web application.
o Identity Attack Surface: Attackers may launch their payload from various entry
points in the application and ultimately impact the business. Threat actors define
A Hybrid Approach to Threat Modelling 19
“who will attack” whereas attack surface indicates “from where will the attack
originate”. While examining the DFD, the points where data transacted from
untrusted sources are identified and marked as potential entry points. For
example, a web application authentication page where users submit credentials
(username and password via input fields) to access protected resources. This
can be an entry point for the attacker to conduct a brute-force attack or SQL
injection attack via these input fields. Identifying the attack surface completes
the process of threat enumeration, as one would have adequate information on
the trust boundary, potential adversaries, and the point from where the attack
will be launched.
Threat Categorization: The objective of threat categorization is to frame the
countermeasures for the given scenario. There are bound to be challenges while
categorizing, especially when threats overlap multiple categories. In such situations,
mark the threats in the applicable categories, but use the primary attack objective to
help identify the countermeasures. For example, consider a threat scenario where a
session id is not well protected (uses weak hashing algorithms). An adversary
attacks and obtains a valid session id, while either at rest (cached in web browser)
or in transit, and then uses it to impersonate a legitimate user. A typical dilemma
may be to categorize it as either information disclosure, spoofing, or both. In this
case, the objective of the attack is to obtain the exposed session id while the result
of the compromise may lead to spoofing. Because the attack objective relates to
information disclosure, categorized the threat as information disclosure and
document the associated countermeasure: create session ids using strong
cryptographic algorithms and transmit values over secure communication channels.
Threat Mitigation: The following points have to be addressed to arrive at an
effective threat mitigation plan:
o Countermeasures: This is a set of actions taken to defend the attack for the
given threat scenario. In this section, threat modellers should provide both
conceptual and technical details to secure the web application. For example,
the countermeasure for SQL Injection Attack: using of parameterized
queries, stored procedures, and whitelist input validation must be explained
conceptually for the software developers to understand the approach for
defending against such an attack.
A Hybrid Approach to Threat Modelling 20
As indicated in the above diagram, the STRIDE technique should be used for
threat identification and threat categorization, and attack library for threat mitigation.
Attack tree should be used to provide an abstract view about attacks against a particular
feature or component of an application. The following points provide the rationale
behind this mapping:
the hybrid model covering the key aspects of a structured approach, optimum details
and readability. The template is divided into two parts:
Table-1: The first four rows capture the summary about the specific area selected for
threat modelling, details about the team and references to the design that will be
analysed.
Table-2: Various users of the application and even external web services or systems
interacting with the application are mentioned along with their scope to the trust
boundary.
Table-3: Threat actors: potential threat agents or entities who can harm the application
are documented.
Table-4: Attack surface: different entry points by which the threat actors can launch
their payload and gain illegitimate access to the application.
Table-5: Threat consideration: threat modellers can highlight the schemes that are
considered as part of this threat modelling exercise, as it provides a nice overview and
understanding about areas covered in this exercise.
Col-1: Ref No: a nomenclature to uniquely identify a threat scenario. This can be
subsequently mentioned in various stages in the SDLC process to ensure the threat has
been adequately handled.
Col-2: Elements: indicates the element (external entity, data flow, data store, and
business logic) to which the threat is mapped. This aids consideration of the threats
specific to those elements.
Col-3: Interaction: The specific flow in the application to which the threat scenario will
be addressed.
Col-4: Threat scenario: captures “what could go wrong” considering the element
involved and specific flow in the application.
Col-5 to 10: STRIDE: these columns are used to categorize the identified threat. As
mentioned earlier, the threat can be categorised in more than one attack property which
will help in determining precise countermeasures.
Col-11: Countermeasures: conceptual details about the security controls that needs to
be implemented to tackle the identified threat scenario. The countermeasures need to
be effective in order to ensure that the threats are not realized.
Col-12 to 14: Attack library: illustrates the best practices by providing a description of
the possible attacks, and secure coding practises to prevent the same. This serves as a
guideline for software developers while implementing the countermeasure for the threat
scenario. It is in the best interest of the organization to develop their own attack library
or secure coding guidelines as it will be aligned to their technology stack (programming
language and development frameworks). Solutions provided in CAPEC or CWE may
be abstract and not in the programming language adopted by the organization. However
the intention is to provide a direction for the software developers on secure coding
practices which will result in developing secure applications.
A Hybrid Approach to Threat Modelling 23
3. Conclusion
To reap the complete benefit from the exercise we have to utilize a combination
of each of these techniques to perform the various activities in the threat modelling
process. Critical success factors for the threat modelling exercise lies in adopting a
structured approach, providing optimum details and readability. Hence this paper
proposes a hybrid model that would implement the techniques that best suit each of the
activities in threat modelling.
Acknowledgments
I wish to thank Mr. Marty Solomon - Senior Director Software Security Architecture
and Mr. Tom Connor – Director Software Engineering, Pegasystems Inc. for providing
their valuable feedback and being of support.
A Hybrid Approach to Threat Modelling 24
References
[1] Bird, J., Johnson, E., & Kim, F. (2015, May). 2015 State of Application Security: Closing
the Gap. Retrieved from https://www.sans.org/reading-room/whitepapers/analyst/2015-
state-application-security-closing-gap-35942
[2] Shostack, A. (2014). In Threat Modeling Designing for Security (p. 61).
[3] Shostack, A. (2014). In Threat Modeling Designing for Security (p. 78).
[4] Osterman, L. (2007, September 10). Threat Modeling Again, STRIDE per Element.
Retrieved from https://blogs.msdn.microsoft.com/larryosterman/2007/09/10/threat-
modeling-again-stride-per-element/
[5] Shostack, A. (2014). In Threat Modeling Designing for Security (p. 80).
[6] Shostack, A. (2014). In Threat Modeling Designing for Security (p. 87).
[7] Schneier, B. (1999, December). Attack Trees. Retrieved from
https://www.schneier.com/academic/archives/1999/12/attack_trees.html
[8] Ristic, I. (2009, September 09). SSL Threat Model. Retrieved from
https://blog.ivanristic.com/2009/09/ssl-threat-model.html
[9] Shostack, A. (2014). In Threat Modeling Desiging for Security (p. 101).
[10] OWASP Top 10 Vulnerabilities. (2013). Retrieved from
https://www.owasp.org/index.php/Top_10_2013-Top_10
[11] CAPEC: Mechanisms of Attack. (2015, December). Retrieved from
https://capec.mitre.org/data/definitions/1000.html
[12] CWE: Software Fault Pattern. (December). Retrieved from 2015:
https://cwe.mitre.org/data/graphs/888.html