wolfSSL / wolfssh

wolfSSH is a small, fast, portable SSH implementation, including support for SCP and SFTP.
https://www.wolfssl.com
371 stars 87 forks source link

Fix index of signature part in case of RSA #613

Closed TakayukiMatsuo closed 10 months ago

TakayukiMatsuo commented 10 months ago

This PR is to address the issue reported in ZD#16867.

This issue occurs because the index value, which is initialized to point to the signature part of the data, is pointing after the signature part, resulting in a buffer error(-1004). This index value must be initialized correctly. This failure occurs when the server host key algorithm is RSA.

How to reproduce the issue:

  1. configure wolfSSH with following options ./configure --enable-debug --enable-sftp CFLAGS="-DWOLFSSH_YES_SSH_RSA_SHA1"
  2. comment out ID_ECDSA_SHA2_NISTP256 entry from cannedKeyAlgoClient[]. This is to ensure that only rsa-sha2-256 and ssh-rsa are listed in the Server-host-key algorithm list. The   WOLFSSH_NO_ECDSA macro could not be used because it would generate a build error.
  3. build and run echoserver as a sever and run wolfsftp with -u jill -P upthehill
  4. wolfsftp prints out " connect error: CLIENT_KEXDH_INIt_SENT, -1004"