1 00:00:00,000 --> 00:00:06,200 Next up we have Carl Kosher talking about enabling HTTPS for home network devices using Let's Encrypt. 2 00:00:06,860 --> 00:00:08,060 All right. 3 00:00:08,060 --> 00:00:09,100 Thanks. 4 00:00:10,080 --> 00:00:12,060 So I'm Carl Kosher. 5 00:00:12,060 --> 00:00:18,360 I'm a research scientist at the University of Washington doing wireless and embedded system security. 6 00:00:18,360 --> 00:00:33,940 I'm going to talk about some of the challenges of using TLS on home network devices or other internal network devices and a way to easily issue certificates for these devices. 7 00:00:34,380 --> 00:00:37,180 So why is TLS important? 8 00:00:37,180 --> 00:00:39,960 Isn't, you know, WPA on your network enough? 9 00:00:39,960 --> 00:00:44,100 I mean, it's already encrypting and authenticating your communication. 10 00:00:44,100 --> 00:00:49,580 Well, as it turns out, browsers are really pushing for TLS these days. 11 00:00:49,580 --> 00:01:07,040 Chrome and some other browsers are now requiring TLS to use certain powerful APIs such as accessing the user's web camera or running service workers or pushing notifications. 12 00:01:07,160 --> 00:01:18,580 And so if you want to write an app that uses these, what they call powerful features, you need to serve that over TLS. 13 00:01:18,800 --> 00:01:40,100 And the problem with that is if you want to make a web application that uses those features and also communicates with local network devices, you can't really do that because it also blocks cross-origin requests from a secure origin to a non-secure origin. 14 00:01:40,360 --> 00:02:11,400 And so to make this a bit more concrete, I was trying to write an app for the Chromecast which requires applications to be served over HTTPS to connect to this HD home run TV tuner so that I could watch TV channels on my TV through my Chromecast while it connects to the TV tuner and pulls down the impact stream. 15 00:02:11,400 --> 00:02:20,320 The problem is that, so the HD home run device, it gets its IP address. 16 00:02:20,320 --> 00:02:31,180 However, because the HD home run device only speaks HTTP, it can't actually do that cross-origin request to get that, uh, impact data stream. 17 00:02:31,180 --> 00:02:39,440 And so this is sort of the problem that really, um, uh, caused me to, to look at this issue. 18 00:02:39,540 --> 00:02:43,740 So why is, uh, doing local TLS hard? 19 00:02:43,740 --> 00:02:54,460 Well, uh, as I alluded to, um, local TLS is often discovered by their IP address and not by a particular host name. 20 00:02:54,980 --> 00:02:59,120 Uh, TLS certs, on the other hand, are issued for a specific host name. 21 00:02:59,120 --> 00:03:08,000 So, um, in the common name or the, uh, subject alternate name, you have a list of, uh, fully qualified domain names that a certificate is valid for. 22 00:03:08,280 --> 00:03:16,340 And, um, so if you're just connecting to an IP address, uh, that doesn't match what it is in the, the certs. 23 00:03:17,040 --> 00:03:29,100 Some, uh, device manufacturers will, uh, ship a cert , uh, on the device, uh, and that certificate is the same across all devices. 24 00:03:29,100 --> 00:03:32,620 Uh, however, that can be easily abused. 25 00:03:32,620 --> 00:03:37,960 Um, you might remember the super fish scandal that happened several years ago. 26 00:03:37,960 --> 00:03:52,960 Basically, uh, this software, uh, pre-installed a, uh, certificate, um, that was, uh, used as a CA certificate that could, uh, sign, uh, any host name, uh, whatsoever. 27 00:03:52,960 --> 00:04:05,780 And the problem there was that the private key was shared across all laptops and so anyone with the super fish software could then create, uh, certificates for any domain name. 28 00:04:05,820 --> 00:04:13,520 Um, so you can also do that, uh, when you have shared certificates across these network devices. 29 00:04:14,020 --> 00:04:30,040 Uh, even if you do unique certificates, again, because you're, uh, discovering these devices by IP address, um, they will often be for a common host name like, uh, router dot homeland dot com or something like that. 30 00:04:30,140 --> 00:04:47,260 And so if you have any of these certificates, uh, you can get them re- you can, um, basically use those to, uh, do man in the middle attacks on, uh, on that domain name. 31 00:04:47,340 --> 00:04:57,820 Um, if you want to do something with, like, let's encrypt, uh, the problem there is that a lot of end users typically don't own a domain. 32 00:04:57,820 --> 00:05:03,740 Uh, I imagine most people in this room probably do, but, uh, real users don't. 33 00:05:03,820 --> 00:05:10,500 Uh, and so there's not really, uh, a domain that people can use to, uh, get their own certificate. 34 00:05:11,120 --> 00:05:29,260 And finally, even if they do have their own domain name and they want to get a domain with let's encrypt, uh, these local devices aren't externally facing, so the typical way of using certbot to automatically generate these certificates, uh, doesn't really work because, 35 00:05:29,260 --> 00:05:36,460 uh, let's encrypt can't talk back to the device to verify, uh, domain ownership or control. 36 00:05:36,640 --> 00:05:43,740 So it turns out that one company has actually solved this issue and that company is Plex. 37 00:05:43,740 --> 00:05:53,540 So Plex is, uh, well, it's a little sketchy, but it's basically, uh, Netflix for your own, uh, home media, um, server. 38 00:05:53,580 --> 00:06:11,140 And, uh, the way that they solved it is they issue each server a 16 byte GUID and then Plex issues a wildcard cert for this GUID dot Plex dot direct. 39 00:06:11,140 --> 00:06:29,160 And so whenever you want to talk to your Plex server on a particular IP address, you go to IP address dot GUID dot Plex dot direct and they have name servers set up that automatically resolve that, uh, directly to A dot B dot C dot D. 40 00:06:29,160 --> 00:06:48,440 Now this seems a little weird, but, um, the key here is that by going to that fully qualified domain name instead of an IP address, um, the, uh, fully qualified domain name matches with the wildcard cert that the server has, uh, and then the connection is trusted automatically. 41 00:06:48,440 --> 00:06:54,460 And so this allows for, um, uh, friends to connect to your server over the internet. 42 00:06:54,500 --> 00:07:10,400 Even if you have a dynamic, uh, IP address from your ISP, it also, uh, lets you connect directly, uh, on internal, um, like 192 dot 168, uh, IP addresses as well and everything is, uh, nice and secure. 43 00:07:10,720 --> 00:07:23,000 So, Plex partnered with, uh, certificate authority to issue these certs and that's kind of costly and, uh, most IOT vendors won't bother doing this. 44 00:07:23,100 --> 00:07:32,680 So, I was wondering if we could actually use Let's Encrypt which provides free certificates to do this and as it turns out, you actually can. 45 00:07:33,320 --> 00:07:38,360 So, let's talk a little bit about how Let's Encrypt, uh, automatically issues certificates. 46 00:07:38,360 --> 00:07:56,540 So, they use what's known as the ACME protocol, the automation, uh, automated certificate management environment protocol and this is implemented by, uh, a client called Certbot and by, uh, CA software called Boulder and this is a way to, uh, basically automate, 47 00:07:56,540 --> 00:08:04,060 uh, domain validation to prove that you have control over a domain that you want, um, a certificate for. 48 00:08:04,900 --> 00:08:18,820 Uh, so, the way that this, that the ACME protocol works is that the certificate authority issues you a challenge , uh, to prove, uh, control over a domain that you want a certificate for. 49 00:08:18,820 --> 00:08:36,120 And there's a couple of different types of challenges, uh, the two main ones right now are HTTP01 where the, uh, certificate authority asks you to create a file at a specific URL with, uh , specific contents and it verifies that you put that file there and if you did, 50 00:08:36,120 --> 00:08:39,920 uh, then you have control over that domain and they give you a certificate for that. 51 00:08:39,920 --> 00:09:02,880 There's also DNS01 where you add a text record, um, for the domain name, uh, with a, a specific content, uh, uh, secure token, uh, and, uh, this is the only way to get, uh, wild card certificates, um, but it's nice that they do, uh, give you wild card certificates now. 52 00:09:03,580 --> 00:09:11,540 Um, so for accounts, um, basically they are associated with a public private key pair. 53 00:09:11,540 --> 00:09:22,620 Um, you're the, so you automatically generate this private key, um, and derive the public key from that and that public key is essentially your account ID. 54 00:09:22,620 --> 00:09:39,040 Now they do have sort of, uh, an internal account ID that you actually use, um, for efficiency and, and other reasons, but basically your account is this public private key pair and you use this private key that you generate yourself to sign all requests, 55 00:09:39,040 --> 00:09:46,780 including the initial registration with Let's Encrypt where you tell them that you agree to the terms of service and, and so on and so forth. 56 00:09:47,140 --> 00:10:08,920 Uh, so my proposed solution for, um, using Let's Encrypt, uh, for local devices is, um, this service that I'm calling TLS my net, which lets you issue wild card certificates for subdomain that is tied to your Let's Encrypt, uh, account public key. 57 00:10:09,840 --> 00:10:23,060 So, time is of the essence and tying the, um, the subdomain to your Let's Encrypt account, uh, basically lets you verify legit, legitimacy at an application level. 58 00:10:23,080 --> 00:10:44,880 Um, so, uh, you know that you are always going to talk to your server at a particular subdomain and as long as that subdomain matches, you know that, um, the private, uh, that at least someone with the corresponding private key, um, proved, uh, that they had that private key and they, 59 00:10:44,880 --> 00:10:47,320 um, got a certificate for that domain. 60 00:10:47,840 --> 00:11:11,320 So, the basic way that this works is you use, uh, Let's Encrypt, um, as normal, but, uh, instead of proving, um, control over your own domain, you ask a third party, uh, to, uh, prove control of a subdomain, um, and, uh, that third party then, um, um, 61 00:11:11,320 --> 00:11:15,340 can, um, solves that challenge for you by creating that text record. 62 00:11:15,800 --> 00:11:22,380 So, the way that this works is the device initiates a subdomain wildcard certificate request with Let's Encrypt. 63 00:11:22,380 --> 00:11:26,200 Let's Encrypt says, okay, here's a DNS challenge. 64 00:11:26,200 --> 00:11:30,640 Uh, the device then sends that challenge request to TLS MyNet. 65 00:11:30,640 --> 00:11:35,960 This request is signed with the public key using, uh, JSON web signatures. 66 00:11:36,300 --> 00:11:53,800 Uh, the thumbprint of the corresponding public key, um, is used as the subdomain, uh, and because of limitations of DNS, we actually have to encode this as a base 36, which is kind of icky, but, um, it, it works. 67 00:11:54,020 --> 00:12:03,040 Uh, and basically the, the public private key pair here is the same, uh, public private key that is tied to your Let's Encrypt account. 68 00:12:04,120 --> 00:12:14,720 Uh, so this is currently implemented in, uh, 2 Python scripts, um, uh, that are on GitHub right now and I'll, uh, give you that URL later. 69 00:12:14,720 --> 00:12:20,980 The first is, uh, DNS server.py and this does 2 things primarily. 70 00:12:20,980 --> 00:12:29,020 One, it resolves, uh, that, uh, IP address dot thumbprint dot TLS my dot net to that IP address. 71 00:12:29,320 --> 00:12:31,600 Um, so it, it handles that for you. 72 00:12:31,600 --> 00:12:41,900 The second, uh, second is that it also resolves these, uh, text records, um, that are used for, uh, subdomain, uh, verification with Let's Encrypt. 73 00:12:41,900 --> 00:12:52,400 Uh, it uses this library called DNSlib, which, uh, lets you easily create, uh, DNS clients and serve, uh, servers, uh, using Python. 74 00:12:52,540 --> 00:13:07,640 Right now the server is sort of, uh, single threaded and synchronous and so there could theoretically be some performance issues, but, uh, I'm planning on migrating that to, uh, Python's async IO, uh, fairly shortly. 75 00:13:08,140 --> 00:13:19,520 Uh, the second half of this, uh, system is the, the web server, which receives these requests, uh, for creating these text records to respond to these challenges. 76 00:13:19,520 --> 00:13:28,840 Uh, this does use async IO, so even though it's single threaded, um, it can handle multiple requests and while it's waiting on one, it can service another. 77 00:13:29,180 --> 00:13:38,060 Uh, and it uses, uh, also this, uh, JWcrypto library for doing, uh, JSON web signatures and, and JSON web keys and things like that. 78 00:13:38,060 --> 00:13:49,760 And then in between there's just a standard Redis server that's a temporary, uh, key value store for storing, um, specific text records, uh, for specific subdomains. 79 00:13:49,980 --> 00:13:54,160 Um, and those, uh, those last for 5 minutes. 80 00:13:54,160 --> 00:14:03,620 Um, and so the nice thing here is that really there doesn't need to be any state that you actually store on this server. 81 00:14:03,620 --> 00:14:10,660 Uh, you just need the, the key value store long enough to, uh, do the domain verification. 82 00:14:10,660 --> 00:14:20,220 Um, you don't need accounts because, uh, those are automatically proven by using the public uh, private key pairs. 83 00:14:20,640 --> 00:14:27,700 Uh, and, uh, you know, the resolving an IP address, uh, is, you know, straightforward. 84 00:14:28,200 --> 00:14:31,980 So, currently this is still, uh, a work in progress. 85 00:14:31,980 --> 00:14:43,200 Um, there is a test client right now, uh, on GitHub that, uh, sends a, uh, request to create a challenge, um, to the web server. 86 00:14:43,340 --> 00:14:48,060 Uh, it, it could be better, um, but, you know, hopefully that's coming soon. 87 00:14:48,060 --> 00:14:55,140 Um, I am planning on integrating this with CertBot as a plug-in. 88 00:14:55,140 --> 00:15:09,840 However, there's a, a little , um, issue there where the, uh, CertBot plug-ins don't automatically expose the account , uh, public and private keys to, uh, the extensions there. 89 00:15:09,840 --> 00:15:12,940 So, that's a little issue I'll, I'll have to work through. 90 00:15:12,980 --> 00:15:18,740 The server currently has a little brokenness with case sensitivity, but, but I'm going to fix that today. 91 00:15:18,740 --> 00:15:29,260 Um, it, uh, I have tested it and it does work and as I said before, uh, the DNS server will be modified to use, uh, async IO for a bit more performance. 92 00:15:29,300 --> 00:15:37,860 Um, so the code is up right now on GitHub, on, uh, github.com slash superset slash TLS my.net. 93 00:15:38,800 --> 00:15:45,960 Uh, so before I, uh, finish this talk, uh, I might want to talk a bit about the risk model here. 94 00:15:45,960 --> 00:15:57,660 Um, this seems a bit, um, non-standard and you might have some concerns about this and, uh, I'll just talk, uh, a little bit about those. 95 00:15:57,660 --> 00:16:12,920 So, the third party domain that you use, uh, in this instance, TLS my.net is, um, assumed to be trusted because they can always prove, uh, control over, uh, that domain and any of its subdomains. 96 00:16:13,300 --> 00:16:28,120 Uh, but, the way I envision this being used is that, uh, each device manufacturer runs their own service for this and you're already trusting that manufacturer anyway, um, so there, there's some sort of implicit trust there. 97 00:16:28,120 --> 00:16:50,820 Um, also, as of, uh, fairly recently, there's these things called certificate transparency logs where every certificate that is issued is, um, uh, appended to these, uh, append only logs which, you know, blockchain, whatever, um, basically to, to prove, 98 00:16:50,820 --> 00:17:01,820 um, or to, basically to, uh, show that certificate authorities are not issuing certificates that are unauthorized. 99 00:17:01,820 --> 00:17:18,800 So, if you're concerned about your, uh, third party domain provider, um, issuing a certificate, uh, for your subdomain or issuing a wildcard cert for the entire domain, you can go through and search these, uh, certificate transparency logs to make sure that they are, 100 00:17:18,800 --> 00:17:20,320 uh, doing the right thing. 101 00:17:20,780 --> 00:17:40,720 Uh, so my plan is to release, uh, TLS MyNet as a public service, uh, and, um, you know, get this idea out there perhaps, maybe get, uh, Let's Encrypt to, to support this natively and do the same DNS resolution, uh, and challenges that, um, uh, that we support right now. 102 00:17:40,720 --> 00:17:56,800 Um, I'm, mostly see this as sort of a proof of concept service, uh, to encourage, uh, TLS adoption for these local network devices, um, that, uh, are currently hard to get, uh, TLS certificates for. 103 00:17:56,800 --> 00:18:01,360 And, uh, please, please, please bug your manufacturers to, to support TLS. 104 00:18:01,360 --> 00:18:14,540 So, even if you have, um, these certificates, you know, these devices still need a way to, uh, load these certificates into them, uh, and actually speak HTTPS and, and TLS and these things. 105 00:18:14,540 --> 00:18:19,620 And even if you do get a certificate, uh, the device still needs to talk TLS. 106 00:18:20,360 --> 00:18:30,900 Um, so, in summary, I would say, you know, going forward, TLS, uh, is absolutely essential for, uh, these innovative web applications. 107 00:18:30,900 --> 00:18:32,880 Uh, browsers are demanding it. 108 00:18:32,880 --> 00:18:35,360 Devices like the Chromecast are demanding it. 109 00:18:35,480 --> 00:18:42,500 Uh, basically, you need TLS if you want to, um, use a lot of these new powerful features. 110 00:18:42,600 --> 00:18:52,100 Um, currently, they, uh, these TLS certificates are difficult to acquire for, uh, these internal network devices for a bunch of reasons that I talked about. 111 00:18:52,100 --> 00:19:02,100 Um, but I, uh, proposed here a way of, uh, easily getting these, uh, wildcard certificates, uh, using a third -party service. 112 00:19:02,360 --> 00:19:06,000 Uh, so with that, I'd like to, uh, thank you for your attention. 113 00:19:06,000 --> 00:19:12,200 Uh, this is my email address, my Twitter handle, and the GitHub account for the TLS MyNet service. 114 00:19:12,200 --> 00:19:13,640 So, thanks . 115 00:19:14,280 --> 00:19:15,360 Alright. 116 00:19:15,440 --> 00:19:16,760 Thank you, Carl. 117 00:19:16,760 --> 00:19:20,860 If you have questions, please come up and line up by me. 118 00:19:32,230 --> 00:19:38,770 Did you have any problems with running into, uh, DNS needing a CAA record? 119 00:19:39,270 --> 00:19:42,930 So, we, uh, no. 120 00:19:42,930 --> 00:19:46,930 So, we do not return CAA records for that. 121 00:19:46,930 --> 00:20:06,110 We could return CAA records for that, but, um, the, so, for people who don't know, the CAA records, uh, basically, uh, say, or they tell a certificate authority which CAAs are allowed to issue certificates for a particular domain. 122 00:20:06,110 --> 00:20:10,010 Um, we currently don't, uh, return any CAA records. 123 00:20:10,010 --> 00:20:16,970 So, theoretically, any CAA could issue, um, uh, certs for, uh, TLS MyNet. 124 00:20:16,970 --> 00:20:19,410 Um, I, I could add it. 125 00:20:21,530 --> 00:20:23,390 Other questions? 126 00:20:25,370 --> 00:20:25,950 No? 127 00:20:25,950 --> 00:20:26,350 Alright. 128 00:20:26,350 --> 00:20:29,170 Well, then let's give Carl one last big round of applause. 129 00:20:29,170 --> 00:20:29,510 Alright. 130 00:20:29,510 --> 00:20:29,950 Thanks. 131 00:20:29,950 --> 00:20:30,570 Thank you, Carl.