Was reading this: How to check if a Wi-Fi network is safe to connect to?
When I came across some comments
I can redirect you to other pages without your interaction. Install key loggers. Heck if your browser runs activeX objects I could open a shell on your machine without your knowledge. That last example is rare these days but what's not rare is tricking you into installing a shell for me, keylogging, session stealing, and redirection.
Or as I mentioned in my post, drop a crypto miner on your machine with the tool I wrote
Written by Anthony Russell in the comments of his answer.
So, this looks bad, obviously. What I want to know is how can I stop these attacks? Blocking javascript sounds like a good start, the original post also suggested to check my device for open ports (they did not demonstrate how to shut them though). What else? Is there a fool-proof way to prevent these sort of (virus injection? remote control?) attacks?
To be clear, I am not talking about logging. That's a given when you connect to any network. Please also dont give any advice along the lines of "don't connect to malicious networks". There are reasons that I cannot switch away from a (possibly) compromised network.
What I'm most worried about is virus injection. But other attacks (like key loggers) mentioned above are serious concerns too. Just share whatever comes to mind. I'm sure other people will fill in the blanks.
Sorry if I sound like a complete noob. That's because I am. Sorry in advance.