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.
Originally disclosed on Mozilla
- Fixed in 17 days
- Paid in 26 days
- Disclosed after 17 days
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.
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.