This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 834029 - spice-gtk doesn't implement host-subject verification like spicec does
spice-gtk doesn't implement host-subject verification like spicec does
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: spice-gtk (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Christophe Fergeau
Desktop QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-20 12:30 EDT by Alon Levy
Modified: 2012-06-21 10:21 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-21 05:49:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alon Levy 2012-06-20 12:30:04 EDT
Description of problem:
When connecting to a secured channel spice-gtk should implement verification of the server to prevent an unknown server signing it's certificate with the same ca spice-gtk is using and impersonating the real server (i.e Man in the middle). There is an implementation of RFC 2818, Section 3.1 [1], in spice-common [2] that can already be used for this. A nice to have is to also implement truststore usage, i.e. check that the server certificate is a match to any in the truststore.

[1] http://www.rfc-editor.org/rfc/rfc2818.txt
[2] http://cgit.freedesktop.org/spice/spice-common/tree/common/ssl_verify.c
Comment 2 Marc-Andre Lureau 2012-06-20 12:35:41 EDT
please be more descriptive of what is needed, or alternatively provide a patch.  ssl_verify.c was partially rewritten to match spice-gtk needs, so it does use it already.
Comment 3 Alon Levy 2012-06-21 05:49:05 EDT
My bad, I misread the code. Sorry for the noise.
Comment 4 Christophe Fergeau 2012-06-21 05:52:28 EDT
SPICE clients are not getting the certificate directly from the server they are connecting to, but the certificate has to already be present on the user's computer, so I think this makes MITM harder, the user would have to be tricked into using a compromised certificate.

As I understand it, host subject verification in RFC 2818 is useful because the certificate is provided by the server, so its identity is compared against something provided by the user and not the server, which is the URI the user typed to connect to the server. Then the certificate (signed by trusted CAs) is used by the server to prove it "owns" the URI entered by the user.

As an additional security check, I agree that checking the host subject is a good thing to have, however let's just check the hostname as typed by the user (ie hostname or IP address) and not the whole host subject which is hard to guess.

Finally, spice-gtk seems to be implement these checks to some extent since there's at least one RHEV instance I couldn't connect to without passing --spice-host-subject.
Comment 5 Christophe Fergeau 2012-06-21 05:57:21 EDT
(In reply to comment #4)

> As I understand it, host subject verification in RFC 2818 is useful because
> the certificate is provided by the server, so its identity is compared
> against something provided by the user and not the server, which is the URI
> the user typed to connect to the server. Then the certificate (signed by
> trusted CAs) is used by the server to prove it "owns" the URI entered by the
> user.
> 
> As an additional security check, I agree that checking the host subject is a
> good thing to have, however let's just check the hostname as typed by the
> user (ie hostname or IP address) and not the whole host subject which is
> hard to guess.
> 

Actually the RFC is saying something very similar:
"If the client has external information as to the expected identity of
 the server, the hostname check MAY be omitted. (For instance, a
 client may be connecting to a machine whose address and hostname are
 dynamic but the client knows the certificate that the server will
 present.)"
Comment 6 Alon Levy 2012-06-21 06:54:16 EDT
We don't have the server certificate, only the ca certificate; ca_file is provided only.

If we had it, you're right that we wouldn't need host subject verification.

But I misread the code, there is the same ssl_verify.c entry point used in spice-gtk and spice/client.

(I had a longer write up with the function calls but it was eaten by firefox).
Comment 7 Christophe Fergeau 2012-06-21 10:21:04 EDT
(In reply to comment #6)
> We don't have the server certificate, only the ca certificate; ca_file is
> provided only.

Ah, yes, I missed that, thanks!

> 
> If we had it, you're right that we wouldn't need host subject verification.
> 

Yes, so some kind of verification is indeed needed given your first comment. Personally it would be great if we could use the hostname for this verification as much as possible instead of having to use the host subject sometimes (see bug https://bugzilla.redhat.com/show_bug.cgi?id=672765 for one case where this is needed).

Note You need to log in before you can comment on or make changes to this bug.