From 43d38d90e048d8e4f03577152a47bb3d75492b16 Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Wed, 13 Apr 2022 14:21:23 +0000 Subject: [PATCH] BB: Extract powershell cred re-use into a separate test Credential re-use only applies to windows island, that's why it's separate --- .../blackbox/config_templates/grouped/depth_1_a.py | 3 --- envs/monkey_zoo/blackbox/test_blackbox.py | 12 ++++++++++++ .../blackbox/utils/config_generation_script.py | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py b/envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py index 842e33a2d..b09123566 100644 --- a/envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py +++ b/envs/monkey_zoo/blackbox/config_templates/grouped/depth_1_a.py @@ -11,7 +11,6 @@ class Depth1A(ConfigTemplate): # Log4shell (10.2.3.55, 10.2.3.56, 10.2.3.49, 10.2.3.50, 10.2.3.51, 10.2.3.52) # MSSQL (10.2.2.16) # SMB mimikatz password stealing and brute force (10.2.2.14 and 10.2.2.15) - # Powershell credential reuse (powershell login with empty password) (10.2.3.46) config_values.update( { "basic.exploiters.exploiter_classes": [ @@ -20,7 +19,6 @@ class Depth1A(ConfigTemplate): "MSSQLExploiter", "SmbExploiter", "SSHExploiter", - "PowerShellExploiter", ], "basic_network.scope.subnet_scan_list": [ "10.2.2.2", @@ -34,7 +32,6 @@ class Depth1A(ConfigTemplate): "10.2.2.16", "10.2.2.14", "10.2.2.15", - "10.2.3.46", ], "basic.credentials.exploit_password_list": ["Ivrrw5zEzs", "Xk8VDTsC"], "basic.credentials.exploit_user_list": ["m0nk3y"], diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index fcf723c8e..c90c15597 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -11,6 +11,9 @@ from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemp from envs.monkey_zoo.blackbox.config_templates.grouped.depth_1_a import Depth1A from envs.monkey_zoo.blackbox.config_templates.grouped.depth_2_a import Depth2A from envs.monkey_zoo.blackbox.config_templates.grouped.depth_3_a import Depth3A +from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( + PowerShellCredentialsReuse, +) from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_pth import SmbPth from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_mimikatz import WmiMimikatz from envs.monkey_zoo.blackbox.config_templates.single_tests.zerologon import Zerologon @@ -116,6 +119,15 @@ class TestMonkeyBlackbox: def test_depth_3_a(self, island_client): TestMonkeyBlackbox.run_exploitation_test(island_client, Depth3A, "Depth4A test suite") + # Not grouped because can only be ran on windows + @pytest.mark.skip_powershell_reuse + def test_powershell_exploiter_credentials_reuse(self, island_client): + TestMonkeyBlackbox.run_exploitation_test( + island_client, + PowerShellCredentialsReuse, + "PowerShell_Remoting_exploiter_credentials_reuse", + ) + # Not grouped because it's slow def test_zerologon_exploiter(self, island_client): test_name = "Zerologon_exploiter" diff --git a/envs/monkey_zoo/blackbox/utils/config_generation_script.py b/envs/monkey_zoo/blackbox/utils/config_generation_script.py index 2d799b275..3a5f06c50 100644 --- a/envs/monkey_zoo/blackbox/utils/config_generation_script.py +++ b/envs/monkey_zoo/blackbox/utils/config_generation_script.py @@ -6,6 +6,9 @@ from envs.monkey_zoo.blackbox.config_templates.config_template import ConfigTemp from envs.monkey_zoo.blackbox.config_templates.grouped.depth_1_a import Depth1A from envs.monkey_zoo.blackbox.config_templates.grouped.depth_2_a import Depth2A from envs.monkey_zoo.blackbox.config_templates.grouped.depth_3_a import Depth3A +from envs.monkey_zoo.blackbox.config_templates.single_tests.powershell_credentials_reuse import ( + PowerShellCredentialsReuse, +) from envs.monkey_zoo.blackbox.config_templates.single_tests.smb_pth import SmbPth from envs.monkey_zoo.blackbox.config_templates.single_tests.wmi_mimikatz import WmiMimikatz from envs.monkey_zoo.blackbox.config_templates.single_tests.zerologon import Zerologon @@ -25,8 +28,15 @@ parser.add_argument( args = parser.parse_args() island_client = MonkeyIslandClient(args.island_ip) - -CONFIG_TEMPLATES = [Depth1A, Depth2A, Depth3A, Zerologon, SmbPth, WmiMimikatz] +CONFIG_TEMPLATES = [ + Depth1A, + Depth2A, + Depth3A, + Zerologon, + SmbPth, + WmiMimikatz, + PowerShellCredentialsReuse, +] def generate_templates():