Multi-Stage Attack Graph Simulation Via Markov Chains

Closed-Form Time to Resolution and Absorption Probabilities for Containment versus Catastrophic Breach

Author

Patrick Lefler

Published

August 27, 2026

Introduction

Enterprise cyber defenses have traditionally relied on static checklists and subjective risk heatmaps that do not capture how adversaries maneuver through networks over time. When advanced persistent threats (APTs) or ransomware operators infiltrate an organization, they do not execute a single isolated attack; they work through a sequence of tactical stages, from initial delivery to privilege escalation and lateral movement. Traditional security metrics rarely quantify the speed of this progression or the likelihood of catastrophic outcomes relative to early containment.

This project implements a multi-stage cyber attack simulator using absorbing Markov chains in R. The attack is modeled as a set of transient stages and permanent absorbing outcomes. Using the Fundamental Matrix framework, we compute, for an assumed transition matrix, the closed-form probability that an attack ends in containment versus data exfiltration or ransomware, and the expected time to resolution. The goal is to illustrate how such a model can support discussion of detection and response priorities. It is not a validated risk quantification: the inputs are illustrative (see Parameterization and Assumptions). The term “attack graph” is used loosely here: the states are tactic-level stages, not the host, privilege, and vulnerability nodes of a formal attack graph.

%%{init: {'themeVariables': { 'fontSize': '14px', 'fontFamily': 'sans-serif' }}}%%
flowchart LR
    S1["<b>S1: Recon & Phishing</b><br>(User Engagement)"] --> S2["<b>S2: Initial Foothold</b><br>(Endpoint Breach)"]
    S2 --> S3["<b>S3: Priv Escalation</b><br>(Credential Theft)"]
    S2 --> S4
    S3 --> S4["<b>S4: Lateral Movement</b><br>(Network Discovery)"]
    S3 --> S5
    S4 --> S3
    S4 --> S5["<b>S5: Domain Dominance</b><br>(Active Directory)"]
    S4 --> S6
    S5 --> S6["<b>S6: Payload Staging</b><br>(Arming Assets)"]

    S1 -.-> A1["<b>A1: Contained / Terminated</b>"]
    S2 -.-> A1
    S3 -.-> A1
    S4 -.-> A1
    S5 -.-> A1
    S6 -.-> A1
    S5 -.-> A2["<b>A2: Data Exfiltration</b>"]
    S5 -.-> A3["<b>A3: Enterprise Ransomware</b>"]
    S6 -.-> A2
    S6 -.-> A3

    classDef default fill:#f8f9fa,stroke:#0275d8,stroke-width:1.5px;
    classDef good fill:#e4f4e4,stroke:#5cb85c,stroke-width:1.5px;
    classDef alert fill:#fce4e4,stroke:#d9534f,stroke-width:1.5px;
    class A1 good;
    class A2,A3 alert;

Solid arrows are transitions among transient stages (forward, skip, and the S4 → S3 back-edge); dotted arrows are transitions into absorbing outcomes. Self-loops are omitted for readability.

How to read the diagram. Each box is a stage of an attack or a final outcome. The six blue-bordered boxes, S1 to S6, are the stages an attacker moves through, from a user engaging with a phishing lure to staging a ransomware payload. Solid arrows show where an attacker can move next; dotted arrows show where an attack can end. The green box is containment, and the two red boxes are the catastrophic outcomes: data theft and ransomware.

What the diagram tells you. Every stage has a dotted arrow to containment, so defenders get a chance to stop the attack at each step. Only the last two stages, domain dominance and payload staging, lead to a catastrophic outcome, so an attacker must get deep into the network before serious damage occurs. The arrows show which moves are possible, not how likely they are; the likelihoods are assumed values set out on The Model.

How this site is organized. This page gives the headline results and conclusions. The Model sets out the mathematics, the assumptions, the solver, and the diagnostic plots. Robustness and Limitations tests how far the results move when the inputs change and lists what the model cannot show. Reproducibility explains how to rerun everything.

Scorecard

The scorecard summarizes the closed-form metrics under the illustrative baseline and improved-posture matrices. Time to resolution is shown in steps first and hours second.

Display code
scorecard_table <- res |>
  transmute(
    Kill_Chain_Stage = stage,
    Baseline_Steps = steps_b,
    Baseline_Hours = hours_b,
    Baseline_Containment_Pct = cont_b * 100,
    Baseline_Catastrophic_Pct = cat_b * 100,
    Hardened_Containment_Pct = cont_h * 100,
    Hardened_Catastrophic_Pct = cat_h * 100,
    Containment_Uplift_pp = (cont_h - cont_b) * 100
  )

scorecard_table |>
  gt() |>
  tab_header(
    title = "Kill-Chain Absorption Scorecard",
    subtitle = "Closed-form absorbing Markov chain metrics: baseline vs. illustrative improved posture"
  ) |>
  cols_label(
    Kill_Chain_Stage = "Starting Stage",
    Baseline_Steps = "Time to Resolution (steps)",
    Baseline_Hours = "Time to Resolution (hours)",
    Baseline_Containment_Pct = "Containment (Base)",
    Baseline_Catastrophic_Pct = "Catastrophic (Base)",
    Hardened_Containment_Pct = "Containment (Improved)",
    Hardened_Catastrophic_Pct = "Catastrophic (Improved)",
    Containment_Uplift_pp = "Containment Uplift (pp)"
  ) |>
  fmt_number(columns = Baseline_Steps, decimals = 1) |>
  fmt_number(columns = Baseline_Hours, decimals = 1, pattern = "{x} hrs") |>
  fmt_percent(columns = c(Baseline_Containment_Pct, Baseline_Catastrophic_Pct,
                          Hardened_Containment_Pct, Hardened_Catastrophic_Pct),
              scale_values = FALSE, decimals = 1) |>
  fmt_number(columns = Containment_Uplift_pp, decimals = 1, pattern = "+{x} pp") |>
  data_color(
    columns = Baseline_Catastrophic_Pct,
    direction = "column",
    palette = c("#ffffff", "#f8d7da", "#d9534f")
  ) |>
  data_color(
    columns = Hardened_Containment_Pct,
    direction = "column",
    palette = c("#ffffff", "#d4edda", "#5cb85c")
  ) |>
  tab_options(
    table.font.size = 11,
    heading.title.font.size = 13.5,
    heading.subtitle.font.size = 11
  )
Kill-Chain Absorption Scorecard
Closed-form absorbing Markov chain metrics: baseline vs. illustrative improved posture
Starting Stage Time to Resolution (steps) Time to Resolution (hours) Containment (Base) Catastrophic (Base) Containment (Improved) Catastrophic (Improved) Containment Uplift (pp)
S1: Recon & Phishing 3.5 14.2 hrs 72.5% 27.5% 97.3% 2.7% +24.8 pp
S2: Initial Foothold 3.4 13.5 hrs 61.9% 38.1% 93.5% 6.5% +31.6 pp
S3: Privilege Escalation 3.1 12.6 hrs 47.1% 52.9% 87.0% 13.0% +39.9 pp
S4: Lateral Movement 2.7 10.9 hrs 34.1% 65.9% 74.6% 25.4% +40.5 pp
S5: Domain Dominance 1.9 7.7 hrs 19.3% 80.7% 56.2% 43.8% +36.9 pp
S6: Payload Staging 1.1 4.2 hrs 10.5% 89.5% 36.8% 63.2% +26.3 pp

How to read the table. Each row is the stage where an attack starts, from S1 (a user engages with a phishing lure) to S6 (ransomware staged). The first two columns give the expected time until the incident ends in any way, in 4-hour steps and in hours. The next four give the chance it ends contained or catastrophic (data theft or ransomware), under the baseline and under an improved posture. The last column is the gain in containment, in percentage points.

What the table tells you. The later an attack is caught, the worse the odds: containment falls from 72.5% for an attack starting at S1 to 10.5% at S6 under the baseline. The improved posture lifts containment at every stage, by 24.8 to 40.5 points. All inputs are illustrative assumptions, so these figures show how the model behaves, not the risk to any real organization.

In more detail

Catastrophic outcomes overtake containment at S3. Under the baseline parameters, catastrophic probability rises from 38.1% at S2 to 52.9% at S3 (versus 47.1% containment) and reaches 89.5% by S6. This is a consequence of the hand-set parameters, and the uncertainty analysis attaches a 90% interval of 42.3%–63.5% to the S3 value. It is suggestive that identity and credential controls matter around this stage, but it does not show that perimeter defense alone is insufficient.

The window shortens with depth. Expected time to resolution falls from 14.2 hours at S1 to 4.2 hours at S6, a decline of 70%. This is the time to any resolution; it shrinks partly because fewer stages remain. The time scale rests on the assumed 4-hour step.

Improvement from a hand-set matrix. Moving from the baseline to the illustrative improved posture raises containment by 24.8 to 40.5 percentage points depending on the starting stage, with the largest uplifts at S3 and S4 (39.9 and 40.5 pp). Because all rows change together, this does not identify which stage’s control matters most; see the one-row-at-a-time table.


Scorecard Insights

Insight 1 (Early-Stage Response Time): Under the baseline, an attack starting at S1: Recon & Phishing has an expected time to resolution of 14.2 hours; conditional on ending in a catastrophic outcome, the expected time to that outcome is 25.0 hours. Response targets such as MTTD under 4 hours and MTTR under 8 hours on initial endpoint compromises are consistent with this picture of neutralizing activity before S3: Privilege Escalation, but they follow from the assumed 4-hour step, not from the model, and should be set from observed dwell times.

Insight 2 (Active Directory Tier-0 Isolation): If an adversary reaches S5: Domain Dominance, the baseline probability of a catastrophic outcome is 80.7% (90% parameter-uncertainty interval 71.0%–89.1%). Under these parameters that supports prioritizing segregation of identity infrastructure; the figure is a function of the assumed S5 row, not a measured rate.

Insight 3 (Control Prioritization): Moving to the illustrative improved posture raises containment for an attack starting at S1 from 72.5% to 97.3% (+24.8 pp). Hardening one row at a time, the S1 and S2 rows carry the most leverage for attacks starting at S1. S2 ranks first in 61.9% of parameter draws and S1 in 31.6%, so their order is not robust. The size of the decline for deeper rows also depends on how the perturbation is defined: about 1.6× under a fixed 0.05 shift versus 4.0× under a proportional change. This illustrates how a control improvement translates into outcome probabilities; investment decisions require cost and loss inputs that this model does not contain.

Insights & Conclusions

This project illustrates how an attack progression can be represented as an absorbing Markov chain and solved in closed form. Six kill-chain-style stages lead to three outcomes. For an assumed transition matrix, the Fundamental Matrix and matrix powers give the outcome probabilities, expected times, and full time-to-outcome distributions from every starting stage, without simulation. Under the illustrative baseline, an attack starting at S1 ends in a catastrophic outcome with probability 27.5%; when it does, it arrives in 25.0 hours on average and never before 16 hours. At the point estimate, catastrophic outcomes become more likely than containment at S3 (52.9% versus 47.1%). However, the crossing falls at S3 in only 38.0%–79.1% of parameter draws, depending on the assumed concentration α. The closed form is exact given \(P\), but \(P\) is uncertain, and the time layer in particular restates the 4-hour step assumption.

On where to act, the evidence is more limited than a comparison across starting stages suggests. The one-row-at-a-time analysis points to the S1 and S2 rows as carrying the most leverage for attacks starting at S1. Their order is not robust (S2 ranks first in 61.9% of draws), and the size of the decline for deeper rows depends on how a control change is represented. The paired comparison puts the illustrative improved posture’s containment uplift from S1 at 24.6 pp, with a 90% interval of 18.2 pp–31.7 pp. That is a scenario difference, not a measured control effect. Whether any real control (MFA, EDR, Zero Trust) corresponds to these parameter changes is not something this model can establish: there are no costs, loss magnitudes, or control-to-parameter mapping. Loss quantification, including any Cyber Value-at-Risk (CyVaR) figure, would need a stated loss mapping that is not part of this version.

Closed-form algebra replaces simulation for absorption probabilities, expected times, and time-to-outcome distributions. Monte Carlo is still needed to propagate parameter uncertainty; the simulation check reproduces \(B\), \(\mathbf{t}\), the conditional times, and one cumulative-incidence point as a correctness test. Other limitations are listed under Parameterization and Assumptions: the memoryless property, constant per-step hazard, geometric holding times, a single assumed step length coupled to the transition probabilities, a containment share that falls with depth by assumption, phishing as the only entry vector, permanent containment, mutually exclusive A2/A3 outcomes, and hand-set probabilities that are not calibrated to any cited benchmark. The natural next version is a continuous-time chain with stage-specific rates, which removes the time floor and lets controls act as hazard ratios. Real attackers adapt, and real environments differ.