Files
crypto/ssh
Han-Wen Nienhuys beb2a9779c ssh/knownhosts: disregard IP address if the hostname is available
This fixes the following vulnerability scenario:

* Victim logs into SAFE-HOST on SAFE-IP-ADDRESS regularly.

* Victim is cajoled into connecting to attacker controlled
  ATTACK-HOST, on ATTACK-IP-ADDRESS. ATTACK-HOST uses a different host
  key type (e.g. Ed25519 vs RSA). The new key is added at the end of
  known_hosts.

* Attacker makes DNS system return ATTACK-IP-ADDRESS for SAFE-HOST.

* Victim logs into SAFE-HOST, but is not warned because the host key
  matches ATTACK-IP-ADDRESS.

For this attack to work, the key type has to be different, because
knownhosts gives precedence to the first key found for each type. Add
a test that asserts this behavior.

The new semantics simplify the code, but callers that modify
.ssh/known_host interactviely must now take an extra step to remain
OpenSSH compatible: on successful login, the IP address must be
checked without hostname, and if it is not known, added separately to
the known_hosts file, so future logins that use an IP address only
will be protected too.

Thanks to Daniel Parks <security@demonhorse.net> for finding this
vulnerability.

Change-Id: I62b1b60ceb02e2f583a4657213feac1a8885dd42
Reviewed-on: https://go-review.googlesource.com/104939
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-09 15:00:46 +00:00
..
2017-12-18 18:48:59 +00:00
2014-04-09 13:57:52 -07:00
2017-12-18 18:48:59 +00:00
2018-01-22 08:55:56 +00:00
2017-11-13 21:34:09 +00:00
2017-11-13 21:34:09 +00:00
2017-11-28 17:48:09 +00:00
2017-11-28 17:48:09 +00:00
2017-11-28 19:40:09 +00:00
2014-04-09 13:57:52 -07:00
2016-07-06 16:40:51 +00:00