by degenerate · 3y ago · 0 comments
Sidecar question: when automating your backups, what's a good way to make sure your rolling backups aren't simply backing up malware-encrypted files? I found out too late that all my backups were encrypted. I only had 1 week retention to save space. Is longer retention and manual checks the only sane strategy? Or has some backup software built in sanity detection for crypto attacks by now?
My backup solution (backuppc/other syncs + zfs + sanoid/syncoid plus offsite server with zfs) means the backup server pulls files from the clients using backuppc/rsync. The backup server volume is zfs snapshoted regularly using sanoid. The offsite server pulls these from the backup server via syncoid/zfs send.
I'm not using rsync.net since I have my own infrastructure, but would definitely choose it as the offsite server if needed.
I also have most of my non-sensitive data on Onedrive, which keeps old versions of files.
Maybe you could check the level of entropy (measure of randomness) of files before backing up - very high entropy could suggest encrypted data?
Also, JPEG, PNG, .jar, .xlsx, etc. are already compressed, so pretty high entropy to begin with.
As others have pointed out, the growth rate of your de-duplicated backup size is probably the best way to detect ransomware.
Compute checksums. Also, if storing diffs check out how many files the back-up think changed. All of your photo library getting re-uploaded should be a red flag.
I can't assist you with recovery, and without a lot of logs and forensics data (or a significant performance improvement), the described method is likely unfeasible. But I'll try to find a matching sample and let you know if it's vulnerable.
> Sidecar question: when automating your backups, what's a good way to make sure your rolling backups aren't simply backing up malware-encrypted files?
Lots of good responses, I like incremental backups without ovewriting anything (supported OOTB by all copy-on-write filesystems, like ZFS or BTRFS). Not sure how to configure this on Windows.
Backup of Git repositiories:
... # git fsck --full
error: unable to unpack contents of .git/objects/a2/cf1a9631658799733f43c3b3f0a799696a4b21
error: a2cf1a9631658799733f43c3b3f0a799696a4b21: object corrupt or missing: .git/objects/a2/cf1a9631658799733f43c3b3f0a799696a4b21
Oops... No matter if it's a malware, the lack of ECC which by bad luck induced a bit flip that wasn't detected (on an otherwise okay Git repo) or a disk failing, it's trivial to detect if the repo is corrupted.Same for my ripped archive of Audio CDs. The rippers save lots of information and the rips are bitperfect, cross checked with other people's rips' checksums. And the checksums are all there.
For family pictures, I add a checksum to the pictures myself.
Backups aren't really backups until they've been verified :)
Anyone tried using git for 500G of photos?
I would love to if it worked, I have my photo collection spread out on multiple computers and merging the edits to the master backup is always a pita. “Was this file removed from copy A or added to copy B”? All those problems just solve themselves with a clear DVCS git history.
Not having the possibility of ever removing photos, to free up space, is of course another issue of git.
If you're open to new tools, git annex is what you're looking for. The other two options are Subversion, which has some DVCS features these days, or Perforce Helix Core (paid), though I can't vouch for it as I've never used it.
Feel free to check it out here https://github.com/Oxen-AI/oxen-release#-oxen would love any feedback!
You should check out Git LFS if you want to do that, as it sounds like a good idea in the first place!
So I don't care about the different pictures (or short family movies) format.
I just wrote some Clojure / babashka code to do that. I also truncate the checksum so that the filename doesn't become gigantic: it's not sensitive content, it's just to detect corruption.
Then I can use another computer and generate, say, all the thumbnails of the pictures and do a quick eyeball verification. If it looks correct, later on I can just automatically have the checksums verified.
Funnily enough I got a few old JPG pictures who were corrupt but I ended finding the correct version on older backups.
Checksum then helps too: otherwise you have two files with the same name (say on different HDD), but only one is correct and you don't know which one without manually opening them.
It's not super advanced and maybe a bit overkill but it's not complicated and works fine for my use case.
P.S: I take it another way would be to use a fs that use content-based addressing or does checksumming for me.
https://www.scootersoftware.com/v4help/index.html?snapshots....