{"id":1032,"date":"2014-08-05T02:31:42","date_gmt":"2014-08-05T02:31:42","guid":{"rendered":"https:\/\/trouble.org\/?p=1032"},"modified":"2014-08-05T02:31:42","modified_gmt":"2014-08-05T02:31:42","slug":"certificates-and-security","status":"publish","type":"post","link":"https:\/\/trouble.org\/?p=1032","title":{"rendered":"certificates and security"},"content":{"rendered":"<p><tt>npm<\/tt> is the defacto package manager for the <a title=\"node.js, to boldly node where noone has noded before\" href=\"http:\/\/en.wikipedia.org\/wiki\/Node.js\" target=\"_blank\">node.js<\/a> javascript network programming environment thingee.<\/p>\n<p>The folks who make npm have <a title=\"the great leap forward\" href=\"http:\/\/blog.npmjs.org\/post\/78085451721\/npms-self-signed-certificate-is-no-more\" target=\"_blank\">taken a\u00a0security leap<\/a>:<\/p>\n<blockquote><p><b>npm no longer supports its self-signed certificates<\/b><\/p><\/blockquote>\n<p>Ah, they build the bastions of light and goodness, protecting us from the sins of the masses by standing tall.<\/p>\n<p>So&#8230; how do you install npm, anyway? Ah, yes, you look it up on <a title=\"to boldly npm where no one has npm'd before\" href=\"https:\/\/www.npmjs.org\/doc\/README.html\" target=\"_blank\">their site.<\/a>.. let&#8217;s see&#8230; why, it&#8217;s as simple as executing raw shell commands from a host, what could go wrong with that?<\/p>\n<p>But let&#8217;s test it out, it&#8217;s simply (they thoughtfully tell you to put the -L option, which tells curl to go wherever they decide to redirect you in the webs):<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"bash codecolorer\">$ curl <span class=\"re5\">-L<\/span> https:<span class=\"sy0\">\/\/<\/span>npmjs.org<span class=\"sy0\">\/<\/span>install.sh <span class=\"sy0\">|<\/span> <span class=\"kw2\">sh<\/span><br \/>\n$<\/div><\/div>\n<p>Nothing happened? Ah, they tell you to use a stupid shell so they fail silently; try again with something with a brain, <tt>bash<\/tt> this time.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"overflow:auto;white-space:nowrap;height:800px;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-L<\/span> https:<span class=\"sy0\">\/\/<\/span>npmjs.org<span class=\"sy0\">\/<\/span>install.sh <span class=\"sy0\">|<\/span> <span class=\"kw2\">bash<\/span><br \/>\n<span class=\"sy0\">%<\/span> Total <span class=\"sy0\">%<\/span> Received <span class=\"sy0\">%<\/span> Xferd Average Speed Time Time Time Current<br \/>\nDload Upload Total Spent Left Speed<br \/>\n<span class=\"nu0\">100<\/span> <span class=\"nu0\">6711<\/span> <span class=\"nu0\">100<\/span> <span class=\"nu0\">6711<\/span> <span class=\"nu0\">0<\/span> <span class=\"nu0\">0<\/span> <span class=\"nu0\">17161<\/span> <span class=\"nu0\">0<\/span> --:--:-- --:--:-- --:--:-- <span class=\"nu0\">17161<\/span><br \/>\n<span class=\"re2\">tar<\/span>=<span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span><span class=\"kw2\">tar<\/span><br \/>\nversion:<br \/>\n<span class=\"kw2\">tar<\/span> <span class=\"br0\">&#40;<\/span>GNU <span class=\"kw2\">tar<\/span><span class=\"br0\">&#41;<\/span> <span class=\"nu0\">1.20<\/span><br \/>\nCopyright <span class=\"br0\">&#40;<\/span>C<span class=\"br0\">&#41;<\/span> <span class=\"nu0\">2008<\/span> Free Software Foundation, Inc.<br \/>\nLicense GPLv3+: GNU GPL version <span class=\"nu0\">3<\/span> or later <span class=\"sy0\">&lt;<\/span>http:<span class=\"sy0\">\/\/<\/span>gnu.org<span class=\"sy0\">\/<\/span>licenses<span class=\"sy0\">\/<\/span>gpl.html<span class=\"sy0\">&gt;<\/span><br \/>\nThis is <span class=\"kw2\">free<\/span> software: you are <span class=\"kw2\">free<\/span> to change and redistribute it.<br \/>\nThere is NO WARRANTY, to the extent permitted by law.<br \/>\n<br \/>\nWritten by John Gilmore and Jay Fenlason.<br \/>\n<span class=\"kw2\">install<\/span> npm<span class=\"sy0\">@<\/span>latest<br \/>\ncurl: <span class=\"br0\">&#40;<\/span><span class=\"nu0\">60<\/span><span class=\"br0\">&#41;<\/span> SSL certificate problem, verify that the CA cert is OK. Details:<br \/>\nerror:<span class=\"nu0\">14090086<\/span>:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed<br \/>\nMore details here: http:<span class=\"sy0\">\/\/<\/span>curl.haxx.se<span class=\"sy0\">\/<\/span>docs<span class=\"sy0\">\/<\/span>sslcerts.html<br \/>\n<br \/>\ncurl performs SSL certificate verification by default, using a <span class=\"st0\">&quot;bundle&quot;<\/span><br \/>\nof Certificate Authority <span class=\"br0\">&#40;<\/span>CA<span class=\"br0\">&#41;<\/span> public keys <span class=\"br0\">&#40;<\/span>CA certs<span class=\"br0\">&#41;<\/span>. The default<br \/>\nbundle is named curl-ca-bundle.crt; you can specify an alternate <span class=\"kw2\">file<\/span><br \/>\nusing the <span class=\"re5\">--cacert<\/span> option.<br \/>\nIf this HTTPS server uses a certificate signed by a CA represented <span class=\"kw1\">in<\/span><br \/>\nthe bundle, the certificate verification probably failed due to a<br \/>\nproblem with the certificate <span class=\"br0\">&#40;<\/span>it might be expired, or the name might<br \/>\nnot match the domain name <span class=\"kw1\">in<\/span> the URL<span class=\"br0\">&#41;<\/span>.<br \/>\nIf you<span class=\"st_h\">'d like to turn off curl'<\/span>s verification of the certificate, use<br \/>\nthe <span class=\"re5\">-k<\/span> <span class=\"br0\">&#40;<\/span>or --insecure<span class=\"br0\">&#41;<\/span> option.<br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>curl: <span class=\"br0\">&#40;<\/span><span class=\"nu0\">60<\/span><span class=\"br0\">&#41;<\/span> SSL certificate problem, verify that the CA cert is OK. Details:<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span> error:<span class=\"nu0\">14090086<\/span>:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><br \/>\nMore details here: http:<span class=\"sy0\">\/\/<\/span>curl.haxx.se<span class=\"sy0\">\/<\/span>docs<span class=\"sy0\">\/<\/span>sslcerts.html<br \/>\n<br \/>\ncurl performs SSL certificate verification by default, using a <span class=\"st0\">&quot;bundle&quot;<\/span><br \/>\nof Certificate Authority <span class=\"br0\">&#40;<\/span>CA<span class=\"br0\">&#41;<\/span> public keys <span class=\"br0\">&#40;<\/span>CA certs<span class=\"br0\">&#41;<\/span>. The default<br \/>\nbundle is named curl-ca-bundle.crt; you can specify an alternate <span class=\"kw2\">file<\/span><br \/>\nusing the <span class=\"re5\">--cacert<\/span> option.<br \/>\nIf this HTTPS server uses a certificate signed by a CA represented <span class=\"kw1\">in<\/span><br \/>\nthe bundle, the certificate verification probably failed due to a<br \/>\nproblem with the certificate <span class=\"br0\">&#40;<\/span>it might be expired, or the name might<br \/>\nnot match the domain name <span class=\"kw1\">in<\/span> the URL<span class=\"br0\">&#41;<\/span>.<br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>If you<span class=\"st_h\">'d like to turn off curl'<\/span>s verification of the certificate, use<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span> the <span class=\"re5\">-k<\/span> <span class=\"br0\">&#40;<\/span>or --insecure<span class=\"br0\">&#41;<\/span> option.<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><br \/>\nFailed to get tarball url <span class=\"kw1\">for<\/span> npm<span class=\"sy0\">\/<\/span>latest<br \/>\nsilent <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>d3ck<span class=\"sy0\">\/<\/span>tmptmp <span class=\"nu0\">1078<\/span> <span class=\"sy0\">&gt;<\/span> curl <span class=\"re5\">-L<\/span> https:<span class=\"sy0\">\/\/<\/span>npmjs.org<span class=\"sy0\">\/<\/span>install.sh <span class=\"sy0\">|<\/span> <span class=\"kw2\">sh<\/span><br \/>\n<span class=\"sy0\">%<\/span> Total <span class=\"sy0\">%<\/span> Received <span class=\"sy0\">%<\/span> Xferd Average Speed Time Time Time Current<br \/>\nDload Upload Total Spent Left Speed<br \/>\n<span class=\"nu0\">100<\/span> <span class=\"nu0\">6711<\/span> <span class=\"nu0\">100<\/span> <span class=\"nu0\">6711<\/span> <span class=\"nu0\">0<\/span> <span class=\"nu0\">0<\/span> <span class=\"nu0\">18132<\/span> <span class=\"nu0\">0<\/span> --:--:-- --:--:-- --:--:-- <span class=\"nu0\">18132<\/span><\/div><\/div>\n<p>Yes, the same thing you always see&#8230; a crypto error, because they don&#8217;t use a valid certificate, and I don&#8217;t think they ever have. But hell, obviously these security minded folks want you to simply follow the 301s, wherever they go, execute arbitrary code from psuedo random sites stop asking pesky questions.<\/p>\n<p>Fortunately you can tell curl to ignore the certificate with the &#8211;insecure option (obviously the curl people are exaggerating naming it that!) and run it again:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"bash codecolorer\">$ curl <span class=\"re5\">-k<\/span> <span class=\"re5\">-L<\/span> https:<span class=\"sy0\">\/\/<\/span>npmjs.org<span class=\"sy0\">\/<\/span>install.sh <span class=\"sy0\">|<\/span> <span class=\"kw2\">bash<\/span><br \/>\n<span class=\"br0\">&#91;<\/span>errors much like above<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>Well shoot. It looks like they run curl inside the script that runs curl that follows their redirects to sites with broken certificates. You folks just fill me with confidence &#8211; well, confidence that you don&#8217;t know your head from a hole in the ground WRT security.<\/p>\n<p>I suppose it&#8217;s better than node.js was a year or two ago, when their official advice was to:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-Ls<\/span> goo.gl<span class=\"sy0\">\/<\/span>JD2SR <span class=\"sy0\">|<\/span> <span class=\"kw2\">bash<\/span><\/div><\/div>\n<p>What does that do? Well, they even removed the pretense &#8211; this isn&#8217;t even a secure site, it&#8217;s using an obfuscater, and they tells curl to ignore any pesky errors or warnings.<\/p>\n<p>Following that single line above with <tt>strace<\/tt> revealed 1.6GB of data being tossed around, 16 hosts being involved, and who knows (I lost the output, sorry, lol) how many hundreds of programs, files, and other things were involved.<\/p>\n<p>And these are the people trying to tell me how to use certificates? They may be gods and networking, but they blow chunks with security. GTFO my lawn, whippersnappers, and stop chasing dreams you read in CSO magazine or wherever else you get your crappy security 411. And stop trying to demonize self-signed certs, which I guarantee you are far more numerous and far more useful that crap they try to sell you at Verisign et al*.<\/p>\n<p>God, certificates suck.<\/p>\n<p><a href=\"http:\/\/www.activityvillage.co.uk\/sites\/default\/files\/images\/sports_certificates_av2.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"http:\/\/www.activityvillage.co.uk\/sites\/default\/files\/images\/sports_certificates_av2.jpg\" alt=\"Thanks to the activity village folks. This is worth more than most crypto certs out there, surely\" width=\"320\" height=\"218\" \/><\/a><\/p>\n<p>* In this case nothing against Verisign, it&#8217;s just the entire rotten group of certificate authorities out there.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>npm is the defacto package manager for the node.js javascript network programming environment thingee. The folks who make npm have taken a\u00a0security leap: npm no longer supports its self-signed certificates Ah, they build the bastions of light and goodness, protecting us from the sins of the masses by standing tall. So&#8230; how do you install [&hellip;]<\/p>\n","protected":false},"author":44,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[260,19,4,6,87],"tags":[227,129,342,318,285,284],"class_list":["post-1032","post","type-post","status-publish","format-standard","hentry","category-crypto","category-philosophy","category-security","category-tech","category-web","tag-bullshit","tag-certs","tag-crypto","tag-security","tag-signed","tag-unsigned"],"_links":{"self":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1032"}],"version-history":[{"count":3,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1032\/revisions"}],"predecessor-version":[{"id":1035,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1032\/revisions\/1035"}],"wp:attachment":[{"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}