1

I have set up a certificate-based connection with socat using this tutorial: http://www.dest-unreach.org/socat/doc/socat-openssltunnel.html

My socat connection works as following (only the relevant parts of the command):
ssl:<server-ip>:<port>,cert=/path/to/client.pem,cafile=/path/to/server.crt
ssl-l:<port>,cert=/path/to/server.pem,cafile=/path/to/client.crt,fork

I'm doing this for a university course and there is an additional question asking what security problems could arise due to the line

NOTE: The server certificate is only checked for validity against cafile or capath, but not for match with the server’s name or its IP address.

Now I'm not sure whether or not I understand this correctly, the way I do is:
The server's server.pem file (.key and .crt combined) is checked whether or not it matches the client's server.crt, however it does not check the certificate's (server.crt) CN for a match on the server's domain/IP/whatever.

If that is correct, I fail to find any critical security problems without having the server's private key having to be stolen (in which case you've already lost anyways).

2

If you only check that the certificate is valid in the PKI, but not that it matches the server name (either the domain or IP address), then you can be fooled by a certificate issued to a different site.

Suppose:

  • I own malicioussoftware.com
  • Thus I can but a certificate for malicioussoftware.com
  • You (attempt to) connect to https://www.microsoft.com, but I set a MiTM and answer with my malicioussoftware.com certificate.
  • Your socat sees the certificate is valid (it is signed by a trusted CA) and happily goes on.
  • I though socat would only check against against the CA I supplied it with? And since it is a self-signed certificate I can be decently sure that nobody has a certificate signed by this specific CA. I can see your method working though for certs signed by the same CA (a "professional" CA so to say). Also I'm just realizing, does capath mean the general list of trustworthy CAs built in my system? Then I could see what you mean. Also, if that is so, does supplying a cafile override the capath? – RikuXan Nov 11 '14 at 16:52
  • @RikuXan: Yes, if this CA has only signed this certificate, then you are safe. You would typically set capath or cafile, not both (I think in that case openssl would accept it if it the certificate could be chained with any of them). capath points to a folder where accessing by a hash value (usually a symlink), it can open the corresponding CA pem file. See c_rehash (1) – Ángel Nov 12 '14 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.