{"id":3553,"date":"2012-10-04T16:42:49","date_gmt":"2012-10-04T14:42:49","guid":{"rendered":"http:\/\/daniel.haxx.se\/blog\/?p=3553"},"modified":"2016-02-10T23:11:52","modified_gmt":"2016-02-10T22:11:52","slug":"ssl-verification-still-often-disabled","status":"publish","type":"post","link":"https:\/\/daniel.haxx.se\/blog\/2012\/10\/04\/ssl-verification-still-often-disabled\/","title":{"rendered":"SSL verification still often disabled"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-4290\" title=\"SSL padlock\" src=\"http:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2012\/10\/ssl-padlock.jpg\" alt=\"SSL padlock\" width=\"250\" height=\"362\" srcset=\"https:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2012\/10\/ssl-padlock.jpg 250w, https:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2012\/10\/ssl-padlock-103x150.jpg 103w, https:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2012\/10\/ssl-padlock-207x300.jpg 207w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/>Back in 2002 I realized that having libcurl not do SSL server verification by default basically meant that everyone writing <a href=\"http:\/\/curl.haxx.se\/libcurl\/\">libcurl<\/a> apps would inherit that flaw, simply because most people always just let the defaults remain unless they really have to read up on what something does and then modify them. If things work, things will just remain. So when we shipped <a href=\"http:\/\/curl.haxx.se\/changes.html#7_10\">libcurl 7.10<\/a> on the first of October that year, libcurl started verifying server certs by default.<\/p>\n<p>Fast forward about ten years.<\/p>\n<p>Surely SSL clients everywhere now do the right thing?<\/p>\n<p>One day a couple of months ago, I was referred to this <a href=\"http:\/\/bugs.python.org\/issue13647\">bug report<\/a> for the <a href=\"http:\/\/docs.python.org\/dev\/library\/ssl.html\">pyssl module in Python<\/a> which identifies that <strong>it doesn&#8217;t verify server certs by default<\/strong>! The default SSL handler in Python doesn&#8217;t verify the certificate properly. It makes all python programs that use this without special attention vulnerable for <a href=\"http:\/\/daniel.haxx.se\/blog\/2008\/10\/20\/in-the-middle-there-is-a-man\/\">man in the middle attacks<\/a>.<\/p>\n<p>So let&#8217;s look at the state of another popular language: <a href=\"http:\/\/www.php.net\/\">PHP<\/a>. A plain standard PHP program opens a ssl:\/\/ or tls:\/\/ stream. Unless the author of said program knows and understands these things, it too <strong>runs <a href=\"http:\/\/php.net\/manual\/en\/context.ssl.php#context.ssl.verify-peer\">without verifying server certs<\/a><\/strong>. If a program instead decides to use the <a href=\"http:\/\/php.net\/manual\/en\/book.curl.php\">PHP\/CURL<\/a> binding for HTTPS or similar, it will use <a href=\"http:\/\/curl.haxx.se\/libcurl\/\">libcurl&#8217;s<\/a> default which verifies it (as I explained above).<\/p>\n<p>But not everything is gloomy. Some parts of our community have decided to do the right thing:<\/p>\n<p>I was told (and proven) that Ruby <a href=\"https:\/\/gist.github.com\/1515075\">now does the right thing<\/a>, but I don&#8217;t know how recent that is and thus how many older Ruby programs that suffer.<\/p>\n<p>The same problem existed with perl&#8217;s major HTTPS using module, the LWP, for a very long time. The perl camp however already modified LWP to do verification by default with the release of <a href=\"http:\/\/cpansearch.perl.org\/src\/GAAS\/libwww-perl-6.00\/Changes\">libwww-perl 6.00<\/a>, released in March 2011.<\/p>\n<p>Side-note: in the curl project we make it easy for everyone on the Internet to use Firefox&#8217;s excellent CA cert bundle to verify server certs by providing <a href=\"http:\/\/curl.haxx.se\/docs\/caextract.html\">the Firefox CA cert collection converted to PEM<\/a> &#8211; the preferred format for OpenSSL, GnuTLS and others.<\/p>\n<p><strong>Conclusion:<\/strong><\/p>\n<p>Even today, lots and lots of applications and scripts will remain insecure &#8211; even though they probably think they&#8217;re fairly safe when they switch to a HTTPS or SSL using protocol &#8211; \u00c2\u00a0and might be subject for man-in-the-middle attacks without even being able to spot it. I think it is pretty sad.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2002 I realized that having libcurl not do SSL server verification by default basically meant that everyone writing libcurl apps would inherit that flaw, simply because most people always just let the defaults remain unless they really have to read up on what something does and then modify them. If things work, things &hellip; <a href=\"https:\/\/daniel.haxx.se\/blog\/2012\/10\/04\/ssl-verification-still-often-disabled\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">SSL verification still often disabled<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,6,133],"tags":[33,186,190,428,43],"class_list":["post-3553","post","type-post","status-publish","format-standard","hentry","category-curl","category-floss","category-security","tag-curl-and-libcurl","tag-php","tag-python","tag-security","tag-ssl"],"_links":{"self":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/3553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/comments?post=3553"}],"version-history":[{"count":28,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/3553\/revisions"}],"predecessor-version":[{"id":8598,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/3553\/revisions\/8598"}],"wp:attachment":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media?parent=3553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/categories?post=3553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/tags?post=3553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}