CPSA ยท Unix network file, trust and remote access services
X11 security: xhost versus xauth
Host-based (xhost) vs user-based (xauth) access control and remote display risks.
Key points
- An X server decides which clients may open windows on its display.
- xhost: host-based list of allowed machines; xhost + switches access control off for everyone.
- xauth: user-based; clients must present matching authorization data held by the user.
- Open X server: a remote client can capture screenshots, read keystrokes and inject input, so xhost + on a networked display is a serious finding.
Source: https://xorg.freedesktop.org/archive/X11R7.7/doc/man/man1/xhost.1.xhtml
Practice questions
What does running 'xhost +' with no name do?
- Turns access control off, so any host may connect
- Adds only the local machine to the allowed list
- Turns on user-based xauth checking
- Lists the hosts currently allowed
Show answer
Answer: A. Turns access control off, so any host may connect
A bare + turns access control off, so any host may connect to the X server. A bare - turns it back on. It does not add only localhost or enable xauth.
What can a remote client do against an X server whose access control is open?
- Capture screenshots of the display
- Observe keystrokes typed into windows
- Send synthetic keyboard input to windows
- Decrypt the user's SSH sessions
- Rewrite the server's firewall rules
Show answer
Answer: A. Capture screenshots of the display, B. Observe keystrokes typed into windows, C. Send synthetic keyboard input to windows
An accepted X client can read the screen contents, observe keystrokes and send synthetic input to windows. It cannot decrypt SSH traffic or change the server's firewall rules by itself.
True or false: xhost provides strong, per-user authentication of X clients.
Show answer
Answer: False
False. xhost is host-based and the man page calls it a rudimentary form of access control suited to single-user workstations. User-based control is the job of xauth-style authorization data.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
