Found a backdoor on my NixOS laptop disguised as a "nix-update" service?

Yes, I’ve reinstalled the system now. But I currently still don’t know how to ensure its security in the future… Linux lacks something like Windows Defender (I’m not joking). All I can do is detect problems after they occur and isolate as many things as possible to reduce the attack surface.

But when I don’t know how it might have entered… I don’t know what I should isolate, or what the purpose of my isolation is; I’m just mechanically isolating my applications… I think I understand why our computing cluster uses a strict whitelist for network access… There no other way to protect against malicious programs.

I expect you know about QubesOS, right? There are various attempts to combine it with Nix … I think they’re all at early stages though. Today I found a new one: Alpha release of QixOS - Qubes with Nix - Community Guides - Qubes OS Forum

There’s also the Nix-based Spectrum OS by @qyliss:

If the baseline is no isolation, using firejail for everything that looks like it can be a risk already improves your security situation a lot while being easier to adopt than going full-on to Qubes. (Personally I use some scripting around nsjail)

(Accidently pressed enter on my previous post before editing.)

This is my rough survey of the “sandboxing” ecosystem.

data-oriented sandboxing:

  • island
  • QubesOS - An OS where you run apps in separate temporary sub OS’s in VMs
  • nix-housing
  • Separate users ala Android
  • microvm / gvisor + containers setup (have to built it yourself.)

executable-oriented sandboxing:

  • flatpak - App wrapping using bubblewrap.
  • toolpak - Gnome’s flatpak for tools, but is doesn’t seem to do sandboxing?
  • firejail - namespace+seccomp-bpf sandboxing
  • bubblewrap - namespace+seccom-bpf
  • bubblejail
  • landrun - (landlock) similar to bubblewrap but using landlock.
  • microvm
  • gvisor - similar to a microvm, provides a layer between the executable and the kernel, meant for containers.

System wide sandboxing:

  • systemd - sandboxing services
  • apparmor - file-path based security policy
  • selinux - similar to above but file-label based security policy

There are really three axes here:

  • Convenience for the user.
  • Will the sandboxing be there at the right place and time for protection.
  • Quality of the sandboxing mechanism.