Broken extension can prevent XPIDatabase.verifySignatures from enforcing signatures
Categories
(Toolkit :: Add-ons Manager, defect)
Tracking
()
People
(Reporter: robwu, Assigned: rpl)
References
(Regression)
Details
(Keywords: regression, sec-moderate, Whiteboard: [adv-main133+][adv-esr128.5+])
Attachments
(5 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr128+
|
Details | Review |
|
638 bytes,
text/plain
|
Details |
Bug 1892961 introduced a loadManifestFromFile call in verifySignatures. Unfortunately, the logic does not account for the possibility of the method throwing (e.g. when a manifest is considered invalid or broken).
There are multiple ways to trigger this bug, but as an example I'll provide a STR that simulates a scenario where a previously-valid manifest is now considered invalid.
STR:
- Launch Firefox with a new profile.
- Install a manifest version 3 extension, e.g. https://addons.mozilla.org/en-US/firefox/addon/gnome-shell-integration/
- Visit
about:configand setextensions.manifestV3.enabledto false. - At
about:config, set theapp.update.lastUpdateTime.xpi-signature-verificationpreference to 0.
(if it was already 0, skip step 5). - Restart Firefox.
- In
about:configsearch for thexpi-signaturepref from step 4. - Open the Browser Console (Ctrl-Shift-J) and wait a bit, until the preference value in step 6 changes from 0 to some number (current timestamp).
- Look at the Browser Console, for errors.
Expected:
- Non-fatal errors.
Actual:
- There is an error printed with
XPI_verifySignature: Error: Unsupported manifest version: 3. - Upon clicking on it to reveal the stack trace, it ultimately points to
verifySignature,XPIDatabase.sys.mjs:2271. Note that this is in acatchblock, which means that a runtime error prevented the logic from continuing as usual.- The security-sensitive part of this bug is that this can prevent Firefox from effectively enforcing signature validation on other unrelated add-ons.
- Although the log does not show it, the source of the error is the unchecked
loadManifestFromFilecall inverifySignatures.
Recommendation:
- The
loadManifestFromFilecall should be wrapped in a try-catch.
| Assignee | ||
Updated•11 months ago
|
| Assignee | ||
Comment 1•11 months ago
|
||
Updated•11 months ago
|
Comment 2•11 months ago
|
||
Set release status flags based on info from the regressing bug 1892961
| Assignee | ||
Comment 3•11 months ago
|
||
Depends on D228201
| Reporter | ||
Comment 4•11 months ago
|
||
Note on security impact: The verifySignatures function is a method to catch inconsistencies in what ought to be considered a valid signature vs the actual signature in the add-on database. Ordinarily, there should not be such an inconsistency. But the need for inconsistency fixups can arise if external software tampered with the database. Another situation where this logic can result in observable differences is in bugs like bug 1548973 (armagadd-on) - but that cannot happen any more for the next few decades (because we don't have expiring add-on signing certs for the next few decades).
For this reason I'd rate this as sec-low or sec-moderate at most.
Updated•11 months ago
|
Updated•11 months ago
|
Comment 6•11 months ago
|
||
Updated•11 months ago
|
| Assignee | ||
Comment 7•11 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D228201
Updated•11 months ago
|
Comment 8•11 months ago
|
||
beta Uplift Approval Request
- User impact if declined: For Users with an installed extension with an invalid manifest, XPIProvider verifySignatures would not be able to catch incosistent signing for addons that follow the one with an invalid manifest
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: This patch is paired with a child revision that provides test coverage (not landed yet) and it has been tested manually. Comment 0 STR can be used as a reference if we want to run an additional manual QE verification.
- Risk associated with taking this patch: Low risk
- Explanation of risk level: the change is minimal (the call to loadManifestFromFile has been wrapped in a try/catch) and the issue well understood.
- String changes made/needed: -
- Is Android affected?: yes
| Assignee | ||
Comment 9•11 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D228201
Updated•11 months ago
|
Comment 10•11 months ago
|
||
esr128 Uplift Approval Request
- User impact if declined: For Users with an installed extension with an invalid manifest, XPIProvider verifySignatures would not be able to catch incosistent signing for addons that follow the one with an invalid manifest
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: This patch is paired with a child revision that provides test coverage (not landed yet) and it has been tested manually. Comment 0 STR can be used as a reference if we want to run an additional manual QE verification.
- Risk associated with taking this patch: Low risk
- Explanation of risk level: the change is minimal (the call to loadManifestFromFile has been wrapped in a try/catch) and the issue well understood.
- String changes made/needed: -
- Is Android affected?: no
Updated•11 months ago
|
Comment 11•11 months ago
|
||
| uplift | ||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Comment 12•11 months ago
|
||
| uplift | ||
Updated•11 months ago
|
Updated•11 months ago
|
Comment 13•11 months ago
|
||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•6 months ago
|
Updated•2 months ago
|
Comment 14•2 months ago
|
||
Comment 15•2 months ago
|
||
Comment 16•2 months ago
|
||
Backed out for causing xpc failures @ test_signed_verify.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/d814f435ee53a5ed24d9c90ecb59c373645d24c3
| Assignee | ||
Comment 17•2 months ago
|
||
(In reply to Pulsebot from comment #15)
Pushed by smolnar@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/43bf95dc909b
https://hg.mozilla.org/integration/autoland/rev/d814f435ee53
Revert "Bug 1929600 - Test XPIDatabase.verifySignatures on extensions with
an invalid manifest. r=robwu" for causing xpc failures @
test_signed_verify.js
I see that the failure was hit on mobile builds, the logic that this new test case covers is only executed on builds where Services.policies is defined and so it is completely skipped on mobile builds and so the test hits a failure.
I've just updated the phabricator revision to account for that (and skip the new test case on builds where Services.policies is not defined).
I'll push the updated revision to autoland as soon as the static analysis job has completed and confirmed there are no linting errors as expected.
Comment 18•2 months ago
|
||
Comment 19•2 months ago
|
||
| bugherder | ||
Description
•