Bug 2944 - ssh-agent returns incorrect signature type for rsa-sha2-512-cert-v01@openssh.com and rsa-sha2-256-cert-v01@openssh.com
Summary: ssh-agent returns incorrect signature type for rsa-sha2-512-cert-v01@openssh....
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 7.9p1
Hardware: All Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_8_0
  Show dependency treegraph
 
Reported: 2018-12-18 22:56 AEDT by Daniel Aschwanden
Modified: 2021-04-23 15:10 AEST (History)
1 user (show)

See Also:


Attachments
Patch for authfd.c to consider rsa-sha2-*cert algorithm types to properly request the signature at the agent (611 bytes, patch)
2018-12-18 22:56 AEDT, Daniel Aschwanden
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Aschwanden 2018-12-18 22:56:59 AEDT
Created attachment 3216 [details]
Patch for authfd.c to consider rsa-sha2-*cert algorithm types to properly request the signature at the agent

After upgrading to 7.9p1 we encountered the following warnings during ssh client usage:


agent key RSA-CERT SHA256:IC6hv9VA5eBGO2oW0vRB8zkOvl954JwZ5KHU2lnaHW4 returned incorrect signature type


The detailed output shows the following: 

debug1: Server accepts key: /home/daa/.ssh/id_rsa RSA-CERT SHA256:lSQIkaEaSCKJLOi5eV0Z+7fR8W/Z1nm1+DHAupcdk5M explicit agent
debug3: sign_and_send_pubkey: RSA-CERT SHA256:lSQIkaEaSCKJLOi5eV0Z+7fR8W/Z1nm1+DHAupcdk5M
debug2: sign_and_send_pubkey: using private key "/home/daa/.ssh/id_rsa" from agent for certificate
debug3: sign_and_send_pubkey: signing using rsa-sha2-512-cert-v01@openssh.com
agent key RSA-CERT SHA256:lSQIkaEaSCKJLOi5eV0Z+7fR8W/Z1nm1+DHAupcdk5M returned incorrect signature type
debug3: sign_and_send_pubkey: signing using ssh-rsa-cert-v01@openssh.com
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).

Openssh 7.8p1 was only using ssh-rsa-cert-v01@openssh.com when using RSA-CERT.

A quick look at the authfd.c file, leads me to the conclusion that the agent_encode_alg does not properly consider RSA-CERT in the signature algorithm encoding, so that not a rsa-sha2-* signature is requested at the ssh-agent.

I've attached a patch fixing this obvious error, please feel free to adjust the patch if required.
Comment 1 Damien Miller 2019-01-22 22:16:00 AEDT
A fix for this was committed last year and will be in OpenSSH 8.0. It's also committed on the stable V_7_9 branch if you want to cherry-pick it.

https://anongit.mindrot.org/openssh.git/commit/authfd.c?id=007a88b48c97d092ed2f501bbdcb70d9925277be
Comment 2 Damien Miller 2021-04-23 15:10:03 AEST
closing resolved bugs as of 8.6p1 release