What are some ways you have prepared for ransomware?
I've thought about:
1) udev rules that blacklist drives until the infrequent moments I do full backups
2) a "USB condom" of sorts that I can remotely disconnect (sever the 5V line), to make a USB spinning HD available as needed with an authentication scheme
3) running a program that tries to detect ransomware execution (antivirus or excessive cpu usage/encryption/etc)
4) mirror it to the cloud (unworkable, considering it's 16TB)
I don't think there's a solution as good as offsite backups. Most of these are ideas that add indirection or complexity that common ransomware wouldn't be coded for.
How do you disconnect a drive without disconnecting it? Especially nvme rather than a USB enclosure?
What is your creative solution?
The simplest solution would be to maintain "off-site" backups... where "off-site" is actually right next to it (in the same room), but in a physically separate computer. Then you can use on it something like borgbackup's append-only mode (https://borgbackup.readthedocs.io/en/stable/usage/notes.html...), so that ransomware running on other computers cannot overwrite old backups. Of course, this assumes that an attacker cannot access that computer other than through "borg serve" (it would be ideal if administration required physical console access to it), and that borgbackup doesn't have any bugs which allow bypassing the append-only restrictions in "borg serve".
(This has a drawback, explained on that page, that a periodic prune/compact on the server to free space from old backups could allow an attacker to delete data from the repository; but it can be easily worked around by taking a filesystem snapshot of the repository before doing the prune/compact. In case the attacker corrupted the backups, you just have to find a snapshot from before the corruption.)
My mind goes to immutability (eg: read-only filesystems), being able to repeatably build the hosts/generate as much state as possible, and relying on basic availability/eventual stability -- basically have so much of 'it' that they may not take it all down.
To practically do what I envision would require at least a decent amount of hardware, if not engineering time/workflow changes.
I think the main benefit from this is that it opens the door to more effective administration.
You'd be able to see a bunch of audit policy denials for servers trying to write where they shouldn't. You could also routinely reload the hosts to ensure they're clean. Ideally no one system controls everything, so they have to break many barriers to truly deny you access.
By the way, this is why SELinux is so highly recommended. It captures countless different ways these kinds of things can happen. Web servers opening unexpected sockets [for reverse shells], users reading devices they have no business with, etc.
Enable it, tune the policies as needed, and then monitor it. It does a good job at protecting you. Too good, too many people disable it in my opinion. Most don't realize it makes a fantastic snitch for nefarious actors.
You state:
> It is a design requirement not to have offline storage
Then go on to list amateurish hacks like "sever the 5V line" (offline) or "mirror it to the cloud" (this is literally offsite backup). So your plans of action violate the unbreakable requirements you list in the first paragraph.
Why not back up to a proper tape robot which can rotate out tapes? Or did someone bid this job for $500?
If the requirements are as you state, then you have already failed because if the datacenter is destroyed by fire, flood, power surge, swarm of locusts - or disk corruption, filesystem corruption, bad RAID controller firmware, etc.... you are, in a word, fucked.
All that said, the best way to address ransomware is to prevent it from getting into your network in the first place. Which usually happens via unsecured endpoints manned by idiots. Application whitelisting can help with this.
Also do some web research on "data diode" as a way to prevent exfiltration if you must have network connectivity to the backup drives. If only one signed piece of software can write to the backup disks and the data can only flow one direction (to the disks) then if you can trust the security of that system your backups might be relatively safe, at least from being encrypted by ransomware. Corruption of the original data would still be a problem.
Which is a big flaw in using backups for protection. If the main system is corrupted and the corruption gets into the backups then you're compromised anyway. So a way to detect data corruption before you do a backup would be useful. If that's not possible then backups become essentially useless. You could keep very old backups forever and they might not be corrupted, but they would not be very useful because they would be so out of date. If you design all transactions to be reversible perhaps you can assume that after an attack you could figure out the nature of the corruption and reverse just those transactions, but I wouldn't count on that. An attacker does not have to actually encrypt your data, just copy it and then destroy your ability to use the data you have, and if they are sneaky about it you won't discover it until it is too late and all your current backups are also corrupted. I haven't seen this kind of attack yet, probably because simple ransomware is already so effective. If countermeasures against current ransomware become effective then ransomware may evolve.
In truth, if it is important, you need a detailed security analysis of the entire system to guide the backup strategy, not some quick hack.
2) Restrict both read, write and modify permissions in Unix MAC permissions but also enforce it specifically for the data files using a LKM like selinux,apparmor or even the new and fancy eBPF LKM.
3) Enforce module signing and secure boot to prevent kernel mode code execution (short of an exploit) and of course harden your kernel.
4) This is shoddy, but if it were me I would have a LUKS encrypted backup partition with a detached header where the header and key are only fetched from a remote server temporarily from a and in-memory by a cron job/script to unlock it for a backup and lock it back again. That way, it requires a close examination of the cron script to figure out the partition is used for backup. Maybe even make the script itself remote exececuted by a simple 'curl ...|sh'
1. Don't allow users to sudo.
2. chmod the files to 400 (read-only) as the normal user.
3. chattr +i the files (as root) to prevent modifications. This makes the files immutable (cannot be changed).
So if ransomware (running in the context of a normal user) gets onto the machine, it cannot encrypt the files.
Hope this helps.
As for protection I try to follow general security guidelines: I mind all the packages I install (including dependencies like npm), I have ABP and nextdns on my browsers, I use Arch and update it every morning, and I disable any sw or hw feature (bluetooth, sdcards, usb boot) that I do not use, to give some examples. I have a feeling reducing attack surface should be enough for me.
My solution for an air-gapped backup is a linux server with no exposed ports, no daemons running.
A cron job starts a scp that copies data into a directory named as the date.
If you want you can expand using zfs with snapshots, compress, deduplicate.
Or if you have the money, buy a data domain or similar appliance and set it with immutable backups (nobody can delete them) and double password for any destructive operations. You can set it up as a tape with fiber channel or with ddboost, other ways to create a air gap
sure? we faced almost the same scenario, but with incremental backups plus data deduplication we have two outside backups (with Borg and https://en.wikipedia.org/wiki/Proxmox_Backup_Server ) that are updated nightly (with a cheap internet connection)
deduplication is really a must have for backups, plus encryption and read only, of course
Get a server with ECC RAM and storage
Get TrueNAS
Configure an ecrypted ZFS pool
Configure shares (NFS, Samba, etc.)
Configure periodic ZFS snapshots (hourly, daily, weekly, etc)
Connect your shares from clients
Use cloud providers /offsite that support zfs send and configure them
Test a disaster regularly and take notes on how to perform a restore as fast as possible
Do not ever login, store or input server credentials or unlock keys on your clients (otherwise ransomware may access your snapshots)
If ransomware attacks you, restore your latest snapshot
That should work
Just curious why and what kind of application or company's requirement is not to have offline?