Commit a6861d9
committed
Validate the host key signature algorithm name in DoKexDhReply().
The client-side KEXDH_REPLY path was parsing the signature blob name and
skipping over it without checking that it matched the negotiated host key
algorithm. That allowed an RSA server to negotiate rsa-sha2-256 or
rsa-sha2-512 but send a signature blob labeled ssh-rsa instead.
Fix this by comparing the signature blob name against the expected
signature type derived from handshake->pubKeyId before verifying the
signature bytes.
Add regress coverage that drives an in-memory client/server handshake,
rewrites the server's first KEXDH_REPLY on the wire, and verifies the
client rejects rsa-sha2-256 and rsa-sha2-512 replies whose signature blob
name is downgraded to ssh-rsa.
F-20771 parent 98e3b63 commit a6861d9
2 files changed
Lines changed: 613 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5761 | 5761 | | |
5762 | 5762 | | |
5763 | 5763 | | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
5764 | 5767 | | |
5765 | 5768 | | |
5766 | 5769 | | |
| |||
6010 | 6013 | | |
6011 | 6014 | | |
6012 | 6015 | | |
6013 | | - | |
6014 | | - | |
6015 | | - | |
| 6016 | + | |
| 6017 | + | |
| 6018 | + | |
| 6019 | + | |
6016 | 6020 | | |
6017 | 6021 | | |
6018 | 6022 | | |
| |||
6023 | 6027 | | |
6024 | 6028 | | |
6025 | 6029 | | |
| 6030 | + | |
| 6031 | + | |
| 6032 | + | |
| 6033 | + | |
| 6034 | + | |
| 6035 | + | |
| 6036 | + | |
| 6037 | + | |
| 6038 | + | |
6026 | 6039 | | |
6027 | 6040 | | |
6028 | 6041 | | |
| |||
10569 | 10582 | | |
10570 | 10583 | | |
10571 | 10584 | | |
10572 | | - | |
10573 | 10585 | | |
10574 | 10586 | | |
10575 | 10587 | | |
| |||
0 commit comments