Skip to content
Open redirect Disclosed report Intermediate CVE-2020-6808

Full URL spoof using javascript URI scheme

Gijs Follow

Originally disclosed on Mozilla

  • Fixed in 4.0 years
  • Paid in 2.0 years
  • Disclosed after 4.0 years
Text
Created attachment 8718878
FF-URL-SPOOFv2.html

+++ This bug was initially created as a clone of Bug #1228754 +++

(original test and steps from bug 1228754 and @qab, not from me)

1. Open attached file.
2. click link
3. click back button in the browser


Somehow, the URL stays in the URL bar. Interrogating the browser's currentURI shows the URL shown in the URL bar, but the document displayed is actually about:blank (and the documentURI and so on verify this, and document.documentElement.nodePrincipal is the original opener's principal (localhost if you host the file there, bugzilla if you opened it directly ).

(In reply to Boris Zbarsky [:bz] from bug 1228754 comment #33)
> Sounds like it, but it also sounds like something different from the
> original issue reported in this bug (the one I analyzed in comment 6). 
> Seems like we should get a new bug filed on the interaction involving
> session history, and probably ask Olli whether he can take a look.

--> ni Olli.

The original report as published on Mozilla's Bugzilla, by Gijs. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

This is a Mozilla bug report about a full URL spoof in Firefox, filed against the Core: DOM: Navigation component and disclosed on 25 January 2020. The reporter is Gijs, and the report is explicitly a clone of an earlier bug, #1228754. The test case and reproduction steps come from that earlier bug and from a user referred to as @qab, not from the reporter of this clone.

The attachment is a single HTML file:

Text
FF-URL-SPOOFv2.html

The reproduction is three steps:

  1. Open the attached file.
  2. Click the link in it.
  3. Press the browser's back button.

The result is that the URL stays in the URL bar. The address bar keeps showing the URL of the page the user navigated to, but the document actually displayed is about:blank. The reporter checked this by interrogating the browser: currentURI reports the URL shown in the address bar, while documentURI and related properties confirm the displayed document is about:blank. The reporter also notes that document.documentElement.nodePrincipal is the principal of the original opener, which would be localhost if the file is hosted there, or Bugzilla if the file is opened directly from the bug.

So the spoof is not just cosmetic text in the address bar: the security principal of the rendered document belongs to the opener origin while the bar advertises a different URL. That combination is what makes it interesting, because the user is shown one origin and the document is treated as another.

The report does not give a bounty amount, a CVSS score, a fix or a resolution. It ends with a quoted comment from Boris Zbarsky on the earlier bug, saying the behaviour sounds like something different from the original issue analysed there, and that a new bug should be filed for the interaction involving session history, with a request that Olli take a look. The comment asks whether Olli can take a look.

Root cause

The report points at the interaction between navigation and session history. The report does not explain the cause; it only points at the interaction with session history. The address bar and the document are updated from different sources and are not kept consistent, so the displayed URL and the actual document diverge. The reporter notes the principal belongs to the original opener, but does not explain why.

Impact

The report shows the address bar keeping a URL while the displayed document is about:blank. The report itself only demonstrates the mismatch with about:blank and does not show script execution or data theft, so the practical impact beyond misleading the user about which site is loaded is not established here.

How this kind of bug works

URL spoofing through navigation abuses the gap between what the browser tells the user and what it actually renders. The address bar is fed from the navigation or session history layer, while the rendered document comes from the document and principal layer. Normally these are updated together, but edge cases in history traversal, redirects, error pages, downloads, javascript: URIs and window opening can update one without the other.

A javascript: URI is a common ingredient because it executes in the context of the page that owns it and can trigger navigations or window operations that the history machinery handles differently from ordinary loads. When the resulting document is a blank or error document that inherits a principal, the user sees a URL that does not correspond to the code that can run. Defences are consistency checks: the address bar must be derived from the same document that is rendered, principals must be recomputed on every history restore, and blank or error documents must never inherit a privileged opener principal.

How to test for it

  1. Identify features that manipulate history or open windows: links with javascript: URIs, window.open, history.pushState and replaceState, redirects, meta refresh, and back/forward navigation.
  2. Build a page that performs a navigation and then returns via the back button, and observe the address bar against the rendered document.
  3. In the console, compare location.href, document.URL, document.documentURI and document.documentElement.nodePrincipal after each step. A positive result is a mismatch: the bar shows one URL while the document properties show another, especially when the principal belongs to a different origin than the bar suggests.
  4. Repeat across fresh profiles, with and without the page hosted on a local server, since the opener principal changes with hosting.

Common false positives are deliberate about:blank popups, which legitimately show no URL, and pages that update the title or favicon without changing the document. A real finding needs the address bar to display a URL that does not match the document actually loaded, and ideally a principal mismatch that a script could exploit.

How it is fixed

Fixes for this class recompute the address bar from the document that is actually rendered after every history traversal, and avoid restoring a history entry's URI when the document for that entry cannot be restored. Blank and error documents should get a null or opaque principal rather than inheriting the opener's, and navigation code should treat javascript: URIs and window-opening paths as requiring the same consistency checks as ordinary loads. Regression tests should cover back and forward navigation after scripted navigations.

Hunting notes

This class tends to hide in session history restoration, error and blank documents, redirect chains, downloads that cancel navigation, and window opening from script. Recon signals include any feature that pushes history entries, opens windows, or handles javascript: links, and any place where the browser shows a fallback document. To make a report accepted, show the exact steps, the mismatch between the bar and the document properties, and the principal involved, and explain what a script in the opener context could do with it.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

This is a Mozilla bug report about a way to make Firefox show the wrong address in its address bar. It was filed against the Core: DOM: Navigation component and disclosed on 25 January 2020. The reporter is Gijs, and the report is a clone of an earlier bug, #1228754. The test case and the steps come from that earlier bug and from a user referred to as @qab, not from the reporter of this clone.

The attachment is a single HTML file:

Text
FF-URL-SPOOFv2.html

To reproduce it, you do three things:

  1. Open the attached file.
  2. Click the link in it.
  3. Press the browser's back button.

After that, the URL stays in the URL bar. The address bar keeps showing the address of the page you navigated to, but the document actually on screen is about:blank, the browser's built-in empty page. The reporter confirmed this by asking the browser about itself: currentURI reports the URL shown in the address bar, while documentURI and related properties confirm that the displayed document is about:blank.

Why does that matter? The address bar is the main thing a user trusts to know which site they are on. If the bar says one thing and the page is another, the user can be misled about where they are. The reporter also notes that document.documentElement.nodePrincipal is the principal of the original opener. The principal is the browser's internal label for which site a document belongs to and what it is allowed to touch. It would be localhost if the file is hosted there, or Bugzilla if the file is opened directly from the bug.

So the spoof is not just cosmetic text in the address bar: the security principal of the rendered document belongs to the opener origin while the bar advertises a different URL. That combination is what makes it interesting, because the user is shown one origin and the document is treated as another.

The report does not give a bounty amount, a CVSS score, a fix or a resolution. It ends with a quoted comment from Boris Zbarsky on the earlier bug, saying the behaviour sounds like something different from the original issue analysed there, and that a new bug should be filed for the interaction involving session history, with a request that Olli take a look. The comment asks whether Olli can take a look.

Root cause

The report points at the interaction between navigation and session history. Session history is the browser's list of pages you have visited in a tab, the thing the back and forward buttons walk through. The report does not explain the cause; it only points at the interaction with session history. The address bar and the document are updated from different sources and are not kept consistent, so the displayed URL and the actual document diverge. The reporter notes the principal belongs to the original opener, but does not explain why.

Impact

The report shows the address bar keeping a URL while the displayed document is about:blank. The report itself only demonstrates the mismatch with about:blank and does not show script execution or data theft, so the practical impact beyond misleading the user about which site is loaded is not established here.

In general, how this kind of bug works

URL spoofing through navigation abuses the gap between what the browser tells the user and what it actually renders. Think of a shop window: the sign above the door says one shop, but the goods inside come from another. The address bar is fed from the navigation or session history layer, while the rendered document comes from the document and principal layer. Normally these are updated together, but edge cases in history traversal, redirects, error pages, downloads, javascript: URIs and window opening can update one without the other.

A javascript: URI is a common ingredient because it executes in the context of the page that owns it and can trigger navigations or window operations that the history machinery handles differently from ordinary loads. When the resulting document is a blank or error document that inherits a principal, the user sees a URL that does not correspond to the code that can run. Defences are consistency checks: the address bar must be derived from the same document that is rendered, principals must be recomputed on every history restore, and blank or error documents must never inherit a privileged opener principal.

In general, how to test for it

  1. Identify features that manipulate history or open windows: links with javascript: URIs, window.open, history.pushState and replaceState, redirects, meta refresh, and back/forward navigation.
  2. Build a page that performs a navigation and then returns via the back button, and observe the address bar against the rendered document.
  3. In the console, compare location.href, document.URL, document.documentURI and document.documentElement.nodePrincipal after each step. A positive result is a mismatch: the bar shows one URL while the document properties show another, especially when the principal belongs to a different origin than the bar suggests.
  4. Repeat across fresh profiles, with and without the page hosted on a local server, since the opener principal changes with hosting.

Common false positives are deliberate about:blank popups, which legitimately show no URL, and pages that update the title or favicon without changing the document. A real finding needs the address bar to display a URL that does not match the document actually loaded, and ideally a principal mismatch that a script could exploit.

In general, how it is fixed

Fixes for this class recompute the address bar from the document that is actually rendered after every history traversal, and avoid restoring a history entry's URI when the document for that entry cannot be restored. Blank and error documents should get a null or opaque principal rather than inheriting the opener's, and navigation code should treat javascript: URIs and window-opening paths as requiring the same consistency checks as ordinary loads. Regression tests should cover back and forward navigation after scripted navigations.

In general, where to look

This class tends to hide in session history restoration, error and blank documents, redirect chains, downloads that cancel navigation, and window opening from script. Recon signals include any feature that pushes history entries, opens windows, or handles javascript: links, and any place where the browser shows a fallback document. To make a report accepted, show the exact steps, the mismatch between the bar and the document properties, and the principal involved, and explain what a script in the opener context could do with it.

Glossary

  • Address bar / URL bar: the field at the top of a browser that shows the address of the page you are on.
  • URL: the address of a resource on the web, such as a page or a file.
  • URI: a more general term for an identifier of a resource; in browser code it is often used where a URL is meant.
  • about:blank: a built-in browser page that is empty and has no real site behind it.
  • Session history: the browser's per-tab list of visited pages that the back and forward buttons move through.
  • Navigation: the act of the browser moving from one page to another.
  • Document: the page content the browser has loaded and is displaying.
  • Principal: the browser's internal label for which site a document belongs to and what it is allowed to access.
  • Opener: the page or window that opened another window or document; the new one can inherit properties from it.
  • Origin: the combination of scheme, host and port that defines a site's identity for security purposes.
  • javascript: URI: a link whose target is a piece of script rather than a page; the browser runs the script in the context of the page that owns the link.
  • window.open: a browser function that opens a new window or tab from script.
  • history.pushState / replaceState: browser functions that add or change session history entries from script without a full page load.
  • Redirect: a server or page instruction that sends the browser to a different address.
  • Meta refresh: an HTML tag that tells the browser to reload or navigate to another address after a delay.
  • DOM: the browser's in-memory model of the page, which scripts read and change.
  • Console: the browser's developer tool where you can run commands and inspect the page.
  • location.href / document.URL / document.documentURI: properties that report the address the browser associates with the page.
  • currentURI: a browser-internal property reporting the address the browser currently considers active.
  • nodePrincipal: the principal attached to a particular node in the page's DOM.
  • False positive: a result that looks like a bug but is actually normal, expected behaviour.
  • Regression test: an automated test that checks a fixed bug stays fixed.
  • CVSS: a standard scoring system for rating the severity of a security issue.
  • Severity: a rating of how serious a bug is.

More by Gijs

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.