New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Dec 2016
Cc:



Sign in to add a comment
OpenSSH: LPE via forwarded unix domain sockets if privsep is disabled
Project Member Reported by jannh@google.com, Nov 24 2016 Back to list
This issue affects OpenSSH if privilege separation is disabled (config option
UsePrivilegeSeparation=no). While privilege separation is enabled by default, it
is documented as a hardening option, and therefore disabling it should not
directly make a system vulnerable.

OpenSSH can forward TCP sockets and UNIX domain sockets. If privilege separation
is disabled, then on the server side, the forwarding is handled by a child of
sshd that has root privileges. For TCP server sockets, sshd explicitly checks
whether an attempt is made to bind to a low port (below IPPORT_RESERVED) and, if
so, requires the client to authenticate as root. However, for UNIX domain
sockets, no such security measures are implemented.

This means that, using "ssh -L", an attacker who is permitted to log in as a
normal user over SSH can effectively connect to non-abstract unix domain sockets
with root privileges. On systems that run systemd, this can for example be
exploited by asking systemd to add an LD_PRELOAD environment variable for all
following daemon launches and then asking it to restart cron or so. The attached
exploit demonstrates this - if it is executed on a system with systemd where
the user is allowed to ssh to his own account and where privsep is disabled, it
yields a root shell.

This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.

 
ssh-noprivsep-systemd-lpe.tar
10.0 KB Download
Project Member Comment 1 by mjurczyk@google.com, Dec 8 2016
Labels: -Reported-2016-11-24 Reported-2016-Nov-24
Project Member Comment 2 by jannh@google.com, Dec 19 2016
Status: Fixed
Fixed in release 7.4 (https://www.openssh.com/txt/release-7.4):

 * sshd(8): When privilege separation is disabled, forwarded Unix-
   domain sockets would be created by sshd(8) with the privileges of
   'root' instead of the authenticated user. This release refuses
   Unix-domain socket forwarding when privilege separation is disabled
   (Privilege separation has been enabled by default for 14 years).
   Reported by Jann Horn of Project Zero.
Project Member Comment 3 by jannh@google.com, Dec 19 2016
Labels: CVE-2016-10010
Project Member Comment 4 by jannh@google.com, Dec 23 2016
Labels: -Restrict-View-Commit
Project Member Comment 5 by jannh@google.com, Jun 2
Labels: Methodology-source-review
Sign in to add a comment