]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/ssl_certificates_not_checked_with_openid.mdwn
A misfeature I stumbled upon.
[ikiwiki.git] / doc / bugs / ssl_certificates_not_checked_with_openid.mdwn
1 As far as I can tell, ikiwiki is not checking the SSL certificate of the remote host when using openid authentication. If so, this would allow for man-in-the-middle type attacks. Alternatively, maybe I am getting myself confused.
2
3 Test #1: Enter URL as openid server that cannot be verified (either because the certificate is self signed or signed by an unknown CA). I get no SSL errors.
4
5 Test #2: Download net\_ssl\_test from dodgy source (it uses the same SSL perl library, and test again. It seems to complain (on same site ikiwiki worked with) when it can't verify the signature. Although there is other breakage with the version I managed to download (eg. argument parsing is broken; also if I try to connect to a proxy server, it instructs the proxy server to connect to itself for some weird reason).
6
7 For now, I want to try and resolve the issues with net\_ssl\_test, and run more tests. However, in the meantime, I thought I would document the issue here.
8
9 -- Brian May
10
11 > Openid's security model does not rely on the openid consumer (ie,
12 > ikiwiki) performing any sanity checking of the openid server. All the
13 > security authentication goes on between your web browser and the openid
14 > server. This may involve ssl, or not.
15 >
16 >> Note that I'm not an openid expert, and the above may need to be taken
17 >> with a grain of salt. I also can make no general statements about openid
18 >> being secure. ;-) --[[Joey]]
19
20 > For example, my openid is "http://joey.kitenet.net/". If I log in with
21 > this openid, ikiwiki connects to that http url to determine what openid
22 > server it uses, and then redirects my browser to the server
23 > (https://www.myopenid.com/server), which validates the user and redirects
24 > the browser back to ikiwiki with a flag set indicating that the openid
25 > was validated. At no point does ikiwiki need to verify that the https url
26 > is good.
27 > --[[Joey]]
28
29 >> Ok, so I guess the worst that could happen when ikiwiki talks to the http
30 >> address is that it gets intercepted, and ikiwiki gets the wrong address.
31 >> ikiwiki will then redirect the browser to the wrong address. An attacker could
32 >> trick ikiwiki to redirect to their site which always validates the user
33 >> and then redirects back to ikiwiki. The legitimate user may not even notice.
34 >> That doesn't so seem secure to me...
35
36 >> All the attacker needs is access to the network somewhere between ikiwiki
37 >> and http://joey.kitenet.net/ or the ability to inject false DNS host names
38 >> for use by ikiwiki and the rest is simple.
39
40 >> -- Brian May
41
42 >>> I guess that the place to add SSL cert checking would be in either
43 >>> [[!cpan LWPx::ParanoidAgent]] or [[!cpan Net::OpenID::Consumer]]. Adding
44 >>> it to ikiwiki itself, which is just a user of those libraries, doesn't
45 >>> seem right.
46 >>> 
47 >>> It's not particularly clear to me how a SSL cert can usefully be
48 >>> checked at this level, where there is no way to do anything but
49 >>> succeed, or fail; and where the extent of the check that can be done is
50 >>> that the SSL cert is issued by a trusted party and matches the domain name
51 >>> of the site being connected to. I also don't personally think that SSL
52 >>> certs are the right fix for DNS poisoning issues. --[[Joey]]
53
54 I was a bit vague myself on the details on openid. So I looked up the standard.
55 I was surprised to note that they have already considered these issues, in
56 section 15.1.2, <http://openid.net/specs/openid-authentication-2_0.html#anchor41>.
57
58 It says:
59
60 "Using SSL with certificates signed by a trusted authority prevents these kinds of
61 attacks by verifying the results of the DNS look-up against the certificate. Once
62 the validity of the certificate has been established, tampering is not possible.
63 Impersonating an SSL server requires forging or stealing a certificate, which is
64 significantly harder than the network based attacks."
65
66 With regards to implementation, I am surprised that the libraries don't seem to
67 do this checking, already, and by default. Unfortunately, I am not sure how to test
68 this adequately, see [[!debbug 466055]]. -- Brian May
69
70 --- 
71
72 I think [[!cpan Crypt::SSLeay]] already supports checking the certificate. The trick
73 is to get [[!cpan LWP::UserAgent]], which is used by [[!cpan LWPx::ParanoidAgent]] to
74 enable this checking.
75
76 I think the trick is to set one of the the following environment variables before retrieving
77 the data:
78
79 $ENV{HTTPS\_CA\_DIR} = "/etc/ssl/certs/";  
80 $ENV{HTTPS\_CA\_FILE} = "/etc/ssl/certs/file.pem";  
81
82 Unfortunately I get weird results if the certificate verification fails, see [[!debbug 503440]].
83 It still seems to work though, regardless.
84
85 -- Brian May