1 00:00:01,280 --> 00:00:04,400 Welcome to this talk, When TLS Hacks You. 2 00:00:05,160 --> 00:00:07,040 I'm actually going to start with the demo. 3 00:00:07,100 --> 00:00:08,420 This is going to be weird. 4 00:00:08,420 --> 00:00:13,100 This isn't a concrete attack scenario, but hopefully should make everyone curious about what's going on. 5 00:00:13,100 --> 00:00:18,720 For those familiar with SSRF, the implications will be fairly clear, but I'll explain them right after the demo for everyone else. 6 00:00:19,080 --> 00:00:26,680 After that, the attack examples are going to gradually move towards real stuff, but I find it's easiest to look at the simplest cases and then start expanding to look at real-world stuff. 7 00:00:26,800 --> 00:00:31,120 For now, though, let's see the essence of the dangerous property of TLS that this talk is about. 8 00:00:33,460 --> 00:00:39,200 So, here's memcached, a popular cache that commonly runs on port 11211. 9 00:00:39,880 --> 00:00:44,880 I have it installed here, so you can first see for the key named Z, there currently is no entry. 10 00:00:45,060 --> 00:00:50,040 If you're not familiar with memcached, this is how stuff communicates with it, a newline-delimited TCP protocol. 11 00:00:50,260 --> 00:00:53,680 But now I'll do something that you might not expect to affect memcached. 12 00:00:53,680 --> 00:00:55,880 I'll make a request to an HTTPS URL. 13 00:00:55,880 --> 00:01:00,260 The "-l'' enables redirects, and the "-v'' lets you see all that's going on. 14 00:01:01,040 --> 00:01:04,780 So, you can see that the endpoint is redirecting to itself. 15 00:01:05,260 --> 00:01:09,340 I sped this up because this is a lightning talk, and the string of redirects takes a couple of minutes. 16 00:01:09,900 --> 00:01:11,580 But the redirects don't go on forever. 17 00:01:11,800 --> 00:01:14,880 After a bit, we get an error. 18 00:01:16,080 --> 00:01:17,380 And now for the magic. 19 00:01:17,760 --> 00:01:22,520 Going back to memcached, if we rerun the same git command, we see an entry appear. 20 00:01:23,040 --> 00:01:32,360 The odd thing is, that text never showed up in the curl command or in any of the redirects, so somehow the server we were talking to had to do something with TLS to trick curl into putting it in there. 21 00:01:32,900 --> 00:01:39,720 So even though I didn't just do anything other than hacking myself, what just happened was weird and potentially useful. 22 00:01:43,260 --> 00:01:45,020 But here's where I'm going with this. 23 00:01:45,060 --> 00:01:51,400 Because not everyone is into these sorts of attacks, I'm going to start off with exactly what makes this useful as an attacker. 24 00:01:51,400 --> 00:01:58,360 I'll then move on to some stuff that shows just how widely these attacks can be applied, and then get to some recommendations for what to do about them. 25 00:01:59,400 --> 00:02:03,280 So to start off with, there's an existing class of vulnerability called SSRF. 26 00:02:03,280 --> 00:02:05,460 It stands for server-side request forgery. 27 00:02:05,800 --> 00:02:09,600 It's where you effectively phish a server into doing something by sending it a URL. 28 00:02:11,320 --> 00:02:16,020 Last year at Black Hat, I demonstrated a bunch of these vulnerabilities in Apple Pay and in Webhook receivers. 29 00:02:16,240 --> 00:02:22,840 I'm not going to go into those as much here, but if you're curious, you can download these slides later and go to this YouTube link right here. 30 00:02:24,320 --> 00:02:28,900 SSRF has a ton of different approaches, but it was actually pretty easy in some cases. 31 00:02:28,960 --> 00:02:35,500 Webkit.org had a live sample implementation of Apple Pay, and it was even on AWS with the old Insys metadata service. 32 00:02:35,540 --> 00:02:40,380 So all I had to do was pass this IP, and I could poke around an internal API and get some tokens. 33 00:02:41,460 --> 00:02:43,260 But not everything was so simple. 34 00:02:43,260 --> 00:02:47,900 I had a lot of SSRF vulnerabilities that were almost there, but weren't vulnerable to this easier approach. 35 00:02:49,340 --> 00:02:54,840 Sometimes I'd have a Webhook where I could hand it a URL, and the server would even fetch the URL, but not give me a response. 36 00:02:55,000 --> 00:02:56,760 This is called blind SSRF. 37 00:02:57,760 --> 00:03:02,820 Other times the request in question would be a put request, which restricted what endpoints I could hit. 38 00:03:03,080 --> 00:03:08,920 Sometimes you can mess with the request method by setting up an endpoint that redirects the target server around, but that's hit or miss. 39 00:03:10,160 --> 00:03:16,400 Other times you might get some data back, but it's validated against a specific content type, or you only get back certain fields. 40 00:03:16,400 --> 00:03:19,680 Or even worse, it'll only accept HTTPS URLs. 41 00:03:21,320 --> 00:03:26,360 But what we really want in order to exploit this stuff is a generic blind SSRF approach. 42 00:03:26,360 --> 00:03:37,420 In other words, we'd like to see in the server a URL, have it fire a payload at something internal like SMTP or Redis, and get a security compromise just from that payload, without needing to see the response. 43 00:03:38,740 --> 00:03:40,880 Here are some of the common approaches. 44 00:03:41,000 --> 00:03:47,760 The issue is these are extremely platform-specific, to the point where I've never had any luck with these. 45 00:03:47,880 --> 00:03:51,700 But there are some useful ideas in here, particularly in SNI injection. 46 00:03:51,780 --> 00:04:01,540 You wouldn't think that TLS would be particularly useful, because its packets are mostly just encrypted data, binary flags and other stuff an attacker doesn't have much control over, but it's not all that limited. 47 00:04:01,540 --> 00:04:06,660 As OrangeSci noticed, the SNI, which is basically just the domain name, is part of the URL. 48 00:04:06,660 --> 00:04:16,000 So if you can trick the victim into accepting a weird domain name and parsing it incorrectly, you can include stuff like arbitrary bytes in there and smuggle stuff like SMTP commands. 49 00:04:16,400 --> 00:04:19,860 This approach is dependent on a platform-specific URL parsing book. 50 00:04:20,020 --> 00:04:23,400 But what if we had something that was inherent to the TLS protocol? 51 00:04:23,600 --> 00:04:25,180 This is where my work starts. 52 00:04:25,220 --> 00:04:28,460 Let's look at a TLS packet and see what's in there for us to use. 53 00:04:29,420 --> 00:04:36,420 As is often helpful when looking at protocols, we can open up Wireshark to see what happens in a TLS connection. 54 00:04:36,700 --> 00:04:41,800 Here's the SNI, or server name indication, that was previously explored in Orange's talk. 55 00:04:42,000 --> 00:04:46,540 His work involved putting new lines and SMTP commands into the section pointed to by the arrow here. 56 00:04:46,720 --> 00:04:51,980 If you poke around, you'll see stuff like random strings, key shares, and other stuff that isn't useful for SSRF. 57 00:04:52,240 --> 00:04:52,780 Why? 58 00:04:52,780 --> 00:05:01,120 Because the only part of this we can typically feed a server is a URL, and the only part of the URL that will make it into the client-hello packet is the domain name that we provide the victim machine. 59 00:05:03,120 --> 00:05:07,160 But there's a different way that we as an attacker can get payloads into client-hello messages. 60 00:05:07,180 --> 00:05:10,480 It involves a couple of steps and is the main focus of this talk. 61 00:05:10,740 --> 00:05:15,660 First, we send over a link to our own server, in this case jmatrix.com. 62 00:05:16,040 --> 00:05:21,100 Then jmatrix.com responds with a valid server hello, but it contains our payload. 63 00:05:22,620 --> 00:05:30,240 Now, it would be ideal if we as an attacker could get that payload that jmatrix.com sent the victim, and then get the victim to send it somewhere internal. 64 00:05:30,360 --> 00:05:31,820 But that raises a question. 65 00:05:31,860 --> 00:05:34,680 Is there such a field that we can use to deliver these payloads? 66 00:05:35,480 --> 00:05:41,380 It might seem too good to be true, but TLS actually provides exactly that in the form of a session ID. 67 00:05:41,600 --> 00:05:44,160 Most clients even persist this field for later use. 68 00:05:44,500 --> 00:05:51,600 Session IDs are limited to 32 bytes, as you can see here, but depending on the implementation, you might have session tickets. 69 00:05:51,780 --> 00:05:56,460 This one is about 200 bytes, but these can be up to around 65 kilobytes. 70 00:05:57,100 --> 00:06:03,560 Both session IDs and session tickets are mechanisms for a TLS client to go, hey, remember that cryptographic key exchange we did earlier? 71 00:06:03,560 --> 00:06:05,940 Let's just keep using that key in this new connection. 72 00:06:06,260 --> 00:06:13,680 TLS 1.3 includes a slightly more complicated but similar mechanism called a pre-shared key identity, which pretty much does the same thing for our purposes. 73 00:06:13,680 --> 00:06:17,700 All of these are about optimization, since key exchanges can be time-consuming. 74 00:06:18,000 --> 00:06:29,300 But they provide a way for a server to tell whatever is connecting to it to persist some data for later use, almost like a cookie that lives in plain text. 75 00:06:29,300 --> 00:06:31,820 So it's perfect for the SSRF attack we're trying to do. 76 00:06:33,060 --> 00:06:35,020 Now, you might anticipate a problem here. 77 00:06:35,500 --> 00:06:41,620 Obviously, if you go to google.com and then to apple.com, those TLS sessions are going to have distinct data from each other. 78 00:06:41,620 --> 00:06:44,580 The same applies between google.com and localhost. 79 00:06:44,640 --> 00:06:50,940 So we have a bit of a problem getting the target server to reuse the session when communicating with something internal. 80 00:06:52,140 --> 00:06:58,680 But when I looked at both the TLS spec and popular session cache implementations, I saw this wasn't quite the case. 81 00:06:58,680 --> 00:07:02,900 I first went to the curl source code, since libcurl is used by a lot of PHP stuff. 82 00:07:03,160 --> 00:07:09,260 Sessions are keyed by the four properties here, which belong to this struct. 83 00:07:09,260 --> 00:07:11,740 As you can see, none of these are the IP address. 84 00:07:12,140 --> 00:07:17,520 This means that no matter what IP address jmatrix.com resolves to, curl will attempt to reuse the session. 85 00:07:17,720 --> 00:07:21,040 This happens to be how just about everything else caches TLS sessions. 86 00:07:21,260 --> 00:07:29,740 So if you establish a TLS session with jmatrix.com, whether it resolves to something on the internet or your own machine, your HTTPS client will not know the difference. 87 00:07:29,880 --> 00:07:36,240 Since I, as an attacker, own jmatrix.com, I can combine all of this TLS stuff with a concept called DNS rebinding. 88 00:07:37,580 --> 00:07:43,440 So I resolve the first request to 35.x.x.x, some server I control. 89 00:07:44,840 --> 00:07:50,340 Then the target server picks up the payload from 35.x.x.x in the form of a session ticket. 90 00:07:52,080 --> 00:07:56,660 After some time, I send the exact same URL, except the DNS entry has expired. 91 00:07:56,740 --> 00:08:04,160 Again, since I control the DNS server, this time around I resolve jmatrix.com to something internal that I wouldn't normally have access to from the outside. 92 00:08:04,160 --> 00:08:06,620 To simplify things, I'll just use localhost. 93 00:08:07,800 --> 00:08:12,560 Once the DNS query finishes, the target server then makes an internal request with that payload. 94 00:08:14,540 --> 00:08:25,220 So, like what I did in the opening demo, you can manipulate whatever you're attacking to send a TLS session ID, ticket, or PSK identity like this to itself. 95 00:08:25,340 --> 00:08:28,400 Here I'm showing a PSK identity that does a memcache insert. 96 00:08:29,880 --> 00:08:33,140 And here's that same TCP stream, but just displayed raw. 97 00:08:33,140 --> 00:08:38,300 This view shows the really important property of my approach to combining TLS with DNS rebinding. 98 00:08:38,300 --> 00:08:42,200 You can get arbitrary characters to be sent, which includes new lines. 99 00:08:42,260 --> 00:08:48,980 This is what allows you to interact with a bunch of local services like memcached, just like people did in the past with Gopher URLs. 100 00:08:50,300 --> 00:08:54,300 And here's an exchange more typical of what you'd use to do real damage. 101 00:08:54,320 --> 00:09:00,380 This is a value that in most Python memcached libraries will execute a shell command immediately once it's retrieved from a cache. 102 00:09:00,380 --> 00:09:08,280 This is because it's quite common in Python and other languages to use built-in serialization methods like pickle to convert values to something that can be stored. 103 00:09:08,520 --> 00:09:12,600 Unfortunately, built-in serialization methods are also common RCE targets. 104 00:09:12,620 --> 00:09:14,340 We'll get to exploitation later. 105 00:09:15,220 --> 00:09:19,120 But since this is pretty common, I ended up testing a fair amount of slides. 106 00:09:19,120 --> 00:09:26,920 I'll get to some specific ones in a second, but first I'll go over some testing infrastructure I set up, along with some tips for actually performing these kinds of exploits. 107 00:09:27,980 --> 00:09:30,240 So here are all the VMs I have on the internet. 108 00:09:30,280 --> 00:09:35,640 Say for maybe some IP whitelisting, they need to be on the open internet so that the target boxes can reach them. 109 00:09:35,840 --> 00:09:45,180 I've got a nameserver record pointing ssltest.jmatrix.com queries to the DNS server on the top left, which is just a Python script running on port 53. 110 00:09:45,180 --> 00:09:50,080 It alternates between answering with the IP of the custom TLS server and localhost. 111 00:09:50,680 --> 00:09:55,980 Then over there on the right, I have my custom TLS server, which is there to deliver my payloads via session tickets. 112 00:09:55,980 --> 00:09:59,120 I configure those by just updating values in Redis. 113 00:09:59,380 --> 00:10:07,740 But when testing it, it proved to be difficult to just go straight to localhost, because depending on what library is making the requests, I didn't know if SSL sessions were being cached. 114 00:10:09,180 --> 00:10:14,760 To address this, I sometimes just ended up adding another box to see if the payload was being persisted. 115 00:10:14,820 --> 00:10:20,880 If you're not familiar, Netcat can be set up to just listen for TCP connections and log the results. 116 00:10:20,880 --> 00:10:24,840 If I saw my payload making it into the logs, I knew the general approach could work. 117 00:10:25,120 --> 00:10:30,580 And then go back to the setup from the previous slide to get the server to start delivering the payload to itself on different ports. 118 00:10:31,940 --> 00:10:34,020 And here are the links to all that I actually used. 119 00:10:34,220 --> 00:10:40,380 A big chunk of the work was saved by just messing around with a pure Rust implementation of TLS, which is linked to here. 120 00:10:40,560 --> 00:10:42,960 A big thanks goes out to everyone mentioned in this slide. 121 00:10:43,040 --> 00:10:47,120 I wouldn't have had the time to do any of this work if not for the code they had put out there. 122 00:10:48,980 --> 00:10:55,460 But I know with everything I just claimed, I need to back things up by showing what actual real-world attacks can happen with this. 123 00:10:55,880 --> 00:10:59,800 I'll start off conceptually and then get to some examples along with another demo. 124 00:11:01,560 --> 00:11:03,120 But here's the mullot I've got. 125 00:11:03,400 --> 00:11:06,500 If you're in the middle of this diagram, you're generally vulnerable. 126 00:11:07,520 --> 00:11:13,780 This top part refers to when you can send something a URL and it will fetch that URL, but you don't know of a way to exploit that behavior. 127 00:11:13,780 --> 00:11:19,840 It's interesting because you would hope by now people would try to eliminate anything even remotely looking like SSRF. 128 00:11:19,880 --> 00:11:23,040 But this pattern is in fact required by a few popular specs. 129 00:11:23,260 --> 00:11:29,060 This is even common enough that I've seen bug bounties mention SSRF with no proven security impact as an excluded category. 130 00:11:29,300 --> 00:11:30,960 But that's what this talk is about. 131 00:11:30,960 --> 00:11:35,840 Adding the security impact when you have just something that is just almost SSRF. 132 00:11:37,040 --> 00:11:39,520 This one on the left sounds weird, but it's getting bigger. 133 00:11:39,520 --> 00:11:46,140 It's just a matter of if whatever the SSRF is going through to make requests has implemented this feature according to the latest spec. 134 00:11:48,080 --> 00:11:55,340 Unfortunately, there are quite a few HTTPS client libraries out there that support full-blown TLS session caching. 135 00:11:55,520 --> 00:11:58,020 Here are a few that you may be wondering about. 136 00:11:58,060 --> 00:12:02,340 I reported this as a vulnerability to some of these, but not all of the entries with yes. 137 00:12:02,520 --> 00:12:04,120 And I haven't seen much traction. 138 00:12:04,480 --> 00:12:10,180 Understandably, since fixing this requires diverging from the TLS spec, not a whole lot of people are eager to do so. 139 00:12:12,060 --> 00:12:15,500 The thing you run into the most trouble with is this last circle. 140 00:12:15,500 --> 00:12:19,600 Because you have to first do some recon to see what ports might be internally exposed on the server. 141 00:12:19,900 --> 00:12:25,920 And then you need to see if what's on those ports is permissive enough to keep the connection open past the opening bytes of the TLS client hello. 142 00:12:27,420 --> 00:12:29,960 Here are some examples of what you might be looking for there. 143 00:12:29,960 --> 00:12:33,020 It's far from complete, but here are the most notable entries. 144 00:12:34,660 --> 00:12:41,240 So now we'll go through a couple of exploitable examples of these TLS session-based SSRF vulnerabilities that I reported and got fixed. 145 00:12:42,580 --> 00:12:44,120 Here's one from uTrack. 146 00:12:44,120 --> 00:12:51,060 It's rated low because all I did was hit local SMTP, and I didn't try poking around to see if I could exploit the SMTP server further. 147 00:12:51,300 --> 00:12:56,680 It originated from uTrack's import feature, which normally wouldn't be easy to exploit, being blind SSRF. 148 00:12:57,780 --> 00:13:02,940 But with my rebinding code, here's a section from the TLS packet I got uTrack to send itself. 149 00:13:03,420 --> 00:13:10,740 This works because SMTP is a newline-delimited protocol, so just like memcache, you can embed working commands within a TLS ticket. 150 00:13:12,920 --> 00:13:14,880 And here's what came of that packet. 151 00:13:14,940 --> 00:13:21,500 This alone wasn't super severe because it's not signed quite right, and I didn't dig too deeply because I wanted to just report it ASAP. 152 00:13:21,500 --> 00:13:28,320 But it did get initiated by a TCP stream I got uTrack to send itself, so it's still pretty bad. 153 00:13:29,700 --> 00:13:31,640 Here's the one I reported in Nextcloud. 154 00:13:32,080 --> 00:13:34,220 The idea behind Nextcloud is a cool one. 155 00:13:34,220 --> 00:13:39,880 You set up a server and host files, and can even share them with other people's servers using a share URL like this. 156 00:13:41,100 --> 00:13:44,220 But as it turns out, you can include port numbers in the share URL. 157 00:13:44,220 --> 00:13:52,380 Now, since Nextcloud automatically puts HTTPS in there, normally there wouldn't be much SSRF potential, and it would have to be blind SSRF. 158 00:13:53,460 --> 00:13:56,080 But luckily I was able to do just that. 159 00:13:56,080 --> 00:14:02,140 So as a non-admin user, I could use my TLS for binding attack infrastructure to perform arbitrary writes on memcached. 160 00:14:04,360 --> 00:14:07,920 After reporting this and working through the options, there weren't any great ones. 161 00:14:07,920 --> 00:14:11,780 Because not all request libraries allow you to disable TLS sessions. 162 00:14:11,780 --> 00:14:16,720 In this case, libcurl has the option, but it isn't exposed by PHP request libraries such as Guzzle. 163 00:14:17,180 --> 00:14:25,360 In any case, adding a request timeout made the attack pretty much infeasible, assuming that people don't turn the DNS time to live values super low on their servers. 164 00:14:25,740 --> 00:14:29,960 Nextcloud was still generous enough to give me a bounty, even though in my opinion this is libcurl's fault. 165 00:14:32,000 --> 00:14:38,060 Since the last couple were just text slides, let's see a real demo now, from the perspective of a Django web developer getting phished. 166 00:14:38,060 --> 00:14:45,280 The DNS for binding part has been done in the past, but what's new here is combining DNS for binding with TLS session persistence to make it more powerful. 167 00:14:45,500 --> 00:14:50,440 In the past, you had to get people to visit a fully malicious page to get anywhere with DNS for binding. 168 00:14:50,640 --> 00:14:53,260 But with my work, you can do the same with just an image tag. 169 00:14:53,380 --> 00:14:58,120 Because of that, you can phish people into RCE, even if they just view an email, but don't click any links. 170 00:14:58,140 --> 00:14:59,240 Let's see that now. 171 00:15:00,860 --> 00:15:02,820 And now for the actual demo. 172 00:15:04,920 --> 00:15:09,580 So as you can see, we're pretending I'm a Django application developer running a typical app. 173 00:15:09,760 --> 00:15:11,700 If we look at the app, it's pretty simple. 174 00:15:11,700 --> 00:15:16,500 We can view a sloth emoji, but if we refresh too fast, the sloth needs to go to sleep. 175 00:15:16,940 --> 00:15:19,040 And now for what happens when I get phished. 176 00:15:19,300 --> 00:15:25,160 As you can see, I have received some perfectly legitimate emails, and I'm viewing them. 177 00:15:25,160 --> 00:15:33,080 Normally, these image tags should be benign, but after viewing them, my sloth now opens a calculator via shell command. 178 00:15:33,620 --> 00:15:39,580 That's because those image tags pointed to the domain with my binding setup, and a simple Python pickle payload. 179 00:15:44,110 --> 00:15:47,870 So here's most of the source code of the example app I created. 180 00:15:47,950 --> 00:15:59,950 You can pretty easily find apps that call django.core.cache or on GitHub, but I didn't want to demo against a specific one, because that seems a little mean, and I wouldn't want people launching actual phishing campaigns against such projects. 181 00:16:00,050 --> 00:16:02,030 It's a little tough to assign blame here. 182 00:16:02,190 --> 00:16:08,470 Nothing is really breaking from established safe practices, but it's clear that there's a potential to compromise real-world developer laptops. 183 00:16:09,930 --> 00:16:13,790 On that note, there's a lot more to do that I couldn't possibly do on my own. 184 00:16:14,330 --> 00:16:19,710 These slides will be available online if you want to return to this, and if you do anything interesting, I'd love to hear about it. 185 00:16:19,970 --> 00:16:23,110 There are certainly a lot more potential vulnerabilities to explore. 186 00:16:23,910 --> 00:16:27,550 So all of that is bad, but what can be done about it? 187 00:16:27,570 --> 00:16:30,790 Let's start from the root of the problem, TLS clients. 188 00:16:32,550 --> 00:16:35,450 Here's something I recommended to the Chromium team a while back. 189 00:16:35,650 --> 00:16:42,110 We still aren't in agreement about whether or not this should be fixed, and my report was pretty hastily written, which probably didn't help things. 190 00:16:42,210 --> 00:16:46,350 Essentially, I'd like to remove the ability for sessions to be resumed between servers. 191 00:16:47,350 --> 00:16:54,570 But while the Chromium team has marked this as a won't-fix, they did suggest an alternative that maintains support for resuming sessions across servers. 192 00:16:54,690 --> 00:16:59,190 They probably care about that more than I do, but we can at least have the best of both worlds. 193 00:16:59,390 --> 00:17:05,210 This last option of just partitioning based upon whether the address is something local is a pretty good compromise. 194 00:17:05,430 --> 00:17:09,890 It wouldn't affect performance, but would protect against most of the attack scenarios I can think of. 195 00:17:10,230 --> 00:17:18,590 But based on my experiences so far, I'm not hopeful that there's going to be much proactive effort on the part of software packages that make HTTPS requests. 196 00:17:18,590 --> 00:17:24,630 For most of the audience, it's more useful to know what's susceptible, and what layers of defense can be applied. 197 00:17:25,270 --> 00:17:30,270 However, with all of this worth taking a step back to consider, is TLS session resumption even worth it? 198 00:17:31,710 --> 00:17:35,510 There are other issues with it, a couple of which are shown here. 199 00:17:35,690 --> 00:17:44,010 I'm not going to make the case that the industry as a whole should give up on this optimization, but we should take a step back and see if this is a worthwhile trade-off. 200 00:17:44,050 --> 00:17:47,670 We may, just like in the previous slide, find that the costs can be eliminated. 201 00:17:47,670 --> 00:17:51,850 But if we find we can't tackle these problems, we need to weigh them against the benefits. 202 00:17:52,930 --> 00:17:54,570 And here's the main benefit. 203 00:17:54,570 --> 00:17:59,850 You get a sizable performance improvement on the small subset of packets that are TLS handshakes. 204 00:17:59,870 --> 00:18:03,150 You probably care about this whenever you're in the position of serving up TLS. 205 00:18:03,430 --> 00:18:09,250 Whatever percentage of CPU usage is due to TLS handshakes, you probably want to keep that low to minimize costs. 206 00:18:11,050 --> 00:18:13,090 But if you're like me, you don't care. 207 00:18:13,290 --> 00:18:19,970 I'm taking on all the security and privacy risk of session resumption, but the amount that it saves on my power bill is pretty minimal. 208 00:18:20,150 --> 00:18:28,250 Additionally, if you're running a web application, you might care about session resumption on incoming connections, but when you're making external requests, it's probably not in your interests. 209 00:18:28,450 --> 00:18:33,370 You're placing a lot of trust on random websites not to redirect you and on your local services. 210 00:18:33,570 --> 00:18:35,470 So how might you turn it off? 211 00:18:36,890 --> 00:18:38,210 Here's what I found. 212 00:18:38,210 --> 00:18:46,470 It's kind of sad when stuff forces you into this, but at least as an internet user, you can pick Firefox and disable session identifiers if you're paranoid about this stuff. 213 00:18:46,470 --> 00:18:49,230 If you're running a web application, you're a bit stuck, though. 214 00:18:49,310 --> 00:18:50,350 So what should you do? 215 00:18:51,530 --> 00:18:58,790 First off, it's a good idea in general to run your outbound requests through a proxy, especially if you're supporting webhooks or some other SSRF-prone feature. 216 00:18:58,870 --> 00:19:01,930 But also reconsider your infrastructure decisions. 217 00:19:02,050 --> 00:19:09,890 You'd be surprised to know just how much stuff is still set up in a way that is just one locally initiated TCP stream away from compromise. 218 00:19:11,190 --> 00:19:12,870 But here are the general takeaways. 219 00:19:12,870 --> 00:19:19,690 The thing I'd like to highlight is if you're just starting out in the offensive side of security, I'd encourage you to look at the random standards and browser features that come out. 220 00:19:19,750 --> 00:19:25,190 Even if you don't fully understand them at first, find something that seems interesting and start hacking around in Wireshark. 221 00:19:25,190 --> 00:19:32,690 I know I didn't understand TLS at first, and I still don't really understand it very much after all of this. 222 00:19:32,690 --> 00:19:37,510 But as an attacker, you really only need to understand the worst parts, and that's what this is all about. 223 00:19:39,270 --> 00:19:40,230 And thank you. 224 00:19:40,230 --> 00:19:42,810 Here's my Twitter and a link to Latakora, where I work. 225 00:19:42,810 --> 00:19:47,170 They're a great place to work and have been amazingly supportive of random research directions I take. 226 00:19:47,330 --> 00:19:48,390 Definitely take a look.