A lot of people use a huge /etc/hosts file to simply redirect ads and scam sites to 127.0.0.1. The interesting part about this approach is that you can have the same hosts on your tablet, your android phone, your mac, your linux box, etc, and all applications in your machine are subject to the /etc/hosts, so you don't need to configure browsers, proxies...
An example of a HUGE hosts file is from this french website.
I would like to create some scripts and use these hosts files in an automated manner, but I was afraid of some security issues: imagine that someone hacked the server from where I get the hosts file, and now is pointing gmail.com to a scam site for example.
So, I thought of just doing a simple validation: each line of the hosts file must begin with 127.0.0.1 or with a comment (#).
Is this a valid precaution measure? Do you see any problems with this approach?
your-bank.webto point to their server, they can serve you with a phishing page. – Polynomial Oct 4 '12 at 7:34