[mirror] Go supplementary cryptography libraries
Перейти к файлу
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
acme acme/autocert: use valid certificates from the cache during renewal 2018-03-19 06:17:31 +00:00
argon2 argon2: fix typo and code formatting in comments 2018-03-06 22:39:34 +00:00
bcrypt all: fix errors reported by vet, golint 2017-11-28 17:48:09 +00:00
blake2b blake2b,blake2s: implement BinaryMarshaler, BinaryUnmarshaler 2018-03-30 21:03:55 +00:00
blake2s blake2b,blake2s: implement BinaryMarshaler, BinaryUnmarshaler 2018-03-30 21:03:55 +00:00
blowfish all: use HTTPS for links that support it 2017-06-29 04:21:55 +00:00
bn256 bn256: don't claim a 128-bit security level. 2017-12-31 21:50:28 +00:00
cast5 crypto: add import comments. 2014-12-09 23:26:36 +00:00
chacha20poly1305 internal/chacha20: move up from chacha20poly1305/internal/chacha20 2018-01-10 14:51:33 +00:00
cryptobyte cryptobyte: include changes from review of 57810 2017-09-12 19:18:25 +00:00
curve25519 all: fix article typos 2017-09-15 13:46:28 +00:00
ed25519 ed25519: require canonical signatures 2018-03-13 19:52:38 +00:00
hkdf crypto: add import comments. 2014-12-09 23:26:36 +00:00
internal/chacha20 internal/chacha20: move up from chacha20poly1305/internal/chacha20 2018-01-10 14:51:33 +00:00
md4 md4: move the example to the right directory 2017-07-20 17:59:35 +00:00
nacl nacl/sign: add package 2018-03-20 22:59:59 +00:00
ocsp all: run gofmt -s on source code 2017-11-28 19:40:09 +00:00
openpgp openpgp/packet: improve handling of short MPIs for RSA values 2018-03-16 18:01:49 +00:00
otr otr: add missing return on error path 2017-01-18 18:54:26 +00:00
pbkdf2 pbkdf2: add benchmarks 2017-12-19 04:11:29 +00:00
pkcs12 all: run gofmt -s on source code 2017-11-28 19:40:09 +00:00
poly1305 all: use HTTPS for links that support it 2017-06-29 04:21:55 +00:00
ripemd160 ripemd160: use bits.Rotate for rotates 2018-03-08 18:56:24 +00:00
salsa20 all: make overlap rules wording consistent 2017-09-11 15:03:43 +00:00
scrypt scrypt: add missing license header 2017-09-30 17:46:04 +00:00
sha3 sha3: fix typo in Shake256 docs 2018-03-12 19:55:33 +00:00
ssh ssh/knownhosts: disregard IP address if the hostname is available 2018-04-09 15:00:46 +00:00
tea all: fix errors reported by vet, golint 2017-11-28 17:48:09 +00:00
twofish all: use HTTPS for links that support it 2017-06-29 04:21:55 +00:00
xtea xtea: comment cleanup 2018-03-22 17:52:30 +00:00
xts all: make overlap rules wording consistent 2017-09-11 15:03:43 +00:00
.gitattributes crypto: copying .gitattributes to all subrepositories 2014-12-23 06:54:52 +00:00
.gitignore convert .hgignore to .gitignore. 2014-12-08 10:41:13 +11:00
AUTHORS all: use HTTPS for links that support it 2017-06-29 04:21:55 +00:00
CONTRIBUTING.md CONTRIBUTING.md: remove note about not accepting Pull Requests 2018-03-14 18:02:59 +00:00
CONTRIBUTORS all: use HTTPS for links that support it 2017-06-29 04:21:55 +00:00
LICENSE LICENSE: add 2012-03-17 15:19:30 +11:00
PATENTS go.crypto: add PATENTS file to the subrepo. 2012-04-16 11:25:08 +10:00
README.md README: add improvements 2017-07-19 14:12:01 +00:00
codereview.cfg crypto: add codereview.cfg 2015-03-18 17:04:25 +00:00

README.md

Go Cryptography

This repository holds supplementary Go cryptography libraries.

Download/Install

The easiest way to install is to run go get -u golang.org/x/crypto/.... You can also manually git clone the repository to $GOPATH/src/golang.org/x/crypto.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the crypto repository is located at https://github.com/golang/go/issues. Prefix your issue with "x/crypto:" in the subject line, so it is easy to find.

Note that contributions to the cryptography package receive additional scrutiny due to their sensitive nature. Patches may take longer than normal to receive feedback.