Orion Corp
Challenge Lab (Easy) - by 2ubZ3r0
The following post by 0xb0b is licensed under CC BY 4.0
Scenario
Objective
Orion Corp has hired you to perform an internal penetration test against two machines within their network. Your task is to identify all vulnerabilities and (if possible) elevate your privileges to Domain Admin.
Initial Access
The client has provided you with VPN access to their network, but no credentials.
Summary
Recon
In the Orion Corp scenario, we have two machines in our scope. First, we run an Nmap scan on both machines and then attempt to enumerate the exposed services we find.
Domain Controller
We use rustscan -b 500 -a 10.0.0.5 --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.0.0.5 is a Domain Controller, DC01.orion.local, in the orion.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 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–49725. The system is running Windows build 10.0.26100 and has an enterprise CA named orion-DC01-CA issuing certificates for the domain.

We try to authenticate as guest against SMB, but without success. We see some name resolution errors. Nevertheless we will generate a hosts file entry with the following command.

We add the following entry to our /etc/hosts file.
As a precaution, we generate a krb5.conf configuration file to ensure our attacking machine can properly resolve the orion.local realm to its Key Distribution Center DC01.orion.local, which is required for any subsequent Kerberos-based authentication and attacks against the domain. After adding the /etc/hosts entry we do net receive the name resolution error anymore, but still cannot authenticate... we get a timeout.

IT Workstation
Let's continue with the workstation.
We use rustscan -b 500 -a 10.0.0.6 --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.0.0.6 is a domain-joined Windows workstation, WS-IT.orion.local, member of the orion.local domain. 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 port 5985. The host also exposes MSRPC on ports 135, 49668, and 49678.

Here, too, we use NetExec to generate the /etc/hosts entry via the exposed SMB service. Here, too, we get a name resolution error.

We add the following entry to our /etc/hosts file.
Access as b.williams
Now that we've added the host's FQDN to the /etc/hosts file, we can authenticate as a guest to access the SMB share on the workstation. We can see that we have read and write permissions on the Uploads in share. We could use the write permissions, if possible, for an NTLM theft attack.

But first, we conntect to the share using smbclient.py. We do find a README.txt...

... this gives us a hint that the files are collected and processed daily...

So it might actually enable us to perform an NTLM theft attack through coercing. This is a technique where Windows is forced to authenticate to them using NTLM, allowing us to capture or relay the victim's NTLM credentials.
We can coerce for example via a .lnk file by placing a malicious shortcut in a writable share. When a user or service browses the folder, the .lnk file references a remote UNC path (e.g. \\attacker\share), causing Windows to automatically attempt NTLM authentication to that remote host, leaking the NTLM hash without any user interaction.

We start responder...

... and perform the attack using NetExec's module called slinky. This creates a windows shortcut with the icon attribute containing a URI to the specified server share.

We inspect the options of the Slinky module.

Now we use the slinky module in NetExec to plant a malicious .lnk shortcut named ticket-0a137 on the Uploads share of WS-IT.orion.local, which, when a user browses the share, automatically triggers an SMB connection back to our attacker machine 192.168.211.2 to capture their NTLMv2 authentication hash.

After a short delay we receive the NTLMv2-SSP hash of the user b.williams.

We try to crack the hash using hashcat with rockyou.txt and are able to retrieve the password of the user.

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

BloodHound Enumeration
With the credentials, we'll enumerate the domain using BloodHound.

We see that the user initially does not have any special permissions to escalate our privileges or move laterally.

We identify the Administrator account as the only Domain Admin account.

We are looking for Kerberoastable users and see that the SVC onboarding is misconfigured in this regard.

Access as svc-onboarding
Before we try to perfrom the Kerberoasting, we'll list the shares and identify that we have read access to the Company share. We get all the documents, but do not find any further useful information in them.

We perform a Kerberoasting attack using the b.williams credentials and successfully retrieved the Kerberos 5, etype 23, TGS-REP blob for the service account svc-onboarding using nxc ldap.

We use hashcat to crack the blob and are able to retrieve the password of svc-onboarding account.

We test the credentials of svc-onboarding using NetExec, we are able to authenticate. But we do not find any new shares.

We'll take a closer look at the user in Bloodhound and see that this user can change the password for three users using the ForceChangePassword permission. We may be able to escalate further from here. We mark the user as owned.

Based on the query shortest path from owned object, we determine that we may be able to take over the m.white account via GenericWrite (through a targeted Kerberos attack or shadow credential attack) through s.mitchell, who is a member of the helpdeksops-tier2. We can, in turn, compromise m.white using ForceChangePassword. Since m.white is a member of the WS-IT-RemoteAccess group, this may enable us to establish a remote session on the target machine.

Access as s.mitchell
First, we'll change s.mitchell's password.

We are now able to authenticate as s.mitchell.

Shell as m.white
We'll start with the TargetedKerberoast. See below links for further reading:
This abuse can be carried out when controlling an object that has a
GenericAll,GenericWrite,WritePropertyorValidated-SPNover the target. A member of the Account Operator group usually has those permissions.The attacker can add an SPN (
ServicePrincipalName) to that account. Once the account has an SPN, it becomes vulnerable to Kerberoasting. This technique is called Targeted Kerberoasting.
To perform the TargetedKerberoast we will use the following tool:
We run the following command, but our first attempt fails. A stronger authentication is required.

We retry using LDAPS, but the returned TGS blob is encrypted with AES (etype 18), which we are unable to crack.

We give it another try with a shadow credentials attack.
Further information on the Shadow Credentials Attack can be found under the following link:
The Kerberos authentication protocol works with tickets in order to grant access. An ST (Service Ticket) can be obtained by presenting a TGT (Ticket Granting Ticket). That prior TGT can only be obtained by validating a first step named "pre-authentication" (except if that requirement is explicitly removed for some accounts, making them vulnerable to ASREProast). The pre-authentication can be validated symmetrically (with a DES, RC4, AES128 or AES256 key) or asymmetrically (with certificates). The asymmetrical way of pre-authenticating is called PKINIT.
The client has a public-private key pair, and encrypts the pre-authentication data with their private key, and the KDC decrypts it with the client’s public key. The KDC also has a public-private key pair, allowing for the exchange of a session key.
Active Directory user and computer objects have an attribute called
msDS-KeyCredentialLinkwhere raw public keys can be set. When trying to pre-authenticate with PKINIT, the KDC will check that the authenticating user has knowledge of the matching private key, and a TGT will be sent if there is a match.There are multiple scenarios where an attacker can have control over an account that has the ability to edit the
msDS-KeyCredentialLink(a.k.a. "kcl") attribute of other objects (e.g. member of a special group, has powerful ACEs, etc.). This allows attackers to create a key pair, append to raw public key in the attribute, and obtain persistent and stealthy access to the target object (can be a user or a computer).
To perform the Shadow Credentials Attack we are using Certipy.
In short: If we can write to the msDS-KeyCredentialLink property of a user, we can retrieve the NT hash of that user.
With the following command we issue the attack and are succesful. We retrieve the NT hash of m.white.

We test the credentials using NetExec. We successfully authenticated.

Next, we try to get a remote session on the Workstation using evil-winrm and find the users flag at C:\Users\m.white\Desktop\user.txt.

Access as m.reeves
While enumerating the workstation, we find plaintext credentials in the PowerShell history file.

We test the credentials using NetExec agains the DC and are able to authentice.

We review the user in our BloodHound data and see that the user is member of the ws-it-admins and ws-it-remoteaccess group.

Access as svc-pki
We test the credentials again (but this time against the workstation) and see that we have indeed admin privileges. Furthermore we identify that we are now have read access to the IT share.

We connect to the share using smbvlient.py and get every file.

In the Publish-CRL.ps1 script from the Scripts folder we find credentials of the svc-pki account.

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

Next, we review the user in our BloodHound data and see that the user is member of the certificate enrollees. Time to enumerate the ADCS.

Shell as Administrator
We enumerate Active Directory Certificate Services (ADCS) using certipy to list all available certificate templates.

We also filter for vulnerable ones using the -vulnerable flag to identify any misconfigurations that could be exploited for privilege escalation.

There are some remarks about ESC2 and ESC3 on the User template (from the all query), but we ignore them for now.
The resulsts of the vulnerable enumeration reveals that the OrionAuth template is vulnerable to ESC1.

We follow the ESC1 escalation path as documented in the Certipy wiki.
First, we add the CA hostname to our /etc/hosts file to ensure proper name resolution.
We attempt to request a certificate using the vulnerable OrionAuth template, but the initial request fails without specifying an alternative UPN.

We retry the request with the -upn flag set to administrator@orion.local and the corresponding SID, abusing the enrollee-supplied subject name misconfiguration to request a certificate on behalf of the domain administrator. We get the sid from the BloodHound data.

Using the obtained administrator.pfx certificate, we authenticate against the domain controller to retrieve the administrator’s NTLM hash via PKINIT.

Finally, we use the recovered NTLM hash to establish a remote session on the domain controller via evil-winrm, ...

... and are able to retrieve the final flag at C:\Users\Administrator\Desktop\root.txt.

Last updated