SSH X11 forwarding is on
- Check
ssh.x11_forwarding- Severity
- low
- Runs
- on the server, in the daily run of the agent
- Looks at
- X11Forwarding is yes
What the check looks at
The agent reads the effective sshd configuration (sshd -T) and warns when X11Forwarding is yes.
Why it matters
X11 forwarding lets a graphical program on the server show its windows on the screen of the client. A server
without a desktop does not use it. While it is on, sshd sets up an X11 proxy for every session that asks for
it, which is code that can have bugs and a channel that a malicious server can abuse against clients that
forward their display. The OpenSSH default is no; Debian, Ubuntu, Rocky Linux and RHEL ship X11Forwarding yes in their own configuration. We saw it in /etc/ssh/sshd_config on Debian 12, Debian 13 and Ubuntu
24.04, and in /etc/ssh/sshd_config.d/50-redhat.conf on Rocky Linux 9 and 10. Alpine 3.24 ships no.
The severity is low: this is cleanup, not an open door.
How to fix it
Add a drop-in file. sshd keeps the first value it reads, and the files in /etc/ssh/sshd_config.d/ are read
in alphabetical order before the rest of sshd_config, so a name starting with 10- wins over the
distribution setting. On RHEL 8, Rocky Linux 8 and AlmaLinux 8, sshd_config does not read /etc/ssh/sshd_config.d/; add the
Include line at the top of it first, as the SSH hardening guide shows.
echo 'X11Forwarding no' | sudo tee /etc/ssh/sshd_config.d/10-x11.conf
sudo sshd -t
On RHEL, Rocky and Alma, do not edit 50-redhat.conf; a package update can replace it. The 10- file is
read first and wins.
Reload sshd:
Debian and Ubuntu
sudo systemctl reload ssh
RHEL, Rocky Linux and AlmaLinux
sudo systemctl reload sshd
Alpine
Nothing to do unless someone turned it on; then remove that line and run sudo rc-service sshd reload.
How to check the fix
sudo sshd -T | grep '^x11forwarding'
The output must be x11forwarding no.
When a warning is fine
When people run graphical tools on the server over SSH on purpose (a GUI installer, a plotting tool). Then
keep it on for them only, with a Match block:
X11Forwarding no
Match Group x11-users
X11Forwarding yes
Sources
- sshd_config(5) —
X11Forwarding, defaultno;Match - ssh(1) — the client side of X11 forwarding and the risk for the client