Applying data-flow diagrams to security threat modelling
Data-flow diagrams, often shortened to DFDs, are one of the most practical ways to understand how a system handles information and where security risks can enter. For technical teams, they are useful because they turn a system from a static picture into something you can analyse: where data comes from, where it goes, what transforms it, and where trust changes.
That matters because many security issues are not caused by a single weak component. They emerge from the way components interact. A service may be well configured in isolation, but still expose sensitive data through an untrusted integration, an over-permissive API, or a missing control at a trust boundary. A DFD helps you see those relationships before they become incidents.
For UK SMEs, the value is practical rather than theoretical. You do not need a heavyweight process to get benefit. You need a diagram that is accurate enough to support structured analysis, a method for identifying threats, and a way to convert findings into controls that fit your environment and risk appetite.
Why data-flow diagrams matter in threat modelling
What a data-flow diagram captures that a simple architecture diagram does not
A standard architecture diagram usually shows systems, services, and infrastructure components. That is useful, but it does not always show how data moves or where security assumptions change. A DFD adds those missing details.
In a DFD, you typically represent:
- External entities, such as users, suppliers, or third-party services
- Processes, such as web applications, APIs, batch jobs, or authentication services
- Data stores, such as databases, object storage, message queues, or file shares
- Data flows, such as API calls, file transfers, web requests, or event messages
- Trust boundaries, where the level of trust changes between components or environments
That structure makes it easier to ask security questions. What data is sensitive? Which flow crosses an untrusted network? Which process can write to a store it should only read from? Where does identity get asserted, and where is it re-checked?
Those questions are hard to answer from a box-and-arrow diagram alone. They become much easier when the diagram is built for analysis rather than presentation.
Where DFDs fit alongside STRIDE, attack trees, and risk assessment
DFDs are not a threat model by themselves. They are the input to threat analysis. In practice, they work well with STRIDE, which is a mnemonic for Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, and Elevation of privilege. You use the DFD to identify the assets, flows, and boundaries, then apply STRIDE to each element and flow.
Attack trees can be useful later when you want to explore how an attacker might achieve a specific outcome. Risk assessment helps you prioritise what matters most to the business. The DFD sits in the middle. It gives you the system view that makes structured analysis possible.
For technical practitioners, that means the DFD is not just documentation. It is a working artefact that supports design review, control selection, and change impact analysis.
Building a useful data-flow diagram for security analysis
Choosing the right system boundary, trust boundaries, and external entities
The first mistake many teams make is drawing too much. A DFD should start with a clear system boundary. Decide what is in scope and what is outside it. If you are modelling a SaaS application, the boundary may include the application, its supporting services, and its cloud resources, but not the customer’s endpoint estate. If you are modelling an internal business system, the boundary may include the application and its database, but not the identity platform that provides authentication.
External entities should be genuinely external to the system being modelled. That might include end users, administrators, suppliers, payment processors, or identity providers. If a component is under your control and part of the system, it is usually a process or data store, not an external entity.
Trust boundaries deserve special attention. A trust boundary is any point where you stop assuming that data, identity, or execution context can be trusted in the same way. Common examples include:
- Internet to cloud application
- User device to internal network
- Application tier to database tier
- Tenant boundary in a multi-tenant platform
- On-premises environment to SaaS integration
Marking these boundaries clearly helps you focus on authentication, authorisation, validation, encryption, and logging at the right points.
Representing processes, data stores, data flows, and security-relevant dependencies
Processes should be named for what they do, not for the server they run on. For example, “Order submission API” is better than “Web server 1”. The security question is about behaviour and trust, not just infrastructure.
Data stores should identify the type of data they hold and whether it is sensitive. A customer database, audit log store, secrets vault, or document repository each has different security implications. If a store contains personal data, payment data, credentials, or operationally critical information, note that explicitly.
Data flows should show direction and, where relevant, protocol or mechanism. For example, “HTTPS request”, “SFTP file transfer”, “AMQP message”, or “database query over TLS”. You do not need to model every packet. You do need enough detail to understand where data is exposed, transformed, or relied upon.
Security-relevant dependencies should also be visible. If a process depends on an identity provider, a key management service, a logging platform, or a third-party API, include it. These dependencies often create indirect trust assumptions that are missed in simpler diagrams.
A practical rule is this: if the failure or compromise of a dependency would change the security posture of the system, it belongs in the DFD.
Using the diagram to identify threats systematically
Applying STRIDE to each element and flow in the diagram
Once the DFD is complete enough to be useful, apply STRIDE systematically. The aim is not to generate a long list of theoretical issues. It is to identify realistic threats that follow from the design.
For each process, ask:
- Could an attacker spoof this process or impersonate it?
- Could data be tampered with before or after processing?
- Could the process deny having performed an action because logging is weak?
- Could it disclose information it should not?
- Could it be used to cause service degradation?
- Could it be abused to gain higher privileges?
For each data flow, ask whether the flow is authenticated, integrity-protected, encrypted in transit, and validated at the receiving end. For each data store, ask whether access is controlled, whether data is encrypted at rest where appropriate, and whether the store is protected against unauthorised modification or deletion.
For each trust boundary, ask what changes at that point. Does identity need to be re-established? Is input validation required? Is there a need for mutual authentication? Are rate limits or segmentation needed to reduce exposure?
This approach works well because it is repeatable. Different analysts may produce slightly different threat lists, but they will usually converge on the same major design weaknesses if they use the same structure.
Spotting privilege issues, data exposure, spoofing paths, and tampering opportunities
In real systems, the most useful findings often come from a few recurring patterns.
Privilege issues appear when a process can do more than it needs. A background job that can read and write all records, when it only needs access to a subset, creates unnecessary blast radius. A service account with broad database permissions may make recovery easier in the short term, but it also increases the impact of compromise.
Data exposure often shows up on flows that cross trust boundaries without strong transport protection or without a clear need for the data to be present at all. If a process sends full customer records to a downstream service when only a reference ID is needed, the DFD makes that visible.
Spoofing paths are common in distributed systems. If a service trusts a caller because it is “internal”, that is a design assumption worth challenging. Internal networks are not a trust model. Identity should be asserted and verified at the point of use, and service-to-service authentication should be explicit.
Tampering opportunities often arise where data is accepted, transformed, and forwarded without integrity checks. Message queues, file drops, and loosely controlled integration points deserve special scrutiny. If the receiving process assumes the content is valid because it came from a known source, the DFD should prompt a review of that assumption.
For technical teams, the value of the diagram is that it exposes these issues early, when they are still cheap to fix.
Turning diagram findings into practical controls
Mapping threats to controls such as authentication, encryption, logging, and segmentation
Threat modelling only becomes useful when it leads to action. The DFD should help you map each significant threat to one or more controls.
Typical control mappings include:
- Spoofing: strong authentication, mutual TLS, workload identity, signed tokens, and certificate lifecycle management
- Tampering: integrity checks, signed messages, secure transport, input validation, and restricted write permissions
- Repudiation: centralised logging, time synchronisation, immutable or protected logs, and traceable request IDs
- Information disclosure: encryption in transit, encryption at rest where appropriate, data minimisation, and access control
- Denial of service: rate limiting, queue controls, autoscaling, circuit breakers, and upstream filtering
- Elevation of privilege: least privilege, RBAC, separation of duties, and hardened service accounts
Segmentation is often relevant where a DFD shows a sensitive process or store reachable from a broader network than necessary. In cloud environments, that may mean security groups, network policies, private endpoints, or microsegmentation. In application design, it may mean separating administrative functions from user-facing paths.
Logging should be considered at the same time as the control itself. If a threat is likely to be investigated later, make sure the relevant process emits enough context to support detection and response. That includes authentication events, privilege changes, sensitive data access, and failed security checks.
Prioritising remediation based on impact, exposure, and implementation effort
Not every finding deserves immediate work. Prioritisation should reflect business impact, exposure, and the effort required to reduce risk.
A practical way to rank findings is to ask:
- What is the likely impact if this control is missing or bypassed?
- How exposed is the weakness, internally and externally?
- How easy would it be to exploit in the real environment?
- How much effort is needed to fix it properly?
- Are there compensating controls already in place?
This is where the DFD supports risk-based decision-making. A missing control on a high-value, internet-facing flow should usually outrank a similar weakness on a low-value internal batch process. Likewise, a control that can be implemented with a configuration change may be worth doing before a larger architectural refactor.
For SMEs, the goal is not perfection. It is to reduce the most meaningful risks first and to avoid spending time on low-value detail.
Making DFD-based threat modelling work in real teams
Using workshops with architects, developers, and operations teams
Threat modelling works best as a collaborative exercise. A good DFD workshop usually includes someone who understands the business process, someone who knows the application design, and someone who understands operations or platform constraints.
In the workshop, start with the current or proposed design. Confirm the system boundary, list the external entities, and walk through the main data flows. Then challenge assumptions. Where does identity come from? What happens if the identity provider is unavailable? Which components are internet-facing? Which stores contain sensitive data? Which flows cross trust boundaries?
Keep the session focused on decisions. If the team cannot explain why a trust boundary exists or why a service needs broad access, that is a useful outcome. The aim is not to create a perfect model. It is to surface design choices that affect security.
For distributed teams, a lightweight template helps. Use a standard notation, a short threat checklist, and a simple findings log with owner, priority, and target date. That makes the process repeatable without turning it into bureaucracy.
Keeping diagrams current through change management and design reviews
A DFD loses value quickly if it is only updated once. The best way to keep it useful is to tie it to change management and design review. Any material change to authentication, data storage, integration, hosting, or trust boundaries should trigger a review of the diagram.
That does not mean every minor code change needs a full workshop. It means the model should be revisited when the security-relevant shape of the system changes. Examples include:
- Adding a new third-party integration
- Moving a service into a new cloud environment
- Changing how secrets or tokens are stored
- Introducing a new admin interface
- Splitting a monolith into services
- Exposing an internal API to partners or customers
If the diagram is part of the design record, it becomes easier to spot when the implementation has drifted from the intended security model.
Common mistakes and how to avoid them
Overcomplicating diagrams or modelling too much detail too early
One of the most common mistakes is trying to capture everything in one diagram. That usually makes the model hard to read and hard to maintain. Start with a high-level DFD for the system or feature, then add detail only where it changes the threat picture.
Another mistake is mixing implementation detail with analysis detail. You do not need to show every container, subnet, or library unless it affects trust or exposure. If the diagram becomes a network map, it has probably gone too far.
A useful test is whether the diagram helps the team answer security questions. If it does not, simplify it.
Treating the diagram as documentation only rather than an analysis tool
Some teams create a DFD because it is expected, then file it away. That misses the point. The diagram should be used to drive discussion, identify threats, and justify controls.
If no threats are recorded against the diagram, it is probably not being used properly. If the same diagram is never revisited during design changes, it will quickly become stale. The value comes from the analysis cycle, not the drawing itself.
A practical starter approach for SMEs
A lightweight workflow for new systems, major changes, and recurring reviews
For a small or medium-sized organisation, a practical workflow might look like this:
- Draw a simple DFD for the system or change in scope.
- Mark trust boundaries, sensitive data, and external dependencies.
- Apply STRIDE to each process, flow, and store.
- Record threats, existing controls, and gaps.
- Prioritise the gaps using impact, exposure, and effort.
- Assign owners and track remediation through normal delivery or change processes.
- Review the model again when the system changes materially.
That workflow is light enough for most teams to use without specialist tooling. A whiteboard, a diagramming tool, and a simple register are often enough to begin.
How to reuse the approach across cloud, SaaS, and internal applications
The same method works across different environments. In cloud systems, the DFD should show identity services, storage, queues, network controls, and managed services where they affect trust. In SaaS products, it should show tenant boundaries, administrative paths, and third-party integrations. In internal applications, it should show user access, privileged access, data stores, and any links to external services.
The exact notation matters less than consistency. If the team can use the same approach across projects, it becomes easier to compare risk, reuse controls, and spot recurring weaknesses.
Applying data-flow diagrams to security threat modelling is most effective when it is treated as a design discipline. The diagram helps you understand the system, STRIDE helps you challenge it, and the resulting control decisions help you reduce risk in a way that is proportionate to the business.
If you want support turning this into a repeatable process for your environment, a consultant can help you structure the workshop, define a practical template, and align the output with your wider security architecture and risk management approach.
FAQ
Do I need a formal threat modelling framework to use data-flow diagrams effectively?
No. A formal framework helps with consistency, but a DFD can still be valuable on its own if you use it to identify trust boundaries, sensitive data, and security-relevant dependencies. In practice, pairing the diagram with STRIDE gives you a simple and repeatable structure without adding much overhead.
How detailed should a data-flow diagram be before it becomes hard to maintain?
Detailed enough to support security decisions, but no more. If the diagram starts to look like an infrastructure inventory, it is probably too detailed. Keep the main model at a level where the team can still understand the flows, then add separate views only for areas that need deeper analysis.


Comments are closed