Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
ADADCSADWSRBCDSHADOW CREDENTIALSWINDOWS

Millennium

Challenge Lab (Hard) - by Ross

The following post by 0xb0b is licensed under CC BY 4.0


Scenario

Objective

Millennium Corp recently underwent a penetration test that revealed significant exposure through SMB and LDAP based attack paths. In response, the organization rapidly implemented host-based firewall restrictions and hardened traditional network services across the environment.

Believing these mitigations to be sufficient, Millennium Corp has commissioned a follow-up internal black box penetration assessment from the HackSmarter team under an assumed breach scenario.

As the operator, you are placed inside the corporate network. Traditional lateral movement paths such as SMB and LDAP are heavily restricted or monitored, forcing you to heavily rethink conventional Active Directory enumeration and attack strategies.

Your objective is to:

  • Enumerate the environment under constrained network conditions

  • Identify alternative attack surfaces beyond SMB and LDAP

  • Escalate privileges to achieve full domain compromise and prove post compromise.

Millennium Corp believes their defenses have closed the gaps exposed in their previous assessment.

Your task is to prove otherwise.

Initial Access

Summary

Summary

In Millennium, we begin with assumed breach credentials against a hardened Domain Controller DC01.MILLENNIUM.CORP where traditional SMB and LDAP attack paths are blocked by host-based firewall rules. Initial enumeration confirms that ports 445 and 389 are filtered, rendering standard tools like BloodHound.py and NetExec ineffective. Research into alternative attack surfaces leads us to Active Directory Web Services (ADWS) on port 9389, which we leverage using Soaphound for BloodHound-compatible enumeration and SOAPy for write operations; both operating entirely outside the restricted protocols.

BloodHound reveals that Domain Users hold GenericAll over the user sully, who in turn has GenericWrite on the domain controller.

Using SOAPy, we perform a shadow credentials attack against sully via ADWS, writing to msDS-KeyCredentialLink and authenticating via PKINIT with certipy to obtain a TGT. From sully, we execute a second shadow credentials attack targeting the DC01$ machine account, retrieve its NT hash, and use S4U2self with -altservice to forge an HTTP service ticket impersonating the domain admin athena. This grants us a WinRM shell on the domain controller, from which we dump the NTDS database and extract the krbtgt hash, achieving full domain compromise despite the hardened network controls.

Recon

We use rustscan -b 500 -a 10.1.216.214 --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.

The target 10.1.216.214 is a Domain Controller, DC01.MILLENNIUM.CORP, in the MILLENNIUM.CORP 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 3268 and 3269 (Global Catalog). SMB is exposed via port 139. Remote management and access are available through RDP on port 3389 and WinRM on port 5985. The host also exposes AD Web Services on port 9389, RPC over HTTP on port 593, and several MSRPC endpoints on ports 135, 49664–62839. The system is running Windows Server build 10.0.20348 and has an enterprise CA named MILLENNIUM-DC01-CA issuing certificates for the domain.

We update our /etc/hosts file as follows, using the information from our port scan.

Using the provided credentials, we attempt to authenticate using NetExec via LDAP and SMB. However, as described in the scenario, these are hardened, and we are unable to enumerate the machine this way.

Our standard tools, such as bloodhound-ce and rusthound-ce, are failing. Authentication via LDAP is not working.

With traditional LDAP and SMB enumeration blocked, we research for alternative approaches to Active Directory enumeration and discovered Active Directory Web Services (ADWS) on port 9389 as a viable path.

Active Directory Web Services (ADWS) is a default service on domain controllers (DCs) which allows clients an alternative method to collect information stored in LDAP using the SOAP protocol for subsequent attacks.

This led us to the Soaphound.py – Collecting Active Directory Objects over ADWS from Linux article by the creator of Soaphound.py, which details how to perform BloodHound-compatible data collection entirely over ADWS, bypassing the hardened LDAP and SMB services.

The Soaphound.py article also references the SOAPy by Logan Goins (IBM X-Force Red) article, which takes ADWS interaction further by supporting not only enumeration but also write operations such as shadow credentials and RBCD. The SpecterOps operators guide, Make Sure to Use SOAP(y), details the operational tradecraft for stealthy AD collection and post-exploitation entirely over ADWS from Linux.

The following article by SpecterOps is a highly recommended read for a deep dive since it covers the full offensive workflow from OPSEC-safe collection through BOFHound ingestion to domain compromise including the defensive perspective on detecting ADWS abuse.

BloodHound Enumeration

Using the provided credentials, we will now attempt to enumerate the domain via ADWS, using Soaphound for this purpose. We are now able to gather the information.

We import the data into Bloodhound and proceed as usual.

We can see that the domain users group has GenericAll permissions over the user sully. This would allow us to take over sully's account, for example, by changing the password.

Furthermore, we see that sully has GenericWrite permissions on the domain controller which renders the user as a high value target. This allows us to write to any non-protected attribute on the target object, opening up two different attack paths:

A Resource-Based Constrained Delegation (RBCD) attack which involves creating an attacker-controlled computer account, configuring the domain controller's msDS-AllowedToActOnBehalfOfOtherIdentity attribute to trust that account for delegation, and then using S4U2self and S4U2proxy to request a service ticket impersonating a domain admin.

A Shadow Credentials attack by writing a crafted key pair to the target’s msDS-KeyCredentialLink attribute, allowing us to authenticate as that account via PKINIT without knowing its password. With a GenericWrite on the domain controller's machine account, this yields its NT hash, which can be used for a DCSync or to forge service tickets via S4U2self. Either approach grants us the ability to impersonate a privileged user and take full control of the domain controller.

We identify the user athena as the domain administrator and administrator.

Access as sully

We follow the attack path identified by Bloodhound and begin by taking over the user sully by attempting to change the user's password. Our standard tools fail because they use LDAP and do not support ADWS.

Referring back to the SpecterOps operators guide, we chose to use SOAPy over bloodyAD for our operations. Since bloodyAD relies on LDAP to modify attributes, it fails in this hardened environment where ports 389 and 445 are blocked.

We get the tool from the following resource and can be installed as follows.

The big advantage over SOAPHound: SOAPy can also do write operations over ADWS, like shadow credentials attacks, Therefore, we are deviating from our original approach to changing the password and are instead carrying out a shadow credential attack directly.

However, changing the password remains an option; we could have done this via the Kerberos protocol using impackets' changepasswd.py. https://github.com/fortra/impacket/blob/master/examples/changepasswd.py

We perform the shadow credentials attack using SOAPy, writing a key pair to sully's msDS-KeyCredentialLink attribute over ADWS. This returns a PFX certificate file and its associated password.

Using the retrieved PFX file, we authenticate as sully via PKINIT with certipy, which returns a Kerberos TGT saved as a ccache file along with sully's NT hash:

We set the KRB5CCNAME environment variable to point to sully's TGT, enabling Kerberos authentication. To verify our access, we query the domain's user objects over ADWS using SOAPy with Kerberos authentication.

Recalling our BloodHound path we either can perfrom a RBCD attack or Shadow Credentials Attack.

The RBCD attack over SOAPy failed on my end, as the getST.py impersonation step errored with KDC_ERR_ETYPE_NOSUPP.

Shell as Athena via Shadow Credentials Attack

We set the KRB5CCNAME environment variable to point to sully's TGT, enabling Kerberos authentication if not already applied. We then perform the shadow credentials attack using SOAPy, writing a key pair to DC01$'s msDS-KeyCredentialLink attribute over ADWS. This returns a PFX certificate file and its associated password.

Using the retrieved PFX file, we authenticate as DC01$ via PKINIT with certipy, which returns a Kerberos TGT saved as a ccache file along with DC01$'s NT hash:

We set the KRB5CCNAME environment variable to point to DC01$'s TGT, enabling Kerberos authentication

Using DC01$'s TGT, we perform an S4U2self request to obtain a service ticket impersonating athena. The -self flag instructs getST.py to only perform S4U2self without S4U2proxy, which allows the domain controller's machine account to request a ticket on behalf of any user to itself. The -altservice HTTP/DC01.MILLENNIUM.CORP flag rewrites the service name in the resulting ticket to HTTP/, which is the SPN that WinRM on port 5985 thatrequires for Kerberos authentication. Without this flag, the ticket would be issued for the machine account’s default SPN DC01$, which WinRM would reject.

We then point KRB5CCNAME to the resulting ticket and connect via evil-winrm using Kerberos authentication, landing a shell as athena, a Domain Admin:

Now we want to get the hash of krbtgt. To do this, we'll dump the ntds.dit and system hives and perform a secretsdump offline. Normally, we could just do this using netexec, but the services are blocked. We follow the instructions from the hackers recipes using the built-in maintenance tool NTDSUtil. This dumps the necessary hives and the ntds.dit.

We downoload the ntds.dit.

We had trouble downloading the resulting system hive from NTDSUtil, so we're saving it again manually.

We then perform an offline secrets dump and are able to retrieve the nt hash of krbtgt.

To speed things up we can modify the firewall to allow SMB traffic to perform a remote NTDS dump via NetExec to extract the krbtgt hash.

We do so as follows and are able tor retrieve the nt hash of krbtgt using Netexec.

Last updated