Always use a firewall and anti-virus software on any computer that can access the miner(s)
NEVER blindly download software from unknown or untrusted sources be careful of untrusted emails, etc.
If you get a used miner: 1st download a new copy of its firmware from the manufacturers website, connect the miner to a PC that preferably is not connected to anything else (a cheap Chromebook is great) and flash the firmware to the miner. Only then is it safe to put the miner online along with other miners you may have. Most malware will search for all miners on your network to try to infect them so used miners need to be isolated and reflashed before putting them on your man network.
I just want to point out two things here, most antivirus software are not very mining friendly, they will block/delete Whatsminer tools, they would block even web access to some miner's webpages, and some monitoring programs will also have a very hard time running with antivirus installed, so a few exceptions will need to be put into whichever security measures you run on your PC, some folks prefer not to run any at all which is a double edge sword.
I found Kaspersky to be the most paranoid, it won't even allow you to submit a webpage that contains a stratum URL, of course, if you know all the things to allow beforehand it would be great, otherwise, every time you try to download a new monitoring software or new firmware you would be forced to make adjustments accordingly.
As for the used miner, flashing firmware from the webpage isn't going to get rid of common viruses like NightSwitcher, some versions of those viruses are pretty sophisticated, when you flash a new firmware they will show you that everything went fine, it will start hashing to your own pool, and then later on "probably where the name NightSwiticher came from" it will start mining to the hacker's pool.
The only way around this would be using Sdcard to flash the miner, it works like 99% of the time, but to be super safe, after the sdcard flash you would still do this
Just in case the virus was able to disable the bootloader on your control board, and thus making that Sdcard flash useless.
** You don't need to connect the miner to a PC when flashing Sdcard, just read the manual and you will figure out if it was successful based on the led blinking patterns, could be 10 flashes, could be 5 reds, could be 10 greens, you just need to know what the process looks like and then you don't have to risk infecting the secondary PC you use.