Closed Bug 2033120 Opened 7 months ago Closed 5 months ago

WebInstaller ppmm principal forgery - Gate 1 doorhanger bypass for extension install via compromised renderer

Categories

(Toolkit :: Add-ons Manager, defect, P3)

Desktop
All
defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 --- wontfix
firefox152 --- wontfix
firefox153 --- fixed

People

(Reporter: kerberoasting, Assigned: robwu)

References

Details

(Keywords: reporter-external, sec-low, Whiteboard: [client-bounty-form][fixed by bug 2040758][adv-main153-])

Attachments

(1 file)

32.60 KB, application/x-zip-compressed
Details
Attached file poc_wiawa.zip —

Howdy.

Gate 1 bypass for the add-on install flow, different IPC surface from Bug 2015305. amManager.sys.mjs registers a ppmm listener for WebInstallerInstallAddonFromWebpage at line 58, and the handler at line 218 has no remoteType check. Its three sibling cases (MSG_PROMISE_REQUEST at 238, MSG_INSTALL_CLEANUP at 275, MSG_ADDON_EVENT_REQ at 290) all gate on remoteType !== "privilegedmozilla" at lines 244/281/296 — added by Bug 1539595 (commit 9db67e7b72a1, Tom Ritter, May 2019). MSG_INSTALL_ADDON was intentionally left open because the normal .xpi-click path fires from any content process, but the handler then trusts the child-supplied triggeringPrincipal (destructured at line 86, passed to AddonManager.isInstallAllowed at line 94).

A compromised content process sends SystemPrincipal as triggeringPrincipal. Parent's PrincipalInfoToPrincipal (BackgroundUtils.cpp:52-58) returns SystemPrincipal::Get() with no sender check. SystemPrincipal's URI is null, so XPIInstall.sys.mjs:4659-4661 returns isDirectRequestWhitelisted() — pref xpinstall.whitelist.directRequest, default true at line 4620. installAllowed is true, so AddonManager.sys.mjs:2596-2597 takes startInstall("AMO") and the addon-install-blocked notification at line 2610 is never reached.

Impact:

  • Arbitrary WebExtension install with Gate 1 bypassed, compromised content process fires the IPC directly with no preceding UI. SystemPrincipal suppresses the "Allow this site to install?" doorhanger. Gate 2 permission prompt ("Add
    X?") still fires and requires one click. Same end-user primitive as Bug 2015305, different IPC framework (ppmm JS message manager vs JSWindowActor) and different actor.
  • Not reachable from web content (Services.cpmm and principal construction are chrome-JS only). Compromised-renderer threat model — similar to Bug 2015305.

Suggested fix: derive triggeringPrincipal parent-side from payload.browsingContext.currentWindowGlobal?.documentPrincipal instead of trusting the child payload.

How was this issue discovered? Audit of amManager.sys.mjs after noticing Bug 1539595 added remoteType gates to three of four handlers in the same switch; checked whether the remaining one (MSG_INSTALL_ADDON) had compensating sender validation elsewhere — it doesn't. Traced triggeringPrincipal from the ppmm payload through AddonManager.installAddonFromWebpage to isInstallAllowed and confirmed the SystemPrincipal null-URI branch reaches startInstall("AMO") with no addon-install-blocked observer fire.

All info + PoC attached: browser_poc_wiawa_forgery.js, browser-chrome mochitest. Attack code confined to one SpecialPowers.spawn call so it runs in the content process (the format mccr8 requested in Bug 2015305 Comment 3). Verified on mozilla-central commit 6164ea4bacae (2026-04-17): 5/5 subtests PASS, child processType=2, principalIsSystem=true, topics observed ["addon-install-started","webextension-permission-prompt"], no addon-install-blocked* topic fired.

I have a Marionette version if you prefer but mochitest was preferred last time. Thanks y'all - Richard

Flags: sec-bounty?
Component: Security → Add-ons Manager
OS: Unspecified → All
Product: Firefox → Toolkit
Hardware: Unspecified → Desktop

The severity field is not set for this bug.
:zombie, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(tomica)

The bypass of the initial prompt is not ideal. The prompt being bypassed is the warning about an extension installation being triggered from a website. There is still a regular install prompt that cannot be bypassed. On its own, the bug here does not allow elevation of privileges, but it could lower the barrier to tricking users into installing unwanted extensions.

These days there should not be a reason for that logic to be in the child process; I'm going to do a timeboxed check to see if the logic can be moved into the parent process.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(tomica)
Priority: -- → P3
Whiteboard: [client-bounty-form] → [client-bounty-form][addons-jira]

I'm going to file a public bug to attach patches to, because there are more cleanups that we can do beyond just moving to the parent... the historical baggage is really surfacing here.

Depends on: 1776426
Depends on: 2040758

Work will happen in bug 2040758.

Assignee: nobody → rob
Status: NEW → ASSIGNED
Whiteboard: [client-bounty-form][addons-jira] → [client-bounty-form]

bug 2040758 is now fixed, is this fixed as a result?

Flags: needinfo?(rob)

Yes.

P.S. my recommended security rating here is: sec-low, see comment 2 for rationale.

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Flags: needinfo?(rob)
Resolution: --- → FIXED
Whiteboard: [client-bounty-form] → [client-bounty-form][fixed by bug 2040758]
Target Milestone: --- → 153 Branch
Group: firefox-core-security → core-security-release

(In reply to Rob Wu [:robwu] from comment #6)

Yes.

P.S. my recommended security rating here is: sec-low, see comment 2 for rationale.

Howdy Rob. Just a heads-up on the 2040758 cleanup.

I agree. The ppmm WebInstallerInstallAddonFromWebpage handler I reported here is gone, so that vector's closed. But the Gate-1 bypass primitive survived the refactor: the new parent-side amContentHandler (MAIN_PROCESS_ONLY) trusts loadInfo.triggeringPrincipal (destructured L45, passed to installAddonFromWebpage L106). A compromised content process navigating to an .xpi with a forged SystemPrincipal triggeringPrincipal hits the null-URI → isDirectRequestWhitelisted (default true) branch, so addon-install-blocked never fires — same as before, just via navigation instead of ppmm. DocumentLoadListener.cpp:2441 ValidatePrincipal is off-path here because xpinstall is retargeted in the parent (ParentProcessDocumentOpenInfo →NS_BINDING_RETARGETED).

One extra: bb17abc1dda added !triggeringPrincipal.isSystemPrincipal to the user-activation gate (L52-55), so a system-triggered install now also skips xpinstall.userActivation.required. That gate applied to system principals before the fix. So the forged-SystemPrincipal path is now gesture-free.

Impact: arbitrary WebExtension install with the "Allow this site to install?" doorhanger suppressed, no gesture needed, Gate-2 "Add X?" prompt still one click. Compromised-renderer threat model. Verified at runtime on Nightly 153.0a1, default prefs — topics ["addon-install-started","webextension-permission-prompt"], no addon-install-blocked*.

Happy to file this as a separate bug with the PoC if you want — let me know. Thanks! - Richard.

QA Whiteboard: [sec] [qa-triage-done-c154/b153]

Thanks for double-checking; I filed bug 2048964 to track that work.

Depends on: 2048964

The current "Gate 1" prompt is a vestigial holdover from the early days (literally 20 years ago) and really doesn't serve much purpose anymore. There have been a lot of changes and many of the things it was supposed to protect against are no longer necessary.

Flags: sec-bounty? → sec-bounty-
Keywords: sec-low
Whiteboard: [client-bounty-form][fixed by bug 2040758] → [client-bounty-form][fixed by bug 2040758][adv-main153+]
Whiteboard: [client-bounty-form][fixed by bug 2040758][adv-main153+] → [client-bounty-form][fixed by bug 2040758][adv-main153-]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: