6.2p1+ fails key-exchange with embedded SSH devices
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openssh (Ubuntu) |
Triaged
|
Low
|
Unassigned | ||
openssh (openSUSE) |
New
|
Undecided
|
Unassigned |
Bug Description
I have various network devices with embedded SSH daemons, such as CDUs, UPSs, managed Switches, DRAC, and so on. All devices have entries in the ssh config file specifying an IdentityFile.
The particular embedded SSH daemon in this case is Mocana nanoSSH:
http://
Recently I had need to access a Server Technology Switched CDU via SSH using 14.04 Trusty and its OpenSSH_6.6.1p1. Connections consistently failed at:
$ ssh -vvv cdu-01
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/tj/
debug1: /home/tj/
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Hostname has changed; re-reading configuration
debug1: Reading configuration data /home/tj/
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.254.0.3 [10.254.0.3] port 22.
debug1: Connection established.
...
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug2: bits set: 531/1024
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_
Received disconnect from 10.254.0.3: 11: Logged out.
Initially I thought the local configuration had been corrupted in some way since the local /home/ was moved from a 13.04 to 14.04 installation. Later I discovered a bug report of this issue affecting other embedded network devices reported against versions of OpenSSH later than 6.1p1 on the BSD operating system at:
https:/
I then chroot-ed into the earlier 13.04 installation and tried again with its OpenSSH_6.1p1 and it connected:
$ ssh -vvv hostmaster@
OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.254.0.3 [10.254.0.3] port 22.
debug1: Connection established.
...
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug2: dh_gen_key: priv key bits set: 117/256
debug2: bits set: 521/1024
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_
debug1: Server host key: DSA 17:36:55:
The authenticity of host '10.254.0.3 (10.254.0.3)' can't be established.
DSA key fingerprint is 17:36:55:
Are you sure you want to continue connecting (yes/no)?
The cause is apparently a buffer overflow in the embedded Mocana SSH daemon with cipher/mac lists longer than ~287 bytes.
I fixed it by limiting the list of Ciphers and Macs sent, via the ssh_config:
Host cdu-01
Hostname 10.254.0.3
User hostmaster
IdentityFile ~/.ssh/
IdentitiesOnly yes
Protocol 2
Ciphers aes256-
Macs hmac-sha1,hmac-md5
$ ssh -vvv cdu-01
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/tj/
debug1: /home/tj/
debug3: ciphers ok: [aes256-
debug3: macs ok: [hmac-sha1,
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Hostname has changed; re-reading configuration
debug1: Reading configuration data /home/tj/
debug3: ciphers ok: [aes256-
debug3: macs ok: [hmac-sha1,
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.254.0.3 [10.254.0.3] port 22.
debug1: Connection established.
...
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_
debug1: Server host key: DSA 17:36:55:
debug3: load_hostkeys: loading entries for host "10.254.0.3" from file "/home/
debug3: load_hostkeys: loaded 0 keys
The authenticity of host '10.254.0.3 (10.254.0.3)' can't be established.
DSA key fingerprint is 17:36:55:
Are you sure you want to continue connecting (yes/no)?
Changed in openssh (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Low |
It might be worth changing your ciphers to something like:
Ciphers AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA AAAAAAAAAAAAAAA
and see if you can get 0x41414141 kinds of things in e.g. CPU registers
or elsewhere in your embedded devices. (I'm curious if this is just a
client configuration that won't connect properly or if you've found
exploitable flaws in the Mocana sshd.)
Thanks