System compromised by crypto-miner, Am I alone?

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

System compromised by crypto-miner, Am I alone?

Post by lost »

Hello,

For the 1st time my PI hosting Domoticz was compromised: 1st noticed this from the widgets showing CPU/RAM usage. CPU was near to 100% and DDR to ~80% with no visible issue from user POV (webUI still responsive etc). So this looked quite well calibrated to use as many ressources as possible without a user likely to notice.

=> As (see hereunder) the starter code of this was in my ~/domoticz, even if I could not trace were this exactly came from, I advise everyone to check its system load (widgets, if setup, or using top utility for instance).

Another consequence was core temp at 70°C instead of usual 45/50°C (with only passive cooling glued on SoC/memory in my system).

This lasted about 24h before I notice.

Usual process monitoring tools (ps, top...) dit not show anything but process usage added from top output being far from 100% (this was at most 8/10%, so a big and suspect gap). The load was userspace (labelled us in top), so not kernel related (interrupt storm due to faulty HW...).

If you see high loads, go ahead:

Checking socket stat quickly shows a process with a tcp connection active (remote port being https/443), but no name shown. So a process using network was somehow hidden.

To check this:

Code: Select all

ss -tup
This will show active tcp/udp connections with associated process... If you see a line with no process name shown, you may be in same situation as me.

The easy way (not modifying system tools/LD_PRELOADing a library affecting their behavior or kernel patch) to hide a process is to remounts it's /proc/PID tree somewhere else (to a tmpfs in my case).

Code: Select all

mount | grep proc
On a Debian system if you have anything added after /proc and both lines showing binfmt_misc this is a sign of something bad. This will also show the remount point for the process PID.

I 1st tried to kill it but came back almost immediately but load started to decrease before being back to ~100%. So the culprit was this hidden process.

So I did last step again to get the new PID and this time did an unmount of the shadow mount point from hereupper command.

This revealed a ~/domoticz/.sysinit hidden executable (another [process] named between squares, to have a "kernel process look"/avoid suspicion, was in cgroups: This is the one that was restarting the process responsible for the load). Searching for this in the whole SD card did show 2 callers: An added root cron line for reboot (that could be also seen using "crontab -l" as root) and in /root/.bashrc file executed when connection is done as root user: Exactly what I did when this started on saturday at ~16h45, as I did not restarted my since a few days.

=> So I presume compromise happened between this last reboot on tuesday after some apt update needing it (otherwise load would probably have risen immediately) and my connection as root for administrative tasks on last saturday.

Unfortunately, I don't keep logs for long (SD card storage...) so I could not get more clues. Only this .sysinit file in domoticz tree makes me think this could have something to do with Dz but as root anyone can setup anything where it decides to.

I also did a mistake by doing a move (mv ~/domoticz/.sysinit ~) of the file to keep it out of it's known start path, in case there is unseen starters: This kept the inode and the file was destroyed at both found processes kill. Should have done a cp instead... So no more investigation possible from there. Google search shows load and dissimulation techniques may point to some crypto-miner (on a PI, that's a bit surprising as this need some horsepower).

There was also 2 directories (.global), empty at time of check, lying in domoticz and plugin roots. They may be some remaining traces of the install path.

This looks now quiet since yesterday, but I'll probably have to wipe a just installed system (less than a month)...

Just wanted to know if I'm alone or not?
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by gizmocuz »

Sorry to see this, a compromised box is never fun, and you are certainly not alone in being hit by a crypto-miner on an internet facing Raspberry Pi.

That said, from what you describe this is not a Domoticz bug. The .sysinit binary and the .global directories are not Domoticz files, Domoticz creates neither. Once an attacker has root (the crontab in /root and the line in /root/.bashrc show they had it) they can drop and hide files anywhere, and ~/domoticz is just a writable directory that was used to blend in. With the original evidence gone (the mv instead of cp) the entry vector cannot be established, so there is nothing here we can act on in Domoticz itself. If you ever find concrete evidence that Domoticz itself was the entry point, please report it privately through a GitHub security advisory or [email protected] (see SECURITY.md), not in a public thread.

A few things that matter here, and as a long time user you most likely know them already:
  • Run the latest beta. Security and hardening fixes land there first.
  • Never expose Domoticz or SSH directly to the internet. Put it behind a VPN such as WireGuard or OpenVPN and reach your network through that. A port forward to Domoticz or SSH is the usual way these boxes get taken over.
  • Do not run Domoticz as root, and use a strong admin password.
  • Keep the OS patched.
Thanks for the write up anyway, warnings like this are useful for others.
Quality outlives Quantity!
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by lost »

Hi,

Yes, note I was a bit careful on this and location could be chosen to anything that does not attract attention too much. I wrote a MP yesterday with more details on this but this was not on dedicated security mail and without any evidence on Domoticz, probably not the right place anyway.

I forgot to write it, but only Domoticz https is exposed (my ssh can be opened for 30s, time to setup a connection, by a script triggered by a virtual switch from domoticz webUI ; this is the alternative to my former knockd setup but this tool unfortunately does not manage IPv6 and I'm dual stack).
There is fail2ban rules to ban those that must be banned. There is truecrypt for cert management.

For now, this was enough. I must confess I do not like VPN so much for 2 reasons:
-Needs a host with the VPN setup... So your brain contents is not enough.
-Any flaw on the VPN is like anyone being able to plug a RJ45 in one of your home socket without any further escalation needs.

Domoticz is ran as root to be able to bind default https 443 port... An alternative to avoid this would be using an alternate port out of 0-1024 range dedicated to root, but with the risk to be blocked by some external networks while connecting remotely (I can NAT IPv4 side, but from IPv6 only networks that's not an option). Would be better to avoid this as any flaw on webUI server ran as root would be open bar, but I don't know if this is possible with the need to bind 443 (some mechanism to drop privilege after bind?).

The OS was patched: Wednesday restart reason was last apt updated packages needing this. I'm aware this goes a bit more quickly than a few years ago on security due to IA. I don't think I'll reach several weeks or even months of uptime as in the past.

What worries me is I don't have a clue on how this came in... this was recent installation on debian13 with, in between, just an upgrade from stable 2026.4 to a beta with some fixes we talked about on another thread.

So a reinstall may lead to same situation. I'll for now monitor my system more closely and try to find other evidences I may still have missed when I have some time. And if this is back, avoid my mv mistake!
jannl
Posts: 878
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1.x
Location: Geleen
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by jannl »

As far as I know Domoticz runs on nginx, which had a major vulnerability, mainly on the http/2.

Correct me if I am wrong on this.

I had mine more or less exposed via a reverse proxy on Synology, for which I did some precautions based on http/2. Besides that, I disabled the obscure port forwarding in my router, since I basically always enable wireguard on my phone. Only time not is when I need Android auto, but in that case I do not use my phone ;-)
User avatar
Marathon2010
Posts: 50
Joined: Tuesday 02 February 2021 23:02
Target OS: NAS (Synology & others)
Domoticz version: 2026.4
Location: Netherlands
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by Marathon2010 »

jannl wrote: Monday 23 November 2026 14:18 As far as I know Domoticz runs on nginx, which had a major vulnerability, mainly on the http/2.

Correct me if I am wrong on this.

I had mine more or less exposed via a reverse proxy on Synology, for which I did some precautions based on http/2. Besides that, I disabled the obscure port forwarding in my router, since I basically always enable wireguard on my phone. Only time not is when I need Android auto, but in that case I do not use my phone ;-)
Do have the same kind of config. You can remain on Wireguard VPN and still use Android Auto by excluding the application in the Wireguard tunnel.

Click on the tunnel and an overview of the tunnel setting is shown (like name, public key, ...). Click the pencil to go into update mode. Between the blocks Interface and Peer you can click on applications. List of applications on your phone is shown. There you can exclude Android Auto from you VPN tunnel.

In this way my phone is always on VPN and so I can access Domoticz over VPN. And also use Android Auto without disabling VPN.
Synology DS920+ DSM7 (Docker) | Integrations: Audio, Heating, Gas, Electricity, Water, Alarm, Car, Camera, Doorbell, Garage, Garbage, Washer | SW: Tasmota, DzVents, Pushbullet, Telegram | Plugins: UPS, GPSLogger, BatteryLevel, Hyundai KIA, Rhasspy
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by lost »

gizmocuz wrote: Monday 23 November 2026 11:36 That said, from what you describe this is not a Domoticz bug. The .sysinit binary and the .global directories are not Domoticz files...
Indeed, I missed an obfuscated script in the event editor that points to the webUI as an entry point... See MP.

BR
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by gizmocuz »

As mentioned above, keep your system and Domoticz up to date.
Sure you are aware of script kiddies using AI to find security issues and exploit them ... not that this is a bad thing, as systems get more secure.
So install the latest beta version, and I also advise to use docker compose as i have been telling everyone now since some years.
If you do not have crazy hardware like GPIO and such, you do not need to run under root anyway with docker compose.
Also keep your OS up to date, and maybe you have other things running next to Domoticz on your system that are compromised. (a PHP application/site)?

And as mentioned above as well, use wireguard/VPN, specially if you use a Fritzbox as router, wireguard is natively available.
Quality outlives Quantity!
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by lost »

System was up to date and Domoticz on a recent beta but I usually only upgrade to betas if this solve an issue and for now always just after some new release, as they bring many more users with an emphasis on quick-fixes not seen in beta phase so not likely to bring regressions...

Not a big fan of overall complexity (docker...) that makes the system more obscure, even to me, and can also bring their own flaws, so I just plan to change setup not to run Dz at root anymore and looks there was tips for this in wiki I did not notice until now.

But as I told you in MP, the obfuscated base64 bash encoded payload, that loads another "image" payload on an address that now returns 404 I found in a Lua script placed in the event editor (a feature I do not use) have good chance to be the initial hack path. The name of the script, ncc_time_bcc7d8, looks auto generated. This was the purpose of this message: Figuring-out if I'm the top of the iceberg or a single event?

This last finding now points toward some precise targeting of Domoticz+Lua and managed to get in despite authentication activated on all Dz accounts and some added monitoring/ban, so I would now be surprised if this is single event. Being set in the event editor, this may even come back after a full reinstall with DB restore for anyone that would not notice/remove this, as such scripts are setup in DB!

Looks also this crypto-miner must have been there since more time I expected, as I have it inside all the backups done since my reinstall. Will try to see if I still have savings from before upgrade.

A quick way to check in DB knowing name script (without the last bits that may just identify a system for CC side):

Code: Select all

strings domoticz/domoticz.db | grep ncc_time_
../../lua/ncc_time_bcc7d8dzVentsAllprint('NCCPROBE_BEGIN')
EDIT:
This definitively came-in after upgrading the whole system (from debian11 and Dz 2025.1 to debian 13 and 2026.4 release then beta build 18581). I fortunately changed the uSD card at upgrade for a new one and the previous was still there: Nothing in DB before upgrade.
=> There may be an unknown flaw in webUI on newer releases. I advise anybody with webUI made accessible from outside to check the integrated event editor for scripts they did not wrote (especially those, like me, that use script files in the usual file-system paths and do not use event editor nor even think about it!).
Last edited by lost on Tuesday 24 November 2026 8:24, edited 1 time in total.
jannl
Posts: 878
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1.x
Location: Geleen
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by jannl »

After being compromised, the only good solution is a complete fresh install of the complete OS (I learned this the hard way), a smart hacker provides obfuscated backdoors for himself in a compromised system.

That said, when running in docker a compromised Domoticz docker most likelily is not zo big an issue, simply bring the container down an have a fresh start (unless the system is compromised from within the container, which is not so easy)

Since I use docker (several years now), the system is way mre transparant to me.
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by lost »

jannl wrote: Tuesday 24 November 2026 8:17 After being compromised, the only good solution is a complete fresh install of the complete OS (I learned this the hard way), a smart hacker provides obfuscated backdoors for himself in a compromised system...
Yes, I know this and debunked some at several levels. But the situation here is I've been compromised immediately, as this was the day of the upgrade to 2026.4 release (so I presume 2025.1 was not affected)! Did not noticed until last WE just because the miner was not activated until now.

So for now I'll not reinstall as this may come in again as soon as it already came in. I'll just work at not running Dz as root anymore (as this looks finally possible to bind 443 on userside) so a webUI flaw with the event editor able to setup scripts will not provide open-bar root privilege to those scripts.

Maybe a startup option to disable event editor for those who do not use it would be a good idea.
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by gizmocuz »

There is nothing wrong with the code of the event editor.
You can however disable the event system if you do not use it from the settings.

I hope lessons learned, keep your system updated, that includes domoticz, that also includes running the latest beta version.

Also look into using docker compose running under a normal user account
Quality outlives Quantity!
lost
Posts: 733
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: System compromised by crypto-miner, Am I alone?

Post by lost »

I did not wrote there was something wrong with the event editor, just this allows setting scripts with the rights of the user domoticz is launched with, if someone gets admin access to the webUI for some reason: Agree this should not happen for someone else to get to webUI, especially as admin (something I don't do myself until really needed), but for some reason this happened to me (after 10 years without any issue) and this possibility to write scripts from there made getting out of webUI up to a shell very easy.

Disabling event system would be a bit too much as this'll block any script run from domotocz/scipts/lua etc path... There is in my knowledge for now no way to just block the possibility to setup scripts from the webUI, but keeping the event system which makes the customization power of Domoticz active.

A system not up to date was for sure not the issue there, and this may be bit counter intuitive but this was in fact the opposite: The system got hacked just after being setup up to date, both OS and Domoticz side: Maybe this was not clear in hereupper message, but the old SD card I checked that was running debian11 (old but at least still getting security fixes) and Dz 2025.1 until the day of update have no traces of compromise (lua script, root crontab and .bashrc, presence of executable/directories I identified).
Post Reply