Previously: turning off browser ad features from the command line

I like Privacy Badger as a privacy extension for normal use, but the problem with running it—instead of a full-service ad blocker like uBlock Origin—is the Google Search ads. The FBI warns people to

Use an ad blocking extension when performing internet searches.

and blocking elements on the page is out of scope for Privacy Badger, so it can’t block the search ads on its own. But it’s still important to do something about it. CERN’s Computer Security Office, in Computer Security: Block ads, stay clean, agrees.

In particular, attackers try to abuse “Google ads” in order to sneak their malicious payload into your computer…

Source: Even the birthplace of the world wide web wants you to use adblockers by Thom Holwerda on OSNews.

Fortunately there’s another protection method I can use, besides browser extensions. This is tested on both Mozilla Firefox 142.0.1 and Google Chrome 140.0.7339.41. Both Firefox and Chrome have enterprise management features and it’s pretty easy to write a config file into the right place to set some options that will take effect across all browser profiles. And—buried treasure—both browsers’ enterprise management features support URL blocks.

To make this a little easier and avoid breaking legit stuff, I’m going to block just what I need to in order to keep a search ad click from going through. Seeing the ad isn’t the problem, the problem is the nasty payload for those who (mistakenly or accidentally) click it.

A user who accidentally clicks on search malvertising will get this “blocked page” page.

Here are the settings.

Firefox policies.json

"WebsiteFilter": {
    "Block": ["*://*.googleadservices.com/*", "*://*.google.com/aclk*"]
}

Google Chrome managed_policies.json

"URLBlocklist": ["googleadservices.com", "*.google.com/aclk*"]

Those are part of a complete breakfast with some other browser settings, available as an easy-to-install RPM at dmarti/browser-adfraud-protection: Policies to turn off problematic in-browser advertising features. This is something that can go out to all users to address the most urgent malvertising problem, with minimal disruption to the ads on legit sites.

You can see the policies in effect on your browser, at:

In general I like the Privacy Badger approach, where the ads start working on a site as soon as they change some key business practices, better than general blocking. Ideally the people who run web sites would read and act on the How do I stop Privacy Badger from blocking me section of their FAQ (which needs an update since current browsers can send GPC but not DNT but that’s a minor fix) Unfortunately, right now the web advertising business is, thanks to Google, kind of a shitshow so it’s going to take a while for sites to get on that. Blocking the most problematic ads is a start—hey, if enough people do this, more of the ad money will end up at legit sites and they’ll have a little budget and time to fix things. More: fix Google Search