Slashdot Mirror


Why Screen Lockers On X11 Cannot Be Secure

jones_supa writes: One thing we all remember from Windows NT is the security feature requiring the user to press CTRL-ALT-DEL to unlock the workstation (this can still be enabled with a policy setting). The motivation was to make it impossible for other programs to mimic a lock screen, as they couldn't react to the special key combination. Martin Gräßlin from the KDE team takes a look at the lock screen security on X11. On a protocol level, X11 doesn't know anything of screen lockers. Also the X server doesn't know that the screen is locked as it doesn't understand the concept. This means the screen locker can only use the core functionality available to emulate screen locking. That in turn also means that any other client can do the same and prevent the screen locker from working (for example opening a context menu on any window prevents the screen locker from activating). That's quite a bummer: any process connected to the X server can block the screen locker, and even more it could fake your screen locker.

13 of 375 comments (clear)

  1. Re:Windows reigns supreme by Viol8 · · Score: 3, Informative

    Would this be the "hobby" OS that took over running the London Stock Exchange trading platform when Windows couldn't cope?

  2. Re:Umm..and telnet is insecure. by Dog-Cow · · Score: 5, Informative

    Wow. Way to totally misunderstand everything.

    X11(R6) is a protocol.
    XFree86 and XOrg are implementations.

  3. Uses QT for screensaver, complains about security by Anonymous Coward · · Score: 5, Informative

    KDE uses QT, a gigantic toolkit, to implement the screen saver. In this case the UI relies on QT Quick.
    Gnome's screensaver has the same problems with GTK.

    Jamie Zawinski, who wrote the standard xscreensaver, has a FAQ page detailing how these are a fundamentally bad idea from a security perspective:
    http://www.jwz.org/xscreensaver/toolkits.html

  4. Re:So to cicumvent the screen locker... by Anonymous Coward · · Score: 5, Informative

    This was fixed decades ago. Don't issue xhost + and you should be fine. X uses auth tokens that are files in /tmp with mode 600.

  5. Re:not the point by Anonymous Coward · · Score: 4, Informative

    What do you mean "think it will kick in"? Activate it when you get up from your desk, period. For Windows it's an easy "winkey+L" combo as you get up from your desk. Done, workstation is secured and locked. That's our company policy anyway, you're supposed to lock your workstation when you step away. A timed lock screen is pointless, stupid and just gets in the way. If your mouse just happens to bounce a little, it'll reset the "inactive screen timeout".

  6. Re: not the point by Teranolist · · Score: 3, Informative

    Thats why you lock your screen manually BEFORE you leave the machine...

  7. Re:Windows reigns supreme by Viol8 · · Score: 4, Informative

    They did go for C++. On Linux. It was more than just issues with .NET.

  8. Re:physical access by Wrath0fb0b · · Score: 4, Informative

    Comparing this to Windows is silly, because Windows doesn't have anything like the X11 protocol. On Windows, running code can disable the screen saver in other ways: patching or replacing DLLs, changing system configuration, etc. No difference from a security point of view.

    I'm no Windows fanboy, but this is just factually incorrect.

    (1) All those operations require elevation, so unless the user has lowered UAC from the default, they will require authentication. I suppose a malicious installer could do that, but it is emphatically incorrect that any running code can effect that change.

    (2) Since 7, when Windows elevates it completely suspends the old 'Desktop' and creates a brand new one for the elevation prompt. If you look closely, you'll realize that all the other 'windows' are actually just a static screenshot of what happened on the unprivileged desktop at the point where the elevation prompt was created.

    So "from a security point of view", on Windows you have a specific privilege required to change the SS that is mediated through a privileged interface where it cannot be snooped/intercepted by unprivileged processes.

    [ Of course, this comparison is also patently unfair -- Windows 7 was written in the 2000s, X11 was written in the 1980s. Expecting them to be comparable in terms of security is pretty ridiculous. ]

  9. Re:If it's accessing your X server, it's elevated by JesseMcDonald · · Score: 5, Informative

    I'm not familiar with writing apps for X, but are you saying that every program that displays a window in X can log all keystrokes including in windows that are not associated with that program?

    Yes. This isn't just X, by the way; it's a common design across most operating systems. Any client can register to receive keyboard and mouse input regardless of the current focus, unless another client has already "grabbed" the input device. This is how things like global keybindings are typically implemented. Windows used for password entry (including lock screens) can grab the keyboard to prevent other programs from listening in. The problem is that this only works if no other program has already grabbed the keyboard.

    Secure input handling is one of the many reasons why everyone is eventually planning to switch to Wayland. Under Wayland, only the compositor has access to the raw input or the ability to inject simulated input events. The compositor manages any global keybindings and forwards the remaining events exclusively to the active window.

    --
    "The state is that great fiction by which everyone tries to live at the expense of everyone else." - Bastiat
  10. Re:Uses QT for screensaver, complains about securi by Anonymous Coward · · Score: 4, Informative

    Jamie Zawinski has been wrong before, too, but in this case it's not even wrong. What we're talking about is the X protocol being fundamentally flawed; it's really pretty irrelevant what screen locker is being used.

    And yet Jamie's xscreensaver hasn't been shown to be insecure by this guy. He's only proven what jwz said which is that a lockscreen using a toolkit on top of X11 is insecure.

  11. Re:So to cicumvent the screen locker... by Culture20 · · Score: 3, Informative

    Xroach: places animated roaches under their open windows and the roaches scatter when the windows are reduced or closed.

  12. Re:If it's accessing your X server, it's elevated by parenthephobia · · Score: 3, Informative

    Your façade rather falls apart when they actually do press "del", I think.

  13. Re:If it's accessing your X server, it's elevated by benjymouse · · Score: 3, Informative

    I'm not familiar with writing apps for X, but are you saying that every program that displays a window in X can log all keystrokes including in windows that are not associated with that program?

    Yes. This isn't just X, by the way; it's a common design across most operating systems. Any client can register to receive keyboard and mouse input regardless of the current focus, unless another client has already "grabbed" the input device.

    Except in Windows. Since Vista user interface privilege isolation prevents unauthorized processes from grabbing keyboard/mouse events or sending messages to windows owned by another process, even if that process is running as the same user. To be allowed to grab keyboard/mouse, the process must have declared that intent in the manifest *and* it must have been launched from an installed location (program files or windows system). Furthermore, such hooking/messaging is also masked out at the intrinsic level by UAC - specifically by integrity levels. A lower integrity process is simply not allowed - manifest or not - to send messages or install keyboard/mouse hooks at a higher integrity level process.

    X is especially bad in this regard, as it does not even protect against shatter attacks and eavesdropping on windows from *another users* processes. If you elevate to root - e.g. sudo from a terminal window - any other process can *still* eavesdrop on keyboard events.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*