Skip to content

Commit d9bc764

Browse files
authored
Merge pull request #263 from stratosphereips/add-mlflow-utilis
Add-mlflow-utilis
2 parents 4cc44c0 + 71d331e commit d9bc764

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,4 @@ figures/*
157157
*trajectories*.json
158158
.vscode/settings.json
159159
trajectories/*
160+
*.tar.gz

NetSecGameAgents

Submodule NetSecGameAgents updated 70 files

README.md

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,88 @@ The [scenarios](#definition-of-the-network-topology) define the **topology** of
6565
The defender does have the action to block an IP address in a target host.
6666

6767

68-
> [!NOTE]
69-
> The global defender, available in the previous environment versions, will not be supported in the future. To enable backward compatibility, the global defender functionality can be enabled by adding `use_global_defender: True` to the configuration YAML file in the `env` section. This option is disabled by default.
70-
7168
The actions are:
7269
- BlockIP(). That takes as parameters:
7370
- "target_host": IP object where the block will be applied.
7471
- "source_host": IP object from which this action is executed.
7572
- "blocked_host": IP object to block in ANY direction as seen in the target_host.
7673

74+
> [!NOTE]
75+
> The global defender, available in the previous environment versions, will not be supported in the future. To enable backward compatibility, the global defender functionality can be enabled by adding `use_global_defender: True` to the configuration YAML file in the `env` section. This option is disabled by default.
76+
77+
78+
#### How the global defender detects
79+
80+
The global defender is implemented as a stochastic detection, which means the detection is probabilistic.
81+
82+
First, all the actions are analyzed in time windows (TW) (default is 5 actions). So the last 5 actions are analyzed together. Every new action moves the slides the TW by one position.
83+
84+
85+
##### Detection Thresholds
86+
87+
- Detection Probabilities
88+
89+
Each action type has a predefined probability of being detected. However, detection does not happen for every action; it depends on additional behavioral patterns.
90+
91+
- ScanNetwork: 0.05,
92+
- FindServices: 0.075,
93+
- ExploitService: 0.1,
94+
- FindData: 0.025,
95+
- ExfiltrateData: 0.025,
96+
- BlockIP: 0.01
97+
98+
This means that one action of the type ScanNetwork has a 5% probability of being detected by the defender.
99+
This way we can define some basic probabilities based on how good we want the defender to be.
100+
101+
- Type Ratio Threshold
102+
103+
The Type Ratio Threshold defines how frequently an action must appear in the time window to be considered for detection. If the ratio is below this threshold, no detection occurs.
104+
105+
For example, if the last action is ScanNetwork in a TW with [ScanNetwork, FindService, ScanNetwork, FindData, ScanNetwork], the ratio is 3/5 = 0.6
106+
107+
The default values of the thresholds are:
108+
109+
- ScanNetwork: 0.25,
110+
- FindServices: 0.3,
111+
- ExploitService: 0.25,
112+
- FindData: 0.5,
113+
- ExfiltrateData: 0.25,
114+
- BlockIP: 1
115+
116+
- Consecutive Actions Threshold
117+
118+
The Consecutive Actions Threshold determines the maximum number of consecutive occurrences of an action type within the time window before detection is triggered.
119+
120+
The default values of the thresholds are:
121+
122+
- ScanNetwork: 2,
123+
- FindServices: 3,
124+
- ExfiltrateData: 2
125+
126+
- Repeated Action Threshold
127+
128+
The Repeated Action Threshold applies to certain action types and defines the number of times a specific action must appear in the __entire episode__ before it can be considered for detection.
129+
130+
The default values are:
131+
132+
- ExploitService: 2
133+
- FindData: 2
134+
135+
136+
##### Decision Logic
137+
138+
The system monitors actions and maintains a history of recent ones within the time window.
139+
140+
- If an action's Type Ratio Threshold is met within the time window or it exceeds the Consecutive Actions Threshold, it is evaluated for detection.
141+
142+
- If the action type has a Repeated Action Threshold and has not been repeated enough times in the episode, it is ignored.
143+
144+
- If an action meets the conditions above, it is subject to detection based on its predefined probability.
145+
146+
- Actions that do not meet any threshold conditions are ignored, ensuring that occasional activity does not lead to unnecessary detections.
147+
148+
This approach ensures that only repeated or excessive behavior is flagged, reducing false positives while maintaining a realistic monitoring system.
149+
77150

78151
### Starting the game
79152
The environment should be created before starting the agents. The properties of the environment can be defined in a YAML file. The game server can be started by running:

0 commit comments

Comments
 (0)