Lightweight themes can be installed automatically, without user's consent
The security checks for automatic lightweight theme installation relied on the baseURI property of the theme element, which can be manipulated with a base tag. An attacker could make a malicious page appear as a trusted domain and install a theme without user consent.
Originally disclosed on Mozilla
- Fixed in 8 days
- Paid in 12 days
- Disclosed after 8 days
Created attachment 8963092
Proof of concept page
The security checks determining which websites are allowed to install lightweight themes and particularly which are allowed to install them without user's consent are based on the baseURI property of the theme element. Unlike the document URI, this property can be easily manipulated - e.g. by using a <base href="..."> tag. This is what the attached proof of concept page does - opening it will immediately install a theme named "Hacked you" because the security checks consider that page to be discovery.addons.mozilla.org. This is also problematic in light of bug 527463: a theme might not even change the appearance of Firefox but invisibly track the user via updateURL instead.
What the report shows
The target is the Add-ons Manager in the Mozilla toolkit, specifically the logic that decides which websites may install lightweight themes. Two decisions depend on that logic: whether a site is allowed to install a theme at all, and whether it is allowed to do so without the user's consent.
The researcher found that these security checks are based on the baseURI property of the theme element rather than on the document URI. The baseURI is easy to manipulate, for example with a <base href="..."> tag. The proof of concept page attached to the report does exactly that: opening it immediately installs a theme named "Hacked you", because the checks treat the page as discovery.addons.mozilla.org.
The report also points to a related concern, bug 527463: a theme might not change the appearance of Firefox at all, and could instead invisibly track the user through its updateURL. The report gives no bounty, no CVSS score and no fix details; the platform records it as medium severity under the privilege escalation weakness.
Root cause
The trust decision is made against a value the page can influence. baseURI reflects the document's base URL, which the document itself can change with a <base> element, so a page on any origin can present itself as having the base of a trusted add-ons host. The check compares that attacker-controlled string against the trusted sites, and the page is treated as discovery.addons.mozilla.org.
The underlying mistake is using a document-derived, mutable property as the input to an authorisation decision instead of the actual origin of the document that initiated the install.
Impact
An attacker who convinces a user to open a crafted page can install a lightweight theme without any consent prompt. The theme is named by the attacker. Beyond changing the browser's appearance, the report notes that a theme need not change appearance at all and could track the user invisibly via updateURL. The report does not describe what data such tracking would collect or how it would be transmitted.
How this kind of bug works
Browsers expose several URL-related properties on elements and documents: the document URL, the document's base URL, and per-element resolved URLs. The base URL is not fixed: a <base href> element in the document changes how relative URLs are resolved for the whole document, and APIs that report a resolved URL will reflect it.
When server-side or client-side code makes a trust decision (may this origin install an add-on, may this frame navigate the top window, may this page read this resource) it must use the origin of the document as the browser enforces it, not a string the document can rewrite. Any check that reads baseURI, a resolved href, or a similar derived value and compares it to a list of trusted hosts is suspect, because the page controls part of the input.
The same class of mistake appears wherever privilege is granted based on a URL that the requesting context can influence: install prompts, permission grants, postMessage origin checks, redirect allowlists and CORS-style origin comparisons. Defences are straightforward: compare the actual origin (scheme, host and port) of the initiating document, treat all URL strings from content as untrusted, and require explicit user consent for privileged actions regardless of origin.
How to test for it
- Identify features where a page's origin determines a privilege: silent installs, permission prompts, cross-origin reads, or navigation rights.
- Find the code path that performs the comparison. In browser or extension code, look for reads of
baseURI,documentURI, resolvedhrefvalues, orownerDocumentURLs feeding into allowlist checks. - Craft a page on an untrusted origin that adds a
<base href>pointing at the trusted host, then trigger the privileged action. - A positive result is the privileged action completing with no consent prompt, or the check passing when the real origin is not on the allowlist.
- Vary the technique:
<base>injection, relative URL resolution, redirects that change the final URL, and documents whose base differs from their origin.
Common false positives: the action still shows a consent prompt (the check may run elsewhere), the install fails at a later validation step, or the page was already served from the trusted origin. Confirm the real origin of the document that triggered the action before reporting.
How it is fixed
Hunting notes
This bug class hides in browser chrome code, extension APIs, and any web application that grants privileges based on a URL string taken from the request context. Recon signals include allowlists of trusted hosts in client-side code, install or permission flows that skip a prompt for "trusted" sites, and any comparison that reads a resolved URL rather than an origin.
To get a report accepted, show the privileged outcome with the real origin clearly visible (for example in the address bar or a logged document URL), demonstrate that no consent prompt appeared, and keep the proof of concept minimal. If the impact is invisible, as with a theme that only sets an updateURL, explain the concrete harm rather than relying on the visual change.
What happened, in plain words
Firefox lets you change how it looks by installing a theme: a small package that changes colours, images or the toolbar. Some themes are "lightweight", meaning they are simple and can be installed from a website. Normally the browser asks you first: do you want to install this? That question is called a consent prompt, and it exists so that a website cannot quietly change your browser.
The security checks treat a page as discovery.addons.mozilla.org when deciding whether to install a theme without asking.
The researcher, Wladimir Palant, found that this check was looking at the wrong piece of information. Instead of asking "which website is this really?", the browser asked the page for a value called baseURI, and a page can set that value itself. The report describes the trick as a <base href="..."> tag. A page on any website can add that tag, claim to be discovery.addons.mozilla.org, and the check believes it.
The proof of concept page attached to the report does exactly this. Opening it immediately installs a theme named "Hacked you", with no prompt, because the security checks consider that page to be discovery.addons.mozilla.org.
The report also raises a second worry, referring to bug 527463: a theme might not even change the appearance of Firefox but invisibly track the user via updateURL instead. In other words, the visible change is not the only possible harm. The report does not say what such tracking would collect or where it would send it.
The platform records this as a medium severity privilege escalation issue in the Toolkit: Add-ons Manager. No bounty or CVSS score is given, and the report does not describe the fix.
In general, how this kind of bug works
A URL is the address of something on the web, for example https://example.com/page. Its origin is the combination of scheme (https), host (example.com) and port. Browsers use the origin as the basis for trust: two pages with the same origin may share data, pages with different origins may not.
A base URL is a related idea. When a page contains a relative link such as images/logo.png, the browser needs a starting point to turn it into a full address. That starting point is the base URL, and a page can change it with a <base href="..."> tag. This is a normal, useful feature. It becomes dangerous when security code treats the base URL as if it were the page's real address.
The mistake here is a general one: a trust decision was made using a value the page itself can rewrite. The browser should have compared the actual origin of the document that started the install against its list of trusted sites. Instead it compared a string the document controls. Any check that reads baseURI, a resolved href, or a similar derived value and compares it to a list of trusted hosts is suspect for the same reason.
The same pattern appears wherever privilege is granted based on a URL the requesting page can influence: install prompts, permission grants, postMessage origin checks, redirect allowlists and CORS-style origin comparisons. The defences are straightforward: compare the real origin (scheme, host and port) of the initiating document, treat every URL string coming from page content as untrusted, and require explicit user consent for privileged actions regardless of origin.
How to test for it
- Look for features where a page's origin decides a privilege: silent installs, permission prompts, cross-origin reads, or navigation rights. Why it matters: these are the places where a wrong trust decision has a real effect.
- Find the code that performs the comparison. In browser or extension code, look for reads of
baseURI,documentURI, resolvedhrefvalues, orownerDocumentURLs feeding into allowlist checks. Why it matters: you need to know which value the check trusts before you can influence it. - Build a page on an untrusted origin that adds a
<base href>pointing at the trusted host, then trigger the privileged action. Why it matters: this reproduces the exact trick from this report. - A positive result is the privileged action completing with no consent prompt, or the check passing when the real origin is not on the allowlist. Why it matters: the absence of the prompt is the observable proof.
- Vary the technique:
<base>injection, relative URL resolution, redirects that change the final URL, and documents whose base differs from their origin. Why it matters: one working variant confirms the class of bug, not just a single path.
Common false positives: the action still shows a consent prompt (the check may run elsewhere), the install fails at a later validation step, or the page was already served from the trusted origin. Confirm the real origin of the document that triggered the action before reporting.
How it is fixed
Where to look
This bug class hides in browser chrome code, extension APIs, and any web application that grants privileges based on a URL string taken from the request context. Signals worth watching for include allowlists of trusted hosts in client-side code, install or permission flows that skip a prompt for "trusted" sites, and any comparison that reads a resolved URL rather than an origin.
To get a report accepted, show the privileged outcome with the real origin clearly visible (for example in the address bar or a logged document URL), demonstrate that no consent prompt appeared, and keep the proof of concept minimal. If the impact is invisible, as with a theme that only sets an updateURL, explain the concrete harm rather than relying on the visual change.
Glossary
- Theme: a package that changes how Firefox looks, such as colours, images or the toolbar.
- Lightweight theme: a simple theme that can be installed from a website.
- Consent prompt: the question the browser shows before doing something that affects you, such as installing a theme.
- Add-ons Manager: the part of Firefox that handles installing, listing and removing add-ons and themes.
- Toolkit: the shared code base that Firefox and related Mozilla products are built from.
baseURI: a property that reports the base URL of a document or element, which the page can change.- Document URI: the actual address of the page you are viewing.
<base href="...">: an HTML tag that sets the base URL used to resolve relative links in a page.- Base URL: the starting point a browser uses to turn a relative address into a full one.
- URL: the address of something on the web.
- Origin: the combination of scheme, host and port that browsers use to decide whether two pages may trust each other.
- Allowlist: a list of sites that are trusted for some action.
- Privilege escalation: gaining a level of access or capability you should not have.
updateURL: the address a theme uses to check for and fetch updates.- Proof of concept: a minimal page or script that demonstrates a bug.
- CVSS: a standard scoring system for the severity of a security issue.
postMessage: a browser mechanism for sending messages between pages, whose origin checks are a common place for this kind of mistake.- CORS: a browser rule set that controls which origins may read responses from another origin.
- False positive: a test result that looks like a bug but is not one.