Visitar URL original
hostkey: reject ECDSA key curve mismatch by tatikoma · Pull Request #2700 · libssh2/libssh2 · GitHub
Skip to content

hostkey: reject ECDSA key curve mismatch - #2700

Open
tatikoma wants to merge 4 commits into
libssh2:masterfrom
tatikoma:fix/ecdsa-hostkey-curve-match
Open

tatikoma wants to merge 4 commits into
libssh2:masterfrom
tatikoma:fix/ecdsa-hostkey-curve-match

Conversation

@tatikoma

Copy link
Copy Markdown

The three plain ECDSA host-key methods use the same key importer. The importer accepted any supported ECDSA curve identifier from the key blob without checking that it matched the host-key method selected during KEXINIT. A session that selected ecdsa-sha2-nistp521 could therefore accept a P-256 key blob.

Require the key-blob algorithm identifier to match session->hostkey->name before importing the key.

The regression test loads the existing repository test key tests/openssh_server/ssh_host_ecdsa_key.pub from disk. It fails on current unpatched master and passes with this change.

Tested with OpenSSL 3.6.3 under ASan/UBSan: 61/61 CTest cases passed.

Require the plain ECDSA key blob type to match the host key method selected during KEXINIT. Add a regression test that loads the existing P-256 test host key from disk.
Comment thread tests/test_simple.c Resolved
Comment thread tests/test_simple.c Resolved
Comment thread tests/test_simple.c Resolved
@willco007

Copy link
Copy Markdown
Member

Is this ready to go @vszakats ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants