1 00:00:01,500 --> 00:00:06,260 Alright, welcome back and let's resume with the talks. 2 00:00:06,980 --> 00:00:11,280 Up next, we have the very famous Vivek Ramachandran. 3 00:00:11,760 --> 00:00:14,080 Now we all know who this personality is. 4 00:00:16,840 --> 00:00:20,840 He has over a decade's researching experience. 5 00:00:20,840 --> 00:00:23,880 He has done a lot of research with Wi-Fi security as well. 6 00:00:24,360 --> 00:00:31,120 He has identified attacks such as Caffe Latte attack, broken WPA encoding, and a lot more. 7 00:00:31,120 --> 00:00:37,520 He has been a regular speaker at premier conferences such as Black Hat and DEF CON. 8 00:00:38,640 --> 00:00:44,500 Now, his talk is with respect to identifying weaknesses in secure web gateways. 9 00:00:44,580 --> 00:00:52,620 At times, mitigating web-based initial access threats, enterprises deploy something called as a secure web gateway. 10 00:00:52,620 --> 00:01:07,980 And in this talk, he will explore on how to conduct reconnaissance against SVGs, identify the vendor and location, reconstruct the rules and policies applied, and identify bypasses based on these insights. 11 00:01:08,280 --> 00:01:17,000 He will also introduce a tool called as SVG Recon, a new tool in order to automate enumeration processes. 12 00:01:17,220 --> 00:01:24,960 This tool has been rigorously tested against all leading vendors in the market and has proven to be highly effective. 13 00:01:24,960 --> 00:01:27,060 Quite a good day for us to see this tool. 14 00:01:27,060 --> 00:01:36,700 So here, Vivek will be talking about how easy it is for an attacker to deploy JavaScript via their websites and deliver malware to enterprise browsers. 15 00:01:36,700 --> 00:01:43,380 So please welcome the founder of SquareX, the founder of Pentest Academy, Vivek Ramachandran. 16 00:01:48,500 --> 00:01:51,900 Thank you so much for that kind and sweet introduction. 17 00:01:52,360 --> 00:01:53,500 You said decade. 18 00:01:53,500 --> 00:01:54,860 I've been doing this two decades. 19 00:01:54,860 --> 00:01:56,820 I'm starting to get a bit dated now. 20 00:01:59,480 --> 00:02:01,880 So yeah, welcome to my talk. 21 00:02:01,880 --> 00:02:05,720 A bunch of great people as well, and they'll do an introduction shortly. 22 00:02:05,940 --> 00:02:07,900 So, SWG Recon. 23 00:02:08,360 --> 00:02:14,120 Today, I'm also doing a main stage talk later on SWGs and how they can be broken, track four. 24 00:02:15,060 --> 00:02:18,640 It's a continuation of this, so feel free to show up for that as well. 25 00:02:18,960 --> 00:02:22,120 Now, a little bit about myself. 26 00:02:22,520 --> 00:02:25,860 I started doing security almost 24 years back. 27 00:02:26,440 --> 00:02:32,200 Discovered a bunch of attacks, did my very first DEF CON main stage all the way back in 2007. 28 00:02:32,200 --> 00:02:34,000 It's almost 17 years. 29 00:02:34,740 --> 00:02:41,820 Founded a couple of companies, Pentest Academy, and now I run this company called SquareX where we do browser-native security. 30 00:02:43,260 --> 00:02:45,760 Also, I have a wonderful team. 31 00:02:46,040 --> 00:02:48,160 Most of the work was done by these guys. 32 00:02:50,700 --> 00:02:51,860 Hello, everyone. 33 00:02:51,860 --> 00:02:52,840 I'm Shorin. 34 00:02:52,840 --> 00:02:56,060 I work as a principal software engineer at SquareX. 35 00:02:56,260 --> 00:03:03,240 My research is mainly around extensions and we'll see how we're going to use extensions in this talk as well. 36 00:03:03,340 --> 00:03:10,740 My work has been published in Black Hat Europe before and I'm also giving a few more talks in this DEF CON. 37 00:03:14,640 --> 00:03:15,780 Hello, all. 38 00:03:15,780 --> 00:03:16,720 Happy to see you here. 39 00:03:16,720 --> 00:03:17,880 My name is Dakshita. 40 00:03:17,880 --> 00:03:20,960 I do help out with security research at SquareX. 41 00:03:20,960 --> 00:03:27,000 I've been here since the beginning of the company, so really happy to be part of the ride and happy to share this talk with you. 42 00:03:31,430 --> 00:03:34,170 And this was my co-speaker, Jesvin. 43 00:03:35,110 --> 00:03:41,370 Unfortunately, last-minute US immigration issues and he couldn't make it, so he says hi. 44 00:03:43,910 --> 00:03:46,530 Okay, so secure web gateways. 45 00:03:46,570 --> 00:04:04,470 I think if you look at web browsing in the enterprise today, you have sassy SSE solutions with secure web gateways and the promise that SWGs made that they could look at SSL traffic by doing SSL interception and then just by looking at the network traffic of HTML, 46 00:04:04,470 --> 00:04:08,230 CSS, and JavaScript, figure out application layer attacks. 47 00:04:08,850 --> 00:04:14,270 Anyone here uses SWGs, as they're called, in their enterprise? 48 00:04:14,270 --> 00:04:15,530 Okay, someone? 49 00:04:15,530 --> 00:04:16,890 Okay, just one. 50 00:04:17,690 --> 00:04:27,350 Now, for the purpose of this talk, I'm basically using SWG as a collective term for a lot of security controls which exist with it. 51 00:04:27,710 --> 00:04:31,450 SSL interception, malware detection, DLP, firewall. 52 00:04:31,710 --> 00:04:38,770 So for the talk purpose, all of these components are working together and that's what we are going to go ahead and see how we can recon. 53 00:04:39,770 --> 00:04:41,730 Now, how do SWGs work? 54 00:04:41,730 --> 00:04:51,990 So if you look at a standard file download, what ends up happening is, let's say a user whose computer's traffic is going through the SWG ends up clicking on a link. 55 00:04:52,250 --> 00:04:56,610 There's a HTTP content disposition header which kind of, you know, shows up. 56 00:04:56,730 --> 00:05:15,030 The SWG figures out with that and maybe a couple of other metrics that this is an active file download and then the SWG will either cache it in the cloud, wait for the whole file to be cached, run an AV scan, or it'll start allowing the download while it is analyzing. 57 00:05:15,430 --> 00:05:20,670 And based upon if it feels this is bad, then it'll end up blocking or killing the download in between. 58 00:05:21,210 --> 00:05:38,630 Now similarly for files, or rather websites, if there is a malicious website with HTML, CSS, JavaScript, and maybe it figures that out that this is a clone or a spear phishing website, it'll try to fingerprint that and if you just took that very same website, 59 00:05:38,630 --> 00:05:44,710 put it up on a new domain, typically SWGs will block it or at least that is the promise. 60 00:05:47,780 --> 00:05:55,220 Now from an attacker's perspective, I think browser is a very, very interesting component. 61 00:05:55,360 --> 00:06:12,560 Especially in today's world where hybrid work is happening, your entire workforce is traveling, and really the browser has become the gateway or the access to all your enterprise as well as resources on the internet which your team ends up using. 62 00:06:12,560 --> 00:06:31,440 And that is really where from an attacker's perspective, being able to smuggle malware, malicious files, spear phishing websites, all of that through a secure web gateway which is analyzing all of that traffic in between is very important and crucial. 63 00:06:31,460 --> 00:06:43,880 So because this is the recon village, the entire focus here is hey, could an attacker with absolute zero knowledge figure out if all the traffic is going through a SWIG? 64 00:06:44,080 --> 00:06:48,260 And if yes, what kind of policies, rules, etc. 65 00:06:48,260 --> 00:06:49,600 have been applied, right? 66 00:06:49,600 --> 00:06:52,820 So of course, this talk is just 40-45 minutes. 67 00:06:52,820 --> 00:06:56,960 So I'm going to talk about some of the more interesting use cases. 68 00:06:57,320 --> 00:07:03,680 And at the very end, we'll actually leave you with a GitHub repo where you can download and try this tool out. 69 00:07:03,990 --> 00:07:07,280 And where we plan to cover a lot of other cases. 70 00:07:07,440 --> 00:07:13,220 Much more fine-grained analysis which unfortunately, in such a short talk is very difficult to cover. 71 00:07:13,980 --> 00:07:23,700 So when you look at SWIG enumeration of all the rules and policies, primarily we've kind of broken it down for the purpose of this talk into 5 categories. 72 00:07:23,880 --> 00:07:28,900 The first is vendor detection which is, can you figure out who the vendor is? 73 00:07:29,500 --> 00:07:38,000 I was telling the organizers it's fairly incidental that we have a sassy SSE vendor who is also a sponsor of the recon village. 74 00:07:39,960 --> 00:07:46,880 After the vendor detection is done, how do you figure out what kind of category-based web filtering is applied? 75 00:07:47,160 --> 00:07:51,220 The allowed file types, file sizes, a couple of other things. 76 00:07:51,720 --> 00:07:56,780 And beyond that, if you guys are interested, feel free to show up for the 5pm talk today. 77 00:07:58,680 --> 00:08:02,020 Okay, so identifying SWIG vendors. 78 00:08:02,020 --> 00:08:04,740 Let's have Dakshita run us through it. 79 00:08:06,440 --> 00:08:12,820 First we'll see how we're going to identify which SWIG is being used. 80 00:08:13,000 --> 00:08:14,920 Primarily we do it through two methods. 81 00:08:14,920 --> 00:08:17,500 First is to check for the IP range. 82 00:08:17,760 --> 00:08:19,980 And secondly is to check for connectivity. 83 00:08:20,220 --> 00:08:24,660 Once we've done both of these checks, we kind of know who the vendor is. 84 00:08:24,760 --> 00:08:47,220 If we take a look at how this works, we're just going to send a request and the request will go through the secure web gateway to this website called api.ipapi.is and this essentially gives a JSON response and this response contains the IP address where we can then figure out the ASN, 85 00:08:47,220 --> 00:08:51,040 the organization, and from this way we can figure out who the vendor is. 86 00:08:51,200 --> 00:08:53,000 This is pretty straightforward here. 87 00:08:56,160 --> 00:09:04,160 So just to add to that, SWIG vendors have to have very massive data centers, right, where all of this scrubbing is going on. 88 00:09:04,160 --> 00:09:14,720 And most of the time these data centers are so big and so geographically distributed that you actually see dedicated ASNs for certain vendors. 89 00:09:14,860 --> 00:09:32,740 And most of these IP address ranges are also published many times on the vendor website itself and because all the traffic goes through the proxy, if an attacker were to set up a website where he can basically ping or use one of the open kind of IP pinging services, 90 00:09:32,740 --> 00:09:37,840 it's very easy for him to go ahead and figure out what IP address range is there. 91 00:09:38,200 --> 00:09:48,220 Honestly, there are probably 7 or 8 SWIG vendors in the whole world through which most of the traffic ends up going and this makes it fairly easy to fingerprint. 92 00:09:48,520 --> 00:09:51,480 At the very end of the talk, we'll show you some demos. 93 00:09:51,700 --> 00:09:55,620 Again, the whole idea here is to be vendor agnostic, not to name and shame. 94 00:09:55,940 --> 00:10:00,540 So we'll try not to go ahead and show vendor logos and things like that, right? 95 00:10:00,700 --> 00:10:03,760 Of course, also don't want to get sued. 96 00:10:05,820 --> 00:10:09,640 Okay, so Shaury will talk about the URL categories. 97 00:10:13,110 --> 00:10:24,470 Okay, so just to add one more thing, so you know, sometimes it might happen that the secure web gateways might not actually be sending the traffic from a specific IP or an ASN. 98 00:10:24,470 --> 00:10:28,690 They might also use some sort of a cloud service or they might also use something else. 99 00:10:28,690 --> 00:10:33,450 So in that case, our logic will basically fall back to the connectivity endpoints. 100 00:10:33,450 --> 00:10:41,430 So generally, secure web gateways also have some connectivity endpoints which you can actually call to see whether the secure web gateway is connected or not. 101 00:10:41,450 --> 00:10:49,450 So we have an exhaustive list of those endpoints and using that also, we can figure out which vendor it is in case the ASN check doesn't work. 102 00:10:49,790 --> 00:10:53,170 Now coming back to the allowed URL categories. 103 00:10:53,390 --> 00:11:02,190 So what happens is that typically one of the first policies that any enterprise setup is that what kind of websites are allowed in the network. 104 00:11:02,430 --> 00:11:06,830 Now these can basically be, for example social networking is allowed or not, right? 105 00:11:06,830 --> 00:11:09,010 Or it can be like sports websites allowed or not. 106 00:11:09,090 --> 00:11:15,790 So this is like a very basic check that most people do to filter out what kind of traffic can actually open in the enterprise network. 107 00:11:15,870 --> 00:11:21,630 Now as an attacker, it can actually be helpful as well to get in the system and we'll see how that can be. 108 00:11:21,770 --> 00:11:27,970 So before doing that, we'll see how we can actually recon what kind of categories are allowed in the network. 109 00:11:28,550 --> 00:11:33,330 So typically, you know, there are a lot of different categories. 110 00:11:33,370 --> 00:11:36,870 There is an exhaustive list of categories that Swig supports. 111 00:11:37,070 --> 00:11:39,990 Many of them are also available in their documentation. 112 00:11:40,390 --> 00:11:45,190 Now what we're going to do is that we have a list of URLs. 113 00:11:45,330 --> 00:11:49,610 These URLs fall under different categories and we're going to do a similar thing. 114 00:11:49,610 --> 00:11:57,350 We're going to call all these endpoints from the given device and see which of them are basically opening and which of them are not opening. 115 00:11:57,670 --> 00:12:06,950 Now if in case it gets blocked, we know that based on the policy of the enterprise, this specific category is not allowed to be opened. 116 00:12:07,110 --> 00:12:08,950 Now how do we figure that out? 117 00:12:09,090 --> 00:12:13,690 So typically when you open a webpage , there's an HTTP status code that is written. 118 00:12:13,810 --> 00:12:26,550 So in case it comes out as 200, and that is something we have made sure in the list that whatever endpoint we are hitting or whatever URL we are hitting, generally gives a 200 when it's allowed to be opened. 119 00:12:26,610 --> 00:12:37,810 So in case it's getting blocked by the SWIG, in that case, they'll send like a 4xx response or they'll send a redirect response with a 3xx series. 120 00:12:38,150 --> 00:12:43,390 So whenever we get a status code similar to that, there's a good chance that it's actually being blocked. 121 00:12:43,850 --> 00:12:59,270 In some cases, like this was a possible thought we had, that there might be some vendors who might actually return a 2xx instead of doing a 3xx or 4xx, but at least in the run that we did for any of the major vendors, we did not find that. 122 00:12:59,450 --> 00:13:04,090 However, a possible solution for that could actually be to look at the content text. 123 00:13:04,090 --> 00:13:09,710 Because typically the block page text of a given vendor might be quite similar. 124 00:13:09,950 --> 00:13:17,370 So we can, in case we get a 2xx response, we can look at the HTML content of that page and see if it is something related to a block page. 125 00:13:17,470 --> 00:13:22,490 So in that way, we can also cover cases in case a vendor gives a 2xx response. 126 00:13:23,150 --> 00:13:31,850 Now , similar to that, there are also some common categories which often can be used by attackers. 127 00:13:32,030 --> 00:13:36,110 For example, what kind of domains are allowed? 128 00:13:36,170 --> 00:13:40,150 Sometimes there might be a recently registered domain, whether they're allowed or not. 129 00:13:40,210 --> 00:13:43,190 And there can also be things like a free hosting website. 130 00:13:43,790 --> 00:13:50,530 We have seen cases where people have running phishing campaigns which are typically hosted on any of the online blog pages. 131 00:13:50,530 --> 00:13:53,410 Because they have an older domain, they have a good reputation. 132 00:13:53,410 --> 00:13:55,350 And they often are allowed in the network. 133 00:13:55,490 --> 00:14:00,290 So these checks that we have made, make sure to also open all these categories. 134 00:14:01,010 --> 00:14:07,490 Now, let's say you understood what categories are allowed after the recon. 135 00:14:07,730 --> 00:14:16,030 Now, taking a step further, if we want to see how an attacker can leverage what kind of categories are allowed, we can look at these four different ways. 136 00:14:16,070 --> 00:14:20,530 So the first one is that let's say I go ahead and I register a new domain. 137 00:14:20,710 --> 00:14:25,290 And I figure out that my domain is basically a very new domain. 138 00:14:25,490 --> 00:14:33,130 Now, there are pages of specific SWIG vendors where you can actually go and submit your domain for a classification check. 139 00:14:33,490 --> 00:14:40,890 Now, typically what vendors start with is a categorization based on a domain, rather than doing it on a whole URL. 140 00:14:40,890 --> 00:14:46,110 So I'll do a submission first, making sure that my page looks for a given category. 141 00:14:46,170 --> 00:14:54,530 And once that submission is done, after a while I will simply add a phishing page or a malicious page in a given subdomain. 142 00:14:54,610 --> 00:15:01,230 So for a good period of time, your SWIG will still categorize it as that specific domain which it previously categorized as. 143 00:15:01,450 --> 00:15:07,530 So it's one of the ways you can actually leverage the knowledge of what kind of category is supported in a malicious way. 144 00:15:07,530 --> 00:15:11,530 The other one I already mentioned, you can also use free hosting websites. 145 00:15:11,910 --> 00:15:21,950 One other way is that if you know that a specific category was missed out by the admin in the configuration, you can actually register a domain in that specific category. 146 00:15:22,310 --> 00:15:28,650 And you can have a specific plan to open a certain category of domains in that specific network. 147 00:15:28,990 --> 00:15:35,370 Similarly, one of the most missed out events could also be if recently registered domains are allowed. 148 00:15:35,370 --> 00:15:42,250 Because in some cases, when a domain is very recently registered, they might give an NA or uncategorized response. 149 00:15:42,250 --> 00:15:47,950 So if in case the admin has not set a policy, it can be a very easy way to get into the system. 150 00:15:48,870 --> 00:15:50,710 Now, we'll look at... 151 00:15:50,710 --> 00:15:51,990 Yeah. 152 00:15:53,290 --> 00:16:03,510 So one funny quirk is, which we found with some vendors, is you can buy a new domain and just redirect that domain to a well-known one. 153 00:16:03,510 --> 00:16:08,750 So let's say you buy xxxwhatever.com and just redirect that to yahoo.com. 154 00:16:08,750 --> 00:16:17,030 A lot of swigs today end up following the redirection and by default place you in the same bucket as yahoo.com. 155 00:16:17,250 --> 00:16:23,970 So this is as crazy as it sounds, but in some of the tests that we ran, we actually found this. 156 00:16:28,000 --> 00:16:28,740 Okay. 157 00:16:28,740 --> 00:16:32,840 So now we'll look at a bit about the file types. 158 00:16:32,860 --> 00:16:40,840 Sometimes a certain category of files might also be allowed or not allowed in a given organization based on the policies. 159 00:16:42,560 --> 00:16:46,920 So Vivek will now take this up and show how different vendors set this up. 160 00:16:48,780 --> 00:16:53,520 So this was the part which was the most interesting when we started doing this research. 161 00:16:54,080 --> 00:17:00,540 By the way, this is based upon the public documentation available today on all swig vendors. 162 00:17:00,940 --> 00:17:08,120 Now, you won't believe, there are swig vendors who can only scan up to 15 megabits of file size. 163 00:17:08,860 --> 00:17:26,240 So, literally, if a malware author wanted to go ahead and get this bypassed, all he has to do is have a file size larger, and unless the organization is blocking all files above 15 megs, he can easily bypass that thing. 164 00:17:26,240 --> 00:17:28,700 Now, why is this limitation there, right? 165 00:17:28,700 --> 00:17:32,540 So when we were doing this research, I was thinking, well, why would you want to do this? 166 00:17:32,540 --> 00:17:36,720 Like, today you have so much of memory CPU available in the cloud. 167 00:17:37,040 --> 00:17:39,400 Why have these crazy limitations? 168 00:17:39,880 --> 00:17:42,700 By the way, one of the vendors is also at 2 megs. 169 00:17:43,900 --> 00:17:44,860 Unbelievable. 170 00:17:46,060 --> 00:17:55,580 Now, our hypothesis here is, look, anytime you have to do a deep analysis of a large file, you need to throw a lot of CPU and memory at it, right? 171 00:17:55,580 --> 00:18:00,700 So now imagine a swig vendor who's looking at millions of requests per second. 172 00:18:00,700 --> 00:18:15,540 If they had to go through hundreds of thousands of files and push a lot of CPU memory at it to do that analysis, I don't think you can actually offer your swig or sassy SSE product at $2 to $3 a month per endpoint. 173 00:18:15,620 --> 00:18:22,740 It is just cost prohibitive to go ahead and run such large and in-depth analysis in the cloud. 174 00:18:23,100 --> 00:18:28,320 So if you look at it, file scanning size limits, that's a pretty big one. 175 00:18:28,780 --> 00:18:39,560 And most of the time in our tests, if you just go above it, unless the organization is blanket-blocking everything above a certain size, your malware, whatever you have, would just kind of go through. 176 00:18:40,100 --> 00:18:42,940 The second is file type scanning. 177 00:18:43,160 --> 00:18:46,200 There's massive variation here as well. 178 00:18:46,880 --> 00:18:53,500 Also, a lot of web-native compiled versions of files aren't looked at. 179 00:18:53,500 --> 00:18:55,560 How many of you have heard of WebAssembly? 180 00:18:55,560 --> 00:18:56,540 Wasm. 181 00:18:56,900 --> 00:19:09,160 So you can go about compiling so much of interesting logic into a Wasm module, which is really binary for what it's worth, gets loaded by the browser, runs in the context of the browser. 182 00:19:09,160 --> 00:19:14,920 At this point in time, you could literally write an entire credential stealer in Wasm if you so wanted. 183 00:19:15,260 --> 00:19:17,560 Unfortunately, swigs can't look at it. 184 00:19:17,700 --> 00:19:19,860 They can't look at images. 185 00:19:19,880 --> 00:19:22,620 Now, why could images be interesting? 186 00:19:22,620 --> 00:19:26,680 Come to our talk in the main stage talk today at 5pm. 187 00:19:26,700 --> 00:19:35,080 We'll look at how you can actually hide malware and do something called last-mile reassembly to pick malware out and just drop it in the browser. 188 00:19:36,860 --> 00:19:38,520 Zip recursion levels. 189 00:19:38,520 --> 00:19:40,920 This one was the most interesting. 190 00:19:41,940 --> 00:19:50,080 If you basically have zip files placed recursively, a lot of vendors, unfortunately, cannot scan beyond a few steps. 191 00:19:50,080 --> 00:19:53,860 Some of them actually blatantly just allow it to go through. 192 00:19:54,500 --> 00:19:57,660 And as i said, this is public documentation. 193 00:19:57,660 --> 00:20:00,580 This is not something we tested against different vendors. 194 00:20:01,040 --> 00:20:03,200 Again, there's no need to name and shame. 195 00:20:03,500 --> 00:20:06,060 We just call them swig vendor A to E. 196 00:20:11,310 --> 00:20:14,670 So we tested a bunch of different file types. 197 00:20:14,670 --> 00:20:18,950 So all we did is put all of them on an S3 bucket and went ahead to download it. 198 00:20:18,970 --> 00:20:22,390 And we'll basically see whether this download goes through or not. 199 00:20:22,390 --> 00:20:25,430 So if we get a 200 okay, that means it went through. 200 00:20:25,430 --> 00:20:31,210 So this is how we figure out whether certain file types has been blocked, whether there's been certain policies set up. 201 00:20:31,210 --> 00:20:41,830 So usually what happens is that if swig is not able to scan it, then the admin generally has a policy, can set a policy to say block it completely or just let it pass through. 202 00:20:41,830 --> 00:20:47,850 So this way we can figure out what are the different file types that can go through without being blocked. 203 00:20:48,730 --> 00:20:50,770 So what can we say from this? 204 00:20:50,770 --> 00:20:58,010 So popular file formats like images, audio, videos, generally they are allowed because they tend to be harmless. 205 00:20:58,010 --> 00:21:02,610 But there is many different ways you can hide malware and embed them within it. 206 00:21:02,610 --> 00:21:04,010 So we can use that. 207 00:21:04,010 --> 00:21:05,570 The attackers can use that. 208 00:21:05,690 --> 00:21:08,070 And archives are generally allowed as well. 209 00:21:08,070 --> 00:21:09,630 And they have limited capabilities. 210 00:21:09,630 --> 00:21:13,830 Swigs generally do not scan archives as in-depth as they should. 211 00:21:13,830 --> 00:21:22,590 So we can transform the content, maybe do recursive zipping and so on and find ways to deliver this to the client side. 212 00:21:22,590 --> 00:21:27,430 Password protected zips are also pretty questionable ones. 213 00:21:27,430 --> 00:21:36,130 So if you password protect some content, if the swig is by default not blocking this, you can get it through to the victim. 214 00:21:36,470 --> 00:21:38,050 Finally, office file formats. 215 00:21:38,050 --> 00:21:40,170 So this one is a pretty interesting one. 216 00:21:40,230 --> 00:21:44,710 So there are a few ways we can embed malware through office file formats. 217 00:21:44,710 --> 00:21:51,070 One is definitely through macros, which is the active content within the office files. 218 00:21:51,130 --> 00:22:02,930 Additionally, because the more recent office file formats are actually a zip, so the OXML formats are actually zip, they can actually compress really large file sizes within them. 219 00:22:02,930 --> 00:22:07,590 So you can embed pretty large malware within the office file and zip it up. 220 00:22:07,590 --> 00:22:09,570 So that is one way we can bypass it as well. 221 00:22:09,570 --> 00:22:13,490 And of course, you can password protect your office document, which anybody can do. 222 00:22:13,490 --> 00:22:16,030 And that's another way that we can bypass this. 223 00:22:19,450 --> 00:22:30,910 So I think one of the other things we saw was SWIGs and even endpoint security exceptionally bad at looking at malicious office documents with macros in it. 224 00:22:31,270 --> 00:22:33,550 It's unbelievably bad. 225 00:22:33,790 --> 00:22:35,790 So, EXCs has been pretty good. 226 00:22:35,790 --> 00:22:39,190 I think, you know, most folks have evolved their whole EXC analysis. 227 00:22:39,250 --> 00:22:43,850 You know, static dynamic, there are so many threat feeds and what not. 228 00:22:43,910 --> 00:22:46,090 Office documents, we were surprised. 229 00:22:46,090 --> 00:22:48,030 I mean, this is all about SWIGs. 230 00:22:48,030 --> 00:22:50,150 Maybe we'll do one on endpoint security. 231 00:22:50,310 --> 00:22:55,990 But very, very surprised at how easy it is to kind of go ahead and subvert. 232 00:22:59,660 --> 00:23:07,600 So now we'll look at how we can check what are the different kinds of file size limits enforced by the policy. 233 00:23:07,840 --> 00:23:15,980 So often, what people do is they simply block any kind of downloads which are happening greater than or less than a given file size. 234 00:23:15,980 --> 00:23:20,480 So as part of the recon, it's also good to know what kind of file sizes are actually supported. 235 00:23:20,920 --> 00:23:25,680 It's also very similar to how we were checking different file, supported file types. 236 00:23:25,700 --> 00:23:31,500 So we basically have a bunch of files of different different sizes of a given category. 237 00:23:31,500 --> 00:23:35,120 So let's say I have like five, six different files of Word documents. 238 00:23:35,180 --> 00:23:39,980 And then I will basically categorize them into small size, medium size, and large size. 239 00:23:40,100 --> 00:23:45,540 And then when I upload those files in a given endpoint, or let's say if I try to download them. 240 00:23:45,540 --> 00:23:48,240 So in this case, we're going to download that file. 241 00:23:48,280 --> 00:23:52,580 We'll see what kind of file sizes are allowed to be downloaded. 242 00:23:52,940 --> 00:23:58,420 So to know if a file download is successful, we, again, do the same thing. 243 00:23:58,420 --> 00:24:01,300 We see if the status check is coming out as 200. 244 00:24:01,520 --> 00:24:09,560 In some cases, we saw that often vendors return a 200 status, but there's a file size mismatch. 245 00:24:09,760 --> 00:24:18,240 So they basically send back a file, but it is not the same as what we were initially requesting, because they scanned it, and they found it to be malicious, for example. 246 00:24:18,500 --> 00:24:26,960 So in those cases, what we're going to do is, we're going to use the file hash, compare them, because we are downloading these files from our own bucket. 247 00:24:26,960 --> 00:24:28,860 We know what are the file hashes. 248 00:24:28,860 --> 00:24:33,300 We compare that, and through that, we can know if the download was successful or not. 249 00:24:33,480 --> 00:24:42,240 So through the 200 status check, as well as the file hash check, we are able to do this recon on what kind of file sizes are actually supported. 250 00:24:43,620 --> 00:24:47,460 Now, let's say I know what kind of file sizes are supported. 251 00:24:47,460 --> 00:24:49,960 Now, as an attacker, how can I use that? 252 00:24:50,060 --> 00:24:54,900 So one of the most common ways of doing that would be actually to break files into different chunks. 253 00:24:55,500 --> 00:25:03,640 I can actually break a particular file, break it into chunks, and then I have another client-side script running, which can stitch everything together. 254 00:25:03,800 --> 00:25:11,480 So it's one of the ways such kind of recon can help an attacker to deliver a malicious file in a given device. 255 00:25:11,780 --> 00:25:18,120 Similar to how Dakshita mentioned earlier, you know, even the newer office formats are actually zip files. 256 00:25:18,120 --> 00:25:21,380 So you can put some malicious files inside them as well. 257 00:25:21,700 --> 00:25:24,420 Similarly, large image sizes. 258 00:25:24,420 --> 00:25:30,360 Sometimes, you know, people often don't put a limit on things like images. 259 00:25:30,460 --> 00:25:40,300 And if an admin misses out on such a policy, you can actually use something like technography to, you know, put some sort of malicious file within an image itself. 260 00:25:40,300 --> 00:25:44,920 So it will look like a legit image format, but it can actually have a malicious file. 261 00:25:45,040 --> 00:25:49,460 And then at the client-side, you can again take that malicious file outside your given image. 262 00:25:49,940 --> 00:26:00,540 Similarly, you know, like any kind of web resource, like HTML, JavaScript, WebAssembly, all these can also be used to actually embed a malicious file. 263 00:26:02,080 --> 00:26:09,220 Now we'll look at, you know, now we'll look at how we can also identify the unmonitored channels. 264 00:26:12,480 --> 00:26:15,220 Yeah, so this one is interesting. 265 00:26:15,800 --> 00:26:24,800 I think the promise that SWIX came up with is, you know, we are going to monitor all traffic coming in from a user's browser, probably from an endpoint. 266 00:26:24,880 --> 00:26:27,460 But the web is evolving really fast, right? 267 00:26:27,460 --> 00:26:38,160 Like, large vendors like Google and everybody, right from the browser's perspective, new protocol's perspective, there's leaps and bounds in which, you know, new things are coming up. 268 00:26:38,160 --> 00:26:56,060 And this is really very interestingly, today SWIX are unable to monitor unbelievably anything which goes through WebSockets, because WebSockets is binary streams anyway, so you can actually smuggle through things via WebSocket and completely evade SWIX detection today. 269 00:26:56,360 --> 00:27:07,900 Similarly, protocols like gRPC, WebRTC, WebTransport, SSC, WebPush protocols, unbelievably, all of these are completely unmonitored at this point in time. 270 00:27:07,900 --> 00:27:15,020 So, you really do not need to send a malicious file through your regular HTTP. 271 00:27:15,020 --> 00:27:18,660 You can just go about using one of these, and there is full bypass. 272 00:27:18,940 --> 00:27:28,180 As crazy as it sounds, a lot of SWIX vendors recommend that you actually block these protocols on the browser. 273 00:27:29,380 --> 00:27:44,860 But if you block these, the overall seamlessness with which the web loads live, let's say, any form of audio stream and all of that, there is perceptible loss in the user's experience. 274 00:27:45,000 --> 00:27:48,560 But at this point in time, these channels are completely unmonitored. 275 00:27:53,170 --> 00:28:02,110 So, you can actually go about smuggling various things through it, different kind of documents and all of that, and I think Shaurya can explain more about it. 276 00:28:02,110 --> 00:28:06,190 Yeah, so, it's pretty simple. 277 00:28:06,370 --> 00:28:12,030 What we're going to do here is we're going to actually download a given file through one of these channels. 278 00:28:12,030 --> 00:28:17,090 By doing so, we can figure out what channels admin has missed out on the policy. 279 00:28:17,230 --> 00:28:23,230 So, like Vivek mentioned, most of the time, these vendors recommend to block these kind of protocols. 280 00:28:23,310 --> 00:28:34,870 So, in case an admin has missed out on these policies, during this recon, we can actually find out which particular channel, which is usually unmonitored, is allowed based on the policy. 281 00:28:35,230 --> 00:28:43,150 So, we have different types of files, and we're going to just download them through all of these different newer protocols. 282 00:28:44,350 --> 00:28:48,070 Now, the next one is identifying the DLP policies. 283 00:28:52,910 --> 00:29:02,370 One of the interesting things I wanted to mention about these unmonitored channels is in a lot of enterprises, now you have managed browsers. 284 00:29:02,370 --> 00:29:07,850 You can manage your Chrome, Edge, and there's a bunch of ways to go about doing it. 285 00:29:08,010 --> 00:29:22,830 So, in the recon, even though the SWIG itself isn't really doing anything here, you can actually figure out if some of these protocols were blocked on the browser side itself, and that kind of shows that probably the enterprise is using some kind of managed browser solution. 286 00:29:24,270 --> 00:29:24,890 Okay. 287 00:29:24,930 --> 00:29:26,670 DLP is very interesting. 288 00:29:26,850 --> 00:29:41,870 I think, again, the same promise, when a file is getting uploaded, you can go about running regular expressions, other pattern matching, and all of that, and then figure out if something is admissible, inadmissible, allow or block it. 289 00:29:41,910 --> 00:29:52,710 And this is really where it's very easy for an attacker to go about simulating a file upload from the user's perspective, and try to enumerate various DLP policies. 290 00:29:53,010 --> 00:30:14,150 Now, if an attacker, in one of the earlier enumerations, figures out the exact vendor name, and of course, you know, most nation state attackers or more sophisticated ones would have access to the products as well, it is actually possible to build out very granular DLP testing policies based upon who the vendor is, 291 00:30:14,150 --> 00:30:15,030 by the way. 292 00:30:15,110 --> 00:30:31,930 For the purpose of this talk, we've tried to keep it generic, but with understanding of who the vendor is, you can literally figure out every way that they currently allow you to slice and dice DLP policies, and go about creating tests for that, which can run entirely by the client. 293 00:30:35,150 --> 00:30:35,830 Okay. 294 00:30:35,930 --> 00:30:41,230 So, the different ways by which you can go about deploying this, i think Shaury will take over that. 295 00:30:42,130 --> 00:30:49,350 Primarily, just to give you a high level, is, one is an attacker-controlled website, and the other is through a malicious extension. 296 00:30:52,350 --> 00:30:52,770 Yeah. 297 00:30:52,850 --> 00:31:11,170 So, the reason for using an extension here, is because, you know, since we have a bunch of URL categories, and a bunch of URLs, it's not possible for a single attacker to go ahead and buy all these domains, and update all the course policies. 298 00:31:11,170 --> 00:31:16,730 So, we're going to use extensions here, because extensions are highly privileged inside the browser. 299 00:31:16,750 --> 00:31:27,210 So, if you're making a request from the background script or service worker, as it's called now, you will actually be able to make calls without having any kind of course restrictions. 300 00:31:27,310 --> 00:31:38,350 So, this would make the whole recon process quite easy, because you can actually have a huge list of URLs of different categories, and actually call them up from an extension. 301 00:31:38,910 --> 00:31:52,070 In case, you know, installing an extension is not an option, then of course you can fall back to a normal attacker-controlled website as well, and from that you can also make this request, but in that case you will have to take care of the course restrictions. 302 00:31:52,910 --> 00:31:58,130 Also, you know, if it's happening through an extension, it happens very silently. 303 00:31:58,350 --> 00:32:05,790 So, that's also very convenient for an attacker, in case, you know, he's able to install some sort of an extension through any kind of social engineering measures. 304 00:32:05,810 --> 00:32:12,170 Like, for example, you know, let's say ChatGPT releases a new version, and you just ask them, you know, hey, can I get access to that? 305 00:32:12,170 --> 00:32:17,650 And people are going to search online, and they'll see, oh, there's an extension, which is allowing a free access to that. 306 00:32:17,650 --> 00:32:22,550 They install it on their computer, and you can have your recon process running from there, in the background. 307 00:32:22,710 --> 00:32:28,410 Since there is no tab open, if you are doing it from the background strip, it's way more convenient for an attacker. 308 00:32:28,470 --> 00:32:37,770 So, both these methods are available, but for this talk, what we are going to use is an extension, because it's much more convenient for any kind of lifting the course restrictions. 309 00:32:40,770 --> 00:32:51,890 So, the important thing you have to understand is, you can do this with an attacker-controlled website, minus the URL category one. 310 00:32:51,890 --> 00:32:59,750 And the only reason is, I mean, of course, you as an attacker could also set up all of these different URL categories, and then you don't need an extension as well. 311 00:32:59,890 --> 00:33:05,450 All the other recons that we've shown can actually happen through an attacker-controlled website, right? 312 00:33:05,830 --> 00:33:07,690 So, that's an important distinction. 313 00:33:07,690 --> 00:33:13,990 It's just, how much does an attacker want to invest in setting up, you know, his whole backend infrastructure? 314 00:33:14,410 --> 00:33:15,030 Okay. 315 00:33:15,110 --> 00:33:17,970 So, Shoray will show you guys a quick demo. 316 00:33:17,970 --> 00:33:23,950 The important thing is, we will release this tool on GitHub, and you can go get it after the talk. 317 00:33:24,430 --> 00:33:30,550 Of course, for purposes of the talk, if you do live enumeration, you will end up seeing a lot of vendor names. 318 00:33:31,110 --> 00:33:33,070 How many of you want to see vendor names? 319 00:33:34,730 --> 00:33:35,850 No way. 320 00:33:37,530 --> 00:33:40,130 So, for the purpose of the talk, it's a video. 321 00:33:40,130 --> 00:33:41,870 I hate doing that, you know. 322 00:33:41,870 --> 00:33:44,570 I did my very first talk at DEF CON in 2007. 323 00:33:44,570 --> 00:33:46,050 Always did live ones. 324 00:33:46,830 --> 00:33:54,090 But there's a threatscape beyond the attack, which is the legal threatscape, so I want to be sure to navigate that well as well. 325 00:33:54,270 --> 00:34:04,750 So, we'll show you a video demo, but I guess much of it is, you know, fairly logical, and then hey, on GitHub, pick up the tool, try it out, you know, on your own. 326 00:34:07,460 --> 00:34:08,160 Okay. 327 00:34:08,160 --> 00:34:17,100 So, in this video, we will see a real recon running in an environment where a SWG vendor is present. 328 00:34:17,280 --> 00:34:25,040 For the purpose of this recon, there are a few policies which I want to let you all know was actually configured there. 329 00:34:25,200 --> 00:34:34,400 So , the web sockets and the web socket over SSL, both of these were blocked on the network of the enterprise where this recon was running. 330 00:34:34,400 --> 00:34:41,520 At the same time, all kinds of files which are greater than 500 KB were blocked. 331 00:34:41,880 --> 00:34:46,040 Similarly, a DLP policy was actually set for credit card numbers. 332 00:34:46,040 --> 00:34:50,000 So, there was no DLP policy set for social security numbers. 333 00:34:50,000 --> 00:34:51,780 So, this is how it looks like. 334 00:34:52,760 --> 00:34:58,300 So, you know, what we are going to do is, we are going to simply go ahead, open an extension page. 335 00:34:58,300 --> 00:35:04,480 So, if you see on the top, once you have the extension installed, you can actually access an extension page. 336 00:35:04,480 --> 00:35:06,240 So, I open this extension page. 337 00:35:06,240 --> 00:35:08,680 The purpose of showing this is via a UI. 338 00:35:08,960 --> 00:35:16,060 All these checks are actually running on the background strip, so you don't even have to open this extension page if you are using it in a real environment. 339 00:35:16,540 --> 00:35:21,520 So, I'm just going to go and show how it happens when you click on start analysis. 340 00:35:22,060 --> 00:35:26,800 So, it's going to do a bunch of these checks at the same time on different sites. 341 00:35:26,800 --> 00:35:31,680 So, you can see on the top left, you can see on the top left, 342 00:35:36,430 --> 00:35:40,850 yeah , so on the top left, the vendor was basically identified, but we have blurred this out. 343 00:35:41,670 --> 00:35:52,350 Similarly, all these kinds of enumerations are running, and we are able to see that what kind of protocols are basically allowed in the network, what kind of categories are being allowed. 344 00:35:52,390 --> 00:35:59,810 So, we can see the whole enumeration thing is running, and we are seeing that what is the status code we are getting for each of the URLs we are trying it out with. 345 00:35:59,990 --> 00:36:04,710 So, as I mentioned before, in this particular admin policy, the WebSockets were blocked. 346 00:36:04,710 --> 00:36:10,110 So, we can see that it's appearing as a cross, while the other ones are unable and showing as a check. 347 00:36:10,110 --> 00:36:21,030 So, we can see that in this case, certain kind of categories got blocked, some got partially blocked, and some got completely blocked. 348 00:36:21,110 --> 00:36:34,250 So, the partially blocked implies that certain URLs, so this can also happen that some URLs might have multiple categories, and some of them might get blocked under a different category. 349 00:36:34,270 --> 00:36:38,010 So, in that case, those will basically fall under the partially one. 350 00:36:38,010 --> 00:36:50,530 Similarly, we can see what is happening when we are uploading different kinds of DLP, check the DLP policies, we are uploading files which have social security numbers, or the files which have credit card numbers. 351 00:36:50,670 --> 00:36:59,830 So, this gives a very good view of what kind of file types are supported, what kind of file sizes are supported, and what kind of protocols are supported. 352 00:37:00,690 --> 00:37:06,450 Also, to mention, like I mentioned before, any file greater than 500 KB was blocked. 353 00:37:06,450 --> 00:37:13,330 So, you can see here that in the file size check, all the files which are greater than 500 KB are actually getting blocked. 354 00:37:14,750 --> 00:37:27,310 So, this is how the tool would look like, and once the whole recon is done, you can see the whole list of different categories, the different subcategories, and simple check marks to show what is supported and what is not. 355 00:37:27,790 --> 00:37:33,050 So, now we'll just quickly see how we can prepare ourselves for using this tool. 356 00:37:33,190 --> 00:37:35,190 So, this is the GitHub repo link. 357 00:37:35,890 --> 00:37:39,470 It's a simple Chrome extension, Chromium -based extension. 358 00:37:39,470 --> 00:37:42,990 You can run it over Brave, Chrome browser, any of them. 359 00:37:43,150 --> 00:37:47,750 You simply have to follow the instructions on the readme on how to build the extension. 360 00:37:47,990 --> 00:37:54,530 Once you have the extension built, you have to load this extension in your browser in the developer mode. 361 00:37:54,570 --> 00:38:00,550 The moment you do that, you will be able to access that extension page, and you will be able to run the whole recon. 362 00:38:06,110 --> 00:38:07,190 Thank you so much. 363 00:38:07,190 --> 00:38:08,090 Any questions? 364 00:38:08,090 --> 00:38:09,490 Anyone has any questions? 365 00:38:09,770 --> 00:38:12,950 I don't know if you have time to take questions. 366 00:38:13,290 --> 00:38:14,770 Organizers, anyone? 367 00:38:17,090 --> 00:38:18,510 Yeah, okay. 368 00:38:26,560 --> 00:38:27,640 Okay. 369 00:38:28,040 --> 00:38:38,020 So, we have a main stage talk today at 5 p.m., where we're going to talk about an entire new class of attacks, which we call Last Mile Reassembly. 370 00:38:38,020 --> 00:38:44,220 And we'll show you how those attacks primarily target the architecture of secure web gateways. 371 00:38:44,680 --> 00:38:55,860 We show over 25 bypasses, but honestly, based upon that entire attack genre that we plan to introduce, you can go about extrapolating and building many more attacks. 372 00:38:55,860 --> 00:39:01,180 So, if this was interesting, definitely track 4, 5 p.m., please do come. 373 00:39:01,180 --> 00:39:01,680 Yeah? 374 00:39:01,680 --> 00:39:03,000 Thank you so much. 375 00:39:03,000 --> 00:39:03,820 Thank you.