I got hacked, my server started mining Monero this morning

49 points by eduard


Garbi

Author describes the symptoms, finds the cause, fixes the problem, and says how to avoid it in the future. Nice.

samuelkarp

then apparently what I’m seeing is just Docker’s default behavior of showing container processes in the host’s ps output, but they’re actually isolated.

[...]

Apparently, when you run ps aux on a Docker host, you see processes from all containers because they share the same kernel. But those processes are in their own mount namespace - they can’t see or touch the host filesystem.

This is a Linux behavior and other container runtimes will also exhibit this. The pid namespace is hierarchical; from a parent namespace you can see all the processes present in the child namespaces. The path shown in comes from the path the application sees itself (in a container this is a separate mount namespace and after pivot_root was called to root it properly in the container's filesystem).

parisosuch

I just experienced this yesterday on my VPS! I was showcasing my Coolify instance to my coworker and noticed my CPU usage was 100% across all cores. I saw a program called javao and xmrig running in that same path /tmp/.XIN-unix/. It is self-replicating in memory.

The culprit was also my umami container which depends on NextJS, via this CVE. My Umami instance was not up-to-date with the latest version that does not have this attack vector.

Fun stuff!

a4rbay4mnv

One thing I find useful is to limit my publicly accessible ports. You can still access other things by using SSH port forwarding. If he bound the vulnerable system only to a localhost address it wouldn't have been accessible from the open web.

atk

Blog post heavily written by an LLM (presumably from concise notes). Please don't do that.

Does your analytics thing need to be publicly exposed?

The best way to avoid this is just not publicly hosting things, need to access your personal stuff from anywhere in the world? Use a tunnel.

I am currently working towards the only publicly exposed ports on my internet facing servers being HTTP, HTTPS, SMTP (for incoming mail, not for submission), DNS, and wireguard. Things exposed over HTTP would be strictly internet facing things like my blog, and my git repositories. Anything only I or my fiancée use would then only be available via a VPN (yes, even when you're in the house, makes it so you don't need 15 WiFi networks, you just put your IOT shit on one, your guests on another, and everything you marginally trust on the third one, and even then the only way to access the actually important stuff is through a VPN (which will work from any network, or the internet, through careful routing).