Skip to content
XSS Disclosed report Advanced CVE-2024-26282

Potential UXSS through <link rel=canonical> on Firefox for iOS

Firefox for iOS treated a page's canonical link as the current URL when the address began with /amp, and stored that canonical URL unvalidated when bookmarking. An attacker could set a javascript: canonical URL so that opening the bookmark later ran script in the context of whatever site was loaded, a potential universal XSS.

Muneaki Nishimura Follow

Originally disclosed on Mozilla

  • Fixed in 2 months
  • Paid in 2 months
  • Disclosed after 2 months
Text
Created attachment 9362654
potential_uxss_through_canonical_link.mov

When the current URL starts with `/amp`, Firefox for iOS recognizes an URL indicated by `<liink rel=canonical>` as the current page URL.
https://github.com/mozilla-mobile/firefox-ios/blob/e8a99cadf78ecb15db98609a702704480fbc4182/Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentEnd/MetadataHelper.js#L21

Also, when the page is bookmarked, the URL specified in the `<link rel=canonical>` is added instead of the current URL.
https://github.com/mozilla-mobile/firefox-ios/blob/7b798d538aedb8e17040c049fcc7715fcfb47e38/Client/Frontend/Browser/BrowserViewController/BrowserViewController%2BKeyCommands.swift#L45

Then, Firefox doesn't validate given canonical URL, so any scheme URL can be added to the bookmark.

Thus, if an attacker specifies a `javascript:` scheme URL, it's possible to execute JavaScript on any site opened at the time by opening the bookmarked page. These is a potential for UXSS.

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

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

How it worked

Impact

An attacker could potentially run script in the context of any site open when the crafted bookmark is opened, a universal XSS; the report calls this potential and does not demonstrate a full exploit.

What the attacker needed

Firefox for iOS; victim bookmarks a crafted /amp page; victim opens the bookmark

How it was found

  1. Open a page whose URL starts with /amp that contains a canonical link.
  2. Firefox for iOS treats the canonical URL as the current page URL.
  3. Bookmark the page, which stores the canonical URL instead of the real one.
  4. Open the bookmark later to run the javascript: URL in the current site's context.

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 report has not been written yet. The Original tab links to the source.

A web page can tell a browser 'my real address is this other one' using a canonical link. Firefox for iOS believed that claim on certain pages and saved it as a bookmark without checking what kind of address it was. If the claimed address was a javascript: link, opening the bookmark would run attacker code inside whatever website was open at the time.

What is XSS?

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

More by Muneaki Nishimura

View all

74 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.

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.