Low firefox Logic Error 🔧 Commit mapped

Overview

Low
Severity
CVSS
No
Exploited ITW
Fixed
Fix Status
Impactlow
DescriptionPrivilege escalation in the Enterprise Policies component
ComponentToolkit
Bug ClassLogic Error
Tracker2059825
Fix commita4f93c656861 (firefox) +16/-12
CISA KEVNot listed
CreditedThe Mozilla Fuzzing Team
Disclosed2026-08-18

Changed Functions

FunctionChangeNotes
onBeforeAddons
browser/components/enterprisepolicies/Policies.sys.mjs
modified
if
browser/components/enterprisepolicies/Policies.sys.mjs
modified
if
toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
modified
_readData
toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
modified

Files Changed

  • browser/components/enterprisepolicies/Policies.sys.mjs
  • toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
  • toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
diff --git a/browser/components/enterprisepolicies/Policies.sys.mjs b/browser/components/enterprisepolicies/Policies.sys.mjs
index 9aad627a7f6..2009e0af4e7 100644
--- a/browser/components/enterprisepolicies/Policies.sys.mjs
+++ b/browser/components/enterprisepolicies/Policies.sys.mjs
@@ -49,8 +49,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
 const PREF_LOGLEVEL = "browser.policies.loglevel";
 const BROWSER_DOCUMENT_URL = AppConstants.BROWSER_CHROME_URL;
 
-const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
-
 ChromeUtils.defineLazyGetter(lazy, "log", () => {
   let { ConsoleAPI } = ChromeUtils.importESModule(
     "resource://gre/modules/Console.sys.mjs"
@@ -95,7 +93,7 @@ export var Policies = {
   // Use the same timing that you used for setting up the policy.
   _cleanup: {
     onBeforeAddons() {
-      if (Cu.isInAutomation || isXpcshell) {
+      if (Cu.isInAutomation) {
         lazy.clearBlockedAboutPages();
       }
       Services.obs.notifyObservers(
diff --git a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
index 4da86126cc0..2e213da105b 100644
--- a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
+++ b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
@@ -5,6 +5,14 @@
 import { EnterprisePolicyTesting } from "resource://testing-common/EnterprisePolicyTesting.sys.mjs";
 
 export async function runBackgroundTask(commandLine) {
+  // This process runs with its own profile, so it doesn't inherit the xpcshell
+  // harness's automation prefs, which the policy engine requires to read
+  // `browser.policies.alternatePath`.
+  Services.prefs.setBoolPref(
+    "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer",
+    true
+  );
+
   let filePath = commandLine.getArgument(0);
   await EnterprisePolicyTesting.setupPolicyEngineWithJson(filePath);
 
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
index 52971e49420..76ef9303765 100644
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
@@ -55,14 +55,12 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => {
   });
 });
 
-const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
+// Testing escapes in this file must key on Cu.isInAutomation.
 
-// On Nightly under a test harness, ignore real system/user policies so a
-// developer's local policies.json or registry entries don't leak into tests.
-// Restricted to Nightly so release builds never expose a way to bypass
-// enterprise policies via a test env var.
+// On Nightly in automation, ignore real system/user policies so a developer's
+// local policies.json or registry entries don't leak into tests.
 function shouldIgnoreLocalPolicies() {
-  return AppConstants.NIGHTLY_BUILD && (Cu.isInAutomation || isXpcshell);
+  return AppConstants.NIGHTLY_BUILD && Cu.isInAutomation;
 }
 
 // We're only testing for empty objects, not
@@ -701,7 +699,7 @@ class JSONPoliciesProvider extends PoliciesProvider {
     // work as expected.
     if (
       alternatePath &&
-      (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD || isXpcshell) &&
+      (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD) &&
       (!configFile || !configFile.exists())
     ) {
       if (alternatePath.startsWith(MAGIC_TEST_ROOT_PREFIX)) {
@@ -773,7 +771,7 @@ class WindowsGPOPoliciesProvider extends PoliciesProvider {
     // user policies first and then replace them if necessary.
     this._readData(wrk, wrk.ROOT_KEY_CURRENT_USER);
     // We don't access machine policies in testing
-    if (!Cu.isInAutomation && !isXpcshell) {
+    if (!Cu.isInAutomation) {
       this._readData(wrk, wrk.ROOT_KEY_LOCAL_MACHINE);
     }
   }
@@ -781,7 +779,7 @@ class WindowsGPOPoliciesProvider extends PoliciesProvider {
   _readData(wrk, root) {
     try {
       let regLocation = "SOFTWARE\\Policies";
-      if (Cu.isInAutomation || isXpcshell) {
+      if (Cu.isInAutomation) {
         let altLocation = Services.prefs.getStringPref(PREF_ALTERNATE_GPO, "");
         if (altLocation) {
           regLocation = altLocation;
Loading diff…

Regression Test / PoC

shipped with the fix
diff --git a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
index 4da86126cc0..2e213da105b 100644
--- a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
+++ b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
@@ -5,6 +5,14 @@
 import { EnterprisePolicyTesting } from "resource://testing-common/EnterprisePolicyTesting.sys.mjs";
 
 export async function runBackgroundTask(commandLine) {
+  // This process runs with its own profile, so it doesn't inherit the xpcshell
+  // harness's automation prefs, which the policy engine requires to read
+  // `browser.policies.alternatePath`.
+  Services.prefs.setBoolPref(
+    "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer",
+    true
+  );
+
   let filePath = commandLine.getArgument(0);
   await EnterprisePolicyTesting.setupPolicyEngineWithJson(filePath);
Loading diff…