A digital twin for threat analysis and risk assessment (TARA) is a virtual model of a vehicle system, with its electronic control units (ECUs), networks, interfaces and security controls, that you can attack in simulation. Instead of estimating how bad an attack would be or whether a countermeasure works, engineers run the attack on the twin, watch what happens, and carry that evidence into the TARA that ISO/SAE 21434 calls for. It helps most at the system and vehicle level, where a TARA built from static diagrams goes stale every time the design changes.
A TARA for a single component is fairly contained. At the system or vehicle level it gets complicated fast, and teams end up revisiting the assessment as the design evolves. One way to handle that is to look at the target of evaluation in two spaces. The real vehicle lives in physical space: hardware, sensors and actuators. Its digital twin lives in cyberspace as a virtual copy of the vehicle's electronic systems and communication networks, where we can simulate threats, look for weaknesses and test controls without touching a car.

What is a digital twin in automotive cybersecurity?
A digital twin is a virtual representation of a physical object or system that is kept in step with its real counterpart through data. In vehicle cybersecurity, a twin mirrors:
- ECUs and their software, sometimes including the software bill of materials (SBOM)
- In-vehicle networks such as Controller Area Network (CAN), automotive Ethernet and FlexRay
- External interfaces such as vehicle-to-everything (V2X) communication, Bluetooth and cellular
- Security controls such as firewalls, intrusion detection and encryption
That gives security engineers a place to try attacks and evaluate countermeasures without putting a real vehicle, or a real driver, at risk.
How a digital twin makes a TARA better
A traditional TARA works from a static architecture and attack paths written down in advance. That's a fine start, but the design keeps changing and new attack techniques keep appearing, so a static assessment drifts out of date. A twin helps in three ways:
- A TARA that stays current. When the twin is fed with design changes and real-world data, the assessment can be re-run instead of rewritten.
- Engineers can test their own assumptions. Design engineers can simulate an attack on their system and check a control themselves, rather than waiting on the TARA team for every question. We've written before about why involving engineers early in the TARA process pays off.
- Ratings backed by evidence. Simulated attack results give impact and feasibility ratings something firmer to stand on than judgment alone.
Simulating a TARA on a braking-system digital twin
Here is how a simulated TARA plays out, step by step. ISO/SAE 21434 treats its TARA methods as building blocks rather than a fixed sequence, so we've grouped them into four steps for this example.
Step 1: Choose the twin and identify assets
Digital twins come in four common types, from narrow to broad:
- Component twins: a single part, such as a brake sensor or actuator.
- Asset twins: a complete unit made of several components, such as an engine.
- System twins: several assets working together, such as an entire braking system.
- Process twins: whole workflows, such as vehicle manufacturing or supply chain logistics.
For our example, we can use a system twin of a vehicle's braking system, using CARLA, an open-source driving simulator, for the vehicle and driving conditions, with the brake ECU, anti-lock braking system (ABS), actuators and CAN bus modeled in Python. A system twin isn't strictly necessary, and a simpler asset twin can work well depending on the project. The twin then lets us:
- Simulate baseline behavior: normal braking under different driving conditions.
- Simulate attacks: inject malicious CAN messages that try to override or disable braking.
- Assess impact and test countermeasures: watch how the system responds, then add controls and try again.

Asset identification then happens on the model: the brake ECU, sensors and CAN messages, the cybersecurity properties that matter for each (integrity of the brake command, for example), and the damage scenarios if they are compromised. A CAN bus attack that causes brake failure or a sudden stop is the damage scenario this example tests.
Step 2: Identify threats and attack paths
- Model likely attack vectors:
- Remote attacks such as wireless injection or spoofed over-the-air messages
- Network attacks such as CAN spoofing or denial of service
- Sensor attacks such as LiDAR blinding or GPS spoofing
- Run each attack in the twin and record how the system responds.
Step 3: Rate impact and feasibility
Instead of estimating the consequence of a spoofed brake command, measure it in the twin: how much braking is lost, and under which driving conditions. The simulation also shows what access and tools an attack path really needs, which is the evidence an attack feasibility rating is built on.
Step 4: Decide treatment and test the mitigation
- Add countermeasures to the twin, such as firewalls, encryption or intrusion detection.
- Re-run the same attacks with the countermeasures in place to see whether they work.
- Update the TARA with what the twin showed, including any risk left over.
The risk treatment decision itself (avoid, reduce, share or retain) still belongs to people. We walk through it in Navigating the Risk Treatment Decision in TARA.
Put side by side, the difference for the braking example looks like this:

- Asset identification. Without a twin: list the braking components. With a twin: model them virtually.
- Damage scenarios and impact. Without: estimate the consequences. With: simulate the attack and measure the effect on braking.
- Threats and feasibility. Without: rate from experience. With: run the attack and record what it took.
- Risk treatment. Without: propose a control. With: test the control against the same attack before hardware exists.
Pros and cons of using a digital twin for TARA
Pros:
- Lower cost. You can test without physical parts or expensive hardware, which matters most early in development when parts aren't available yet.
- Earlier findings. Weaknesses show up while the design can still change cheaply.
- Safe testing. You can try dangerous scenarios, like an attack on the braking system, without putting anyone at risk.
- Reusable. Once built, the twin serves many tests, and new features can be tried without building new physical setups.
Cons:
- Effort to build. An accurate model takes time and expertise.
- Limited fidelity. A twin is only as good as its model. A simulation that models the messages but not the physical bus won't show bus timing or hardware quirks, so important findings still need confirming on real hardware.
- Data quality. Wrong or missing data gives wrong answers.
- Integration. Connecting a twin to existing vehicle software can be hard, especially for older systems.
- Privacy. If the twin takes in personal or sensitive data, it needs the same protection as the real system.
Simulate first, then confirm on hardware
A digital twin doesn't replace the ISO/SAE 21434 work products, and it doesn't satisfy UN Regulation No. 155 on its own. What it gives you is better evidence inside the TARA you already have to produce: ratings you measured, and mitigations you tested before the hardware existed.
The habit that matters is the loop: try the attack virtually, then confirm the result on real hardware. You can practice that loop in VSEC Test today. A test case runs the same way against a Simulation Bench, a simulated target with no hardware needed, as it does against a real ECU on your test bench through a VSEC Bench, a Raspberry Pi that connects it to the cloud. It isn't a full vehicle twin, but the loop is the same. When the hardware arrives, remote hardware-in-the-loop testing keeps those results current release after release.
To try it, get a free VSEC Test license and run your first test case against a simulated ECU.
Subject expert

Andre Weimerskirch is Chief Operating Officer at Block Harbor, where he runs operations and the company's AI-first initiative. His work focuses on making cybersecurity engineering scale, from AI-assisted TARA to putting effort where the real risk is.




