After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795699 - ssh-agent: Reject SSH v1 public key
ssh-agent: Reject SSH v1 public key
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: ssh-agent
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2018-04-30 16:12 UTC by Daiki Ueno
Modified: 2018-07-14 05:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ssh-agent: Make public key parsing robuster (5.14 KB, patch)
2018-04-30 16:12 UTC, Daiki Ueno
committed Details | Review

Description Daiki Ueno 2018-04-30 16:12:27 UTC
Reported in Fedora:
https://bugzilla.redhat.com/show_bug.cgi?id=1568895
Comment 1 Daiki Ueno 2018-04-30 16:12:33 UTC
Created attachment 371559 [details] [review]
ssh-agent: Make public key parsing robuster

Previously, _gkd_ssh_agent_parse_public_key() mistakenly accepted
OpenSSH v1 keys as valid, because the second component of the key line
looks like a base64 blob:

  2048 65537 2444136...

This patch checks that the component is really base64 encoded, by
checking the length is a multiple of 4.
Comment 2 Daiki Ueno 2018-05-07 07:09:30 UTC
Attachment 371559 [details] pushed as f3f3cc7 - ssh-agent: Make public key parsing robuster
Comment 3 Mantas Mikulėnas (grawity) 2018-05-09 11:21:08 UTC
> Note that this solution is not perfect, as there could be a key with a
> public exponent whose decimal length is multiple of 4.  More thorough
> approach would be to call ssh-keygen -l on each public key.

A very robust method would be to compare key types, as the base64 blob *always* starts with its own type as a SSH-string (length-prefixed), e.g ssh-rsa blobs begin with "\x00\x00\x00\x07ssh-rsa"...
Comment 4 Daiki Ueno 2018-05-22 13:06:50 UTC
Indeed, that sounds like a good idea.  Would you like to create a patch?
Comment 5 Daiki Ueno 2018-07-14 05:46:47 UTC
I've filed an MR here https://gitlab.gnome.org/GNOME/gnome-keyring/merge_requests/2
It would be nice if you could give a quick review.