Following my previous post on r/voidlinux (no systemd), where I noticed systemd binaries showing up in htop and draining resources, after some help it turned out it's a trojan disguised as a systemd binary, according to virustotal.
Anyway, I located the binary, and it seems to be using cgmanager to run itself. How fucked I am?
Here is the output of ps aux | grep systemd.
I tried to kill it, yet it keeps respawning. And it seems to hook itself with cgmanager. How can I disable that?
EDIT 1: I also noticed whenever I enter the graphical shell (startx), the trojan systemd binary starts itself in /tmp. How can I locate the source that execute the file?
EDIT 2: I removed cgmanager although I think it doesn't have to do with systemd here.
Anyway I figured out how the malware works. First it tries to run itself from /tmp/, if it doesn't run, it runs itself either from /.local/share or from /.config/.
I added noexec to /tmp, that actually stopped a couple of malware names from running (basically the names that the malware use to disguise itself are: gvfs, initctl, ibus-x11, dbus-daemon, systemd, and others.
I installed socklog, how can I use it (or any other logging software) to trace the automatic execution
EDIT 3: I found the source
2 files (~/.ssh/config/service/ssh-agent, and ~/.local/share/icc/icc-daemon). Somehow my .bashrc and .bash_profile were modified to let these files to start up (noticed that when changing users the program didn't start). Here is a screenshot.
Anyway, I still have the binaries of the files, just to inspect them later, if anyone wants to take a look let me know. So far, I think I solved it. But my ssh keys are fucked I guess.
FINAL UPDATE Thanks to u/AN3223 for pointing it out, the source seems to come from an addon for Kodi, according to discussions on linux forums, majaro's forums, pclinuxos and a blog post on how to get rid of it, and some users on reddit also ran into this exact malware here and here.
u/funfollower pointed that the vulnerability has been investigated 5 years ago.