Skip to content
Back to Blog
Security10 min read

Ransomware Backup Strategy: 6 Rules That Stop Encryption

Immutable backups, offline copies, and tested recovery plans form the last line of defense when ransomware strikes. Here's how to build a strategy that survives.

Written by Abdul AbrorTechnical Hosting Support Engineer
Ransomware Backup Strategy: 6 Rules That Stop Encryption
On this page

Ransomware doesn't ask permission. It finds your production data, encrypts it, and moves to your backups if they're accessible. A working ransomware backup strategy assumes attackers will reach your primary systems and plans around that reality.

I've seen hosting environments recover in hours and others stay dark for weeks. The difference wasn't luck—it was whether backups survived the encryption wave. Six rules separate resilient backup architectures from expensive regret.

Rule 1: Make Backups Immutable

Immutable storage locks backup data so nothing can alter or delete it during a retention window. Ransomware can't encrypt what it can't modify.

Most backup platforms now offer object-lock or WORM modes. Enable them. Set a retention period that matches your recovery point objective—typically seven to thirty days for server environments. Once written, those blocks stay frozen until the lock expires.

Check your backup software for immutability features:

# Example: S3 object lock via AWS CLI
aws s3api put-object-lock-configuration \
  --bucket backup-bucket \
  --object-lock-configuration \
  'ObjectLockEnabled=Enabled,Rule={DefaultRetention={Mode=GOVERNANCE,Days=14}}'

Governance mode lets you override locks with explicit permission. Compliance mode allows no exceptions—not even the root account can delete data before retention expires. Use compliance mode for your most critical backup tier.

Immutability only works if credentials stay isolated. Ransomware that captures your AWS keys or backup admin password can still disable future immutability settings or wait out the retention window. Rotate credentials regularly and store them offline.

Rule 2: Keep One Copy Completely Offline

Air-gapped backups sit on media with no network path back to production. A disconnected external drive. Tapes in a safe. Storage that requires a human to physically connect it.

This is the backup that saves you when everything else fails.

Modern ransomware pivots through networks, hits cloud accounts, and corrupts replicas. If your backup system is online, assume attackers can reach it. An offline copy breaks that chain.

Practical approaches:

  • Removable drives on rotation: Attach a USB or eSATA drive, run a backup job, disconnect it, and lock it in a cabinet. Rotate through multiple drives.
  • LTO tape: Write backups to tape with a standalone library, then eject and store tapes offsite.
  • Periodic cloud sync to isolated accounts: Copy backups to a separate cloud account with different credentials, then revoke all access tokens until the next sync window.

The last option isn't truly air-gapped, but it creates a credential boundary attackers must cross. If your sync script runs via a time-limited service account that only exists for ten minutes each day, the attack surface shrinks.

How often should you refresh the offline copy? Weekly for most environments. Daily if your data changes rapidly or compliance requires it.

Rule 3: Follow the 3-2-1 Rule Religiously

Three copies of your data. Two different storage types. One offsite.

This rule predates ransomware, but it maps perfectly to the threat:

  1. Production data on your primary server (copy one).
  2. Local backup on a NAS, second disk array, or same-datacenter object storage (copy two, first media type).
  3. Offsite backup in a different physical location or cloud region (copy three, second media type).

The 3-2-1 rule prevents single points of failure. Fire, hardware death, and ransomware all get stopped by geographic and technical diversity.

In hosting environments I work with, the pattern typically looks like:

  • Production: cPanel server with live websites and databases.
  • Local: Nightly snapshots to a backup server in the same rack, with immutability enabled.
  • Offsite: Daily sync to S3 in another region or a second datacenter.

Some teams add a fourth copy for high-value data—another offsite tier or that offline drive. The 3-2-1 rule is a minimum, not a maximum.

Rule 4: Separate Backup Credentials from Production

Ransomware spreads using stolen credentials. If your backup system authenticates with the same accounts that run production services, both fall together.

Isolate backup access:

  • Use dedicated service accounts for backup jobs with read-only permissions on source data.
  • Store backup system credentials in a vault or HSM, not in environment variables on the server being backed up.
  • Require MFA for any human access to backup management consoles.
  • Limit API tokens to the shortest practical lifespan.

For SSH-based backups, generate a key pair solely for the backup user and restrict it in authorized_keys:

# On the backup server's authorized_keys for the target
command="/usr/local/bin/backup-wrapper.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAAAB3... backup@source-server

The command= directive forces that key to run only the backup script. Even if attackers steal the private key, they can't pivot through SSH.

Rule 5: Test Recovery on a Schedule

Backups you haven't restored are just expensive log files.

Test recovery monthly at minimum. Quarterly is too slow—you'll forget configuration details and let tooling drift. Weekly is ideal if automation makes it cheap.

What to test:

  1. File-level restore: Pull a random directory from last night's backup and verify contents match a known-good snapshot.
  2. Full system restore: Rebuild a test VM or container from backup and confirm services start correctly.
  3. Database restore: Import the latest database backup into a staging environment and run schema validation.
  4. Offsite retrieval: Actually download data from your remote/offline backup tier to confirm it's accessible and intact.

Document restore time. How long does it take to go from "we've been hit" to "services are back online"? That number drives your recovery time objective (RTO) and tells you whether your backup strategy meets business needs.

In support tickets I handled, failed restores usually came down to missing dependencies, changed file paths, or forgotten database users. Testing surfaces those issues before an emergency.

Rule 6: Snapshot Frequently but Retain Smartly

Frequent snapshots shrink the recovery point objective—the maximum data loss you'll tolerate. Hourly snapshots mean you lose at most an hour of changes.

But infinite retention bloats storage and creates more attack surface. Ransomware can encrypt old backups too.

Use a retention policy that balances granularity with practicality:

  • Hourly snapshots kept for 24 hours.
  • Daily snapshots kept for 7 days.
  • Weekly snapshots kept for 4 weeks.
  • Monthly snapshots kept for 3-12 months depending on compliance requirements.

This gives you fine-grained recent recovery points and long-term milestone copies without drowning in data.

Automate retention rules in your backup software. Don't rely on manual cleanup—you'll forget, and retention will drift.

What About Backup Encryption?

Encrypt backups at rest and in transit. This protects them from unauthorized access but doesn't stop ransomware from encrypting already-encrypted data.

Use your backup platform's native encryption. If you're scripting your own backups, pipe through GPG or use tools like restic that handle encryption internally:

# Example: restic backup with encryption
restic -r /backup-repo backup /var/www \
  --exclude="*.log" \
  --tag daily

Store encryption keys separately from backup data and production credentials. A password manager or KMS works well. If ransomware can reach your encryption keys, it can reencrypt your backups or delete them outright.

How Fast Can You Actually Recover?

Recovery speed depends on data size, network bandwidth, and restore tooling.

A 50 GB website might restore in twenty minutes over gigabit Ethernet. A 2 TB database could take eight hours from a remote S3 bucket.

Know your numbers:

  • Measure restore throughput during testing.
  • Calculate worst-case recovery time for your largest dataset.
  • Identify bottlenecks (disk I/O, WAN bandwidth, decompression CPU) and plan around them.

If your RTO is four hours but restoring from offsite takes twelve, you need a faster local backup tier or more bandwidth. Recovery time objectives aren't wishes—they're engineering constraints.

Monitoring and Alerts

Backups fail silently all the time. A full disk, a dead cron job, expired credentials—any of these can break backups without triggering obvious errors.

Monitor backup job status actively:

  • Set up alerts when backup jobs don't complete within their expected window.
  • Track backup size over time; sudden drops indicate missing data.
  • Verify backup file integrity with checksums or hash comparisons.
  • Test that backup data can be read (not just that files exist).

Many backup platforms include built-in monitoring. Use it. For custom scripts, write job status to a file and check it with monitoring tools like Nagios, Zabbix, or a cron job that emails you.

#!/bin/bash
# Simple backup health check
BACKUP_AGE=$(find /backup -name "*.tar.gz" -mmin -1500 | wc -l)
if [ "$BACKUP_AGE" -eq 0 ]; then
  echo "Backup older than 25 hours" | mail -s "Backup Alert" [email protected]
fi

Failed backups mean failed recovery. Catch problems early.

Where to Focus First

If you're building a ransomware backup strategy from scratch, start with immutability and the 3-2-1 rule. Enable object lock on your cloud backups today. Set up a second backup tier in a different location this week. Add an offline copy within the month.

Then test recovery. Pick a random server and restore it from backup next Friday. Time how long it takes and fix whatever breaks.

Ransomware backup strategy isn't theoretical. It's the difference between recovering in a day and explaining to customers why their data is gone.

FAQ

How long should I keep immutable backups?

Fourteen to thirty days covers most ransomware scenarios. Attacks often sit dormant for weeks before encrypting, so you need backups old enough to predate the initial compromise. Longer retention helps but increases storage costs.

Can ransomware delete immutable backups?

Not during the retention period if you're using true immutability (WORM or compliance-mode object lock). However, attackers can disable immutability for future backups if they control your backup credentials. That's why credential isolation matters.

Do I need offline backups if I have immutable cloud backups?

Immutability and offline copies solve different problems. Immutable backups stop tampering. Offline backups stop access entirely. Both are valuable—immutable for operational resilience, offline for catastrophic scenarios where cloud accounts are compromised.

How do I test backups without disrupting production?

Restore to a separate test environment—an isolated VM, staging server, or local container. Never restore directly over production data during testing.

What's the minimum viable ransomware backup strategy?

Daily backups to a local immutable store, weekly copies to an offline drive, and monthly recovery tests. It's not perfect, but it's survivable.