1 00:00:00,000 --> 00:00:01,880 We have a real treat for you today. 2 00:00:01,880 --> 00:00:07,140 It's Russia's firewall and defending against the future of digital repression. 3 00:00:07,320 --> 00:00:09,960 With Benjamin Mixon-Baca. 4 00:00:10,000 --> 00:00:11,240 Have a great talk. 5 00:00:11,240 --> 00:00:12,480 Yeah, thank you. 6 00:00:16,220 --> 00:00:17,500 Hi. 7 00:00:18,960 --> 00:00:21,460 Thank you for coming to my talk today. 8 00:00:21,460 --> 00:00:26,380 I hope you are excited to learn about Russia's fancy new firewall. 9 00:00:26,820 --> 00:00:31,980 So to sort of motivate this discussion, I'm going to start with an example. 10 00:00:32,960 --> 00:00:39,240 So imagine you want to surprise your grandmother for her birthday. 11 00:00:39,580 --> 00:00:43,900 She absolutely loves cherry peach and eggplant cobbler. 12 00:00:44,140 --> 00:00:57,360 And so you being the good grandson or granddaughter that you are, you go online and you are searching for recipes and you expect to see images like what you see here, right, on your phone. 13 00:00:57,640 --> 00:01:05,780 And to your horror, your dismay, your disgust, you see these block pages, right? 14 00:01:05,780 --> 00:01:16,840 And then you start to freak out because you know, you know, five minutes from now the autonomous drone swarm is going to arrest you, right? 15 00:01:16,840 --> 00:01:23,560 And you are sure about this because your buddy Trevor last week just got arrested for looking up cat pictures. 16 00:01:23,560 --> 00:01:26,540 So, you know, you are super nervous. 17 00:01:26,540 --> 00:01:33,960 And for anyone who wants to know, I have the prompt that I used to generate this cool image of me getting arrested. 18 00:01:35,060 --> 00:01:38,660 So what makes this possible? 19 00:01:39,260 --> 00:01:41,760 That's sort of a two‑part question. 20 00:01:42,360 --> 00:01:47,500 There's going to be a policy component and then there's going to be sort of a more technical component. 21 00:01:48,460 --> 00:01:56,760 In Russia specifically, there's about seven or eight laws related to information controls. 22 00:01:57,160 --> 00:01:58,940 So here they are right there. 23 00:01:58,940 --> 00:02:06,740 The most relevant for this discussion though is federal law number 90FZ, the sovereign internet law. 24 00:02:06,960 --> 00:02:24,880 And it basically sets guidelines for who is supposed to do the regulations, like what body does it, who has to abide by them, so which network operators and fines and things like that. 25 00:02:26,300 --> 00:02:34,260 So Roskomnadzar is the body responsible for enforcing censorship in Russia. 26 00:02:34,260 --> 00:02:37,680 Here's a picture of their seal and their headquarters. 27 00:02:37,980 --> 00:02:39,640 They go by Arcane for short. 28 00:02:39,640 --> 00:02:50,100 But basically they coordinate with network operators, ISPs, data centers and things like that to actually enforce the censorship laws in Russia. 29 00:02:53,820 --> 00:02:55,760 So what's blocked? 30 00:02:56,320 --> 00:03:01,900 So mostly things that are related to politics are going to be blocked in Russia. 31 00:03:01,900 --> 00:03:06,360 So CNN, X is blocked. 32 00:03:06,800 --> 00:03:08,380 Google is blocked. 33 00:03:08,380 --> 00:03:10,040 Voice of America is blocked. 34 00:03:10,040 --> 00:03:17,780 So basically anything that the government deems will be destabilizing to the country is blocked. 35 00:03:18,640 --> 00:03:22,800 That pretty much completes the policy portion of this discussion. 36 00:03:22,800 --> 00:03:25,940 I think it's good to just have some context around that. 37 00:03:25,940 --> 00:03:32,420 But this is primarily going to be a technical discussion of sort of the nuts and bolts of how the TSP operates. 38 00:03:32,840 --> 00:03:42,840 So to start that portion, so here's a picture of a TSP that's deployed in a cabinet at a data center somewhere. 39 00:03:43,780 --> 00:03:52,340 The specific equipment that enforces this censorship policy is called the ecofilter DPI and you can see this image there. 40 00:03:53,200 --> 00:03:55,360 This is another picture of it. 41 00:03:55,740 --> 00:03:59,940 And it's manufactured by a company called RDP.RU. 42 00:04:00,540 --> 00:04:08,140 So they were the ones who won out on the bid to provide Roskomnadzar with the censorship equipment. 43 00:04:08,140 --> 00:04:18,620 But there was actually a bidding process and there's some leaked documents where you can read the reviews that all of these companies, this 12 in total, you know, how they performed. 44 00:04:19,160 --> 00:04:23,480 The ecofilter is pretty impressive for a few reasons. 45 00:04:24,640 --> 00:04:34,880 If you look at the other equipment, they all basically can process on the order of 10 gigs per second or so of network traffic. 46 00:04:35,060 --> 00:04:42,140 The ecofilter, by contrast, its data sheet says that a single device can process on the order of over 100 gigs per second for one device. 47 00:04:42,140 --> 00:04:44,780 So that's very impressive. 48 00:04:44,780 --> 00:04:51,880 I've worked on kind of similar DPI applications myself and it's pretty challenging hitting, you know, 1 or 10 gigs per second, much less 100. 49 00:04:53,000 --> 00:04:56,860 So yeah, that's just, you know, part of the reason why it's impressive in my opinion. 50 00:04:57,320 --> 00:05:03,160 Some of the other equipment are all Linux based, not all of them, but the ones that I looked into are Linux based. 51 00:05:03,160 --> 00:05:07,020 There's actually ISOs that you can download if you want to poke around. 52 00:05:07,400 --> 00:05:11,280 I did that for another one of the devices called carbon filter. 53 00:05:11,740 --> 00:05:22,040 So there's some goodies in there if anyone's interested in seeing, you know, what else is out there looking for vulnerabilities in this equipment, you know, it might be fun, fun exercise to do. 54 00:05:24,620 --> 00:05:32,860 So just to contextualize censorship, I'm going to start off by discussing a little bit of the great firewall of China. 55 00:05:32,860 --> 00:05:35,940 For those of you who don't know, it's called the GFW. 56 00:05:36,240 --> 00:05:45,120 And it, up until this point, was basically the state of the art for censorship equipment and it's pretty different from the TSPU. 57 00:05:45,480 --> 00:05:59,280 So the GFW is deployed, what's known as on path, which means that while it can basically observe and see everything that is traversing the network, it can't, for example, drop packets, right? 58 00:05:59,280 --> 00:06:01,860 And it can't, for example, throttle connections. 59 00:06:02,020 --> 00:06:10,520 So when you make a request for your recipe for your grandmother, your request is going to traverse a series of nodes. 60 00:06:11,200 --> 00:06:22,240 Eventually, and I believe it's somewhere around the 14th hop, so it's kind of deeper into the network, it's going to hit a port mirror and a copy of your request is going to go to the GFW equipment. 61 00:06:22,920 --> 00:06:30,100 And it's going to check, maybe it'll check the SNI, like in a TLS request or something, but it's going to check that. 62 00:06:30,100 --> 00:06:37,840 And because it's on path, your actual request will also go to the end server that you're trying to get that recipe from, right? 63 00:06:38,440 --> 00:06:46,060 And because it's on path, it has to do something typically called like a reset injection in order to disrupt your request. 64 00:06:46,720 --> 00:06:50,940 So when that happens, you'll see a block page or something. 65 00:06:51,640 --> 00:06:58,420 And if you're really unlucky, you might have, you might be greeted by one of these autonomous drones to come and arrest you. 66 00:06:59,500 --> 00:07:00,840 So that's bad. 67 00:07:01,500 --> 00:07:09,000 So by contrast, the TSP device, they are in path and this is part of the reason why I was saying it's impressive. 68 00:07:09,340 --> 00:07:21,200 Because hitting that speed of traffic with an in path device without sacrificing quality of service, just from a technical standpoint is pretty incredible. 69 00:07:21,660 --> 00:07:23,120 So it's in path. 70 00:07:23,560 --> 00:07:30,680 And it's also much closer in the network than the GFW where the GFW is something like 14 hops away. 71 00:07:30,680 --> 00:07:33,060 The TSP is more like 5. 72 00:07:33,060 --> 00:07:38,920 And when we were doing experiments and measuring where the TSP was, that's what we found. 73 00:07:39,000 --> 00:07:43,840 So you make a request. 74 00:07:44,040 --> 00:07:53,340 And almost immediately your request is, you know, hit by the TSP and it will see, you know, what you're requesting. 75 00:07:53,340 --> 00:07:56,140 It will see that it's supposed to be blocked. 76 00:07:56,900 --> 00:07:59,720 And because it's in path, it can throttle the connection, right? 77 00:07:59,720 --> 00:08:11,480 Which is a pretty nasty way of doing censorship because it's harder to tell if it's legitimate, like legitimate disruption or just like actual censorship. 78 00:08:11,480 --> 00:08:14,600 So that's one of the reasons why this is kind of a pain. 79 00:08:15,640 --> 00:08:25,040 So just to summarize, basically the sovereign internet law, the RUNet law in Russia, the TSP is one element of that. 80 00:08:25,040 --> 00:08:28,640 But there's, it's actually a fairly broad spectrum approach. 81 00:08:28,640 --> 00:08:38,260 They have, in Russia I believe they have like a national domain name service, the NDSI, so that they can control their domain names. 82 00:08:38,440 --> 00:08:42,440 They also have a national root certificate authority. 83 00:08:43,160 --> 00:08:49,960 And the, basically all the apps in Russia that are produced there have to have one of these trusted root certificates. 84 00:08:49,960 --> 00:08:55,160 So if you look at, for example, Yandex browser, that certificate is embedded in the app. 85 00:08:55,160 --> 00:08:58,340 So you basically have no privacy if you're using Russian apps. 86 00:08:58,340 --> 00:09:04,220 They're also locking down their BGP routes so traffic can't get rerouted. 87 00:09:04,220 --> 00:09:11,020 They're using something called RPKI or resource public key encryption or infrastructure. 88 00:09:11,440 --> 00:09:14,480 So it's a very broad spectrum approach. 89 00:09:16,000 --> 00:09:19,760 So what can we do to kind of get around this? 90 00:09:19,760 --> 00:09:25,540 Are we going to have to repurpose our microwaves to fry all of these nasty drones? 91 00:09:26,260 --> 00:09:26,980 Maybe. 92 00:09:26,980 --> 00:09:32,680 So for some of you hardware hackers out there, you know, maybe you'll get a chance to fry some drones with a microwave. 93 00:09:32,920 --> 00:09:34,440 And if you do, you can teach me. 94 00:09:34,440 --> 00:09:35,420 That would be cool. 95 00:09:35,460 --> 00:09:43,400 But in the interim, there's, I think, some other approaches that I'm going to discuss as far as getting around the censorship. 96 00:09:46,160 --> 00:09:52,300 So why is there this divergence in the deployment? 97 00:09:52,300 --> 00:09:55,500 Why is the TSPU in path? 98 00:09:55,500 --> 00:09:56,620 Why is it closer? 99 00:09:56,620 --> 00:09:59,920 There's a, you know, when compared to the GFW. 100 00:10:00,040 --> 00:10:04,280 Well, there's about three factors that I think are important to call out here. 101 00:10:04,280 --> 00:10:10,260 One is the difference in ISP ecosystem in China compared to Russia. 102 00:10:10,260 --> 00:10:15,020 The other is the economics of equipment that can do the censorship. 103 00:10:15,720 --> 00:10:18,020 And data, the scale of data. 104 00:10:18,020 --> 00:10:27,700 So if you look up the autonomous system numbers in Russia, there's, I think, something like an order of magnitude more ASs in Russia than China. 105 00:10:28,120 --> 00:10:32,320 Their ISPs are also more regionally distributed. 106 00:10:32,320 --> 00:10:44,380 So to actually deploy this censorship apparatus with this type of network kind of necessitates that it be deployed in path and close to the network. 107 00:10:47,440 --> 00:10:57,060 Researchers didn't used to think that it would be possible to have in path devices about 20 years ago when the GFW was first implemented. 108 00:10:57,140 --> 00:11:05,480 But the cost of microprocessors and the density of transistors has made it such that this is feasible again. 109 00:11:05,480 --> 00:11:21,580 And I think between that and just how much data we're all spitting out and consuming, having a censorship apparatus which is closer to users makes it, you know, this is actually a more ideal approach. 110 00:11:22,260 --> 00:11:29,900 I think another interesting thing about this deployment strategy is it also gives Russia finer granularity to perform censorship. 111 00:11:29,900 --> 00:11:32,960 So it can be very regionally specific and targeted. 112 00:11:33,320 --> 00:11:37,440 So that's, that's kind of an interesting aspect of it. 113 00:11:37,680 --> 00:11:43,200 So how do I know that the TSPU is deployed this way? 114 00:11:45,520 --> 00:11:53,500 Well, around 2020, 2021 2022, I was working on something unrelated. 115 00:11:53,500 --> 00:12:01,000 I was looking at vulnerabilities in VPN software and in specifically in the Linux networking code. 116 00:12:01,400 --> 00:12:08,360 And my buddy, Dewin, who had, he had just finished doing a censorship study for Russia. 117 00:12:08,360 --> 00:12:14,660 And he started talking about a really interesting circumvention strategy. 118 00:12:14,660 --> 00:12:30,640 And it turns out that what he said was if he tried to connect to X or Twitter from a vantage point inside of Russia and he tried to connect to it, his connection would get throttled. 119 00:12:31,100 --> 00:12:44,700 But when he, if he would spoof a SYN packet to his vantage point in Russia from the outside world from Twitter and then connect to the, to the Twitter server, his connection went through. 120 00:12:45,380 --> 00:12:56,860 And that sounded really familiar to me because I had been looking at vulnerabilities and stuff and kind of are elbow deep in the, in the Linux kernel stuff. 121 00:12:57,220 --> 00:13:00,320 And so what was I looking at? 122 00:13:00,320 --> 00:13:03,900 Well, I was looking at the connection tracking frameworks. 123 00:13:04,420 --> 00:13:14,100 And connection tracking, it turns out, is common across a lot of different types of devices and intrusion detection systems, right? 124 00:13:14,100 --> 00:13:19,560 So here's some connection tracking code for the Zeek IDS. 125 00:13:20,920 --> 00:13:22,800 So that's something I want to call out. 126 00:13:22,800 --> 00:13:26,700 It's trying to figure out what direction the packet is going in. 127 00:13:26,700 --> 00:13:28,420 So is it the client or the server? 128 00:13:29,300 --> 00:13:34,120 Here's Suricata's connection tracking code with just a snippet of it. 129 00:13:34,660 --> 00:13:40,380 And kind of doing a similar thing is trying to figure out which direction the packet is coming from. 130 00:13:40,940 --> 00:13:44,280 This is what I was really looking at at the time. 131 00:13:44,320 --> 00:13:46,300 This is the net filter code. 132 00:13:46,340 --> 00:13:56,820 And there's some special logic to, to figuring out which direction a packet's going in. 133 00:13:56,820 --> 00:14:02,520 And particularly for TCP, this is very challenging. 134 00:14:03,080 --> 00:14:07,380 And that's because TCP has something called simultaneous open. 135 00:14:07,380 --> 00:14:18,060 So because of simultaneous open, it's, there's not a deterministic way to figure out which side of a connection is the client versus which side is the server. 136 00:14:18,520 --> 00:14:20,880 So this becomes really important. 137 00:14:21,340 --> 00:14:23,180 So what is simultaneous open? 138 00:14:23,820 --> 00:14:31,160 So there is the client on the left hand side, I think, with the peaches. 139 00:14:31,380 --> 00:14:33,960 There's the TSPU censorship device in the middle. 140 00:14:33,960 --> 00:14:36,320 And then there's the web server on the right. 141 00:14:36,580 --> 00:14:41,140 So the TSPU, it's going to have to track the state of a connection. 142 00:14:41,240 --> 00:14:43,120 So it's going to track that in a global table. 143 00:14:43,120 --> 00:14:45,340 This is modeled after the way Linux does it. 144 00:14:45,340 --> 00:14:49,000 But it's kind of similar for, for pretty much anything that's tracking connections. 145 00:14:49,000 --> 00:14:51,040 So anyways, it's going to have a global table. 146 00:14:51,460 --> 00:14:56,480 It's going to track what's called the originator or orage variable. 147 00:14:56,480 --> 00:15:00,220 So that's a connection tuple that's internal to external. 148 00:15:00,960 --> 00:15:05,700 It's going to also track a connection tuple in the reverse direction. 149 00:15:05,700 --> 00:15:06,420 So the reply. 150 00:15:06,420 --> 00:15:07,860 So that would be the server. 151 00:15:07,940 --> 00:15:10,340 Or external to internal. 152 00:15:10,700 --> 00:15:16,340 And in the case of TCP, it has to also track its view of the TCP state. 153 00:15:17,260 --> 00:15:23,600 So with simultaneous open, let's just pretend that the web server initiates a connection . 154 00:15:23,600 --> 00:15:25,200 So it's going to send a SYN packet. 155 00:15:25,200 --> 00:15:29,040 From the TSPU's perspective, it's going to be in a SYN sent state. 156 00:15:29,960 --> 00:15:36,340 And then because we're doing simultaneous open, the client is going to send a connection request, a SYN packet. 157 00:15:36,740 --> 00:15:40,420 And from the TSPU's perspective, it's going to be SYN sent 2. 158 00:15:40,420 --> 00:15:44,040 So that's just another way of saying simultaneous open. 159 00:15:45,780 --> 00:15:48,060 Then the web server is going to send a SYNACK. 160 00:15:48,060 --> 00:15:50,800 So we're in SYN received state. 161 00:15:51,260 --> 00:15:54,380 And then of course the client sends its SYNACK. 162 00:15:54,380 --> 00:15:56,740 So still SYN received. 163 00:15:57,180 --> 00:16:01,700 And then the web server is going to complete its side of the 3-way handshake. 164 00:16:01,700 --> 00:16:04,960 And now the TSPU thinks it's in an established state. 165 00:16:05,220 --> 00:16:11,800 And the client finishes its side of the 3-way handshake and now it's also in, now we're established. 166 00:16:12,060 --> 00:16:17,520 So that pretty much summarizes how simultaneous open works. 167 00:16:18,900 --> 00:16:30,820 And it turns out that because of that, because of the directions of connections, especially with TCP, that it allows us to use what's called the server side bypass. 168 00:16:30,820 --> 00:16:35,000 So when you're talking about censorship circumvention, there's kind of 2 flavors of strategies. 169 00:16:35,140 --> 00:16:44,660 There's the server side strategies, which just means that the server initiates or modifies or sends packets in some way to bypass the firewall. 170 00:16:45,040 --> 00:16:48,600 And so I'm just going to call this the simultaneous open bypass. 171 00:16:52,850 --> 00:16:54,030 All right. 172 00:16:54,590 --> 00:17:04,850 So, for the censorship circumvention strategy to work, the, your internal client has to coordinate with an external server. 173 00:17:05,270 --> 00:17:10,190 So this external client is somebody, you know, outside of Russia, for example. 174 00:17:10,210 --> 00:17:17,690 And so the way the strategy works is you'll have to send a SYN packet towards your internal vantage point. 175 00:17:18,170 --> 00:17:21,190 And the TSPU thinks it's in SYN sent state. 176 00:17:22,070 --> 00:17:25,870 If you'll notice that packet, it doesn't actually reach the client. 177 00:17:25,870 --> 00:17:27,750 So it is TTL limited. 178 00:17:28,330 --> 00:17:43,910 And that's significant because if it were to reach the client, then that client would send probably a reset ACK and it would reset the state of the connection from the TSPU's perspective and it would basically corrupt the state that we need to be in. 179 00:17:44,330 --> 00:17:47,490 And so the internal client then sends a SYN packet. 180 00:17:48,270 --> 00:17:51,530 And so this is from the TSPU's perspective, it's in SYN sent. 181 00:17:51,870 --> 00:18:00,930 But in reality, it's going to be, the states are going to be inconsistent between the TSPU and the actual connection end points. 182 00:18:01,750 --> 00:18:04,430 So then the web server is going to send a SYN ACK. 183 00:18:04,590 --> 00:18:06,750 TSPU thinks it's in SYN received. 184 00:18:07,530 --> 00:18:19,330 And then the client is going to send its last ACK and then it's going to actually make a request to your web server or to the recipe website or whatever. 185 00:18:19,970 --> 00:18:22,370 So I'm going to kind of skip over that for now. 186 00:18:22,370 --> 00:18:23,550 I'll get back to that in a second. 187 00:18:23,550 --> 00:18:31,230 But basically what that allows you to do is bypass the throttling that would normally happen. 188 00:18:33,010 --> 00:18:40,330 So there's some other security implications for some of this connection tracking stuff that I was telling you about. 189 00:18:41,430 --> 00:18:48,010 It turns out that you can use that to mess with VPNs as well. 190 00:18:48,590 --> 00:18:55,870 So we just presented a paper on some of these, some attacks that we had developed against VPNs. 191 00:18:55,870 --> 00:19:00,810 We developed an exploit primitive that we call the port shadow. 192 00:19:00,810 --> 00:19:06,230 And it basically allows you to port scan somebody behind a VPN. 193 00:19:06,230 --> 00:19:10,450 It allows you to de-anonymize or remove the encryption from the VPN. 194 00:19:10,610 --> 00:19:17,010 And it also allows you to basically reroute packets in really interesting ways. 195 00:19:17,010 --> 00:19:24,110 And in particular, it allows you to basically escalate from an adjacent position to in path. 196 00:19:24,290 --> 00:19:35,050 So this connection tracking stuff is actually like, it's super important and it has broad security implications that I think that's an important thing to understand. 197 00:19:35,130 --> 00:19:41,050 So here if you want to read more about the technical details of some of that stuff, just download the slides. 198 00:19:41,470 --> 00:19:44,350 There's the links to it. 199 00:19:45,890 --> 00:19:51,570 So I just finished, or I just kind of went over the server side bypass strategies. 200 00:19:52,610 --> 00:20:01,670 And while we were doing all of this analysis, we were, you know, sending TCP packets with different flags and in different sequences. 201 00:20:01,670 --> 00:20:05,730 And we kind of stumbled upon a client side bypass strategy. 202 00:20:05,730 --> 00:20:15,630 So with a client side bypass strategy, that means the client sends packets in some weird way to be able to bypass the firewall. 203 00:20:16,170 --> 00:20:24,250 And it turns out that if you send five acts in a particular order, you can also bypass the censorship. 204 00:20:25,330 --> 00:20:36,590 So to understand how, we're kind of, we have a hypothesis as to why it is five acts that allows for this type of behavior and it has to do with the TLS four way handshake. 205 00:20:37,570 --> 00:20:42,810 So let's just assume that you kind of, you already do your TCP three way handshake. 206 00:20:42,810 --> 00:20:46,910 The last act that the client sends, let's just count that as the first act. 207 00:20:46,910 --> 00:20:50,370 So that's act number one from the client to the server. 208 00:20:51,910 --> 00:20:58,590 And then when you initiate a TLS four way handshake, you're going to have to send what's called a client hello. 209 00:20:58,930 --> 00:21:02,770 And it's typically broken across at least two packets with acts. 210 00:21:02,970 --> 00:21:07,690 So that's going to be act number one, act number two and act number three. 211 00:21:07,690 --> 00:21:18,930 And then at that point, the TSP, when there's a TLS connection, it has to figure out how to block specific content. 212 00:21:18,930 --> 00:21:22,790 And typically it uses what's called SNI based filtering to do that. 213 00:21:22,790 --> 00:21:34,690 So the server name indication is plain text and that's what the TSP devices will use to basically fingerprint a connection and perform censorship. 214 00:21:35,850 --> 00:21:44,250 So then the web server, after it gets a client hello, it's going to send its own server hello. 215 00:21:44,830 --> 00:21:48,150 And that's basically just negotiating cryptographic parameters. 216 00:21:48,790 --> 00:21:51,510 And then the client is going to acknowledge that. 217 00:21:51,510 --> 00:21:53,210 So that's act number four. 218 00:21:54,250 --> 00:22:01,870 And then the web server is probably going to push data at that point and then the client of course is going to act those packets. 219 00:22:02,690 --> 00:22:05,570 And that's typically when censorship happens. 220 00:22:05,570 --> 00:22:10,490 So what we found, and again, this was pretty much just like serendipitous. 221 00:22:10,490 --> 00:22:12,010 It was completely accidental. 222 00:22:13,470 --> 00:22:18,390 What we found was that, let's just say you go through the regular TCP three way handshake. 223 00:22:18,990 --> 00:22:28,550 So we found that if you send one, two, three, four, five acts, and then you actually start your client hello. 224 00:22:29,230 --> 00:22:34,950 So client hello with the S&I that would normally be blocked. 225 00:22:36,330 --> 00:22:40,850 What we think is happening is that there's a buffer inside the TSP devices. 226 00:22:41,750 --> 00:22:46,810 And because of that, they need to buffer some amount of TCP packets with data in it. 227 00:22:46,810 --> 00:22:58,270 And because of that, there is, you know, it uses the fact that these are act packets with data to basically do the reassembly and check for an S&I to see whether or not it's blocked. 228 00:22:58,270 --> 00:23:01,150 And we think that this somehow disrupts the internal state. 229 00:23:01,810 --> 00:23:05,770 And that's why this client side bypass strategy works. 230 00:23:05,770 --> 00:23:07,590 That's our working theory. 231 00:23:08,150 --> 00:23:10,230 But yeah, it was just kind of interesting to see. 232 00:23:12,010 --> 00:23:16,690 So then, yeah, the client will, or the web server will send a server hello. 233 00:23:17,630 --> 00:23:24,290 Client is going to act that and the server is going to send some data, write your recipe that you wanted. 234 00:23:26,150 --> 00:23:28,710 And then there's no throttling. 235 00:23:28,710 --> 00:23:31,470 So we just, we thought that was really interesting, right? 236 00:23:31,470 --> 00:23:40,370 And like I said, our theory is that it's because there's a buffer and it needs to keep track of and do reassembly with those packets. 237 00:23:42,850 --> 00:23:48,810 So there's some emerging threats and challenges in this space. 238 00:23:49,670 --> 00:24:02,530 What I didn't talk about too much was the fact that a lot of people in Russia use VPNs, specifically shadow socks or similar fully encrypted protocols to bypass censorship. 239 00:24:04,250 --> 00:24:21,890 And in fact, if you try to download a VPN in Russia, they have issued, the Russian government has asked Google, Google play, Apple app store and other app store providers to remove VPNs from their, you know, from their offering for Russian citizens. 240 00:24:21,890 --> 00:24:22,430 So it's illegal. 241 00:24:22,430 --> 00:24:29,630 And it's also illegal to provide information about how to get around censorship. 242 00:24:30,350 --> 00:24:34,230 So this is a website called Apple censorship dot com. 243 00:24:34,230 --> 00:24:39,590 It's deployed by or maintained by the great fire project. 244 00:24:39,590 --> 00:24:45,790 So it's a nifty, nifty website for seeing what's blocked in various countries. 245 00:24:46,190 --> 00:24:48,810 They also have one for Google censorship. 246 00:24:48,950 --> 00:24:55,290 So you can see here there's VPNs that are not accessible in Russia or China. 247 00:24:57,310 --> 00:25:21,750 So this is created kind of an interesting, this is kind of created a market force where because there's VPNs are no longer, you know, legal to have in those countries, we're starting to see an increase in backdoored and malware, like VPNs with basically malware in them. 248 00:25:22,170 --> 00:25:33,130 There's a project called the domain name tools investigations and they actually have seen a surge in malware URLs for, for VPNs. 249 00:25:33,130 --> 00:25:44,710 And that's pretty consistent with, so this is, in this case it's , it's Chinese VPNs but my preliminary analysis of Russian based VPNs is kind of showing agreement with this. 250 00:25:45,870 --> 00:25:53,450 So if, if, if anyone is interested in kind of checking that, that work out by them, that, you know, go, you know, here's the, the URL for it. 251 00:25:55,190 --> 00:25:58,490 So what does that, what do backdoored VPNs look like? 252 00:25:58,490 --> 00:26:02,070 Well, here's an example that I worked on a little while ago. 253 00:26:02,370 --> 00:26:05,990 This VPN, it's called an accelerator, it's called Quafon. 254 00:26:06,430 --> 00:26:10,050 So here's the legitimate website for this app. 255 00:26:10,470 --> 00:26:12,190 That's its domain. 256 00:26:12,850 --> 00:26:21,010 And then here is the, the, basically the malicious website. 257 00:26:22,310 --> 00:26:23,830 So obviously they're different. 258 00:26:23,830 --> 00:26:29,210 If you look at their whois information, it's, it's going to be, it's going to be different, you'll know. 259 00:26:30,110 --> 00:26:40,010 And it turns out that when you start reverse engineering the APK for the malicious VPN, it's, for those of you who don't know, this is, this is obfuscation. 260 00:26:40,010 --> 00:26:42,190 There's some reflection going on. 261 00:26:42,210 --> 00:26:48,750 There's also the, the names of various strings and class names and method names are encrypted. 262 00:26:48,770 --> 00:26:50,150 So you can see that here. 263 00:26:50,150 --> 00:26:51,650 So those get decrypted. 264 00:26:51,650 --> 00:26:55,630 And then, and then it tries to load a shared library. 265 00:26:55,630 --> 00:26:59,570 This is actually a packer called Zhiguo. 266 00:26:59,570 --> 00:27:01,870 It's by Qiho 360. 267 00:27:01,870 --> 00:27:04,090 They're a big Chinese cyber security firm. 268 00:27:04,090 --> 00:27:09,170 And this is the, the packer that they use for, for obfuscating their apps. 269 00:27:09,750 --> 00:27:33,110 Um, so in addition to the, the like malicious VPNs, uh, there's also a threat that, um, some providers who you might think are legitimate are not fully transparent in terms of like who, um, who they're, like you don't, you, you might like, uh, look up, 270 00:27:33,110 --> 00:27:35,930 like do some research on, on who they are. 271 00:27:36,070 --> 00:27:42,830 Um, and on their website you will think, uh, that it's one company and then it turns out that it's another company. 272 00:27:42,830 --> 00:27:58,890 So actually, uh, uh, an organization by the name of the Tech Transparency Project, they uncovered, uh, recently connections between, um, several, uh, Chinese, uh, VPNs and, uh, the People's Liberation Army. 273 00:27:59,670 --> 00:28:03,110 And I was kind of working on some similar work at the time. 274 00:28:03,390 --> 00:28:13,710 Um, specifically there's, uh, VPNs that are pretty popular, uh, by one of them is called TurboVPN, but there's like three other VPNs, uh, from that report. 275 00:28:14,010 --> 00:28:27,130 But if you look, uh, so if you dig into their business records, if you go to, um, opencorporates.com and look up Innovative Connecting, you'll see that their copyright information is actually, shows that they're based out of, uh, Beijing. 276 00:28:27,190 --> 00:28:31,550 Uh, but if you were to look on their website or their Google Play profile, it says Singapore. 277 00:28:31,550 --> 00:28:38,990 So, and, and that information is not, uh, immediately obvious, uh, when you actually look, uh, look up this organization. 278 00:28:39,850 --> 00:28:42,170 Um, but it's actually worse than that. 279 00:28:42,170 --> 00:28:48,330 So it turns out, so I was reverse engineering these apps because we were really concerned about the transparency of these providers. 280 00:28:48,750 --> 00:28:52,390 Uh, and they use, uh, a tunneling protocol called Shadow Socks. 281 00:28:52,390 --> 00:28:56,370 Uh, Shadow Socks uses symmetric cryptography. 282 00:28:56,830 --> 00:29:05,310 And what's even worse is that, uh, in the case of these apps, they actually hard code the password into the APK. 283 00:29:05,670 --> 00:29:08,390 Um, so that's really bad, right? 284 00:29:08,390 --> 00:29:18,950 Like that basically means that anyone on the network who can, um, enumerate the IPs of the VPN servers can do, decrypt, uh, the traffic for these, for these particular VPNs. 285 00:29:18,950 --> 00:29:21,150 And that's exactly what I did. 286 00:29:21,350 --> 00:29:28,570 Uh, so that's, um, obfuscated traffic and then, oops, and then that's the decrypted version of the same traffic. 287 00:29:29,250 --> 00:29:43,030 And there's actually, in addition to the three VPNs from the tech transparency project, uh, reporting, uh, I also uncovered, uh, five other VPN providers that are all, they all appear to be linked to Chihuahua 360. 288 00:29:43,110 --> 00:29:45,210 Uh, I'm still working on confirming that. 289 00:29:45,210 --> 00:29:48,350 They're for sure, uh, controlled by a Chinese national. 290 00:29:48,490 --> 00:29:52,290 Uh, but that information's not disclosed. 291 00:29:52,350 --> 00:29:56,490 So there's a, uh, kind of a transparency issue with that. 292 00:29:56,490 --> 00:30:08,430 And the fact that they also use, uh, symmetric cryptography with, uh, hard coded passwords is, um, you know, a pretty big, pretty big security issue. 293 00:30:09,010 --> 00:30:12,830 So I just presented some of that work at a workshop called Folkeye. 294 00:30:12,830 --> 00:30:20,090 Uh, if you want to read about the technical details of that, um, that's the link to the, to the report there. 295 00:30:20,450 --> 00:30:32,970 Uh, and then one of the last, um, one of the last threats, uh, that, uh, is sort of an emerging thing is the, it seems like the Russian government is going towards whitelisting. 296 00:30:33,330 --> 00:30:35,630 And that's going to be a real challenge to get around. 297 00:30:36,110 --> 00:30:48,010 Uh, but in the interim, um, I was saying we found, we discovered, um, client side bypass strategies, right? 298 00:30:48,470 --> 00:30:56,170 Those are preferred to the server side bypass strategies because in the server side case, right, you need an external machine to sort of coordinate with. 299 00:30:56,370 --> 00:31:00,870 Uh, and that doesn't really work for big companies like Google, Twitter. 300 00:31:01,210 --> 00:31:04,950 Uh, and so really what you want are client side bypass strategies. 301 00:31:06,010 --> 00:31:19,770 But it doesn't really work for us to like test one vantage point and then just randomly discover, you know, accidentally techniques because it's really hard for us to be able to, uh, deploy those at scale. 302 00:31:20,370 --> 00:31:23,970 So it's kind of like a whack-a-mole scenario, right? 303 00:31:23,970 --> 00:31:27,630 We find one thing and then we might be able to tell one or two people and that's it. 304 00:31:27,630 --> 00:31:29,670 Like how do we, how do we scale this up? 305 00:31:30,730 --> 00:31:43,030 Well, there's fundamental design issues in, uh, network protocols and specifically in like things like stateful firewalls trying to track them. 306 00:31:43,510 --> 00:31:59,350 Uh, so you can think of those like cracks or chinks in the armor, uh, for the, uh, for the firewall and what we're basically trying to do now, what we're in the process of developing are, is essentially something like an embedded state machine that, um, 307 00:31:59,350 --> 00:32:03,730 can basically automatically discover new client side bypass strategies. 308 00:32:03,730 --> 00:32:05,790 I know there's some other work in this space. 309 00:32:05,850 --> 00:32:10,610 Uh, this is, uh, an example of, uh, TLA plus. 310 00:32:10,610 --> 00:32:11,790 It's a temporal logic. 311 00:32:11,790 --> 00:32:13,210 It's a logic programming language. 312 00:32:13,210 --> 00:32:35,710 But the idea is to use something like this to basically, uh, provide developers, uh, with, um, some means of automatically, uh, bypassing censorship, uh, without having to, um, without having to depend on end users having rooted devices, uh, or be, uh, 313 00:32:35,710 --> 00:32:36,610 super technical. 314 00:32:36,610 --> 00:32:44,950 You know, we, we want this to be something that anyone can use, uh, that developers can, uh, benefit from and, uh, yeah. 315 00:32:44,950 --> 00:32:47,770 So that's, that's kind of the direction things are going now. 316 00:32:48,510 --> 00:32:51,190 So, let's see. 317 00:32:53,570 --> 00:32:56,610 Kind of flew through the talk a little bit. 318 00:32:57,630 --> 00:33:01,830 Um, so I'm going to go, I'm going to, I have a demo now. 319 00:33:01,830 --> 00:33:19,270 This demo is not, um, it's basically just going over like how connection tracking works , um, and showing how even in the face of SNI based filtering, uh, how people are typically getting around that and just explaining some of the connection tracking stuff. 320 00:33:19,530 --> 00:33:30,850 So to, to do this, I, I, uh, installed this, um, this, uh, it's basically a, a network, uh, network filter, uh, module for doing SNI based filtering. 321 00:33:30,850 --> 00:33:35,590 Uh, so shout out to LockNair for writing that, uh, this cool module. 322 00:33:35,830 --> 00:33:38,850 So if anyone wants to check that out. 323 00:33:39,650 --> 00:33:40,610 Um. 324 00:33:52,000 --> 00:34:02,720 Okay, I'm going to run the, just an example of how, uh, a stateful firewall that does, uh, SNI based filtering, uh, could work just based on my observations. 325 00:34:02,720 --> 00:34:07,380 This is basically the topology I've got going on, uh, in my test environment. 326 00:34:07,780 --> 00:34:26,740 Um, so the TSP devices, effectively this, this device here, this NAT gateway, um, the, the target behind the TSP, uh, which would be like a Russian citizen, for example, is this some web client, whatever. 327 00:34:26,880 --> 00:34:33,540 Um, and to get to the internet, their traffic has to get routed through the NAT gateway or TSP. 328 00:34:33,960 --> 00:34:39,340 Uh, so I'm just going to show, uh, with and without, uh, SNI based filtering using that filter. 329 00:34:39,460 --> 00:34:43,060 Uh, and then I'm going to show, um, how things kind of currently work. 330 00:34:43,080 --> 00:34:52,980 Uh, I'm going to use open VPN in this example, but in reality, the TSP actually does block, uh, open VPN, uh, at least the vanilla version of that protocol. 331 00:34:53,140 --> 00:34:55,680 Uh, but this is just for illustrative purposes. 332 00:34:56,320 --> 00:35:07,280 So to get started, uh, I have several terminals open, uh, the upper or the, I'm sorry, left-hand side, uh, is the firewall or TSP device. 333 00:35:07,820 --> 00:35:10,560 So that's both of these, these terminals here. 334 00:35:10,740 --> 00:35:13,920 The upper right is going to be the VPN server. 335 00:35:14,440 --> 00:35:22,620 And then, uh, these two devices in the lower right are going to be, uh, the targets behind the TSP device. 336 00:35:23,740 --> 00:35:27,540 So, um, I'm just going to make sure my routes are correct. 337 00:35:27,560 --> 00:35:29,180 Real quick. 338 00:35:29,400 --> 00:35:38,700 Uh, so I want to do, I'm just going to, 339 00:35:41,890 --> 00:35:47,750 I just want to make sure I don't get all my SSH traffic. 340 00:35:47,830 --> 00:35:52,550 Uh, so I'm just going to download facebook.com real quick. 341 00:35:53,390 --> 00:35:54,010 Right. 342 00:35:54,010 --> 00:35:57,450 And so obviously that's getting routed through the TSP device. 343 00:35:57,450 --> 00:36:07,830 And if I look at the connection tracking table, uh, we should see, yep, there's Facebook's, um, IP address. 344 00:36:07,830 --> 00:36:15,170 And you'll see, uh, in the, uh, originator direction, this is the target's, uh, IP address. 345 00:36:15,170 --> 00:36:20,270 And that would be their public IP address in, in real life, whatever, um, whatever their ISP assigned to them. 346 00:36:20,350 --> 00:36:23,390 This is Facebook's destination IP address. 347 00:36:23,430 --> 00:36:30,510 Uh, and you can see this is the, in the originator direction, the source port, the destination port is going to be obviously 443. 348 00:36:30,510 --> 00:36:35,510 And then we have the, uh, contract information in the reply direction. 349 00:36:35,510 --> 00:36:41,510 So the connection tuples, uh, source sources and destination ports and IPs are, are flipped. 350 00:36:41,510 --> 00:36:47,410 Uh, in this case, the connection is in the assured state because packets have been sent in both directions. 351 00:36:48,690 --> 00:36:57,430 Um, and so now that that's taken care of, what I'm going to do is add a SNI based firewall rule. 352 00:36:57,430 --> 00:37:05,030 Uh, in this case, I'm just using a net filter, um, just for ease of demonstration. 353 00:37:05,290 --> 00:37:14,050 This is a, this is a custom module that, um, someone wrote and I'll post a link just to give credit where credit's due. 354 00:37:14,050 --> 00:37:17,850 Cause I thought this was really cool, um, implementation. 355 00:37:18,710 --> 00:37:29,010 So now that the SNI based net filter filtering is in place, we'll try to go ahead and get Facebook again. 356 00:37:29,010 --> 00:37:35,230 And I'm going to again dump, uh, the network interface. 357 00:37:36,850 --> 00:37:46,410 So obviously now, because the firewall is in path, it can drop any packets it wants, right? 358 00:37:46,670 --> 00:37:48,410 It doesn't have to do reset injection. 359 00:37:48,410 --> 00:37:53,130 It can just drop arbitrary packets and interfere pretty invasively that way. 360 00:37:55,430 --> 00:37:56,110 Okay. 361 00:37:59,550 --> 00:38:00,310 Right. 362 00:38:00,310 --> 00:38:12,550 So now that, uh, I've done that, what I want to do is, um, run a, run a VPN client. 363 00:38:12,790 --> 00:38:15,430 In this case, I'm going to do a client to config. 364 00:38:15,430 --> 00:38:16,650 There's no reason to do that. 365 00:38:16,670 --> 00:38:20,010 In particular, why I'm doing it that way. 366 00:38:20,750 --> 00:38:24,610 There we go. 367 00:38:25,230 --> 00:38:25,810 All right. 368 00:38:25,810 --> 00:38:27,970 So the connection's initiated. 369 00:38:27,970 --> 00:38:37,950 I do have to, uh, delete the current default route, which is through the, um, through the TSPU interface. 370 00:38:38,830 --> 00:38:44,090 And then I'm going to add a default route for the ton zero interface, which is 371 00:38:49,760 --> 00:38:54,500 the route add default dev. 372 00:38:55,600 --> 00:38:57,320 Okay. 373 00:38:57,500 --> 00:39:11,640 So now the not port two, cause I don't want my SSH traffic. 374 00:39:11,860 --> 00:39:19,280 So now, uh, when I do wget, uh, facebook.com, I should. 375 00:39:19,500 --> 00:39:20,700 Yep. 376 00:39:20,700 --> 00:39:21,780 So I got that. 377 00:39:23,740 --> 00:39:24,600 Okay. 378 00:39:24,600 --> 00:39:26,680 That looks right. 379 00:39:26,780 --> 00:39:32,220 Now I'm going to dump the, uh, connection tracking table again. 380 00:39:33,040 --> 00:39:36,920 Uh, this time we can see that old connection. 381 00:39:36,920 --> 00:39:48,960 These are old, uh, connection tuples from when, um, when the SNI firewall rule was in place originally, um, and couldn't get through. 382 00:39:49,240 --> 00:39:57,920 Uh, but you'll notice that, uh, for this particular connection tuple, um, where is it? 383 00:39:59,000 --> 00:40:15,900 There is, um, no, there's no entry for the current, uh, connection to Facebook, but there is a connection, uh, in the connection tracking table for the VPN connection. 384 00:40:15,900 --> 00:40:27,840 So anytime a connection traverses an in-path device in this way, the contract table is going to be populated with, um, these connection tracking entries. 385 00:40:28,420 --> 00:40:33,360 So that is how one would do SNI based filtering with net filter. 386 00:40:33,360 --> 00:40:42,580 You might implement some additional optimizations like using X data path or EBPF or, or some other, um, data plane toolkit. 387 00:40:42,580 --> 00:40:59,080 There's like DPDK for example, uh, or PF ring, or you might do it in hardware or something, but, um, hopefully this kind of gives you a sense for the, you know, how, how this would work for, um, at least in this case. 388 00:40:59,080 --> 00:40:59,940 So, yep. 389 00:40:59,940 --> 00:41:00,820 Thank you. 390 00:41:07,740 --> 00:41:09,020 Um, yeah. 391 00:41:09,020 --> 00:41:11,680 So that's pretty much, uh, that's pretty much what I got. 392 00:41:11,680 --> 00:41:14,880 Um, and that's my contact info. 393 00:41:15,380 --> 00:41:17,720 Uh, and, um, yeah. 394 00:41:17,760 --> 00:41:19,500 So thank you.