More Tricks for Defeating SSL in Practice
Total Page:16
File Type:pdf, Size:1020Kb
More Tricks For Defeating SSL In Practice Moxie Marlinspike [email protected] Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies Once Again, The Back Story... Moxie Marlinspike Institute For Disruptive Studies In the past, I've talked about BasicConstraints... Moxie Marlinspike Institute For Disruptive Studies Certificate Chaining VeriSign Intermediate CA paypal.com Moxie Marlinspike Institute For Disruptive Studies Certificate Chaining VeriSign Intermediate CA Intermediate CA paypal.com Moxie Marlinspike Institute For Disruptive Studies How do we verify these things? Moxie Marlinspike Institute For Disruptive Studies What they say: ● Verify that the name of the leaf node is the same as the site you're connecting to. ● Verify that the leaf certificate has not expired. ● Check the signature. ● If the signing CA is in our list of trusted root CAs, stop. Otherwise, move one up the chain and repeat. Moxie Marlinspike Institute For Disruptive Studies Here Be Dragons ● Very tempting to use a simple recursive function. ● Everyone focuses on the signature validation. ● The result of a naïve attempt at validation is a chain that is complete, but nothing more. Moxie Marlinspike Institute For Disruptive Studies What if... VeriSign Intermediate CA Intermediate CA thoughtcrime .org Moxie Marlinspike Institute For Disruptive Studies What if... VeriSign Intermediate CA Intermediate CA thoughtcrime .org paypal.com Moxie Marlinspike Institute For Disruptive Studies What they say: ● Verify that the name of the leaf node is the same as the site you're connecting to. ● Verify that the leaf certificate has not expired. ● Check the signature. ● If the signing CA is in our list of trusted root CAs, stop. Otherwise, move one up the chain and repeat. Moxie Marlinspike Institute For Disruptive Studies Something must be wrong, but... ● All the signatures are valid. ● Nothing has expired. ● The chain is in tact. ● The root CA is embedded in the browser and trusted. Moxie Marlinspike Institute For Disruptive Studies But we just created a valid certificate for PayPal, and we're not PayPal? Moxie Marlinspike Institute For Disruptive Studies The missing piece... Moxie Marlinspike Institute For Disruptive Studies ...is a somewhat obscure field. Moxie Marlinspike Institute For Disruptive Studies Back In The Day ● Most CAs didn't explicitly set basicConstraints: CA=False ● Whether the field was there or not, most SSL implementations didn't bother to check it. ● Anyone with a valid leaf node certificate could create and sign a leaf node certificate for any other domain. ● When presented with a complete chain, IE, Outlook, Konqueror, OpenSSL, and others considered it valid... Moxie Marlinspike Institute For Disruptive Studies And then in 2002... ● Microsoft did something particularly annoying, so I blew this up by publishing it. ● Microsoft claimed that it was impossible to exploit. ● So I also published the tool that exploits it. Moxie Marlinspike Institute For Disruptive Studies sslsniff Moxie Marlinspike Institute For Disruptive Studies sslsniff Moxie Marlinspike Institute For Disruptive Studies sslsniff sslsniff ● Intercept a connection from ● Make a normal SSL the client side. connection to the server. ● Generate a certificate for the ● Pass data between client and site it is connecting to. server, decrypting and ● Sign it with any random valid encrypting on each end. leaf node certificate. ● Pass that certificate chain to the client. Moxie Marlinspike Institute For Disruptive Studies Lately, I've been talking about SSL Stripping... Moxie Marlinspike Institute For Disruptive Studies brief Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies SSL can be useful, but how it's deployed matters Moxie Marlinspike Institute For Disruptive Studies In the context of web browsing ● SSL is almost never encountered directly. ● It is either encountered as a result of: ● A 302 redirect from an HTTP URL to an HTTPS URL. ● An HTTPS link that a user clicks on from an HTTP page. – (Think, “My Cart,” “Checkout,” “Login,” etc...) Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies We Can Attack SSL Before We Even Get There Moxie Marlinspike Institute For Disruptive Studies sslsniff Moxie Marlinspike Institute For Disruptive Studies sslstrip Moxie Marlinspike Institute For Disruptive Studies sslstrip ● Watch HTTP traffic go by. ● Switch <a href=”https://...”> to <a href=”http://...”> ● and keep a map of what you've changed. ● Switch Location: https:// to Location: http:// ● and keep a map of what you've changed. sslstrip Moxie Marlinspike Institute For Disruptive Studies sslstrip ● Watch HTTP traffic go by. ● When we see an HTTP request for a URL that we've stripped, proxy that out as HTTPS to the server. ● Watch the HTTPS traffic go by, log everything that we want, and keep a map of all relative, CSS, and JS links that go by. sslstrip Moxie Marlinspike Institute For Disruptive Studies How Does It Look? How Does It Look? How Does It Look? How Does It Look? Where can we go from here? Moxie Marlinspike Institute For Disruptive Studies Where do we need to go from here? Moxie Marlinspike Institute For Disruptive Studies What's with certificates, anyways? X509Certificate Version Serial Number Issuer Validity (not before X or after Y) Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies What's with certificates, anyways? X509Certificate Version Serial Number Issuer Validity (not before X or after Y) Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies What's with certificates, anyways? X509Certificate Version Serial Number Issuer Validity (not before X or after Y) Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies What's with certificates, anyways? X509Certificate Version Serial Number Issuer Validity (not before X or after Y) Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies What's with certificates, anyways? X509Certificate Version Serial Number Issuer Validity (not before X or after Y) Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies The Big Three ● Secrecy ● Authenticity ● Integrity Moxie Marlinspike Institute For Disruptive Studies SSL/TLS Handshake Beginnings ClientHello ServerHello, ServerCertificate Moxie Marlinspike Institute For Disruptive Studies SSL Handshake Beginnings X509Certificate Version Serial Number Issuer Validity Subject PublicKey SignatureAlgorithm Signature Moxie Marlinspike Institute For Disruptive Studies The Problems For Us Begin Attacker ClientHello ServerHello, ServerCertificate? Moxie Marlinspike Institute For Disruptive Studies Let's start by looking back once more. Moxie Marlinspike Institute For Disruptive Studies In 2000, things were different. Moxie Marlinspike Institute For Disruptive Studies Notaries! Moxie Marlinspike Institute For Disruptive Studies Identification! Moxie Marlinspike Institute For Disruptive Studies Phone Calls! Moxie Marlinspike Institute For Disruptive Studies Actual people involved... Moxie Marlinspike Institute For Disruptive Studies That is a bygone era Moxie Marlinspike Institute For Disruptive Studies These days it's all about: online domain validation Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes WHOIS Lookup Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes WHOIS Lookup Email [email protected] Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject www.bankofamerica.com PublicKey Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject certificate.authoritie s.are.a.total.ripoff. PublicKey bankofamerica.com Attributes Moxie Marlinspike Institute For Disruptive Studies PKCS #10 CertificateRequest Version Subject certificate.authoritie s.are.a.total.ripoff. PublicKey bankofamerica.com Attributes Moxie Marlinspike Institute For Disruptive Studies Subjects DistinguishedName Country State Locale Organization Organizational Unit Common Name Moxie Marlinspike Institute For Disruptive Studies Subjects ● The X.509 standard is DistinguishedName a total nightmare. Country ● Three revisions, State twenty years. Locale ● Parts of the standard Organization have literally been Organizational Unit “lost” and then later Common Name “found” again.