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 SPARTA application also includes a short version of this tutorial, which you follow step by step next to the workbench (see Guided tutorial). 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 File ‣ Import… ‣ General ‣ Existing Projects into Workspace and point Select archive file to the downloaded Tutorial.zip.

Tip

SPARTA also contains a guided version of this tutorial and ready-made example projects:

  • The cheat sheet Help ‣ Cheat Sheets… ‣ SPARTA ‣ Create and analyze your first model walks you through the same steps next to the editors, with a small web shop model.

  • File ‣ New ‣ Example… ‣ SPARTA ‣ Guided Tutorial Starter Project creates the modeling project sparta-tutorial, which the cheat sheet uses. It contains the threat type catalog stride-per-interaction - Shostack.sparta and the solution catalog SecurityPatternCatalog.sparta, which offers the same SecurePipe solution type as SolutionTypeCatalog.sparta, but no DFD model yet.

  • The same SPARTA category offers three complete example projects, each with its DFD model, its diagram and the catalogs it uses: Contoso (STRIDE, security solutions), Social Network (LINDDUN privacy) and WebRTC (STRIDE and LINDDUN).

When the cheat sheet asks you to add the SecurePipe solution, use the Apply Solution tool as described in Instantiating security and privacy solutions below: a solution created with the createSolution tool has no role bindings to assign.

Introduction

Before following the rest of this tutorial make sure you have SPARTA up and running. Download SPARTA 2026.3 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. When you start SPARTA with a new workspace, a welcome screen opens, with links to the guided tutorial, the example projects and the wizards for a new project or model; Go to the workbench closes it, and Help ‣ Welcome opens it again. The workbench itself (Project Explorer, editors, Properties view, ThreatAnalysis view, and the SPARTA menu) 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 File ‣ New ‣ Modeling Project (or File ‣ New ‣ Project… ‣ Sirius ‣ Modeling Project), give the project a name, and click Finish. The modeling project contains a file representations.aird, which stores the diagrams you create below. If you use the sparta-tutorial starter project, you can skip this step.

Creating a DFD model

To create a DFD model, right-click your newly created project and select New ‣ SPARTA Model. (The same wizard is also available through New ‣ Other… ‣ SPARTA Model Creation Wizards ‣ SPARTA Model.) 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.

Adding a trust boundary

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.

Adding elements

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.

Adding an external entity and data flows

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 New Child ‣ Model Element Annotation (with a single Value property) or New Child ‣ KV Model Element Annotation (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.

Adding annotations

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 Import… ‣ General ‣ File System, and then selecting the catalog file. The sparta-tutorial starter project already contains this catalog, so you can skip the download; you still need to link the catalog to your model, as described below.

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, its copy in the sparta-tutorial starter project, 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.

Note

Catalogs whose threat patterns have no data flow parameter, such as STRIDE-per-element, elicit threats without a data flow. Countermeasures with a scope, such as those of SecurePipe below, never apply to such threats, so the solution of this tutorial does not reduce their risk (see The role of the data flow). Use a STRIDE-per-interaction catalog for this tutorial.

Importing a threat type catalog.

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:

  1. Open the model in the tree editor by double-clicking the .sparta file.

  2. Load the catalog into the editor: choose SpartaModel Editor ‣ Load Resource…, click Browse Workspace…, select the catalog file, and click OK.

  3. Select the DFD Model element and, in the Properties view, click the … button of the Resource property.

  4. In the dialog, select the Threat Type Catalog, click Add, and then OK.

  5. 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.

Linking the threat type catalog.

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 New Child ‣ Estimate) 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 0 treats every value between the minimum and the maximum as equally likely; higher values (for example 4 or 10) 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.

In the diagram, the Loss Estimates layer marks the processes, data stores and external entities that have an estimate: their label ends in [loss followed by the probable value of their first estimate and ], their tooltip ends in [loss estimated], and processes and external entities get a red border. You can turn this off by disabling the layer in the Layers drop-down of the diagram toolbar.

Assigning an estimate.

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:

  • New Child ‣ Threat Type ID To Estimate Map: 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. In Tutorial.zip, Process 1 uses this to map its estimate Process 1 tampering value to stride.tampering.

  • New Child ‣ Threat Type To Estimate Map: 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.

Assigning an estimate for a specific threat type.

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 New ‣ SPARTA Model. 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 SpartaModel Editor ‣ Load Resource…, 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.3 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. Make the diagram of your DFD model the active editor, for example by clicking it, and choose SPARTA ‣ Load and Analyze Model (or press Ctrl+Alt+A, Cmd+Alt+A on macOS). The same command is available as the analyse button in the toolbar of the ThreatAnalysis view on the right-hand side of the interface. If this view is not visible, choose Window ‣ Show View ‣ Other… 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. If no editor is active, or the active editor does not show a SPARTA model, a dialog asks you to open a SPARTA model or diagram editor first. The analysis runs in the background as the job Loading SPARTA threat analysis, with its progress at the bottom right of the window, and replaces any previous analysis. 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.

Analyzing a 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. SPARTA also recalculates the risk of the threats that a change affects, for example when you edit an estimate of an element or bind a role of a solution; the other threats keep their values (see Analysis results and exports). SPARTA ‣ Clear Analysis Engine clears the results and stops the monitoring.

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 Import… ‣ General ‣ File System, and then selecting the catalog file. Next, load the catalog in the tree editor of the model (SpartaModel Editor ‣ Load Resource…) and add the Solution Type Catalog to the Resource property of the DFD Model.

Importing a solution type catalog.

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:

  1. Select the Apply Solution tool and click an empty spot of the diagram.

  2. In the dialog Select solution to apply, choose SecurePipe in the Solution list. The dialog shows the Name and the Number of Roles of the selected solution type. Click OK. SPARTA creates a solution named SecurePipe with one role binding for every role of the solution type. The role bindings are shown as small squares on the border of the solution: light orange, with the tooltip unassigned role: followed by the name of the role binding, as long as no element is assigned, and gray once an element is assigned. Select a square to see its role in the Binds property of the Properties view. The light-green squares on the border are the countermeasures of the solution type.

  3. Select the Assign Role tool, click a role binding square, and then click the DFD element or data flow it applies to. Assign SP_sender to the external entity, SP_recipient to the process, SP_sendFlow to the flow from the external entity to the process, and SP_receiveFlow to the response flow. The tool only accepts targets of the types allowed by the role (for example, a data flow for SP_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.

The tooltip of the solution summarizes it, for example Mitigates 3 threat type(s); 4 of 4 role(s) bound.

To unbind an element, select its gray line in the diagram and delete it: only that element is removed from the role binding. Deleting a role binding square that has elements assigned unassigns all of them, and the square turns light orange again; deleting a light-orange square removes the role binding from the solution.

Alternatively, you can build the solution step by step: the createSolution tool creates an empty solution, without role bindings, 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. Assign Role only works from a role binding whose role is set, so with this route, add and set a role binding for every role first; Apply Solution does all of this in one step. In the tree editor, right-click the DFD Model and select New Child ‣ Solution; 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 there, select it in that list and click the red remove button.

The recording below applies the solution with Apply Solution and then sets the Binds To property of each role binding in the Properties view.

Instantiating the secure pipe solution.

For clarity, you may want to hide the solution instances in the diagram 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 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.

Hiding a solution instance.

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. While the analysis is loaded, SPARTA recalculates the risk of the affected threats as soon as you assign a role; you do not need to run Load and Analyze Model again. 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. Keep the analysis loaded while you apply further solutions to see the impact of each change.

Exporting the results

You can export the current analysis results with the following commands of the SPARTA menu, which are also available as buttons in the toolbar of the ThreatAnalysis view:

  • export Export Threats to CSV writes the threat list to the file threats.csv in the root of the project that contains the analyzed model.

  • export Export Threats to XLSX writes the same columns to the Excel workbook threats.xlsx in the root of that project.

  • report Export Threat Report writes the sources of a LaTeX report, including the data flow diagram with the layout of the project’s .aird file, to the folder report in the root of that project.

The export commands are only enabled after an analysis. None of them asks for a file name or location, and existing files are overwritten. When the export is done, a dialog shows where the file or folder was written, and the Project Explorer shows it. 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 New ‣ Other… and then pick SPARTA Model in the category SPARTA Model Creation Wizards. In the SPARTA perspective, the project’s context menu also offers New ‣ SPARTA Model 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.

Create solution type catalog screenshot

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.denialofservice and stride.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 Import… ‣ General ‣ File System 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 SpartaModel Editor ‣ Load Resource…, click Browse Workspace…, select the catalog file and click OK.

Load resource screenshot

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 New Child ‣ Solution Type. 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 New Child ‣ Counter Measure. 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. When a solution of this type is applied in a diagram, each countermeasure is shown as a light-green square on the border of the solution; its tooltip shows the name of the countermeasure and the number of entries in its Mitigates and Mitigated Threat Type ID properties.

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. A countermeasure with a scope never applies to a threat without a data flow, such as the threats of the STRIDE-per-element catalog (see The role of the data flow).

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 New Child ‣ Estimate. 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

While an analysis is loaded, the ThreatAnalysis view recalculates the risk of the affected threats when you bind a role of a solution to an element in the analyzed diagram (see Analysis results and exports). If you change the solution catalog itself, for example the difficulty of a countermeasure, save it and run Load and Analyze Model again.

Known limitations in 2026.3

Keep the following limitations of SPARTA 2026.3 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 New ‣ Other… and then pick SPARTA Model in the category SPARTA Model Creation Wizards. In the SPARTA perspective, the project’s context menu also offers New ‣ SPARTA Model 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.

Create attacker model screenshot

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. You create the attacker profiles and their estimates in this tree view. Once they exist, you can also compare and edit their values side by side in a table (see Reviewing attacker profiles in a table).

Creating a new attacker profile

To add a new attacker profile, right-click the Attacker Model element and select New Child ‣ Attacker Profile. 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 SpartaModel Editor ‣ Load Resource…. In the data flow diagram, the tooltip of an element ends in [insider threat] when a profile of an attacker model in the Resource property of the DFD model lists it as insider.

Enabled

Whether the profile is enabled (default true). In SPARTA 2026.3, this property has no effect (see Known limitations in 2026.3).

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.

Reviewing attacker profiles in a table

The Attacker Profiles table shows all attacker profiles of an attacker model, one per row, and lets you edit their values in its cells. It is a representation, like the data flow diagram, so the attacker model file must be part of a modeling project. To create it, right-click the project, select Create Representation, pick Attacker Profiles (under the viewpoint DataFlowDiagram), and select the Attacker Model element of your file. The default name of the table is Attacker profiles.

The table has the following columns:

  • Name and Enabled: the name and the Enabled property of the profile.

  • Threat cap. (min), Threat cap. (prob.), Threat cap. (max) and Threat cap. (conf.): the Minimum, Probable, Maximum and Confidence of the threat capability estimate.

  • Prob. of action (min) to Prob. of action (conf.): the same four values of the probability of action estimate.

  • Contact freq. (min) to Contact freq. (conf.): the same four values of the contact frequency estimate.

The table cannot add profiles or estimates: create them in the tree editor, as described above. If a profile does not have an estimate, the cells of that estimate are empty and you cannot type in them.

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 SpartaModel Editor ‣ Load Resource…. 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 run Load and Analyze Model. While the analysis is loaded, a change to an attacker profile of a linked attacker model in the analyzed editor or modeling session, for example in the Attacker Profiles table, recalculates the risk of all threats (see Analysis results and exports). If you edit the attacker model in its own tree editor, save it and run Load and Analyze Model again.

Known limitations in 2026.3

Keep the following limitations of SPARTA 2026.3 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 New ‣ Other… and then pick SPARTA Model in the category SPARTA Model Creation Wizards. In the SPARTA perspective, the project’s context menu also offers New ‣ SPARTA Model 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. You build the catalog in this tree view and the Properties view: you add threat types and threat patterns in the tree. The threat patterns have their own VQL editor (see Editing the VQL text), and the table editor for threat type catalogs shows the threat types of the catalog side by side, where you can edit their values but not add new ones (see Reviewing the catalog in a table). In the Properties view, the long texts of a catalog accept line breaks: the Description of every element, the Imports and Helper Patterns of the catalog, the Title, Additional Info and Comments of threat types and groups, and the Long Description and Patterns of threat patterns.

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 use stride and linddun.

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, DataStore and DataFlow, available in your patterns. The second one makes the Ecore data types, such as EString, 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 New Child ‣ Threat Threat Type Group. 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.3 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 New Child ‣ Threat Type. 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, here Tampering, 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.

Reviewing the catalog in a table

The Threat Type Catalog table lists all threat type groups and threat types of a catalog, at any depth, as one flat list, and lets you edit them in its cells. It is a representation, like the data flow diagram, so the catalog file must be part of a modeling project. To create it, right-click the project, select Create Representation, pick Threat Type Catalog (under the viewpoint DataFlowDiagram), and select the Threat Type Catalog element of your file. The default name of the table is Threat type catalog.

Each row shows a group or threat type, with the columns Name, ID, Title, Enabled and Description. The table is a convenient way to check that every group and threat type has a unique ID. It cannot add groups, threat types or threat patterns: create them in the tree editor. The Enabled column has no effect on threat patterns (see Known limitations in 2026.3).

Writing the threat pattern

Right-click the threat type and select New Child ‣ Threat Pattern. 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:

location

The 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.

df

The 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 countermeasures with a scope do not apply to such threats (see Known limitations in 2026.3).

Other parameters, such as sender

Free parameters that you can use in placeholders, as long as they are bound to model elements. 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 that are bound to model elements: otherwise, SPARTA shows it as <unknown: p> (see Placeholders in names and descriptions).

The Patterns property holds the VQL text as a list of text values. SPARTA joins the values with line breaks and parses the combined text as VQL. You can therefore enter the whole pattern as a single value, or one line per value, in order: 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, or use the VQL editor described below. The button opens a dialog that lists the values under Feature: select a value to edit it in the multi-line text box under Value, and use Add, Remove, Up and Down to change the list. The Imports and Helper Patterns of the catalog are edited in the same way in the Properties view.

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.

Editing the VQL text

To write the pattern with VQL syntax highlighting, right-click the threat pattern in the tree editor and select Edit VQL Pattern…. The dialog, titled Edit VQL pattern: followed by the name of the threat pattern, has the following parts:

Context (read-only)

The package line and the Imports of the catalog, which SPARTA puts in front of the pattern text (see Setting the package and imports). It is only shown when the catalog has a package or imports.

Patterns

The values of the Patterns property, each shown with its number and first line, with the buttons Add, Remove, Up and Down.

Pattern body

The text of the selected value, with VQL syntax highlighting.

Click OK to write the values back to the threat pattern. You can undo the change in the editor, and you still need to save the catalog. The dialog does not check whether the VQL is valid: errors show up in the PatternSupport view when you analyze a model (see Diagnosing errors in the PatternSupport view). If the threat pattern is not open in an editor or a modeling session, or its catalog is read-only, a Cannot edit VQL pattern dialog explains the problem.

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:

  1. Open the DFD model file in the SPARTA Model Editor.

  2. Select SpartaModel Editor ‣ Load Resource…, click Browse Workspace…, select your catalog file and click OK.

  3. Select the DFD Model element, open its Resource property in the Properties view, add your Threat Type Catalog and save the model.

  4. Show the PatternSupport view, as described in the next section.

  5. Make the DFD model’s diagram active, or select an element of the DFD model in the tree editor, and choose SPARTA ‣ Load and Analyze Model (or click analyse 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 run Load and Analyze Model. After you change the patterns of the catalog, save it and run Load and Analyze Model again: while an analysis is loaded, SPARTA recalculates risk values after model edits, but it does not parse changed patterns.

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. In the SPARTA perspective, it is the PatternSupport tab next to the ThreatAnalysis view. You can also open it with Window ‣ Show View ‣ Other…, and select PatternSupport in the Pattern Support category (or type PatternSupport in the filter field). It is filled when Load and Analyze Model runs, so show the view, for example by clicking its tab, before you run 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.3

SPARTA 2026.3 has some limitations for threat type catalogs; Known limitations in 2026.3 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: countermeasures with a scope never apply to threats without a data flow (see The role of the data flow).

  • The Enabled property of threat types and groups, also in the Threat Type Catalog table, has no effect on threat patterns: to switch off a threat type, remove its threat patterns or empty their Patterns property.