Skip to content

Ransomware: prevention, containment and recovery

The attack rarely starts with encryption. It starts with access, and that is where defense has the most to gain.

Reading time
10 min
Published

Ransomware is a type of attack in which the criminal encrypts the victim's data and demands payment to release it, often with the added threat of leaking the information. It has become one of the costliest threats for companies of every size, because it combines business disruption with the risk of data exposure. What few people realize is that encryption is the last act of a sequence that began days or weeks earlier.

Against ransomware, defense needs to prevent initial access, contain the damage once the attack starts and recover operations with backups that survive the attack. The focus here is defensive and realistic: no measure eliminates the risk completely, but a combination of controls greatly reduces the attack's chance of success and the impact of an incident.

How the attack unfolds

Encrypting the data is the ending. A ransomware attack usually starts well before that, with initial access gained through phishing, a leaked credential or the exploitation of an exposed, outdated service. From there, the attacker moves through the network, tries to escalate privileges, locates the high-value data and the backups, and only then triggers the encryption. The time between access and encryption is the window in which detection can still contain everything.

Many modern operations use double extortion: before encrypting, the attacker copies the data out and threatens to publish it. That changes the logic of defense, because having backups is no longer enough. You can restore all the data and the leak is still a risk. This is why preventing access and detecting the attack early carry even more weight.

Prevention: closing the entry points

The prevention that pays off most targets the initial access vectors. Since many attacks start through identity or an exposed service, that is where controls make the biggest difference. A second authentication factor, patching known vulnerabilities and reducing the exposed surface block most attempts before they progress.

  • A second authentication factor on remote access and administrator accounts
  • Fast patching of exposed services and known vulnerabilities
  • A smaller exposed surface: nothing public without a need
  • Least privilege and segmentation to limit lateral movement
  • Phishing awareness, since phishing is the main way in
  • Endpoint protection that detects malicious behavior

Detection: the window before encryption

Between initial access and encryption there is an interval, sometimes days or weeks long, in which the attacker moves around, escalates privileges and looks for the backups. That interval is the biggest opportunity for defense, and if you only notice the attack once the files are already encrypted, you have lost the best chance to contain it. Some typical signs of this phase:

  • Unexpected creation of privileged accounts or access keys
  • Use of legitimate administration tools outside the team's usual patterns
  • Internal network scanning and repeated authentication attempts
  • Unusual access to backup servers and file repositories
  • Endpoint protection or log collection being disabled
  • Abnormal volumes of data reads or outbound data, a sign of exfiltration

Detection depends on visibility and on someone looking at it. Endpoint protection with behavioral analysis, centralized logs and detection use cases turn these signs into alerts. Without them, the clues are there, but nobody sees them in time. This is where a detection and response service makes the biggest difference.

Containment during the incident

When the attack is detected in progress, the speed of containment determines how much damage is done. The immediate goal is to isolate what is compromised, so encryption and lateral movement do not spread. That requires a plan decided in advance, because in the middle of the incident there is no time to improvise who does what.

  • Isolate compromised systems from the network instead of shutting them down indiscriminately
  • Revoke credentials and sessions suspected of compromise
  • Preserve evidence to understand the vector and the extent
  • Activate the response plan with defined owners and contacts
  • Assess the obligation to notify, including the ANPD (Brazil's National Data Protection Agency) when personal data is involved

Shutting machines down in a hurry can destroy evidence and get in the way of recovery. In general, isolating from the network is better than powering off, because it preserves the system's state for analysis. That decision needs someone with authority and a view of the whole picture, which is one more reason to have an incident response plan defined before you need it.

Recovery and the role of backups

Recovering without paying depends on having backups the attacker cannot reach. Modern ransomware looks for and deletes accessible backups before encrypting, so a backup connected to the same network and protected by the same credentials tends to go down with everything else. What holds up is an isolated, immutable backup whose restore has been tested.

  • Keep isolated copies with no direct access from the production network
  • Use immutable retention, which prevents deletion within a set period
  • Test restores for real instead of just trusting that the backup exists
  • Store copies outside the main environment, following the separation principle
  • Document the expected recovery time for critical systems

Paying the ransom is not a recommended solution. Nobody guarantees the data will be recovered, the payment funds new criminal operations and, with double extortion, the risk of a leak remains. Reliable recovery comes from protected backups and a rehearsed plan, not from negotiating with the attacker.

Preparing the response before the incident

In the middle of an attack there is no time to decide who does what. The choices that reduce damage have to be made in advance: who coordinates, who has the authority to isolate systems, who to call for forensic analysis and legal support and how to communicate with affected parties. With a written, rehearsed response plan, containment happens in an orderly way; without one, it turns into expensive improvisation.

  • Defined roles and owners, with a clear incident coordinator
  • External contacts ready: forensic support, legal support and, if you have it, insurance
  • Decision criteria for isolating systems, preserving evidence and triggering recovery
  • An internal and external communication plan, without unnecessary exposure
  • Assessment of the legal obligation to notify, including the ANPD under the LGPD (Brazil's General Data Protection Law)

Rehearsing with simulations

A plan that has never been exercised usually fails on first contact with reality. In tabletop exercises, the team walks through a ransomware scenario step by step and finds the gaps before they get expensive: a supplier's phone number that changed, a decision nobody knows who owns, a dependency that was forgotten. Repeating the exercise regularly keeps the response sharp and the plan up to date as the environment changes.

Practical checklist

  • Enable a second factor on remote access and administration
  • Quickly patch exposed services and known vulnerabilities
  • Reduce the exposed surface and apply least privilege
  • Segment the network to limit lateral movement
  • Train the team to recognize phishing
  • Keep backups isolated, immutable and tested
  • Have a response plan with owners and contacts
  • Define the criteria for isolation and evidence preservation
  • Assess your incident notification obligations
  • Rehearse recovery of critical systems
  • Monitor for signs of lateral movement and data exfiltration
  • Rehearse the response plan with tabletop exercises
  • Keep forensic and legal support contacts ready

Best practices

  • Prioritize preventing initial access, where defense pays off most
  • Treat early detection as your chance to contain the attack before encryption
  • Prefer isolating systems from the network over shutting them down indiscriminately
  • Keep backups out of reach of the production network
  • Test restores before you need them in an incident
  • Invest in visibility to detect the phase before encryption
  • Prepare and rehearse the response plan before you need it
  • Do not treat paying the ransom as a recovery plan

Common mistakes

Relying only on antivirus and prevention, without detection
The attacker moves around for days without triggering an alert, until encryption.
Backups connected to the network with the same credentials
The attack deletes the backup along with everything else and recovery becomes impossible.
Never testing restores
You find out, in the middle of the incident, that the backup does not restore as expected.
Not having a response plan defined in advance
Decisions are improvised, the damage grows and evidence is lost.
Paying the ransom as the first way out
The money goes out with no guarantee of recovery, and the risk of a leak remains.
A response plan that is written but never rehearsed
Contacts and decisions fail the first time the incident is real.

Authorship and review

Cesar Gargiulo

CEO and founder of GUARDIASEC. Technical and editorial lead for the content published in this library.

Published on . Found a technical error? Write to [email protected] and we will correct it and keep a record of the change.

Frequently asked questions

What is ransomware?
Ransomware is a type of malware that encrypts files and systems and demands a ransom to restore access. Many groups also copy the data before encrypting it and threaten to publish it. That is why backups solve only part of the problem: they restore operations, but they do not prevent the leak.
How do you protect against ransomware?
Focus protection on initial access, because encryption is the last step of the attack. A second authentication factor, fast patching of exposed services, a smaller exposed surface, least privilege, network segmentation and phishing awareness block most attempts. Add early detection, which lets you contain the attack before encryption, and protected backups, so you can recover without paying.
Should I pay the ransom in a ransomware attack?
Paying is not recommended. Nobody guarantees the data will be recovered, the payment funds new criminal operations and, when there is double extortion, the risk of the already copied data leaking remains. Reliable recovery comes from isolated, tested backups and a rehearsed response plan, not from negotiating with the attacker.
Why do ordinary backups fail to protect against ransomware?
Because modern ransomware looks for and deletes accessible backups before encrypting the data. A backup connected to the same network and using the same credentials as production tends to be destroyed along with everything else. What holds up is an isolated backup with immutable retention (which prevents deletion for a set period), stored outside the main environment and with restores that have been tested for real.
Do you have to report a ransomware attack to Brazil's ANPD?
When the attack involves personal data, there may be an obligation under the LGPD (Brazil's General Data Protection Law) to report the incident to the ANPD, the national data protection authority, and to the affected data subjects, especially when there is significant risk to the people involved. The assessment depends on the nature of the data and the impact. So a ransomware response has to bring data protection into the picture early, along with the technical recovery.
How much time passes between initial access and encryption?
It varies widely, from a few hours to several weeks. Some operations move fast; others spend weeks mapping the network, escalating privileges and locating backups before triggering the encryption. That interval is the detection window. The more visibility you have and the faster the alert comes, the better your chance of containing the attack before it reaches its end. If you rely on prevention alone, that window goes unwatched.
What is double extortion in ransomware?
It is when the attacker, before encrypting the data, copies part of it out and threatens to publish it if the ransom is not paid. That changes the logic of defense, because having backups is no longer enough: even with systems restored, the leak is still a risk. Against this model, preventing access, early detection and protecting sensitive data carry even more weight.
How can you detect a ransomware attack before encryption?
By watching for the signs of the phase that comes before the ending: unexpected creation of privileged accounts, unusual use of administration tools, internal network scanning, atypical access to backup servers, endpoint protection being disabled and abnormal volumes of outbound data. Endpoint protection with behavioral analysis, centralized logs and someone following the alerts turn these clues into detection in time to contain the attack.

When to bring in specialist help

GUARDIASEC's Monitoring and Response service helps reduce your exposure to ransomware with early detection, a rehearsed response plan and a review of your backup strategy. The goal is to contain the damage early and recover operations without depending on negotiation with the attacker.