Letting users block injected third-party DLLs in Firefox
hacks.mozilla.org
hacks.mozilla.org
The user sees "firefox has crashed". But the reality is that your antivirus dll has crashed inside firefox, and firefox is getting the blame for being crappy software.
Chrome has plugins and it rarely crashes with the plugins I typically use. Originally, I had to switch from Firefox because of unstable plugins (although I have come back on mobile, because at least they gave plugins).
How is Chrome able to encapsulate, but Firefox isn't? And why shouldn't that be blamed on the browser itself? Maybe I am confusing "extensions" and "plugins". If so, how are they different?
Unfortunately, the way these third party injected DLL's work, they have full access to all memory within the firefox process. When they go wrong, they can corrupt or change anything, so it is pretty hard to protect against them.
> Chrome has plugins and it rarely crashes with the plugins I typically use.
Chrome doesn't allow 3rd party DLL's either. Chrome plugins run inside the javascript VM.
They made the change 5+ years ago, and it really helped stopping crashes.
They're normally things like the a gaming mouse which has a DLL that injects into every windows process to make the mouse light change colour when you hover over a text field. Or a 'firewall' that injects into every process to try and find HTTPS encryption keys so it can scan HTTPS content in realtime. Or a 'password protected folders' feature that will pop up a dialog box if any program tries to read a file in a protected folder and ask for the unlock password.
And all 3 of those can easily crash in Firefox. The gaming mouse doesn't understand that firefox renderers live in a sandbox, so when it tries to send a message to the mouse to change the light color that breaches the sandbox causing a crash. The 'firewall' assumes the https encryption key will be in memory of the process making the TCP connection - but in a multi-process architecture that may not be the case - so crashes. The 'password protected folders' makes a dialog box, but hangs the calling thread until the user types the password. Because firefox is multi-process, they have a hang detector which thinks the process has locked up so kills it, and the user thinks it crashed.
All in all, these 'kinda plugins for windows, but not using any official API' are a bad idea when they interact with code they have never been tested to work with. Thats the real problem.
I know some people consider proper binary signing difficult on Windows and find the UAC prompts annoying, but those are multi-billion dollar companies, I'm pretty sure they can figure it out.
If anything, Firefox shouldn't be the one doing this, Windows itself should be preventing loading of unsigned/improperly signed DLLs without a UAC prompt.
Drivers from Intel/Nvidia/AMD are signed by Microsoft, WHQL certified, and are not part of Windows, so as far as Mozilla is concerned they are third-party drivers.
[1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/i...
WHQL is only required for distribution in Windows Update.
What do you mean by "improperly designed DLLs"? The presence of these is totally normal because most of the graphics drivers are implemented in user-mode and loaded into whatever process uses Direct3D or another graphics API. If you block these, you won't be able to use 3D APIs.
Nvidia are notoriously .. not good, but a substantial part of the 3D API runs client-side userspace, and a substantial part of the huge NVIDIA "geforce experience" is a set of game-specific patches, because NVIDIA have their own opinions on how to optimise for framerate.
It also provides a whole bunch of features! There's an entire overlay screen you can bring up with screenshot/video recording options, camera effects for screenshots, etc.
(also top tip even if you don't have NVIDIA - try pressing Win-G in random applications to see if they count as "games" which will let you use the DirectX screen recorder provided by Windows)
> Windows itself should be preventing loading of unsigned/improperly signed DLLs without a UAC prompt.
That's the "UAP" model and its successor, which provide mobile-like actual app isolation. Otherwise you (or rather, processes running as your user account or above) can generally just inject at runtime any DLL into any process.
It's part of their "value add" I guess. Nvidia drivers will literally patch video games behind the scenes. It's so insane I can't believe it even works.
Even Windows does, Microsoft actively checked if SimCity 2000 was running because without special treatment it would crash on newer Windows Versions due to an allocator bug.
You'd think they'd only need to hook into Explorer.exe but alas no, they show up in every process. I guess because of the file picker dialog which is an embedded Explorer window running in the host process.
And perhaps a reason why Mozilla wants to hurry and get off of Windows 7.
https://chromium.googlesource.com/chromium/src/+/578c7a852a4...
Also that AV is far more apt to be guilty of injecting some bullshit into the process space.
Then the OS has spoken. Having user space applications pretend to include security barriers that can be easily circumvented is not the way.
> Also that AV is far more apt to be guilty of injecting some bullshit into the process space.
Many AVs have a terrible track record, yes. Perhaps if Mozilla actually cared they should start their own and try to do better? At least it would run as a privileged process and have some chance at success.
Another example of these "silently user-hostile" applications is VirtualBox; it spawns multiple processes in a similar way, and even resists attempts to debug it if it's already running. I remember being incensed enough by it complaining about my --- patched to make the OS work for me and no others --- system DLLs not matching its internal whitelist and not starting, but not after I exercised the same skills to patch out those checks in it.
The title literally says it is giving users that power. This is empowering you, by giving you the ability to see which DLLs are being injected into Firefox.
They do block some by default, certainly, but only ones which in practice just crash Firefox (often because they are old).
They do block some by default, certainly, but only ones which in practice just crash Firefox (often because they are old).
Is there a way to unblock them as easily as blocking them?
As long as it's all end user-controlled, I suppose the only issue is awareness that this feature exists and how it's controlled (this is the first time I've read about it).
Also, it feels somewhat weird to have this function in an application rather than at the OS level (or as a independent process firewall application) - but I suppose this is fine.
The latter is how Microsoft secures Protected Container in Edge.
It's not particularly easy to set up and is just a complete block. The options are called Arbitrary Code Guard, Code Integrity Guard and (for old versions) Disable extension points.
https://learn.microsoft.com/en-us/microsoft-365/security/def...
And the only way to turn that restriction off, is to either use Firefox Nightly or Firefox Developer Edition (which is a beta). If you want to use stable Firefox, because you like having a stable web browser, you just can't turn the restriction off. Period. The closest thing you can do is installing it as a "temporary extension" which uninstalls itself when the browser restarts.
It's kind of ridiculous that the default browser of most Linux distros has a Apple-esque mentality of "we get to tell you what you're allowed to install."
Requiring a few hoops - and it sounds like e.g. requiring a developer edition sounds like such a hoop - to ensure a likely misconfiguration was actually intentional and the user is capable of dealing with the consequences is not a bad idea.
In particular, debugging when things go wrong can be an insurmountable task.
Better isolation of software components has been a trend for decades; to the point where I think we can safely say that the old unix and windows model of permissions was a fundamentally insufficient idea. Devs flock to using VMs and containers precisely because uncontrolled interaction between stuff even controlled by the same nominal "user" is a huge pain - and that's before malware and privacy concerns come in.
Were software more isolated by default, and interaction more controlled and/or explicit, then indeed I think the argument against this kind of controlling-the-"user" features would be stronger. But as is? The alternative is clearly much, much worse.
After all, certainly here and often in other cases too - it's not like it's actually impossible to circumvent these restrictions. It's simply technically inconvenient in a way that happens to also prevent many unintentional bugs and some malware vectors.
In an ideal world, a devs for a piece of software would be hard-pressed to even do this, let alone feel the need to do it. But that's just not the world we live in; we're not even really close yet - except on really locked down platforms that go much further than needed to prevent the risks, and into the territory of quite openly restricting the user, not the software.
Except when such hoops then start being used as evidence the user is an undesirable and should be kept away from various services. See e.g. many Android apps refusing to work on rooted phones.
I specifically don't like bucketing things like these under "development" label - "dev mode", "dev build", "dev edition", etc. - because it creates the idea that those "dev capabilities" are there to help developers with development, and should very much not be used for non-development things.
There _will_ be constraints on running programs altering other stuff. Sandboxes _will_ get even stricter. The benefits are so large that this trend will inevitably continue, and rightly so.
To protect the ability to tinker we'll need to instead talk about who gets to control those sandboxes, ultimately. How can we poke holes without allowing abuse by malware or creative (ab)use rendering the system pointless? How can we ensure the poked-holes exist by user choice, not at the behest of a tiny handful of software behemoths?
On a technical level, I don't think that arbitrary and surreptitious dll injection is a line in the sand worth defending. It's not a great abstraction; it's tech debt.
I think giving DLL injections up isn't really solving anything. DLL injection isn't an accident of history - it's a solution to a specific problem. The problem won't disappear if you remove the solution.
The issue in question is that it's also broadly useful to allow software to be modified by third parties in arbitrary ways, without the involvement or cooperation of the software vendor. In fact, the security folks are a major users of this capability - that's how malware scanners work, that's how emergency hot-fixing is done, that's how compliance systems work - and moving towards more evil/dystopian use cases, this capability is needed by anti-cheat systems, DRM, and the modern digital surveillance economy.
All this means that, if you eliminate the current way to let third parties inject code into programs, you'll soon be forced to create the equivalent mechanism yourself. The sandboxes will get stricter to protect users from criminals, and then they'll have holes poked in them to accommodate legitimate actors, both good and bad. Problem is, going through the whole dance of making a sandbox and then making it leaky, is that it generates bloat. You end up roughly in the same place you started, just with an extra layer of abstraction on top.
(And, of course, all those abstraction layers have bugs in them, so the attack surface for criminals is getting larger in the process.)
Why not allow users to decide themselves?
This functionality is enabled by default. That`s why I`m asking - why don't ask the user first?
Upd: please be civil, this is a discussion and not a competition.
As for default, that's a different question unrelated to user freedom. Unfortunately in Windows, DLL injection is very often abused for no good reason. Imagine a simple, non-technical user getting asked about permitting mouse driver DLL.. what would user think? With only information being DLL name/description, they might think that mouse will not work without it and permit it (see https://news.ycombinator.com/item?id=36681873 for real reason). And once firefox starts crashing, will they know how to disable it?
No, it is much safer to disable it all by default. And if a powrer user needs a specific DLL, they can enable it. As a bonus, they will learn where the dialog is, so they can disable it back once the crashes start.