<?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 Gorkem Karadeniz on Medium]]></title>
        <description><![CDATA[Stories by Gorkem Karadeniz on Medium]]></description>
        <link>https://medium.com/@gorkemkaradeniz?source=rss-65ec247db1aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i8r5znMYnIywW2jhDlBimw.jpeg</url>
            <title>Stories by Gorkem Karadeniz on Medium</title>
            <link>https://medium.com/@gorkemkaradeniz?source=rss-65ec247db1aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 03:39:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gorkemkaradeniz/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[Out of Band NTLM Relay Using Outlook CVE-2023–23397 Vulnerability]]></title>
            <link>https://gorkemkaradeniz.medium.com/out-of-band-ntlm-relay-using-outlook-cve-2023-23397-ba09a6516c9e?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba09a6516c9e</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[zero-day-vulnerability]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[red-teaming]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Tue, 04 Apr 2023 21:22:04 GMT</pubDate>
            <atom:updated>2023-04-06T10:23:02.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00nOMu3fYrQZfu_saL29iw.png" /></figure><p><em>In this article we will be focusing on an out-of-band lateral movement attack chain with the help of recent Outlook vulnerability CVE-2023–23397</em></p><h3><strong>What is the vulnerability ?</strong></h3><p>Briefly, on March 14th Microsoft has released a patch for a vulnerability in Outlook that allows an attacker to trigger NTLM authentication towards an untrusted system. While Microsoft has not disclosed the details on exploiting the vulnerability, they have initially provided an auditing script to check for mail items that could take advantage of the issue. MDsec team inspected the the script and discussed their findings in a blog post. The released script was checking for the <em>PidLidReminderFileParameter </em>property that controls the notification sound file name that the Outlook client plays a reminder. This property was able to receive a filename that is a UNC path to trigger NTLM authentication. It was detected that when this property is used together with the <em>PidLidReminderOverride </em>property, an attacker can send a crafted email item and cause Outlook to parse a malicious UNC path inside <em>PidLidReminderFileParameter, </em>triggering NTLM authentication towards the given system.</p><h3>Brief Background on NTLM Relay</h3><p>Before getting into the discussion of how this vulnerability could be extended further for lateral movement, let’s talk about NTLM relay and what can be relayed where for a second.</p><p>It is a common knowledge that after Microsoft had patched MS08–68, It was not possible to relay NTLM authentication back to the source machine anymore. However, as long as SMB signing is not enforced it is still practically possible to relay the NTLM authentication for one SMB server to a different server:<br>✔️ <strong>Victim → (Attacker Controlled)-SMB → (Target)-SMB,</strong></p><p>As for the cross protocol NTLM relay, mainly the NetNTLMv2 authentication on different protocols with their default settings can be successfully relayed to SMB. Some examples are shared below:<br>✔️ <strong>Victim → (Attacker Controlled)-HTTP → (Target)-SMB, </strong><br>✔️ <strong>Victim → (Attacker Controlled)-SMTP → (Target)-SMB,</strong><br>✔️ <strong>Victim → (Attacker Controlled)-IMAP → (Target)-SMB,</strong><br>✔️ <strong>Victim → (Attacker Controlled)-POP3 → (Target)-SMB</strong></p><h3>Lateral movement you said ?..</h3><p>This vulnerability, when combined with a foothold in a target environment can increase chances of successful lateral movement drastically. For large enterprise environments that consist of thousands of endpoints, it is always a possibility that attackers achieve command execution on an edge system. These edge systems may not always hold high privilege users or credentials that can help the attacker advance in the target network and the target systems may not contain any vulnerabilities for the attacker to abuse from their initial foothold. By abusing this vulnerability, the attacker may have the ability to relay NTLM authentication of specifically chosen users through its own C2 channel to other target systems in the network. The below graph can summarise the generic traffic flow in this attack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*JzUOsO3UV10QJBOkk6v08w.png" /><figcaption>Outlook CVE-2023–23397 Vulnerability based out of band NTLM Relay Attack Flow</figcaption></figure><p>The proof of concept videos I have come across in the last few weeks were showing the Outlook triggered NTLM authentication over SMB protocol. In secure enterprise environments it is not very practical to expect endpoint systems to make outbound SMB traffic (Port 445) towards the internet. There is a higher chance that such egress traffic attempts from endpoints would directly be blocked at the perimeter firewalls. <strong>However,</strong> <strong>this vulnerability also allows the attacker to feed a WebDAV address for Victim outlook to attempt connection. As WebDAVtraffic will go through HTTP (80) and HTTPS (443) protocols, there is much higher chance that such traffic could be allowed egress through the perimeter. </strong>Of course nowadays, in many enterprise environments the endpoints cannot directly communicate with the internet and use of a Web proxy has become a standard. <strong>As the WebDAV communication started by Outlook application is also proxy aware, the attack flow may still continue unbroken through the endpoint assigned Web Proxy server.</strong></p><h3><strong>Let’s talk about feasibility and practicality:</strong></h3><p><strong>As good as this sounds, there is a caveat:</strong> In my tests I have seen that <strong>for victim system to attempt access via WebDAV protocol, it needs to have the WebClient service in running state</strong>. It is important to note that WebClient service is <strong>by default enabled but not running</strong> after boot. However, all is not lost for the attackers because <strong>many regular activities that enterprise users do on a Windows system </strong><em>(an example would be mapping of a network drive or as simple as typing a random word to the explorer address bar) </em><strong>can trigger start of this service in the background.</strong>This is demonstrated in the recording below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGb7VDs3pgQTBOs0y3R7SQ.gif" /><figcaption>Triggering WebClient Service by typing a word on explorer address bar</figcaption></figure><p>Keeping in mind that most users do not shutdown their computers at all during the business week, there is a pretty good chance that at the time of such attack, the WebClient service could already be running on the targeted endpoint.</p><h3><strong>Demo time…</strong></h3><p>For demonstration purposes, I have provisioned a lab environment in which the attacker has already had a foothold within the target network on a system called BETADKTP05. Attacker’s beacon is active on BETADKTP05 and it is beaconing back to the C2 server <strong><em>“attacker.wan”</em></strong> over HTTPS. In our scenario, the attacker aims to use the credential of <strong><em>testuser01</em></strong> who is actively using his Outlook on BETADKTP01 to achieve command execution on the server BETASRV01. t<strong><em>estuser01 </em></strong>has administrator privileges on the system BETASRV01.</p><p>In the below recording you can see the initial step of the attack where once <strong><em>testuser01 </em></strong>receives the malicious email with attacker controlled UNC WebDAV path, the Outlook of <strong><em>testuser01 </em></strong>on BETADKTP01 automatically communicates with the company proxy server and the proxy server proxies this traffic to the attacker controlled WebDAV server on <strong><em>“attacker.wan”</em></strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdF8EXYCtmXBmDE6PKaW4g.gif" /><figcaption>Outlook WebDAV connection taffic passing through Web Proxy</figcaption></figure><p>The WebDAV traffic coming from victim Outlook goes through the web proxy without an issue, we can continue building the attack chain. Instead of a dummy WebDAV server, we (as the attacker) plan on setting up <strong><em>ntlmrelayx</em></strong>, configuring socks proxy and forwarding the relayed NTLM authentication traffic to BETASRV01 through our beacon C2 communication on BETADKTP05. <strong>When we try to force NTLM authentication for this WebDAV communication however, we quickly discover that even though the victim system reaches out to the WebDAV server, it still does not attempt NTLM authentication, thus not allowing the attacker to capture or relay NTLM challenge response.</strong> When SMB protocol (port 445) is used, Outlook successfully attempts NTLM authentication to the remote “attacker.wan” system without any issue. In my tests with different Outlook versions, when WebDAV protocol is used, I did not see the vulnerability causing NTLM authentication to be attempted to a server outside the trusted zone. You can see the comparison of SMB and WebDAV based attacks in the below screen recording:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rTzPsG9HYVDTMZQMWASFOw.gif" /><figcaption>CVE-2023–23397 Outlook Vulnerability - NTLM Authentication demo SMB vs WebDAV</figcaption></figure><h3><strong>So… Does the attack chain fail then?</strong></h3><p>Not really… No. For this scenario, since we already have an active beacon inside the network and we have control of a regular domain user on BETADKTP05 we may still be able to quickly get around this limitation by creating a fake computer account using to the good old <strong><em>ms-ds-Machine-Account-Quota</em></strong>. Shortly, this is a setting that defines the number of computer accounts any regular domain user can add to an Active Directory domain and by default has a value of 10. Thus, we as the attacker can abuse this default AD setting and add a new fake computer account and a respective DNS record. You can see the computer account being created and a DNS record being added to the Active Directory in the below screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*xFM59XC8U_bGsg6k-JwGMg.jpeg" /><figcaption>Creation of a new computer account in the domain beta.lab</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_OrXfRlk9C3cbU5p_cziQ.jpeg" /><figcaption>Addition of a new DNS record for the newly created computer account</figcaption></figure><h3>Complete Attack Chain Demo:</h3><p>As we now have a DNS record in the trusted zone pointing towards our attacker system, this time the victim Outlook answers the <em>“401 Unauthorized, NTLM Authentication required”</em> message and starts NTLM authentication with the attacker’s WebDAV server over the Internet. A final touch is setting up of a socks proxy to tunnel relayed NTLM authentication traffic through the beacon on BETADKTP05. This can be done with a SOCKS capable C2 framework and a quick proxychains configuration on the attacker system. The end-to-end attack is presented in the following screen capture. At the end, the attacker is able to execute command on the target system BETASRV01 with system rights using the relayed NTLM credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kla0LZ3cXQRStitpt9RuBw.gif" /><figcaption>Execution of Out of Band NTLM Relay Full Attack Chain</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba09a6516c9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Comprehensive Lab Environment for Cybersecurity Research Part-1: Introduction & Design]]></title>
            <link>https://gorkemkaradeniz.medium.com/comprehensive-lab-environment-for-cybersecurity-research-part-1-7b4ee677f005?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b4ee677f005</guid>
            <category><![CDATA[computer-network]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Tue, 16 Feb 2021 10:50:48 GMT</pubDate>
            <atom:updated>2021-02-16T10:50:48.067Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“We don’t rise to the level of our expectations, we fall to the level of our training.” -Archilochus</blockquote><p>As the frequently used quote from Archilochus emphasizes, training has a very important and restrictive part in achieving success. Among many others this is a very applicable concept for cyber security as well. Whether you are working on the defensive or the offensive side; being prepared, having proper knowledge and experience are the key elements. As you can relate, It feels a lot different when an incident occurs on a type of system that you have never even heard of versus a system that you have done many similar investigations and forensic analysis on. Similarly, as a red team operator it can be way more difficult to disguise/hide your footprints if you have never checked which logs are generated by a certain offensive technique or evade an EDR that you face for the first time during an engagement than the one you have already practiced with many times before.</p><p>Thus, there is a sound rationale for a cyber security professional to have his/her own lab environment. In this series I will design a small -but as comprehensive as possible- lab environment with many features that can be seen in today’s enterprise networks.</p><p>Since there is a lot to consider, I will try to divide the series to multiple articles with distinct main topics. In this article I will draw a roadmap and explain the planned lab infrastructure’s design. Below are the distinct concepts that I will try to include in the lab design and present in different articles:</p><ul><li>Setting Up Networks, LAN segments and Firewall Rules</li><li>Active Directory Setup: Forests, Domains &amp; Trusts</li><li>Active Directory Setup: Populating Users, Groups and adding Relations</li><li>Adding Linux support to the AD Environment Using Centrify (or a similar solution)</li><li>Setting Up a Proxy for Internet Access, Setting up the Exchange Infrastructure</li><li>Systems Logging, ELK setup and SIEM app on Kibana, Working on Acquiring Different Log Types</li><li>Setting Up Microsoft Advanced Threat Analytics ( or another UEBA product) &amp; Inspecting Results</li><li>Workshop Cases</li></ul><p>As a note, I would like to state that although I like gathering information from multiple sources and vetting them either by comparison or experimentation, throughout this series there may be parts where the only information that I provide would be from my own experience and therefore subjective. There are lots of different technologies involved in an enterprise network, I am in no way an expert in all of these technologies, and there may be better individual guides &amp; documentation so I will try to give reference to such guides whenever possible.</p><p>So without much further ado, lets talk about the lab environment design:</p><p>Initially our Lab will include 6 Different Active Directory Domains with different trust settings in between. Below is the initial plan for trusts in the AD infrastructure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsToorzLs7LDFDxgQv_2Ig.png" /></figure><p>The complete network will have multiple different local network segments and a simulated WAN interface with various access control rules. The simplified network diagram is as shown in the following figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_EYQZELm65Cs3gq3IM5Vwg.png" /></figure><p>In order to mimic an enterprise environment, we will implement access control rules between different networks. Some of the network segments will eventually simulate restricted server subnets, some of the subnets will allow all incoming connections but restrict outgoing connections and some of the subnets will mimic client device networks with limited WAN access. Moreover, since the roadmap for this series includes centralized logging and SIEM setup, there is a plan on using one of the subnets to mimic a dedicated security operations network.</p><p>Finally, it is time to talk a bit about estimated minimum technical requirements for this design. As we are not going to be usually running complex calculations in the LAB environment, a modern CPU may handle high number of low activity virtual machines. However, RAM allocation is static among virtual machines and it may be the limiting reagent for such setup. You can find a rough estimate for bare minimum RAM requirements below:</p><ul><li>Host OS Reserved: 4GB RAM</li><li>6 Domains -&gt; 6 Domain Controllers (At least 1.5GB Ram Each): 9GB RAM</li><li>1 Extra Domain Controller for multi DC scenarios: 1.5GB RAM</li><li>1 Exchange Server: 1.5 GB RAM</li><li>4 Windows Clients (At Least 1 GB RAM Each): 4 GB RAM</li><li>4 Windows Servers (At Least 1 GB RAM Each: )4GB RAM</li><li>2 Linux Servers (At least 512 MB RAM Each): 1GB RAM</li><li>4 Virtual Firewalls (At least 512 MB RAM Each): 2 GB RAM</li><li>1 Linux DNS Server : 512 MB RAM</li><li>Proxy Server: 1 GB RAM</li><li>ELK &amp; SIEM Bundle 4–6 GB RAM</li><li>(Optional) Advanced Threat Analytics Server: 2 GB RAM</li><li>(Optional) Centrify or a similar Infrastructure: 1.5 GB RAM</li></ul><p>As it can be seen from above the minimum memory requirement for such a lab is above 32 GB.</p><p>Note that in addition to the above systems, we may also need to run a decent attacker system, command control server or a redirector for some attack scenarios. If you’d like to create a similar design, depending on the amount of RAM available, you may need to take some of the (unused) virtual machines offline for some scenarios.</p><p>You can now read the <a href="https://medium.com/@gorkemkaradeniz/comprehensive-lab-environment-for-cyber-security-research-part-2-413182862ece">Part 2 of the series: “Setting Up Networks, LAN segments and Firewall Rules”</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b4ee677f005" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Comprehensive Lab Environment for Cybersecurity Research Part-2: Setting Up Networks]]></title>
            <link>https://gorkemkaradeniz.medium.com/comprehensive-lab-environment-for-cyber-security-research-part-2-413182862ece?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/413182862ece</guid>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[computer-network]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Tue, 16 Feb 2021 10:47:30 GMT</pubDate>
            <atom:updated>2021-02-16T10:47:30.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u0jE4JCwKnl2NfYI8YNHHw.png" /></figure><p><strong><em>In the first part, we have talked about the general design and plans of our lab environment. In Part 2, we are going to focus on the network design of our lab Note: If you have just come across this series, you might want to </em></strong><a href="https://medium.com/@gorkemkaradeniz/comprehensive-lab-environment-for-cybersecurity-research-part-1-7b4ee677f005"><strong><em>start from Part-1</em></strong></a><strong><em>.</em></strong></p><p>For starters, we are going to need virtual routers and firewalls in our lab environment if we would like to simulate an enterprise environment and a portion of the public IP space. I have chosen OPNsense (which is a fork of pfSense) as it has many of the needed capabilities such as firewall, NAT, routing, DHCP and VPN.</p><p>As shown in the first article we are going to setup one <a href="https://opnsense.org/">OPNsense </a>VM as a router simulating a portion of the public IP space. In order to simulate a portion of the wide area network (WAN), we can chose chunks of Public IPs that belong to organizations or countries which we know that we won’t need to access from our lab environment. In order to look up such large /8 IPv4 blocks you can check out <a href="https://en.wikipedia.org/wiki/List_of_assigned_/8_IPv4_address_blocks">Wikipedia</a>. For this write-up let’s assume that we choose the block 7.0.0.0/8 (note: <em>you can choose another public IP block to which you don’t need to access from your lab environment, it can be a smaller public IP block as well</em>).</p><p>We can add 3 Network adapters (Interfaces) on the WAN OPNsense VM and set 2 of these Network adapters to different <em>LAN Segment</em>s. The first interface can be setup as VMware NAT as this interface is going to be the connection of our lab environment to real Internet. The main reason that we choose LAN segments instead of host only networks is because there is a limit to the number of VMware host only networks that can be created on a Windows Host whereas there are not many restrictions on LAN segments. Also we don&#39;t need any IP blocks to be assigned to these interfaces by the VMware itself since we are going to manage the IP blocks of these segments from our simulated WAN router.</p><p>You can find the main network design for this write-up below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgRB5wNsencJxMXhtocJMQ.jpeg" /></figure><p>It may be wise to name the LAN Segments accordingly because things get confusing really fast when you define 30+ LAN segments and forget which one is what. Thus, in the scope of our write-up, lets assume that for the WAN router virtual machine the first Network Adapter is connected to NAT, Network Adapter 2 is connected to the LAN Segment, which is called “7.0.0.0/15_SIM_WAN_Backbone” and Network Adapter 3 is connected to the LAN segment “7.2.0.0/15_LAB_WAN_Interface”. In order to keep track of these LAN segments I try to name them as explicitly as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*KXCkfI2su4YWA3n7lerz2A.png" /><figcaption><em>During initial installation of OPNsense virtual machines it is better to allocate 1GB of RAM, you can reduce it to 512MB after installations are complete</em></figcaption></figure><p>For our simulated WAN to work we would also need a simulated authoritative DNS server that can resolve domain names (such as “<em>myspecialattackerdomain.com</em>” that are unknown to Internet) inside our simulated WAN. As I needed a simple DNS solution with a GUI, I have installed <a href="https://technitium.com/dns/">Technitium </a>DNS on a Debian server. The DNS server virtual machine will have one network adapter that is connected to the “7.0.0.0/15_SIM_WAN_Backbone” LAN segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*cCi5mm6g_WbdN_C7okOpjg.png" /></figure><p>Afterwards, static IP networking can be configured by editing the /etc/network/interfaces from the Debian server console. For this write-up we have given IP 7.1.1.1 to the DNS server. Below you can find a screenshot of the Technitium DNS web GUI being served on port 5380. It is relatively easy to setup, and the GUI access is enough for adding different DNS zones and various types of records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*VNwKpHi2QDwPjD8EH2WS3A.png" /></figure><p>If you would like the simulated WAN DNS server to behave as an authoritative DNS server (which is usually how the public DNS servers such as Google, OpenDNS or Cloudflare DNS basically behaves) then you need to configure the “Allow Recursion”option as shown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lBUsSBDuL-q3J09Ko8agLg.png" /></figure><p>Then, it is time to place our LAB environment inside this simulated WAN and for that we can use the second LAN segment (7.2.0.0/15_LAB_WAN_Interface) that we have defined on the Simulated WAN OPNsense virtual machine. As we are going to place our lab environment inside the simulated WAN, we need to setup an edge router/firewall for our LAB. Let’s call this router/firewall FW01. Moreover as we would like to have many different subnets, we are going to setup 2 more OPNsense router/firewalls. This is mainly because in VMware there is a limit to the number of Network Adapters a virtual machine can have (which is 10). We are going to (creatively!) name these OPNsense systems as FW02 and FW03.</p><p>I am not going to give a step by step guide on how to set up OPNsense virtual machines. The initial setup process is done through the virtual machine console command line during OS installation. You can find detailed tutorials on the internet. After creating 3 virtual machines and setting CPU, RAM and Network Adapters, it might be easier to configure one LAN interface for each OPNsense virtual machine through their command line consoles and attach a dummy windows machine to the same LAN segment. This way, you can use the temporary Windows system to make detailed configurations on OPNsense VMs by accessing their web interfaces instead of their command line consoles.</p><p>Another important note is that after the initial OS setup the LAN interfaces on OPNsense firewalls will have deny rules by default. My suggestion would be to first add firewall rules for each interface in a way that it would allow any any connections from and to that interface. This is for two reasons: First, we would like to make sure that the routing is working correctly on every subnet that we create so we need allow access from each subnet to every other subnet. Second, the OPNsense firewalls have two different methods for writing rules: interface based rules and floating rules. Using both of them concurrently can make things complicated and for this write-up (even though interface based rules would probably have better performance) we are going to use only the floating rules on each firewall while setting the interface based rules as “ALLOW any any”. The OPNsense firewall is designed to evaluate the floating rules first and interface based rules second, hence if all necessary rules are written in floating rules section of the firewalls, everything would still work as designed (For details you can check out the OPNsense <a href="https://docs.opnsense.org/manual/firewall.html">documentation</a>.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgRB5wNsencJxMXhtocJMQ.jpeg" /></figure><p>The FW01 and FW03 will also have simulated WAN access as the initial will act as outbound traffic exit for the LAB environment and the latter will act as a firewall to the lab DMZ. All public and private IP blocks and LAN segments are given in the network diagram above.</p><p>All FW01, FW02 and FW03 systems will be connected to each other through a chosen LAN Segment which would be attached to one Network adapter on each of them. For this write-up, I have created a LAN10 segment with 10.x.10.0/24 network and give each FW system a static IP on this segment so that they can route traffic to and from each other. Of course, the systems need to know where to route traffic and we need to setup routing in order for these separate OPNsense instances to route traffic through each other . You can find the example routing rules for FW01 below (<em>Note: You’ll need to set routing on FW02 and FW03 as well</em>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JT6yrwtdec6gdB6RBjW9Rw.jpeg" /><figcaption>OPNsense route config for FW01 (note that x=143 in this screenshot)</figcaption></figure><p>Its easy to get frustrated during this initial networking setup. During this phase, using a dummy virtual machine that you can connect different LAN segments to diagnose issues could potentially save a lot of time. When faced with an issue, using <em>traceroute </em>and <em>ping </em>commands and checking firewall logs could help.</p><p>The next part of the series will continue with Part 3: “Active Directory Setup: Forests, Domains &amp; Trusts”</p><ul><li><a href="https://opnsense.org/">OPNsense® is an open source, feature rich firewall and routing platform, offering cutting-edge network protection. - OPNsense</a></li><li><a href="https://en.wikipedia.org/wiki/List_of_assigned_/8_IPv4_address_blocks">List of assigned /8 IPv4 address blocks - Wikipedia</a></li><li><a href="https://technitium.com/dns/">Technitium DNS Server</a></li><li><a href="https://docs.opnsense.org/manual/firewall.html">Rules - OPNsense documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=413182862ece" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Defeating RunAsPPL: Utilizing  Vulnerable Drivers to Read Lsass with Mimikatz]]></title>
            <link>https://gorkemkaradeniz.medium.com/defeating-runasppl-utilizing-vulnerable-drivers-to-read-lsass-with-mimikatz-28f4b50b1de5?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/28f4b50b1de5</guid>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[mimikatz]]></category>
            <category><![CDATA[red-teaming]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 06:18:11 GMT</pubDate>
            <atom:updated>2020-03-09T06:18:11.565Z</atom:updated>
            <content:encoded><![CDATA[<h3>Defeating RunAsPPL: Utilizing Vulnerable Drivers to Read Lsass with Mimikatz</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ivpIXr0zHkGjTuGtm7bcFg.png" /><figcaption>Mimikatz not able run sekurlsa module due to RunAsPPL Registry Setting</figcaption></figure><p>As operating systems continue to grow and improve themselves security-wise, we find ourselves requiring to defeat more and more of the controls and restrictions during penetration tests. One of such restrictions on Windows is Local Security Authority Protection. This feature arrived with Windows 8.1 and restricts access to LSA, which keeps important information such as used credentials (even if you have NT Authority System privileges). For lateral movement, we have many other methods but getting clear text passwords or NTLM hashes directly from a compromised system usually helps us proceed much faster towards our target during a red team exercise.</p><p>One of the tools that can extract clear text or hashed credential information from lsass process is the well known tool, mimikatz. However, when the “RunAsPPL” setting is enabled in the registry on a current Windows system, mimikatz fails to gather clear text or hashed credentials from the memory. What comes to the rescue is another module, that is developed by infamous Benjamin Delpy himself, called mimidrv . This module is a driver file called mimidrv.sys and by loading mimidrv as a driver it becomes possible to do operations to bypass or remove some further controls such as the lsass protection. We are not going to get into detail but Matt Hand has published a great article on the mimidrv functionality and technical details (You can read it <a href="https://posts.specterops.io/mimidrv-in-depth-4d273d19e148"><strong>here</strong></a>).</p><p><strong>What is so special about mimidrv.sys and why would we want code execution as a driver ?</strong></p><p>In a nutshell, even if we have administrator or system level privileges we may still want to escalate from the user space to kernel space. Windows drivers are allowed to run in the kernel space but the users are not. Code execution as a driver allows us to bypass or deactivate some of the Windows security mechanisms (such as LSA protection), also from the kernel space it is possible to have a more direct hardware access which in turn could allow us to modify the firmware of some components or the device itself (<em>LoJax malware campaign is an example where a legitimate kernel driver “RwDrv.sys” is used to install persistent rootkit to the UEFI so that it can survive even a complete reinstallation of the operating system. You can read </em><a href="https://www.welivesecurity.com/2018/09/27/lojax-first-uefi-rootkit-found-wild-courtesy-sednit-group/"><strong><em>this article</em></strong></a><strong><em> </em></strong><em>for further information.</em>).</p><blockquote>Kernel runspace (Ring 0) is a realm where almost everything is possible in a windows operating system.</blockquote><p><strong>So, can we say “Problem solved! lets use mimidrv module and gather all the credentials!” ? <br></strong>Well, <strong>Yes</strong> and <strong>No</strong>. <br>If you are in the middle of a red team engagement and try to bring the same mimidrv.sys file that has been around since 2013 to the target environment, <strong>there will be alerts. </strong>The hash and composition of the file is known for the last 7 years. Even the least competent AV will probably detect it.</p><p><strong>So what do you do now; can you modify the mimidrv source code and obfuscate the file for AV evasion for a quick win ? <br></strong>Again it’s not that simple. Because on current Windows Operating Systems the drivers need to be signed and in order to successfully load a driver, there are strict rules on the kind of signatures that are acceptable. Microsoft currently requires for any new driver to be first signed with a trusted Extended Validation Code Signing Certificate, and then the driver needs to be submitted to the WHQL portal to be WHQL certified. Only then the drivers are allowed to load in Windows 10. However, there is an exception for older drivers that are signed prior the date: 29.07.2015. These drivers do not need to be signed again or submitted to WHQL portal, and for backward compatibility reasons Windows continues to accept these drivers.</p><p>This backward compatibility case can be seen in the below screen recording where the mimidrv.sys file signed by Benjamin Delpy from 7 years ago is still allowed to load as a driver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CqQUu6DkGuYn9035B5OVwA.gif" /><figcaption>The expired signature of mimidrv.sys and Windows OS still allowing the driver to load (Windows Defender is completely disabled)</figcaption></figure><p>In the screen recording below, the user has administrator privileges and tries to load an unsigned mimidrv driver. It can be seen that as the user tries to load the custom mimidrv.sys driver using mimikatz !+ command, the process fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5NwaEeN4ICev_lnASxU-8w.gif" /><figcaption>Windows not allowing the custom unsigned mimidrv driver to be loaded</figcaption></figure><h4>There are 2 main ways to attack this problem:</h4><p><strong>1- Build your own driver, get it signed and Microsoft WHQL certified:<br> </strong>This option is also suggested by Vincent Le Toux. You will need to get an EV code signing certificate and you need to send your own custom driver (that may have some funny intentions) to Microsoft for quality control. Currently, there are not many people who disclose that they are sending such drivers for WHQL signing but it is not hard to imagine Microsoft trying to impose stricter controls on the certification process if this method attracts more attention. Also an EV certificate is a bit costly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*mlR9VUMFwnF_P49cDdP6KA.png" /><figcaption>Tweet from Vincent Le Toux explaining a method to bypass LSA Protection</figcaption></figure><p><strong>2- Exploit a vulnerable driver that is running as kernel driver on the system:<br></strong>Another option would be to exploit a vulnerable driver that is already running on the system to escalate privileges. But what if there are no vulnerable drivers running on the system ?</p><p>Well, then, there actually is one more option: <strong>BYOvD</strong>, meaning <strong>B</strong>ring <strong>Y</strong>our <strong>O</strong>wn <strong>V</strong>ulnerable <strong>D</strong>river. With this method, you upload a regular driver for any device or vendor that has code execution vulnerability to the target system. The perfectly normal product driver (that is also a little exploitable), lets say for a keyboard or a hard drive, <strong>would already be signed in the past before its release</strong> <strong>so that it could function</strong>. <strong>That driver would still be acceptable by Windows OS today.</strong> Thus, what we can do is to bring a vulnerable driver that we know how to exploit, load the vulnerable driver to our target system, and as this driver has rights to run in Ring 0 we will have the same rights after exploiting the driver. After getting the kernel level code execution rights, it is possible to act the same way as the mimidrv driver, bypass the protection and access LSA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*cQXRcPTSOXcEOmn-rgh1oA.png" /><figcaption>Part of the Source Code from Gigabyte Driver Exploit POC by <a href="https://github.com/alxbrn/gdrv-loader">Alexander Bruun</a></figcaption></figure><p>There are multiple POC programs on Github for exploitation of the vulnerable Gigabyte driver. We are going to use the proof of concept called <strong>gdrv-loader</strong> by <a href="https://github.com/alxbrn/gdrv-loader">Alexander Bruun</a> to load our custom created <em>mimidrv.sys</em>. In this POC, the program first acquires Kernel level code execution right by exploiting the vulnerable Gigabyte driver and then uses the higher privilege to momentarily disable the Driver Signature Enforcement (DSE), load the given driver and enable DSE back again. After exploiting the Gigabyte driver, we can also directly remove process protection of a desired process(similar to what <a href="https://github.com/hoangprod/DanSpecial">DanSpecial</a> does). We could have also completely renamed the mimidrv file and its service to something else or further modified the mimikatz &amp; mimidrv code for evasion. We could even load a custom driver of our own that would provide the similar functionality. Here, we are just using a freshly built and unsigned mimidrv for demonstration purposes.</p><blockquote>OPSEC Note: Do not run untrusted/unverified code/binary in a live environment, review source codes, rebuild and test in controlled environments.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThPMPEXJCb3ECaCiAJ8COg.gif" /></figure><p>As we already have Administrator privileges, we can easily load the vulnerable (but signed and valid) Gigabyte driver to the target system. In the above example, we disable DSE and load our unsigned mimidrv driver with the help of kernel level code execution rights. mimidrv has a function that allows us to make any process protected. Thus, it is possible to protect the mimikatz.exe process using command !processProtect /process:mimikatz.exe . After this invocation it is possible to read lsass memory again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XanzCsmvGs4NusqyhDlHCQ.png" /></figure><h4>Beware (Here be Dragons!)</h4><p>It is harder for the operating system to tolerate or recover from errors that occur on the kernel level thus I would like to emphasize that loading rogue drivers to a windows system is a <strong>risky action </strong>and may very well cause system instability and/or crash (aka BSOD). Testing such actions multiple times on controlled environments and taking all necessary precautions before running on live systems are strongly advised both for OPSEC and safety reasons.</p><h4><strong>Further Research on vulnerable Drivers</strong></h4><p>There is research by the Eclypsium team (presented at Defcon 27) on finding unreported but possibly vulnerable drivers, it is very much possible to apply their methods and search for such previously unknown drivers, write custom exploits for them and use in your engagements for better evasion. You can read about their research <a href="https://github.com/eclypsium/Screwed-Drivers/blob/master/presentation-Get-off-the-kernel-if-you-cant-drive-DEFCON27.pdf"><strong>here</strong></a>.</p><p><strong><em>Note: </em></strong><em>It is unlawful to access computer systems without explicit consent. Author assumes no liability; always have permission and take necessary precautions before any invasive activity.</em></p><h4><strong>References that are mentioned in this article:</strong></h4><ul><li><a href="https://docs.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection">Configuring Additional LSA Protection</a></li><li><a href="https://techcommunity.microsoft.com/t5/windows-hardware-certification/driver-signing-changes-in-windows-10/ba-p/364859">Driver Signing changes in Windows 10</a></li><li><a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/install/whql-release-signature">WHQL Release Signature - Windows drivers</a></li><li><a href="https://posts.specterops.io/mimidrv-in-depth-4d273d19e148">Mimidrv In Depth: Exploring Mimikatz’s Kernel Driver</a></li><li><a href="https://blogs.jpcert.or.jp/en/2016/10/verification-of-ad9d.html">Verification of Windows New Security Features - LSA Protection Mode and Credential Guard - JPCERT/CC Eyes</a></li><li><a href="https://www.secureauth.com/labs/advisories/gigabyte-drivers-elevation-privilege-vulnerabilities">GIGABYTE Drivers Elevation of Privilege Vulnerabilities | SecureAuth</a></li></ul><p><a href="https://github.com/eclypsium/Screwed-Drivers/blob/master/presentation-Get-off-the-kernel-if-you-cant-drive-DEFCON27.pdf">https://github.com/eclypsium/Screwed-Drivers/blob/master/presentation-Get-off-the-kernel-if-you-cant-drive-DEFCON27.pdf</a></p><ul><li><a href="https://github.com/eclypsium/Screwed-Drivers/">eclypsium/Screwed-Drivers</a></li><li><a href="https://www.welivesecurity.com/2018/09/27/lojax-first-uefi-rootkit-found-wild-courtesy-sednit-group/">LoJax: First UEFI rootkit found in the wild, courtesy of the Sednit group | WeLiveSecurity</a></li><li><a href="https://github.com/alxbrn/gdrv-loader">alxbrn/gdrv-loader</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28f4b50b1de5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Yapısına Zincirleme Saldırı Senaryoları #3]]></title>
            <link>https://gorkemkaradeniz.medium.com/active-directory-zincirleme-senaryolar-bolum3-a6b709846770?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6b709846770</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[siber-guvenlik]]></category>
            <category><![CDATA[sızma-testi]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Wed, 01 Jan 2020 21:35:26 GMT</pubDate>
            <atom:updated>2020-01-01T21:40:06.336Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bölüm 3: Forest’lar Arası Yatay Hareket ve Hedef Sisteme Erişim</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhulpeVAsk3ox5O59Tf5hA.png" /></figure><p><a href="https://link.medium.com/ZYhQgyF5O2">Bir önceki bölümde</a> SOUTH forest’ında Enterprise Admin yetkilerine erişmiştik. Bu yazı içerisinde önce NORTH forest’ına geçiş yapacak ardından da WEST domain’i içerisinde bulunan VAULT01 hedef sistemimize erişim sağlayarak saldırımızı sonlandıracağız. <a href="https://link.medium.com/KOYyudzGH2"><strong><em>(Not: Henüz okumadıysanız 1. bölümden başlamak isteyebilirsiniz</em></strong></a><strong><em>.)</em></strong></p><p>İlk yazı içerisinde Active Directory’deki 3 çeşit delegasyon yapısından söz etmiştik. SOUTH forest’ından, hedef sistemimiz olan WEST\VAULT01’e giden yol üzerindeki NORTH forest’ına geçiş yapabilmek için “Unconstrained Delegation” özelliğinden faydalanacağız.</p><p>“Unconstrained Delegation”<strong>,</strong> “TGT Forwarding” adı verilen bir yapı ile çalışmakta ve Active Directory içerisindeki sistemlerde “TrustedForDelegation” özelliği (attribute) ile belirlenmektedir. Varsayılan ayarlarda bir domain içerisindeki tüm domain controller’lar “TrustedForDelegation” özelliğine sahiptir.</p><p>Herhangi bir kullanıcı “TrustedForDelegation” özelliğine sahip bir sisteme kerberos kimlik doğrulama kullanarak bağlandığında, ilgili sisteme bağlanma yetkisini doğrulama amaçlı iletilen TGS’in (Service Ticket) yanında ilgili kullanıcıya ait TGT’de bağlantı kurulan sisteme iletilir.</p><p><em>(Not: TGT, kerberos kimlik doğrulama yapısında bir kullanıcının şifresi ile kendisini domain controller’a tanıttıktan sonraki seferlerde kimliğini daha önceden doğruladığını kanıtlamak için arka planda kullannılan bir bilet (ticket) değeridir. TGS ise AD yapısı içerisinde kullanıcının spesifik bir servis/sisteme bağlanma yetkisini gösteren bilettir ve bu bilet ilgili sistem tarafından kontrol edilerek kullanıcıya erişim sağlanır. Kullanıcı, geçerli durumdaki TGT’sini kullanılarak (tekrar şifre girmesine gerek olmadan) spesifik bir servis/sisteme bağlanma izni sağlayacak bir TGS’i domain controller’dan talep edilebilir.)</em></p><p>Bu bilgilerden hareketle Forest’lar arası güven sınırını (trust boundary), Unconstrained delegation özelliğini kullanarak aşma konusunda Will Schroeder’in <a href="https://www.harmj0y.net/blog/redteaming/not-a-security-boundary-breaking-forest-trusts/">bu araştırmasından</a> faydalanacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5xaIezsT0ZXHRbsZ3RLXw.png" /></figure><p>Yukarıdaki şekilde de görüleceği üzere, saldırı planımız dahilinde NORTH domain’indeki NORTHDC01 domain controller sisteminin kontrolümüz altındaki SOUTHDC01’e bağlanmasını istemekteyiz. İlgili bağlantı gerçekleştiğinde SOUTHDC01 sisteminin varsayılan olarak sahip olduğu “Trusted For Delegation” özelliği sayesinde, NORTHDC01$ (Computer Account) adına olan TGT de, SOUTHDC01 sistemine iletilmiş olacaktır. NORTHDC01 sisteminin SOUTHDC01&#39;e bağlanmasını sağlamak için 1. bölümde de kullanmış olduğumuz MS-RPRN protokolünden faydalanacağız. MS-RPRN protokolü <strong>RpcRemoteFindFirstPrinterChangeNotificationEx</strong> fonksiyonunu uzaktan çağırarak NORTHDC01 sisteminin SMB üzerinden SOUTHDC01&#39;e bağlantı kurmaya zorlayabiliriz. Bu işlemin ardından SOUTHDC01 sisteminin memory’sine NORTHDC01&#39;e ait TGT’nin geldiğini göreceğiz. İlgili TGT’yi elde etmek için ana yazarı Will Schroeder olan Rubeus aracından faydalanabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ja-e41HylDfJYV5fHPHW1g.png" /></figure><p>İlgili TGT’nin ele geçirilmesi sonrası NORTHDC01 domain controller’ına uzaktan bağlanarak “Directory Replication” işlemi başlatabilir, NORTH domain’i içerisindeki tüm kullanıcılara ait NTLM hash’lerini elde edebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-rs4Rl34d22hbd7nDjWV7Q.png" /></figure><p>NORTH domain’inin tüm kontrolünün ele geçirilmesinin ardından WEST domain’i içerisindeki VAULT01 sistemine erişim sağlamanın yollarını aramaktayız. Bu kapsamda öncelikle NORTH ve WEST domain’leri arası güven ilişkisini inceleyeceğiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*CGPwZ1Pl0lrsfWOWgm0qUA.png" /></figure><p>NORTH ve WEST domain’leri arasındaki güven ilişkisi “External Trust” olarak geçmekte. “External Trust” ilişkisinde (aşağıdaki Powerview çıktısından da görülebileceği üzere) “SID Filtering” özelliği aktif durumdadır. Ayrıca bu güven çeşidinde varsayılan olarak yalnızca NTLM kimlik doğrulama desteklenmektedir bu nedenle bir önceki işlemde olduğu gibi kerberos delegasyon yapısını kötüye kullanmamız da mümkün olmamaktadır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zpdimcaEKn64e2ZaEPvkqg.png" /><figcaption>NORTH domain’inin sahip olduğu güven ilişkileri Powerview kullanılarak incelenmektedir.</figcaption></figure><p>İşlevsel bir active directory yapısında iki domain arası güven ilişkisi oluşturulmuş ise genellikle bunun amacı iki domain içerisindeki kullanıcı/gruplardan bazılarının diğer domain’deki çeşitli servis ya da sistemlerden hizmet alabilmesini sağlamaktır. Bu düşünce ile şimdiye kadar ele geçirmiş olduğumuz NORTH domain’i kullanıcılarının, WEST domain’i içerisinde herhangi bir yetkileri olup olmadığını incelemek doğru bir adım olabilir.</p><p>Ele geçirililen tüm hesaplar ile deneme yapmak gürültülü (çok sayıda log üremesine / alarm oluşmasına sebep olacak) bir işlemdir. Öncelikle daha nazik bir yaklaşım deneyerek WEST domain’i içerisindeki gruplarda domain dışından bir kullanıcı olup olmadığını ve eğer var ise bu kullanıcıları ele geçirmiş olup olmadığımızı inceleyebiliriz. Powerview aracının Get-DomainForeignGroupMember fonksiyonu bu konuda bize yardımcı olacaktır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H4LAMY6I-uqwlqArlhIBag.png" /></figure><p>Yukarıdaki çıktıda görüldüğü üzere WEST domain’i içerisindeki “Cryptocurrency Vault Admins” isimli grup domain dışından bir üye barındırmakta (Yukarıdaki çıktıda kullanıcının yalnızca SID’si görünmekte). İlgili kullanıcının SID bilgisinden faydalanarak hangi domain’e üye olduğunu ve kim olduğunu öğrenmemiz mümkün olabilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSznp7sAn939b8jTgbevyA.png" /></figure><p>Bu bilgiyi yukarıdaki çıktıda görülebileceği üzere yine PowerView aracını kullanarak öğrenmemiz mümkün.</p><p>Ulaşmak istediğimiz sistemimizin adı VAULT01 we NORTH\Cave kullanıcısın da içerisinde bulunduğu WEST domaini içerisindeki grubun adı ”Cryptocurrency Vault Admins”. Elimizde kesin bir bilgi olmamakla birlikte kimlik bilgilerini ele geçirdiğimiz tüm kullanıcılar ile deneme yapmaya başlamadan önce bu kullanıcının sisteme erişimi olup olmadığını test etmemiz daha mantıklı olacaktır.</p><p>Yine mimikatz aracının pass the hash özelliğinden faydalanarak yeni bir process için NORTH\Cave kullanıcısının NTLM hash’ini enjekte edebiliriz. Aşağıdaki ekran görüntüsünde Cave kullanıcısıymış gibi yeni bir cmd.exe çalıştırmaktayız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYnsD35DTETE35YFU2zf6w.png" /></figure><p>İlgili cmd.exe içerisinden, VAULT01 sunucusu üzerinde PsExec kullanarak uzaktan komut çalıştırmak istediğimizde aşağıdaki gibi başarılı olduğunu görmekteyiz. Bu işlem sonucunda hedef sistemimiz olan VAULT01&#39;in tüm kontrolünü ele geçirmeyi başarmış bulunuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9OoCsCeoRXX9DlJlFYVMg.png" /></figure><p>Bu bölüm ile birlikte yazı dizimizin sonuna geldik. Saldırganımız geçtiğimiz üç bölüm içerisinde hayali bir active directory ortamında, sıradan bir kullanıcı bilgisayarından yola çıkarak yetkisini yükseltti, birden fazla domain ve forest arasındaki güven ilişkilerini istismar ederek, farklı yöntemler ile yatay hareket gerçekleştirdi ve hedefine ulaşmayı başardı.</p><p><em>Yazı içerisinde işlenilen konular ile ilgili detaylı bilgi içeren bazı kaynaklar:</em></p><ul><li><a href="https://github.com/GhostPack/Rubeus">GitHub - GhostPack/Rubeus: Trying to tame the three-headed dog.</a></li><li><a href="https://shenaniganslabs.io/2019/01/28/Wagging-the-Dog.html">Wagging the Dog: Abusing Resource-Based Constrained Delegation to Attack Active Directory</a></li><li><a href="https://www.harmj0y.net/blog/redteaming/not-a-security-boundary-breaking-forest-trusts/">Not A Security Boundary: Breaking Forest Trusts</a></li><li><a href="https://posts.specterops.io/hunting-in-active-directory-unconstrained-delegation-forests-trusts-71f2b33688e1">Hunting in Active Directory: Unconstrained Delegation &amp; Forests Trusts</a></li><li><a href="https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon">PowerSploit/Recon at master · PowerShellMafia/PowerSploit</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6b709846770" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Yapısına Zincirleme Saldırı Senaryoları #2]]></title>
            <link>https://gorkemkaradeniz.medium.com/active-directory-zincirleme-senaryolar-bolum2-de84c7dd6c0d?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/de84c7dd6c0d</guid>
            <category><![CDATA[sızma-testi]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[siber-guvenlik]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Sun, 29 Dec 2019 21:02:51 GMT</pubDate>
            <atom:updated>2019-12-29T21:02:51.156Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bölüm 2: Forest İçerisinde Yetki Yükseltme</h4><p>Bir önceki yazıda SOUTHWEST domain’i içerisinde, domain admin yetkilerine ulaşmıştık. Bu yazıda ise, SOUTHWEST domain’inde elde ettiğimiz haklardan faydalanarak, SOUTH domain’i üzerinde kontrol sağlanmasını inceleyeceğiz. <a href="https://link.medium.com/KOYyudzGH2"><em>(Not: Henüz okumadıysanız 1. bölümden başlamak isteyebilirsiniz</em></a><em>.)</em></p><p>Saldırı senaryomuzun son durumu aşağda gösterilmektedir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zJGqAHTjDtZXmGE36PAiw.png" /><figcaption>Kırmızı ile işaretlenen alan geçtiğimiz bir önceki yazı kapsamında saldırgan tarafından kontrolü ele geçirilen sistemleri ifade etmektedir.</figcaption></figure><p>Saldırımızın bu adımında aksiyon planımızı oluşturmak için örnek hedef ortamımızdaki domain ve forest’lar arası güven ilişkilerine yeniden göz atalım.</p><ul><li>Bir AD Forest’ın tam kontrolü Enterprise Admins grubu üyelerine aittir.</li><li>Enterprise Admins grubu bir Forest içerisinde <strong>yalnızca </strong>root domain’de bulunur. Bu grubun bir üyesinin ele geçirilmesi tüm Forest üzerinde kontrol sağlamak için yeterli olur.</li></ul><p>Çizimden de görüldüğü üzere SOUTHWEST domain’i SOUTH forest’ı içerisinde yer alan bir domaindir ve SOUTH forest’ının ana kontrolü ilgili root domain olan SOUTH domain’inde yer alan Enterprise Admins grubuna aittir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tvO3yH2xywc0RTqBwPwopw.png" /><figcaption>Kırmızı ile işaretlenen alan geçtiğimiz bir önceki yazı kapsamında saldırgan tarafından kontrolü ele geçirilen sistemleri ifade etmektedir.</figcaption></figure><p>Saldırganımızın şansına ele geçirdiği SOUTHWEST Domain’indeki kullanıcılardan hiçbiri SOUTH domain’indeki Enterprise Admins grubuna dahil değil, bu durumda tüm forest’ın kontrolünü ele geçirmek için farklı bir yol izlenmesi gerekecektir.</p><p>SOUTHWEST domain’inde krbtgt hash’ini kullanarak yaratacağımız golden ticket’ların içinde dilediğimiz grup içerisinde olduğumuzu belirtebiliriz ancak SOUTHWEST domain’i içerisinde Enterprise Admins grubu bulunmadığı için ilgili ibareyi eklesek dahi bu durum SOUTH domain’i tarafından yok sayılacaktır. Çözüme ulaşma konusunda yardımımıza Active Directory özelliklerinden “SID History” yetişmektedir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*ZtbK8DCpoHyGPw460FddaQ.png" /></figure><p>SID History özelliği normal şartlar altında bir domain kullanıcısı başka bir domain’e taşınırken eski kullanıcı bilgilerinin kaybolmaması için kullanılan bir yapıdır. Bu yapı sayesinde kullanıcılar yeni domain e taşındıktan sonra dahi eski domain içerisindeki yetkilerini kullanmaya devam edebilmesi sağlanabilir.</p><p>Biz ise ilgili SID-History yapısını kötüye kullanacağız. Forest içerisindeki SOUTH domain’e SID-History alanımızda Enterprise Admins grubunun üyesi olduğumuza dair bir bilgi eklenmiş bir TGT sunacağız. Böylelikle Parent/Child güven ilişkisinden de faydalanarak SOUTH domain’inin, ilettiğimiz TGT’nin SOUTH domain’den taşınmış ve hala SOUTH içerisindeki eski haklarını da kullanmaya devam etmesi gereken bir kullanıcıya ait olduğuna inanmasını sağlayacağız. Bu işlem için Benjamin Delpy tarafından yazılan mimikatz aracından yardım almamız mümkün.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQ34uRhDqeLFhVL_E-WOEA.png" /></figure><p>Sid history alanında Enterprise Admins bilgisi içeren golden ticket’ı ürettikten sonra SOUTH domain controller’a directory replication işlemi için uzaktan bağlanabilir ve SOUTH\Administrator kullanıcısı hash’ini elde edebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*TX8UbOvcTrHTDaM3EeNFpw.png" /></figure><p><strong><em>Not:</em></strong><em> SID History yapısını kötüye kullanabilme sebebimiz varsayılan ayarlarda aynı Forest içerisindeki domain’ler arası parent/child güven ilişkisinin “SID Filtering” uygulamıyor oluşuyudur. Domain’ler arası güven ilişkilerinde “SID Filtering” özelliği aktif olduğu durumlarda SID History alanında gelen bilgiler dikkate alınmadığından bu istismar yöntemi mümkün olmamaktatır. Microsoft tarafından tek başına bir domain değil bir forest’ın bütünü güven sınırı (Trust boundary) olarak belirlediğinden varsayılan ayarlarda bu özellik kapalı durumdadır.</em></p><p>SOUTH Forest’ın kontrolünü tamamen ele geçirmemizin ardından hedefimize giden yol üzerinde bulunan North Forest’a geçiş yapmanın bir yolunu aramaktayız. 2 Forest arasındaki güven ilişkisini istismar etme ve Forest’lar arası güven sınırını (trust boundary) aşma konusunu bir sonraki bölümde işleyeceğiz.</p><p><em>Yazı içerisinde işlenilen konular ile ilgili detaylı bilgi içeren bazı kaynaklar:</em></p><ul><li><a href="https://adsecurity.org/?p=1772">Sneaky Active Directory Persistence #14: SID History</a></li><li><a href="https://github.com/gentilkiwi/mimikatz">GitHub - gentilkiwi/mimikatz: A little tool to play with Windows security</a></li><li><a href="https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc759073(v=ws.10)">What Are Domains and Forests?: Active Directory</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de84c7dd6c0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Yapısına Zincirleme Saldırı Senaryoları #1]]></title>
            <link>https://gorkemkaradeniz.medium.com/active-directory-zincirleme-senaryolar-bolum1-27ad9583a5ae?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/27ad9583a5ae</guid>
            <category><![CDATA[siber-güvenlik]]></category>
            <category><![CDATA[bilgi-güvenliği]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[penetration-test]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Wed, 25 Dec 2019 07:50:28 GMT</pubDate>
            <atom:updated>2019-12-30T06:19:21.500Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bölüm 1: Domain İçerisinde Yetki Yükseltme</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*0KYJGCoeM_uW2wOVZ2DW4A.jpeg" /></figure><p>Geçtiğimiz ay NETSECTR etkinliğinde gerçekleştirdiğim sunumu, medium üzerinden de birkaç yazıya bölünmüş olarak yayınlayacağım. Bu yazı dizisinde örnek bir Active Directory ortamı üzerinde farklı saldırı senaryolarını inceleyeceğiz. Gerçekleştireceğimiz saldırı işlemleri sırasında AD yapısındaki varsayılan özellik, konfigürasyon ve güncel zafiyetlerden faydalanarak yetki yükseltme ve yatay hareket sağlayacak, adım adım hedeflenen sisteme erişmeye çalışacağız.</p><p>Örnek hedef ortamımızdaki sistemler aşağıdaki çizimde gösterilmektedir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3veoaJVgDol7QJprPJqUQ.png" /><figcaption>Yazı kapsamında sunucu sistemlerin tamamının işletim sistemi Windows 2016 Server’dır. İstemci sistemler ise Windows 10&#39;dur. Tüm domain ve forest’ların fonksiyonel seviyeleri 2012 olarak ayarlanmıştır (İsminin sonunda DC ibaresi olan sistemler domain Controller olarak değerlendirilmelidir.).</figcaption></figure><p>Senaryomuz kapsamında saldırganımız SOUTHWEST domain’i içerisinde yer alan sıradan bir kullanıcıyı (SWUSR01) ve SWPC01 istemci sisteminin kontrolünü ele geçirmiş durumdadır. Saldırganımızın hedefi ise WEST domain’i içerisinde yer alan VAULT01 sistemine erişim sağlamaktır. Örnek hedef AD ortamımız 4 AD domain’den oluşmakta, ilgili domain/forest yapıları arasındaki güven ilişkileri ise aşağıda verilmektedir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*t80C2dB95RujhzO4GETulg.png" /></figure><p>Saldırganımızın ilk önceliği, hedef sisteme erişim sağlamak için izleyeceği yol üzerindeki diğer sistemlere yayılmak olacaktır. Bu amaçla SOUTHWEST domain’i içerisinde daha fazla (mümkün ise de domain admin seviyesinde) yetkiye sahip olmayı amaçlamaktadır.</p><p>SOUTHWEST domain’i içerisinde domain admin yetkilerine erişmek için ms-ds-machineAccountQuota özelliği, MS-RPRN protokolü, CVE-2019–1040 zafiyeti, Resource based constrained delegation özelliği ve protokoller arası NTLM relay saldırılarının tamamından faydalanacağız. Bu yazı içerisinde belirtilen özellik ve zafiyetlerin tüm detaylarına değinmeyecek yalnızca senaryo kapsamındaki saldırımız sırasında kullanabileceğimiz noktalarına odaklanacağız.</p><p>İlk olarak, <strong>ms-ds-MachineAccountQuota</strong> değerinden bahsedelim. Bu değer active directory domain’lerinde herhangi bir kullanıcının domain içerisine ekleyebileceği yeni sistem “Computer Account” sayısını ifade etmektedir ve varsayılan olarak bu sayı 10&#39;dur. Bu varsayılan değer sayesinde bir domain içerisindeki her kullanıcı varsayılan olarak ilgili domain’e 10 adete kadar sistem (Computer Account) ekleyebilir.</p><p><strong>MS-RPRN</strong> protokolü ise Windows işletim sistemleri üzerinde yazıcı işlemlerine destek olmak için smb protokolü üzerinden çalışan fonksiyonlardan oluşmaktadır ve uzun yıllardır desteklenmekte olan bir yapıdır. MS-RPRN içerisinde yer alan <strong>RpcRemoteFindFirstPrinterChange- -NotificationEx</strong> fonksiyonu aynı ya da arada güven ilişkisi bulunan başka bir domain içerisindeki herhangi kullanıcı tarafından çağrılabilmektedir. Bu fonksiyon kötüye kullanılarak herhangi bir sistemin istenilen adrese smb protokolü üzerinden bağlanmaya çalışması sağlanabilmektedir. Konuyla ilgili detaylı bilgiye <a href="https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/d42db7d5-f141-4466-8f47-0a4be14e2fc1"><strong>buradan</strong></a> ulaşabilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPb23qS0FSZhcXqNUGOOVQ.png" /><figcaption><strong>RpcRemoteFindFirstPrinterChangeNotificationEx fonsiyonu çalışma akışı</strong></figcaption></figure><p>Active directory delegasyonlarından çok kısa bahsetmemiz gerekir ise; Unconstrained, Constrained ve Resource-Based Constrained delegation isimlerinde farklı delegasyon yapıları mevcuttur. İlk senaryomuz içerisinde Resource-Based Constrained Delegation yapısından faydalanacağız. Windows 2012 ile birlikte gelen bu özellik sayesinde servis ya da sistem hesapları, ek bir yetkiye ihtiyaç duyulmaksızın kendi başlarına (yalnızca kendi üzerlerinde) delege belirleme hakkına sahip olurlar. Constrained delegation yapısının teknik detaylarına burada değinmeyeceğiz ancak S4U, S4U2Self, S4U2Proxy adı verilen alt protokollerin yardımıyla çalışan bu yapının saldırganımız için fayda sağlayacak etkisi şu şekildedir: Herhangi bir Servis A, Servis B’yi delegesi olarak belirlediğinde, Servis B’nin kontrolünün ele geçirilmesi sonrası protokol içerisindeki fonksiyonlar istismar edilerek Servis A üzerinde istenilen herhangi bir kullanıcı haklarına erişmek mümkün olmaktadır.</p><p>Bu bilgiler ışığında izlenecek saldırı adımları aşağıdaki gibi olacaktır:</p><ul><li>Domain içerisinde ele geçirilmiş olan SWUSR01 hesabı kullanılacak ve SOUTHWEST domain’i ms-ds-machineAccountQuota değerinin sıfırdan büyük olması sayesinde, ilgili kullanıcının yetkileri ile domain’e hayali bir sistem eklenebilecektir. Bu sisteme MYTESTPC1 adını vereceğiz. Bir domain içerisine yeni (hayali) bir sistem hesabı eklemek için Kevin Robertson tarafından yazılmış olan PowerMad aracından faydalanabiliriz.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_oiIgHNbdCpBWg-xmFtVZg.png" /><figcaption>PowerMad Aracı ile SOUTHWEST domain’e yeni bir Sistem Hesabı eklenmesi</figcaption></figure><ul><li>Saldırı planımızın 2. adımında, SOUTHWEST domainine ait domain controller sisteminin kontrolümüz altında olan bir sisteme NTLM kimlik doğrulama ile bağlantı kurmaya çalışmasını istemekteyiz. <em>(Not: kontrolümüz altında olan sistemin ilgili domain’in trusted zone’u içerisinde olması gerekmekte.)</em>Amacımız domain controller sisteminden gelen NTLM kimlik doğrulamasını NTLM relay işlemine tabi tutabilmek. Bu şekilde ilgili kimlik doğrulamayı başka bir domain controller’a LDAP protokolü üzerinden ileterek domain controler’ı kendisi üzerinde constrained delegation belirlemeye zorlamak istiyoruz. Bu işlemi gerçekleştirmek için yukarıda anlatılan MS-RPRN fonksiyonunu kötüye kullanacak ve SOUTHWESTDC01 (SOUTHWEST domain controller) sisteminin kontrolümüz altındaki SWPC01&#39;e bağlantı kurması için ilgili <strong>RpcRemoteFindFirstPrinterChangeNotificationEx </strong>fonksiyonunu çağıracağız.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eX7voYD5fwcuNj9jLf_ZTA.png" /></figure><ul><li>SOUTHWESTDC01 sistemi SMB protokolü üzerinden bağlantı kurmak istediğinde NTLM kimlik doğrulama başlatmasını sağlayacak ve ilgili NTLM kimlik doğrulamayı da ikinci bir domain controller’a (SOUTHWESTDC02) doğru LDAP protokolü üzerinden kimlik doğrulama amacı ile ileteceğiz. Bu noktada SMB protokolünden LDAP protokolüne doğru NTLM relay işlemi gerçekleştiriyoruz ve normal ayarlarda SMB ve LDAP protokollerinin varsayılan imza (Signing) yapılarındaki uyumsuzluk sebebiyle NTLM relay işlememiz başarısız olacaktır. 2019 yılı ortalarında yayınlanan <strong>CVE-2019–1040</strong> zafiyeti ise bu uyumsuzluğun etrafından dolanmamızı sağlayabilecek, NTLM kimlik doğrulama paketleri içerisinde imza bütünlüğünün kontrolünde kullanılan Message Integrity Code (MIC) adı verilen alanın yok sayılmasına ve kimlik doğrulama işleminin devam edebilmesine olanak sağlayacaktır. Bu işlemler için Impacket kütüphanesinden faydalanabiliriz.</li><li>Saldırımız sırasında ilgili zafiyetten faydalanarak SOUTHWESTDC01 sistemi NTLM kimlik doğrulamasını LDAP protokolüne iletecek ve SOUTHWESTDC01 sisteminin kendisi üzerinde, kontrolünü elimizde bulundurduğumuz bir sistem/servis hesabı için <strong>Resource Based Constrained Delegation</strong> belirlemesini sağlayacağız. Kontrolünü elimizde bulundurduğumuz sistem hesabı olarak çalışmanın başında varsayılan haklarla yaratmış olduğumuz MYTESTPC1$ sistem hesabını (computer account) kullanacağız.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXKVTtabh5WFX0AOSYv6fA.png" /><figcaption>SMB -&gt; LDAP NTLM Relay</figcaption></figure><ul><li>İşlemin ardından MYTESTPC1$ hesabına verilmiş olan “Constrained Delegation” yetkisini kötüye kullanarak SOUTHWESTDC01 domain controller’ı üzerinde Administrator haklarına erişmek mümkün olmaktadır. Bu hakkı kullanarak SOUTHWESTDC01 sistemine bağlanacak, Directory Replication fonksiyonunu tetikleyecek ve SOUTHWEST\krbtgt hesabının NTLM hash’ini elede edeceğiz. Bu işlem için mimikatz aracının dc-sync fonksiyonunu kullanmak mümkündür.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32sa37llPQJ6b5wpARn8CQ.png" /><figcaption>SOUTHWESTDC01 Domain controller’ı üzerinde mimikatz ile DC-Sync işlemi</figcaption></figure><p>Aşağıdaki şekilde gerçekleştirilen adımlar özetlenmiştir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QlkDw94t0aq0fJKV7pAdVQ.png" /></figure><p>Bir domain içerisinde krbtgt hesabını elde ettikten sonra domain admin yetkilerini kullanabilir, herhangi bir sistem ya da servis’e erişmemizi sağlayacak bir golden ticket üretebiliriz. Bu noktada domain ve içerisindeki tüm sistemlerin kontrolü saldırganın eline geçmiş olur.</p><p>SOUTHWEST domain’i içerisinde domain admin yetkilerine ulaşmamız ile birlikte 1. bölümün sonuna geldik. <a href="https://medium.com/@gorkemkaradeniz/active-directory-zincirleme-senaryolar-bolum2-de84c7dd6c0d"><strong>Bir sonraki bölümde</strong></a> SOUTHWEST domain’inden forest root olan SOUTH domain’ine geçişi işleyeceğiz.</p><p><em>Yazı içerisinde işlenilen konular ile ilgili detaylı bilgi içeren bazı kaynaklar:</em></p><ul><li><a href="https://adsecurity.org/?p=4056">Domain Controller Print Server + Unconstrained Kerberos Delegation = Pwned Active Directory Forest</a></li><li><a href="https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/d42db7d5-f141-4466-8f47-0a4be14e2fc1">[MS-RPRN]: Print System Remote Protocol</a></li><li><a href="https://shenaniganslabs.io/2019/01/28/Wagging-the-Dog.html">Wagging the Dog: Abusing Resource-Based Constrained Delegation to Attack Active Directory</a></li><li><a href="https://www.harmj0y.net/blog/redteaming/another-word-on-delegation/">Another Word on Delegation</a></li><li><a href="https://github.com/gentilkiwi/mimikatz/wiki/module-~-kerberos">gentilkiwi/mimikatz</a></li><li><a href="https://github.com/Kevin-Robertson/Powermad">GitHub - Kevin-Robertson/Powermad: PowerShell MachineAccountQuota and DNS exploit tools</a></li><li><a href="https://github.com/SecureAuthCorp/impacket">GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27ad9583a5ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cobalt Strike ile Siber Saldırı Simülasyonu: Malleable Profile Kullanımı #3]]></title>
            <link>https://gorkemkaradeniz.medium.com/cobaltstrike-siber-saldiri-simulasyonu-malleable-profile-afc123ecdae2?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/afc123ecdae2</guid>
            <category><![CDATA[siber-guvenlik]]></category>
            <category><![CDATA[siber-güvenlik]]></category>
            <category><![CDATA[cobalt-strike]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 05:07:22 GMT</pubDate>
            <atom:updated>2019-09-23T05:07:22.756Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gnHxdo3m9npuJ50fxmp8Tg.png" /><figcaption>Cobalt Strike® Strategic Cyber, LLC</figcaption></figure><p>Bu yazı dizisinin önceki bölümlerinde siber saldırı simülasyonlarında kullanılan Cobalt Strike’ın temel komuta kontrol özelliklerine ve kullanılabilecek yönlendirici (redirector) yapısına değinmiştik. Henüz okumadıysanız <a href="https://medium.com/@gorkem.karadeniz/cobalt-strike-ile-siber-saldiri-simulasyonu-giris-64bc081fcbd3"><strong>1. ve</strong></a><strong> </strong><a href="https://medium.com/@gorkem.karadeniz/cobaltstrike-ile-siber-saldiri-simulasyonu-2-98f9e816e770"><strong>2. kısım</strong></a><strong>ları</strong> incelemek isteyebilirsiniz. Bu yazı kapsamında Cobalt Strike’ın Malleable Profile adı verilen ve hedef sistemdeki ajanın komuta kontrol merkezi (C2) ile olan iletişimin birçok özelliğinin farklılaştırılmasına olanak sağlayan yapısı incelenecektir.</p><p>Her bir Cobalt Strike Teamserver, kendisine bağlanan ajanlar (Beacon) ile haberleşmek için tek bir “Malleable Profile” kullanılabilmektedir. Bu nedenle farklı profillerde teamserver ile konuşan beacon’lar kullanmak isterseniz birden fazla teamserver çalıştırmanız gerekecektir. Daha önceden oluşturmuş olduğunuz bir profil dosyasını aşağıdaki gibi teamserver’ı başlatırken argüman olarak verebilirsiniz.</p><pre><strong>./teamserver [Dinlenilen Arayüz IP] [parola] [profil dosyası yolu]</strong></pre><p>Cobalt Strike’ın hedef sistem üzerinde çalışan ajanının iletişim özelliklerinden malleable profile ile değiştirebileceklerinize dair temel bilgiler Raphael Mudge tarafından <a href="https://www.cobaltstrike.com/help-malleable-c2">Cobalt Strike resmi sayfasında</a> da paylaşılmaktadır.</p><p>Temel bilgilerin ardından, ilk olarak varsayılan ayarlarda bir teamserver-beacon ikilisi için gerçekleşen “Reverse HTTPS” iletişimi, bir proxy aracı olan Burp Suite ile araya girerek inceleyeceğiz. Ardından farklı bir “Malleable Profile” kullanacağız ve iletişimleri burp suite aracılığı ile tekrar inceleyeceğiz. Son olarak ise bir senaryo kapsamında Beacon-C2 iletişim trafiğini Malleable Profile kullanarak özelleştireceğiz.</p><p>Aşağıdaki ekran görüntüsünde pwgen komutu ile üretilen rastgele şifre kullanılarak standart bir teamserver başlatılışı ve bu teamserver’a yapılan bağlantı gösterilmektedir (Not: İşlemler sistem lokalindeki sanallaştırma ortamında yapıldığı için görünen IP’ler 192.168.0.0/16 yerel IP segmentindendir) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*V_DGM1htYBJFyVDtWwqDgw.png" /></figure><p>Başlatılan teamserver’a bağlandıktan sonra, aşağıdaki gibi standart ayarlarda bir HTTPS reverse dinleyici oluşturulur:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*4ZthZJ018wRAn1ss0wq3-g.png" /></figure><p>Dinleyici (Listener) başlatıldıktan sonra, çalıştırılabilir formatta bir saldırı yükü (payload) oluşturulur ve hedef sistemde aşağıdaki gibi çalıştırılır. İlgili Beacon saldırı yükünün (Payload) çalıştırılması ile birlikte gerçekleşmeye başlayan iletişime dair Wireshark ve Burp Suite çıktıları görünmektedir. <strong><em>Not:</em></strong><em> Kolaylık açısından ekran kayıtları hızlandırılmıştır, beacon’un varsayılan ayarlarda her iletişimi arasında yaklaşık 1 dakikalık süre geçtiği zaman damgalarından anlaşılabilir.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFrjRgA3ePBR9Ll5ZfAjPg.gif" /></figure><p>Görüldüğü üzere varsayılan ayarlarda HTTPS Beacon komuta kontrol merkezine veri gönderimini “submit.php” URI’ına POST işlemi ile gerçekleştirmekte, komuta kontrol merkezinden görevlerini çekmek için ise “__utm.gif” adresini GET metodu ile kullanmaktadır. İlk yazımız içerisinde “Staged” saldırı yüklerinden bahsetmiştik. Burp Suite çıktısında görmekte olduğunuz “/d5Nv” URI’ına yapılan GET isteği saldırı yükünün adımlama / hazırlık (staging) işleminin tamamlanması için tek seferlik kullanılmaktadır. İlgili isteğe dönmekte olan yanıtın büyüklüğünden de bu durum anlaşılabilir. Varsayılan ayarlarda bu URI üretilen her saldırı yükü dosyası için farklı 4 karakterden oluşmaktadır. C2 komutlarını almak için kullanılan GET isteği ve hedef sistemden C2&#39;ya veri göndermek için kullanılan POST istekleri ise standart ayarlarda hep aynıdır. Client üzerindeki bir güvenlik ajanı ya da ağ içerisinde trafiğin geçmekte olduğu SSL inceleme (interception) özellikli bir aygıt tarafından bu varsayılan ve tahmin edilebilir iletişimlerin izlemeye yakalanması muhtemeldir. Malleable Profile’ın en temel faydası da payload iletişim imzalarını farklılaştırmada kullanılabilir olmasıdır.</p><p>Aşağıdaki ekran görüntüsünde hazırlık (staging) işlemi için gönderilen GET isteği detayları verilmiştir. Varsayılan ayarlarda kullanılan her Beacon için isteğe dair header bilgileri ve sunucudan gelen yanıtın yapısı aşağıdaki gibidir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4fQarMR5uWx85LV7XSCpA.png" /></figure><p>Benzer şekilde hedef sistemden komuta kontrol merkezine doğru gerçekleştirilen GET ve POST istekleri detayları da aşağıdaki gibidir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*qeVI6yLJDgKKsExIzZK1Ug.png" /><figcaption>Varsayılan Ayarlarda Beacon GET İsteği</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*vOuRt0HC874gDKk0SLco7w.png" /><figcaption>Varsayılan Ayarlarda Beacon POST İsteği</figcaption></figure><p>Varsayılan ayarlarda gerçekleştirilen HTTP(S) isteklerini ve parametreleri inceledikten sonra şimdi de HTTP(S) üzerinden geri dönüşlü bağlantı için basit bir Malleable profil dosyası oluşturmayı ve sonuçta ortaya çıkan iletişimdeki farklılıkları inceleyeceğiz. Ancak öncesinde Malleable profile dosyası yapısına kısaca göz atmamız faydalı olacaktır. Bu amaçla Raphael Mudge’ın kendi paylaşmış olduğu örneklerden birini inceleyeceğiz (<a href="https://github.com/rsmudge/Malleable-C2-Profiles/blob/master/normal/randomized.profile">Örnek olarak paylaşılan profil dosyalarına <strong>bu adresten</strong> ulaşabilirsiniz</a>).</p><p>Öncelikle iletişimimizin kullanacağı User-Agent bilgisini profile dosyası içerisinde aşağıdaki satır ile kontrol edebilmekteyiz.</p><pre>set useragent &quot;Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko&quot;;                                               </pre><p><em>Operasyonel Güvenlik (OPSEC) Üzerine Not: Olgunluğu yüksek kurumlarda test gerçekleştirirken hedef sistemler üzerindeki ajanların iletişimde kullanacağı User-Agent bilgileri, saldırı simülasyonlarının hızlıca fark edilmesine ve başarısız olmasına yol açabilir. Bunun bir sebebi bu kurumların kendi ağları içerisinde kullanılan tarayıcılar ve versiyonları standartlaştırma çalışmaları yapmaları nedeniyle, ajanımızın kullanacağı farklı bir User-Agent’ın izleme ekiplerine bir aykırılık “outlier” olarak alarm üretmesi olacaktır. Bu nedenle yapılacak çalışmalar öncesi keşif adımında hedef ağda kullanılan tarayıcıların türleri ve versiyonlarının öğrenilmesi ve sonraki safhalarda Ajan-C2 arası HTTP(S) protokolü üzerinden gerçekleştirilecek iletişimde bu User-Agent’ın kullanılması kritik önemde olabilir.</em></p><p>Ajan (Beacon) tarafından görevleri C2&#39;dan almak için GET isteğinin yapılacağı URI aşağıdaki gibi set uri komutu ile belirlenmektedir. Profil dosyası içerisinde “client” bölümü, beacon’un göndereceği HTTP(S) istekleri için ayarları içerirken “server” bölümü ise C2 sunucusundan dönülecek HTTP(S) yanıtları için ayarları içermektedir.</p><pre>http-get {       <br>          set uri &quot;/getadresi&quot;;                                                </pre><pre>   client {                         </pre><pre>        metadata {<br>                  mask;<br>                  base64url;<br>                  uri-append;<br>                 }         <br>   }<br>   server {                         <br>        header &quot;Content-Type&quot; &quot;text/plain&quot;;     <br>        output {                          <br>           prepend &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;<br>           mask;<br>           base64;<br>           print;<br>        }<br>   }<br>}                                               </pre><p>Yukarıda verilen malleable profil parçasında metadata komutu ile Beacon’dan C2&#39;ya gidecek olan üst-verinin(ajanın kendi yapısı ve sistem ile ilgili temel bilgi) aktarım ayarları düzenlenebilmektedir. Yukarıdaki profilde öncelikle bu üst-veri, mask komutu ile Beacon-C2 arası rastgele kararlaştırılmış bir XOR anahtarı ile şifrelenmekte, sonrasında URL’de kullanılabilecek yapıda base64 olarak encode edilmekte ve son olarak ilgili GET URI’ının sonuna direkt olarak eklenmektedir. Profil içerisinde “server” komutu ile ise; yapılacak GET isteklerine C2&#39;dan dönülecek olan yanıtın özellikleri belirlenmektedir. “prepend” komutu ile verilmiş olan karakter dizisi, komuta kontrol merkezinden (C2) dönülecek yanıtın önüne eklenmekte, mask komutu ile dönülecek yanıtın tamamı rastgele bir XOR anahtarı ile şifrelenmekte ve son olarak base64 komutu ile base64 endoce işlemi gerçekleştirilmektedir. Not: Malleable Profile içerisinde kullanılabilecek komutları ve parametreler ile ilgili temel bilgiye Cobalt Strike’ın <a href="https://www.cobaltstrike.com/help-malleable-c2"><strong>kendi sitesinden</strong></a> ulaşabilirsiniz.</p><p>Aşağıda görüldüğü gibi profilin devamında Beacon’dan komuta kontrol merkezine gönderilecek olan veriler için kullanılacak POST isteklerinin özelleştirme kuralları işlenmektedir.</p><pre>http-post {<br>set uri &quot;/postadresi&quot;;                        <br>set verb &quot;POST&quot;;                                                <br>client {                         <br>        header &quot;Content-Type&quot; &quot;application/x-www-form-urlencoded&quot;; <br>        output {                        <br>                mask;  <br>                base64url;<br>                uri-append;<br>        }                         <br>        id {<br>            mask;<br>            base64url;                          <br>            prepend &quot;v=&quot;;                          <br>            append &quot;&amp;button=submit&quot;;                          <br>            print;                         <br>        }                        <br>}                                                </pre><pre>server {                         <br>       header &quot;Content-Type&quot; &quot;text/plain&quot;;<br>       output {                          <br>              prepend &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;<br>              mask;                          <br>              base64;                          <br>              print;                         <br>       }                        <br>}<br>                       <br>}</pre><p>Yukarıdaki profil parçasında ajandan (Beacon) komuta kontrol merkezine (C2) doğru gerçekleştirilecek POST isteklerinde header alanına “<em>Content-Type: application/x-www-form-urlencoded” </em>bilgisi eklenmektedir. Eklenen bu HTTP header’ın ardından gerçekte iletilmesi istenen veri “output” komutu ile belirtilmekte ve bu verinin rastgele bir XOR anahtarı ile şifrelenmesi, base64 olarak encode edilmesi ve URI’a eklenerek gönderilmesi ayarları gerçekleştirilmektedir. “output” komutundan sonra ikinci komut olan “id” ise Cobalt strike yapısı gereği ilgili beacon’ın hangi oturum ile bağlı olduğunun anlaşılmasını sağlayan veriyi ifade etmektedir. Yukarıdaki profilde id bilgisi XOR anahtarı ile şifrelendikten sonra URL’e uygun şekilde base64&#39;e çevrilmekte ve ardından bu base64 veriyi POST isteği gövdesine (Body) “<strong><em>v=&lt;ŞİFRELİ_BASE64_DEĞER&gt;&amp;button=submit”</em></strong> biçiminde eklemektedir Yapılacak POST isteklerine sunucu tarafından dönülecek yanıtın içeriğine ise aynı GET isteği için olduğu gibi belirli bir karakter dizisi eklenmekte, bu içerik XOR anahtarı ile şifrelenmekte ve base64 olarak çevrilerek yanıt gönderilmektedir.</p><p>Bu profilin kullanıldığı bir Cobalt Strike beacon trafiği aşağıdaki gibi olmaktadır:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QwjIn3MPtptcrSKJztxv3A.png" /><figcaption>Örnek Malleable Profile Beacon Trafiği</figcaption></figure><p>Trafik çıktısında görüldüğü üzere, Beacon hedef sistemde çalıştıktan sonra C2 ile iletişimini profil ayarlarına uygun şekilde kurmaktadır. İlk istek hazırlama/basamaklama (staging) isteğidir ve ayarlanan profil içerisinde staging aşaması için bir özelleştirme yapılmamış olduğu için varsayılan URI üzerinden varsayılan ayarlarla gerçekleşmiştir. Sonraki GET ve POST isteklerinin ise profil içerisinde belirtildiği şekilde gerçekleştiği trafik çıktısında görünmektedir. <em>Not: Yukarıdaki trafik çıktısına bakıldığında 140. istekten 144. isteğe kadar arka arkaya POST istekleri yapılmış olduğu fark edilebilir. Bu durumun nedeni Malleable profile içerisinde Beacon’dan C2&#39;ya gönderilecek verilerin (çalıştırılan komut çıktıları vs.) POST isteği gövdesi yerine URI’da gönderilmeye ayarlanmış olmasıdır. Cobalt Strike Beacon otomatik olarak URI içerisinde tek bir isteğe sığmayacak boyutta olan verileri birden fazla isteğe bölerek göndermektedir.</em></p><p>Temel komutları öğrendikten sonra, yazımızın devamında canlı bir örneği inceleyeceğiz. Saldırgan bakış açısıyla, öncelikli amacımız komuta kontrol yapısı ile beacon arasındaki iletişimi olabildiğince gerçek web gezintisi trafiğine benzeterek, sistemden gerçekleştirilen mevcut internet trafiği içerisinde kaybolacak şekilde düzenleyebilmek olduğundan, örnek bir web sayfası seçecek ve beacon trafiğini Malleable profile yardımıyla bu web sayfası ile kurulan iletişime benzeteceğiz.</p><p>Bu kapsamda trafiğimizi benzeteceğimiz web sayfasının nispeten çokça trafik alan <strong><em>https://www.msn.com/tr-tr/haber</em></strong> olduğunu varsayalım. Bu URI altında gündeme dair bir haber ziyaret edildiğinde, standart olarak gönderilen isteklerin neler olduğunu incelemek için yine bir “Interception Proxy” aracı kullanabiliriz. <a href="https://www.msn.com/tr-tr/haber"><strong><em>www.msn.com/tr-tr/haber</em></strong></a><strong><em> </em></strong>adresinde farklı haberler için gezinti trafiğini incelemeye başladığımızda aşağıdaki işaretli isteklerin her girilen haber için farklı parametreler ile de olsa tekrarladığını görebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0CR_MjtaCv65STKdBDvcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRovOWdkroyoTir7wvZWeg.png" /></figure><p>Bu tekrarlayan GET ve POST isteklerinden birer tane seçerek, https üzerinden iletişim sağlayacak bir beacon için Malleable profile’ımızı oluşturmaya başlayabiliriz.</p><p>Öncelikle aşağıdaki GET isteğini ve sunucudan dönen yanıtı inceleyecek ardından da ilgili GET isteği için Malleable profile’ımızı oluşturacağız. Aşağıda gerçek HTTP GET isteğinin Header ve parametre yapısı görülebilmekte.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fa_YxrYGco3NaNg43a0BXA.png" /></figure><p>Bu GET isteği içerisindeki <strong>PreferencesMsn</strong> Cookie değeri base64 encoded ve Beacon tarafından gönderilmekte olan üst veri (metadata) için uygun bir uzunluğa sahip. Bu nedenle oluşturulan profil içerisinde metadata aktarımı amacıyla bu alanı kullanabiliriz. <em>Not: Bu yazı içerisindeki önceliğimiz örnek kapsamında istek ve yanıttaki tüm alanları eksiksiz biçimde profile aktarmaktan ziyade konunun anlaşılır olmasını sağlayacak şekilde Beacon isteğinin özelleştirilmesini sağlayacak konfigürasyonu profil dosyasına dahil etmektir.</em></p><p>Ek olarak Cobalt Strike Malleable profile kapsamında yapabileceğimiz konfigürasyonlara dair limitler de mevcuttur:</p><p><strong>Örneğin bu yazının yazıldığı tarihte Cobalt Strike “Malleable Profile” istemci tarafındaki GET ve POST istekleri için 252 byte’dan daha büyük konfigürasyonları kabul etmemektedir.</strong></p><p><strong>Cobalt Strike ajanın periyodik yapmakta olduğu GET isteklerine döneceği yanıtın response gövdesinde olmasını beklemekte ve ilgili verinin header alanına yazılmasına müsaade etmemektedir.</strong></p><p>Belirtilen limitler dahilinde Beacon-C2 arası GET istekleri için aşağıdaki gibi bir profil oluşturulabilir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_NnoulmGZ3DsYBv3Q5hCaA.png" /></figure><p>HTTP GET için konfigürasyonları gerçekleştirmemizin ardından POST için de benzer ayarlar üzerinde çalışmaya başlayabiliriz. Aşağıda seçtiğimiz POST isteğinin bir kısmını görebilirsiniz, bu POST isteği için de Cobalt Strike sınırları dahilinde benzer bir profil oluşturulacaktır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kDEP8cLMBGT4BHerXUPLSA.png" /></figure><p>Öncelikle Cobalt Strike Beacon tarafından gerçekleştirilen her POST isteğinde ilgili oturuma dair session-id değerinin komuta kontrol merkezine (C2) iletilmesi gerekmektedir. Bu amaçla URI içerisindeki “contentId” parametresini kullanmak uygun görünmekte (Uzunluk ve şekil bakımından base64 bir session Id bilgisi taşıması gerçek isteğin yapısına benzer bir sonuç yaratacaktır). Malleable profile içerisinde bu konfigürasyon <strong>id </strong>komutu ile kontrol edilir. Ayrıca gerçekleştirilen her POST isteği ile, Beacon tarafından hedef sistem üzerinde çalıştırılan komutların sonuçlarının C2 ile paylaşılması gerekiyor. Bu veriyi de Malleable Profile içerisinde ouput komutu ile kontrol etmekteyiz. Bu amaçla oluşturduğumuz profil dosyasının POST işlemleri ile ilgili parçasını aşağıda görebilirsiniz. (Not: 252 byte sınırı sebebiyle Beacon tarafından yapılacak isteklerin URL, Header ve Body bölümleri kısaltılmıştır.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZLb3-A3pUynp3PO1YtMMg.png" /></figure><p>Oluşturulan bu profili kullanan bir Cobalt Strike ajanının komuta kontrol merkezi ile gerçekleştirdiği iletişim aşağıdaki ekran kaydında paylaşılmaktadır. Ajan tarafından gerçekleştirilen GET / POST istekleri ve bu isteklere dönülen yanıtların profile içerisinde ayarlandığı şekilde değişmiş olduğu görülebilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BeHR4wRLGibTJwKcaSfJcg.gif" /></figure><p>Bu yazı içerisinde Cobalt Strike ile siber saldırı simülasyonlarında beacon trafiğini Malleable Profile özelliğini kullanarak farklılaştırma konusunu inceledik ve iki farklı örnek profil oluşturduk.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afc123ecdae2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SharePoint CVE-2019–0604 RCE Exploitation]]></title>
            <link>https://gorkemkaradeniz.medium.com/sharepoint-cve-2019-0604-rce-exploitation-ab3056623b7d?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab3056623b7d</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[sharepoint]]></category>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[vulnerability]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Thu, 09 May 2019 22:50:06 GMT</pubDate>
            <atom:updated>2019-05-13T06:59:57.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOjPFOjIPKFDj887T01eAw.png" /></figure><p>This vulnerability affects most versions of Microsoft SharePoint 2019, 2016, 2013 and 2010. Microsoft initially released a patch in February but then realized that the vulnerability still existed for some conditions and released another patch to finally mitigate the vulnerability.</p><p>Basically this vulnerability is caused by uncontrolled deserialization of data coming from outside the application. Thus the attacker becomes able to inject an object of his/her control into the web application code flow and achieves code execution.</p><p>Many details (function stack trace/entry points/name of vulnerable functions) on this vulnerability have been disclosed by <a href="https://www.thezdi.com/blog/2019/3/13/cve-2019-0604-details-of-a-microsoft-sharepoint-rce-vulnerability"><strong>Zero Day Initiative</strong></a> in March and the writing is publicly accessible. Moreover, there is a basic POC code on <a href="https://github.com/linhlhq/CVE-2019-0604"><strong>Github </strong></a>that directly uses SharePoint dynamic library to show the deserialization part of the vulnerability. To the best of our knowledge there were no publicly available ready-to-use exploit codes at the time of this writing. The main reason for this writing is that although this vulnerability is being exploited in the wild, it is shown as not publicly disclosed / not exploitable <a href="https://www.tenable.com/cve/CVE-2019-0604">by vulnerability <strong>scanners</strong></a> and<strong> </strong><a href="https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0604"><strong>resources</strong></a> on the Internet. Tenable is showing the vulnerability as not exploitable, <a href="https://www.securityfocus.com/bid/106914/exploit"><strong>SecurityFocus</strong></a> states there are no known exploits, Microsoft MSRC states the exploit is not publicly disclosed etc. However, it is possible to craft an exploit for this vulnerability by inspecting the vulnerable SharePoint library and utilizing the detailed explanation by ZDI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u46LMtvyezmKyhKbM-sfCw.png" /><figcaption>SecurityFocus CVE-2019–0604</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3UTnjQU9gE2roVpGxssvg.png" /><figcaption>Microsoft MSRC CVE-2019–0604</figcaption></figure><p><strong>In order to show the effect of this vulnerability I have developed a simple exploit code. It is possible to see the exploitation below. Each time the exploit is run, it sends a request to the SharePoint server and a calculator process is spawned.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*htrIRd-sesgjCgRZ8PbHdg.gif" /></figure><p>The privilege of code execution depends on the account SharePoint application is running with. In the below example, the crafted exploit code is weaponized to carry a Cobalt Strike payload. You can see the spawned powershell process in the target system task manager just before the start of beacon connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0axiJuv9nP6jSvUzmGa60A.gif" /></figure><p>As this vulnerability makes it possible to execute code over HTTP requests on the SharePoint servers with most versions from 2010 to 2019 and since the exploitation is relatively complication free, it poses a high security risk.</p><p><strong>If you have not applied it already, you should apply the patch that Microsoft has released in March as soon as possible to internet facing SharePoint servers.</strong></p><p><em>10.05.2019 </em><strong><em>Edit</em></strong><em>: There is more information about this vulnerability being exploited in the wild:</em></p><ul><li><a href="https://otx.alienvault.com/pulse/5cd3f89df12b501c477a6fba">Attacks Exploiting Sharepoint CVE-2019-0604 - AlienVault - Open Threat Exchange</a></li><li><a href="https://cyber.gc.ca/en/alerts/china-chopper-malware-affecting-sharepoint-servers">Canadian Centre for Cyber Security</a></li><li><a href="https://www.zdnet.com/article/microsoft-sharepoint-servers-are-under-attack/">Microsoft SharePoint servers are under attack | ZDNet</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab3056623b7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SharePoint CVE-2019–0604 İstismarı ile Uzaktan Komut Çalıştırma]]></title>
            <link>https://gorkemkaradeniz.medium.com/sharepoint-uzaktan-kod-calistirma-67cb7d94c9c1?source=rss-65ec247db1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/67cb7d94c9c1</guid>
            <category><![CDATA[zafiyet]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[sharepoint]]></category>
            <dc:creator><![CDATA[Gorkem Karadeniz]]></dc:creator>
            <pubDate>Thu, 09 May 2019 14:44:06 GMT</pubDate>
            <atom:updated>2019-05-11T11:44:56.402Z</atom:updated>
            <content:encoded><![CDATA[<h3>SharePoint CVE-2019–0604 Zafiyeti ile Uzaktan Komut Çalıştırma</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOjPFOjIPKFDj887T01eAw.png" /></figure><p>İlk olarak Şubat ayında Microsoft tarafından yaması yayınlanan (ve daha sonra yamanın eksik olduğu anlaşılıp, Mart ayında tekrar yayınlanan) bu zafiyet IIS üzerinde çalışmakta olan SharePoint 2019/ 2016 / 2013 / 2010 sistemlerini <a href="https://nvd.nist.gov/vuln/detail/CVE-2019-0604#vulnConfigurationsArea">etkilemektedir</a>.</p><p>Zafiyetin ana nedeni, uygulamaya dışarıdan gelmekte olan bir verinin kontrolsüz bir şekilde “deserialize” edilerek uygulama için geçerli bir nesneye çevrilebilmesidir. Bu tür zafiyetler saldırganın uygulama kod akışı içerisine kendi kontrolünde bir nesne yerleştirerek kod akışına müdahale edebilmesine neden olmaktadır.</p><p>İlgili zafiyetin giderilmesini sağlayacak yama Mart ayında Microsoft tarafından yayınlanmıştır. Bu spesifik zafiyeti, yazının konusu yapan temel durum ise mevcut durumda internet üzerinde <a href="https://cyber.gc.ca/en/alerts/china-chopper-malware-affecting-sharepoint-servers">aktif kullanımda</a> olan kötü amaçlı kişi/gruplar olmasına rağmen ilgili bildiri sayfalarında aşağıda görüldüğü gibi bilinen bir istismar kodu yok olarak belirtilmesidir. Bu durum yama ve zafiyet yönetimi süreçlerinde ilgili zafiyetin giderilmesinin geri plana atılmasına neden olabileceğinden risk teşkil etmektedir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u46LMtvyezmKyhKbM-sfCw.png" /><figcaption>SecurityFocus CVE-2019-0604</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3UTnjQU9gE2roVpGxssvg.png" /><figcaption>Microsoft MSRC CVE-2019–0604</figcaption></figure><p>Mart ayında Zero Day Initiative (ZDI) bu zafiyet ile ilgili bir yazı yayınlamış ve zafiyete dair incelemelerini internet üzerinden açıkça paylaşmıştır. İlgili yazı içerisinde zafiyete dair detaylı açıklamalar (Sharepoint kütüphanesi içerisinde etkilenen fonksiyon / yığın izleme detayı (stack trace)) paylaşmış olsalar da direkt olarak kullanılabilir bir istismar kodu paylaşılmamıştır. Benzer tarihlerde github üzerinde bir hesaptan da sharepoint dinamik kütüphanesi kullanılarak, zafiyete sebep olan fonksyonun çalıştırıldığı bir kavram ispatlama (proof of concept) kodu <a href="https://github.com/linhlhq/CVE-2019-0604">yayınlanmış </a>ancak yine hazır şekilde kullanılabilecek hazır bir istismar kodu paylaşılmamıştır. <a href="https://www.thezdi.com/blog/2019/3/13/cve-2019-0604-details-of-a-microsoft-sharepoint-rce-vulnerability"><strong>ZDI tarafından yazılan detaylı açıklamalar</strong></a><strong> okunduğu ve ilgili SharePoint dinamik kütüphanesi incelendiği taktirde istismar kodunu oluşturmak mümkündür.</strong> Yazının başında da belirtildiği üzere ilgili zafiyetin aktif olarak kullanıldığına dair bilgiler mevucttur.</p><p>İstismar kodu oluşturulduktan sonra, zafiyetin istismar kolaylığını ve risklerini göstermek amacıyla kurmuş olduğum bir Sharepoint sistemine hazırlanan istismar kodu ile gerçekleştirilen saldırıya ait ekran görüntüsünü aşağıda bulabilirsiniz. Bu örnekte, saldırgan sharepoint sistemine HTTP(s) protokolü üzerinden erişmektedir ve istismar kodunu kullanarak sistem üzerinde uzaktan komut çalıştırma hakkı elde eder. Örnekte hedef sistemde çalıştırılan komutlar ile birlikte art arda calc.exe process’lerinin çalışmaya başlaması görülebilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*htrIRd-sesgjCgRZ8PbHdg.gif" /><figcaption>CVE-2019–0604 Uzaktan Komut Çalıştırma (Hesap makinesi ile POC)</figcaption></figure><p>Bu uzaktan komut çalıştırma zafiyeti ile elde edilecek yetki seviyesinin, ilgili Sharepoint uygulamasının çalışmakta olduğu haklara bağlı olduğu unutulmamalıdır. Aşağıdaki örnekte ise geliştirilen istismar kodu içerisine powershell tabanlı bir reverse shell payload yerleştirilmiştir. Bu payload hedef sistemin Cobalt Strike sunucusuna bağlantı gerçekleştirmesini sağlamaktadır (<em>Not: Görselde zaman hızlandırılmıştır</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0axiJuv9nP6jSvUzmGa60A.gif" /><figcaption>CVE-2019–0604 Uzaktan Komut Çalıştırma ile Cobalt Strike Reverse Shell elde etme</figcaption></figure><p>Yazı içerisinde bahsedilen SharePoint deserialization zafiyetinin istismar tesirinin yüksek olması, etkilediği versiyon miktarının fazlalığı ve -test edilebildiği kadarıyla- hedef sistemde servis dışı bırakmaya sebebiyet vermeden komut çalıştırmaya uygun olması nedeniyle ilerleyen günlerde kötü amaçlı kullanımının daha yaygınlaşabileceği çıkarımı yapılabilir. <strong>Bu nedenle, eğer henüz geçilmedi ise özellikle internet üzerinden erişim sağlanan sharepoint sunucularına ivedilikle Microsoft’un çıkarmış olduğu yamaların geçilmesi önerilmektedir.</strong></p><p><em>10.05.2019 Ek: İlgili zafiyetin çeşitli gruplarca istismarına dair bilgiler:</em></p><ul><li><a href="https://otx.alienvault.com/pulse/5cd3f89df12b501c477a6fba">Attacks Exploiting Sharepoint CVE-2019-0604 - AlienVault - Open Threat Exchange</a></li><li><a href="https://www.zdnet.com/article/microsoft-sharepoint-servers-are-under-attack/">Microsoft SharePoint servers are under attack | ZDNet</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67cb7d94c9c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>