Updated documentation

pull/14/head
Thorsten Sick 4 years ago
parent e51c46bba3
commit d1aa63bbae

@ -33,7 +33,6 @@ class AttackLog():
self.machines: list[dict] = []
self.verbosity = verbosity
# TODO. As soon as someone wants custom timestamps, make the format variable
self.datetime_format = "%H:%M:%S.%f"
def __add_to_log__(self, item: dict):

@ -2,11 +2,29 @@
Basics
======
Purple Dome is a simulated and automated environment to experiment with several operating system attacking each other.
Purple Dome is a simulated and automated environment to experiment with hacking - and defense.
This tool generates an attacker VM and target VMs. Automated attacks are then run against the targets and they will log system events. Those logs will then be stored away for analysis.
PurpleDome is relevant for you:
Attacks are started from the attacker VM which is normally a Kali linux machine (with all the Kali tools) running a Caldera server for additional tooling.
* If you develop sensors for bolt on security
* If you want to test detection logic for your bolt on security
* If you want to stress test mitigation around your vulnerable apps
* Experiment with hardening your OS or software
* Want to forensically analyse a system after an attack
* Do some blue team exercises
* Want to train ML on data from real attacks
PurpleDome simulates a small busniess network. It generates an attacker VM and target VMs. Automated attacks are then run against the targets.
Depending on which sensors you picked you will get their logs. And the logs from the attacks. Perfect to compare them side-by-side.
Attacks are written as small plugins and control pre-installed tools:
* Kali command line tools
* Caldera commands
* Metasploit
That way your experiments focus on behaviour detection. And not on whack-a-mole games with malware samples.
-------------------
@ -23,11 +41,12 @@ Features
* Metasploit attacks
* Data collection: Attack log and sensor data in parallel with timestamps for matching events
* Vulnerability plugins: Modify the targets before the attack
* Sensor plugins: Write a simple wrapper around your sensor and integrate it into the experiments
Components
==========
The command line tools are the way you will interact with Purple Dome the most. Those are described in the *CLI* chapter.
The command line tools are the way you will interact with Purple Dome. Those are described in the *CLI* chapter.
The experiments are configured in YAML files, the format is described in the *configuration* chapter. You will also want to create some target VMs. You can do this manually or use Vagrant. Vagrant makes it simple to create Linux targets. Windows targets (with some start configuration) are harder and have an own chapter.

@ -9,14 +9,25 @@ To define the VMs there are also *Vagrantfiles* and associated scripts. The exam
Machines
========
Machines (targets and attacker) are configured in *experiment.yaml* - the default config file. There are different kinds of VM controllers and different communication interfaces. You will have to pick one and configure it per machine.
Machines (targets and attacker) are configured in an experiment specific yaml file (default is: *experiment.yaml*). There are different kinds of VM controllers and different communication interfaces. You will have to pick one and configure it per machine.
If you use the VM controller "vagrant" you will also have to create a Vagrantfile and link to the folder containing it.
SSH
---
SSH is the default communication interfaces. If you use Linux and Vagrant Purple Dome can use vagrant to establish SSH communication. For Windows - which needs OpenSSH installed - the configuration needs the proper keyfile specified.
SSH is the default communication interfaces. If you use Linux and Vagrant Purple Dome can use vagrant to establish SSH communication. For Windows - which needs OpenSSH installed - the configuration needs the proper keyfile specified. And you will have to manually install SSH on the windows target.
Vulnerabilities
===============
You can install vulnerabilities and weaknesses in the targets to allow your attacks to succeed (and generating more data that way). Vulnerabilities are implemented as plugins and listed by name in each machine.
Sensors
=======
Each machine can have a list of sensors to run on it. In addition there is the global *sensor_conf* setting to configure the sensors.
Sensors are implemented as plugins.
Attacks
=======
@ -28,19 +39,42 @@ Caldera attacks (called abilities) are identified by a unique ID. Some abilities
All Caldera abilities are available. As some will need parameters and Caldera does not offer the option to configure those in the YAML, some caldera attacks might not work without implementing a plugin.
kali_attacks
------------
In the YAML file you will find two sub-categories under caldera_attacks: linux and windows. There you just list the ids of the caldera attacks to run on those systems.
plugin_based_attacks
--------------------
Kali attacks are kali commandline tools run. Those are executed by specific Purple Dome plugins. Only Kali tools dupported by a plugin are available. You can reference them by the plugin name.
Kali attacks are kali commandline tools run. Metasploit attacks are metasploit steps to run against the target. Both are executed by specific Purple Dome plugins. You can reference them by the plugin name.
kali_conf
---------
In the YAML file you will find two sub-categories under plugin_based_attacks: linux and windows. There you just list the plugin names to run on those systems.
All kali attacks can have a special configuration. The configuration is attack tool specific.
attack_conf
-----------
All plugin based attacks can use configuration. This is in plugin-name sub categories in here.
Example config file
===================
The example defines four machines:
* A kali attacker
And three targets
* target1 (an old Linux, Ubuntu managed)
* target2 (Vagrant managed Windows. Pre installed)
* target3 (Ubuntu 20.10, Created by Vagrant)
It also defines the pre-installed sensors and the vulnerabilities active on each machine.
Next it sets the attack configuration (nap time between attacks and similar) and specifies which attacks to run against which targets.
* plugin_based_attacks
* caldera_attacks
For the plugins it has plugin specific configuration in *sensor_conf* and *attack_conf*
.. autoyaml:: ../template.yaml

@ -3,7 +3,7 @@ Attack plugins
**************
Attack features of PurpleDome can be extended using a plugin system. Those attack plugins can start Caldera ttacks, run Kali command line tools ir use Metasploit.
Attack features of PurpleDome can be extended using a plugin system. Those attack plugins can start Caldera attacks, run Kali command line tools or use Metasploit.
An example plugin is in the file *hydra_plugin.py*. It contains a plugin class that **MUST** be based on the *AttackPlugin* class.
@ -30,7 +30,7 @@ The boilerplate contains some basics:
* name: a unique name, also used in the config yaml file to reference this plugin
* description: A human readable description for this plugin.
* ttp: The TTP number of this kali attack. See https://attack.mitre.org/
* ttp: The TTP number of this kali attack. See https://attack.mitre.org/ "???" if it is unknown "multiple" if it covers several TTPs
* references. A list of urls to blog posts or similar describing the attack
* required_files: A list. If you ship files with your plugin, listing them here will cause them to be installed on plugin init.
Better than using required_files is to use:

@ -2,6 +2,8 @@
Extending the documentation
===========================
The documentation is Sphinx based.
Tools being used for documentation are:

@ -5,15 +5,16 @@ Extending
Modules
=======
Several core module create the system.
Several core module create the system. They are in the *app* folder
* CalderaControl: remote control for Caldera using the Caldera REST API
* Metasploit: Metasploit control
* MachineControl: Create/start and stop VMs
* ExperimentControl: Control experiments. Will internally use the modules already mentioned
* PluginManager: Plugin manager tasks
* MachineConfig / ExperimentConfig: Reading and processing configuration files
* AttackLog: Logging attack steps and output to stdio
* experimentcontrol: Control experiments. This is the central control for everything
* calderacontrol: remote control for Caldera using the Caldera REST API
* metasploit: Metasploit control. Simplifies the basic attack step so they can be used from plugins
* machinecontrol: Create/start and stop VMs. Will call the machinery plugin
* pluginmanager: Plugin manager tasks. Has methods to verify plugin quality as well
* config: Reading and processing configuration files
* attacklog: Logging attack steps and output to stdio
* doc_generator: Generates human readable documents from attack logs
--------------
@ -26,7 +27,7 @@ Class for Caldera communication
:members:
----------
MetaSploit
Metasploit
----------
Class for Metasploit automation
@ -34,6 +35,15 @@ Class for Metasploit automation
.. autoclass:: app.metasploit.Metasploit
:members:
-----------------
MetasploitInstant
-----------------
Extends. In addition to the communication features from the superclass Metasploit it simplifies basic commands.
.. autoclass:: app.metasploit.MetasploitInstant
:members:
--------
MSFVenom
--------

@ -2,7 +2,9 @@
Sensor plugins
**************
To experiment with different senors installed on the targets there is the sensor plugin. It contains a plugin class that **MUST** be based on the *SensorPlugin* class.
To experiment with different sensors installed on the targets there is the sensor plugin. It contains a plugin class that **MUST** be based on the *SensorPlugin* class.
The main goal of PurpleDome is to study sensor technology, which data they can collect and how to create an accurate picture of what happens during an attack. So this can be one of the most important plugin classes to extend.
Usage
=====
@ -11,7 +13,7 @@ To create a new plugin, start a sub-folder in plugins. The python file in there
If the plugin is activated for a specific machine specific methods will be called to interact with the target:
* prime: Easrly installation steps, can trigger a reboot of the machine by returning True
* prime: Easly installation steps, can trigger a reboot of the machine by returning True
* install: Normal, simple installation. No reboot
* start: Start the sensor
* stop: Stop the sensor
@ -29,9 +31,8 @@ The boilerplate contains some basics:
Additionally you can set *self.debugit* to True. This will run the sensor on execution in gdb and make the call blocking. So you can debug your sensor.
The plugin class
================
The sensor plugin class
=======================
.. autoclass:: plugins.base.sensor.SensorPlugin
:members:

@ -2,7 +2,7 @@
VM Controller plugins
*********************
The experiment being run handles the machines. As there can be several VM controllers being used this is handled by the plugin layer as well. Those machines can be target or attack machines.
The experiment being run handles the machines. Those machines can be targets or attacker machines. Different types of machine controllers are covered by those plugins.
A VM plugin handles several things:
@ -32,12 +32,27 @@ The boilerplate contains some basics:
* description. A human readable description for this plugin.
* required_files: A list. If you ship files with your plugin, listing them here will cause them to be installed on plugin init.
Some relevant methods are
Some relevant methods that must be implemented (even if they will not contain code) are:
process_config
--------------
up
--
The configuration for this machine is a sub-section in the experiment config. As the different machinery systems might require special handling, you can parse the config in this section and add your own processing or defaults
Starts the machine
create
------
Creates the machine. Vagrant for example can create machines based on config files.
halt
----
Stop the machine
destroy
-------
Destroy the machine
get_state
---------
@ -52,7 +67,6 @@ Get the ip of the machine. If the machine is registered at the system resolver (
The plugin class
================
The machine class can also be very essential if you write attack plugins. Those have access to the kali attack and one or more targets. And those are Machinery objects.
For a full list of methods read on:
.. autoclass:: plugins.base.machinery.MachineryPlugin

@ -2,7 +2,9 @@
Vulnerability plugins
*********************
To leave attack traces on a machine it should be vulnerable. Services should run. Old application be installed, users with weak passwords added to the system. You get the idea.
For an attack leave attack traces on a machine it should be vulnerable. Services should run. Old application be installed, users with weak passwords added to the system. You get the idea.
For you as a user to be flexible there is a vulnerability plugin type that (surprise !) adds vulnerabilities to targets.
This plugin type allows you to punch some holes into the protection of a machine. Which vulnerability plugins are loaded for a specific target is defined in the configuration file. Feel free to weaken the defenses.
@ -20,19 +22,19 @@ The boilerplate contains some basics:
* name: a unique name, also used in the config yaml file to reference this plugin
* description: A human readable description for this plugin.
* ttp: The TTP number of this kali attack. See https://attack.mitre.org/ Just as a hint which TTP this vulnerability could be related to
* references: A list of urls to blog posts or similar describing the attack
* required_files: A list. If you ship files with your plugin, listing them here will cause them to be installed on plugin init.
* ttp: The TTP number linked to this vulnerability. See https://attack.mitre.org/ as a hint which TTP this vulnerability could be related to. If you do not know the TTP, use "???"
* references: A list of urls to blog posts or similar describing the vulnerability
* required_files: If you ship files with your plugin, listing them here will cause them to be installed on plugin init.
Method: install (optional)
--------------------------
*start* installs the vulnerability on the target. *install* is called before that. If you have to setup anything in the plugin space (and not on the target) do it here.
*start* starts the vulnerability on the target. *install* is called before that. If you have to setup anything in the plugin space (and not on the target) do it here.
Method: start
-------------
Adds the vulnerability to the machine. The most important method you can use here is "self.run_cmd" and execute a shell command.
Starts the vulnerability on the machine. The most important method you can use here is "self.run_cmd" and execute a shell command.
Method: stop
------------

@ -25,10 +25,10 @@ Welcome to the Purple Dome documentation!
extending/vulnerability_plugins
extending/attack_plugins
extending/sensor_plugins
extending/attack_plugins
extending/vm_controller_plugins
extending/extending

@ -19,10 +19,20 @@ Experiment control is the core tool to run an experiment. It accepts a yaml conf
:func: create_parser
:prog: ./experiment_control.py
Testing YAML files
==================
Configuration can be a bit complex and mistakes can happen. To find them before you run Purpledome use pydantic_test.py
.. argparse::
:filename: ../pydantic_test.py
:func: create_parser
:prog: ./pydantic_test.py
Plugin manager
==============
List available plugins or a specific plugin config
List available plugins or a specific plugin config. Most importantly: You can verify your plugin using it !
.. argparse::
:filename: ../plugin_manager.py
@ -49,3 +59,10 @@ Directly control the machines
:func: create_parser
:prog: ./machine_control.py
Doc generator
=============
.. argparse::
:filename: ../doc_generator.py
:func: create_parser
:prog: ./doc_generator.py

@ -10,31 +10,31 @@ caldera:
# Attacks configuration
attackers:
###
# Configuration for the first attacker. One should normally be enough
# Configuration for the first attacker. One should normally be enough. But it is still implemented as a list
- name: attacker
###
# Defining VM controller settings for this machine
vm_controller:
###
# Type of the VM controller, Options are "vagrant"
# Type of the VM controller, Options are "vagrant" and "running_vm"
vm_type: vagrant
###
# # path where the vagrantfile is in
vagrantfilepath: systems
###
# Name of machine in Vagrantfile
# Name of machine in Vagrantfile, main way to reference this machine
vm_name: attacker
###
# Machine can have nicknames. They can be used in complex attacks to reference the machine
# Machine can have nicknames. They can be used in complex attacks to reference the machine in multiple ways
nicknames:
- "suspect 1"
###
# machinepath is a path where the machine specific files and logs are stored. Relative to the Vagrantfile path
# and will be mounted internally as /vagrant/<name>
# and will be mounted internally as /vagrant/<name> for linux machines
# If machinepath is not set PurpleDome will try "vm_name"
machinepath: attacker1
@ -50,16 +50,24 @@ attackers:
# List of targets
targets:
###
# Specific target
# Name of a specific target. It is implemented as a list, you can have several targets in your experiment
- name: target1
###
# Defining VM controller settings for this machine
vm_controller:
###
# Type of the VM controller, Options are "vagrant" and "running_vm"
vm_type: vagrant
###
# # path where the vagrantfile is in
vagrantfilepath: systems
###
# simple switch if targets is used in attack simulation. Default is true. If set to false the machine will not be started
active: no
###
# Name of machine in Vagrantfile, main way to reference this machine
vm_name: target1
###
@ -67,36 +75,54 @@ targets:
nicknames:
- "web server"
###
# OS of the VM guest. Options are so far "windows", "linux"
os: linux
###
# Targets need a unique PAW name for caldera
paw: target1
###
# Targets need to be in a group for caldera. The group is more relevant than the paw. Better put every target in a unique group
group: red
###
# machinepath is a path where the machine specific files and logs are stored. Relative to the Vagrantfile path
# and will be mounted internally as /vagrant/<name> for linux machines
# If machinepath is not set PurpleDome will try "vm_name"
machinepath: target1
# Do not destroy/create the machine: Set this to "yes".
###
# Do not destroy/create the machine: Set this to "yes". Good if you want to keep this machine around between experiments
use_existing_machine: yes
###
# The folder all the implants will be installed into
# The folder all the implants will be installed into. IN the machine
playground: /home/vagrant
# Sensors to run on this machine
###
# List of sensors to run on this machine. They are implemented as plugins and have a unique name
sensors:
# - linux_idp
- name: target2
#root: systems/target1
###
# Defining VM controller settings for this machine
vm_controller:
###
# Type of the VM controller, Options are "vagrant" and "running_vm"
vm_type: vagrant
###
# path where the vagrantfile is in
vagrantfilepath: systems
###
# simple switch if targets is used in attack simulation. Default is true. If set to false the machine will not be started
# simple switch defining if targets is used in attack simulation. Default is true. If set to false the machine will not be started
active: no
###
# Name of machine in Vagrantfile, main way to reference this machine
vm_name: target2
###
@ -105,13 +131,23 @@ targets:
- "t2"
- "practice target"
###
# OS of the VM guest. Options are so far "windows", "linux"
# This is the example for a windows machine. Windows machines are much trickier to handle in Vagrant ! Check the documentation
os: windows
###
# Targets need a unique PAW name for caldera
paw: target2w
###
# Targets need to be in a group for caldera. The group is more relevant than the paw. Better put every target in a unique group
group: red_windows
###
# machinepath is a path where the machine specific files and logs are stored. Relative to the Vagrantfile path
# and will be mounted internally as /vagrant/<name> for linux machines
# If machinepath is not set PurpleDome will try "vm_name"
machinepath: target2w
###
@ -137,6 +173,7 @@ targets:
###
# The folder all the implants will be installed into
# Windows can only use default playground at the moment !
# playground: C:\\Users\\PurpleDome
###
@ -145,7 +182,7 @@ targets:
- windows_idp
###
# Vulnerabilities to pre-install
# Vulnerabilities to pre-install. They are implemented as plugins
vulnerabilities:
- weak_user_passwords
- rdp_config_vul
@ -153,14 +190,23 @@ targets:
# Ubuntu 20.10 (Groovy)
- name: target3
###
# Defining VM controller settings for this machine
vm_controller:
###
# Type of the VM controller, Options are "vagrant" and "running_vm"
vm_type: vagrant
###
# path where the vagrantfile is in
vagrantfilepath: systems
###
# simple switch if targets is used in attack simulation. Default is true. If set to false the machine will not be started
active: yes
###
# Name of machine in Vagrantfile, main way to reference this machine
vm_name: target3
###
@ -169,15 +215,27 @@ targets:
- "red shirt"
- "the flag"
###
# OS of the VM guest. Options are so far "windows", "linux"
# This is the example for a windows machine. Windows machines are much trickier to handle in Vagrant ! Check the documentation
os: linux
###
# Targets need a unique PAW name for caldera
paw: target3
###
# Targets need to be in a group for caldera. The group is more relevant than the paw. Better put every target in a unique group
group: red
###
# machinepath is a path where the machine specific files and logs are stored. Relative to the Vagrantfile path
# and will be mounted internally as /vagrant/<name> for linux machines
# If machinepath is not set PurpleDome will try "vm_name"
machinepath: target3
###
# Do not destroy/create the machine: Set this to "yes".
use_existing_machine: no
@ -189,6 +247,8 @@ targets:
sensors:
- linux_idp
###
# Vulnerabilities to pre-install. They are implemented as plugins
vulnerabilities:
- sshd_config_vul
- weak_user_passwords

Loading…
Cancel
Save