The Linux Security Circus: On GUI Isolation (2011)
theinvisiblethings.blogspot.com
theinvisiblethings.blogspot.com
Sure, if you have a rogue application on your computer, it can access the GUI of a program whose security is critical (e.g: a password manager), but even if all the GUI were isolated, you've still got a rogue program on your comp.
All the security posts I've ever read have pretty much told me that once you're running a malicious program, then it's game over, your system is owned by your adversary and the only good way to move on is to wipe the drives, and start fresh. Why then worry about GUI isolation? If the GUI is isolated, a rogue program can presumably uninstall your secure GUI server and replace it with another!
This blog mentions Qubes, which is cool and does mitigate the rogue program from what I understand, but anything short of isolating whole applications from each other at the hypervisor-level, is fussing about the wrong thing IMHO.
Then again, I'm not a security professional, so what I've said is likely all wrong...
Is there anything wrong about this?
No, X11 won't provide it for you, but browser will.
QubesOS is in that category. It's technically called a Multiple Single Levels (MSL) of security system. The isolation tries to keep problems in each VM.
But X is the one thing that can't be done well by those because granting access to the unix socket that's needed by X means leaving the barn door wide-open.
It's been almost two decades since unix systems were routinely used in true multi tenancy situations with untrusted tenants. Since then nobody has paid any attention to this aspect of security.
I don't think it's that simple, all or nothing. Security is not a boolean. Consider defense in depth [0].
edit: Security is just a price to hack you. You can increase it by adding additional problems to an adversary.
[0] https://en.wikipedia.org/wiki/Defense_in_depth_%28computing%...
That's the default case, because any program that has bugs and takes foreign data has to be considered untrusted.
>All the security posts I've ever read have pretty much told me that once you're running a malicious program, then it's game over
Well, isn't that because of gaping holes like in the X11 design besides any bugs?
> anything short of isolating whole applications from each other at the hypervisor-level, is fussing about the wrong thing IMHO.
Unless it has bugs, too. (And if it doesn't because it is simple enough, it will evolve to send mail and eventually get bugs, or the applications are just monoliths that can't be well hypervised)
There's no reason that can't be true of actual OSes. All programs could be sandboxed by default. But they just were designed under the assumption that all app makers would be good and no one would ever download and run malicious programs. Yeah, right.
read, write, sigreturn and exit
This is used by many browsers and apps to reduce the impact of security flaws and untrusted code (such as js from a website).
It is one part of the puzzle of sandboxing software on a machine. But is certainly not the entire solution.
But with the App Store walled garden craze came a much better idea: let's end this "all programs having full run of the filesystem" nonsense and sandbox them, such that it is very hard for a user to compromise his entire machine by installing one bad program. iOS has always been this way, App Store OSX apps are increasingly this way (already has filesystem sandboxing), I believe Windows App Store is pushing this direction, Android has this to an extent, etc.
The "window composition only" approach of Wayland where it is simply assumed that this can be handled in e.g. the GUI toolkit is problematic if you have programs that don't use that toolkit. The windowing server is really the wrong layer implement this isolation - it makes useful things much harder while not actually providing a lot of security; if a malicious program is already running as the user, there are already endless ways it can harm the user without touching the UI. Real sandboxing would be, for example, a way to open a Wayland-style framebuffer that can be handed to a FreeBSD-style jail (or as "hardware" in a full VM).
The next step towards real sandboxing is applications with cgroups and namespaces (quite similar to FreeBSD jails), as in xdg-app.
That's my point - I don't want most of my "desktop" applications sandboxed from each other. That would be unusable. That kind of sandboxing should be done by nesting the entire display server, creating a separation point.
In the future, with all clients sandboxed from each other, how can I write a tool that does the following (which was easy under X):
* monitors the keyboard input of another process
* sends new (synthetic) key events to that process when it sees a certain key press (keyboard macro)
* does not depend on any support from the process being monitored
* works with any existing program, including proprietary software that cannot be recompiled because the source has been lost
Interaction is necessary at the GUI layer, because that's the intended goal of some software. As I initially said, there is certainly room for improvement. However, simply pretending these use-cases don't exist is foolish. As Joel Spolsky so famously explained[1], all that "cruft" that is cut out during a big rewrite is real-world fixes and necessary features that were added over time. Unfortunately, the GNOME team has been engaging in that kind of narcissism for many years, which is why more and more people are ignoring them.
> real sandboxing
> cgroups and namespaces
Good luck with that; cgroups and namespaces are not designed for security. They are only superficially like jails.
[1] http://www.joelonsoftware.com/articles/fog0000000069.html
I'm honestly not sure where we are on the adoption path for Wayland. Pretty much all of my Linux usage is command line.
1: https://blogs.gnome.org/mclasen/2016/03/04/why-wayland-anywa...
KDE is a little bit more behind, but I'd postulate well working Wayland somewhere around Plasma 5.8 - we are going to see 5.6 come out in a few months, and 5.8 is the start of next year. KDE themselves have had to propose tons of extensions to Wayland itself to support functionality they use - server side decorations, screenshotting, key grabbing, etc.
A prototype B3 Trusted X Window System (1991)
https://www.acsac.org/secshelf/papers/Epstein.pdf
High-performance hardware-based high-assurance trusted windowing system (1996)
http://csrc.nist.gov/nissc/1996/papers/NISSC96/paper041/tx-h...
Design of the EROS Trusted Window System (2004)
https://www.usenix.org/legacy/event/sec04/tech/full_papers/s...
A Nitpicker's Guide to Minimal-complexity, Secure GUI (2005)
http://demo.tudos.org/eng_features.html
Feske, a Nitpicker author, later developed the Genode Framework for constructing systems as part of European research into Dresden-style stuff. He wisely integrated Nitpicker, NOVA, and other best-of-breed tech coming out of CompSci where he could. Plus stuff from OSS that's important for a usable system. Result his people call GenodeOS although many of the pieces, even architecture, are reusable outside of it.
GenodeOS itself is at what I'd call an alpha stage where it's usable enough that people are running desktops on it but more for testing and error reports. ;) They've come quite a way but need more testing and contributions. It's not production by far unless you're backing up data.
Even so, alpha software can cost you productivity with the reinstalls so best to use them alongside another machine with same data that can keep you going during any restores.
GenodeOS Release 16.02 is latest http://genode.org/documentation/release-notes/16.02
Note: They support RISC-V now. That's pretty cool. The combo of RISC-V with separation kernels like Muen and seL4 (both supported) will be important for secure, embedded solutions later.
We really, really to figure out secure booting and sandboxed applications in a way that leaves the user in control. Desktop linux has been fairly safe because it's not an important target and because most users get most of their software through distributions.
However, I don't think in 2016 we should just take it for granted that one malicious program should be able to effortlessly own the user agent and probably the entire system (on a computer with one user who uses "sudo").
The problem is that these technologies have been associated, especially in android/ios, with restricting what the user can do. However, this does not need to be the case.
Until recently, most people's data on their computer wasn't too valuable, but malware has gotten more sophisticated at targeting things like bank information. If we wait for linux desktop security to become a serious issue, it will be too late.
The worst thing is that we already have things like SELinux and AppArmor, but they aren't being used. The insecurity of X is no joke, either. We may getting close to a point where we have no choice but to throw out X just to get security, even if the other reasons for switching aren't that compelling.
For example, for a text editor like vim, here's a completely reasonable lockdown:
- see none of my filesystem... except `cwd` I launched you in
- you get a homedir that's persistent for this application
- (incidentally, whatever libraries you need are there; network namespaces dropped, clean env vars, clean pid space, etc etc etc.)
The things on this list involve essentially Nothing Special and no changes to the program, and at the same time manages to radically reduce the surface area a malicious program can mess with on my computer. Even if, say, a malicious version of vim somehow made it in $distro's package tree and was signed: this still makes me... well, pretty safe. The scope of damage is confined to... exactly what I just laid out on those two bullet points.
And subuser's configuration does an excellent job of exposing exactly those kinds of behaviors to you with very minimum amounts of fuss.
(A json file with `{"access-working-directory": true, "stateful-home": true}` is all you have to say to subuser to set up an application to get... well, hey, if these aren't self-documenting names, I don't know what is.)
Which is also why trying to do anything productive on a smartphone is such an uphill battle. Arbitrary programs not being able to exchange arbitrary files is totally crippling for any use-cases that go off the rails of what one single app wants to let you do.
for src in $(find . -type '*.png')
do
sdir="$(echo "${src}" | dirname)"
name="$(echo "${src}" | basename)"
dstdir="/mnt/www/images/${sdir}"
optipng -out "${dstdir}/${name}" "${src}"
convert -scale 120x120\> "${src}" "${dstdir}/small_${name}"
done
into a GUI's "copy paste" feature?You could do literally the same and you didn't even need to drop to the console.
Opening any random file should be reserved to just a few core applications.
Say, VLC team had argued that a video player may need to open a supplementary subtitle file. If application can be only granted access to a single video file - that's impossible. I think there were other examples, but I don't remember those off-hand.
The problem is more that I do not believe any distro is shipping a default-deny policy. Unknown programs are simply given the kitchen sink rather than having, say, user friendly prompts saying "this program has no access control and wants to open X or use Y, allow?"
But we definitely have the technology, and it does not take any heavy overhead isolation to do it.
Arch has a grsec kernel in the repos if you want one...
There are two ways to do MAC - applications (or the distro) provides the profiles, that restrict execution to just what the program will use, and if it ever asks for anything else it should be suspect for exploitation. The other one is where you put your programs in learning mode, and that only hardens you against future exploits, not current ones, and you also lose the protection against untrusted software because by default everything is untrusted and you must trust everything on a case by case basis.
But for anything you install from the main repos, it will almost always have an apparmor / selinux profile installed along with it to prevent this kind of arbitrary filesystem access.
The very first comment below the article (correctly) contradicts the author's claims about SELINUX sandbox. The author acknowledges the comment, and criticizes the SELINUX implementation, but does not dispute the fact that SELINUX sandbox ("sandbox -X xterm" in RHEL/CentOS/Fedora/SL) does in fact defeat the keystroke logger attack described in the article.
Coincidentally, I was planning to spend some time today porting Qubes' GUI isolation to run outside of Qubes (for use between containers or other OS-level sandboxes). If I'm successful, expect to see a Show HN.
Want level >9000.
For more details about the issues and possible solutions read:
http://mupuf.org/blog/2014/02/19/wayland-compositors-why-and...
After reading this I see that "xinput test Keyboard0" can also be used as a keylogger on my machine. Anybody know of a simple way to disable that one?
[PS: please no trollish answers like "use a different windowing system" :P]
Note that the command is "xinput test id". Meaning that it is a way to monitor what xinput sees when a key or button is pressed.
I have personally used xev for similar purposes, map my keyboard's multimedia keys to various actions.
Combined with a way to authenticate privileged apps (which have permission to sniff for any input event and scrape any drawable), you can have your... security cake and eat your... screen grabbers and Guake hotkeys... too?
Xenocara (least-privilege x11)
libc
LibreSSLOn a Sandy Bridge i7.
OpenBSD is pretty good for servers (I run one), but my experience has been that it's just total shit on the laptop.
Wayland, on the other hand, does.
That seems to block this, though not for the reason i expected (i get an error about a mission extension when i try to run xinput list).
btw, can this be considered a huge security plus for web apps? they can break out, but at least they have to put in some effort.
Because the vast majority of GUI software installed on Linux comes from curated app stores (or 'repos' as they used to be called). It's also mostly written without any expectation of making money.
Web apps being sandboxed is a plus point for users in the sense that it increases security (on the local machine - the web app vendor is still free to do whatever they want with your data). It's also a negative since it means any code you want to execute on your own hardware has to be approved by the browser vendors (web standards don't really provide any user controlled way to break out of the sandbox[1]). The standards generally operate in a lowest-common-denominator way such that the vendor of a browser your don't even use can prevent you from utilising your own hardware by stalling web standards indefinitely.
[1] the old plugins interfaces like NPAPI do exist, but are being phased out and aren't supported at all on web-only platforms like ChromeOS and FirefoxOS, as far as I'm aware