How to prevent ransomware attacks
How to prevent ransomware attacks is one of the main cybersecurity questions for companies, government organizations, and private users. Ransomware locks access to files and systems and then demands a ransom. This article explains how to reduce the risk of infection, protect backups, train employees, configure computers, and prepare a response plan. The main goal is not just to install antivirus software but to build a multi-layered defense where the failure of one tool does not lead to disaster.
What is ransomware and why is it dangerous
Ransomware is a type of malware that encrypts files on a computer, server, or network storage. After that, the attackers demand money for the decryption key. Modern attacks often involve not just blocking data. Criminals may preemptively steal documents, correspondence, client databases, and accounting files, and then threaten to publish them.
The danger of ransomware lies in the fact that an attack affects several levels of operations:
- employees cannot open documents and applications;
- accounting, CRM, ERP, and email become inaccessible;
- production, logistics, or sales are halted;
- recovery takes time, expertise, and clean backups;
- data leaks can lead to legal and reputational consequences.
Furthermore, ransomware does not always enter through complex technical vulnerabilities. Often, a single phishing email, a weak password for remote access, or an uninstalled update is enough. Thus, prevention should combine technical measures, organizational rules, and regular checks.

How ransomware enters the system
To effectively prevent ransomware attacks, it's important to understand the common infection scenarios. Most attacks start with gaining initial access. After that, attackers explore the network, escalate privileges, disable protections, look for backups, and only then initiate encryption.
Phishing emails and malicious attachments
Phishing remains one of the most common methods of infiltration. A user receives an email that looks like an invoice, act, delivery notice, request from a partner, or message from their supervisor. Inside, there might be an attachment, a link to a fake website, or an archive with an executable file.
Documents with macros, ISO files, LNK, JS, VBS, EXE files, and password-protected archives are particularly dangerous. The password in the email prevents the mail gateway from checking the content. Therefore, organizations should filter such attachments and train employees not to open unexpected files.
Weak passwords and remote access
Open RDP, VPN without multi-factor authentication, identical passwords, and old accounts create a convenient entry for attackers. If a malicious actor gains access to an administrator's account, they can quickly spread ransomware across the network.
It's important to limit remote access by IP addresses, use MFA, close unnecessary ports, regularly review permissions, and disable unused accounts.
Vulnerabilities in software and unsupported systems
Unpatched operating systems, servers, VPN gateways, mail solutions, hypervisors, and web applications often become entry points. Public vulnerabilities are quickly exploited by automated tools. If a patch has been released but not applied, the risk significantly increases.
Outdated systems that are no longer supported should be isolated, replaced, or secured with additional measures. It should not be assumed that an old server is safe just because it has been running for a long time without incident.
Compromised websites and third-party vendors
Sometimes infection occurs through a hacked website, fake update, malicious advertising, or contractor account. If a supplier has access to your infrastructure, their security becomes part of yours. Therefore, it's necessary to monitor third-party access, establish clear agreements, and grant the minimal required rights.
The principle of multi-layered protection
Reliable protection against ransomware is based on the principle of defense in depth. This means you have several independent barriers. If an employee does open a malicious email, mail filtering, EDR, privilege isolation, network segmentation, and backups should mitigate the damage.
Multi-layered protection includes:
- preventing malicious code from entering;
- quick detection of suspicious activity;
- limiting spread within the network;
- storing immutable backups;
- having a ready recovery plan;
- training personnel and checking processes.
The main mistake is relying on a single tool. Antivirus is important, but it does not replace backup. Backups are important, but they do not protect against data leaks. MFA reduces the risk of password theft but does not eliminate the need for updates and rights control.
Step-by-step plan to prevent ransomware attacks
Below is a practical plan that can be used as a checklist. It is suitable for small businesses, office networks, remote teams, and home infrastructures. The scale of implementation will vary, but the logic remains the same.
Step 1. Conduct an asset inventory
You cannot protect what you do not know. Create a list of devices, servers, cloud services, accounts, network storage, databases, and critical applications. Highlight systems accessible from the internet.
A minimum inventory should include:
- name of the device or service;
- owner or responsible employee;
- operating system and version of the software;
- criticality level for the business;
- presence of a backup;
- method of remote access;
- date of the last update.
This will make it easier to identify where the main risks are: an old server, a forgotten account, open RDP, or a network drive without a backup.
Step 2. Enable multi-factor authentication
MFA is one of the most effective measures against account takeover. Enable it for email, VPN, cloud interfaces, administrator accounts, remote access systems, and critical business applications.
It's best to use authenticator apps, hardware keys, or push confirmations with additional verification. SMS is better than no MFA, but they are less resistant to certain attacks. For administrators, more stringent methods should be applied.
Step 3. Limit user permissions
A user should not operate under an administrator account. The fewer rights a compromised account has, the harder it is for an attacker to disable protection, encrypt network resources, and propagate further.
Apply the principle of least privilege:
- grant rights only for specific tasks;
- regularly review access;
- separate standard and administrative accounts;
- disable local administrators where not needed;
- do not use shared passwords for multiple devices;
- immediately remove accounts of dismissed employees.
Step 4. Configure backups according to the 3-2-1 rule
Backups are the last line of defense when prevention fails. The 3-2-1 rule means: keep at least three copies of data, on two different types of media, and one copy should be offsite. For protection against ransomware, offline copies or immutable storage are especially important.
Verify not only the existence of backups but also the ability to restore them. A backup that has not been tested may prove useless on the day of an attack.
Step 5. Update systems and close vulnerabilities
Create a regular process for implementing updates. Systems accessible from the internet should be prioritized: VPN, mail servers, web servers, remote access gateways, hypervisors, and control panels.
For businesses, it's useful to maintain a log of updates and timelines for critical patch installations. If the system cannot be updated immediately, apply temporary measures: disable the vulnerable function, limit access by IP, isolate the server, or enable additional monitoring.
Step 6. Protect email and web traffic
The mail gateway should check attachments, links, and sender domains. Set up SPF, DKIM, and DMARC for corporate email to reduce the risk of domain spoofing. Block dangerous file types as needed.
For web traffic, use DNS filtering, protection against malicious domains, and limit executable file uploads. This won’t solve all problems but will reduce accidental infections.
Step 7. Implement EDR or modern endpoint security
Standard antivirus checks files against signatures and behavior. EDR additionally monitors processes, execution chains, network connections, mass file modification attempts, and credential activities. For organizations, this is an essential layer of protection.
When choosing a solution, pay attention not only to the product name but also to the response process. Who receives alerts? Who analyzes incidents at night or on weekends? How quickly can you isolate an infected computer from the network?
Step 8. Segment the network
If all devices are on a flat network, it’s easier for ransomware to spread. Divide the infrastructure into segments: workstations, servers, accounting, production, guest Wi-Fi, cameras, testing environments, and administration.
There should be access rules between segments. For example, a manager's workstation does not need direct access to a hypervisor or domain controller. The fewer unnecessary connections, the smaller the attack surface.
Step 9. Prepare a response plan
A response plan is needed before an attack, not during a panic. It should include contacts for responsible individuals, isolation procedures for devices, a list of critical systems, communication rules, and a restoration scenario from backups.
A good plan answers questions like:
- who makes the decision to disconnect a network segment;
- how to contact the team if corporate email is unavailable;
- where the backup list and emergency access passwords are stored;
- who notifies management, lawyers, clients, and regulators;
- which systems are restored first;
- how evidence for investigation is documented.
Comparison of key protective measures
This table will help set priorities. It's better to implement measures comprehensively, but if resources are limited, start with the most critical: backups, MFA, updates, permissions restrictions, and email protection.
| Protective measure | What it prevents | Implementation difficulty | What to check |
|---|---|---|---|
| 3-2-1 backup | Data loss after encryption | Medium | Is there an offline or immutable copy, has restoration been tested |
| MFA for email, VPN, and administrators | Account takeover | Low or medium | Are there any exceptions for old protocols and service accounts? |
| Regular updates | Exploitation of known vulnerabilities | Medium | Are public services patched first? |
| Rights restriction | Mass distribution and disabling protection | Medium | Do users operate without administrator rights? |
| Email filtering | Phishing and malicious attachments | Low or medium | Are dangerous file types and links blocked? |
| EDR and monitoring | Hidden attacker activity | Medium or high | Is there someone responsible for analyzing alerts? |
| Network segmentation | Rapid spread within infrastructure | Medium or high | Are unnecessary connections between segments prohibited? |
| Employee training | Mistakes when dealing with emails and files | Low | Are regular drills and case studies conducted? |

How to protect backups from ransomware
Many ransomware variants first search for and destroy backups. Therefore, simply connecting an external drive or network storage is not enough. If the backup is accessible for writing from an infected computer, it can also be encrypted.
Use immutable and offline copies
Immutable storage does not allow for change or deletion of a copy for a specified period. An offline copy is physically or logically disconnected from the primary network. Both approaches help preserve data even when accounts are compromised.
Practical options include:
- an external drive that is only connected during the copying process;
- cloud storage with versioning and deletion locks;
- WORM mode or object lock in compatible storages;
- a separate backup server in an isolated segment;
- accounts for backup without interactive login rights.
Separate access to data and backups
The domain administrator account should not automatically have full access to backups. If one password opens all doors, an attack can quickly become critical. Use separate accounts, different passwords, MFA, and log actions.
It's also useful to keep backup system settings and recovery instructions separately. In a crisis situation, the team should know where the copies are and how to restore services without access to regular documentation.
Test restoration
Regular recovery testing is necessary. The test can be simple: once a month, restore a few files, and once a quarter, restore a critical server in an isolated environment. It’s important for businesses to know their RPO and RTO. RPO indicates how much data can be lost over time. RTO indicates how quickly services need to be restored.
If a company does not know these metrics, it cannot realistically assess the consequences of an attack and properly configure the backup schedule.
Configuring workstations and servers
Most attacks start from an ordinary computer or vulnerable server. Therefore, basic hygiene for endpoints plays a key role.
What to do on work computers
For workstations, apply a standard secured profile:
- disable autoplay from external devices;
- block running macros from the internet, if not needed;
- show file extensions in the explorer;
- limit launching programs from temporary folders and user profiles;
- use application control where possible;
- enable local firewall;
- encrypt laptop disks;
- automatically lock screens;
- remove unnecessary software and browser extensions.
Pay special attention to users dealing with many external documents: accounting, sales, HR, procurement, and secretarial staff. They are more likely to receive attachments from new senders.
What to do on servers
Servers should be minimalist. The fewer unnecessary services, the lower the risk. Separate roles: domain controller, file server, database, web server, and backup system should not unnecessarily coexist on one machine.
For servers, it's crucial to:
- disable unused services and ports;
- limit administration to a separate subnet or VPN;
- enable logging of logins and changes;
- use strong passwords and MFA where possible;
- monitor administrator groups;
- update OS and applications timely;
- store secrets not in scripts and text files, but in secure storage.