Skip to content
Access control Disclosed report Intermediate CVE-2021-23976

Any websites can run with PWA privileges on Fenix (bypassing fix of Bug 1657026)

The check that verifies a Progressive Web App manifest sits inside the app's own manifests directory is inverted, so a manifest placed anywhere else on the device is accepted. An attacker could therefore get any website to run with PWA privileges on the Fenix browser.

Muneaki Nishimura Follow

Originally disclosed on Mozilla

  • Fixed in 17 days
  • Paid in 26 days
  • Disclosed after 17 days
Text
Bug 1657026 can still be reproduced on the latest Fenix Nightly (retested it today).

As a countermeasure of Bug 1657026, a function `isUnderFennecManifestDirectory` was introduced for verifying given manifest directory is under <filesDir>/mozilla/<profile>/manifests/ (see below).
https://github.com/mozilla-mobile/fenix/blob/faf765a57d78be91deed9ed9ef54d24f31075192/app/src/main/java/org/mozilla/fenix/customtabs/FennecWebAppIntentProcessor.kt#L130

But the verification logic seems incorrect.

Here, if an attacker gives wrong manifest path such as `/data/local/tmp/dummy_manifest.json`, `manifestsDir.name != "manifests"` returns `true`, but `true` means that given manifest path is under the expected directory.
'''
return manifestsDir == null || manifestsDir.name != "manifests" ||
    // Check that the folder two levels up is named "mozilla"
    manifestsDir.parentFile?.parentFile != getMozillaDirectory()
'''
It seems this comparison part should be changed like below.
'''
return manifestsDir == null || (manifestsDir.name == "manifests" &&
        // Check that the folder two levels up is named "mozilla"
        manifestsDir.parentFile?.parentFile == getMozillaDirectory())
'''
Sorry for the delay in discovering the mistake.

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

Root cause

Likely the directory validation uses a negated name comparison combined with OR, so a manifest outside the expected folder passes the check instead of failing it.

What the attacker needed

Fenix on Android; attacker can supply a manifest path

The fix

The comparison should be rewritten so the manifest name must equal "manifests" and its grandparent folder must be the Mozilla directory, combined with AND.

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 Progressive Web App (PWA) is a website that a browser can install and treat almost like a native app, with extra privileges. Fenix (Firefox for Android) tries to only allow this for manifests stored in its own private folder, but the check that enforces this is written backwards, so a file from anywhere is accepted.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.