Firefox Remote Settings content-signature bypass
Categories
(Firefox :: Remote Settings Client, defect, P1)
Tracking
()
People
(Reporter: galank, Assigned: leplatrem)
References
Details
(Keywords: csectype-priv-escalation, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][adv-main154+][adv-esr153.1+][adv-esr140.14+][adv-esr115.39+])
Attachments
(1 file, 5 external files)
|
5.80 KB,
application/zip
|
Details |
Summary
Firefox's Remote Settings client persists unverified records to the local database before verifying the collection's content signature, and only rolls them back when the failure is an InvalidSignatureError. An attacker who controls a Remote Settings response (a compromised Remote Settings server/CDN, or an on-path attacker able to intercept the TLS connection to firefox.settings.services.mozilla.com — the exact threat content-signature exists to defend against) can force a different verification error (a malformed signature, or a failing x5u cert-chain fetch), which skips the rollback. The unverified attacker records remain in IndexedDB and are served to consumers via the default read path. This is a bypass of the content-signature integrity mitigation for the channel that ships add-on/gfx blocklists, the OneCRL certificate-revocation store, and remote configuration to the entire release population.
Impact
Content signature is the trust anchor that lets Firefox accept Remote Settings data without trusting the server — so a compromised RS server/CDN cannot push malicious data. This bug nullifies that guarantee: an attacker in control of the response can inject unverified records (e.g. remove a OneCRL entry to un-revoke a malicious intermediate certificate, remove an add-on/plugin blocklist entry, or push attacker-chosen remote config) and have them accepted and served to clients. Injected data is cleaned on the next honest sync (the real signature fails over the merged set) but persists for the duration of the attacker's control of the channel, and indefinitely under continued interception (the up-to-date-skip path, remote-settings.sys.mjs:778, does not re-verify once attacker metadata is stored).
Affected versions
Current mozilla-central HEAD 446c6e60 (2026-07-16) and, by inspection, all shipping branches — the _importChanges error handling is long-standing. Firefox desktop + Android + iOS use the same services/settings client.
The bug (source, verified at 446c6e60)
- Write before verify.
RemoteSettingsClient.sys.mjs:1210—db.importChanges(metadata, remoteTimestamp, remoteRecords, { clear: retry }); on the first attemptretry === false, soclear:falsemerges the attacker's records into IndexedDB before any verification. - Verify after write.
:1218-1224—validateCollectionSignature(newRecords, remoteTimestamp, metadata)runs on the already-persisted data. - Rollback gated on one error type.
:1229—if (!(e instanceof InvalidSignatureError)) throw e;re-throws withoutdb.clear()/restore; the cleanup at:1244-1273is reachable only forInvalidSignatureError. - Only a well-formed-but-wrong signature is
InvalidSignatureError.validateCollectionSignature:1102-1122producesInvalidSignatureErroronly on the verifier's resolve-falsepath. A malformed signature, or a failingUtils.fetch(x5u)(:1099, no scheme/host allowlist), makesasyncVerifyContentSignaturereject. - The verifier rejects (not resolve-false) on malformed input.
ContentSignatureVerifier.cpp:128-131maps onlyNS_ERROR_INVALID_SIGNATURE→NS_OK(→ resolvefalse, the safe path); every other failure returns the raw error →CallCallback(:143) rejects → the JSawaitthrows a non-InvalidSignatureError→ step 3 re-throws without cleanup. The attacker fully controls the changeset JSON (only truthiness ofx5u/signatureis checked,:1093), so they can deliberately choose a malformed signature to take this branch. - Served without re-verification.
get()defaultsverifySignature:false(:457) and the read-time re-check is double-gatedthis.verifySignature && verifySignature(:615);get()returnsdb.list()straight from IndexedDB (:570). No production consumer passesverifySignature:true, so the sync-time gate (the one with the hole) is the only enforcement.
Reproduction — REPRODUCED END-TO-END on Firefox (not source-analysis)
Ran against a Firefox Nightly artifact build at 446c6e60 via the attached xpcshell test (test_content_signature_reject_persist.js, drop-in to services/settings/test/unit/). Serve, from the Remote Settings endpoint (compromised server/CDN or TLS MITM), a changeset with attacker records and metadata.signatures = [{ x5u: <valid Mozilla chain>, signature: "AAAA" }] — "AAAA" is a cleanly-formed base64 value that decodes to 3 bytes (odd length), which the real NSS verifier rejects at ContentSignatureVerifier.cpp:355 (rawSignatureItem.len % 2 != 0 → NS_ERROR_FAILURE), i.e. a reject, not InvalidSignatureError.
Observed at HEAD (unpatched): sync error: NS_ERROR_FAILURE (confirming the non-InvalidSignatureError path); then RemoteSettings("<collection>").get() → ["cliff-inert-attacker-record"] — the unverified attacker record is served. With the attached patch: the same test → get() → [] (record cleared). The test therefore fails at HEAD and passes with the fix — it is a ready-to-land regression test. (A malformed-base64 signature, or an x5u returning non-PEM content, are additional triggers of the same reject path.)
Fix
Minimal (attached patch rs-content-sig-rollback.patch): roll back on any verification failure, not just InvalidSignatureError — remove the early if (!(e instanceof InvalidSignatureError)) throw e; and let the existing clear/restore logic run for all errors (guarding the local-data re-check so it can't itself re-introduce the gap). Verified to apply cleanly at 446c6e60; the valid-signature and InvalidSignatureError paths are unchanged.
Structural (recommended): verify the candidate records before db.importChanges, matching the already-correct pullStartupBundle pattern (remote-settings.sys.mjs:303-324), so unverified bytes are never written. Additionally, add an https-scheme + Mozilla-host allowlist on x5u (:1099) to remove the fetch-failure reject trigger and the associated SSRF/privacy surface.
Severity note for the committee (mitigation bypass; precondition acknowledged)
We want to be upfront about the precondition and let the impact speak for itself. Precondition: the attacker must control the Remote Settings response for the targeted client — a compromised Remote Settings server/CDN, or an on-path/TLS-MITM position against firefox.settings.services.mozilla.com. We are not claiming a no-precondition, normal-browsing compromise.
Why it still matters, despite the precondition: content-signature verification is the security mitigation that exists specifically to make that precondition survivable — the entire design goal is that Firefox accepts Remote Settings data without trusting the server, so that a compromised server or on-path attacker cannot push malicious data. This report is a bypass of that exact mitigation. Concretely, an attacker who has reached the precondition can:
- Un-revoke a malicious/mis-issued intermediate CA by dropping its OneCRL entry — directly re-enabling the certificate compromise that OneCRL was pushed to contain; and/or
- remove an add-on/plugin/gfx blocklist entry, or push attacker-chosen remote configuration,
all served to the client as if trusted. So while the entry is gated on controlling the channel, the consequence is defeat of the fleet's second line of defense for exactly that scenario.
We think this fits the exploit-mitigation-bypass eligibility category (and its bounty modifier) regardless of the raw severity number, and we'd argue for sec-high on the OneCRL-un-revocation impact — but we defer to the committee's rating and are happy to provide the xpcshell PoC, the debug transcript (attached), and to coordinate a disclosure date. If a related report already exists internally, please treat this as an independent, source-verified confirmation with a ready-to-land fix + regression test.
AI-assistance disclosure
This issue was identified and validated with substantial AI assistance (Anthropic Claude / Claude Code), used as a research tool by a human researcher. Every receipt was human-verified against mozilla-central source at 446c6e60 (file:line), and the control-flow was traced end-to-end (JS + the C++ verifier's error mapping) before this report.
Updated•4 months ago
|
Comment 1•4 months ago
|
||
The rating assigned by our bug rating tool (currently under development) is:
Rating: sec-moderate
Explanation: Verified real bug. In RemoteSettingsClient._importChanges, remote records are written to IndexedDB with clear:false BEFORE signature verification (line 1210), and rollback (db.clear) is gated on e instanceof InvalidSignatureError (line 1229). validateCollectionSignature only yields InvalidSignatureError on the verifier's resolve-false path; a malformed signature or failing x5u fetch makes ContentSignatureVerifier.cpp return NS_ERROR_FAILURE (line 355-357), mapped to a promise reject (only NS_ERROR_INVALID_SIGNATURE is mapped to resolve-false at 128-131), so the JS throw is a non-InvalidSignatureError and the tampered DB is not cleared. get() defaults verifySignature:false (455) with a double-gated read-time recheck (615), so the unverified records are served. This is a genuine bypass of the content-signature integrity mitigation (blocklists/OneCRL/remote config). Not sec-high: it requires the attacker to already control the RS response channel (compromised server/CDN, or a TLS MITM of firefox.settings.services.mozilla.com) — content-signature is a defense-in-depth layer behind TLS, so the required attacker positioning plus transient persistence (cleared on next honest sync) caps this at sec-moderate (a would-be-high mitigation bypass limited by attacker-capability preconditions).
Comment 2•4 months ago
|
||
Not sec-high: it requires the attacker to already control the RS response channel (compromised server/CDN, or a TLS MITM of firefox.settings.services.mozilla.com) — content-signature is a defense-in-depth layer behind TLS
The analysis is wrong: content signatures were a key part of the remote-settings design precisely because we didn't trust the CDN and know a fair percentage of our users are MITM'd by corporate and anti-virus proxies. Both are probably fine in practice, but not good enough for the sensitivity of remote-settings or updates (another feature that uses content signatures).
Updated•4 months ago
|
Comment 3•4 months ago
|
||
Is it easy to make RS not write before the signature verification? That would seem to be the most thorough fix here.
| Assignee | ||
Comment 4•4 months ago
•
|
||
It would require a fair amount of code change, but technically doable.
Writing to a temporary place (or with a prefix) and swapping when signature is valid could also work.
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 5•4 months ago
|
||
Updated•4 months ago
|
Comment 6•4 months ago
|
||
:leplatrem, please update all release status flags to reflect the affected/unaffected/disabled state correctly. Which branches (beta, release, and/or ESR) are affected by this flaw?
Comment 8•4 months ago
|
||
Updated•4 months ago
|
Comment 9•4 months ago
|
||
AFAICT this needs uplift requests for all supported branches except Release.
| Assignee | ||
Comment 10•4 months ago
|
||
Tests are shipped in https://phabricator.services.mozilla.com/D314015
Original Revision: https://phabricator.services.mozilla.com/D314013
Updated•4 months ago
|
Comment 11•4 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Without this, users are not fully protected against MiTM attacks on the Remote Settings data
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Risk is low because this code is only executed when the RS signature verification fails. Vast majority of our users won't execute this code change.
- String changes made/needed?: None
- Is Android affected?: yes
Comment 12•4 months ago
|
||
firefox-esr153 Uplift Approval Request
- User impact if declined/Reason for urgency: Without this, users are not fully protected against MiTM attacks on the Remote Settings data
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Risk is low because this code is only executed when the RS signature verification fails. Vast majority of our users won't execute this code change.
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 13•4 months ago
|
||
Tests are shipped in https://phabricator.services.mozilla.com/D314015
Original Revision: https://phabricator.services.mozilla.com/D314013
Comment 14•4 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined/Reason for urgency: Without this, users are not fully protected against MiTM attacks on the Remote Settings data
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Risk is low because this code is only executed when the RS signature verification fails. Vast majority of our users won't execute this code change.
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 15•4 months ago
|
||
Tests are shipped in https://phabricator.services.mozilla.com/D314015
Original Revision: https://phabricator.services.mozilla.com/D314013
| Assignee | ||
Comment 16•4 months ago
|
||
Tests are shipped in https://phabricator.services.mozilla.com/D314015
Original Revision: https://phabricator.services.mozilla.com/D314013
Updated•4 months ago
|
Comment 17•4 months ago
|
||
firefox-esr115 Uplift Approval Request
- User impact if declined/Reason for urgency: Without this, users are not fully protected against MiTM attacks on the Remote Settings data
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Risk is low because this code is only executed when the RS signature verification fails. Vast majority of our users won't execute this code change.
- String changes made/needed?: None
- Is Android affected?: yes
Updated•4 months ago
|
Updated•4 months ago
|
Comment 18•4 months ago
|
||
| uplift | ||
Updated•4 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Comment 20•4 months ago
|
||
| uplift | ||
Comment 21•4 months ago
|
||
| uplift | ||
Updated•4 months ago
|
Comment 22•4 months ago
|
||
| uplift | ||
Updated•4 months ago
|
Updated•4 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 23•2 months ago
|
||
(In reply to Daniel Veditz [:dveditz] from comment #2)
Not sec-high: it requires the attacker to already control the RS response channel (compromised server/CDN, or a TLS MITM of firefox.settings.services.mozilla.com) — content-signature is a defense-in-depth layer behind TLS
The analysis is wrong: content signatures were a key part of the remote-settings design precisely because we didn't trust the CDN and know a fair percentage of our users are MITM'd by corporate and anti-virus proxies. Both are probably fine in practice, but not good enough for the sensitivity of remote-settings or updates (another feature that uses content signatures).
We reviewed this further and our severity guidelines and agree this is an issue (i.e. TLS should not be the only line of defense) but that requiring compromise of it does limit it in capability and make it a sec-moderate
Updated•2 months ago
|
Updated•1 month ago
|
Description
•