Skip to content

RSA public key authentication fails with OpenSSH 8.8 #634

Closed

Description

@palmin

Describe the bug
OpenSSH 8.8 has disabled the ssh-rsa authentication algorithm. Since libssh2 doesn't support rsa-sha2-256 or rsa-sha2-512 it can no longer do RSA public key authentication against the most popular SSH server implementation.

To Reproduce

  • Upgrade OpenSSH to version 8.8
  • Configure rsa public key in .ssh/authorized_keys
  • Connect using rsa private key with example/ssh2

Authentication is rejected and sshd will complain that
userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

Expected behavior
libssh2 should switch to rsa-sha2-256 or rsa-sha2-512 perhaps even trying these first.

Version (please complete the following information):

  • Fedora 34, but any Linux distribution will do if updated to latest OpenSSH version
  • libssh2 version 1.10.0

Additional context

These changes are described in the OpenSSH Release Notes

Potentially-incompatible changes
================================

This release disables RSA signatures using the SHA-1 hash algorithm
by default. This change has been made as the SHA-1 hash algorithm is
cryptographically broken, and it is possible to create chosen-prefix
hash collisions for <USD$50K [1]

For most users, this change should be invisible and there is
no need to replace ssh-rsa keys. OpenSSH has supported RFC8332
RSA/SHA-256/512 signatures since release 7.2 and existing ssh-rsa keys
will automatically use the stronger algorithm where possible.

Activity

  1. palmin commented on Oct 26, 2021

    @palmin
    ContributorAuthor

    I have been working to support RFC 8332 in libssh2 but feeling a little out of my depth.

    I can send rsa-sha2-256 as the public key method in _libssh2_userauth_publickey() in userauth.c and have changed the signing functions to use SHA256 instead of SHA1 but my signature doesn't match.

    It also isn't clear to me when to stick with the old ssh-rsa method and when to use rsa-sha2-256 without having to try and potentially fail authentication which some servers will hold against the client.

  2. changed the title [-]RSA public key authentication fails with OpenSSH 8.8 default configurations[/-] [+]RSA public key authentication fails with OpenSSH 8.8[/+] on Oct 26, 2021
  3. willco007 commented on Oct 26, 2021

    @willco007
    Member

    This is a duplicate of #536 which has a pending PR #626, please check it out if you're interested.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions