Tutorials
The first tutorial walks you through creating a DFD model, eliciting its threats with a threat type catalog, and reducing their risk with solutions from a solution catalog. The other three tutorials show how to create your own catalogs: solution type catalogs, attacker models and threat type catalogs.
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, and exporting the results.
Note
The running example, including basic threat and solution catalogs, can be downloaded here.
The archive contains the Eclipse modeling project Tutorial with the DFD model of the first part of this tutorial (model.sparta and its diagram in representations.aird), the solution catalog SolutionTypeCatalog.sparta, and the threat type catalogs stride-per-interaction - MTMT.sparta, stride-per-interaction - Shostack.sparta, stride-per-element.sparta and LINDDUN-PRO.sparta.
To open it, choose and point Select archive file to the downloaded Tutorial.zip.
Introduction
Before following the rest of this tutorial make sure you have SPARTA up and running. Download SPARTA 2026.2 and extract the archive wherever you want. SPARTA includes its own Java runtime and does not require any further installation. See Installing SPARTA for the available downloads and for installing SPARTA into an existing Eclipse IDE instead. The workbench itself (Project Explorer, editors, Properties view, and ThreatAnalysis view) is described in SPARTA Interface.
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 project
All models live in a project.
Choose (or ), give the project a name, and click Finish.
The modeling project contains a file representations.aird, which stores the diagrams you create below.
Creating a DFD model
To create a DFD model, right-click your newly created project and select .
(The same wizard is also available through .)
A wizard will open to enter the necessary details.
Give your model file a name ending in .sparta (the default is model.sparta).
Click Next, choose DFD Model as Model Object, and click 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 (the SPARTA Model Editor) 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 your project again and select Create Representation.
Pick Data Flow Diagram (under the viewpoint DataFlowDiagram), click Next, select your DFD Model, and click Finish.
After that you can enter a name for your diagram; the default is new DataFlowDiagram followed by the name of the DFD model.
Alternatively, expand the .sparta file in the Project Explorer, right-click the DFD Model element and select New Representation.
For your first diagram, this menu only contains Other…, which opens the same wizard; later, it lists an entry that starts with new DataFlowDiagram.
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.
The tools are in the DFD Elements section of the palette at the right-hand side of the modeler.
Let us start with the creation of a trust boundary so we can distinguish between interactions that are external and those that are internal to our system.
Select the createTrustBoundary tool and then click the diagram, after which a new trust boundary (named Container 1, displayed in upper case) 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 tool 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 with the createDataStore tool to enable our processes to store and retrieve some data.
New elements get default names such as Process 1, Process 2, and DataStore 1.
Finally, we can add an external entity outside of the trust boundary with the createExternalEntity tool 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 tool and clicking the sender and then the recipient of the data flow.
For the second part of this tutorial, add both a flow from the external entity to the process and a response flow from that process back to the external entity.
Data flows that cross a trust boundary are drawn in dark red and their name is followed by (!); you can turn this off by disabling the Mark Flows Crossing TrustBoundary layer in the Layers drop-down of the diagram toolbar.
Annotating model elements (optional)
Additional information can be added to the model in the form of annotations.
Such annotations may be required to identify specific threats.
For example, identifying threats related specifically to logging may require information on where logs are stored.
Annotations are added in the tree editor: double-click the .sparta file to open it, right-click the element, and select (with a single Value property) or (with a Key and a Value).
Which annotations matter depends on the threat type catalog.
For example, the catalog stride-per-interaction - MTMT.sparta in Tutorial.zip only elicits its Process Memory Tampered threat for a process that has a Model Element Annotation with the value mstmt.unmanaged-code.
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.
Threat type catalogs for STRIDE and LINDDUN are available in the SPARTA catalogs repository; for this tutorial, use STRIDE/STRIDE-per-interaction/Shostack/stride-per-interaction - Shostack.sparta from that repository, or stride-per-interaction - MTMT.sparta from Tutorial.zip.
Add this file to your project, by dragging it to your project or by right-clicking the project, selecting , and then selecting the catalog file.
Note
The solution catalog and the per-threat-type estimates in this tutorial refer to threat types by their ID (for example stride.tampering).
The catalog from the repository and the MTMT catalog in Tutorial.zip define these IDs; the copies of stride-per-interaction - Shostack.sparta and stride-per-element.sparta in Tutorial.zip do not, so solutions and estimates keyed by ID have no effect on their threats.
Caution
In SPARTA 2026.2, catalogs whose threat patterns have no data flow parameter, such as STRIDE-per-element, are only partly supported.
The ThreatAnalysis view and CSV Export handle their threats, but once a solution whose countermeasures have a scope (such as SecurePipe below) is bound to the threatened element and mitigates the threat, the risk calculation of that threat fails and the view shows 0 for its values, which looks like a fully mitigated threat.
Report Export fails when the analysis contains such threats (see Analysis results and exports).
Use a STRIDE-per-interaction catalog for this tutorial.
Now the catalog is part of the project, but we will still need to link this to the model. This step is required: SPARTA only analyzes the model file itself and the files that the model refers to. The link is made through the Resource property of the DFD Model:
Open the model in the tree editor by double-clicking the
.spartafile.Load the catalog into the editor: choose , click Browse Workspace…, select the catalog file, and click OK.
Select the DFD Model element and, in the Properties view, click the … button of the Resource property.
In the dialog, select the Threat Type Catalog, click Add, and then OK.
Save the model file.
The same Resource property is shown on the Main tab of the Properties view when you click the background of the diagram. That way, the catalog 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 the element and select ) instead of the graphical modeler. Every estimate has the following properties:
Minimum: the lowest plausible value.
Probable: the most likely value, between the minimum and the maximum.
Maximum: the highest plausible value.
Confidence: how strongly the values concentrate around the probable value. The default
0treats every value between the minimum and the maximum as equally likely; higher values (for example4or10) put more weight on the probable value.Name (optional): a label that helps you recognize the estimate in the tree.
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.
An estimate whose minimum equals its maximum is an exact value.
A newly created estimate has all values 0, so always set its values: an estimate of exactly 0 means no loss.
See Estimates for how SPARTA turns an estimate into a probability distribution.
Asset estimates can also be provided per threat type, for example if the integrity of some element is more valuable than its availability. First add all the estimates to the element, then map them to threat types with one of these children:
: the Key is the ID of a threat type or threat type group, such as
stride.tampering, and the Value is one of the element’s estimates. InTutorial.zip,Process 1uses this to map its estimateProcess 1 tampering valuetostride.tampering.: the Key is a threat type (not a threat type group) from a loaded catalog, and the Value is one of the element’s estimates.
When calculating the risk of a threat, SPARTA uses the estimate mapped to that threat type, or, by ID, to one of its threat type groups. If there is none, the first estimate of that element is used.
Linking an attacker model (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, named Opportunist, during the analysis.
The attacker profile specifies 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 difficulty.
To create an attacker model, right-click your project and select .
A wizard will open to enter the necessary details.
Give your attacker model file a name ending in .sparta.
Click Next, choose Attacker Model as Model Object, and click Finish.
Attackers and their properties can then be specified in the tree editor of the newly created file, as explained in the tutorial Creating attacker models further on this page.
Like a catalog, the attacker model must be linked to the DFD model, or SPARTA will not see it and will use the default profile instead. Open the DFD model in the tree editor, load the attacker model file with , and add the Attacker Model to the Resource property of the DFD Model, as you did for the threat type catalog.
Note
In SPARTA 2026.2 the Enabled property of an attacker profile has no effect: every attacker profile in the linked attacker models is used.
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
Load and Analyze Model button in the ThreatAnalysis view on the right-hand side of the interface.
If this view is not visible, choose and select ThreatAnalysis in the ThreatAnalysis category.
Load and Analyze Model analyzes the model of the active editor. With the diagram open in the editor area, this is the DFD model of the diagram; in the tree editor, it is the model of the element selected in the tree. SPARTA elicits the threats from the model and the linked catalogs, calculates their risk, and shows the results in the ThreatAnalysis view. The header of the view shows the number of threats and the total, residual, and mitigated annualized risk; the table lists one threat per row with its location, type, name, data flow, risk, single loss event (SLE), vulnerability, loss event frequency (LEF), and description. Click a column header to sort the threats, for example by risk or vulnerability (click again to reverse the order, and a third time to remove the sorting). Double-click a threat to see its details. See Analysis results and exports for a full description of the view.
Do note that, because SPARTA works with estimates and uncertainty from the start, it calculates the risk values from samples drawn from statistical distributions based on the estimate parameters. The precise values therefore differ slightly every time you analyze the model.
While the analysis is loaded, SPARTA keeps monitoring the model. If changes are made to the model that introduce new threats or invalidate old ones, for example adding or removing elements or data flows, these will be updated accordingly in the threat list. In SPARTA 2026.2, the risk values of threats that are already listed are not recalculated, though (see Analysis results and exports).
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, take the solution catalog SolutionTypeCatalog.sparta from Tutorial.zip, or create your own as described in the tutorial Creating security/privacy solutions further on this page.
Add this file to your project, by dragging it to your project or by right-clicking the project, selecting , and then selecting the catalog file.
Next, load the catalog in the tree editor of the model () and add the Solution Type Catalog to the Resource property of the DFD Model.
Note
The Apply Solution tool used below only offers the solution types of the catalogs listed in the Resource property of the DFD Model (and solution types contained in the DFD model itself), so link the solution catalog before you apply solutions. Solutions that are already applied refer to their catalog themselves, so SPARTA also takes them into account in the analysis.
Note
The countermeasures of a solution type refer to the threat types they mitigate, either directly or by threat type ID.
The countermeasures in SolutionTypeCatalog.sparta use the STRIDE IDs (stride.spoofing, stride.tampering, stride.informationdisclosure, and so on), so they only mitigate threats of a threat type catalog that uses the same IDs.
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: the solution type SecurePipe in SolutionTypeCatalog.sparta.
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.)
SecurePipe has four roles:
SP_sender: the client that sends the request (here, the external entity);SP_recipient: the server that receives it (the process);SP_sendFlow: the data flow from the client to the server;SP_receiveFlow: the response flow from the server back to the client.
To add the solution, use the Security Tools section of the palette:
Select the Apply Solution tool and click an empty spot of the diagram.
In the dialog Select solution to apply, choose
SecurePipein the Solution list. The dialog shows the Name and the Number of Roles of the selected solution type. Click OK. SPARTA creates a solution namedSecurePipewith one role binding for every role of the solution type. The role bindings are shown as small gray squares on the border of the solution. Select a square to see its role in the Binds property of the Properties view.Select the Assign Role tool, click a role binding square, and then click the DFD element or data flow it applies to. Assign
SP_senderto the external entity,SP_recipientto the process,SP_sendFlowto the flow from the external entity to the process, andSP_receiveFlowto the response flow. The tool only accepts targets of the types allowed by the role (for example, a data flow forSP_sendFlow). Each assigned element is connected to its role binding by a gray line.
Tip
A role binding can be bound to several elements.
If the external entity sends several data flows to the process over the secure pipe, bind all of them to SP_sendFlow: use Assign Role again from the same SP_sendFlow square for each further flow.
Likewise, bind all response flows to SP_receiveFlow.
You do not need a second SecurePipe solution for these flows.
Alternatively, you can build the solution step by step: the createSolution tool creates an empty solution, whose Securitypattern property you set to the solution type, and the createRole tool adds a role binding to it, whose role you set in its Binds property.
In the tree editor, right-click the DFD Model and select ; once its Securitypattern is set, right-click the solution and select New Child followed by the name of a role (for example SP_sender) to add a role binding for it.
Instead of the Assign Role tool, you can also select a role binding and add elements to its Binds To list in the Properties view, with the … button next to the list.
To remove an element from a role binding, select it in that list and click the red remove button; deleting the gray line in the diagram does not unbind the element.
The recording below applies the solution with Apply Solution and then sets the Binds To property of each role binding in the Properties view.
For clarity, you may want to hide the solution instances in the diagram by right-clicking the solution instance and selecting . Hidden elements can be revealed at any time through the Show/Hide button in the diagram toolbar. Alternatively, all solutions can be hidden from a diagram by disabling the SecurityView layer in the Layers drop-down of the diagram toolbar, as shown below. This also hides the Security Tools section of the palette until you enable the layer again.
Evaluating the impact of the solutions
After assigning the four roles in the solution, all elements are linked and the solution will be taken into account during the threat analysis.
If a role covers several elements, such as several request flows, link all of them to that role’s binding: the countermeasures for that role apply to each linked element.
Click
Load and Analyze Model again to recalculate the risk of all threats; in SPARTA 2026.2 the values are not updated automatically when you apply a solution.
The threats that the solution mitigates now have a vulnerability lower than 1 and a lower risk, and the header of the ThreatAnalysis view shows the mitigated annualized risk and the risk reduction progress.
Repeat this step after every change to assess the impact of applying these solutions.
Exporting the results
The ThreatAnalysis view can export the current analysis results:
CSV Export writes the threat list to the file threats.csvin the root of the project that contains the model.
Report Export writes the sources of a LaTeX report to the folder reportin the root of that project.
Neither action asks for a file name or location, and an existing threats.csv is overwritten.
Refresh the project in the Project Explorer (F5) to see the new files.
See Analysis results and exports for the file formats and for compiling the report.
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. To write your own threat types, see Creating threat type catalogs.
Creating security/privacy solutions
This tutorial provides a detailed explanation of how to use SPARTA to create a catalog of security and privacy solutions.
A solution type describes a reusable solution: the roles that DFD elements play in it, and the countermeasures it provides to the elements that fulfill those roles.
Once a solution type is part of a catalog, you can apply it to any DFD model, as shown in the first tutorial.
The SolutionTypeCatalog.sparta file in the tutorial download is an example of such a catalog.
Creating a solution catalog
The first step requires the creation of a Solution Type Catalog.
Right-click your project, select and then pick SPARTA Model in the category SPARTA Model Creation Wizards.
In the SPARTA perspective, the project’s context menu also offers directly.
A wizard will open to enter the necessary details.
Give your model file a name ending in .sparta.
Next, choose Solution Type Catalog as Model Object and then click Finish.
Creating a new solution type catalog.
If you open this file, you will see a tree view (the SPARTA Model Editor) with a Solution Type Catalog element at the root.
Since there is no graphical editing support for solution types, you create them in this tree view.
Referring to threat types
The countermeasures of a solution type specify against which types of threats they defend. A countermeasure can refer to threat types in two ways:
by ID, with the Mitigated Threat Type ID property. You enter the IDs as text, so you do not need to load a threat type catalog. The countermeasure then works with every catalog that uses the same IDs. For example, the published STRIDE catalogs share the group IDs
stride.spoofing,stride.tampering,stride.repudiation,stride.informationdisclosure,stride.denialofserviceandstride.elevationofprivilege. The solution catalog of the tutorial download uses this approach.by reference, with the Mitigates property. This ties the solution catalog to one specific threat type catalog file, which you must first load into the editor, as described in the next section. The countermeasure then only works for DFD models that link that same catalog file in their Resource property; with another copy of the catalog, or without it, the countermeasure has no effect.
Loading a threat type catalog into the solution catalog
This step is only needed if you want to use the Mitigates property.
To do this, download a threat type catalog (see Installing SPARTA). Add this file to your project, by dragging it to your project or by right-clicking the project, selecting and then selecting the catalog file. Now the catalog is part of the project, but you still need to make it available in the solution catalog’s editor. In the open solution catalog file, select , click Browse Workspace…, select the catalog file and click OK.
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
To add a new type of solution, right-click the Solution Type Catalog element and select .
Give the solution type a name in the Properties view, for example SecurePipe.
Adding roles
After creating the solution type, add its roles: right-click the solution type and select one of the following New Child entries.
New Process role
New DataFlow role
New DataStore role
New ExternalEntity role
New DataFlowEntity role: a role that any process, data store or external entity can fulfill.
These roles express which types of DFD elements are involved in the solution.
The entry you choose sets the role’s Binding Types property: the types of DFD elements that can fulfill the role.
You can change it later in the Properties view (choices Process, DataFlow, DataStore, ExternalEntity, DataFlowEntity and DFDElement).
Give every role a meaningful name, such as SP_sender or SP_sendFlow, because you will see these names when you apply the solution to a model.
The tree shows a role with its binding types, for example Role SP_sendFlow [DataFlow].
Example
Some roles may be restricted to data flows, while others could be filled in only by processes.
Adding countermeasures
After adding the roles, introduce the countermeasures to specify how certain threats are prevented on the elements that fulfill the roles. Right-click the solution type and select . After adding the element, use the countermeasure properties to express the effect of the countermeasure. A countermeasure reduces the risk of a threat when the threat is located at an element bound to one of its subject roles, the threat’s type matches, and the scope (if any) matches.
- Mitigates
One or more threat types that are mitigated by the countermeasure, chosen from a loaded threat type catalog. Selecting a threat type group covers all threat types below it.
- Mitigated Threat Type ID
One or more threat type IDs, entered as text, for example
stride.tampering. An ID matches a threat whose threat type, or any group above that threat type, has this ID. A countermeasure applies when either Mitigates or Mitigated Threat Type ID matches.- Subject
The roles that receive the protection against threats of the specified types. The countermeasure applies to threats located at a DFD element bound to one of these roles. You can choose from all roles of the solution type. When a solution is applied to a model, a role can be bound to several DFD elements; the countermeasure then applies to each of them.
- Scope
Scope can be used to limit the effect of the countermeasure. You can choose from the data flow roles of the solution type. When the scope is not empty, the countermeasure only applies to a threat if the threat’s data flow is bound to one of the scope roles. Every data flow bound to a scope role is in scope, so one solution can cover all flows that use, for example, the same secure connection. When the scope is empty, the countermeasure applies to all matching threats on the subject elements.
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 actually occurs over the 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.
- Difficulty
The strength of a countermeasure is specified by adding a child estimate: right-click the countermeasure and select . This estimate is the countermeasure’s difficulty; the tree shows it as
Estimate ...below the countermeasure, and it is not listed in the Properties view of the countermeasure. A countermeasure has at most one difficulty. Select the estimate to set its Minimum, Probable and Maximum value and its Confidence. During the analysis, SPARTA compares samples of this difficulty with samples of the threat capability of each attacker profile: the attacker defeats the countermeasure when the threat capability is greater than or equal to the difficulty. If several countermeasures apply to the same threat, the attacker must defeat all of them. Difficulty and threat capability use the same scale. The built-in default attacker profile has a threat capability between 0 and 35, and most countermeasures in the tutorial download have difficulties between 60 and 100. See How SPARTA computes risk for how SPARTA turns these values into a vulnerability.
Caution
A countermeasure without a difficulty counts as a difficulty of exactly 100 (see Defaults when information is missing): only an attacker with a threat capability of 100 or more defeats it.
In the tutorial download, the countermeasure of the Sandbox solution type has no difficulty, so the built-in default attacker profile never defeats it.
A difficulty estimate whose Minimum equals its Maximum is an exact value: a newly created estimate with all values 0 is a difficulty of 0, which every attacker defeats.
Always give each countermeasure a difficulty and set its values.
Using the solution catalog
Save the catalog when you are done. To use it, add it to the Resource property of a DFD model and apply its solution types, as described in the first tutorial. The Apply Solution palette tool only offers solution types that are contained in the DFD model itself or in catalogs that the DFD model refers to in this way.
Note
In 2026.2, the ThreatAnalysis view does not recalculate the risk of listed threats when you apply a solution, bind a role or change a countermeasure: click Load and Analyze Model again (see Analysis results and exports).
Known limitations in 2026.2
Keep the following limitations of SPARTA 2026.2 in mind when you create solution catalogs.
The Scope of a countermeasure does not check that the threat’s data flow is bound to the scope role in the same solution instance: a binding in another instance of the same solution type also counts (see Which countermeasures apply). For example, suppose one TLS solution instance protects a web server, and a second one secures a data flow between that web server and a mail server. The server authentication of the first instance then also applies to threats to the web server via the flow of the second instance, even though it does not protect that flow, so SPARTA underestimates their risk.
Creating attacker models
This tutorial provides a detailed explanation of how to use SPARTA to create an attacker model: a catalog of attacker profiles. SPARTA takes these attacker profiles into account when it calculates the risk of the elicited threats. They do not influence which threats are elicited.
Creating an attacker model
The first step requires the creation of an Attacker Model.
Right-click your project, select and then pick SPARTA Model in the category SPARTA Model Creation Wizards.
In the SPARTA perspective, the project’s context menu also offers directly.
A wizard will open to enter the necessary details.
Give your model file a name ending in .sparta.
Next, choose Attacker Model as Model Object and then click Finish.
Creating an attacker model.
If you open this file, you will see a tree view (the SPARTA Model Editor) with an Attacker Model element at the root.
Since there is no graphical editing support for attacker models, you create the attacker profiles in this tree view.
Creating a new attacker profile
To add a new attacker profile, right-click the Attacker Model element and select .
Give the profile a name in the Properties view.
An attacker profile has the following properties.
- Insider
The elements of a concrete DFD model where the attacker is an insider. For a threat located at one of these elements, the attacker is able to completely bypass countermeasures, regardless of their difficulty: the vulnerability is 1. Only the listed elements themselves count. Listing a trust boundary or a decomposed process does not make the attacker an insider for the elements inside it. To be able to select elements, first load the DFD model file into the attacker model’s editor with .
- Enabled
Whether the profile is enabled (default
true). In SPARTA 2026.2, this property has no effect (see Known limitations in 2026.2).
The other properties of the attacker profile are expressed as estimates. Add each of them by right-clicking the attacker profile and selecting the matching New Child entry. A profile needs all three estimates.
- Threat Capability Estimate
The capability of the attacker. This determines to which extent the attacker is able to defeat countermeasures: the attacker defeats a countermeasure when the threat capability is greater than or equal to the countermeasure’s difficulty. Use the same scale as the difficulty of the countermeasures in your solution catalogs (see Adding countermeasures and How SPARTA computes risk). For comparison, the built-in default Opportunist profile (see Using the attacker model in an analysis) has a threat capability between 0 and 35.
- Contact Frequency Estimate
How frequently the attacker comes into contact with the system.
- Probability Of Action Estimate
How likely the attacker is to attempt to attack the system when in contact with it.
The tree shows these estimates as Threat Capability: Estimate ..., Contact Frequency: Estimate ... and Probability of Action: Estimate ....
Like any estimate, each one has a Minimum, Probable and Maximum value and a Confidence.
See Estimates for the meaning of these values and How SPARTA computes risk for how SPARTA combines them into a risk value.
Caution
A newly created estimate has all values 0, and an estimate whose Minimum equals its Maximum is an exact value, so always set the values of all three estimates. With a contact frequency or probability of action of exactly 0, the profile adds no risk; with a threat capability of exactly 0, the attacker only defeats countermeasures with a difficulty of 0.
Using the attacker model in an analysis
SPARTA only uses the attacker profiles of an attacker model that the analyzed DFD model refers to.
To link them, open the DFD model file in the SPARTA Model Editor and load the attacker model file with .
Then select the DFD Model element, open its Resource property in the Properties view and add the attacker model, in the same way as for a threat type catalog in the first tutorial.
If the attacker model is not referenced, its profiles are not part of the analysis.
If the analysis contains no attacker profile at all, SPARTA uses a built-in default profile named Opportunist; its estimates are listed in Defaults when information is missing.
As soon as the analysis contains at least one attacker profile, the default profile is not used.
Note
Multiple attacker profiles can be specified in an attacker model, and SPARTA takes into account all of them. The risk of a threat is the sum of the risk for each attacker profile. SPARTA reads the attacker profiles when you click Load and Analyze Model in the ThreatAnalysis view. In 2026.2, it does not recalculate the risk of threats that are already listed when you change an attacker profile: click Load and Analyze Model again (see Analysis results and exports).
Known limitations in 2026.2
Keep the following limitations of SPARTA 2026.2 in mind when you create attacker models.
The Enabled property of an attacker profile has no effect: SPARTA takes every attacker profile in the analysis into account, whether it is enabled or not. To leave a profile out of the analysis, remove it from the attacker model.
Creating threat type catalogs
A threat type catalog determines which threats SPARTA elicits from a DFD model. Each threat type in the catalog contains one or more threat patterns, written in the VIATRA Query Language (VQL), that SPARTA matches against the DFD model to identify threats.
This tutorial builds a small catalog with a single threat type step by step, links it to a DFD model, and shows how to find errors in the patterns. For the complete reference on writing patterns, see Writing threat type patterns. The published STRIDE and LINDDUN catalogs (see Installing SPARTA) are larger examples of the same structure.
Creating the catalog file
Right-click your project, select and then pick SPARTA Model in the category SPARTA Model Creation Wizards.
In the SPARTA perspective, the project’s context menu also offers directly.
Give your model file a name ending in .sparta, for example mycatalog.sparta.
Next, choose Threat Type Catalog as Model Object and then click Finish.
The file opens in the SPARTA Model Editor, with a Threat Type Catalog element at the root.
As for the other catalogs, there is no graphical editing support: you build the catalog in this tree view and the Properties view.
Setting the package and imports
Select the root element and set the following properties in the Properties view.
- Name, Description, Id
General information about the catalog.
- Package
A VQL package name for the patterns of this catalog, for example
mycatalog. This property is required. The published catalogs usestrideandlinddun.- Imports
The VQL import lines for the patterns of this catalog. Add these two values, exactly as shown, as in every published catalog:
import "http://distrinet.cs.kuleuven.be/spartamodel" import "http://www.eclipse.org/emf/2002/Ecore"
The first import makes the SPARTA meta-model classes, such as
DFDElement,Process,DataStoreandDataFlow, available in your patterns. The second one makes the Ecore data types, such asEString, available.- Helper Patterns
Optional VQL patterns that the threat patterns of this catalog can call with
find. Helper patterns never produce threats themselves. Leave this property empty for this tutorial; see Writing threat type patterns.- Pattern Dependencies
Optional other threat type catalogs whose patterns SPARTA processes before those of this catalog. Leave this property empty for this tutorial; see Catalog settings.
SPARTA puts the package and the imports in front of the text of every threat pattern, so do not write a package line or imports in the patterns themselves (see Writing threat type patterns).
Adding threat type groups and threat types
Threat types are usually organized in groups, for example the six STRIDE categories.
Right-click the catalog and select .
Set its Name to Tampering and its Id to mycatalog.tampering.
Note
The catalog’s New Child menu shows some entries with a prefix, because the catalog file stores its top-level elements in two lists:
Threat Threat Type Group and Threattypegroup Threat Type Group create the same kind of group; they only differ in where the catalog file stores it, and SPARTA treats both the same. This tutorial uses the first one.
Threat Threat Type adds a threat type directly to the catalog, outside any group.
Threat Or Composite Threat Type and Threat And Composite Threat Type add composite threat types, which SPARTA 2026.2 treats exactly like groups.
Inside a group, the entries have plain names, such as Threat Type Group for a nested group and Threat Type.
Next, right-click the group and select . Set the following properties of the new threat type.
- Name
<$location$> tampered. This is a template: SPARTA fills in the<$...$>placeholders for each threat (see Writing the threat pattern) and shows the result in the Name column of the ThreatAnalysis view. The name of the top-level group, hereTampering, appears in the Type column.- Id
mycatalog.tampering.datastore.
IDs let countermeasures (Mitigated Threat Type ID) and asset estimates (Threat Type ID To Estimate Map) refer to threat types by text. Such an ID matches the threat type itself and every threat type below it, so give every group, and preferably every threat type, a stable, unique dotted ID (IDs must be unique within a file).
Tip
If your groups use the same IDs as a published catalog, for example stride.tampering, then solution catalogs and asset estimates that use those IDs also apply to the threats of your catalog.
Only threat types (the leaves of the tree) produce threats; groups only organize them. The Description, Title, Additional Info and Comments properties of threat types and groups are documentation only and do not appear in the analysis results. Do not add EString To EBoolean Map children unless you want to use the legacy key-based threat elicitation, which is described in Writing threat type patterns.
Writing the threat pattern
Right-click the threat type and select . Set the following properties of the threat pattern.
- Name
Data store receives data. This name only labels the threat pattern in the tree.- Description
Data that <$sender$> sends to <$location$> over <$df$> may be tampered with.This template becomes the Description column of each threat.- Long Description
Optional additional explanation, entered as a list of text values like Patterns (the values are joined with line breaks). When you double-click a threat in the ThreatAnalysis view, the dialog shows the long description after
Info:if the threat pattern also has a description, and the long description alone otherwise (see Analysis results and exports).- Patterns
The VQL text of the pattern:
pattern dataStoreTampered(location : DFDElement, sender : DFDElement, df : DataFlow) { DataStore(location); DataFlow.sender(df, sender); DataFlow.recipient(df, location); }
This pattern matches every data flow df from a sender to a data store location.
SPARTA creates one threat for each distinct combination of parameter values, so the example yields one threat for every data flow into a data store.
The parameter names have a meaning:
locationThe threatened element, which must be a DFD element. It appears in the Location column, and SPARTA calculates the risk of the threat for this element. Every threat pattern must declare it; Writing threat type patterns describes the alternative parameter names.
dfThe data flow involved in the threat. It appears in the Flow column, it is used in exports, and it determines whether countermeasures with a scope apply. It is optional: a pattern without it yields one threat per threatened element, without a data flow, but such threats have limitations (see Known limitations in 2026.2).
- Other parameters, such as
sender Free parameters that you can use in placeholders, as long as they are bound to model elements (see Known limitations in 2026.2). Each additional parameter can multiply the number of threats, because every distinct combination of values is a separate threat.
In the threat type name, the description and the long description, a placeholder <$p$> is replaced by the name of the element bound to parameter p, and <$p.type$> by the type of that element, for example DataStore.
A placeholder can only refer to parameters of the pattern (see Placeholders in names and descriptions).
The Patterns property holds the VQL text as a list of text values, usually one value per line. SPARTA joins the values with line breaks and parses the combined text as VQL. You can therefore enter the pattern one line per value, in order, or enter the whole pattern as a single value on one line: VQL does not depend on line breaks. To edit the list, select the Patterns property in the Properties view and click the button at the end of its value field. The same applies to the Imports of the catalog.
A threat type can have several threat patterns, each with its own description, and the text of one threat pattern can contain several VQL patterns; Writing threat type patterns explains how SPARTA handles them.
Note
DataFlow.sender and DataFlow.recipient refer to the direct sender and recipient of a data flow.
For models with decomposed elements (sender and recipient specifications), the published catalogs use helper patterns such as Communication instead.
See Writing threat type patterns.
Save the catalog when you are done.
Linking the catalog to a DFD model and analyzing it
SPARTA only analyzes the catalogs that the DFD model refers to. Link your catalog in the same way as a downloaded catalog in the first tutorial:
Open the DFD model file in the SPARTA Model Editor.
Select , click Browse Workspace…, select your catalog file and click OK.
Select the
DFD Modelelement, open its Resource property in the Properties view, add yourThreat Type Catalogand save the model.Open the PatternSupport view, as described in the next section.
Make the DFD model’s diagram active, or select an element of the DFD model in the tree editor, and click Load and Analyze Model in the ThreatAnalysis view.
Caution
Load and Analyze Model analyzes the model of the active editor. If the editor of your catalog is active, SPARTA analyzes the catalog file instead of your DFD model.
For a model in which a process sends data to a data store, the ThreatAnalysis view now lists a threat with the data store in the Location column, Tampering in the Type column, the filled-in name (for example DataStore 1 tampered) in the Name column and the data flow in the Flow column.
A DFD model can refer to several threat type catalogs; SPARTA elicits the threats of all of them.
See Analysis results and exports for a description of the ThreatAnalysis view.
SPARTA parses the patterns again every time you click Load and Analyze Model. After you change the catalog, save it and click Load and Analyze Model again.
Diagnosing errors in the PatternSupport view
When it analyzes a model, SPARTA skips threat patterns that contain errors, without any message in the ThreatAnalysis view: a pattern with errors produces no threats.
The PatternSupport view lists the errors that were found in the threat patterns.
Open it with , and select PatternSupport in the Other category (or type PatternSupport in the filter field).
The view is not part of the SPARTA perspective.
It is filled when Load and Analyze Model runs, so open it before you click Load and Analyze Model.
The view has three columns:
- ThreatType
The name of the threat type that contains the pattern.
- Pattern
The name of the VQL pattern.
- Issue
The error message. Double-click a row to see the full message in a dialog.
Note
Because SPARTA puts the package line and the import lines in front of your pattern, the line numbers in error messages are shifted: subtract 1 plus the number of imports, which is 3 with the two standard imports.
If a threat type produces no threats although the view shows no errors, or the Description column shows Description missing., go through the checklist in Debugging patterns.
Known limitations in 2026.2
SPARTA 2026.2 has some limitations for threat type catalogs; Known limitations in 2026.2 lists them all. Keep the following ones in mind when you write your own catalog:
Declare a data flow parameter (
df) unless you need element-based threats: for threats without a data flow, Report Export fails, and so does their risk calculation when a countermeasure with a scope applies (see The role of the data flow).Only use placeholders for parameters that the pattern declares and that are bound to model elements; otherwise the threats of that pattern can be missing from the ThreatAnalysis view, without a message (see Placeholders in names and descriptions).
The Enabled property of threat types and groups has no effect on threat patterns: to switch off a threat type, remove its threat patterns or empty their Patterns property.