OpenSSH / dropbearSSHd xauth command injection
The xauth command handling in OpenSSH and dropbearSSHd did not properly sanitise input, allowing an attacker to inject extra xauth commands. This let them bypass forced commands and login-shell restrictions, and in OpenSSH also read or write arbitrary files and start outbound X connections.
- Fixed in 17 days
- Paid in 17 days
- Disclosed after 3.7 years
Summary by the program
https://github.com/tintinweb/pub/tree/master/pocs/cve-2016-3115
The report
- OpenSSH
- affects all version <= 7.2p1 with
X11Forwarding yes(acc. to OpenSSH this bug is 20 years old and affects all versions back to openssh v1) - status: fixed, vendor advisory: http://www.openssh.com/txt/x11fwd.adv
- dropbearSSHd
- affects <= 2015.71 (basically all versions that come with x11 support; dates back 12 years [1])
- status: fixed, vendor info: https://matt.ucc.asn.au/dropbear/CHANGES
- other
- mobaSSH; they're just based on openssh but for windows - mobassh.mobatek.net
allows to bypass ssh-forced-commands and login-shell restrictions (/bin/false, specific binary) by injecting xauth commands. The latter only affects OpenSSH. Capabilities: arbitr. file read/write, info disclosure (xauth env. info), initiate outbound X connections
reported to OpenSSH first, provided detailed vulnerability analysis, PoC and a simple patch. OpenSSH kindly coordinated patch and release with dropbearSSHd. fixed within a few days (first contact march 3rd. coordinated release with dropbear 10th)
details and the actual research material that was securely disclosed to OpenSSH will be pushed to the following repo (note this llink is subject to change once there's a cve assigned for that issue): https://github.com/tintinweb/pub/tree/master/pocs/cve-2016-xxxx-openssh-dropbearsshd
[1] https://github.com/mkj/dropbear/blob/790726519e69f5d93b579a21951d78f8f777a5cb/svr-x11fwd.c
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server built an xauth command line from attacker-influenced data without escaping it, so injected commands were executed.
Impact
An attacker could bypass forced commands and restricted login shells, and on OpenSSH could read or write arbitrary files, disclose xauth environment information and open outbound X connections.
What the attacker needed
X11Forwarding enabled (OpenSSH)
The fix
It was fixed by the vendors, who coordinated a patch and release for both OpenSSH and dropbearSSHd.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you connect to a server over SSH, the server can be told to run only one fixed command for you, or to give you a restricted shell. This report says a flaw in how the server passed data to a helper program called xauth let an attacker sneak in extra commands, so those restrictions could be escaped. On OpenSSH that also meant reading or writing files the user should not touch.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.