Skip to content

Code that implements Factor Analysis of Information Risk (FAIR) using Markov Chain Monte Carlo (via PyMC) to determine the frequency of successful attacks.

License

joshua-m-connors/cyber-incident-mcmc-pymc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cyber Incident Estimation utilizing Markov Chain Monte Carlo (MCMC) simulation

This code takes an initial (prior) estimate of the frequency of attacks against an organization. This range would be similar to Threat Event Frequency (TEF) in the Factor Analysis of Information Risk (FAIR) taxonomy, but likely a bit higher (analysts likely weed out or are unaware of many attacks that fail early on).

Note: There is an option (lines 270 & 271) to enter actual observational data (i.e. if you know there were 2 successful incidents in the past 3 year).

It then simulates each attack as it progresses through the relevant MITRE ATT&CK tactics. Each tactic has an individually estimated range of control strength that gets applied. There is also logic that assumes that when an attacker fails with a tactic, they may retry and/or fallback and try a different path. However, as they fallback and try different techniques the chance of being discovered or blocked increases.

The result is then an posterior projection of the number of successful attacks that will actually get through the entire attack process to full compromise. These are then combined with estimates of loss aligned to FAIR loss categories to compute Annualized Loss Expectancy (ALE).

Running the code:

You can use either the .py file or if you prefer Jupyter Notebooks you can use the .ipynb file.

Note: The Jupyter Notebook version of the code is dialed back to run fewer simulations, this is because Jupyter Notebooks won't always play nice with the parallelization that is implemented in the .py version.

Requires:

Acknowledgements:

  • I got a lot of help on this from Claude and ChatGPT.

Sample Output:

The code also outputs two CSV files, to the same directory the .py file is save in, that includes the summary statistics and the full annualized simulation data for each draw.

Screenshot From 2025-10-27 08-47-32 Figure_1 Figure_2

MITRE ATT&CK Tactics Progression

This is intended to show attackers progression through the MITRE ATT&CK tactics, so you can see how far attackers are getting, where controls may be more effective at stopping attackers, etc.

Note: I have only implemented this view into the Jupyter Notebook version of the code, due to the extended time it takes to gather these statistics.

Screenshot From 2025-10-27 09-55-10

About

Code that implements Factor Analysis of Information Risk (FAIR) using Markov Chain Monte Carlo (via PyMC) to determine the frequency of successful attacks.

Topics

Resources

License

Stars

Watchers

Forks