简体   繁体   中英

SSLSniff error: “SSL Accept Failed”

I'm trying to use SSLSniff's tool, and I have some technical issues... I've been looking for any similar problems, but the only results are from Twitter feeds, with no public useful answer. So, here it is:

(My version of SSLSniff is 0.8) I'm launching sslsniff with args:

sslsniff -a -c cert_and_key.pem -s 12345 -w out.log  

where: cert_and_key.pem file is my authority's certificate concatenate with my unencrypted private key (in PEM format of course), and 12345 is the port where I redirect traffic with my iptables rule.

So sslsniff is correctly running:

INFO sslsniff : Certificate ready: [...]  

[And anytime I connect with a client, there are these 2 following lines:]

DEBUG sslsniff : SSL Accept Failed!  
DEBUG sslsniff : Got exception: Error with SSL connection.

On my client' side, I've register my AC as a trusted CA (with FF). Then when I connect through SSL I'm having the error:

Secure Connection Failed.  
Error code: ssl_error_bad_cert_domain

What is super strange (moreover the fact that the certificate is not automatically accepted since it should be signed by my trusted CA) is that I cannot accept the forged certificate by clicking on "Add exception..." : I am always returning to the error page asking me to add an(other) exception...

Moreover, when I try to connect to for example: https://www.google.com , SSLSniff's log is completed with a new line :

DEBUG sslsniff : Encoded Length: 7064 too big for session cache, skipping...  

Does anyone know what I'm doing wrong?

-- Edit to summer up the different answers --

The problem is that SSLSniff is not taking care of alternive names when it forges certificates. Apparently, Firefox refuses any certificate as soon as the Common Name doesn't match exactly the domain name.

For example, for Google.com : CN = www.google.com and there is no alternative name. So when you connect to https://www.google.com , it's working fine.
But for Google.fr : CN = *.google.fr, with these alternative names: *.google.fr and google.fr. So when you connect to https://www.google.fr , FF is looking for alternative names and, since it obviously doesn't find any, refuses the malformed certificate.

... So a solution would be to patch/commit... I don't know if Moxie Marlinspike has intentionally forgot this functionnality because it was too complicated, or if he was just not aware of this issue. Anyway, I'll try to have a look at the code.

The session encoded length error message: When caching the SSL session fails, it means that SSL session resumption on subsequent connections will fail, resulting in degraded performance, because a full SSL handshake needs to be done on every request. However, despite using the CPU more heavily, sslsniff will still work fine. The caching fails because the serialized representation of the OpenSSL session object (SSL_SESSION) was larger than the maximum size supported by sslsniff's session cache.

As for your real problem, note that sslsniff does not support X.509v3 subjectAltNames, so if you are connecting to a site whose hostname does not match the subject common name of the certificate, but instead matches only a subjectAltName, then sslsniff will generate a forged certificate without subjectAltNames, which will cause a hostname verification mismatch on the connecting client.

If your problem happens only for some specific sites, let us know the site so we can examine the server certificate using eg openssl s_client -connect host:port -showcerts and openssl x509 -in servercert.pem -text . If it happens for all sites, then the above is not the explanation.

Try a straight MITM with a cert you fully control , and make sure you don't have some OCSP/Perspectives/Convergance stuff meddling with things. Other than that, maybe add the cert to the OS trusted roots. I think FF on windows uses the windows cert store (start->run->certmgr.msc). It may also be worth trying with something like Burp to see if the error is localized to SSLSniff or all MITM attempts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM