KORTHVEILSecurity firewall
Guides

Stealth ad blocking: sites can't tell ads are blocked

Download as PDF All guides

Some sites test whether ads are blocked, and then lock the page behind an "ad blocker detected" message. With stealth ad blocking, Korthveil keeps blocking every ad, but the page sees the ad scripts load and answer as if nothing were blocked. When a site still notices, the firewall finds out by itself, switches that site to a stronger method, and keeps the one that works. It also learns how sites try to detect blocking or identify your computer, and uses that for every browser at once.

From Korthveil 1.3.5, on by default. It works on every device through the firewall's ad blocking (see Devices without CipherGate below), and most thoroughly in browsers with CipherGate (Chrome, Edge, Firefox, Safari), where it also heals itself, learns, and removes YouTube's video ads.

At a glance:

Step Where What
1 Network › DNS › Ad & tracker blocking Hide ad blocking from sites, on every device is ticked (the default)
1b Security › Privacy › CipherGate › Browsers For the full protection, browsers are enrolled (see the CipherGate guide)
2 Security › Privacy › CipherGate › Browsers › Stealth ad blocking Hide ad blocking from sites is ticked (the default)
3 The same place Learn how sites detect blocking and identify computers is ticked (the default)
4 Nothing to do Sites that detect blocking heal by themselves; the list shows each one and the step it needs
Security › Privacy › CipherGate › Browsers › Stealth ad blocking: the switches, sites that detected blocking, the lists and what was learned
Security › Privacy › CipherGate › Browsers › Stealth ad blocking: the switches, sites that detected blocking, the lists and what was learned

How sites detect ad blocking, and what Korthveil does

How a site checks Without stealth With stealth
Loads an ad script (Google AdSense, Google Publisher Tag, Amazon, Google video ads) and waits for "loaded" or "error" Error: the firewall blocked the ad server Loaded. A stand-in script answers every call and shows no ad
Looks for the ad library's objects (adsbygoogle, googletag, apstag) Missing Present. Ad slots report "no ad to show", which is normal
Loads an ad picture or asks an ad server Fails Succeeds, with an empty answer
Runs a detector library (FuckAdBlock, BlockAdBlock and similar) "Detected" "Not detected"
Checks canRunAds or similar flags Missing True
Checks whether browser functions were changed (a sign of an extension) Could see it Native code, as in a browser with nothing installed
Looks for the extension's own addresses in the page Could see them Nothing to see

The ads themselves are never let through: the firewall's ad blocking stays as it is. Only what the page is told changes.

A test page asks eleven ways whether ads are blocked: every answer says no, and no ad is shown
A test page asks eleven ways whether ads are blocked: every answer says no, and no ad is shown

When a site still detects it: healing

Some sites have their own checks that no list knows yet. CipherGate notices when a page shows an "ad blocker detected" wall (a box over the page with that wording, in several languages, often with scrolling locked) and tells the firewall. The site then moves up one step, for every enrolled browser:

Step What the site sees
1. Stand-ins (every site) The known ad scripts load and answer; ad servers answer empty; detector libraries say "not detected"
2. Failures look like success (that site only) Any request to another site that the firewall blocks, script, picture or data, looks like it loaded
3. Wall hidden (that site only) If the wall still appears, it is removed and scrolling comes back. The article is already there

A site goes up one step per detection, at most once every two minutes while browsers fetch the new step. After 30 days without a wall it goes one step down again, to try the lighter method. If the wall comes back, it goes up again by itself.

Step 1: the site's own check isn't on any list yet, and it shows its wall
Step 1: the site's own check isn't on any list yet, and it shows its wall
Step 2, a moment later: the same page, without the wall
Step 2, a moment later: the same page, without the wall

The pictures are from the release test (build/tests/ciphergate-stealth-e2e.py), which runs these pages in Chrome with CipherGate and checks every answer on each release.

YouTube: no ads before or during videos

YouTube's ads don't come from separate ad sites: the ad instructions are part of YouTube's own data about the video, and the ad video comes from the same servers as the video. So, on top of blocking other sites' scripts and the ad addresses, CipherGate removes the ad instructions (adPlacements, playerAds, adSlots) from YouTube's video data before YouTube's player reads it: in the page itself and in the player's own requests. The player has no ad to play, the video starts at once, and to YouTube it looks like a video for which no ad was sold. CipherGate never sends YouTube or advertisers a report that an ad was watched.

YouTube: no ads before or during videos is ticked by default; untick it to leave YouTube as it is. YouTube changes how it delivers ads from time to time; if a new way appears, the release test's YouTube checks and the healing steps catch up. Ads YouTube may stitch into the video stream itself on its servers can't be removed by any method.

A youtube.com stand-in page in the release test: the video data arrives without its ad instructions, the video is still there
A youtube.com stand-in page in the release test: the video data arrives without its ad instructions, the video is still there

Learning: how sites detect blocking and identify computers

With Learn how sites detect blocking and identify computers ticked, browsers report the methods pages use, never what's on the page:

  • Detector scripts: the address of a script that checks for ad blocking.
  • Bait elements: tiny invisible boxes named like ads (ad-banner, adsbox) that a page inserts to see whether a blocker hides them. Korthveil never hides them, so they always look normal, also with Hide ad boxes, sponsored posts and banners on (from 1.6.1: its rules for every site leave out the bait names and the ones learned here).
  • Identification: which script (by its site) read the canvas drawing, the graphics card's name, the audio fingerprint, installed fonts, plugins, battery, the CPU and memory, or the screen's colour depth.
  • Detector libraries asking "are ads blocked?".

The firewall pools what every browser learned under Learned, and uses it at once:

  • Detector scripts it learned get an empty stand-in in every browser.
  • Under Scripts that identify computers, press Block to stop a script host from running at all. Fingerprint noise (CipherGate › Browsers) already blurs what such scripts read. A site that needs the script may stop working, so this is your choice per host.

For new builds: press Export what was learned. The file holds the methods only, with no sites and no browsers. Korthveil's build folds exports from firewalls into CipherGate's built-in knowledge (build/stealth/learned-import.py), so a new firewall's browsers handle those detectors from the start.

Forget what was learned clears the list. Untick the learning box to stop recording.

Lists that teach it

Two lists, downloaded once a day while stealth is on, teach CipherGate before any site detects blocking:

List What it adds
Adblock Warning Removal List (EasyList) Detector scripts used by many sites (up to 1,500): each gets an empty stand-in
AdWire Guardian ad domains Ad servers: AdWire's list has over 500,000 names, too many for a browser, so the ones that serve ads by their name (ad, ads, adserver, banner, pagead and similar, up to 8,000) answer empty in the browser. The whole list still blocks every name through the firewall's ad blocking

Download the lists now fetches them at once. If a download fails, the last good copy stays in use. SentinelOps and Korthveil's own names are never on them (adr/0265).

Sites left as they are

Under Sites left as they are, add a site whose pages should see blocking as it is: an intranet, or a test page. Stealth doesn't apply there, and from 1.6.1 neither do CipherGate's options for the page (element hiding, cookie banners, scriptlets, redirect skipping).

Element hiding and healing (from 1.6.1)

With Hide ad boxes, sponsored posts and banners on (CipherGate guide, Ad blocking in the browser), CipherGate hides ad boxes with the browser's own user stylesheet, which a page can't read, and never hides bait boxes. If a site still shows a wall, healing works as above, and from step 2 that site also gets none of the lists' rules for every site (only the rules written for that site), so a check that looks at many boxes finds them all shown.

Reset a site

In Sites that detected blocking, Reset puts a site back to step 1. Browsers get the change within 15 minutes.

What no method can hide

  • A site can count on its own servers that no ad view was reported. Nothing on your computer can change that.
  • Ads stitched into the video stream itself on the site's servers are not separate ad instructions, so they can't be told apart from the video. YouTube's usual ads are removed (see YouTube above).
  • New detectors appear. Healing and the lists catch up within a day; they can't know a new one in advance.

Devices without CipherGate (TVs, phones, any browser)

On every device, CipherGate or not, Network › DNS › Ad & tracker blocking › Hide ad blocking from sites, on every device (on by default) lets the ad libraries' loaders answer while the names that deliver the ads stay blocked:

Loader that answers Its ads come from (still blocked)
pagead2.googlesyndication.com (Google AdSense) googleads.g.doubleclick.net, tpc.googlesyndication.com
imasdk.googleapis.com (Google video ads) pubads.g.doubleclick.net
c.amazon-adsystem.com (Amazon) aax.amazon-adsystem.com
Network › DNS › Ad & tracker blocking: Hide ad blocking from sites, on every device
Network › DNS › Ad & tracker blocking: Hide ad blocking from sites, on every device

A site that checks "did the ad library load?" sees it load, and the ad spaces stay empty, as if no ad was sold. Video players get "no ads" and start the video. Google Publisher Tag (securepubads.g.doubleclick.net) is not let through: the same name also delivers its ads. A loader you put on your own block list stays blocked.

The trade-off: Google and Amazon see that a page loaded their library. Untick the box to block the loaders as well (sites can then tell). Browsers with CipherGate never contact the loaders: CipherGate's stand-ins answer first, and the healing steps and YouTube part only work there.

Download as PDF All guides