1 00:00:00,000 --> 00:00:05,360 And I guess with no further ado, Adam Crosser is going to talk about covert channels and web conferencing. 2 00:00:05,360 --> 00:00:06,480 So let's hear it for Adam. 3 00:00:09,000 --> 00:00:10,040 All right. 4 00:00:10,460 --> 00:00:11,780 Happy to be here today, everyone. 5 00:00:11,780 --> 00:00:13,940 Thank you for coming to my presentation. 6 00:00:14,360 --> 00:00:18,220 This is Ghost Calls Abusing Web Conferencing for Covert Command and Control. 7 00:00:19,380 --> 00:00:22,760 To start off with just a brief introduction, I'm Adam Crosser. 8 00:00:22,760 --> 00:00:25,060 I'm a staff security engineer at Praetorian. 9 00:00:25,160 --> 00:00:33,380 I do a lot of different things from vulnerability research to helping to build offensive security tooling that we can use on things like red team engagements. 10 00:00:35,680 --> 00:00:44,880 And to start things off, I just want to create a bit of a common terminology that we can use on the different types of command and control channels and how I typically think about them. 11 00:00:45,800 --> 00:00:51,240 And so the first type is basically what I would refer to as like a short term command and control channel. 12 00:00:51,240 --> 00:00:56,360 So this would be maybe you're doing SOX proxying, tunneling different tools through the end point. 13 00:00:56,400 --> 00:01:00,360 Maybe remote port forwarding for like NTM relaying on the internal network or stuff like that. 14 00:01:00,360 --> 00:01:01,520 Data exfiltration. 15 00:01:01,520 --> 00:01:07,040 Shorter duration, maybe a couple of hours that you're using for things like, for those types of things. 16 00:01:07,040 --> 00:01:11,180 Generally I would describe it as low latency, high throughput communication. 17 00:01:11,720 --> 00:01:14,340 The second type is what I consider like a long term C2. 18 00:01:14,340 --> 00:01:19,820 So that would be whatever is going to kick off again whenever your system reboots and you log back in. 19 00:01:19,920 --> 00:01:21,400 That's going to be your long term C2. 20 00:01:21,400 --> 00:01:24,560 A lot of people actually use the same short term and long term C2. 21 00:01:24,560 --> 00:01:29,760 There are some what I consider to be disadvantages of that that I'm going to talk about later on. 22 00:01:29,760 --> 00:01:32,280 And then the other type is backup C2. 23 00:01:32,280 --> 00:01:35,480 So you can get really creative here. 24 00:01:35,480 --> 00:01:38,220 Basically backup access vectors that you've put in place. 25 00:01:38,220 --> 00:01:43,980 So if there is some sort of incident response event, you have multiple TTPs that you're using, different backup systems. 26 00:01:43,980 --> 00:01:45,180 You can get really creative here. 27 00:01:45,180 --> 00:01:49,080 Like I found like credentials for like forklifts that weren't domain joined. 28 00:01:49,080 --> 00:01:52,120 It didn't have EDR on them that I set up backup C2 on. 29 00:01:52,120 --> 00:01:54,500 They take like a Windows tablet running on them. 30 00:01:54,820 --> 00:01:56,640 And you can get really creative there. 31 00:01:57,000 --> 00:01:59,640 And the final type is peer to peer communication. 32 00:01:59,640 --> 00:02:07,660 So imagine like you have one system you've compromised that's on like a PCI environment and it has a lot of internal connectivity to a PCI environment. 33 00:02:07,660 --> 00:02:10,440 But it doesn't have any sort of egress out to the internet. 34 00:02:10,540 --> 00:02:13,840 You can set up a channel with another system on the network. 35 00:02:13,840 --> 00:02:17,960 Maybe it's like an end point laptop that has more direct internet access. 36 00:02:17,960 --> 00:02:25,620 And then you can link those two together maybe like ICMP or SMB communicating with each other in order to kind of tunnel into that PCI environment. 37 00:02:26,520 --> 00:02:40,080 And so I wanted to just talk about the problem that we're trying to solve today which is we didn't feel like we had a good channel for that short term command and control channel that a couple of hours you might be using a SOX proxy or something to access an internal confluence page or stuff like that. 38 00:02:40,080 --> 00:02:43,360 We didn't really have a good channel that we really liked for this mechanism. 39 00:02:43,360 --> 00:02:50,100 And so I'm going to, we kind of made this model of what would the ideal attributes of this channel actually look like. 40 00:02:50,100 --> 00:02:52,080 And so we came up with four things. 41 00:02:52,080 --> 00:02:53,160 One of them is latency. 42 00:02:53,160 --> 00:02:58,700 So latency being, you know, if you send a message and when that message is received, how long does that take? 43 00:02:58,800 --> 00:03:00,620 But there's another thing here which is throughput. 44 00:03:00,880 --> 00:03:06,700 And one of the things that you might notice is that a lot of, there are a lot of channels that have low latency but then they have low throughput. 45 00:03:06,700 --> 00:03:08,000 You can't send much data through them. 46 00:03:08,000 --> 00:03:12,920 And there are a lot of other channels where they have very high throughput but they also have relatively high latency. 47 00:03:14,380 --> 00:03:15,960 The third one is reach of course. 48 00:03:15,960 --> 00:03:22,980 Like if you're using say IRC or Tor for a command and control channel, that's not going to be common on most large enterprise networks. 49 00:03:23,440 --> 00:03:24,620 And the fourth one would be trust. 50 00:03:24,620 --> 00:03:32,140 Ideally if you're going to be using something for C2, I would recommend using something where it's going to be trusted within the environment. 51 00:03:32,140 --> 00:03:34,720 So maybe allow listed, excluded from inspection. 52 00:03:34,720 --> 00:03:38,860 And so that would be what I would consider to be an ideal short term command and control channel. 53 00:03:40,220 --> 00:03:48,620 So we came up with some selection criteria here which were basically, we wanted to focus kind of first on services egressing from end user devices. 54 00:03:48,620 --> 00:03:52,380 So on these types of engagements, we don't always actually run code on end points. 55 00:03:52,380 --> 00:03:56,980 We might do things with CICD infrastructure in the cloud or with identity based attacks. 56 00:03:57,200 --> 00:04:04,300 But often when we are getting an initial foothold into many environments, we're actually egressing from end user devices and so that's kind of what we focused on here. 57 00:04:04,380 --> 00:04:08,420 We wanted to focus on services that would be widely used across most enterprise users. 58 00:04:08,420 --> 00:04:10,940 So not services that would only be used by developers. 59 00:04:11,020 --> 00:04:14,540 And we wanted to think through common workflows and services that might be used. 60 00:04:14,540 --> 00:04:18,160 And so using the selecting criteria, we came up with a few ideas. 61 00:04:18,360 --> 00:04:25,880 And I'm going to kind of run through and talk about how we can use this rubric to then think about different channels we could use for short term command and control. 62 00:04:26,460 --> 00:04:28,360 So one option is DNS over HTTP. 63 00:04:28,360 --> 00:04:30,220 I think the latency there would be quite low. 64 00:04:30,220 --> 00:04:32,260 But we had two concerns on the throughput side. 65 00:04:32,260 --> 00:04:35,880 One of them is we weren't sure that we would be able to send a large amount of data through it. 66 00:04:35,880 --> 00:04:41,640 And even if we did, if you're sending, you know, 10 gigs of data through like a Google DNS server or something, it's going to look kind of weird. 67 00:04:41,860 --> 00:04:47,180 From a reach perspective, a lot of large enterprises, they have their own internal DNS resolution infrastructure. 68 00:04:47,180 --> 00:04:51,540 So it's not uncommon for them to not be using DNS over HTTP. 69 00:04:51,540 --> 00:04:53,980 More common on consumer devices for sure. 70 00:04:54,240 --> 00:04:57,340 And from a trust perspective, we thought that would be good. 71 00:04:58,160 --> 00:05:00,800 Another option was kind of cloud file storage. 72 00:05:00,800 --> 00:05:02,420 This would solve the throughput issue. 73 00:05:02,420 --> 00:05:05,040 But generally you're going to be chunking large amounts of data. 74 00:05:05,040 --> 00:05:11,980 So it would introduce some more latency that wouldn't be acceptable for kind of realtime communication, RDP, web browsing, stuff like that. 75 00:05:13,040 --> 00:05:22,380 The trust wouldn't be ideal because a lot of companies, if they're not using a specific solution like Box or Dropbox, they actually might have it blocked internally for most of their users. 76 00:05:23,980 --> 00:05:29,160 Another classic one is just you register a domain, maybe age it for three years, get it classified as like finance. 77 00:05:29,460 --> 00:05:31,460 You could use like a WebSockets connection. 78 00:05:31,560 --> 00:05:34,500 That would be good from a low latency, high throughput perspective. 79 00:05:34,500 --> 00:05:36,260 You could get decent speeds there. 80 00:05:36,260 --> 00:05:39,860 But anything communicating with that would be compromised assets. 81 00:05:40,060 --> 00:05:43,500 And it wouldn't necessarily be trusted within most environments. 82 00:05:44,620 --> 00:05:47,500 So another idea was kind of e‑mail and messaging applications. 83 00:05:47,500 --> 00:05:51,520 And so depending on what you're using like e‑mail or Slack, there would be some more latency there. 84 00:05:51,520 --> 00:05:53,700 The throughput would be not ideal. 85 00:05:53,700 --> 00:05:56,020 But they would be widely used and trusted. 86 00:05:56,540 --> 00:06:03,740 And so then we kind of came to this one which is web conferencing solutions where when we applied our criteria, it kind of overlapped perfectly. 87 00:06:03,740 --> 00:06:07,740 We're looking for something that is used for realtime communication. 88 00:06:07,740 --> 00:06:17,600 And so these systems kind of from the ground up are designed for that because you're sending say multiple video streams to a channel that requires a decent amount of data even with modern video compression. 89 00:06:17,880 --> 00:06:22,800 And from a latency perspective, even a small amount of latency on a video call could make it unusable . 90 00:06:22,800 --> 00:06:30,100 And so every part of this infrastructure is kind of designed for realtime low latency communication which is what we needed in a channel. 91 00:06:30,100 --> 00:06:36,780 And it's going to be sending enough data that if we sent a decent amount of data through that channel, it wouldn't necessarily stick out relative to normal use cases. 92 00:06:36,780 --> 00:06:41,920 And especially after things like, you know, the pandemic, these solutions are widely used. 93 00:06:42,460 --> 00:06:48,900 You know, a lot of people are actually using all of them because they're kind of interfacing with different companies that use different products. 94 00:06:49,000 --> 00:06:51,220 And they're generally going to be trusted in a lot of environments. 95 00:06:51,220 --> 00:06:55,160 And so you can actually see this in a lot of the vendor recommendations. 96 00:06:55,520 --> 00:07:08,440 Microsoft recommends, for example, configuring split tunneling so you're not routing traffic to their infrastructure for teams through your VPN appliance because that would introduce an unacceptable amount of latency and throughput issues in many cases. 97 00:07:08,560 --> 00:07:12,260 They also recommend excluding their infrastructure from things like TLS inspection. 98 00:07:12,420 --> 00:07:21,200 And if you look at other vendors like Zoom, they make similar recommendations around split tunneling and disabling TLS inspection for domains like zoom.us. 99 00:07:22,540 --> 00:07:27,300 And so just a quick disclaimer, you know, this isn't like a mistake that these providers are making or anything. 100 00:07:27,300 --> 00:07:32,080 It's just when you have these types of systems, they need to be designed in a way to facilitate realtime communication. 101 00:07:32,080 --> 00:07:37,000 Any system that does additional inspection or rerouting of traffic is going to introduce latency. 102 00:07:37,000 --> 00:07:39,080 But from an attacker perspective, it's also useful. 103 00:07:39,080 --> 00:07:43,140 And so it's more of a, this is just how these solutions work and how they need to work to function. 104 00:07:43,140 --> 00:07:50,980 It's not an issue that the vendor is making bad recommendations or anything like someone recommending their service account via DA when it doesn't need it or anything like that. 105 00:07:51,100 --> 00:07:53,840 It's just how these systems need to work. 106 00:07:54,000 --> 00:08:05,160 And so now that we figured out what we wanted to actually look at, the kind of obvious next step is we need to figure out how they work and what are potential entry points that we could use for routing traffic through this infrastructure. 107 00:08:05,320 --> 00:08:17,240 And from a lot of research that I've done, I think you could say that a lot of these solutions use a very similar architecture, similar protocols, similar design in how they actually function overall across multiple solutions. 108 00:08:18,120 --> 00:08:28,240 And so of course the first part is just, you know, you have an end user device that's using the service and they're maybe talking to like a main SaaS application and that application lets you do things like create or join meetings. 109 00:08:28,480 --> 00:08:32,640 And when you join a meeting, there's different information that gets looked up or you create a meeting. 110 00:08:33,080 --> 00:08:36,400 Each meeting has a media server allocated to it usually. 111 00:08:36,880 --> 00:08:44,400 So if you're creating a meeting , it's going to find a media server and allocate that server to that meeting and then everyone will send audio and video traffic to that server. 112 00:08:44,900 --> 00:08:49,600 There's another operating mode that many of these solutions support, which is peer to peer communication . 113 00:08:49,600 --> 00:08:53,900 So you can either have a direct centralized server or you can use peer to peer communication between endpoints . 114 00:08:53,900 --> 00:08:57,280 And in some cases it can be faster to use peer to peer communication . 115 00:08:57,280 --> 00:08:58,400 In some cases it won't be. 116 00:08:58,400 --> 00:09:00,500 And I'll talk about that a little bit later on. 117 00:09:00,960 --> 00:09:04,580 And there's a third piece of infrastructure that's often used, which is turn infrastructure. 118 00:09:04,640 --> 00:09:07,000 And it's basically, it acts as a relay. 119 00:09:07,000 --> 00:09:15,400 So imagine you want to establish a peer to peer connection but you're not able to establish that connection using stun with things like net hole punching for direct peer to peer communication. 120 00:09:15,480 --> 00:09:23,140 You can use the turn infrastructure as a way to communicate between two devices that want to make a peer to peer communication connection. 121 00:09:23,140 --> 00:09:29,640 Or as we'll see later, it can also be used when a device is running into egress issues and it's not able to egress out through normal channels. 122 00:09:29,640 --> 00:09:38,160 It can try to use the turn infrastructure to communicate with the media server to do more of a centralized, sending that video stream to a centralized server. 123 00:09:39,680 --> 00:09:45,360 And as I mentioned before, there's a lot of very common protocols that are used with web conferencing. 124 00:09:45,360 --> 00:09:46,640 And one of this is WebRTC. 125 00:09:46,740 --> 00:09:49,300 And I've got some stuff in the resources section. 126 00:09:49,300 --> 00:09:52,040 There's some like 60‑minute talks that just talk about WebRTC. 127 00:09:52,040 --> 00:09:54,460 So I don't have a whole lot of time to talk about it today. 128 00:09:54,460 --> 00:10:04,780 But you will see across many solutions they're using different protocols like WebRTC or SRTP, even if they're using custom protocols, they're often using a lot of the same building blocks under the hood. 129 00:10:06,160 --> 00:10:18,640 But the one thing I want to kind of emphasize today and that you'll need to understand for this talk is the concept of like a WebRTC handshake where basically in this example we have two users, Alice and Bob, and they need to communicate with each other over a WebRTC channel. 130 00:10:19,020 --> 00:10:22,580 Alice, for example, will generate something called an offer that gets sent to Bob. 131 00:10:22,640 --> 00:10:25,260 It can be done through, say, a third party signaling server. 132 00:10:25,260 --> 00:10:30,260 Bob would then take that offer value, generate an answer from that and send it back to Alice. 133 00:10:30,260 --> 00:10:33,760 And again, I don't have time today to really deep dive into all of that functions. 134 00:10:33,760 --> 00:10:39,500 But just understanding that that handshake process exists is an important part of understanding what we're doing today. 135 00:10:40,640 --> 00:10:44,560 And so we started this by doing some reverse engineering of different products like Zoom. 136 00:10:44,560 --> 00:10:47,800 And I'll talk about why we picked the products that we focused on a little bit later. 137 00:10:48,100 --> 00:10:55,160 But we used basically a custom wire shark analyzer and were able to look at the traffic generated from the desktop client in this scenario. 138 00:10:55,160 --> 00:10:59,380 And so we see that it's egressing to Zoom infrastructure on 80 to 1 UDP. 139 00:10:59,760 --> 00:11:04,180 And basically it's using a custom header with some different values in it. 140 00:11:04,240 --> 00:11:07,460 And it's kind of a wrapper around the RTP protocol. 141 00:11:07,540 --> 00:11:16,620 And so for this research , we did find an existing wire shark analyzer from some researchers at Princeton where they reverse engineered the Zoom desktop client and actually published that analyzer. 142 00:11:16,620 --> 00:11:21,420 So if you're interested more in their research , I definitely recommend checking out these two resources . 143 00:11:22,700 --> 00:11:29,820 And so like if you look at something like Google Meet, for example, you see it's also say using UDP traffic outbound on 3478 UDP. 144 00:11:30,300 --> 00:11:40,740 And it's also using RTP protocol, but it's using stock WebRTC where it's using DTLS for key exchange and SRTP protocol for the audio and video streams. 145 00:11:41,820 --> 00:11:48,080 And so the other point I wanted to highlight, which is basically that these solutions are very resilient and are able to egress in many different types of environments. 146 00:11:48,080 --> 00:12:01,220 So even if they're running or being used in an environment where it has very strict egress controls or is blocking a lot of different connections out to different services, they can still function in a pretty diverse set of environments. 147 00:12:01,220 --> 00:12:07,980 And so when I was doing my research, I would basically spin up different environments with different egress controls and then see how different products would behave. 148 00:12:07,980 --> 00:12:22,700 And so I'm going to run through a quick example today with just the Zoom desktop and web client just showing how if I have an environment where the only way to egress outbound is through a web proxy that does mandatory TLS inspection and only allows HTTP outbound and all other connections outbound or blocked, 149 00:12:22,700 --> 00:12:26,520 it's still able to adapt and function properly and actually get you on the call. 150 00:12:27,540 --> 00:12:37,020 And so to start off with the desktop version, it will start by basically trying to make a connection to something called a zone controller on 443UDP using a custom protocol over TLS. 151 00:12:37,080 --> 00:12:38,240 And that would fail. 152 00:12:38,860 --> 00:12:51,900 And so then it's going to switch over and try a web socket connection connecting through the web proxy over HTTPS on 443TCP and it's going to send that custom protocol over the web socket's channel to be able to egress through the proxy and so that would work. 153 00:12:52,960 --> 00:12:58,760 And then it's going to basically try to make connections to the media server where it's going to send audio and video data. 154 00:12:58,820 --> 00:13:07,340 It's going to try to make a connection over 443TCP and 801UDP and these would then fail again because of the configuration in our environment. 155 00:13:07,640 --> 00:13:15,420 And so then it's going to actually make a web socket connection again and send that same data through a, the web socket connection as well. 156 00:13:16,820 --> 00:13:19,880 And then on the web client side, it does something similar. 157 00:13:19,880 --> 00:13:26,820 It talks to something called a real time web gateway over a web socket connection and it gets a lot of the same information it gets from the zone controller. 158 00:13:27,120 --> 00:13:32,280 And it makes a web RTC connection outbound over 801UDP to the media server. 159 00:13:32,680 --> 00:13:35,580 But that's going to fail due to the egress controls within our environment. 160 00:13:35,580 --> 00:13:39,040 So then it's going to try to then use the turn infrastructure I mentioned before. 161 00:13:39,040 --> 00:13:49,600 It's going to try to use something called turns or turn over TLS where basically it will make a connection over 443TCP over TLS running the turn protocol under that. 162 00:13:49,600 --> 00:13:55,600 And it will use the turn server as basically a proxy to communicate with the media server infrastructure. 163 00:13:56,180 --> 00:13:59,040 But then again, this would fail because of the egress controls. 164 00:13:59,040 --> 00:14:11,360 I will say, these types of controls it's very rare to see on endpoints where you actually need to explicitly be configured to use a proxy to egress unless it's like, I've only seen it in financial institutions on some of their very sensitive VDI infrastructure. 165 00:14:12,420 --> 00:14:16,180 So then it's going to then fall back and make a web socket connection to the realtime web gateway. 166 00:14:16,180 --> 00:14:21,400 Actually makes multiple to then talk to the media server kind of using the realtime web gateway as a proxy . 167 00:14:21,400 --> 00:14:30,940 And so these solutions are basically able to operate in a wide variety of different environments when different controls are in place that can prevent different components of the service from functioning properly. 168 00:14:32,320 --> 00:14:34,140 And this is also highly adaptable . 169 00:14:34,140 --> 00:14:46,180 I did notice as you go down that chain of degrading the connection, the speed generally tends to go down like in my lab environment, if I was forcing it to use that web socket channel, it would not always send the video stream. 170 00:14:46,180 --> 00:14:47,300 It would get a little bit backlogged. 171 00:14:47,300 --> 00:14:49,640 It would just send audio only. 172 00:14:49,680 --> 00:14:56,300 It can do stuff like adapting, different products can do things like adapting the actual video quality or they can prioritize certain video streams. 173 00:14:56,300 --> 00:15:02,300 Like if someone's screen sharing, they might prioritize that over, you know, other video streams on the call that they could subscribe to. 174 00:15:02,840 --> 00:15:12,320 And so overall, I would say that these are some of the most resilient solutions in many environments in terms of being able to successfully egress and adapt to different scenarios that they might be running with them. 175 00:15:13,720 --> 00:15:17,500 So now the next step, of course, is we have a bit of an understanding of how they function. 176 00:15:17,500 --> 00:15:21,900 Let's work on designing a capability and defining what we wanted to actually do. 177 00:15:23,040 --> 00:15:26,620 And so we started just by looking at, you know, vendor market share. 178 00:15:26,740 --> 00:15:30,580 And we actually did this earlier in the research project. 179 00:15:30,580 --> 00:15:35,320 And so you probably noticed that I'm talking about two companies in particular, Zoom and Microsoft Teams. 180 00:15:35,320 --> 00:15:40,260 And this is just because they, if you look at, the data is different depending on the source that you look at. 181 00:15:40,260 --> 00:15:43,900 But it's basically, these two are basically always atop no matter what the percentages are. 182 00:15:44,340 --> 00:15:57,960 And so we decided to focus on these products because even if you're say using Google Meet or go to a meeting internally, it's likely that you have a large number of people that are using Microsoft Teams and Zoom to communicate with external parties that are actually using those products within their organizations. 183 00:15:59,660 --> 00:16:01,380 So we started by reverse engineering Zoom. 184 00:16:01,380 --> 00:16:03,440 We looked at both the desktop and the web client. 185 00:16:03,560 --> 00:16:09,800 We like looking at the web client a bit more because it's easier than reverse engineering like C++ code. 186 00:16:10,020 --> 00:16:17,500 And we found there's basically turn server credentials that get returned through that web socket connection with the real time web gateway that you can use. 187 00:16:17,500 --> 00:16:27,020 And so this isn't a vulnerability, it's just these credentials are provided to the client so it can use them to try to egress outbound in scenarios where it's not able to egress outbound say on UDP. 188 00:16:27,400 --> 00:16:35,600 And so we thought this was an interesting and potentially interesting vector for tunneling traffic because they recommend disabling TLS inspection on Zoom.us subdomains. 189 00:16:35,600 --> 00:16:46,540 And when we looked at actually where this infrastructure is hosted and we looked at the documentation, it was also within IP ranges that they recommend allow listing within your infrastructure for running Zoom itself. 190 00:16:46,540 --> 00:16:58,740 And so it met that requirement if we want to route traffic through trusted infrastructure that won't be subject to the normal amount of inspection or kind of other controls that might be in place within the infrastructure. 191 00:16:59,880 --> 00:17:02,600 And so when we looked at Microsoft Teams, we found something similar. 192 00:17:02,600 --> 00:17:08,920 Instead of sending that over a web socket connection, they actually just have an authenticated endpoint you can hit to get turn credentials. 193 00:17:08,920 --> 00:17:10,680 And so again, it's not a vulnerability. 194 00:17:10,680 --> 00:17:12,600 It's just how these solutions actually function. 195 00:17:12,600 --> 00:17:17,440 And so we had made a few observations around how these credentials actually function . 196 00:17:17,480 --> 00:17:21,220 One of them is that they're usually valid for a couple of days. 197 00:17:21,240 --> 00:17:25,800 And so the idea was we wanted to build something that would complement an existing long-term channel. 198 00:17:25,800 --> 00:17:27,820 So maybe you're using like Nighthawk or Cobalt Strike. 199 00:17:27,880 --> 00:17:37,360 You have an existing long-term channel in place, but that long -term channel has limitations on it either on the amount of data you can send or if you send a lot of data through that channel, it would look very weird. 200 00:17:37,360 --> 00:17:39,600 Some channels are very, very good covert channels. 201 00:17:39,600 --> 00:17:45,440 But once you start trying to send five gigs of like web browsing traffic through them, it starts to like look very weird at the network level. 202 00:17:45,920 --> 00:17:48,780 And so these observations applied to both Zoom and Microsoft Teams. 203 00:17:48,880 --> 00:17:52,140 And once we obtain these credentials, there's no requirement on the victim side. 204 00:17:52,140 --> 00:17:53,720 They don't need to have, say, Zoom installed. 205 00:17:53,920 --> 00:18:02,220 If we just run our tooling on their systems, we can use that infrastructure without any dependencies on the actual victim side as well. 206 00:18:03,400 --> 00:18:06,800 And so now the next step comes actually building the tool. 207 00:18:06,820 --> 00:18:12,100 And the first question is, of course, you know, what is it that we actually want to build? 208 00:18:12,100 --> 00:18:20,800 And so the idea was, again, we're going to build an implant that we can run through an existing long-term channel that's meant to spin up a short-term channel that you would use for a couple of hours. 209 00:18:20,800 --> 00:18:34,360 And so at the network level, it would just look like the user is joining a video call for three hours, but we're actually using that infrastructure as a covert channel to browse internal web applications or perform different types of enumeration running different offensive security tooling through that implant. 210 00:18:34,880 --> 00:18:38,060 And so it's meant to run in parallel with a long-term C2. 211 00:18:38,100 --> 00:18:43,820 And I'll talk a little bit about why I believe it's often useful to split your C2 between short-term and long-term. 212 00:18:43,820 --> 00:18:44,880 And I can use an example. 213 00:18:44,880 --> 00:18:47,880 This is from a couple of years ago back when you could domain front through Fastly. 214 00:18:47,880 --> 00:18:51,500 And I was on a project and I was domain fronting through a banking website. 215 00:18:51,500 --> 00:18:53,080 I'm just using somebank.com. 216 00:18:53,080 --> 00:19:01,000 And this customer, they had a lot of SAP infrastructure and the objective was to show that we could pull different types of data or modify information within the ERP systems. 217 00:19:01,000 --> 00:19:11,760 And so we needed to proxy the SAP desktop application through our implants quite a bit to access different things, RDP into different servers to basically really prove out the attack paths that we were demonstrating once we had the access. 218 00:19:11,760 --> 00:19:23,960 And then after the project, we did some looking at some of their dashboards and other things and we noticed that the website that we were domain fronting through was, you know, on some of their most top visited domains because we were hitting it so much for actually routing traffic. 219 00:19:24,360 --> 00:19:29,780 And once you dug into it, it was like a handful of systems actually in the network that were actually making that communication. 220 00:19:29,780 --> 00:19:38,100 It shows that, you know, this was a good long-term channel, but once we started sending too much data through it over a short period of time, it starts to look very weird to anyone that's paying attention. 221 00:19:38,100 --> 00:19:44,720 And that's why I recommend splitting your channel between short-term and long-term and having a tool like this is actually useful. 222 00:19:45,860 --> 00:19:47,140 And so we developed a tool. 223 00:19:47,140 --> 00:19:52,080 I'm going to show this QR code and URL later in the presentation, but it's called Turrent or Turntunneler. 224 00:19:52,080 --> 00:19:54,320 It's a tool for short-term command and control. 225 00:19:55,360 --> 00:19:56,860 And so it has a couple of use cases. 226 00:19:56,860 --> 00:20:09,420 And one of them is I think a little bit interesting of a lot of red teams are actually shifting more toward an assumed breach model just because once you've done, you know, a red team for someone for say two or three years, they know that you can actually get in and actually get a foothold in the environment. 227 00:20:09,420 --> 00:20:13,920 They don't want to pay you a lot of money to, you know, call people on the phone and send them emails and stuff. 228 00:20:14,160 --> 00:20:15,860 We know that you can do that. 229 00:20:15,860 --> 00:20:19,580 We're going to give you a laptop or a VDI infrastructure that you can actually start from . 230 00:20:19,840 --> 00:20:25,720 And so this tool is useful for that scenario because you don't need to set up any other infrastructure to use it once you have turn credentials. 231 00:20:25,820 --> 00:20:27,960 You can do C2 in an entirely decentralized manner. 232 00:20:27,960 --> 00:20:35,560 So maybe you have an operator laptop that you're running off of and you have like a victim VDI or laptop that you're using for the assumed breach exercise. 233 00:20:35,560 --> 00:20:39,380 You can basically connect those with the tool without needing to spin up any backend infrastructure. 234 00:20:39,380 --> 00:20:41,380 So that would save you time on your project. 235 00:20:41,380 --> 00:20:48,120 And then you can then proxy offensive security tooling from your operator laptop through the victim system without needing to run it directly on the endpoint. 236 00:20:48,120 --> 00:21:00,980 And I think increasingly we've been switching from like running tooling on endpoints themselves to proxying them through endpoints a lot of the time because it has a little bit of a smaller attack surface from a detection perspective on the endpoint side. 237 00:21:02,680 --> 00:21:05,400 And so there's a couple other capabilities. 238 00:21:05,400 --> 00:21:10,140 And just because not everyone is going to understand what these terms mean, I just wanted to define them really quickly. 239 00:21:10,500 --> 00:21:12,440 And so one of them is this concept of remote port forwarding. 240 00:21:12,440 --> 00:21:15,540 So imagine you have a tool like NTL relay X and it's a Python based tool . 241 00:21:15,540 --> 00:21:17,100 It has a decent number of dependencies. 242 00:21:17,220 --> 00:21:19,660 It would be very difficult to run it on a victim system. 243 00:21:20,200 --> 00:21:22,000 So what you can do is take your attacker system. 244 00:21:22,000 --> 00:21:23,000 You can run that tool. 245 00:21:23,000 --> 00:21:24,480 Have a listen on a local port. 246 00:21:24,520 --> 00:21:27,160 And then on your victim system you can figure something called a remote port forward. 247 00:21:27,160 --> 00:21:39,800 So whenever someone connects to that port on the victim system on say the internal network, then it will route through Microsoft Teams turn infrastructure, for example, to the attacker system and then route that traffic to the local NTL relay instance. 248 00:21:39,800 --> 00:21:51,060 So you can basically run a tool locally but expose it on an internal network that you wouldn't have access to normally to run different tooling that would be difficult to run on the endpoint or you just wouldn't want to from a detection perspective. 249 00:21:51,060 --> 00:21:54,240 So that can be really useful on a variety of different engagement types. 250 00:21:54,880 --> 00:21:57,580 Another thing I like to do is something called local port forwarding. 251 00:21:57,580 --> 00:22:00,320 So I mentioned that use case before with SAP where it's a thick client. 252 00:22:00,320 --> 00:22:01,860 It doesn't support SOX proxying. 253 00:22:02,020 --> 00:22:16,540 If you want to connect to like a specific SAP server, for example, you can bind to a local port on your attacker system, connect to that with the thick client application and then that will route connections that port through the turn infrastructure to the victim system and it will make that connection to internal infrastructure . 254 00:22:16,540 --> 00:22:23,160 So one of the ways I like to use this is using things like Citrix where a lot of times from the external it requires MFA but from the internal it doesn't. 255 00:22:23,160 --> 00:22:29,300 So I can basically once I have initial foothold I can pivot to Citrix routing the Citrix receiver client through my victim endpoint. 256 00:22:29,300 --> 00:22:43,920 Connect to the internal Citrix infrastructure without MFA and then often I'm able to escalate privileges on that Citrix infrastructure and steal credentials and Chrome cookies from other users and then just use just that access to get objective to actually just pull the specific data that I need in those environments. 257 00:22:45,160 --> 00:22:47,000 And so these are the three use cases. 258 00:22:47,020 --> 00:22:49,940 Basically SOX proxying for things like browsing internal web apps. 259 00:22:50,600 --> 00:22:56,980 Decentralized C2 and local remote port forwarding was really how we envisioned this utility. 260 00:22:57,520 --> 00:22:58,780 And so I'm going to have two demos today. 261 00:22:58,780 --> 00:23:00,680 One with Zoom and one with Microsoft Teams. 262 00:23:00,680 --> 00:23:06,980 And so we're going to basically have a video demo where we demo obtaining credentials from Zoom basically as a stand alone basis on an attacker. 263 00:23:06,980 --> 00:23:08,120 We're just going to run burp. 264 00:23:08,180 --> 00:23:09,580 We're going to run Chrome. 265 00:23:09,580 --> 00:23:10,880 We're going to join a meeting. 266 00:23:11,240 --> 00:23:13,220 Wait for that web socket connection to be made . 267 00:23:13,220 --> 00:23:15,880 We'll get credentials back through the turn infrastructure. 268 00:23:16,420 --> 00:23:20,260 And we're going to put that in a configuration file and use it with our tooling. 269 00:23:20,260 --> 00:23:21,980 And so we have two components that I'm going to demo. 270 00:23:21,980 --> 00:23:23,860 In this video, it's the controller and the relay. 271 00:23:24,320 --> 00:23:28,300 And the controller you run on the operator system and you run the relay on a victim system. 272 00:23:28,320 --> 00:23:33,660 And just for demo purposes, it's easier for me to run this just like, you know, with a VM and GCP. 273 00:23:33,660 --> 00:23:35,380 I'm just going to SSH into it and run the tool. 274 00:23:35,380 --> 00:23:40,840 But really this is meant to be run through an existing implant you have in a system like night hawk or cobalt strike. 275 00:23:40,840 --> 00:23:50,220 And as long as you have the ability to run an arbitrary binary in memory and read standard output, this tool can integrate with your existing implant without needing any other infrastructure in place. 276 00:23:50,220 --> 00:24:01,240 And so we kind of designed it in a way that we wanted to be used with whatever existing C2 channel you use as long as that C2 implant provides some basic primitives that I believe any decent one should be able to provide. 277 00:24:02,460 --> 00:24:06,500 And so now I've got a demo that I'm just going to play. 278 00:24:06,940 --> 00:24:10,960 And so then basically here we're just in burp on the attacker system. 279 00:24:10,960 --> 00:24:13,440 There's the victim doesn't need to be involved here or anything. 280 00:24:13,440 --> 00:24:21,480 We're just joining a meeting and just waiting for it to actually finish initializing. 281 00:24:21,480 --> 00:24:24,560 And then from here we can just close the browser. 282 00:24:25,040 --> 00:24:30,200 And then we go into burp and we actually just look through the web socket channel and we get those credentials. 283 00:24:30,280 --> 00:24:36,760 And so you can grab these from the web socket connection and basically throw them into a configuration file. 284 00:24:36,820 --> 00:24:46,400 And I'm not going to show that putting in the config file on screen but this is all documented in our documentation and how this is actually done if you're curious. 285 00:24:46,400 --> 00:24:49,500 And so here we've got a demo where one side is my operator system. 286 00:24:49,500 --> 00:24:51,280 I'm running the controller component. 287 00:24:51,500 --> 00:24:52,700 We're generating an offer. 288 00:24:52,700 --> 00:24:56,520 The offer thing I mentioned before with the exchange, the handshake process. 289 00:24:56,520 --> 00:25:00,540 Then you basically want to pass that offer to the relay component which you run on the victim system. 290 00:25:00,820 --> 00:25:04,280 And then this generates an answer that you pass back to the controller. 291 00:25:04,480 --> 00:25:10,960 And then this establishes the connection through Zoom's turn infrastructure and now we have communication between these two systems. 292 00:25:10,960 --> 00:25:12,460 And then we're just downloading a file. 293 00:25:12,460 --> 00:25:14,140 And you'll notice that this infrastructure is very fast. 294 00:25:14,140 --> 00:25:18,880 Like we're getting 9 or 10 megabytes per second down on this download here. 295 00:25:19,200 --> 00:25:25,640 And so this is a fairly good speed for any sort of internal short term C2 that we might want to do. 296 00:25:27,700 --> 00:25:37,080 And then if we look at this at the network level, we basically see connection outbound on 443TCP and it's going to look at the client hello. 297 00:25:37,080 --> 00:25:40,360 You see it's going to a Zoom.US subdomain. 298 00:25:41,560 --> 00:25:45,880 And so they actually did push some recent mitigations on the Zoom side to block this. 299 00:25:45,880 --> 00:25:50,200 It depends on, there's a lot of providers that you have turn infrastructure that you could use this tool with. 300 00:25:50,420 --> 00:25:53,200 And whether it's possible to restrict it depends on how it's used. 301 00:25:53,200 --> 00:26:00,440 And basically in their case, they're only using it for communication between the client and the media server and they're not using it to facilitate peer to peer connections as well. 302 00:26:00,440 --> 00:26:07,520 And so they basically restricted what can actually connect to this, the turn server can actually connect to. 303 00:26:07,520 --> 00:26:09,680 And so it can only connect to these media servers. 304 00:26:09,680 --> 00:26:11,540 I haven't actually looked for any bypasses or anything. 305 00:26:11,540 --> 00:26:14,520 So I can't vouch for if it works or not. 306 00:26:14,960 --> 00:26:18,440 But the feasibility depends on the provider and how they use the turn infrastructure. 307 00:26:18,440 --> 00:26:27,460 And there are quite a few providers from the web conferencing providers to CloudFlare or Twilio that have turn infrastructure that you can use with the same type of channel. 308 00:26:28,780 --> 00:26:31,120 And so Microsoft Teams, this still works. 309 00:26:31,120 --> 00:26:32,520 And so that's good. 310 00:26:32,520 --> 00:26:36,920 And so there's two other utilities that we have here. 311 00:26:36,920 --> 00:26:40,040 With Microsoft Teams, it was just an unauthenticated endpoint you could hit. 312 00:26:40,060 --> 00:26:42,860 With Zoom, you had to actually go through a process of joining the meeting. 313 00:26:42,860 --> 00:26:44,780 And so that was a little difficult to automate. 314 00:26:44,780 --> 00:26:47,200 And I think even if we did automate it, it might be a little bit brittle. 315 00:26:47,200 --> 00:26:50,940 So we decided kind of against that, just have some manual documentation. 316 00:26:51,500 --> 00:26:52,960 And so we're going to show a couple things. 317 00:26:52,960 --> 00:26:55,720 One of them is just downloading a hundred megabyte test file through the channel. 318 00:26:55,840 --> 00:26:57,060 And then we have an admin utility. 319 00:26:57,060 --> 00:27:02,440 You can basically use the admin utility to connect to the controller and use that to manage your local and remote port forwards. 320 00:27:02,820 --> 00:27:05,480 And so I'm going to demonstrate a remote port forwarding capability. 321 00:27:05,620 --> 00:27:11,840 And again, we're just using my local laptop and a GCP VM just because it makes it really easy to demo in video form for a presentation. 322 00:27:13,620 --> 00:27:17,400 And so again, I just wanted to have like a demonstration diagram of what's happening. 323 00:27:17,400 --> 00:27:20,320 Basically, I've got a web server running on my attacker system. 324 00:27:20,340 --> 00:27:22,740 That web server just has a file hosted on it. 325 00:27:22,740 --> 00:27:31,200 It's meant to simulate whatever tooling you might want to expose on, say, an internal network on like an endpoint or something that's on an internal client environment, for example. 326 00:27:31,300 --> 00:27:36,640 We're just using a VM and GCP because it's easier to demo for a short presentation in video form. 327 00:27:36,640 --> 00:27:42,740 And so basically we're going to show that we're not able to access that service on the VM and GCP, but it's accessible locally. 328 00:27:42,740 --> 00:27:47,940 And we're going to go through the process of using the admin utility to establish a remote port forward. 329 00:27:49,100 --> 00:27:51,520 And so I've got another demo here. 330 00:27:54,710 --> 00:27:55,910 There we go. 331 00:27:56,630 --> 00:28:07,950 So then in this demo, we're just first running the credentials utility for getting a configuration file that basically has our term credentials for Microsoft Teams infrastructure in them. 332 00:28:07,950 --> 00:28:10,090 We're then going to kick off the controller. 333 00:28:10,090 --> 00:28:11,850 It's going to generate an offer. 334 00:28:12,510 --> 00:28:17,390 That offer gets sent to the relay component running on our GCP infrastructure. 335 00:28:17,710 --> 00:28:29,350 And then we're using that to run the relay utility and then generate an answer that we then send back to the actual controller component. 336 00:28:29,350 --> 00:28:35,870 So we do have documentation on how to do this, like running the tool in memory through other C2 channels like Nighthawk on GitHub documentation. 337 00:28:35,870 --> 00:28:43,230 It's just for a demo, just using SSH for like simulating our long-term C2 channel is useful for a presentation like this. 338 00:28:43,530 --> 00:28:46,430 And so here we're downloading a file and we're getting fairly decent speeds. 339 00:28:46,430 --> 00:28:49,510 I think we get about three to five megabytes per second down here. 340 00:28:49,590 --> 00:28:54,010 And I'll talk a little bit about later why download speeds can vary. 341 00:28:54,010 --> 00:29:00,250 And so some other things later on, but you know, you can get fairly decent speeds through this infrastructure. 342 00:29:00,250 --> 00:29:01,890 I've gotten 10 to 20 before. 343 00:29:02,090 --> 00:29:05,010 Here we're routing traffic internationally. 344 00:29:05,010 --> 00:29:08,170 And so it's going to be a little bit slower in this scenario. 345 00:29:13,230 --> 00:29:16,190 And then I actually forgot. 346 00:29:16,190 --> 00:29:17,550 We've got the other part here. 347 00:29:17,850 --> 00:29:27,770 So then now we're running the admin utility and we're going to basically list remote port forwards to show that there's no currently active. 348 00:29:30,870 --> 00:29:40,010 And then if we pivot back over, this is running commands on my operator system, just showing that this service is not accessible within our victim virtual machine within GCP. 349 00:29:40,010 --> 00:29:43,910 Again, it would be more of like an end point or something compromise an internal network. 350 00:29:43,910 --> 00:29:46,050 We're just using GCP as a quick demo. 351 00:29:46,370 --> 00:29:49,230 You can see that that web server is running locally on the operator system. 352 00:29:49,310 --> 00:29:53,230 And we're going to run a command here to create a remote port forward. 353 00:29:53,550 --> 00:30:03,870 And that's going to basically any time someone connects to that port on GCP on 8080, it's going to route through Microsoft's turn infrastructure back to the operator laptop and originate a connection to the local web server. 354 00:30:03,870 --> 00:30:07,590 And then now that web server is accessible through the victim system. 355 00:30:09,030 --> 00:30:11,770 And then now you can see that that remote port forward is active. 356 00:30:11,770 --> 00:30:24,090 And so yeah, those are really the three main use cases I had envisioned for this , which was basically local and remote port forwarding, SOX proxying, and then decentralized command and control. 357 00:30:25,290 --> 00:30:30,790 And then if we go here, we can look at Wireshark and see what this looks like at the network level. 358 00:30:30,790 --> 00:30:37,270 You can basically see that there's a connection outbound on 443TCP over TLS. 359 00:30:37,410 --> 00:30:40,210 There's a client hello being sent here. 360 00:30:40,210 --> 00:30:44,510 It's connecting to teams.Microsoft.com, subdomain for a channel. 361 00:30:45,070 --> 00:30:57,750 And so now the third part I want to talk about is a lot of what we're focusing on today is this concept of we want to have a channel that's very fast that is going to be low latency and high throughput. 362 00:30:57,750 --> 00:31:05,290 And so we're optimizing for things like if we're trying to do different types of tunneling traffic into a network or exfiltrating data, how do we maximize the speeds? 363 00:31:05,290 --> 00:31:16,990 And so I just want to talk about some interesting observations I had on actually using this tool and like how different ways that traffic gets routed can actually impact tunneling speeds and how you can work around that. 364 00:31:16,990 --> 00:31:20,950 Not just with this tool, but kind of in general when you're doing red team operations. 365 00:31:21,630 --> 00:31:24,110 And so as a disclaimer , I'm not like an expert on internet routing or anything . 366 00:31:24,110 --> 00:31:26,770 I just started researching this like three weeks ago. 367 00:31:26,770 --> 00:31:28,550 So I'm not an expert. 368 00:31:28,550 --> 00:31:30,910 But I wanted to share some interesting observations I've had. 369 00:31:30,910 --> 00:31:43,650 And I kind of wanted to set the scene a little bit by just talking about an interesting scenario we ran into once where we basically, one of the things we really like to do is compromise help desk users because they're often very highly privileged users and relatively easy targets. 370 00:31:43,650 --> 00:31:49,210 And part of this is they often usually have indirect DA privilege and nobody realizes that. 371 00:31:49,290 --> 00:31:58,690 And also they're usually entry level employees and it's generally a lot easier to get them to actually run malware on their systems or reset other users' passwords or things of that nature. 372 00:31:58,950 --> 00:32:05,130 And it's frequently outsourced overseas, especially with larger multinational companies. 373 00:32:05,130 --> 00:32:13,250 And so we've run into issues before where we're trying to tunnel traffic through their systems and we're running it to kind of slower, unreliable channels, proxying traffic through their systems. 374 00:32:13,250 --> 00:32:15,910 And so an example, maybe you have an operator in the U.S. 375 00:32:15,910 --> 00:32:21,610 they're proxying traffic through a compromised help desk employee in India and they're running into speed issues. 376 00:32:21,970 --> 00:32:27,850 And so one of the things that you might think about here is actually, oh, it must be the last mile connection. 377 00:32:27,870 --> 00:32:40,530 Because if you think about the early days of the internet with things like dial up or even DSL until recently in many rural parts of the United States, generally the last mile was the thing that was running into issues from a speed perspective. 378 00:32:41,050 --> 00:32:56,170 But really whether it's India or even a lot of more rural parts of the United States there's actually a massive global build out of fiber to the home infrastructure whether it's a variety of factors from things like just the cost of fiber actually going down quite a bit over time. 379 00:32:56,670 --> 00:33:01,330 And so oftentimes it's not actually the last mile connection that is the bottleneck. 380 00:33:01,330 --> 00:33:05,650 And often it can be things like how your traffic is routed internationally. 381 00:33:06,210 --> 00:33:09,030 And so that can actually be where the bottleneck is. 382 00:33:09,030 --> 00:33:20,790 Some of these countries have very good domestic fiber networks but then they have more congested internet exchange points that they use to route internationally or just kind of poor peering with other major internet routes. 383 00:33:20,790 --> 00:33:24,970 And some of this is just the way internet routing works is a lot messier. 384 00:33:24,970 --> 00:33:30,850 I think in general it's a lot more centralized than I think many people would realize. 385 00:33:30,850 --> 00:33:44,250 And so a lot of providers kind of have pretty bad international routing, especially residential providers because a lot of major sites and CDNs have localized points of presence so they don't need to actually go through the international channels and stuff like that. 386 00:33:44,250 --> 00:33:53,830 And so it's a bit hard to explain but I can kind of show this by, you know, I'm in, I was making these slides in a relatively rural part of the Midwest so I have about 40 megabits down. 387 00:33:53,830 --> 00:34:07,770 It's not amazing speed but this is basically me running a connection on a 40 megabit per second connection and this is connecting directly from the last mile into the ISPs network so there's nothing else that's happening and seeing I'm getting about 40. 388 00:34:08,110 --> 00:34:16,230 And then if I say try to download a file from Hetzner in Singapore I get about half that speed averaging about 2 megabytes per second. 389 00:34:16,750 --> 00:34:29,030 But if I connect to basically Hetzner, connect to express VPN in Chicago, basically that changes how my traffic gets routed internationally and I double the actual download speed for that file. 390 00:34:29,030 --> 00:34:45,910 So that shows like if you're doing anything like say compromising help desk user in India or somewhere and you're trying to route traffic through their system from the U.S., the way that your traffic is routed through different parts of the internet can sometimes matter more than what the last mile connection speed are on both sides and this can also impact things like data exfiltration. 391 00:34:45,910 --> 00:34:54,790 Sometimes if you're exfiltrating data, you want to get that data off the initial first stage very fast in case, you know, something happens during that period. 392 00:34:55,270 --> 00:35:06,370 And so like if you look at say trace route you can see how this gets impacted where from my residential connection I'm getting routed through hurricane electric as a transit provider where it's using NTT with express VPN. 393 00:35:06,370 --> 00:35:17,270 And express VPN tends to use as providers like CDN 77 to optimize connectivity to their infrastructure and then they, you know, tend to pay more for premium transit that gives you better international routing. 394 00:35:17,270 --> 00:35:25,730 And so this is just something I've noticed and been messing with but it just shows how the way that you position your infrastructure and what infrastructure you're using really matters a lot. 395 00:35:25,730 --> 00:35:30,150 And actually I'll talk a little bit about why web conferencing is actually very useful in this regard later on. 396 00:35:31,450 --> 00:35:38,350 But, you know, again, this just goes in the idea of like things like peering or routing relationships can sometimes matter more than your last mile connection speed. 397 00:35:38,350 --> 00:35:44,030 So like imagine you're on like a budget VPS and you've compromised a web server and you're trying to exfiltrate 10 gigs of data. 398 00:35:44,150 --> 00:35:56,130 If your budget VPS provider, you know, doesn't have good peering with whatever server you're trying to actually download to, you could get very, very low download speeds even if your last mile connection to the ISP is very good. 399 00:35:56,130 --> 00:36:06,890 So thinking about how you position your infrastructure if you're trying to exfiltrate data like, you know, that they're running stuff in this data center and this provider and this AWS region has good peering with their ISP in this area with, you know, 400 00:36:06,890 --> 00:36:07,770 running trace route and stuff. 401 00:36:07,770 --> 00:36:12,290 You can find faster paths where you can increase exfil speeds or stuff like that. 402 00:36:12,290 --> 00:36:15,250 And so, again, I think this could be an entire talk on its own. 403 00:36:15,250 --> 00:36:22,370 I just kind of wanted to talk about because a big theme of this talk is how you optimize things like tunneling speed or exfiltration speed. 404 00:36:22,370 --> 00:36:29,630 And I wanted to talk about how I was kind of observing this when I was testing like setting up different systems around the world and messing with stuff like this. 405 00:36:30,430 --> 00:36:50,370 And there's another couple of design decisions we made that I wanted to mention which is one of my original ideas was to support full VPN tunneling where basically you could set up a like virtualized VPN interface, run the system on another system and it would do the turns over TLS over TCP and basically tunneling TCP over TCP traffic with raw VPN tunneling. 406 00:36:50,450 --> 00:36:57,270 But the problem here is that when you are tunneling TCP over TCP traffic, you can run into some pretty major performance issues. 407 00:36:57,310 --> 00:37:02,270 Basically any sort of like packet loss on the outer layer, for example, can trigger congestion control and stuff on the inner layer. 408 00:37:02,270 --> 00:37:04,750 And that's referred to as like a TCP meltdown problem. 409 00:37:05,410 --> 00:37:10,090 And there's a lot of videos on the internet that explain this that are 20 or 30 minutes so I don't have a lot of time. 410 00:37:10,330 --> 00:37:12,830 But head of line blocking is a big issue with TCP. 411 00:37:12,910 --> 00:37:22,530 So with this tunnel that we're using with TCP, any packets that get lost ahead of other ones, that needs to be retransmitted before the full chain of messages can be processed. 412 00:37:22,530 --> 00:37:26,090 And so these are all things that can kind of impact tunneling speeds. 413 00:37:26,090 --> 00:37:33,670 And so this is just an example of me on like a VPN server using TCP over UDP outer layer versus a TCP outer layer . 414 00:37:33,670 --> 00:37:36,870 And you get very different speeds even going through the same server. 415 00:37:36,870 --> 00:37:46,950 And so be careful with, you know, if you're trying to do full VPN tunneling, if you're using TCP as an outer layer for transport, any sort of packet loss can really kill your tunneling speed. 416 00:37:46,950 --> 00:37:50,090 And so that's why I didn't implement that in the tool even though I originally planned to . 417 00:37:50,210 --> 00:37:53,090 And so those are just some of the nuances. 418 00:37:53,350 --> 00:37:59,370 And so for example, in this scenario, be careful cheaping out on your infrastructure, basically. 419 00:37:59,370 --> 00:38:07,350 Because if you have a compromised user in India using a budget VPS or you're even doing peer-to-peer communication, this can slow down connection speeds. 420 00:38:07,350 --> 00:38:13,730 So a common thing people might think is that peer-to-peer is always going to be faster than a centralized server. 421 00:38:13,730 --> 00:38:14,990 But if you have a user in the U.S. 422 00:38:14,990 --> 00:38:22,970 and a user in India and you're trying to make a direct peer-to-peer connection with NAT hole punching, and usually residential ISPs don't really pay for amazing transit. 423 00:38:22,970 --> 00:38:30,430 And so that could actually be slower than doing something like this where you're actually connecting to like using Microsoft Teams infrastructure as a relay. 424 00:38:30,430 --> 00:38:32,890 Because they have globalized points of prevalence around the world. 425 00:38:32,890 --> 00:38:35,230 They have their own private backbone infrastructure. 426 00:38:35,230 --> 00:38:47,630 And so this is one of the other advantages of using things like Microsoft Teams for tunneling is you can actually ride on Microsoft's backbone and run through better transit and get better tunneling speeds than you would through other types of channels. 427 00:38:48,010 --> 00:39:03,030 And so generally if you're like at this scenario where you're tunneling traffic through like a help desk user like we often run into, definitely recommend Microsoft Teams as a good vector for tunneling traffic, getting high performance tunneling going. 428 00:39:03,650 --> 00:39:07,250 And so now I have I think maybe seven minutes for questions. 429 00:39:07,250 --> 00:39:13,250 I've got three QR codes, but I know this is DEF CON and people don't usually trust QR codes. 430 00:39:13,250 --> 00:39:21,550 So if you just want to take a picture, you can just copy this URL using like OCR on your phone if you want to see this other information we have. 431 00:39:21,630 --> 00:39:24,550 Basically this talk is about 40 minutes, 45 minutes. 432 00:39:24,770 --> 00:39:33,530 And so we've got about like I think in Google Docs it was like a 35 page document split up over two blog posts that talks about other parts of this research I didn't talk about today. 433 00:39:33,530 --> 00:39:38,090 We've got the open source tool on GitHub that you can actually download and use. 434 00:39:38,410 --> 00:39:40,370 My LinkedIn profile for if you have any questions. 435 00:39:40,370 --> 00:39:46,350 I used to use XL out for this, but I think now if you don't have like the premium subscription, you can't message people if they don't follow you. 436 00:39:46,350 --> 00:39:51,070 So I think LinkedIn is a good one, even though it's not really my favorite platform personally. 437 00:39:51,070 --> 00:39:54,670 But anyway, any questions would be appreciated. 438 00:39:55,350 --> 00:39:56,850 Just a quick question. 439 00:39:56,850 --> 00:40:03,350 So the turn relays from Microsoft and Zoom will relay traffic on your behalf. 440 00:40:03,350 --> 00:40:07,910 Have you looked if there's any restriction in terms of what they will connect onward to? 441 00:40:07,910 --> 00:40:10,310 So you said Zoom will now only connect to media servers. 442 00:40:10,310 --> 00:40:16,410 Is there anything within the team's networks or the Zoom's networks that are reachable over these relays that shouldn't be? 443 00:40:17,090 --> 00:40:18,670 I didn't really look into that. 444 00:40:18,670 --> 00:40:26,190 You do need when you do the process of setting up the infrastructure, you do need to exchange certain information. 445 00:40:26,190 --> 00:40:29,430 So I wasn't able to find a way to connect to like arbitrary systems internally. 446 00:40:29,430 --> 00:40:30,230 It might be possible. 447 00:40:30,230 --> 00:40:35,750 My focus on this research was more just how do you tunnel traffic for command and control. 448 00:40:35,750 --> 00:40:37,470 But that would be an interesting thing to look into. 449 00:40:37,470 --> 00:40:42,230 It would definitely be something I would look into more if I wanted to expand on this research. 450 00:40:44,830 --> 00:40:50,150 This turn infrastructure is supposed to be used for very specific kinds of traffic. 451 00:40:50,150 --> 00:40:53,290 That is video traffic between two end points. 452 00:40:53,290 --> 00:41:04,350 Any guesses why would Microsoft and Zoom allow any arbitrary communication that look nothing like bidirectional video conferencing traffic through? 453 00:41:04,430 --> 00:41:14,690 So the interesting thing is it actually looks exactly the same at the network level because in both cases on the web client with Zoom they're using WebRTC with data channels sending their custom protocol. 454 00:41:14,930 --> 00:41:18,330 And on the Microsoft team's side they're using WebRTC as well. 455 00:41:18,330 --> 00:41:25,610 So basically what you see with the WebRTC connection is you see basically a DTLS encrypted tunnel that traffic is being sent over. 456 00:41:25,610 --> 00:41:33,310 So it's going to look very similar in many cases to what the client would normally be sending through the infrastructure. 457 00:41:34,130 --> 00:41:40,930 So I guess the only difference may be packet sizes, packet rates, bidirectionality, but not actual contents. 458 00:41:40,930 --> 00:41:52,830 Yeah, it's using the same basic building blocks from a protocol perspective, but it would likely look slightly different if you looked into it more in depth. 459 00:41:52,830 --> 00:41:53,630 Thank you. 460 00:41:58,520 --> 00:41:59,760 Awesome. 461 00:41:59,800 --> 00:42:01,400 Thank you for coming everyone.