Because we live in a hetero world, computer/phone-wise, I use quite a fussy 3rd party firewall on the various client devices, rather than just the default. At times it can be fiddly, however, the kind of crypto-mining you described would have been stopped, and a warning sent to my phone that there was a security issue.
It is not free software, but not expensive. It is good enough that I renewed my subscription, and its name begins with B.