Using Hackability to uncover a Chrome infoleak
A Chrome bug caused the baseURI property of a cross-origin iframe to return the parent document's URL instead of the iframe's own URL. An attacker could read the full URL of a cross-origin page, including query strings and fragments, if that page contained an iframe and was frameable.
Published on portswigger.net
I've been hacking browsers for over 15 years and one of the challenges I set myself was to find a SOP bypass or info leak in every major browser. Chrome was the last browser standing…until now.
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.
Context
This is a browser security story about the Same Origin Policy (SOP) in Chrome. SOP is the browser feature that stops one site reading data from another: the report's own example is facebook.com being unable to read data from google.com. The researcher, Gareth Heyes, had spent over 15 years hacking browsers and had set himself the goal of finding an SOP bypass or information leak in every major browser. Chrome was the last one left, and this write-up describes a flaw that had been buried for nearly five years.
The starting point was not Chrome itself but a PortSwigger Web Security Academy lab on dangling markup injection that had stopped working. The technique involved setting an iframe's location to about:blank, which lets you read the name property of the cross domain window. Normally that is forbidden because cross domain windows are protected by SOP. An earlier write-up of the same idea had produced a CSP bypass using dangling iframes.

Setup
The tooling was the researcher's own Hackability Inspector, described as a security-focused enumerator. The inspector is loaded with a URL that nests iframes across domains:
https://portswigger-labs.net/hackability/inspector/?html=%3Ciframe%20src=%22//subdomain1.portswigger-labs.net/hackability/inspector?html=%3Ciframe%20src=/%3E%22%20id=x%3E
Decoded, the html parameter builds an iframe with id=x pointing at //subdomain1.portswigger-labs.net/hackability/inspector, and that inner inspector itself contains another iframe with src=/. So the main inspector window holds a cross domain window, which in turn holds a further iframe. For the baseURI leak, the precondition is a framed page that already contains at least one iframe.

Finding it
Bypassing CSP was useful, but the researcher suspected there was more to find, because lots of properties were being leaked once the about:blank location was set. The plan was to enumerate those properties on the cross domain window and look for anything that carried data across the origin boundary.
Exploitation
Step 1: point the cross domain subframe at about:blank
In the main inspector window, the location of the subframe inside the cross domain window is set:
x.contentWindow[0].location='about:blank';
Here x is the iframe in the main window, contentWindow is its window, and [0] is the first child frame inside that cross domain window. Setting its location to about:blank is what unlocks the property reads that follow.
Step 2: inspect the cross domain iframe window
Once the location was set, the researcher changed the input of the main inspector window to inspect the cross domain iframe window and hit return:
x.contentWindow[0]

The screenshot shows the inspection of the cross origin window. The property list was long: too many entries to scroll through by hand, so the next move was to filter by properties known to hold interesting information.
Step 3: reach the document object
Filtering showed the document object was reachable:
x.contentWIndow[0].document
(That is how the line appears in the write-up, capital I included.) Known properties such as document.URL were no good, because it was set to about:blank. Then the researcher remembered baseURI, filtered for it, and found it contained cross domain information.

The screenshot shows document.baseURI leaking a cross origin URL. The property held information about the full URL, and it could be read from a different subdomain.
Step 4: confirm the leak is controllable
The researcher confirmed that if the external URL was modified with hash or query string parameters, those could be read from the different subdomain, and decided to report it to Google. A proof of concept was published alongside the write-up.
Root cause
Google investigated after the proof of concept was simplified and found the baseURI problem had been known since 2017. The relevant code, quoted in the report, is:
// TODO(tkent): Referring to ParentDocument() is not correct. See // crbug.com/751329. if (Document* parent = ParentDocument()) return parent->BaseURL();
The baseURI property was reporting an incorrect URL. The TODO and the referenced crbug show the incorrectness was understood, but nobody had managed to demonstrate a security vulnerability until this research. Using a framed page with an existing iframe, the researcher could use this bug to obtain cross domain information.
Impact
The leak lets one subdomain read the full URL of a page on another subdomain, provided that page is frameable and contains at least one iframe. The researcher's example: attachments.example.com could read the entire URL of oauth.example.com and steal OAuth tokens. Hash and query string parameters added to the external URL were confirmed readable from the different subdomain. Google awarded $2000 for the vulnerability.
Fix
Google patched the issue on 2022-07-08, and a Chrome release followed on 2022-08-30. The report does not describe the patch itself.
Variants to test
- Enumerate properties on a cross domain window after setting a nested frame to
about:blank, as above, and filter for anything URL-shaped. A positive result is a property returning a URL from the other origin, including its query string or fragment. - Repeat the check with hash and query string parameters appended to the external URL. A positive result is those values appearing in the leaked property.
- A positive result is a base URL that belongs to the parent document rather than the frame's own document.
- A positive result is cross domain data readable from a sibling subdomain.
Timeline
| Date | Event |
|---|---|
| 2022-06-16 9:37 AM GMT+1 | Reported to Google |
| 2022-07-08 7:15 PM GMT+1 | Google patches issue |
| 2022-08-18 | Google awards $2000 bounty |
| 2022-08-30 | Chrome released |
| 2022-09-01 14:00 PM GMT | Blog post published |
The lesson the researcher draws: minor bugs such as incorrectly assigned properties can be chained with existing techniques to expose cross domain information, and when enumerating it is worth looking for properties that contain external URLs, as they can lead to cross domain information disclosure.
What happened, in plain words
A security researcher found a way for one website to read part of the address of a page on a different website inside Google Chrome. Browsers are normally built to prevent exactly that. The flaw had been known since 2017, but nobody had demonstrated a security vulnerability until this research. Google paid $2000 for the report and fixed the problem.
The rest of this article explains, from scratch, what the browser rule is that was broken, how the researcher found the hole, and why it mattered.
The rule that was broken: the Same Origin Policy
Every page you open in a browser lives at an address, for example https://www.example.com/some/page. The browser splits that address into three parts: the scheme (https), the host (www.example.com) and the port (usually hidden, but it is there). When two pages share all three, the browser treats them as the same origin. When any part differs, they are different origins.
The Same Origin Policy, or SOP, is the browser rule that says: a page from one origin may not read data belonging to a page from another origin. The report gives a simple example: facebook.com is not allowed to read data from google.com. Without this rule, any website you visited could quietly open your bank's site in the background and read your balance.
SOP is not a wall around everything. It mostly stops one origin from reading another origin's data. It does not stop one page from loading another page in a frame, or from navigating it. That gap between what is allowed and what is forbidden is where this story lives.
The researcher's goal
Gareth Heyes had been hacking browsers for over 15 years. He had set himself a personal challenge: find an SOP bypass or an information leak in every major browser. An information leak (or infoleak) means any way to get data out of a place where it was supposed to stay. Chrome was the last browser standing, and this article describes the flaw that finally broke it, one that had been buried for nearly five years.

How it started: a lab that stopped working
PortSwigger runs a Web Security Academy with practice labs. One of those labs demonstrated dangling markup injection. The idea is that if a site lets you inject a fragment of HTML into a page, you can leave an HTML tag unfinished, so that the browser keeps reading the rest of the page as if it were part of that tag. If the unfinished tag is something like an image, the browser will try to load the image from a URL that includes whatever text came next on the page, and that text gets sent to a server you control. It is a way of stealing page content without running any script.
An earlier write-up of the same idea had produced a CSP bypass using dangling iframes. CSP, or Content Security Policy, is a set of instructions a website sends to the browser saying which scripts and resources are allowed. A bypass means getting around those instructions.
The technique involved setting an iframe's location to about:blank. An iframe is a page inside a page: a rectangle in the current page that loads another web page. about:blank is the browser's built-in empty page. Setting a frame to that empty page lets you read the name property of the cross domain window. The name property is just a label a window can carry. Normally you would not be allowed to read anything from a cross domain window, because SOP protects it.
That lab stopped working, and investigating why led to something bigger.
The tool: Hackability Inspector
The researcher used his own tool, the Hackability Inspector, which he describes as a security-focused enumerator. To enumerate means to list things one by one, systematically, the way you might go through every drawer in a desk rather than just the obvious one. The inspector lists all the properties that a page can see on a window object, so you can look for anything interesting.
The inspector was loaded with a URL that nests iframes across domains:
https://portswigger-labs.net/hackability/inspector/?html=%3Ciframe%20src=%22//subdomain1.portswigger-labs.net/hackability/inspector?html=%3Ciframe%20src=/%3E%22%20id=x%3E
That long string after ?html= is a URL-encoded piece of HTML. The %3C and %3E are the characters < and >, and %22 is a double quote. Decoded, it reads:
So the outer inspector page creates an iframe with the identifier x, and that iframe points at a second inspector on a different subdomain, subdomain1.portswigger-labs.net. That inner inspector in turn contains another iframe with src=/, meaning a page on its own site. The result is three layers: the main inspector window, a cross domain window inside it, and a further iframe inside that.

For the baseURI leak, the precondition is a framed page that already contains at least one iframe. Keep that in mind: the trick only works when the page you are targeting has a frame inside it.
Finding it
Bypassing CSP was useful, but the researcher suspected there was more to find. Once the about:blank location was set, lots of properties were being leaked. That suggested the browser was handing over more information than it should. The plan was to enumerate those properties on the cross domain window and look for anything that carried data across the origin boundary.
Exploitation
Step 1: point the cross domain subframe at about:blank
In the main inspector window, the location of the subframe inside the cross domain window is set:
x.contentWindow[0].location='about:blank';
Line by line:
xis the iframe in the main window, the one withid=xfrom the setup URL.contentWindowis the window object inside that iframe, meaning the actual browsing context of the framed page.[0]picks the first child frame inside that cross domain window, which is the inner iframe withsrc=/..location='about:blank'navigates that inner frame to the browser's empty page.
Why do this? Navigating the inner frame to about:blank changes its state in a way that unlocks the property reads that follow. The researcher had already learned from the dangling markup work that this move exposes properties of the cross domain window.
Step 2: inspect the cross domain iframe window
Once the location was set, the researcher changed the input of the main inspector window to inspect the cross domain iframe window and hit return:
x.contentWindow[0]
This line simply asks the inspector to show everything it can see about that inner frame's window. x is the outer iframe, contentWindow is its window, and [0] is the first frame inside it. The inspector then prints a long list of properties.

The screenshot shows the inspection of the cross origin window. The property list was long, too many entries to scroll through by hand, so the next move was to filter by properties known to hold interesting information. Filtering here means typing part of a name into the inspector so it only shows matching entries, like searching a long contact list by first letter.
Step 3: reach the document object
Filtering showed the document object was reachable:
x.contentWIndow[0].document
That is how the line appears in the write-up, capital I included. The document object is the browser's internal representation of the page itself: its address, its content, its title and so on. Being able to reach it at all from another origin is suspicious.
Known properties such as document.URL were no good, because it was set to about:blank. That makes sense: the frame had just been navigated to the empty page, so its URL was the empty page's URL. Then the researcher remembered baseURI, filtered for it, and found it contained cross domain information.

The screenshot shows document.baseURI leaking a cross origin URL. baseURI is the address the browser uses to resolve relative links on a page. If a page at https://example.com/folder/page contains a link written as image.png, the browser turns it into https://example.com/folder/image.png by combining it with the base URI. The property held information about the full URL, and it could be read from a different subdomain.
Step 4: confirm the leak is controllable
The researcher confirmed that if the external URL was modified with hash or query string parameters, those could be read from the different subdomain, and decided to report it to Google. A query string is the part of a URL after a question mark, often carrying values like ?token=abc. A hash (or fragment) is the part after a #, often used to point at a section of a page. Both are common places for applications to put sensitive values. A proof of concept was published alongside the write-up.
Why this matters: the impact
The leak lets one subdomain read the full URL of a page on another subdomain, provided that page is frameable and contains at least one iframe. Frameable means the page does not forbid being loaded inside an iframe.
The researcher's example: attachments.example.com could read the entire URL of oauth.example.com and steal OAuth tokens. OAuth is a common way for websites to let you sign in with another service, and it works by passing a token, a short secret string that proves who you are, much like a wristband at an event. If an attacker can read a URL that contains such a token, they can use it. Hash and query string parameters added to the external URL were confirmed readable from the different subdomain. Google awarded $2000 for the vulnerability.
Root cause
Google investigated after the proof of concept was simplified and found the baseURI problem had been known since 2017. The relevant code, quoted in the report, is:
// TODO(tkent): Referring to ParentDocument() is not correct. See // crbug.com/751329. if (Document* parent = ParentDocument()) return parent->BaseURL();
The comment above it, marked TODO, says that referring to the parent document is not correct, and points at a bug tracker entry, crbug.com/751329. A TODO is a note a programmer leaves for later. So the incorrectness was understood, but nobody had managed to demonstrate a security vulnerability until this research. Using a framed page with an existing iframe, the researcher could use this bug to obtain cross domain information.
Fix
Google patched the issue on 2022-07-08, and a Chrome release followed on 2022-08-30. The report does not describe the patch itself.
Variants to test
If you want to look for similar problems yourself, these are the directions the researcher points at. Each one lists what a positive result looks like.
- Enumerate properties on a cross domain window after setting a nested frame to
about:blank, as above, and filter for anything URL-shaped. A positive result is a property returning a URL from the other origin, including its query string or fragment. - Repeat the check with hash and query string parameters appended to the external URL. A positive result is those values appearing in the leaked property.
- A positive result is a base URL that belongs to the parent document rather than the frame's own document.
- A positive result is cross domain data readable from a sibling subdomain.
Timeline
| Date | Event |
|---|---|
| 2022-06-16 9:37 AM GMT+1 | Reported to Google |
| 2022-07-08 7:15 PM GMT+1 | Google patches issue |
| 2022-08-18 | Google awards $2000 bounty |
| 2022-08-30 | Chrome released |
| 2022-09-01 14:00 PM GMT | Blog post published |
The lesson
The researcher's conclusion: minor bugs such as incorrectly assigned properties can be chained together with existing techniques to expose cross domain information. When enumerating, it is a good idea to look for properties that contain external URLs, because they can lead to cross domain information disclosure. In other words, a small mistake that looks harmless on its own can become serious when combined with something else.
Glossary
- Same Origin Policy (SOP): the browser rule that stops a page from one origin reading data belonging to another origin.
- Origin: the combination of scheme, host and port that identifies where a page came from.
- Information leak / infoleak: any way of getting data out of a place where it was meant to stay.
- SOP bypass: a way around the Same Origin Policy.
- iframe: a page embedded inside another page.
- about:blank: the browser's built-in empty page.
- Window object: the browser's internal handle for a browsing context, holding its properties and methods.
- Property: a named value attached to an object, such as
document.URL. nameproperty: a label a window can carry.- Dangling markup injection: injecting an unfinished HTML tag so the browser treats following page content as part of it and sends it to an attacker's server.
- CSP (Content Security Policy): instructions from a site telling the browser which scripts and resources are allowed.
- CSP bypass: getting around those instructions.
- Enumerator: a tool that lists things systematically so you can inspect them.
- Hackability Inspector: the researcher's security-focused enumerator used here.
- Filtering: narrowing a long list to entries matching what you type.
documentobject: the browser's internal representation of the page itself.document.URL: the address of the page.baseURI: the address the browser uses to resolve relative links on a page.- Query string: the part of a URL after
?, often carrying values. - Hash / fragment: the part of a URL after
#. - Frameable: a page that does not forbid being loaded inside an iframe.
- OAuth: a common way to sign in to a site using another service.
- Token: a short secret string that proves who you are.
- Subdomain: a named subdivision of a domain, such as
attachments.example.comunderexample.com. - TODO: a note a programmer leaves in code for later.
- Bug tracker: a system for recording known software bugs, here
crbug.com. - Proof of concept (PoC): a working demonstration that a vulnerability is real.
- Bounty: a payment a company makes for a valid security report.
- Patch: a software update that fixes a flaw.