Tutorials
Creating and analyzing a new model
This tutorial provides a detailed explanation of how to use SPARTA to elicit security and privacy threats from a DFD model.
It goes through each of the involved steps: creating an initial DFD model, loading a threat type catalog, analyzing the model to obtain an initial list of threats, loading a solution catalog, instantiating a number of solutions in the model, evaluating the effect of these solutions on the list of threats.
The running example can be downloaded here
Introduction
Before following the rest of this tutorial make sure you have SPARTA up and running. Download the latest version and unzip it wherever you want. SPARTA does not require any further installation.
Setting up the initial model
The first steps in the tutorial involve the creation of a simple DFD model, which combined with a threat type catalog, allows us to automatically elicit security and/or privacy threats.
Creating a DFD model
To create a DFD Model, right-click your newly created project, select New > Other… and then pick Sparta Model.
A wizard wil open to enter the necessary details.
Give your model file a name.
This name must end in .sparta.
Next, choose DFD Model as model object and then Finish.
You can create separate files for individual model elements, but it is more convenient to keep everything together in a single model file.
If you open this file, you will see a tree view with a DFD Model element at the root. While you can add all elements in this view, this is not the most straightforward way to model your DFD. Instead, let us use a graphical modeling view. Right-click you project again and select Create Representation. Pick DataFlowDiagram and select your DFD Model. After that you can enter a name for your diagram. This graphical modeler can be used to create your diagram, and the changes you make will be reflected in the model (.sparta) file. The properties view at the bottom can be used to enter information, such as the name of the elements, or to make any manual modifications. If you click the background, the root DFD Model is selected. This way, you can give the DFD Model itself a name as well.
Creating model elements
After creating the DFD Model, we can start to populate it with a number of concrete elements. Let us start with the creation of a TrustBoundary element so we can distinguish between interactions that are external and those that are internal to our system. In the pane at the right-hand side of the modeler, select the createTrustBoundary option and then click the model, after which a new trust boundary should be shown. The name and other properties of the newly added trust boundary can be edited in the properties view.
Next, let us add a number of processes in the trust boundary by selecting the createProcess option and clicking somewhere in the trust boundary. These processes constitute the internal logic of our application. We can also add a data store inside the trust boundary to enable our processes to store and retrieve some data.
Finally, we can add an external entity outside of the trust boundary to represent the end user. This end user will communicate with one of our processes. We can add data flows between these different elements as required, by selecting the createDataFlow option and clicking the sender and recipient of the data flow.
Loading threat type catalog
Before we can actually elicit threats from this model, we will need to specify a catalog containing threat types. These threat types will then be automatically picked up by SPARTA and elicited from the model. To do this, download a threat type catalog. Add this file to your project, by dragging it to your project or by right-clicking the project import > filesystem and then selecting the catalog file.
Now the catalog is part of the project, but we will still need to link this to the model. For this, open the model properties (via the tree editor or by clicking the background in the graphical modeler), find the resource properties and add the threat catalog to the model’s resources. That way, it will be referenced from the model and automatically loaded in. It is also possible to later change this to a different catalog of threat types.
Assigning asset values (optional)
Another optional step is assigning asset values to the different elements in the DFD model. The threat elicitation will work regardless of this information, but SPARTA will not be able to prioritize any of the threats without any information about the potential loss these threats would cause.
An asset value can be assigned to any DFD element, simply by adding an estimate to the element. Adding this estimate currently needs to be done via the model tree editor (right-click element > New Child > Estimate) instead of the graphical modeler. Every estimate requires four values:
the probable value
the minimum value
the maximum value
the confidence
Since it is difficult to assign precise values, the estimates enable expressing uncertainty in these values which will be taken into account by SPARTA during the threat analysis.
Asset estimates can also be provided per threat type, for example if the integrity of some element is more valuable than its availability. When calculating the risk of a threat, SPARTA uses the specific estimate for the threat type in that element if there is any. If not, the first estimate of that element will be taken into account.
Loading attacker profiles catalog (optional)
This is an optional step that can be skipped if you want to go straight to the model analysis step. Every elicited threat in SPARTA is considered against a certain set of attacker profiles. The attacker profiles to consider during the analysis are also provided as part of the model. If no attacker profiles are provided, SPARTA will use a default one during the analysis.
The attacker profile species a number of attacker specific parameters. These are:
the contact frequency: how frequently the attackers come into contact with the system
the probability of action: if an attacker comes into contact with the system, how likely is that attacker to attempt an attack
the threat capability: how capable is the attacker in defeating countermeasures
The above three values are all expressed as estimates, just as the asset values mentioned above.
A final and model-specific property is:
insider: for which elements can the attacker bypass any countermeasures for the set of elements listed under insider; the attacker can completely bypass the countermeasures regardless of their strength
To create an attacker model, right-click your project, select New > Other… and then pick Sparta Model.
A wizard wil open to enter the necessary details.
Give your attacker model file a name.
This name must end in .sparta.
Next, choose Attacker Model as model object and then Finish.
Attackers and their properties can then be specified in the tree editor of the newly created file.
Analyzing the DFD model
After we have collected all the necessary information in the model, let us analyze it next. Analyzing the model with SPARTA is as easy as clicking the green play button in the threat analysis panel on the right-hand side of the interface. If this panel is not visible, go to Window > Show View > Other > ThreatAnalysis. Afterwards, the SPARTA analysis engine will automatically link itself to the model that is currently open, and it will start eliciting and analyzing threats and provide the results in the analysis panel. These results can be subsequently sorted according to, for example, the risk score or the vulnerability. Do note that, because SPARTA works with estimates and uncertainty from the start, the precise risk values will fluctuate over the analysis as the calculation uses samples from statistical distributions based on the estimate parameters.
Furthermore, SPARTA will keep monitoring the model and update the results as new changes are made to the model. If changes are made to the model that introduce new threats or invalidate old ones, these will be updated accordingly in the threat list.
Extending the model with solutions
As you may have noticed from the analysis results of the first part of the tutorial, the vulnerability is 1 for every elicited threat. This is the result of not having any security or privacy solutions with countermeasures in our model. In this second part of the tutorial we will load a catalog with some solutions and apply these in our model to protect against some of the threats we identified earlier.
Loading a solution catalog
Before we can apply any mitigations in our model we need some information on the type of solutions that can be applied. A solution catalog specifies a set of security and privacy solutions in a reusable way, so that we can apply them on multiple different DFD models. To use a catalog, we need to refer to it from the model in exactly the same way as we did for the threat type catalog.
To do this, download a solution catalog. Add this file to your project, by dragging it to your project or by right-clicking the project import > filesystem and then selecting the catalog file. Next, open the model properties (via the tree editor or by clicking the background in the graphical modeler), find the resource properties and add the solution catalog to the resources.
Note
It is not strictly necessary to refer to the solution catalog in the resources of the DFD Model if you already applied some solutions. In that case, SPARTA will load the solution catalog when it encounters the solution instances in the model.
Note
Problems may arise when the threat types referenced by solution types in a solution type catalog are different from the threat types specified in the threat type catalog used in your project.
Instantiating security and privacy solutions
With the solution catalog loaded in, we can start to add some concrete solutions to our model. An obvious threat to start with is information disclosure on the communication between the end user and our internal processes. To resolve this problem, we can introduce a secure pipe solution. This solution will encrypt the communications to ensure the information remains confidential. (It also includes some additional countermeasures to ensure integrity of the data and verify the authenticity of the server process.) To add the solution, we will create a new solution instance, either through the pane at the right-hand side of the graphical editor, or in the tree view by right clicking the model and selecting New Child > Solution. In the properties of this solution instance we specify that it is an instance of the Secure Pipe solution. Next we add four rolebindings to the solution instance. These rolebindings will link the client external entity, server process, and send and receive flows to the corresponding roles of the Secure Pipe solution. Select the rolebinding and in the properties pane select the role of the solution. Next, use the role assignment tool and link the rolebinding element to the element in the DFD model.
For clarity, you may want to hide the solution instances model view by right-clicking the solution instance and selecting Show/Hide > Hide Element. Hidden elements can be revealed at any time through the Show/Hide button.
Evaluating the impact of the solutions
After assigning the four roles in the solution, all elements should be linked and the solution will be taken into account during the threat analysis. You should see the risk of a number of threats to be recalculated accordingly. This recalculation will happen as elements are linked to solutions which allows you to assess the impact of applying these solutions.
Conclusion
This brief tutorial illustrated how SPARTA supports the creation and subsequent analysis of DFD models and how you can enrich these models with security and privacy solutions to mitigate the uncovered threats.
Creating security/privacy solutions
This tutorial provides a detailed explanation of how to use SPARTA to create a catalog of security and privacy solutions.
Creating a solution catalog
The first step in SPARTA requires the creation of a Solution Catalog.
Right-click your newly created project, select New > Other… and then pick Sparta Model.
A wizard wil open to enter the necessary details.
Give your model file a name.
This name must end in .sparta.
Next, choose Solution Type Catalog as model object and then Finish.
You can create separate files for individual model elements, but it is more convenient to keep everything together in a single model file.
Creating a new solution type catalog.
If you open this file, you will see a tree view with a Solution Type Catalog element at the root. Since there is currently no graphical editing support for solutions, they will need to be created in this tree view.
Loading threat type catalog
Before starting to create the actual types of solutions, it is best to first load in a threat type catalog because the countermeasures in the solution types will have to specify against which types of threats they defend.
To do this, download a threat type catalog.
Add this file to your project, by dragging it to your project or by right-clicking the project import > filesystem and then selecting the catalog file.
Now the catalog is part of the project, but we will still need to link this to the model.
In the open solution catalog file, load the Threat Type catalog via SpartaModel Editor > Load Resource...
Load resource via SpartaModel Editor menu.
After the resource is loaded, countermeasures in the created solutions can refer to the threat types of that catalog.
Creating a new type of solution
For adding new types of solutions, create a new Solution Type child in the solution type catalog.
Adding roles
After creating the solution type, roles can be added (right-click the solution type and select New Child > …). These role express which types of DFD elements are involved in the solution. A role must specify the type of the DFD elements that can fullfil it.
Example
Some roles may be restricted to data flows, while others could be filled in only by processes.
Adding countermeasures
After adding the roles, the countermeasures can be introduced to specify how certain threats are prevented on the elements that fullfil the aforementioned roles. This can again be done by right-clicking the solution and selecting New Child > Counter Measure. After adding the element, the countermeasure properties are used to express the effect of the countermeasure.
- Mitigates
This property specifies one or more threat types that are mitigated by the countermeasure.
- Subject
This property specifies which role receives the protection against threats of the specified type.
- Scope
Scope can be used to limit the effect of the countermeasure.
Example
A countermeasure against spoofing, such as server authentication in the context of SSL/TLS, only protects against spoofing of the server process for the communication that actual occurs over SSL/TLS connection. Spoofing of the server can still occur with other data flows to that server process. Therefore the spoofing countermeasure can link to the relevant data flow roles to indicate the effect of the countermeasure is limited to those data flows that are part of the solution.
- Strength
The strength of a countermeasure is specified by adding a child estimate. The strength value of this countermeasure is compared against the threat capability of an attacker to determine whether the attacker is able to defeat the countermeasure.
Creating attacker models
This tutorial provides a detailed explanation of how to use SPARTA to create a catalog of attacker profiles.
Creating an attacker model
The first step in SPARTA requires the creation of an Attacker Model.
Right-click your newly created project, select New > Other… and then pick Sparta Model.
A wizard wil open to enter the necessary details.
Give your model file a name.
This name must end in .sparta.
Next, choose Attacker Model as model object and then Finish.
Creating an attacker model.
If you open this file, you will see a tree view with a Attacker Model element at the root. Since there is currently no graphical editing support for solutions, they will need to be created in this tree view.
Creating a new attacker profile
For adding new attacker profiles, create a new Attacker Profile child in the Attacker Model.
- Enabled
Whether the attacker profile has to be taken into account during the analysis.
- Insider
This refers to the elements of a concrete DFD model where the attacker is a insider and, thus, is able to completely bypass countermeasures (regardless of their strength).
Additional properties of the attacker profile are expressed as estimates.
- Threat Capability
The capability of the attacker. This determines to which extent the attacker is able to defeat certain countermeasures.
- Contact Frequency
How frequently the attacker comes into contact with the system.
- Probability of Action
How likely the attacker is to attempt to attack the system (when into contact).