3-2-1 Backups Against Ransomware: A Guide for Indian Teams

Protect databases and the 180 days of logs CERT-In requires with 3-2-1 and locked copies, report ransomware within 6 hours, and test restores with checksums.

By · · 10 min read

Illustration for 3-2-1 Backups Against Ransomware: A Guide for Indian Teams

India edition. Written for Indian organisations: ransomware under the CERT-In directions of 28 April 2022 (6-hour reporting, 180-day logs in India, synced clocks), with backups for both data and logs worked through for an Indian fintech database. US edition

For an Indian company, a ransomware attack starts two problems at once: getting the data back, and meeting CERT-In's reporting rules. The 3-2-1 backup rule (three copies of your data, on two kinds of storage, one off-site), with at least one copy offline or locked so stolen credentials cannot delete it, handles the first. The CERT-In directions of 28 April 2022 shape the second: ransomware is one of the incident types to report within 6 hours, and every organisation must keep logs of its ICT systems for a rolling 180 days within Indian jurisdiction, which means your logs need the same protection as your data.

This edition explains how those rules change a backup plan, then sets up and tests backups for an Indian fintech's ledger database with the Database Backup Script Generator and the Hash File Verifier. It is general guidance; during a live attack, isolate systems and get incident response help before you touch the backups.

What CERT-In requires, and why backups are part of it

The directions apply to service providers, intermediaries, data centres, body corporates and government organisations. Three of them bear directly on backups:

DirectionWhat it saysWhat it means for backups
(ii) Report within 6 hoursAnnexure I incidents must be reported within 6 hours of noticing them; item (v) is malicious code attacks including ransomwareYour plan has to tell you quickly whether the backups survived, because the report should say what was affected
(iv) Logs for 180 daysEnable logs of all ICT systems and keep them securely for a rolling 180 days within Indian jurisdiction, and provide them with an incident report or on directionLogs are data an attacker will try to delete. Back them up with the same 3-2-1 rules, with retention of at least 180 days
(i) Synced clocksSync ICT system clocks with the NTP servers of NIC or NPL, or a source that does not deviate from themBackup timestamps, log times and the incident timeline line up, so you can tell which backup predates the infection

CERT-In's FAQs add that the 6-hour report can carry the information available at the time, with the rest sent later, and their list of severe incidents for the 6-hour clock includes the spread of computer contaminants, including ransomware, on public information infrastructure. They also list the logs to keep (firewall, IPS, SIEM, web, database, mail, proxy, VPN, SSH and application logs, both successful and failed events) and allow copies outside India as long as the logs can be produced to CERT-In in reasonable time.

What ransomware changes about 3-2-1

The rule assumes failures are accidents: a disk dies, a building floods. Ransomware operators look for backups on purpose, as CISA's #StopRansomware Guide warns, and delete or encrypt every copy they can reach. So the question is not "do we have three copies?" but "which copies can someone with our server's credentials touch?"

  • Separate credentials. NIST SP 800-209 says recovery copies should be managed from separate systems that ordinary production and backup credentials cannot reach.
  • Offline or immutable. An unplugged drive, or object storage with a retention lock the uploading key cannot shorten.
  • Replication is not a backup. A replica copies encrypted blocks within seconds.
  • Keep older copies. Attackers often sit inside a network before encrypting, so the newest backups may already contain their tools. Your clocks, synced to NIC or NPL, are what let you pick a backup from before the first malicious log entry.

Worked example: a fintech ledger and its logs

A lending startup in Pune runs a PostgreSQL database called ledger. Its application and database servers produce about 3.5 GB of compressed logs a day.

Step 1: a backup script that fails loudly. In the Database Backup Script Generator, choose PostgreSQL (port 5432), host localhost, username backup_user, database ledger, keep structure and data ticked, tick Compressed custom format (pg_restore) and click Generate Scripts. The backup script runs pg_dump --format=custom, writes files such as /backup/postgresql/ledger_20261109_020000.dump, stops with the error code if the dump fails, and sets the file to chmod 600. Download it as ledger_backup.sh, and add a sha256sum line for each new dump.

Step 2: three copies of the database.

CopyWhereProtection
1Live ledger databaseNone against ransomware
2Nightly dump on a separate backup server in the same data centreDifferent system, same network
3Object storage in a separate account with a retention lock, or an offline driveServer keys can write but not delete

Step 3: three copies of the logs, for at least 180 days. Ship each day's compressed log archive to the backup server and to the locked off-site bucket, with a retention lock of at least 180 days so nothing can be deleted before CERT-In's period ends. At 3.5 GB a day, 180 days is 630 GB in each place. Keep the archives in Indian jurisdiction, or at least make sure they can be produced to CERT-In in reasonable time, as the FAQs allow.

Step 4: a restore script for a test database. Change the database name to ledger_restore_test and generate again. The restore script restores with pg_restore --clean --if-exists --no-owner --exit-on-error into ledger_restore_test, never into the live ledger. Download it as ledger_restore_test_restore.sh.

Step 5: check the checksum catches a change. In the Hash File Verifier, select the downloaded script and paste:

2dc893ab4ddbc19d64f585d63207707ebad24d2172313f9478146e1125a0a58e  ledger_restore_test_restore.sh

Auto-detect reads it as a SHA-256 sha256sum line and shows Hash Verification Passed for the 896-byte file. Change DB_PORT='5432' to DB_PORT='5433' and the hash becomes 85bcd94d0937fd0f6a27a31b4eedaf1e94c8cb0233670def02ee239ea38a6ff8, and the check fails. A replaced or corrupted dump fails the same way.

The monthly restore drill

  1. Restore from copy 3, the locked off-site copy, onto a machine outside the production network.
  2. Verify the checksum against a line stored away from the backup server.
  3. Restore into ledger_restore_test and compare row counts on the main tables.
  4. Pull one day's logs from the off-site bucket from about 170 days ago and check they open and are complete, so you know the 180-day window really holds.
  5. Record the time taken and the age of the newest good copy. These are your real recovery time and data loss, and they belong in the incident report if an attack happens.

If ransomware hits

Isolate affected machines first and do not restore onto them. Note the time the incident was noticed: CERT-In's 6-hour clock runs from then. Report by email to incident@cert-in.org.in or by phone on 1800-11-4949 with what you know, and keep the logs, which CERT-In may ask for. If you are regulated by a sector regulator or personal data is involved, other reports may also be due; check with your compliance team.

Tools for this job

For dump options and the mistakes that break restores, read database backups with pg_dump, mysqldump and friends. For the 6-hour report inside a full post-incident review, see incident postmortems in India.

Frequently asked questions

Do we have to report a ransomware attack to CERT-In?

Yes, if you are covered by the directions: malicious code attacks including ransomware are in Annexure I, which must be reported within 6 hours of noticing the incident. You can send the information you have and follow up with the rest. CERT-In's FAQs (Q 30) say the 6-hour window is for Annexure I incidents that meet its criteria, such as severe incidents (ransomware among them) on public information infrastructure, data breaches or leaks, large-scale incidents or those affecting safety; if in doubt, report within 6 hours.

Do the 180-day logs have to be backed up?

The directions require logs of all ICT systems to be kept securely for a rolling 180 days in Indian jurisdiction and produced on request. Ransomware can destroy logs along with everything else, so a copy outside the attacker's reach is the practical way to meet that duty.

Is a cloud sync folder a backup?

Not on its own. Sync copies encrypted files to every device. It works as a backup only if earlier versions are kept in a way the attacker cannot purge, under separate credentials.

How long should immutable backups be kept?

At least 180 days for logs, to match CERT-In. For databases, long enough to reach back before an intruder could have arrived, plus the time you need to detect them, and in line with any retention rules from your regulator.

Sources and further reading

Browse all tools