ransomware and segmentation

Lowering and Mitigating Lateral Movement Risk for Ransomware

Share on facebook
Share on twitter
Share on linkedin

After a few tumultuous weeks filled with ransomware news – from companies such as Colonial Pipeline and JBS being hit, to the U.S. White House releasing a memo in which it has clearly mentioned the power of segmentation against such attacks, it is vividly clear that ransomware is now on everyone’s radar – from the government, to companies trying to protect themselves, to the threat actors themselves trying to find new ways of compromising networks for profit. We in Guardicore agree with the White House memo and believe that segmentation is one of the best weapons a defender has today against ransomware attack.

Unlike EPP/EDR platforms which are dependent on the implementation of detection logic, with a properly configured segmentation policy, a packet either goes on the wire – or it doesn’t, in the most binary way possible. The incidents of the last few months have bolstered our belief in the importance of segmentation and making it accessible and easy to implement for every organization, big and small. In this post, which is a follow up to our previous post, we will take a more technical approach, detailing the best steps you can take to improve your segmentation knowledge and approach and to protect against lateral movement in ransomware attacks.

As discussed in our previous blog post – lateral movement is a critical stage in an attack in which the threat actors are moving in between machines and servers, utilizing various tools and authenticating with different credentials in order to gain a deeper foothold in the victim’s network and to move from computer to computer. Mitigating the risk of lateral movement has long bothered security professionals because of how hard it is to mitigate, and yielded multiple techniques and approaches, but as for reducing the attack surface of your organization, the best method to do that, without a doubt, is segmentation.

In this post, we will go over different lateral movement techniques used by ransomware operators and demonstrate how Guardicore’s approach to segmentation can significantly reduce, if not completely eliminate, the risk of lateral movement in your organization.

Tools of the trade

In order to propagate in a network, attackers must have a few things:

  • Knowledge of the network’s structure.
  • Sufficient credentials.
  • A way to launch processes remotely.
  • A “staging area” from which data will be exfiltrated.

Knowledge of the network’s structure

Once an attacker compromises a machine in a network, they will have to understand what is “within the reach” of the compromised machine, meaning, which other computers are accessible to/from that machine. This can be achieved by using various network scanning techniques and tools, from anything basic such as an nmap TCP scan to more advanced methods such as SMB share scanning and mapping.

Guardicore Centra has methods to detect and alert on such activities:

  • Scan Tool Detection – Centra knows to identify common network scanning tools (such as nmap) based on the executable itself, and raise corresponding security incidents alerts inside the system.
  • Scan Behavioral Detection – As network scans are done by connecting to multiple addresses over various (usually unsuccessfully as most are down) over a short period of time, this creates a pattern that is detected by our systems. Indeed, Centra has a special incident type, called Network Scan Incidents that can show exactly that. Moreover, Centra can differentiate between wide network scans and host port scans, based on the amount of ports and machines that participate in the scan.

In addition, Guardicore’s Threat Hunting service – Guardicore Hunt, can also detect those events by analyzing the neighbors of each machine in the network. By continuously monitoring the network, our system can detect anomalies and spikes in the neighboring and connecting machines, which is what happens in network scans.

Network scan for incidents
Visual network scan for incidents in Guardicore Hunt

Guardicore can not only help detect such events, but can also help in mitigating and preventing them. To make sure that an attacker cannot scan and move laterally across machines, it is important to adopt a Zero Trust approach by which a computer can and should only be able to connect to servers/computers which are necessary.

Recommendations

  • Segmentation and separation between applications and sections inside the network are the immediate way to reduce the attack surface, especially between workstations.
    • For example, there is no reason that someone from finance will need direct access to a computer of someone from R&D. There are always communication channels that should be allowed (email, Slack, Zoom etc…) but direct computer to computer access should be discouraged and controlled. Exceptions can be made on a case-by-case basis, but not across the board.
    • The same can be said for servers and applications even inside the same section (i.e microsegmentation). Not everyone needs to access each and every server, and the access ports and protocols can and should be controlled. This way, you restrict access to only a handful of approved protocols, and they usually won’t be those that are used by attackers to move around.
    • To relate this to real life, according to this report by Varonis, Darkside ransomware operators use RDP to move around the network. Segmenting and microsegmenting RDP access to only key users and machines should greatly impair their ability to move around.
  • Powerful and privileged users (i.e Domain Admins) should be contained and restricted in the usage. An attacker that gets ahold of one can wreak havoc in the network, so restricting those users to operate from dedicated machines should minimize the damage that an attacker can do if they get them.
  • Direction should also be considered; While user workstations need to access most servers, the opposite isn’t true. Except IT/Monitoring servers and Domain Controllers, most servers “serve”, and blocking the outgoing route from them shouldn’t hinder network operability while limiting attackers’ playing field.
  • Block all unnecessary SMB and RPC connections to and from relevant assets
  • Secure network shares as much as possible – make sure that permissions are set correctly between different shares.

Looking at this excerpt from this great report by thedfirreport.com we can see that one of the first actions performed by REvil when breaching a network is conducting basic network reconnaissance by using tools that are built in to windows:

Excerpt from https://thedfirreport.com/2021/03/29/sodinokibi-aka-revil-ransomware/

Many of these commands, such as net.exe and wmic will give the attacker the ability to see if there are any security tools (such as an Antivirus) installed or to inspect the various trust relationships between various machines and servers on the work along with what other machines are accessible via SMB through the attacked machine – A proper segmentation policy will prevent an attacker to gain any insights about your network from a very early stage of the attack.

Sufficient credentials

When an attacker wants to move laterally across a network, they must have either a highly privileged user such as a domain administrator or alternatively, a regularly-privileged user with sufficient permissions to the right places.

Attackers often use credential manipulation tools such as Mimikatz to export and steal credentials, these tools don’t discriminate between authentication methods, be it NTLM, Kerberos, Oauth, etc…

Nothing hurts lateral movement more than implementing a proper segmentation policy and two-factor authentication where possible. An attacker’s “blast radius” is only as big as the attack surface that you provide them with – minimizing that attack surface with segmentation will have a direct effect on your chances of successfully mitigating serious risk to your network.

⚠️ Note: Ransomware attackers such as REvil are relying heavily on dumping credentials and using them to move laterally across the network. Please make sure to read our recommendations below regarding proper credential hygiene.

Recommendations

  • Implement 2FA where possible – this makes the task of lateral movement significantly harder
  • Make sure that no user on the network has more access than they need to have
  • IT staff should never use their privileged account for day-to-day work:
  • IT staff should have their own regular low privileged users for day-today work and should only use high-privileged accounts when necessary for IT work
  • User log-on times and work hours can be monitored and enforced.
    Attackers may try to avoid the risk of interfering with an active user, thus raising flags that something is wrong. Instead, they might bide their time to do some operations when the network is quiet, and reaction times are longer. By monitoring or restricting logon times, it makes it harder for attackers to operate undetected, and increase their friction points with the network. This can be done through configuration or analytically.
    • Windows allows setting logon times for each domain user. It is also possible to logout or lock users outside of their allowed period through the group policy.
    • There are services and applications that can monitor logon times for users over time, and alert on users that operate outside the norm. Guardicore Hunt (Guardicore’s Threat Hunting service) includes a method for alerting on such behavior.

A way to launch processes remotely

Once an attacker has managed to compromise the victim’s credentials and gain access to multiple machines, it is now time to use this access in order to launch processes, such as a ransomware or a malware payload, on the compromised machines. This can be achieved in multiple ways, the most popular being psexec, various wmi techniques, winrm, etc…

Some of the tools that are used for these tasks, such as psexec,  were actually developed by Microsoft as advanced IT administration tools and are often being misused by attackers for nefarious purposes. These tools are often based on a concept of utilizing one of Windows’ remoting mechanisms (such as the aforementioned protocols)  which is why it is often challenging to block these tools and/or protocols.In many organizations the IT staff are leveraging such tools to “keep the lights on” and to administer the machines in the organization.

Recommendations:

  • It is important to apply a segmentation policy that only allows a very specific and minimal subset of users and machines to leverage these management applications, thus significantly reducing the chance of an attacker successfully using these tools for their own purpose – see previous section about scanning.
  • Monitor the machine for processes that are running under a different user than the one who is already logged in, or additionally, processes that are running under a user with administrative privileges

A “staging area” from which data will be exfiltrated

In some cases, once attackers   find the files  they are after, they will have one central place where they would copy said files prior to their exfiltration – this could be a specific directory on one of the compromised machines. This usually happens since attackers might be moving laterally from machine to machine and need to have all the files in one place before exfiltrating them. There are many ways to exfiltrate files:

  • Files could be exfiltrated manually, one by one, simply by copying them and pasting them outside an RDP session (if the attackers are indeed using RDP).
  • Files could be uploaded to a cloud hosting provider such as dropbox/Google drive/Mega.
  • Files could be uploaded to an attacker controlled FTP site.

However, it is important to remember that this isn’t always the case and attackers could exfiltrate the files individually and not from one central place – this depends on the attacker’s approach and tools.

Note: In many cases, attackers are adding an additional step before exfiltrating the files which is compression. In case the attackers wish to exfiltrate a large amount of files outside of the organization, they will put all the files in one directory and compress them in order to reduce the amount of files being exfiltrated to one signal archive and also in order to keep the size of the exfiltrated data low due to the file compression.

Recommendations:

  • Prevent machines from connecting to file-sharing websites/services unless necessary.
  • Unless it is  necessary, prevent the installation and communication of file-sharing services clients (such as the Google Drive/Dropbox file sync agent) from contacting their servers.
  • Disable Admin$ and C$ file shares.

Properly segmenting SMB and disabling the aforementioned shares is a critical step since attackers, such as REvil are often using these shares to transfer tools and malware in-between machines, as can be seen from this excerpt from the same report from thedfirreport.com

Excerpt from https://thedfirreport.com/2021/03/29/sodinokibi-aka-revil-ransomware/

Note the use of the ADMIN$ SMB shares, these are hidden network shares that are only accessible with the proper administrative credentials. You can read more about these shares on Mitre’s ATTACK framework website.

Reducing the Attack Surface

All of the activities that we described above, that are used by attackers in their journey to compromise the network, can be considerably mitigated and prevented, and their damage scope reduced, by using segmentation and enforcing user activity. Below, we list our general recommendations for such mitigation measures:

Segmentation

  • Create segmentation and separation between different applications and sections inside the network, especially between workstations.
    • For example, there is no reason that someone from finance will need direct access to a computer belonging to someone in R&D. There are always communication channels that should be allowed (email, Slack, Zoom etc…) but direct computer-to-computer access should be discouraged and controlled. Exceptions can be made on a case-by-case basis, but not across the board.
    • The same can be said for servers and applications even inside the same section (i.e microsegmentation). Not everyone needs to access each and every server, and the access ports and protocols can and should be controlled. This way, you restrict access to only a handful of approved protocols, and they usually won’t be those that are used by attackers to move around.
  • Direction should also be considered; While user workstations need to access most servers, the opposite isn’t true. Except IT/Monitoring servers and Domain Controllers, most servers “serve”, and blocking the outgoing route from them shouldn’t hinder network operability while limiting attackers’ playing field.
  • Use Zero Trust principles when building the network policy
    • Make sure that no user on the network has more access than they need to have, whether to different servers (identity-based segmentation) or resource (identity-based acls)
  • Remote management protocols and applications should only be allowed from a very specific and minimal subset of users and machines, thus limiting who can leverage these management applications, and significantly reducing the chance an attacker can successfully use these tools for their own purpose.
  • Prevent machines from connecting to file sharing websites/services unless necessary, so attackers will have a harder time transfering files through them.

User Activity Monitoring

As we mentioned earlier, the aspect of highly privileged users 

  • Powerful and privileged users (i.e Domain Admins) should be contained and restricted in the usage. An attacker that gets ahold of one can wreak havoc in the network, so restricting those users to operate from dedicated machines should minimize the damage that an attacker can do if they get them.
    • To that effect, IT staff should never use their privileged account for day-to-day work – they should have their own regular low privileged users for day-today work and should only use high-privileged accounts when necessary for IT work
  • User log-on times and work hours can be monitored and enforced.
    Attackers may try to avoid the risk of interfering with an active user, thus raising flags that something is wrong. Instead, they might bide their time to do some operations when the network is quiet, and reaction times are longer. By monitoring or restricting log-on times, it makes it harder for attackers to operate undetected, and increase their friction points with the network. This can be done through configuration or analytically.
    • Windows allows setting logon times for each domain user. It is also possible to logout or lock users outside of their allowed period through the group policy.
    • There are services and applications that can monitor logon times for users over time, and alert on users that operate outside the norm. Guardicore Hunt (Guardicore’s Threat Hunting service) includes a method for alerting on such behavior.
  • To try and detect lateral movement and compromised users, monitor machines for processes that are running under a different user than the one who is already logged in, or additionally, processes that are running under a user with administrative privileges when they shouldn’t.

Administration

  • Disable the default network shares (Admin$, C$ etc..) through Windows’ Registry or Group Policy, instead (or in addition ) of trying to segment all SMB traffic in the network.
  • Prevent the installation and communication of file sharing services clients (such as the google drive/dropbox file sync agent) from contacting their servers.
  • Implementing 2FA where possible.

From Guardicore's
Resource Center

Join this webinar as Forrester Senior Analyst David Holmes and Guardicore CEO, Pavel Gurvich discuss the common misconceptions surrounding microsegmentation and how it is the unsung hero of reducing ransomware risk.
Managed threat hunting delivered by Guardicore Labs
 

Subscribe To Our Newsletter

No spam, we promise. We’re only going to send you insights on how to reduce risk in your data center and clouds.

See Centra in Action

Reduce your attack surface and prevent lateral movement with fast and simple segmentation that works everywhere.

See Guardicore Centra in Action

Schedule a demo customized to your specific security needs