by jacquesm · 11y ago · 0 comments
All these extra bells and whistles added to browsers to allow websites to pretend they're 'native apps' should require a very large switch to be thrown from 'safe' to 'unsafe' whenever an application requests such a thing. And what a pdf reader has to do with javascript is a mystery as well. Systems that are too complex are almost by definition insecure.
The whole reader is written in Javascript: https://mozilla.github.io/pdf.js/
If you don't want a browser that has some notion of "local file context" you should just sell your laptop and go live in a cave. FWIW the entire Firefox UI and every plugin for it is _written_ in Javascript served from local disk. Chrome, Safari and IE aren't far behind
this is kind of a silly statement. nobody would argue a program shouldn't be able to access local files, in this case, we would presume, PDF content that's been downloaded into a cache. the very simple argument is that the code which deals with opening and reading files from disk should be completely isolated from scripting-language code that runs dynamically in the same object space as the front-end scripting environment. e.g., put the .js in a sandbox by default the way we used to take for granted.
I understand that in the Mozilla suite, this barn door was left open years ago and the horses are far and wide by now.
Example (used by Mariusz Mlynski to win Pwn2Own this year): https://www.mozilla.org/en-US/security/advisories/mfsa2015-3...
Just like switching to PDF.js was a decision taken to try and reduce the security attack surface, the decisions to add webgl, webrtc, webfonts, webm, websockets, new css features and so on were all decisions taken in the full knowledge that adding those things would vastly increase the attack surface and inevitably lead to security exploits. These new web features are responsible for a slew of new vulnerabilities and new classes of information leaks.
Thank you for your constructive advice.
And I note that so far my stuff written in 'memory unsafe languages' has been in production since '99 or so without a compromise to date over 100's of billions of requests.
Maybe it's not just the language.
And what business does a browser have with a .pdf file anyway, where does that end? excel sheets? word documents? proprietary format 'x'? Web browsers should stick to web browsing or at least have a mode where they will stick to just web browsing.
On a more serious note, I guess this is the toll we have to pay for innovation pushing. I can understand the reasoning behind writing everything in JS: it allows you to consolidate a lot of mechanisms in a single platform. Once you have that platform secure, any application you will write will (should?) be secure too.
Too bad that theory and practice are usually not the same, in practice..
What innovation and what benefits do I reap by using pdf.js? It's slower and has less features than okular. It's stuck inside a firefox window, so I cannot add a window rule for it (barring adding one for firefox in general).
The same holds on windows: why would I use pdf.js when there are faster, lighter pdf readers (e.g. sumatra) or the actual adobe acrobat reader and its eight bilions features? Heck, I've also noticed that many users will skim the file and then forget to save it, so it doesn't even help less tech savy users.
There are genuine improvement in the new web technologies, but they are mixed with a lot of stuff that simply does not belong there, and with the insufferable attitude "you can do in javascript, hence you should it in javascript" (I'm not criticizing you, eh, and there is some security argument to be made).
Do you mean the browser, or just this particular feature?
Recommended reading: http://lcamtuf.coredump.cx/postxss/ and http://lcamtuf.coredump.cx/tangled/.
If you do choose to read them, I recommend doing it earlier in the day--fitful sleep has been observed after evening reading of the above.
> And what a pdf reader has to do with javascript is a mystery as well.
It's a pdf reader written in JavaScript, just as there are other pdf readers written in other programming languages.
Maybe it would be better if browsers didn't have a pdf viewer, though. Then I'd have to manually download it and open it in a viewer to get owned, which is not going to happen with an ad network.
The fact that every major pdf viewer app tries to install a browser plugin doesn't help.
Safari uses the same library as Apple's Reader. So it's a proprietary native blob.
Edit: While Chrome uses a native blob, I believe it's not proprietary. I think they use pdfium (https://pdfium.googlesource.com/pdfium/)
I think the main reason Chrome bothered making one was because Adobe's reader kept having security vulnerabilities. I trust Chrome's one more than Adobe's. (I just looked up cvedetails.com for Adobe » Acrobat Reader. Security Vulnerabilities Total number of vulnerabilities : 434)
https://support.mozilla.org/en-US/kb/disable-built-pdf-viewe...
and for those who think lynx is a more secure alternative, read this thread: http://marc.info/?l=openbsd-tech&m=140516601718662&w=2
- creates an empty directory,
- fork the mount table for the new bash process and its children (requires privileges),
- unshare /home (required if / is mounted in shared mode [1]),
- hide /home by mount-binding the empty directory,
- start firefox in unprivilegied mode, without being able to access to user's files.
[1] https://www.kernel.org/doc/Documentation/filesystems/shareds...
Or just give up and go QuubeOS ;)
Obviously docker, as opposed to Qubes, won't stop more complex malware that exploits the kernel.
[1] http://danwalsh.livejournal.com/31146.html
[2] http://www.bress.net/blog/archives/195-Firefox-in-a-sandbox-...
$ firefox
you start $ docker run mozilla/firefox
and get instant process isolation and protection from these kinds of exploits.Heck, mozilla could use the same underlying mechanisms internally (cgroups, namespaces) that docker already uses without introducing the dependency on docker (if that's whats bothering you). So while the implementation may not be ideal (installing docker is an overhead, I acknowledge that), what it does technology-wise is an improvement for security.
If you want to use a chroot oriented container manager its better to use an unprivileged container so you are not running as root. Currently only LXC has support for unprivileged containers. We have an experimental GUI app container with Chrome that can be used in unprivileged mode. [2]
You can even run your own sandbox with a simple command like this 'unshare -fp --mount-proc' That gives you a bash shell in its own pid space. You can expand this command further to use more namespaces like mount, net, user to get yourself a sandbox.
That is what apps like firejail and container managers are using, but its useful to know what's happening underneath. We are currently working on a guide on how to use unshare that may help. [3]
[1] https://l3net.wordpress.com/projects/firejail/
Sandboxie has gotten very good over the years. You can sandbox programs that even run with admin privileges.
edit: Don't think sandboxie can load drivers.
https://zeltser.com/security-risks-and-benefits-of-docker-ap...
The isolation provided by Docker is not as robust as the segregation established by hypervisors for virtual machines.
As seen with CVE-2015-3629[0] for instance.
The other points: patch level and docker management isn't understood, seem to be people problems which can easily be corrected.
[0]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3629