Question 1: While browsing internet, can websites execute code through my browser that access websites or services that are hosted on Localhost or LAN?
Yes, not easily and only through some kind of hacking.
Hacker are very clever, and are constantly working to exploit vulnerabilities in web browsers. If they hit your browser with a zero day they could very well inject code and get it to execute. Thus leveraging greater and greater access with each attempt. Most hacker will inject a remote desktop virus so they can see and interact with the desktop, but not always.
Question 2: Also, can data from intranet websites/services be scraped/hacked/stolen through code that is run by remote site through my web-browser?
Yes, not easily and only through some kind of hacking.
Question 3: Do modern web browsers protect from these kind of attacks and how?
Hundreds,thousands, or more of man hours of testing. Having teams of security research poke each browser in every possible manner to see what breaks. Then having them report on it so the browser team can fix it. They also sponsor events at hacking convention where real money bounties are paid for exploits. If the exploit is good enough it can bring in 10,000's or even a million dollars for the researcher or team that bring the hack in.
They even have fuzzers, throwing random data at the web browser to see if anything break or behaves in an unexpected way.
High level zero days are becoming more rare, but very clever people are still working on them. Treasure troves of zero day exploits are being hoarder by evil doing hacker group willing to sell if the price is right.
Question 4: How to isolate Localhost and Intranet access from browser?
- Sandbox software and virtual machine
- Using the latest versions of everything.
- firewalls Don't load untested and unproven extension into your browser.
- anti-virus and rootkit detectors
- IDS
I finish off this scary information with a bit of sanity.
The top web browser have all been thoroughly test and are constantly patching their code. While the answer is YES they can get in, it is incredibly difficult now a days. It usually takes teams of people to find and exploit vulnerabilities the top browser firefox,chrome, and edge. It often takes months of dedicated research to even find a weakness. Even then it can take additional months to turn that into a working exploit. In the meantime the whitehats, good guys, inch closer and closer to either finding the same thing and fixing the problem. This can nullify months of hard work for hackers. It is not a trivial task anymore.