{"id":395,"date":"2024-03-23T20:50:20","date_gmt":"2024-03-23T20:50:20","guid":{"rendered":"https:\/\/jsec-rt.com\/?p=395"},"modified":"2024-07-08T22:53:44","modified_gmt":"2024-07-09T02:53:44","slug":"rt-bt-enumeracion-sobre-active-directory-y-explotacion-de-acls-para-escalar-privilegios-parte-2-2","status":"publish","type":"post","link":"https:\/\/jsec-rt.com\/index.php\/en\/2024\/03\/23\/rt-bt-enumeracion-sobre-active-directory-y-explotacion-de-acls-para-escalar-privilegios-parte-2-2\/","title":{"rendered":"RT\/BT \u2013 Active Directory enumeration and ACL exploitation for privilege escalation \u2013 Part 2"},"content":{"rendered":"\n<p>It&#8217;s been a while since I last posted, I&#8217;ve been busy with personal things, but I want to retake sharing things I know about Active Directory exploitation.<\/p>\n\n\n\n<p>We&#8217;ll continue adding misconfigurations to our Active Directory environment, to further explore ACL exploitation paths.<\/p>\n\n\n\n<p>We&#8217;ll add a new domain user, <strong>max.power<\/strong> in my case.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"534\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image.png\" alt=\"\" class=\"wp-image-203\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image.png 792w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-300x202.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-768x518.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/figure>\n\n\n\n<p>Additionally, I added a new host into the domain, making sure I&#8217;m using the <strong>max.power<\/strong> account for this action.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"480\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-1.png\" alt=\"\" class=\"wp-image-204\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-1.png 503w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-1-300x286.png 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/figure>\n\n\n\n<p>Since the newly created user is the one that added the new host to the domain, <strong>SOPORTE01<\/strong>, the account gets certain privileges over the machine object properties, even when it&#8217;s not a local administrator.<\/p>\n\n\n\n<p>However, since we added the host through the Windows interface, the Domain Controller assigned a random highly complex password to the machine account, which is why we&#8217;re going to assume the compromise of the <strong>max.power<\/strong> user, where we&#8217;ll add a new host through the command line, where we&#8217;ll know the password for the machine account, where we&#8217;ll exploit an RBCD attack (Resource Based Constrained Delegation) from the new computer towards <strong>SOPORTE01<\/strong> and then, from <strong>SOPORTE01<\/strong> towards <strong>TECNOLOGIA01<\/strong>.<\/p>\n\n\n\n<p>Additionally, for simplicity sake, we&#8217;ll add full control privileges to <strong>max.power<\/strong> over the <strong>SOPORTE01<\/strong> host.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">RBCD attack configuration.<\/h2>\n\n\n\n<p>We access the ADSI interface again on the DC, looking for the group <strong>Computers<\/strong>, right clicking in <strong>TECNOLOGIA01<\/strong> and accessing the <strong>properties<\/strong> option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"501\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-2.png\" alt=\"\" class=\"wp-image-206\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-2.png 847w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-2-300x177.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-2-768x454.png 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><\/figure>\n\n\n\n<p>We get the list of domain objects that have any level of privilege over this specific object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"957\" height=\"457\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-3.png\" alt=\"\" class=\"wp-image-207\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-3.png 957w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-3-300x143.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-3-768x367.png 768w\" sizes=\"auto, (max-width: 957px) 100vw, 957px\" \/><\/figure>\n\n\n\n<p>We click on <strong>add<\/strong> and we&#8217;ll see the search box seen before, however, we need to perform an extra step here, where we&#8217;ll click on <strong>Object Types<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"410\" height=\"230\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-4.png\" alt=\"\" class=\"wp-image-208\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-4.png 410w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-4-300x168.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/figure>\n\n\n\n<p>Inside the new window, we enable the <strong>Computers<\/strong> option and then click OK.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"995\" height=\"435\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-5.png\" alt=\"\" class=\"wp-image-209\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-5.png 995w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-5-300x131.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-5-768x336.png 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/figure>\n\n\n\n<p>By default, machine accounts are not considered to grant privileges, but since we modified this behavior, we can write the hostname for one of the new hosts we created <strong>SOPORTE01<\/strong> and click on <strong>Check Names<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"468\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-6.png\" alt=\"\" class=\"wp-image-210\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-6.png 993w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-6-300x141.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-6-768x362.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/figure>\n\n\n\n<p>The computer object was identified and we give it <strong>Full control <\/strong>privilege over the <strong>TECNOLOGIA01<\/strong> object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"449\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-7.png\" alt=\"\" class=\"wp-image-211\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-7.png 962w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-7-300x140.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-7-768x358.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p>We&#8217;ll add the same privileges to the <strong>max.power<\/strong> user over the <strong>SOPORTE01<\/strong> object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"421\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-9.png\" alt=\"\" class=\"wp-image-213\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-9.png 774w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-9-300x163.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-9-768x418.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Targeted Kerberoasting attack configuration.<\/h2>\n\n\n\n<p>Back in the ADSI interface, we&#8217;ll find the <strong>jsec<\/strong> user and modify it&#8217;s properties, giving it <strong>write<\/strong> privileges over the <strong>max.power<\/strong> user.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"395\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-12.png\" alt=\"\" class=\"wp-image-216\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-12.png 794w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-12-300x149.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-12-768x382.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/figure>\n\n\n\n<p>Confirming the privilege, we&#8217;re set for the targeted kerberoasting attack.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"568\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-13.png\" alt=\"\" class=\"wp-image-217\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-13.png 982w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-13-300x174.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-13-768x444.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sharphound usage from a non domain joined host<\/h2>\n\n\n\n<p>It&#8217;s possible to execute enumeration tools from within non domain joined hosts through legitimate windows binaries. This can be pretty useful during internal pentests\/red team exercises where we have a single VPN connection or access to a single ethernet port and internal hosts are well protected (Well configured antivirus, EDR, AMSI enabled, unsigned binaries cannot be executed, restricted access to CMD, Powershell, rundll, etc.)<\/p>\n\n\n\n<p>For this, we created a new windows host, <strong>EXTERNO01<\/strong>, which will not be added to the domain.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"819\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-14-1024x819.png\" alt=\"\" class=\"wp-image-218\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-14-1024x819.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-14-300x240.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-14-768x614.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-14.png 1067w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>We download Sharphound from the following link:<\/p>\n\n\n\n<p>https:\/\/github.com\/BloodHoundAD\/SharpHound\/releases\/download\/v1.1.0\/SharpHound-v1.1.0.zip<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"315\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-15-1024x315.png\" alt=\"\" class=\"wp-image-219\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-15-1024x315.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-15-300x92.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-15-768x236.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-15.png 1064w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To be able to execute the binary, we can setup the DNS servers on our windows host, pointing towards the Domain Controllers.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"388\" height=\"408\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-16.png\" alt=\"\" class=\"wp-image-220\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-16.png 388w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-16-285x300.png 285w\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" \/><\/figure>\n\n\n\n<p>We confirm the correct resolution of the <strong>jsec.local<\/strong> domain and the <strong>ATENCION01<\/strong> host.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"310\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-17-1024x310.png\" alt=\"\" class=\"wp-image-221\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-17-1024x310.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-17-300x91.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-17-768x232.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-17.png 1061w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If we try to run the binary without any parameters, we&#8217;ll get an error stating we can&#8217;t connect to LDAP because of a credential related error.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"650\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-19-1024x650.png\" alt=\"\" class=\"wp-image-223\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-19-1024x650.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-19-300x190.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-19-768x487.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-19.png 1076w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Since we&#8217;re running the command from a non domain joined windows host using a local account, the credentials used to authenticate to the domain controller are the local ones, which are not valid in the <strong>jsec.local<\/strong> domain.<\/p>\n\n\n\n<p>We can define credential objects as it was shown on the previous post to run Sharphound, but I prefer to spawn a new command line shell under a new user context, so I don&#8217;t have to reuse or create multiple credential objects to switch between users, so I use <strong>runas<\/strong> to spawn these new shells.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-20-1024x484.png\" alt=\"\" class=\"wp-image-224\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-20-1024x484.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-20-300x142.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-20-768x363.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-20.png 1062w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In this case, I use the <strong>runas<\/strong> binary to run a process as a different user, <strong>\/netonly<\/strong> indicates that the network communication will use the defined user profile, <strong>\/user<\/strong> defines the user to use and at the end you specify which process you want to run with these credentials.<\/p>\n\n\n\n<p>It&#8217;s important to note that the user password must be introduced manually, but it won&#8217;t be validated before spawning the shell, so we need to make sure we use the correct password, otherwise our commands will fail because the authentication information sent by the terminal is wrong.<\/p>\n\n\n\n<p>The new CMD window has a specific title (running as jsec.local\\max.power), indicating that all the commands we execute will use this user&#8217;s context.<\/p>\n\n\n\n<p>If we run Sharphound again from within this new console, we get a successful authentication attempt and obtain the required information.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"461\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-21-1024x461.png\" alt=\"\" class=\"wp-image-225\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-21-1024x461.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-21-300x135.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-21-768x346.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-21.png 1050w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now we can analyze the generated files through Bloodhound<\/p>\n\n\n\n<p>Using the <strong>Find shortest paths to Domain Admins<\/strong> query, we get the following result:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"441\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-22.png\" alt=\"\" class=\"wp-image-226\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-22.png 842w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-22-300x157.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-22-768x402.png 768w\" sizes=\"auto, (max-width: 842px) 100vw, 842px\" \/><\/figure>\n\n\n\n<p>Some paths were already explored, but we find two new ones<\/p>\n\n\n\n<p>The first indicates that the <strong>max.power<\/strong> user has <strong>GenericWrite<\/strong> privileges over the <strong>jsec<\/strong> user, confirming the possibility to execute a <strong>Targeted Kerberoast<\/strong> attack.<\/p>\n\n\n\n<p>The second case indicates that the <strong>SOPORTE01<\/strong> host has <strong>GenericAll<\/strong> privileges over the <strong>TECNOLOGIA01<\/strong> host, allowing for a <strong>Resource Based Constrained Delegation<\/strong> attack.<\/p>\n\n\n\n<p>However, we need to have the <strong>SOPORTE01<\/strong> host&#8217;s machine account password or NTLM hash to be able to execute the RCBD attack, so by analyzing its <strong>Explicit Object Controllers<\/strong>, we find that <strong>max.power<\/strong> has <strong>GenericAll<\/strong> privileges over the host, so if we control the <strong>max.power<\/strong> user, we can perform both attacks.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"534\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-23-1024x534.png\" alt=\"\" class=\"wp-image-227\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-23-1024x534.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-23-300x156.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-23-768x400.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-23.png 1245w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">EXPLOITATION &#8211; RBCD<\/h2>\n\n\n\n<p>Since <strong>max.power<\/strong> has complete control over the <strong>SOPORTE01<\/strong> host, we can modify the <strong>msDS-AllowedToActOnBehalfOfOtherIdentity<\/strong> property.<\/p>\n\n\n\n<p>According to Windows documentation.<\/p>\n\n\n\n<p>&#8220;This attribute is used for access checks to determine if a requester has permission to act on behalf of other identities on services running as this account.&#8221;<\/p>\n\n\n\n<p>Ref: https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/adschema\/a-msds-allowedtoactonbehalfofotheridentity<\/p>\n\n\n\n<p>For the sake of simplicity, we will define this property as the ability of a domain host to interact with it on behalf of another host, this interaction includes requesting Kerberos access tickets.<\/p>\n\n\n\n<p>So, I can modify the property of the <strong>SOPORTE01<\/strong> host, indicating that another host has the privileges to request Kerberos tickets on behalf of <strong>SOPORTE01<\/strong>.<\/p>\n\n\n\n<p>For this case, we will create a new computer in the internal domain through the command line, since by default, in a standard Active Directory installation, any registered user can add up to 10 computers to the internal domain (MS-DS-Machine-Account-Quota ownership of the users).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Exploitation through Kali Linux <\/h2>\n\n\n\n<p>Using the impacket suite, the <strong>max.power<\/strong> user can create a new domain joined computer called <strong>jsecrbcd<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"927\" height=\"71\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-24.png\" alt=\"\" class=\"wp-image-228\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-24.png 927w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-24-300x23.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-24-768x59.png 768w\" sizes=\"auto, (max-width: 927px) 100vw, 927px\" \/><\/figure>\n\n\n\n<p>Now, since <strong>max.power<\/strong> has <strong>GenericAll<\/strong> privileges over <strong>SOPORTE01<\/strong>, we&#8217;ll modify its properties indicating that our new host, <strong>jsecrbcd<\/strong>, can impersonate users through S4U2Proxy on <strong>SOPORTE01<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"176\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-25-1024x176.png\" alt=\"\" class=\"wp-image-229\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-25-1024x176.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-25-300x52.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-25-768x132.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-25.png 1052w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Because of the privileges the user has, the attack was successful, indicating that the machine account <strong>jsecrbcd$<\/strong> can be used to forge Kerberos tickets.<\/p>\n\n\n\n<p>We&#8217;ll use the machine account to forge a kerberos ticket, impersonating the <strong>Administrator<\/strong> domain user, which is why it&#8217;s important to know the machine account password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"948\" height=\"127\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-26.png\" alt=\"\" class=\"wp-image-230\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-26.png 948w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-26-300x40.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-26-768x103.png 768w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/figure>\n\n\n\n<p>We export the ticket and validate it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"112\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-27.png\" alt=\"\" class=\"wp-image-231\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-27.png 576w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-27-300x58.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p>This way, we can get a valid kerberos session as a domain admin, but only on the <strong>SOPORTE01<\/strong> host.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"984\" height=\"503\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-30.png\" alt=\"\" class=\"wp-image-234\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-30.png 984w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-30-300x153.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-30-768x393.png 768w\" sizes=\"auto, (max-width: 984px) 100vw, 984px\" \/><\/figure>\n\n\n\n<p>The first step of the exploitation chain is done, and we have the NTLM hash for the <strong>SOPORTE01<\/strong> host, so now we can exploit the second RCBD attack path on the <strong>TECNOLOGIA01 <\/strong>host and obtain domain admin privileges.<\/p>\n\n\n\n<p>To confirm that the obtained NTLM hash is valid, we successfully authenticate to the domain controller with the machine account.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"75\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-32-1024x75.png\" alt=\"\" class=\"wp-image-236\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-32-1024x75.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-32-300x22.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-32-768x56.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-32.png 1194w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Its a machine account, so it has low privileges over the domain, however, since its also considered a domain user, it can also add up to 10 hosts to the domain.<\/p>\n\n\n\n<p>We use the machine account <strong>SOPORTE01$ <\/strong>to create another machine <strong>jsecrbcd2<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"63\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-34-1024x63.png\" alt=\"\" class=\"wp-image-238\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-34-1024x63.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-34-300x19.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-34-768x47.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-34.png 1165w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>We execute the RBCD attack using the <strong>SOPORTE01$<\/strong> account towards the <strong>TECNOLOGIA01<\/strong> host since the first has write privileges over the second.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"173\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-35-1024x173.png\" alt=\"\" class=\"wp-image-239\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-35-1024x173.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-35-300x51.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-35-768x129.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-35.png 1080w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The delegation permissions were added correctly, so the newly created machine account <strong>jsecrbcd2<\/strong> can now impersonate users on the <strong>TECNOLOGIA01<\/strong> host.<\/p>\n\n\n\n<p>We forge the kerberos ticket impersonating the domain administrator on the <strong>TECNOLOGIA01<\/strong> host.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"303\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-36.png\" alt=\"\" class=\"wp-image-240\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-36.png 977w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-36-300x93.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-36-768x238.png 768w\" sizes=\"auto, (max-width: 977px) 100vw, 977px\" \/><\/figure>\n\n\n\n<p>The ticket is valid and we get administrative privileges over the <strong>TECNOLOGIA01<\/strong> host.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"567\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-38.png\" alt=\"\" class=\"wp-image-242\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-38.png 717w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-38-300x237.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/figure>\n\n\n\n<p>This way, we obtain the NTLM hash for the machine account that belongs to the Domain Admins group, giving us control over the internal domain.<\/p>\n\n\n\n<p>We can use the NTLM hash to DCSYNC using the machine account <strong>TECNOLOGIA01$<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"700\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-39.png\" alt=\"\" class=\"wp-image-243\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-39.png 972w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-39-300x216.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-39-768x553.png 768w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">TARGETED KERBEROASTING EXPLOITATION PATH.<\/h2>\n\n\n\n<p>The exploitation path is the following one.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"831\" height=\"90\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-40.png\" alt=\"\" class=\"wp-image-244\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-40.png 831w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-40-300x32.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-40-768x83.png 768w\" sizes=\"auto, (max-width: 831px) 100vw, 831px\" \/><\/figure>\n\n\n\n<p>Since we assumed the <strong>max.power<\/strong> user compromise, we can use it to create an SPN ticket for the <strong>jsec<\/strong> user and try to crack its password.<\/p>\n\n\n\n<p>We can use a python script that automates the whole procedure called <strong>targetedkerberoast.py<br><\/strong>https:\/\/github.com\/ShutdownRepo\/targetedKerberoast<\/p>\n\n\n\n<p>The success of the attack depends on the password set for the <strong>jsec<\/strong> user<strong>.<\/strong><\/p>\n\n\n\n<p>Once we execute the tool, we can see in the verbosity messages that the SPN ticket was added successfully and the respective hash, after it prints it, the ticket is automatically deleted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"423\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-42.png\" alt=\"\" class=\"wp-image-246\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-42.png 748w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-42-300x170.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/figure>\n\n\n\n<p>Since the password is pretty common, we get the credential almost immediately.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"501\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45-1024x501.png\" alt=\"\" class=\"wp-image-249\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45-1024x501.png 1024w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45-300x147.png 300w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45-768x376.png 768w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45-1536x751.png 1536w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-45.png 1907w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Validating the credential on the domain controller, we confirm the administrative access.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"126\" src=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-46.png\" alt=\"\" class=\"wp-image-250\" srcset=\"https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-46.png 750w, https:\/\/jsec-rt.com\/wp-content\/uploads\/2022\/09\/image-46-300x50.png 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p>Although this type of attacks are not so common in real environments, there are very specific cases where they can be viable, I recently had two projects in which it was possible to exploit these points to access certain servers considered critical, an important point to consider is that the security configuration of a domain becomes of equal importance to the security patches installed and controls implemented.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a while since I last posted, I&#8217;ve been busy with personal things, but I want to retake sharing things I know about Active Directory exploitation. We&#8217;ll continue adding misconfigurations to our Active Directory environment, to further explore ACL exploitation paths. We&#8217;ll add a new domain user, max.power in <a href=\"https:\/\/jsec-rt.com\/index.php\/en\/2024\/03\/23\/rt-bt-enumeracion-sobre-active-directory-y-explotacion-de-acls-para-escalar-privilegios-parte-2-2\/\" class=\"btn-link\">Continue Reading<i class=\"ion-ios-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,22],"tags":[],"class_list":["post-395","post","type-post","status-publish","format-standard","hentry","category-bt-en","category-p-rt-en"],"_links":{"self":[{"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/posts\/395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/comments?post=395"}],"version-history":[{"count":1,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/posts\/395\/revisions"}],"predecessor-version":[{"id":425,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/posts\/395\/revisions\/425"}],"wp:attachment":[{"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/media?parent=395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/categories?post=395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jsec-rt.com\/index.php\/wp-json\/wp\/v2\/tags?post=395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}