Agent: Inject credentials store to Automated Master

Intercept credentials and update the credentials store using
credentials intercepting telemetry messenger
This commit is contained in:
Ilija Lazoroski 2022-03-28 21:14:46 +02:00
parent 4de90584c9
commit d434c20bcb
2 changed files with 20 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import threading
import time
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
from infection_monkey.credential_store import ICredentialsStore
from infection_monkey.i_control_channel import IControlChannel, IslandCommunicationError
from infection_monkey.i_master import IMaster
from infection_monkey.i_puppet import IPuppet
@ -36,6 +37,7 @@ class AutomatedMaster(IMaster):
victim_host_factory: VictimHostFactory,
control_channel: IControlChannel,
local_network_interfaces: List[NetworkInterface],
credentials_store: ICredentialsStore,
):
self._current_depth = current_depth
self._puppet = puppet
@ -43,9 +45,8 @@ class AutomatedMaster(IMaster):
self._control_channel = control_channel
ip_scanner = IPScanner(self._puppet, NUM_SCAN_THREADS)
exploiter = Exploiter(
self._puppet, NUM_EXPLOIT_THREADS, self._control_channel.get_credentials_for_propagation
)
exploiter = Exploiter(self._puppet, NUM_EXPLOIT_THREADS, credentials_store.get_credentials)
self._propagator = Propagator(
self._telemetry_messenger,
ip_scanner,

View File

@ -15,6 +15,7 @@ from infection_monkey.credential_collectors import (
MimikatzCredentialCollector,
SSHCredentialCollector,
)
from infection_monkey.credential_store import AggregatingCredentialsStore
from infection_monkey.exploit import CachingAgentRepository, ExploiterWrapper
from infection_monkey.exploit.hadoop import HadoopExploiter
from infection_monkey.exploit.log4shell import Log4ShellExploiter
@ -54,6 +55,9 @@ from infection_monkey.puppet.puppet import Puppet
from infection_monkey.system_singleton import SystemSingleton
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
from infection_monkey.telemetry.attack.t1107_telem import T1107Telem
from infection_monkey.telemetry.messengers.credentials_intercepting_telemetry_messenger import (
CredentialsInterceptingTelemetryMessenger,
)
from infection_monkey.telemetry.messengers.exploit_intercepting_telemetry_messenger import (
ExploitInterceptingTelemetryMessenger,
)
@ -183,14 +187,25 @@ class InfectionMonkey:
telemetry_messenger = ExploitInterceptingTelemetryMessenger(
self.telemetry_messenger, self._monkey_inbound_tunnel
)
control_channel = ControlChannel(self._default_server, GUID)
credentials_store = AggregatingCredentialsStore(control_channel)
telemetry_messenger = CredentialsInterceptingTelemetryMessenger(
ExploitInterceptingTelemetryMessenger(
self.telemetry_messenger, self._monkey_inbound_tunnel
),
credentials_store,
)
self._master = AutomatedMaster(
self._current_depth,
puppet,
telemetry_messenger,
victim_host_factory,
ControlChannel(self._default_server, GUID),
control_channel,
local_network_interfaces,
credentials_store,
)
@staticmethod