Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

Attack Tree Structure

Attack Tree: Remote CAN Frame Injection
  ROOT GOAL: Inject arbitrary CAN frames remotely (OR)
  │
  ├── [OR] Path A: Exploit infotainment → pivot to CAN
  │    ├── [AND] Step A1: Exploit web browser heap overflow (LAN/WiFi)
  │    └── [AND] Step A2: Escape renderer sandbox (kernel 0-day)
  │              └── [AND] Step A3: Access CAN gateway from app processor
  │
  ├── [OR] Path B: Exploit telematics cellular interface
  │    ├── [AND] Step B1: Find open port on LTE modem (nmap scan)
  │    └── [AND] Step B2: Buffer overflow in cellular stack service
  │
  └── [OR] Path C: Physical OBD-II + CAN injection (low-tech)
       └── Step C1: Connect CAN adapter to OBD-II port (trivial)

  OR node: attacker picks easiest path → feasibility = MAX of children
  AND node: attacker must complete all steps → feasibility = SUM of AFR scores
  Depth: 3–5 levels typical for ECU scenarios

AFR Factor Scoring Tables

FactorSymbol01–23–46–11
Elapsed TimeET≤ 1 day≤ 1 week (1)≤ 1 month (2), ≤ 6 months (3)> 6 months (4)
Specialist ExpertiseSELayman (0)Proficient (2), Expert (4)Multiple experts (6)
Knowledge of TargetKTPublic (0)Restricted (3), Sensitive (7)Critical (11)
Window of OpportunityWoOUnlimited (0)Easy (1)Moderate (4)Difficult (10)
EquipmentEQStandard (0)Specialized (4), Bespoke (7)Multiple bespoke (9)
Total AFR ScoreFeasibility LevelRisk Treatment Required
0–13HighMandatory countermeasure regardless of impact level
14–19MediumCountermeasure required for S2/S3 impact; review for lower
20–24LowCountermeasure for S3 only; accept with rationale for lower
25+Very LowAccept with documented rationale and review date

AND/OR Feasibility Aggregation

Pythonattack_tree_aggregator.py
#!/usr/bin/env python3
# Attack tree feasibility aggregation per ISO/SAE 21434 Annex B

from dataclasses import dataclass
from typing import List, Optional

@dataclass
class AttackNode:
    name: str
    gate: str           # "AND", "OR", or "LEAF"
    afr_score: Optional[int] = None   # LEAF nodes only
    children: List = None

    def __post_init__(self):
        if self.children is None:
            self.children = []

def compute_feasibility(node: AttackNode) -> int:
    if node.gate == "LEAF":
        return node.afr_score

    child_scores = [compute_feasibility(c) for c in node.children]

    if node.gate == "OR":
        # Attacker picks easiest (lowest score = highest feasibility)
        return min(child_scores)
    elif node.gate == "AND":
        # Attacker must complete all steps → sum scores
        return sum(child_scores)

def score_to_level(score: int) -> str:
    if score <= 13: return "High"
    if score <= 19: return "Medium"
    if score <= 24: return "Low"
    return "Very Low"

# Example: Remote CAN injection attack tree
path_b = AttackNode("Path B: LTE exploit", "AND", children=[
    AttackNode("B1: Find open port", "LEAF", afr_score=2),   # ET=1d(0)+SE=layman(0)+KT=public(0)+WoO=easy(1)+EQ=std(0)=1
    AttackNode("B2: Buffer overflow in cellular stack", "LEAF", afr_score=10),
])

path_c = AttackNode("Path C: OBD-II physical", "LEAF", afr_score=1)  # trivially easy

root = AttackNode("Remote CAN Injection", "OR", children=[path_b, path_c])

total = compute_feasibility(root)
print(f"Root attack feasibility: score={total} → {score_to_level(total)}")
print(f"  Path B score: {compute_feasibility(path_b)} → {score_to_level(compute_feasibility(path_b))}")
print(f"  Path C score: {compute_feasibility(path_c)} → {score_to_level(compute_feasibility(path_c))}")

Tool Support for Attack Trees

ToolFeatureAutomotive Use
IriusRiskAutomated attack tree generation from architecture model; STRIDE auto-applyTARA automation; CI integration for continuous threat modelling
Foreseeti SecuriCADProbabilistic attack simulation on architecture modelQuantitative feasibility estimation; 'what-if' countermeasure analysis
SPARTA (Threat Catalogue)Pre-built automotive attack tree library (UNECE R155 threat categories)Accelerate TARA by starting from industry-proven attack patterns
NVD API + CVE correlationMap attack tree leaf nodes to known CVE exploits; existing exploit = ET drops to ≤ 1 dayAutomated feasibility adjustment when CVE exists for attack step

Summary

Attack trees provide a structured, auditable representation of how an attacker moves from entry point to goal. The AND/OR gate semantics are critical: OR gates (pick easiest path) use minimum score; AND gates (all steps required) use summed scores. A pre-existing CVE exploit for any leaf node automatically raises that node's feasibility to High — run the NVD API query as part of every TARA update to catch newly published exploits against your component's software stack.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousTARA Methodology — Step by StepNext →Impact Rating & Risk Determination