Firefox/Privacy
This article overviews how to configure Firefox to enhance security and privacy.
Contents
-
1 Configuration
- 1.1 Anti-fingerprinting
- 1.2 Tracking protection
- 1.3 Change browser time zone
- 1.4 Change user agent and platform
- 1.5 WebRTC exposes LAN IP address
- 1.6 Disable HTTP referer
- 1.7 Disable telemetry
- 1.8 Enable Do Not Track Header (DNT)
- 1.9 Disable/Enforce Trusted Recursive Resolver
- 1.10 Disable geolocation
- 1.11 Disable Safe Browsing service
- 1.12 Disable WebGL
- 2 Enterprise policies
- 3 Extensions
- 4 Sanitized profiles
- 5 Removal of subsystems
- 6 Hardened user.js templates
- 7 See also
Configuration
The following are privacy-focused configuration tweaks to prevent browser fingerprinting and tracking.
Anti-fingerprinting
Mozilla has started an anti-fingerprinting project in Firefox, as part of a project to upstream features from Tor Browser. Many of these anti-fingerprinting features are enabled by setting about:config
:
-
privacy.resistFingerprinting
true
There is no user-facing documentation about this flag, and Mozilla does not recommend users enable it, since it will break a few websites (it exists mostly to make life easier for the Tor Browser developers). But it does automatically enable many of the features listed below (such as changing your reported timezone and user agent), as well as protection against other, lesser-known fingerprinting techniques. See the tracking bug that lists many of these features.
Tracking protection
Firefox gained an option for tracking protection. It can be enabled by setting about:config
:
-
privacy.trackingprotection.enabled
true
Apart from privacy benefits, enabling tracking protection may also reduce load time by 44%.
Note that this is not a replacement for ad blocking extensions such as uBlock Origin and it may or may not work with Firefox forks. If you are already running such an ad blocker with the correct lists, tracking protection might be redundant.
Change browser time zone
The time zone of your system can be used in browser fingerprinting. To set Firefox's time zone to UTC launch it as:
$ TZ=UTC firefox
Or, set a script to launch the above (for example, at /usr/local/bin/firefox
).
Change user agent and platform
You can override Firefox's user agent with the general.useragent.override
preference in about:config
.
The value for the key is your browser's user agent. Select a known common one.
- The value
Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0
is used as the user agent for the Tor browser, thus being very common. - The #Anti-fingerprinting option also enables the Tor browser user agent and changes your browser platform automatically.
To change the platform for firefox, add the following string
key in about:config
:
general.platform.override
Select a known common platform that corresponds with your user agent.
Win32
is used as the platform for the Tor browser, corresponding with the user agent provided above.WebRTC exposes LAN IP address
To prevent websites from getting your local IP address via WebRTC's peer-to-peer (and JavaScript), open about:config
and set:
-
media.peerconnection.ice.default_address_only
totrue
-
media.peerconnection.enabled
tofalse
. (only if you want to completely disable WebRTC)
You can use this WebRTC test page and WebRTC IP Leak VPN / Tor IP Test to confirm that your internal/external IP address is no longer leaked.
Disable HTTP referer
HTTP referer is an optional HTTP header field that identifies the address of the previous webpage from which a link to the currently requested page was followed.
Set network.http.sendRefererHeader
to 0
.
Disable telemetry
Set toolkit.telemetry.enabled
to false
and/or disable it under Preferences > Privacy & Security > Firefox Data Collection and Use.
Enable Do Not Track Header (DNT)
Set privacy.donottrackheader.enabled
to true
or toggle it in Preferences > Privacy & Security > Tracking Protection
Disable/Enforce Trusted Recursive Resolver
Firefox 60 introduced a feature called Trusted Recursive Resolver (TRR). It circumvents DNS servers configured in your system, instead sending all DNS requests over HTTPS to Cloudflare servers. While this is significantly more secure (as "classic" DNS requests are sent in plain text over the network, and everyone along the way can snoop on these), this also makes all your DNS requests readable by Cloudflare, providing TRR servers.
- If you trust DNS servers you've configured yourself more than Cloudflare's, you can disable TRR in
about:config
by settingnetwork.trr.mode
(integer, create it it it doesn't exist) to5
. (A value of 0 means disabled by default, and might be overridden by future updates - a value of 5 is disabled by choice and will not be overridden.) - If you trust Cloudflare DNS servers and would prefer extra privacy (thanks to encrypted DNS requests), you can enforce TRR by setting
network.trr.mode
to3
(which completely disables classic DNS requests) or2
(uses TRR by default, falls back to classic DNS requests if that fails). Keep in mind that if you're using any intranet websites or trying to access computers in your local networks by their hostnames, enabling TRR may break name resolving in such cases. - If you want to encrypt your DNS requests but not use Cloudflare servers, you can point to a new DNS over HTTPS server by setting
network.trr.uri
to your resolver URL. A list of currently available resolvers can be found in the curl wiki, along with other configuration options for TRR.
Disable geolocation
Set geo.enabled
to false
in about:config
.
Disable Safe Browsing service
Safe Browsing offers phishing protection and malware checks, however it may send user information (e.g. URL, file hashes, etc.) to third parties like Google.
To disable the Safe Browsing service, in about:config
set:
-
browser.safebrowsing.malware.enabled
tofalse
-
browser.safebrowsing.phishing.enabled
tofalse
In addition disable download checking, by setting browser.safebrowsing.downloads.enabled
to false
.
Disable WebGL
WebGL is a potential security risk.[1] Set webgl.disabled
to true
in about:config
if you want to disable it.
Enterprise policies
Network and system-wide policies may be established through the use of enterprise policies which both supplements and overrides user configuration preferences. For example, there is no documented user preference to disable the checking of updates for beta channel releases. However, there exists an enterprise policy which can be effectively deployed as a workaround. Single and/or multiple policies may be administered through policies.json
as follows:
- Disable application updates
- Force-enable hardware acceleration
{ "policies": { "DisableAppUpdate": true, "HardwareAcceleration": true } }
Verify that Enterprise Policies
is set to Active
under about:support and review release-specific policies under about:policies.
Extensions
See Browser extensions#Privacy.
Several extensions, hidden to the user, are installed by default in /usr/lib/firefox/browser/features
. Many can be safely removed via rm extension-name.xpi
in order to completely remove unwanted features. Many of these extensions are not enabled by default and have a menu option for enabling or disabling. about:support
lists all combined user and system extensions. Note that any files removed will return upon update of the firefox package. To keep these extensions removed, consider adding the directories to NoExtract=
in pacman.conf
, see Pacman#Skip files from being installed to system. Below are a few examples of these extensions and their features.
-
activity-stream@mozilla.org.xpi
- "Activity Stream" which replaces the new tab page. See [2]
-
firefox@getpocket.com.xpi
- Pocket
-
followonsearch@mozilla.com.xpi
- Search telemetry. See also #Disable telemetry.
-
shield-recipe-client@mozilla.org.xpi
SHIELD studies
Firefox installations to paths such as the default release installed to /opt
have system extensions installed at /firefox/firefox/browser/features
See also [3] for a full list of system extensions including README files describing their functions.
Sanitized profiles
prefs.js
Files which constitute a Firefox profile can be be stripped of certain metadata. For example, a typical prefs.js
contains strings which identify the client and/or the user.
user_pref("app.normandy.user_id", "6f469186-12b8-50fb-bdf2-209ebc482c263"); user_pref("security.sandbox.content.tempDirSuffix", "2a02902b-f25c-a9df-17bb-501350287f27"); user_pref("toolkit.telemetry.cachedClientID", "22e251b4-0791-44f5-91ec-a44d77255f4a");
There are multiple approaches by which these strings can be reset with the caveat that a master prefs.js
must first be created without such identifiers and synced into a working profile. The simplest solution is close Firefox before copying its prefs.js
to a separate location:
$ cp ~/.mozilla/firefox/example.default-release/prefs.js ~/prefs.sanitized.js
Strip out any and all identfier strings and date codes by either setting them to 0 or removing the entries outright from the copied prefs.js
. Sync the now sanitized prefs.js
to the working profile as required:
$ rsync -v ~/.prefs.sanitized.js ~/.mozilla/firefox/example.default-release/prefs.js
A secondary privacy effect is also incurred which can be witnessed by examining the string results between a sanitized prefs.js
versus a working prefs.js
at Fingerprint JS API Demo.
extensions.json
Assuming that extensions are installed, the extensions.json
file lists all profile extensions and their settings. Of note is the location of the user home directory where the .mozilla
and extensions
folder exist by default. Unwanted background updates may be disabled by setting applyBackgroundUpdates
to the appropriate 0
value. Of minor note are installDate
and updateDate
. Bubblewrap can effectively mask the username and location of the home directory at which time the extensions.json
file may be sanitized and modified to point to the sandboxed HOME
location.
{"schemaVersion":31,"addons":[{"id":"uBlock0@raymondhill.net","syncGUID":"{0}","version":"0","type":"extension","optionsURL":"dashboard.html","optionsType":3,"optionsBrowserStyle":true,"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"embedderDisabled":false,"installDate":0,"updateDate":0,"applyBackgroundUpdates":0,"path":"/home/r/.mozilla/firefox/example.default-release/extensions/uBlock0@raymondhill.net.xpi","skinnable":false,"softDisabled":false,"foreignInstall":true,"strictCompatibility":true}}
Removal of similar metadata from addonStartup.json.lz4
and search.json.mozlz4
can also be accomplished. mozlz4 is a command-line tool which provides compression/decompression support for Mozilla (non-standard) LZ4 files.
Removal of subsystems
Telemetry related to crash reporting may be disabled by removing the following:
/usr/lib/firefox/crashreporter /usr/lib/firefox/minidump-analyzer /usr/lib/firefox/pingsender
For those who have opted to install Firefox manually from official Mozilla sources, the updater system may be disabled by removing updater
in the firefox
directory.
Hardened user.js templates
Several active projects maintain comprehensive hardened Firefox configurations in the form of a user.js
config that can be dropped to Firefox profile directory:
- pyllyukko/user.js
- ghacksuserjs/ghacks-user.js
- ffprofile.com (github) - online user.js generator. You select which features you want to enable and disable and in the end you get a download link for a zip-file with your profile template. You can for example disable some functions, which send data to Mozilla and Google, or disable several annoying Firefox functions like Mozilla Hello or the Pocket integration.
See also
- privacytools.io Firefox Privacy Add-ons
- prism-break.org Web Browser Addons
- MozillaWiki:Privacy/Privacy Task Force/firefox about config privacy tweeks - a wiki page maintained by Mozilla with descriptions of privacy specific settings.
- How to stop Firefox from making automatic connections - Is an annotated list of corresponding Firefox functionality and settings to disable it case-by-case.