Skip to content
XSS Write-up Intermediate

A Surprising Security Vulnerability on the Google Search Results Page

A vulnerability in Google's search results page allowed an attacker to run JavaScript on the page via the rel="prerender" link, which preloaded the first search result. This could be used to play audio, impersonate Google, or cause a denial of service by locking up the browser.

ajayp.app

Published on ajayp.app

Back in 2015, I discovered a surprising security vulnerability that allowed you to run malicious JavaScript code on the Google search engine results page, which might be one of the most secure pages on the internet given how much daily traffic it recieves. It wasn’t until 4 years later (or 2019) that they finally…

The author, on ajayp.app

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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the prerender feature allowed JavaScript from the prerendered page to execute in the context of the Google search results page, enabling script execution and API access.

Impact

An attacker could run JavaScript on Google's search results page to play audio, impersonate Google for phishing, or cause a denial of service by locking up the user's browser; however, the prerendered content was in its own origin, so cookies were not at risk.

What the attacker needed

Attacker controls a website; victim searches for a specific phrase; victim uses Chrome

The fix

The issue was fixed when prerendering support was completely dropped from Chrome in 2019.

How it was found

  1. Search for a phrase where the attacker's site is the first result.
  2. Google prerenders the first result using rel="prerender".
  3. The prerendered page runs JavaScript that can access APIs like WebSpeech.
  4. The script can detect prerender mode via document.hidden and only run then.
  5. The script can play audio, show phishing content, or enter an infinite loop to cause denial of service.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you search on Google, the first result is secretly loaded in the background so it appears instantly when you click it. The author found that this background loading let a website run its own code on Google's page, which could be used to play sounds or freeze the browser. Google fixed it years later by removing that background loading feature.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.