Public bug reported:

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://www.mocana.com/for-device-manufacturers/nanossh

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/.ssh/config
debug1: /home/tj/.ssh/config line 101: Applying options for cdu-01
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/.ssh/config
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_KEXDH_REPLY
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://bugzilla.mindrot.org/show_bug.cgi?id=2116

I then chroot-ed into the earlier 13.04 installation and tried again
with its OpenSSH_6.1p1 and it connected:

$ ssh -vvv hostmaster@10.254.0.3
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_KEXDH_REPLY
debug1: Server host key: DSA 17:36:55:87:49:a5:a4:9f:02:42:8b:da:88:7c:bb:41
The authenticity of host '10.254.0.3 (10.254.0.3)' can't be established.
DSA key fingerprint is 17:36:55:87:49:a5:a4:9f:02:42:8b:da:88:7c:bb:41.
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/id_hostmaster
IdentitiesOnly yes
Protocol 2
Ciphers aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,arcfour
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/.ssh/config
debug1: /home/tj/.ssh/config line 101: Applying options for cdu-01
debug3: ciphers ok: 
[aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,arcfour]
debug3: macs ok: [hmac-sha1,hmac-md5]
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/.ssh/config
debug3: ciphers ok: 
[aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,arcfour]
debug3: macs ok: [hmac-sha1,hmac-md5]
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_KEXDH_REPLY
debug1: Server host key: DSA 17:36:55:87:49:a5:a4:9f:02:42:8b:da:88:7c:bb:41
debug3: load_hostkeys: loading entries for host "10.254.0.3" from file 
"/home/tj/.ssh/known_hosts"
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:87:49:a5:a4:9f:02:42:8b:da:88:7c:bb:41.
Are you sure you want to continue connecting (yes/no)?

** Affects: openssh (Ubuntu)
     Importance: Low
         Status: Triaged

** Changed in: openssh (Ubuntu)
       Status: New => Triaged

** Changed in: openssh (Ubuntu)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openssh in Ubuntu.
https://bugs.launchpad.net/bugs/1350643

Title:
  6.2p1+ fails key-exchange with embedded SSH devices

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1350643/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to