1 00:00:03,980 --> 00:00:09,160 This is Second Breakfast, Implicit and Mutation-Based Serialization Vulnerabilities in .NET. 2 00:00:10,000 --> 00:00:12,960 I'm Jonathan Birch. I hack Office for Microsoft. 3 00:00:13,420 --> 00:00:15,680 And if you want to talk to me about this presentation... 4 00:00:15,680 --> 00:00:20,640 I'm Jonathan Birch. I hack Office for Microsoft. 5 00:00:21,020 --> 00:00:25,720 If you want to talk to me about this presentation or anything else security-related, please contact me on Mastodon. 6 00:00:26,840 --> 00:00:33,160 In this talk, I'm going to explain remote code execution vulnerabilities I found in several .NET NoSQL engines. 7 00:00:33,420 --> 00:00:36,780 I'll talk about what I'm calling a mutation-based serialization vulnerability. 8 00:00:37,160 --> 00:00:42,360 I'll explain how you can bypass serialization binders and how you can defend against all of that. 9 00:00:42,520 --> 00:00:44,620 Also some bonus stuff just for DEF CON at the end. 10 00:00:46,160 --> 00:00:49,820 So a lot of my day job is doing security design reviews. 11 00:00:50,120 --> 00:00:54,140 I have a bunch of meetings every week where I'm looking at data flow diagrams, 12 00:00:54,340 --> 00:00:54,960 telling people, 13 00:00:55,720 --> 00:00:56,920 look this way instead, that kind of thing. 14 00:00:57,240 --> 00:00:59,820 And something I do in those meetings anymore to sort of add value 15 00:00:59,820 --> 00:01:02,760 is I'll just open up their repo that I've never seen before 16 00:01:02,760 --> 00:01:05,000 and spend like a half hour while I'm talking to them 17 00:01:05,000 --> 00:01:08,280 figuring out what are the actual vulnerabilities here so I can talk to them about that too. 18 00:01:09,180 --> 00:01:13,460 And so the research that led to this talk happened because last fall 19 00:01:13,460 --> 00:01:17,060 I saw an article on a certain orange-colored website about LightDB. 20 00:01:17,440 --> 00:01:21,140 And it's a .NET open source library for a NoSQL engine. 21 00:01:21,240 --> 00:01:24,660 I thought, okay, you know, I'll just go do a security review of their repo. 22 00:01:24,660 --> 00:01:27,560 And so when I did that, I saw this code. 23 00:01:27,960 --> 00:01:32,260 And what jumps out to me in this code specifically is this line, 24 00:01:32,460 --> 00:01:35,620 this call to type get type that's being passed a string. 25 00:01:35,900 --> 00:01:38,560 And to me at least, that's a really bad sign. 26 00:01:39,140 --> 00:01:40,780 But why is that a bad sign? 27 00:01:41,000 --> 00:01:48,280 So type get type in .NET is used to convert a string that's like the name of a .NET type 28 00:01:48,280 --> 00:01:50,080 into an actual type object. 29 00:01:50,640 --> 00:01:54,100 And what that means is that someone's going to be giving you 30 00:01:54,100 --> 00:01:56,680 the name of a type generally for an object you're going to create. 31 00:01:57,000 --> 00:01:59,620 So they're telling you what kinds of objects you're creating, 32 00:01:59,800 --> 00:02:02,500 which means they're telling you essentially what code you're going to run. 33 00:02:02,980 --> 00:02:05,400 And that means that if someone malicious comes along, 34 00:02:05,600 --> 00:02:08,260 they give you a malicious type name, and you're running malicious code. 35 00:02:09,420 --> 00:02:11,400 And so how does that show up in LightDB? 36 00:02:12,640 --> 00:02:16,520 Well, LightDB is a NoSQL engine, and generally when an application is using it, 37 00:02:16,580 --> 00:02:18,920 it's just saying to LightDB, store this object I've got. 38 00:02:19,200 --> 00:02:21,840 And maybe at this index with these properties, that kind of thing. 39 00:02:22,220 --> 00:02:24,080 And what LightDB is doing is 40 00:02:24,100 --> 00:02:25,160 it's going to put that in a file, 41 00:02:25,260 --> 00:02:29,500 so it serializes it with a serializer called BSON mapper into a BSON stream, 42 00:02:29,700 --> 00:02:31,900 and stores that BSON stream in a file. 43 00:02:32,060 --> 00:02:34,140 And when the application wants the object back, 44 00:02:34,360 --> 00:02:37,660 it deserializes that BSON back into an object again. 45 00:02:38,200 --> 00:02:40,640 So BSON is just a binary encoding of JSON, 46 00:02:40,860 --> 00:02:43,100 so you can take that file LightDB makes, 47 00:02:43,600 --> 00:02:44,820 decode it back into JSON, 48 00:02:44,980 --> 00:02:46,380 and if you do that, it looks about like this. 49 00:02:47,100 --> 00:02:49,080 And if you look at this JSON here, 50 00:02:49,720 --> 00:02:52,340 it's got this underscore type key in it, 51 00:02:52,420 --> 00:02:54,080 and after that, 52 00:02:54,100 --> 00:02:55,960 it's got the name of an actual .NET type. 53 00:02:56,320 --> 00:02:58,500 So what LightDB is doing with type get type, 54 00:02:58,700 --> 00:03:00,360 is it's taking that type name, 55 00:03:00,540 --> 00:03:02,280 it's passing it to type get type 56 00:03:02,280 --> 00:03:04,820 to actually create the object during that deserialization. 57 00:03:05,200 --> 00:03:07,960 So the data in that BSON is telling LightDB 58 00:03:07,960 --> 00:03:09,460 what types it's going to make. 59 00:03:09,780 --> 00:03:13,300 And that means that this is just a polymorphic serializer behind the scenes, 60 00:03:13,480 --> 00:03:15,680 and that means it's got all of the classic vulnerabilities 61 00:03:15,680 --> 00:03:17,400 that polymorphic serializers have. 62 00:03:17,960 --> 00:03:20,280 But let's explain a little bit what I'm talking about there. 63 00:03:20,540 --> 00:03:22,460 So .NET serialization vulnerabilities. 64 00:03:23,600 --> 00:03:25,600 .NET serialization vulnerabilities generally happen 65 00:03:25,600 --> 00:03:27,560 because you have a polymorphic serializer. 66 00:03:27,680 --> 00:03:29,800 A serializer where the data is telling you 67 00:03:29,800 --> 00:03:31,040 what type it wants to be. 68 00:03:31,380 --> 00:03:33,000 So in this case, we've got a box, 69 00:03:33,120 --> 00:03:34,320 it's some self-describing data, 70 00:03:34,440 --> 00:03:35,980 it says it's a cat, it's labeled cat. 71 00:03:36,400 --> 00:03:37,960 When your serializer sees that label, 72 00:03:38,000 --> 00:03:39,740 it says, well I guess I'm making a cat object, 73 00:03:39,940 --> 00:03:40,960 and it just makes a cat object, 74 00:03:41,120 --> 00:03:43,600 and then sets some properties from the contents of that box. 75 00:03:44,020 --> 00:03:45,480 And the problem with this is, 76 00:03:45,560 --> 00:03:46,800 someone malicious can come along, 77 00:03:46,980 --> 00:03:48,440 and give you a box labeled pain, 78 00:03:48,760 --> 00:03:51,440 your serializer says, well I guess I'm making some pain then, 79 00:03:51,440 --> 00:03:52,960 and you're having a bad time. 80 00:03:55,700 --> 00:03:58,220 So, if you want a little more information in general 81 00:03:58,220 --> 00:04:00,580 on how .NET serialization works, 82 00:04:01,140 --> 00:04:03,680 as far as for those sorts of serialization exploits, 83 00:04:03,740 --> 00:04:06,160 I suggest looking at the Friday the 13th JSON talks 84 00:04:06,160 --> 00:04:07,360 from Black Hat 17. 85 00:04:09,500 --> 00:04:11,160 But, I'll also give you a few examples 86 00:04:11,160 --> 00:04:12,840 of what this pain is here. 87 00:04:13,060 --> 00:04:15,800 So, in general when I'm talking about pain here, 88 00:04:15,860 --> 00:04:17,400 what I'm talking about is types that were, 89 00:04:17,540 --> 00:04:19,160 if you tell an application to create them, 90 00:04:19,320 --> 00:04:20,800 they're going to have side effects 91 00:04:21,440 --> 00:04:22,700 that can further exploit goals, 92 00:04:22,940 --> 00:04:24,200 either when you call their constructor, 93 00:04:24,260 --> 00:04:25,040 set their properties, 94 00:04:25,220 --> 00:04:26,180 maybe the destructor, 95 00:04:26,360 --> 00:04:28,320 will do something that you want to have happen. 96 00:04:28,820 --> 00:04:30,220 Here's a couple of classic ones, 97 00:04:30,460 --> 00:04:32,560 assembly installer has a path property, 98 00:04:32,740 --> 00:04:33,740 when you set the path property, 99 00:04:33,940 --> 00:04:36,340 it just calls load library on whatever path you give it. 100 00:04:36,660 --> 00:04:38,680 So, if you've been able to drop a malicious DLL 101 00:04:38,680 --> 00:04:39,700 on a server somewhere, 102 00:04:39,940 --> 00:04:41,620 you're going to be able to do DLL injection. 103 00:04:42,040 --> 00:04:44,200 It turns out that if you give it an HTTP URL, 104 00:04:44,480 --> 00:04:46,900 it will actually go and request the file from that URL, 105 00:04:47,080 --> 00:04:47,720 it won't load it, 106 00:04:47,840 --> 00:04:50,080 but this is still really useful for getting ping backs, 107 00:04:50,180 --> 00:04:51,360 if you're attacking a server somewhere. 108 00:04:52,120 --> 00:04:56,440 Object data provider is sort of the more classic RCE gadget 109 00:04:56,980 --> 00:04:58,100 for .NET serialization. 110 00:04:58,260 --> 00:05:00,600 It's got properties where if you set the properties on it, 111 00:05:00,680 --> 00:05:03,320 you can call any static method on any type in .NET 112 00:05:03,320 --> 00:05:05,700 with whatever string and integer parameters you want. 113 00:05:05,880 --> 00:05:07,860 So, people usually call process.start 114 00:05:07,860 --> 00:05:09,240 just to pivot the shell injection. 115 00:05:10,240 --> 00:05:12,960 Okay, so that's how .NET serialization vulnerabilities work. 116 00:05:13,180 --> 00:05:14,420 Now, I'll go back to LightDB 117 00:05:14,420 --> 00:05:15,800 and explain what I'm calling 118 00:05:15,800 --> 00:05:17,520 implicit serialization vulnerabilities. 119 00:05:18,260 --> 00:05:21,080 So, here's a remote code execution exploit for LightDB. 120 00:05:21,080 --> 00:05:23,780 If you look at this JSON blob here, 121 00:05:23,920 --> 00:05:26,340 this is going to be the JSON we're going to put into LightDB. 122 00:05:26,620 --> 00:05:28,540 It's got that underscore type key 123 00:05:28,540 --> 00:05:30,140 where it's telling you what type it wants to be. 124 00:05:30,360 --> 00:05:32,060 It's going to be an object data provider. 125 00:05:32,220 --> 00:05:35,460 That's that gadget that lets you call any static method you want. 126 00:05:35,560 --> 00:05:37,760 We're going to call process.start and launch calc. 127 00:05:38,660 --> 00:05:40,520 And all we're going to do with this JSON 128 00:05:40,520 --> 00:05:41,820 is convert it to BSON 129 00:05:41,820 --> 00:05:44,640 and then pass it into BSON mapper to deserialize it. 130 00:05:45,340 --> 00:05:48,700 It's worth noting that when you call the BSON mapper's deserialized method, 131 00:05:48,920 --> 00:05:50,420 you tell it what type you expect, 132 00:05:50,420 --> 00:05:51,620 and it does not matter. 133 00:05:52,760 --> 00:05:57,180 So, LightDB will actually respect the type the data says it wants to be. 134 00:05:57,300 --> 00:05:58,920 It'll go make it. It'll set its properties. 135 00:05:59,800 --> 00:06:01,780 Your serialization exploit gadget will run. 136 00:06:02,000 --> 00:06:04,100 It will then try to do a cast that will fail 137 00:06:04,100 --> 00:06:05,800 and probably throw an exception, but it doesn't matter. 138 00:06:05,900 --> 00:06:06,820 Your code is already run. 139 00:06:08,160 --> 00:06:10,580 So, going back to how LightDB works. 140 00:06:11,200 --> 00:06:14,620 If you remember, LightDB uses BSON mapper to read its own storage. 141 00:06:14,880 --> 00:06:18,340 So, the problem here is that anything that can put malicious data 142 00:06:18,340 --> 00:06:19,440 in the database file 143 00:06:20,420 --> 00:06:20,880 will not achieve RCE. 144 00:06:21,760 --> 00:06:24,060 It's also worth noting that when a client's using LightDB, 145 00:06:24,240 --> 00:06:26,200 they don't know they're using a serializer, probably. 146 00:06:26,460 --> 00:06:28,560 They're almost never going to call BSON mapper directly. 147 00:06:29,280 --> 00:06:32,260 So, this is an implicit serialization vulnerability. 148 00:06:32,720 --> 00:06:35,660 The client is vulnerable to the serialization that's in LightDB, 149 00:06:35,820 --> 00:06:37,420 even though they're not using the serializer. 150 00:06:37,480 --> 00:06:38,160 LightDB is. 151 00:06:38,780 --> 00:06:41,340 And this makes that client vulnerable in a lot of ways. 152 00:06:41,860 --> 00:06:44,740 First of all, LightDB, when it stores a database file, 153 00:06:44,800 --> 00:06:45,860 it just stores a local file. 154 00:06:46,120 --> 00:06:48,100 So, a lot of applications use LightDB 155 00:06:48,100 --> 00:06:49,920 just to write document formats, 156 00:06:50,420 --> 00:06:51,600 or save files for games. 157 00:06:51,980 --> 00:06:54,460 So, if you provide someone a document or a file 158 00:06:54,460 --> 00:06:55,640 that they're reading with LightDB, 159 00:06:55,900 --> 00:06:58,020 you can put an RCE payload in there, 160 00:06:58,100 --> 00:06:59,380 and it will run code when they open it. 161 00:07:00,260 --> 00:07:01,900 LightDB is a NoSQL engine. 162 00:07:02,020 --> 00:07:03,000 It also has queries, 163 00:07:03,060 --> 00:07:05,000 which means you can achieve query injection, 164 00:07:05,320 --> 00:07:07,880 and then you can put a malicious record in the database, 165 00:07:08,080 --> 00:07:10,120 and when someone reads that record, you've got RCE. 166 00:07:10,880 --> 00:07:13,400 And there's one extra special exploit technique 167 00:07:13,400 --> 00:07:15,160 I figured out for this that I'll come back to. 168 00:07:15,980 --> 00:07:18,880 So, what do you do when you find a remote code execution vulnerability 169 00:07:18,880 --> 00:07:20,320 in a major open source library? 170 00:07:20,420 --> 00:07:22,900 Well, you look at all the other libraries that are like it 171 00:07:22,900 --> 00:07:24,100 and find the same vulnerability there. 172 00:07:24,440 --> 00:07:26,720 So, here's essentially the same vulnerability 173 00:07:26,720 --> 00:07:27,560 in MongoDB. 174 00:07:29,060 --> 00:07:30,540 So, here's a JSON payload. 175 00:07:31,280 --> 00:07:33,180 It's got this underscore T key. 176 00:07:33,340 --> 00:07:35,160 That's the type specifier Mongo uses. 177 00:07:35,260 --> 00:07:36,780 That's the way the data says 178 00:07:36,780 --> 00:07:37,820 what type it wants to be. 179 00:07:38,100 --> 00:07:40,100 We're again making an object data provider. 180 00:07:40,840 --> 00:07:43,280 We're going to again call process.start 181 00:07:43,280 --> 00:07:44,040 and launch calc. 182 00:07:44,420 --> 00:07:46,320 And again, all we're going to do with this 183 00:07:46,320 --> 00:07:48,000 is convert it into BSIN 184 00:07:48,000 --> 00:07:49,920 and then deserialize it 185 00:07:50,420 --> 00:07:52,520 with the BSIN serializer that MongoDB uses. 186 00:07:53,040 --> 00:07:54,460 Now, it's worth noting that 187 00:07:54,460 --> 00:07:56,480 you also tell the BSIN serializer 188 00:07:56,480 --> 00:07:57,380 what type you expect, 189 00:07:57,580 --> 00:07:58,840 and that does matter. 190 00:07:59,120 --> 00:08:02,080 So, in MongoDB, it will actually check 191 00:08:02,080 --> 00:08:03,800 that the type the data says it wants to be 192 00:08:03,800 --> 00:08:06,360 is assignable to the type it's expecting to get 193 00:08:06,360 --> 00:08:07,840 before it creates it. 194 00:08:08,060 --> 00:08:09,780 So, if you want to exploit MongoDB, 195 00:08:09,960 --> 00:08:11,620 you have to find something in the data structure 196 00:08:11,620 --> 00:08:14,280 the application's expecting that's open-ended 197 00:08:14,280 --> 00:08:16,400 so you can fit a serialization gadget into it. 198 00:08:16,620 --> 00:08:18,400 That said, it's almost always there. 199 00:08:18,640 --> 00:08:20,140 When I've looked at applications that use 200 00:08:20,420 --> 00:08:21,460 BSIN databases, there's almost always 201 00:08:21,460 --> 00:08:23,360 either an interface member on something 202 00:08:23,360 --> 00:08:25,420 or just a member of type object 203 00:08:25,420 --> 00:08:26,300 that's like a catch-all. 204 00:08:26,580 --> 00:08:28,260 And so you just put your serialization gadget 205 00:08:28,260 --> 00:08:30,360 in that slot, and you still have RCE. 206 00:08:31,960 --> 00:08:35,020 Because MongoDB again uses this BSIN serializer 207 00:08:35,020 --> 00:08:36,040 to read its own database, 208 00:08:36,980 --> 00:08:38,520 it means that anything that puts 209 00:08:38,520 --> 00:08:39,840 malicious data in the database 210 00:08:39,840 --> 00:08:41,060 gets your remote code execution. 211 00:08:42,320 --> 00:08:44,260 MongoDB uses a client-server 212 00:08:44,260 --> 00:08:46,340 kind of architecture most of the time. 213 00:08:46,460 --> 00:08:48,320 So you can have one malicious client 214 00:08:48,320 --> 00:08:50,040 that talks to the database, puts a bad record 215 00:08:50,420 --> 00:08:52,100 in there, some other client reads that you're 216 00:08:52,100 --> 00:08:53,320 running code on that other client. 217 00:08:53,840 --> 00:08:55,960 You can also do, again, query injection. 218 00:08:56,920 --> 00:08:58,420 I will say that I was only 219 00:08:58,420 --> 00:09:00,580 able to exploit the .NET driver for MongoDB, 220 00:09:00,740 --> 00:09:01,620 not Java or Python. 221 00:09:01,860 --> 00:09:04,320 I won't say you can't, just that I couldn't 222 00:09:04,320 --> 00:09:05,120 figure out how to do it. 223 00:09:07,340 --> 00:09:08,440 And then we're 224 00:09:08,440 --> 00:09:09,980 going to move on to yet another remote code 225 00:09:09,980 --> 00:09:11,680 execution vulnerability for yet another 226 00:09:11,680 --> 00:09:13,900 NoSQL engine. This one is RavenDB. 227 00:09:14,400 --> 00:09:16,380 So, once again, we've got a JSON payload. 228 00:09:16,980 --> 00:09:18,360 This one, the type it 229 00:09:18,360 --> 00:09:20,280 says it wants to be is a Windows identity 230 00:09:20,420 --> 00:09:22,140 Windows identity is a 231 00:09:22,140 --> 00:09:24,420 JSON.NET RCE 232 00:09:24,420 --> 00:09:26,200 serialization gadget. I suggest looking at 233 00:09:26,200 --> 00:09:28,080 YSOSerial for details of how it works. 234 00:09:28,440 --> 00:09:30,280 But essentially, it lets you pivot to a 235 00:09:30,280 --> 00:09:32,260 binary formatter payload, which you 236 00:09:32,260 --> 00:09:33,120 then use to get RCE. 237 00:09:34,380 --> 00:09:36,340 And in this case, what we're going to do 238 00:09:36,340 --> 00:09:38,320 with this payload is we're just going to actually 239 00:09:38,320 --> 00:09:39,980 make a connection to the database server 240 00:09:39,980 --> 00:09:42,280 and then do a put request to stick the JSON 241 00:09:42,280 --> 00:09:42,800 in the database. 242 00:09:44,240 --> 00:09:46,360 So RavenDB lets you interact with the 243 00:09:46,360 --> 00:09:48,420 database in two ways. You can read or write 244 00:09:48,420 --> 00:09:50,400 JSON to it, or you can read or write 245 00:09:50,420 --> 00:09:52,340 objects from it. And so what 246 00:09:52,340 --> 00:09:54,200 you can do is if you put malicious JSON 247 00:09:54,200 --> 00:09:56,040 in the database and it's read as an object, 248 00:09:56,120 --> 00:09:58,120 that gets you RCE. Now, 249 00:09:58,180 --> 00:10:00,180 it's worth noting here, again, that 250 00:10:00,180 --> 00:10:01,880 the type that's being expected 251 00:10:02,420 --> 00:10:04,580 matters. There's an assignability 252 00:10:04,580 --> 00:10:06,100 check like there was in MongoDB, 253 00:10:06,600 --> 00:10:07,440 and so 254 00:10:08,160 --> 00:10:10,360 you have to actually have some way to fit 255 00:10:10,360 --> 00:10:12,320 your payload into the expected types. 256 00:10:13,580 --> 00:10:14,060 This, 257 00:10:14,200 --> 00:10:15,900 again, is an implicit serialization vulnerability 258 00:10:15,900 --> 00:10:18,460 because RavenDB is just using JSON.NET 259 00:10:18,460 --> 00:10:20,100 with unsafe settings to read its own storage. 260 00:10:20,420 --> 00:10:22,360 So anything that puts bad data in the database 261 00:10:22,360 --> 00:10:24,180 gets you RCE. And 262 00:10:24,180 --> 00:10:26,180 that special attack pattern that I mentioned 263 00:10:26,180 --> 00:10:28,020 for LightDB works here also. 264 00:10:30,900 --> 00:10:32,280 And I looked at some 265 00:10:32,280 --> 00:10:34,180 things that were NoSQL but not strictly 266 00:10:34,180 --> 00:10:36,260 databases. So here is a remote code 267 00:10:36,260 --> 00:10:37,820 execution vulnerability for 268 00:10:38,230 --> 00:10:40,380 servicedac.redis. Servicedac.redis 269 00:10:40,380 --> 00:10:41,820 is sort of a NoSQL 270 00:10:42,350 --> 00:10:43,700 wrapper for a Redis cache. 271 00:10:44,200 --> 00:10:46,340 So here we've got some JSON. It says 272 00:10:46,340 --> 00:10:48,380 what type it wants to be. In this case it's 273 00:10:48,380 --> 00:10:50,240 saying it's going to be an assembly installer. That's that one 274 00:10:50,420 --> 00:10:52,160 that lets you call load library on an arbitrary path. 275 00:10:52,640 --> 00:10:54,280 We're just going to say I dropped a malicious 276 00:10:54,280 --> 00:10:55,800 DLL somewhere for it to read. 277 00:10:56,300 --> 00:10:58,160 And then what we're going to do with this JSON 278 00:10:58,160 --> 00:10:59,920 is we're going to stick it in the Redis cache 279 00:10:59,920 --> 00:11:02,280 and then read it back. So when we stick 280 00:11:02,280 --> 00:11:04,020 the JSON in the Redis cache as JSON, 281 00:11:04,460 --> 00:11:06,300 it's just JSON, but when you read it back as 282 00:11:06,300 --> 00:11:08,320 an object using servicedac.redis, 283 00:11:08,460 --> 00:11:10,220 it's going to turn into whatever object 284 00:11:10,220 --> 00:11:11,900 we say it wants to be and it can run code. 285 00:11:12,700 --> 00:11:14,100 Now, again, the type 286 00:11:14,100 --> 00:11:15,960 matters. So when you're using 287 00:11:15,960 --> 00:11:18,180 servicedac.redis, you tell it what type you're expecting 288 00:11:18,680 --> 00:11:20,320 and the payload you're using 289 00:11:20,420 --> 00:11:21,880 has to fit into the object graph 290 00:11:21,880 --> 00:11:22,640 you're going to have there. 291 00:11:24,380 --> 00:11:26,280 This is, again, an implicit 292 00:11:26,280 --> 00:11:27,360 serialization vulnerability. 293 00:11:28,040 --> 00:11:30,420 So because servicedac.redis 294 00:11:30,420 --> 00:11:32,160 is using unsafe serializer 295 00:11:32,160 --> 00:11:33,640 to read the Redis cache, 296 00:11:34,060 --> 00:11:35,840 anything that lets you put bad data 297 00:11:35,840 --> 00:11:38,480 in the Redis cache also gets you RCE. 298 00:11:39,060 --> 00:11:40,400 And that extra pattern 299 00:11:40,400 --> 00:11:42,320 I keep talking about works here also. 300 00:11:42,700 --> 00:11:44,240 And now I'm going to tell you 301 00:11:44,240 --> 00:11:45,560 a little bit about how I discovered it. 302 00:11:45,660 --> 00:11:47,120 And that's because I was looking at 303 00:11:47,120 --> 00:11:49,760 one other NoSQL engine in .NET, 304 00:11:50,420 --> 00:11:51,060 and that's MartinDB. 305 00:11:51,580 --> 00:11:53,380 So MartinDB, like RavenDB, 306 00:11:53,660 --> 00:11:55,960 uses JSON.NET with unsafe settings 307 00:11:55,960 --> 00:11:57,000 to read its own storage. 308 00:11:57,260 --> 00:11:59,660 But unlike RavenDB, it doesn't just let you write JSON. 309 00:11:59,800 --> 00:12:01,720 You can only read and write objects from the database. 310 00:12:02,080 --> 00:12:03,640 And when I tried to write an object 311 00:12:03,640 --> 00:12:05,820 to MartinDB that was just like 312 00:12:05,820 --> 00:12:07,380 a serialization exploit gadget, 313 00:12:07,520 --> 00:12:08,960 it would choke on it every time I tried. 314 00:12:09,500 --> 00:12:11,220 So I played with that a lot, 315 00:12:11,360 --> 00:12:13,340 and I found a completely different way to attack it. 316 00:12:13,780 --> 00:12:15,340 And that's what I'm calling 317 00:12:15,340 --> 00:12:17,120 a serialization mutation attack. 318 00:12:17,560 --> 00:12:20,260 So here's a remote code execution payload 319 00:12:20,420 --> 00:12:21,300 for MartinDB. 320 00:12:21,620 --> 00:12:23,060 This one's a little bit different. 321 00:12:23,620 --> 00:12:25,940 So what I'm going to do here is I'm going to make in .NET 322 00:12:25,940 --> 00:12:27,360 a dictionary of string string. 323 00:12:27,680 --> 00:12:29,680 This could be a hash table too, but you need something 324 00:12:29,680 --> 00:12:32,000 that's got key value pairs mapping a string to a string. 325 00:12:32,400 --> 00:12:34,040 And what I'm going to put in that dictionary 326 00:12:34,520 --> 00:12:35,280 is first 327 00:12:35,820 --> 00:12:38,040 a dollar type key paired with 328 00:12:38,040 --> 00:12:39,080 the name of a .NET type. 329 00:12:39,240 --> 00:12:41,600 In this case, workflow designer, which is another 330 00:12:41,600 --> 00:12:43,160 JSON.NET serialization gadget. 331 00:12:43,560 --> 00:12:45,880 It lets you do an arbitrary XAML read. 332 00:12:46,100 --> 00:12:48,040 Again, look at YSO serial for details 333 00:12:48,040 --> 00:12:48,980 about how it works. 334 00:12:50,420 --> 00:12:52,560 One other thing where I'm going to set another key value pair 335 00:12:52,560 --> 00:12:54,380 where this is the name of a property 336 00:12:54,380 --> 00:12:56,400 on workflow designer, which is the one 337 00:12:56,400 --> 00:12:58,360 you set the XAML with to get an 338 00:12:58,360 --> 00:12:59,680 arbitrary XAML parse out of it. 339 00:13:00,080 --> 00:13:02,280 And what I'm going to do with that is I'm just going to 340 00:13:02,280 --> 00:13:03,260 write it to the database. 341 00:13:03,740 --> 00:13:06,200 So if you write this object to the database 342 00:13:06,200 --> 00:13:08,420 and then read it back, that will run code. 343 00:13:08,520 --> 00:13:09,400 It will launch calc. 344 00:13:09,940 --> 00:13:12,180 And that's kind of weird. We're writing a dictionary 345 00:13:12,180 --> 00:13:14,520 to the database, but when you read it back, it runs calc. 346 00:13:14,880 --> 00:13:15,720 Why does that work? 347 00:13:15,840 --> 00:13:18,480 So this is using JSON.NET as its serializer. 348 00:13:18,580 --> 00:13:20,400 So let's look at how this works in JSON.NET. 349 00:13:21,980 --> 00:13:23,740 So in JSON.NET, 350 00:13:23,820 --> 00:13:24,640 if you serialize 351 00:13:24,640 --> 00:13:26,060 one of these dictionary string strings, 352 00:13:26,980 --> 00:13:28,500 like, say you have a dictionary 353 00:13:28,500 --> 00:13:30,020 where you've got a key named fruit 354 00:13:30,020 --> 00:13:32,520 and the value pair, it uses the key names 355 00:13:32,520 --> 00:13:34,200 exactly as you provide them. 356 00:13:34,460 --> 00:13:36,480 So your key as fruit is just 357 00:13:36,480 --> 00:13:37,940 going to go into the serialized JSON 358 00:13:37,940 --> 00:13:39,060 as the key named fruit. 359 00:13:39,540 --> 00:13:42,200 Now if you compare that to what 360 00:13:42,200 --> 00:13:44,660 an RCE payload looks like for JSON.NET, 361 00:13:44,740 --> 00:13:45,680 here's an example of one. 362 00:13:46,240 --> 00:13:48,200 You've got that type specifier key, 363 00:13:48,260 --> 00:13:50,120 that dollar type, and then you've got 364 00:13:50,420 --> 00:13:52,240 that type name as a value for it, and so on. 365 00:13:52,560 --> 00:13:54,200 And the key trick with this 366 00:13:54,200 --> 00:13:56,100 is there's nothing special about 367 00:13:56,100 --> 00:13:58,120 that dollar type key. There's nothing special 368 00:13:58,120 --> 00:14:00,080 about the type specifier used 369 00:14:00,080 --> 00:14:02,160 really in any of the serializers I've talked about. 370 00:14:02,640 --> 00:14:03,860 So you can make 371 00:14:04,420 --> 00:14:06,180 a key for a string string dictionary 372 00:14:06,180 --> 00:14:08,320 named dollar type, and it turns out 373 00:14:08,320 --> 00:14:10,080 that if you serialize one of those 374 00:14:10,080 --> 00:14:12,000 string string dictionaries in 375 00:14:12,000 --> 00:14:14,260 JSON.NET or most of the other serializers 376 00:14:14,260 --> 00:14:16,100 I've talked about, it just uses the key directly. 377 00:14:16,360 --> 00:14:18,220 It doesn't filter it out even though it matches 378 00:14:18,220 --> 00:14:19,100 its type specifier. 379 00:14:20,420 --> 00:14:22,460 So what happens 380 00:14:22,460 --> 00:14:23,760 there is that 381 00:14:23,760 --> 00:14:26,220 you're essentially colliding 382 00:14:26,220 --> 00:14:28,180 with the syntax of what that 383 00:14:28,180 --> 00:14:29,540 RCE payload looked like. 384 00:14:30,140 --> 00:14:31,860 You're making it just output data 385 00:14:31,860 --> 00:14:34,160 where it's going to be the type 386 00:14:34,160 --> 00:14:36,120 specifier, so when this object gets serialized 387 00:14:36,120 --> 00:14:37,940 and then deserialized, it mutates into a different 388 00:14:37,940 --> 00:14:40,020 type entirely. And you can choose whatever 389 00:14:40,020 --> 00:14:42,320 type you want. And this doesn't 390 00:14:42,320 --> 00:14:44,240 just work for dictionary, it works for hash table, 391 00:14:44,420 --> 00:14:46,080 J object, expando object, and like 392 00:14:46,080 --> 00:14:48,200 50 others. Just go look around at .NET 393 00:14:48,200 --> 00:14:49,600 for things that have key value structures. 394 00:14:50,700 --> 00:14:52,300 And because of this mutation 395 00:14:52,300 --> 00:14:54,240 attack, you can do a lot of 396 00:14:54,240 --> 00:14:56,160 attacks on serialization that 397 00:14:56,160 --> 00:14:57,620 usually weren't considered possible. 398 00:14:58,660 --> 00:15:00,160 So say you have a website 399 00:15:00,160 --> 00:15:02,360 that takes some key value data, and this is 400 00:15:02,360 --> 00:15:04,360 a screenshot from a certain website you might recognize 401 00:15:04,360 --> 00:15:05,860 that did not have this vulnerability, 402 00:15:06,220 --> 00:15:08,400 but does let you enter key value data where you can 403 00:15:08,400 --> 00:15:09,560 choose both the keys and the values. 404 00:15:10,240 --> 00:15:12,280 And you send that to a web front end 405 00:15:12,280 --> 00:15:14,420 with a form post, and on the web front end 406 00:15:14,420 --> 00:15:16,060 they're going to make like a dictionary 407 00:15:16,060 --> 00:15:17,960 or a hash table with the data you sent them. 408 00:15:18,260 --> 00:15:20,400 And later on, say that dictionary or hash table 409 00:15:20,420 --> 00:15:22,680 gets serialized to like a database 410 00:15:22,680 --> 00:15:24,580 or a cache, and then later on 411 00:15:24,580 --> 00:15:26,420 after that, it gets read back from that 412 00:15:26,420 --> 00:15:28,380 database or cache using an unsafe serializer. 413 00:15:28,580 --> 00:15:30,500 Well in that case, you can 414 00:15:30,500 --> 00:15:32,340 provide key value data where you're 415 00:15:32,340 --> 00:15:34,220 using that type specifier as the key name, 416 00:15:34,380 --> 00:15:36,240 and when it gets read from that cache on some 417 00:15:36,240 --> 00:15:38,140 backend server, you can make it so it 418 00:15:38,140 --> 00:15:39,800 mutates into whatever object you want, 419 00:15:39,960 --> 00:15:41,920 it's now your serialization exploit gadget, 420 00:15:42,100 --> 00:15:44,320 it's now that pain, and 421 00:15:44,320 --> 00:15:46,260 you've got remote code execution whenever that 422 00:15:46,260 --> 00:15:46,600 happens. 423 00:15:49,960 --> 00:15:50,400 So 424 00:15:50,420 --> 00:15:52,240 I was saying that was that 425 00:15:52,240 --> 00:15:54,020 extra attack pattern against all of these 426 00:15:54,020 --> 00:15:56,220 NoSQL engines, here's how that works against LiteDB. 427 00:15:56,820 --> 00:15:58,360 So LiteDB, you can 428 00:15:58,360 --> 00:15:59,560 make a dictionary string string, 429 00:16:00,400 --> 00:16:02,420 you put your payload in there, 430 00:16:02,520 --> 00:16:04,440 so you've got that underscore type 431 00:16:04,440 --> 00:16:06,400 key specified with a type name, in this case 432 00:16:06,400 --> 00:16:08,100 assembly installer, so we're going to do again 433 00:16:08,940 --> 00:16:10,420 an arbitrary call to load 434 00:16:10,420 --> 00:16:12,480 library, we're saying we're loading a malicious DLL, 435 00:16:12,680 --> 00:16:14,280 and all you do is 436 00:16:14,280 --> 00:16:16,120 you write it to the database and read it back. 437 00:16:17,000 --> 00:16:18,320 Now, this hack 438 00:16:18,320 --> 00:16:20,220 is kind of magic, it doesn't matter 439 00:16:20,420 --> 00:16:22,160 where this is in the data structure, if you can 440 00:16:22,160 --> 00:16:24,220 control two key value pairs in some 441 00:16:24,220 --> 00:16:25,820 part of some object graph, 442 00:16:26,260 --> 00:16:28,100 if it gets saved and read back, 443 00:16:28,300 --> 00:16:30,240 that gets you RCE, and this 444 00:16:30,240 --> 00:16:32,520 actually makes a lot of attacks really ridiculous 445 00:16:32,520 --> 00:16:34,240 and easy, like there's some 446 00:16:34,240 --> 00:16:36,340 application that's just asking you for a couple of 447 00:16:36,340 --> 00:16:38,340 string pairs and later you get RCE when it gets 448 00:16:38,340 --> 00:16:38,940 read from the database. 449 00:16:40,200 --> 00:16:42,260 And this kind of attack works with 450 00:16:42,260 --> 00:16:44,420 a lot of serializers, here's a list of 451 00:16:44,420 --> 00:16:46,280 all the ones I know, these are all 452 00:16:46,280 --> 00:16:48,300 the .NET serializers I know where this sort of 453 00:16:48,300 --> 00:16:50,360 mutation attack works, you'll notice these are 454 00:16:50,420 --> 00:16:52,160 all JSON and BSIN serializers, 455 00:16:52,380 --> 00:16:54,180 this doesn't work for binary formatter 456 00:16:54,180 --> 00:16:56,400 because it doesn't use anything 457 00:16:56,400 --> 00:16:57,480 like this kind of syntax. 458 00:16:59,780 --> 00:17:00,460 And it's 459 00:17:00,460 --> 00:17:01,920 also worth noting that this doesn't work against 460 00:17:02,300 --> 00:17:03,260 MongoDB serializer. 461 00:17:04,900 --> 00:17:06,100 You'll note that there's different 462 00:17:06,800 --> 00:17:08,520 requirements for this to work in certain cases, 463 00:17:08,660 --> 00:17:10,300 some of them you have to control the first key value 464 00:17:10,300 --> 00:17:12,200 pair, some of them there's that assignability 465 00:17:12,200 --> 00:17:14,120 check, some of them there's 466 00:17:14,120 --> 00:17:16,220 other like specific unsafe properties 467 00:17:16,220 --> 00:17:18,120 you've got to set, so there's a lot of 468 00:17:18,120 --> 00:17:20,180 variability in how exploitable 469 00:17:20,420 --> 00:17:21,120 mutation can be. 470 00:17:22,300 --> 00:17:23,920 For example, JSON.NET, like 471 00:17:23,920 --> 00:17:26,040 most popular open source library in the world 472 00:17:26,040 --> 00:17:26,800 as far as I'm aware, 473 00:17:27,660 --> 00:17:30,100 you can get mutation attacks against it, 474 00:17:30,140 --> 00:17:32,100 but it's a little bit tricky. You have to control the 475 00:17:32,100 --> 00:17:34,040 first key value pair because that's the only one 476 00:17:34,040 --> 00:17:35,380 it'll read the type specifier from, 477 00:17:35,840 --> 00:17:38,180 it has to be deserialized using unsafe settings, 478 00:17:38,420 --> 00:17:40,360 it has to be serialized in such a way that 479 00:17:40,360 --> 00:17:42,200 it doesn't double up the type specifier, 480 00:17:42,980 --> 00:17:44,100 and in general, 481 00:17:44,240 --> 00:17:46,120 I would suggest experimenting with this, 482 00:17:46,200 --> 00:17:48,040 there's a lot of weird special cases 483 00:17:48,040 --> 00:17:50,200 and nuances, but sometimes you 484 00:17:50,420 --> 00:17:52,300 can make this work, and you can use this to exploit 485 00:17:52,300 --> 00:17:54,060 things where the serialization is just 486 00:17:54,060 --> 00:17:55,580 not something you can touch. 487 00:17:56,520 --> 00:17:58,440 Serialization happens on the backend, you can't 488 00:17:58,440 --> 00:18:00,220 see the deserialized data, maybe it even gets 489 00:18:00,220 --> 00:18:02,020 an HMAX stuck on it, it doesn't matter. 490 00:18:02,580 --> 00:18:04,360 On the other hand, there's serializers where this 491 00:18:04,360 --> 00:18:06,320 just works all the time, so if you've got 492 00:18:06,320 --> 00:18:07,940 JavaScript serializer with a type resolver, 493 00:18:08,240 --> 00:18:10,340 it will go out of its way to make the exploit 494 00:18:10,340 --> 00:18:12,340 work. It doesn't matter if you've 495 00:18:12,340 --> 00:18:14,260 got other entries in your key value storage, 496 00:18:14,540 --> 00:18:16,640 it doesn't matter if your type specifier 497 00:18:16,640 --> 00:18:17,980 is the last thing in the list, 498 00:18:18,160 --> 00:18:20,300 it doesn't matter if the assignability doesn't 499 00:18:20,420 --> 00:18:22,020 make sense, it'll just run the code and it'll 500 00:18:22,020 --> 00:18:22,540 just work. 501 00:18:24,480 --> 00:18:26,360 You can also do kind of a blind 502 00:18:26,360 --> 00:18:28,180 scanning technique to find these vulnerabilities. 503 00:18:28,680 --> 00:18:30,600 If you've got websites out there 504 00:18:30,600 --> 00:18:32,380 that you think are running on .net and might 505 00:18:32,380 --> 00:18:34,080 have some backend cache or database, 506 00:18:34,560 --> 00:18:36,360 you can just stick key value 507 00:18:36,360 --> 00:18:38,420 data in there, you can use that assembly 508 00:18:38,420 --> 00:18:40,140 installer pingback trick I talked about, 509 00:18:40,400 --> 00:18:42,300 and you can wait to see if you 510 00:18:42,300 --> 00:18:44,180 later get a request back 511 00:18:44,180 --> 00:18:46,340 to your own server. So you can 512 00:18:46,340 --> 00:18:47,860 stick data and services blind, 513 00:18:48,500 --> 00:18:50,120 use maybe unique URLs 514 00:18:50,420 --> 00:18:52,340 for your pingback so you can see which ones talk back to you, 515 00:18:52,400 --> 00:18:54,420 and then maybe later on when it gets 516 00:18:54,420 --> 00:18:56,140 read from the cache you'll get a request and you know 517 00:18:56,140 --> 00:18:57,400 there's an RCE happening there. 518 00:18:59,420 --> 00:19:00,420 You can defend against 519 00:19:00,420 --> 00:19:01,720 these attacks in a bunch of ways. 520 00:19:02,160 --> 00:19:04,240 If you're writing an application, the best thing to do is 521 00:19:04,240 --> 00:19:06,000 don't use a polymorphic serializer. 522 00:19:06,160 --> 00:19:07,540 And I'm going to say that a lot in this talk. 523 00:19:08,020 --> 00:19:10,280 Don't use a serializer where the data gets to tell you 524 00:19:10,280 --> 00:19:11,320 what type it wants to be. 525 00:19:12,000 --> 00:19:13,960 If you have to, for some reason, 526 00:19:14,020 --> 00:19:15,720 you can try using a serialization binder, 527 00:19:15,920 --> 00:19:17,840 but I'm about to tell you how to bypass 528 00:19:18,320 --> 00:19:20,240 serialization binders, so kind of a grain of salt there. 529 00:19:21,560 --> 00:19:22,440 So here's 530 00:19:22,440 --> 00:19:23,880 how to bypass serialization binders. 531 00:19:25,380 --> 00:19:26,160 In general, 532 00:19:26,280 --> 00:19:28,220 if you're talking about using a serialization binder 533 00:19:28,220 --> 00:19:30,240 for security purposes, it's acting like a 534 00:19:30,240 --> 00:19:32,220 filter. What's happening is 535 00:19:32,220 --> 00:19:34,360 during deserialization, your binder's 536 00:19:34,360 --> 00:19:35,740 going to get asked about every type 537 00:19:36,260 --> 00:19:38,520 that's directly referenced in the serialized 538 00:19:38,520 --> 00:19:40,180 data, and it'll say, okay, 539 00:19:40,260 --> 00:19:41,960 this is the type I expect, go ahead, 540 00:19:42,180 --> 00:19:43,900 or if you're doing it right, you throw an exception 541 00:19:44,380 --> 00:19:46,460 when some type you don't expect shows up. 542 00:19:46,620 --> 00:19:48,300 And that means if someone throws pain 543 00:19:48,300 --> 00:19:50,400 at you, you say, I don't know what pain is, 544 00:19:50,420 --> 00:19:52,320 you throw an exception, and nothing bad happens. 545 00:19:52,840 --> 00:19:54,260 So if you're doing it right, your 546 00:19:54,260 --> 00:19:55,980 serialization binder looks sort of like this. 547 00:19:56,780 --> 00:19:58,040 What this is, is just 548 00:19:58,040 --> 00:20:00,100 an allow list of all the expected types, 549 00:20:00,240 --> 00:20:02,460 it's a string allow list for both 550 00:20:02,460 --> 00:20:04,240 the assembly name and the type 551 00:20:04,240 --> 00:20:06,320 from the assembly name, and if you see one 552 00:20:06,320 --> 00:20:07,820 that you don't expect, you throw an exception. 553 00:20:08,220 --> 00:20:10,420 The problem is, a lot of times, people don't 554 00:20:10,420 --> 00:20:12,300 do this. Usually what you see for a 555 00:20:12,300 --> 00:20:14,140 serialization binder is something more like this, 556 00:20:14,860 --> 00:20:16,540 where you have some assembly 557 00:20:16,540 --> 00:20:18,080 you've written yourself. You say, well, 558 00:20:18,180 --> 00:20:19,980 I trust all my types, there's no crazy 559 00:20:20,420 --> 00:20:22,200 serialization gadgets in there, so 560 00:20:22,200 --> 00:20:24,500 if the type says it's coming from 561 00:20:24,500 --> 00:20:26,460 my assembly, I'll just allow it 562 00:20:26,460 --> 00:20:28,400 and I'll use type get type to actually get the type 563 00:20:28,400 --> 00:20:30,200 out of there. And the 564 00:20:30,200 --> 00:20:32,120 problem with this approach is, say 565 00:20:32,120 --> 00:20:34,220 your assembly contains a type like this. 566 00:20:34,640 --> 00:20:36,260 This is an initialized 567 00:20:36,260 --> 00:20:38,640 list type we're going to invent that just derives, 568 00:20:38,660 --> 00:20:40,120 inherits from the just 569 00:20:40,120 --> 00:20:42,260 generic list type in .net, and we're adding 570 00:20:42,260 --> 00:20:44,180 another property to it. That seems 571 00:20:44,180 --> 00:20:46,220 pretty harmless, but if you've got a type 572 00:20:46,220 --> 00:20:48,400 like this in that assembly that you're trusting, 573 00:20:48,580 --> 00:20:50,120 you can export it like this. 574 00:20:51,040 --> 00:20:52,480 So, here's a JSON payload 575 00:20:52,480 --> 00:20:54,400 to bypass that serialization 576 00:20:54,400 --> 00:20:56,580 binder I just showed you. The type 577 00:20:56,580 --> 00:20:58,160 it's saying it wants to be is 578 00:20:58,160 --> 00:21:00,240 initialized list, the type I just mentioned, 579 00:21:00,360 --> 00:21:02,200 but the type in the template for that 580 00:21:02,200 --> 00:21:04,360 is assembly installer, that one that lets 581 00:21:04,360 --> 00:21:05,740 you do an arbitrary load library. 582 00:21:06,180 --> 00:21:08,380 The trick with this is, initialized list 583 00:21:08,380 --> 00:21:10,200 is the type you're getting asked about, that 584 00:21:10,200 --> 00:21:12,300 comes from your assembly, so that binder is 585 00:21:12,300 --> 00:21:14,380 okay with it. And you'll notice that 586 00:21:14,380 --> 00:21:16,140 assembly installer is only ever 587 00:21:16,140 --> 00:21:17,980 referenced inside the template here. 588 00:21:18,940 --> 00:21:20,320 But, when this value 589 00:21:20,420 --> 00:21:22,220 part of the JSON blob gets 590 00:21:22,640 --> 00:21:24,260 deserialized, it'll still make an assembly installer 591 00:21:24,260 --> 00:21:26,220 object, it'll still set its path property, 592 00:21:26,580 --> 00:21:28,200 and you're still doing load library, 593 00:21:28,380 --> 00:21:29,740 so your RCE is still working. 594 00:21:31,820 --> 00:21:32,520 There's a trick 595 00:21:32,520 --> 00:21:34,220 here that when you serialize this with 596 00:21:34,220 --> 00:21:36,340 JSON.net, it'll put another dollar type entry 597 00:21:36,340 --> 00:21:37,520 in there for the assembly installer, 598 00:21:38,120 --> 00:21:40,300 but you don't need it. It can figure out what it's 599 00:21:40,300 --> 00:21:42,380 supposed to be if it's not there, so you can just take it 600 00:21:42,380 --> 00:21:44,220 back out again and then bypass the binder. 601 00:21:45,340 --> 00:21:46,460 There's another trick you can 602 00:21:46,460 --> 00:21:48,300 use to bypass serialization binders that I'm 603 00:21:48,300 --> 00:21:49,320 calling contagion. 604 00:21:50,420 --> 00:21:52,460 So, for JSON.net and a lot 605 00:21:52,460 --> 00:21:53,940 of other Beeson and JSON 606 00:21:53,940 --> 00:21:56,240 serializers, you've got that 607 00:21:56,240 --> 00:21:58,180 dollar type entry that's saying what type 608 00:21:58,180 --> 00:21:59,960 it's supposed to be, but 609 00:21:59,960 --> 00:22:02,060 that object you're creating has 610 00:22:02,060 --> 00:22:04,080 members, properties, constructor arguments 611 00:22:04,080 --> 00:22:05,840 that have their own types. 612 00:22:06,240 --> 00:22:08,580 And you don't have to specify 613 00:22:08,580 --> 00:22:10,120 the types of those in the JSON. 614 00:22:10,260 --> 00:22:12,380 If you serialize it, it will, but if you don't, 615 00:22:12,400 --> 00:22:14,180 the serializer will just figure it out. 616 00:22:14,440 --> 00:22:16,480 So if there's some serialization 617 00:22:16,480 --> 00:22:18,220 gadget you want to use, and it's a 618 00:22:18,220 --> 00:22:20,240 member of something that's a member of something that's a 619 00:22:20,420 --> 00:22:22,300 member of something that you can get past the 620 00:22:22,300 --> 00:22:24,420 binder, you can use that one object 621 00:22:24,420 --> 00:22:26,420 that has it in its tree somewhere 622 00:22:26,420 --> 00:22:27,900 to get it past the binder. 623 00:22:28,500 --> 00:22:29,640 Here's one example. 624 00:22:29,980 --> 00:22:32,060 So Windows Identity that I mentioned 625 00:22:32,060 --> 00:22:34,240 before is a JSON.net 626 00:22:34,240 --> 00:22:36,300 RCE gadget. It lets you pivot to binary 627 00:22:36,300 --> 00:22:38,260 formatter. And you could have a serialization 628 00:22:38,260 --> 00:22:40,360 binder that specifically block lists that. 629 00:22:40,600 --> 00:22:42,460 And if you do that, you can still get it by. 630 00:22:43,140 --> 00:22:44,260 The way you do that 631 00:22:44,260 --> 00:22:46,040 is you use a Windows authentication event 632 00:22:46,040 --> 00:22:48,240 args object. So if you serialize 633 00:22:48,240 --> 00:22:49,960 Windows authentication event args, it has a 634 00:22:49,960 --> 00:22:51,580 constructor argument called identity 635 00:22:52,200 --> 00:22:53,580 whose type is Windows identity. 636 00:22:54,100 --> 00:22:56,240 So when you serialize that, the only type 637 00:22:56,240 --> 00:22:58,120 going by the binder is this 638 00:22:58,120 --> 00:23:00,040 dollar type, because the only things that 639 00:23:00,040 --> 00:23:01,660 the binder gets asked about are the types 640 00:23:02,240 --> 00:23:03,760 explicitly listed in the JSON. 641 00:23:04,980 --> 00:23:06,020 But when the 642 00:23:06,020 --> 00:23:08,040 identity part of it gets deserialized here, 643 00:23:08,240 --> 00:23:09,980 it'll still make a Windows identity object, 644 00:23:10,300 --> 00:23:11,860 it'll still set its properties, 645 00:23:12,060 --> 00:23:13,040 you still get RCE. 646 00:23:15,060 --> 00:23:16,260 So that's a lot 647 00:23:16,260 --> 00:23:17,860 of problems. What if this has been fixed? 648 00:23:18,240 --> 00:23:20,160 So I am with Microsoft. 649 00:23:20,280 --> 00:23:21,480 I practice responsible disclosure. 650 00:23:21,740 --> 00:23:23,560 I told all of these people about these issues 651 00:23:23,560 --> 00:23:25,420 in January or earlier. 652 00:23:26,800 --> 00:23:28,280 Everybody except MartinDB 653 00:23:28,280 --> 00:23:29,620 made some sort of fix. 654 00:23:29,780 --> 00:23:32,300 MartinDB, as far as I've checked last, still hasn't. 655 00:23:33,140 --> 00:23:34,180 MongoDB's fix is pretty 656 00:23:34,180 --> 00:23:36,060 solid. I don't know how to bypass it. 657 00:23:36,120 --> 00:23:38,120 They added a pretty strict allow list on the types that can 658 00:23:38,120 --> 00:23:39,660 get created during deserialization. 659 00:23:39,880 --> 00:23:42,200 It seems good. Everybody else here 660 00:23:42,200 --> 00:23:43,200 added a block list. 661 00:23:44,400 --> 00:23:46,260 LightDB also added an assignability 662 00:23:46,260 --> 00:23:48,020 check, so that puts them about on par 663 00:23:48,240 --> 00:23:50,420 for MongoDB before they made a fix. 664 00:23:50,720 --> 00:23:52,260 I just showed you how to bypass 665 00:23:52,260 --> 00:23:54,160 block lists. I can bypass 666 00:23:54,160 --> 00:23:56,320 all of the fixes for LightDB, 667 00:23:56,580 --> 00:23:58,280 RavenDB, and ServiceDoc.redis. 668 00:23:58,560 --> 00:24:00,160 Like I said, MartinDB didn't get fixed. 669 00:24:00,380 --> 00:24:01,680 I told all of these people, 670 00:24:01,840 --> 00:24:03,760 look, I can still bypass these fixes. 671 00:24:03,920 --> 00:24:05,440 They said we're not making additional fixes. 672 00:24:05,920 --> 00:24:07,620 So there's remote code execution vulnerabilities 673 00:24:07,620 --> 00:24:09,640 that are live right now for all of those libraries. 674 00:24:10,140 --> 00:24:11,020 Worth looking at. 675 00:24:12,280 --> 00:24:14,200 The mutation attack I mentioned 676 00:24:14,200 --> 00:24:15,240 against JSON.net 677 00:24:15,700 --> 00:24:16,920 is not being fixed. 678 00:24:18,240 --> 00:24:19,880 I talked to James Newton King, the maintainer for 679 00:24:19,880 --> 00:24:21,360 JSON.net about this. 680 00:24:21,520 --> 00:24:23,700 He said essentially it's supposed to do that. 681 00:24:23,960 --> 00:24:26,320 So that behavior is not going to be changed. 682 00:24:26,520 --> 00:24:28,080 If you've got some application that's using 683 00:24:28,080 --> 00:24:30,040 JSON.net, it might be vulnerable to 684 00:24:30,040 --> 00:24:31,880 mutation. Similarly, 685 00:24:32,020 --> 00:24:34,120 JavaScript serializer, the .net serializer 686 00:24:34,120 --> 00:24:36,040 I mentioned that works really well 687 00:24:36,040 --> 00:24:38,240 for mutation attacks, will not be 688 00:24:38,240 --> 00:24:40,180 fixed. I talked to the .net team 689 00:24:40,180 --> 00:24:42,120 about this. They said we tell people don't use 690 00:24:42,120 --> 00:24:44,220 JavaScript serializer, we tell people don't 691 00:24:44,220 --> 00:24:46,220 use type resolver, so we're not going to fix 692 00:24:46,220 --> 00:24:47,440 them. Just don't use them. 693 00:24:49,080 --> 00:24:49,520 So, 694 00:24:50,140 --> 00:24:52,400 best practices to avoid these issues. 695 00:24:53,180 --> 00:24:54,000 First thing 696 00:24:54,000 --> 00:24:56,100 I keep saying, don't use 697 00:24:56,100 --> 00:24:58,100 a polymorphic serializer. Don't roll your 698 00:24:58,100 --> 00:24:59,200 own. It's a really bad idea. 699 00:25:00,380 --> 00:25:02,200 Don't have that data let you 700 00:25:02,200 --> 00:25:03,780 tell you what type it wants to be. 701 00:25:03,920 --> 00:25:05,500 It leads to all kinds of problems. 702 00:25:05,980 --> 00:25:08,160 Don't call type get type because if you're doing that 703 00:25:08,160 --> 00:25:10,240 you're probably writing a polymorphic serializer 704 00:25:10,240 --> 00:25:11,800 even if you don't realize you're doing it. 705 00:25:12,620 --> 00:25:14,040 Similarly in Java, don't call 706 00:25:14,040 --> 00:25:16,260 class for name. Also remember 707 00:25:16,260 --> 00:25:18,220 that you can't use an unsafe serializer 708 00:25:18,240 --> 00:25:19,940 anywhere because mutation attacks. 709 00:25:20,260 --> 00:25:22,260 If it's on your back end, if you've got an HVAC, 710 00:25:22,400 --> 00:25:23,620 it doesn't matter for mutation. 711 00:25:24,020 --> 00:25:25,920 You can attack like deep copy 712 00:25:25,920 --> 00:25:28,180 tricks. A lot of people use serializers 713 00:25:28,180 --> 00:25:30,200 to just deep copy objects. You can get 714 00:25:30,200 --> 00:25:32,240 RCE out of that because of mutation, which is 715 00:25:32,240 --> 00:25:34,140 kind of silly. So, don't 716 00:25:34,140 --> 00:25:35,760 use unsafe serializers anywhere. 717 00:25:37,280 --> 00:25:38,180 This one kind of 718 00:25:38,180 --> 00:25:40,300 hurts, but maybe don't read untrusted 719 00:25:40,300 --> 00:25:42,080 data from NoSQL. Mongo 720 00:25:42,080 --> 00:25:44,300 might be okay, but it kind of 721 00:25:44,300 --> 00:25:46,200 looks like every other NoSQL engine I've 722 00:25:46,200 --> 00:25:48,220 looked at. You can get RCE if someone can write back 723 00:25:48,240 --> 00:25:49,420 bad data and you can read it back. 724 00:25:49,800 --> 00:25:52,220 Now, I only really looked at .NET 725 00:25:52,220 --> 00:25:54,120 NoSQL engines, but there's 726 00:25:54,120 --> 00:25:56,060 kind of a pattern here with NoSQL where 727 00:25:56,060 --> 00:25:57,560 they say just take this object 728 00:25:58,160 --> 00:25:59,820 and then later on you can tell the NoSQL engine 729 00:25:59,820 --> 00:26:01,940 I want the object back and I don't care what it is. 730 00:26:02,240 --> 00:26:04,100 Any time you have that pattern, there's a 731 00:26:04,100 --> 00:26:06,100 polymorphic serializer in there somewhere 732 00:26:06,580 --> 00:26:08,160 and you can probably get RCE 733 00:26:08,160 --> 00:26:10,120 out of it if you want a research project 734 00:26:10,120 --> 00:26:11,660 or want to go find libraries that are vulnerable. 735 00:26:11,860 --> 00:26:14,140 Maybe look at Java or Python NoSQL engines. 736 00:26:16,420 --> 00:26:18,220 Don't try to use serialization binders. 737 00:26:18,660 --> 00:26:20,240 It's possible to write a good one, 738 00:26:20,300 --> 00:26:21,160 but nobody ever does it. 739 00:26:21,820 --> 00:26:24,080 Everybody screws this up. I see bypasses 740 00:26:24,080 --> 00:26:24,900 for these all the time. 741 00:26:25,760 --> 00:26:27,860 In general, you're better off architecting your 742 00:26:27,860 --> 00:26:29,840 application so you don't need a serialization binder 743 00:26:29,840 --> 00:26:30,700 in the first place. 744 00:26:31,840 --> 00:26:34,000 And now I'm going to get into the bonus stuff that's just for 745 00:26:34,000 --> 00:26:36,220 DEF CON. So, I've been talking about 746 00:26:36,220 --> 00:26:38,140 .NET framework exploits, but what about 747 00:26:38,140 --> 00:26:39,200 .NET 6 plus? 748 00:26:39,900 --> 00:26:42,120 Everyone seems to think that's different. It's not 749 00:26:42,120 --> 00:26:43,580 going to have these serialization vulnerabilities. 750 00:26:44,440 --> 00:26:46,200 So, since 2016, .NET 751 00:26:46,200 --> 00:26:48,180 has had a couple of different flavors. 752 00:26:48,440 --> 00:26:50,060 There's .NET framework and then 753 00:26:50,060 --> 00:26:52,160 there's .NET. That's what 754 00:26:52,160 --> 00:26:54,000 they want me to call it, but .NET 755 00:26:54,000 --> 00:26:56,180 6 through 8, those are the ones people use 756 00:26:56,180 --> 00:26:58,160 right now. All these exploits have been 757 00:26:58,160 --> 00:27:00,200 .NET framework exploits, so the ones that are 758 00:27:00,200 --> 00:27:02,000 in YSO serial, but what about 759 00:27:02,000 --> 00:27:04,140 .NET 6 plus? Can you do this sort of stuff there? 760 00:27:05,200 --> 00:27:06,160 There is 761 00:27:06,160 --> 00:27:08,300 this myth that .NET 6 plus 762 00:27:08,300 --> 00:27:09,960 is immune to serialization attacks. 763 00:27:10,380 --> 00:27:11,920 So, here's the CVE Mongo 764 00:27:11,920 --> 00:27:14,120 open for the vulnerability I found 765 00:27:14,120 --> 00:27:16,180 and it's kind of an eye chart there, but it's 766 00:27:16,200 --> 00:27:18,180 I'll underline the important part here 767 00:27:18,180 --> 00:27:20,260 and what they said was it must 768 00:27:20,260 --> 00:27:22,220 be running Windows host using full .NET 769 00:27:22,220 --> 00:27:23,680 framework, not .NET core. 770 00:27:23,900 --> 00:27:24,660 That's not true. 771 00:27:26,780 --> 00:27:28,140 Similarly, if you look at YSO 772 00:27:28,140 --> 00:27:30,220 serial, they have a bug there, which 773 00:27:30,220 --> 00:27:31,980 is, is there any gadget for .NET core? 774 00:27:32,200 --> 00:27:33,980 And no one has found one there. 775 00:27:36,580 --> 00:27:38,080 So, admittedly exploiting .NET 776 00:27:38,080 --> 00:27:39,920 6 plus is harder. A lot of the 777 00:27:39,920 --> 00:27:42,280 exploitable types, the gadgets that people use in .NET 778 00:27:42,280 --> 00:27:44,300 framework just aren't there in the framework at all. 779 00:27:47,980 --> 00:27:49,620 There's also this whole issue where 780 00:27:50,200 --> 00:27:52,160 .NET, .NET 6 plus, whatever we're 781 00:27:52,160 --> 00:27:53,920 calling it, actually divides the framework 782 00:27:53,920 --> 00:27:56,000 into three parts. There's .NET core, 783 00:27:56,220 --> 00:27:58,040 there's ASP.NET, and there's the Windows 784 00:27:58,040 --> 00:27:59,980 desktop part. And depending 785 00:27:59,980 --> 00:28:02,060 on how you build your application, you 786 00:28:02,060 --> 00:28:03,840 only get some of the DLLs that are even 787 00:28:03,840 --> 00:28:06,000 visible at all. So you can only use gadgets 788 00:28:06,000 --> 00:28:08,060 from the ones that are appropriate to how you built 789 00:28:08,060 --> 00:28:08,540 your application. 790 00:28:10,940 --> 00:28:11,860 So, the 791 00:28:11,860 --> 00:28:14,120 ASP.NET core 792 00:28:14,120 --> 00:28:15,180 app types and the 793 00:28:16,200 --> 00:28:18,040 Windows desktop app types won't be found 794 00:28:18,040 --> 00:28:20,060 by type-get-type. You can't deserialize 795 00:28:20,060 --> 00:28:22,160 them unless you've built with 796 00:28:22,160 --> 00:28:24,200 an ASP.NET app or a Windows desktop 797 00:28:24,200 --> 00:28:26,100 app. But you 798 00:28:26,100 --> 00:28:28,140 can still do deserialization exploits. 799 00:28:28,400 --> 00:28:30,180 So, object data provider is 800 00:28:30,180 --> 00:28:32,300 still there in .NET 6. It's still there in .NET 801 00:28:32,300 --> 00:28:33,960 8. You have to have Windows 802 00:28:33,960 --> 00:28:36,200 desktop loaded for it to work, but if it's 803 00:28:36,200 --> 00:28:38,100 loaded, the payloads I've been 804 00:28:38,100 --> 00:28:40,220 showing you for object data provider, they just work fine. 805 00:28:41,780 --> 00:28:44,100 There are also some serialization gadgets 806 00:28:44,100 --> 00:28:46,020 that do exist in .NET core app. 807 00:28:46,200 --> 00:28:48,260 And now I'm going to go to the parts that aren't 808 00:28:48,260 --> 00:28:50,020 on my slides because I think I've got some time left. 809 00:28:51,340 --> 00:28:51,780 So, 810 00:28:52,700 --> 00:28:54,200 I told you earlier how you can 811 00:28:54,200 --> 00:28:55,700 get a ping back with assembly installer. 812 00:28:56,260 --> 00:28:58,260 There's a similar trick you can do in .NET 813 00:28:58,260 --> 00:28:59,860 6 and .NET 8 and so on. 814 00:29:00,220 --> 00:29:02,140 And there's a few types you can use to do 815 00:29:02,140 --> 00:29:03,840 that. One of them is assembly 816 00:29:03,840 --> 00:29:06,020 dependency resolver. Another 817 00:29:06,020 --> 00:29:08,300 one is system.io.fileinfo. 818 00:29:08,600 --> 00:29:09,920 The trick with both of those 819 00:29:09,920 --> 00:29:12,180 is they will call create file 820 00:29:12,180 --> 00:29:13,720 with whatever string you give them. So, 821 00:29:13,820 --> 00:29:16,120 assembly dependency resolver has a constructor argument 822 00:29:16,200 --> 00:29:18,060 which is just a path and it will just 823 00:29:18,060 --> 00:29:19,280 call create file on that path. 824 00:29:20,480 --> 00:29:22,180 The file info type, you can 825 00:29:22,180 --> 00:29:24,000 set the read only flag on a file with it 826 00:29:24,000 --> 00:29:26,140 and you can do that, however, so you 827 00:29:26,140 --> 00:29:28,040 can also use that as a payload to do 828 00:29:28,040 --> 00:29:30,100 DOS because you can make files on the server read only. 829 00:29:30,400 --> 00:29:32,020 But when you do that, it will also call 830 00:29:32,020 --> 00:29:33,160 create file on that path. 831 00:29:34,200 --> 00:29:36,080 Now, there's a thing with create file in Windows 832 00:29:36,080 --> 00:29:38,120 where if you give it an internet SMB URL 833 00:29:38,120 --> 00:29:40,200 or a WebDAV URL, it will 834 00:29:40,200 --> 00:29:41,800 go talk to that. It's happy to do it. 835 00:29:42,100 --> 00:29:44,220 So, if you've got an SMB server on the internet 836 00:29:44,220 --> 00:29:45,680 or a WebDAV server somewhere, 837 00:29:46,200 --> 00:29:47,780 you can use those gadgets to get a ping back 838 00:29:47,780 --> 00:29:50,280 to that server. Now, a lot of times 839 00:29:50,280 --> 00:29:51,960 if they're doing their OPSEC correctly, 840 00:29:52,320 --> 00:29:54,180 SMB outbound will be blocked on the 841 00:29:54,180 --> 00:29:55,160 server you're trying to attack 842 00:29:56,060 --> 00:29:57,780 and sometimes the WebDAV 843 00:29:57,780 --> 00:29:59,820 redirector won't exist in the Windows install. 844 00:30:00,000 --> 00:30:02,140 So, it's a little bit iffy, but in my experience 845 00:30:02,140 --> 00:30:03,900 usually one or the other 846 00:30:03,900 --> 00:30:04,620 of those works. 847 00:30:05,560 --> 00:30:07,980 So, you can still get a ping back essentially by 848 00:30:07,980 --> 00:30:09,960 using assembly dependency resolver 849 00:30:09,960 --> 00:30:12,060 or file info setting the read only flag 850 00:30:12,060 --> 00:30:14,060 and then giving either an internet SMB 851 00:30:14,060 --> 00:30:15,860 URL or a WebDAV URL. 852 00:30:18,680 --> 00:30:20,520 And that's actually all I had. 853 00:30:20,660 --> 00:30:22,180 So, are there any questions? 854 00:30:33,120 --> 00:30:34,500 Thanks. I saw one over here. 855 00:30:39,380 --> 00:30:41,200 Sorry. Can you tell me that one more time? 856 00:30:41,260 --> 00:30:41,480 Sorry. 857 00:30:46,620 --> 00:30:47,760 Okay, the question was 858 00:30:47,760 --> 00:30:49,760 do I have any examples of the vulnerable games? 859 00:30:50,060 --> 00:30:51,860 I don't remember which ones they are, 860 00:30:51,980 --> 00:30:53,860 but what you can do is go 861 00:30:53,860 --> 00:30:55,080 on GitHub 862 00:30:56,700 --> 00:30:57,580 or like 863 00:30:57,580 --> 00:30:59,520 if you go on to NuGet. 864 00:30:59,640 --> 00:31:01,700 Okay, so two approaches. Go to NuGet, look at 865 00:31:01,700 --> 00:31:04,200 projects that are dependent on LightDB 866 00:31:04,200 --> 00:31:06,080 and then look at where those 867 00:31:06,080 --> 00:31:08,140 get used or just search on GitHub 868 00:31:08,140 --> 00:31:10,420 for uses of LightDB for things that look like games. 869 00:31:10,540 --> 00:31:11,400 That's how I found a bunch of 870 00:31:12,000 --> 00:31:12,920 examples of that before. 871 00:31:15,400 --> 00:31:16,180 Yeah, so, for example. 872 00:31:16,200 --> 00:31:16,360 Over here. 873 00:31:26,700 --> 00:31:27,340 Sorry. 874 00:31:28,660 --> 00:31:29,840 You said that 875 00:31:29,840 --> 00:31:32,160 after you're reading the object 876 00:31:32,160 --> 00:31:33,800 it will actually 877 00:31:33,800 --> 00:31:35,920 initialize the object injection, right? 878 00:31:36,140 --> 00:31:37,820 So, how did you find 879 00:31:37,820 --> 00:31:40,120 that in the first time? 880 00:31:40,640 --> 00:31:42,140 Because it's not something 881 00:31:42,140 --> 00:31:42,600 that you 882 00:31:43,940 --> 00:31:45,960 typically think about when you're 883 00:31:46,200 --> 00:31:46,540 doing this research. 884 00:31:51,160 --> 00:31:52,060 Okay, to clarify, 885 00:31:52,160 --> 00:31:53,900 was the question how did I realize 886 00:31:53,900 --> 00:31:56,140 that the vulnerability was there in the 887 00:31:56,140 --> 00:31:57,360 code that I was looking at to begin with? 888 00:31:57,720 --> 00:32:00,180 Yeah, because you said I can control the key, 889 00:32:00,280 --> 00:32:01,760 I can control the value, and then 890 00:32:01,760 --> 00:32:04,420 when I read it, it will initialize 891 00:32:04,420 --> 00:32:05,040 the object injection. 892 00:32:06,260 --> 00:32:06,700 Right? 893 00:32:07,280 --> 00:32:08,160 Oh, okay. 894 00:32:10,560 --> 00:32:12,160 So, as far as that goes, 895 00:32:12,360 --> 00:32:13,960 if you're looking for polymorphic 896 00:32:13,960 --> 00:32:15,780 serializers where people are rolling their own, 897 00:32:16,200 --> 00:32:17,580 which is a really bad idea in general, 898 00:32:17,940 --> 00:32:19,800 what I look for when I'm doing these sorts of 899 00:32:19,800 --> 00:32:21,700 code reviews is calls to type-get-type 900 00:32:21,700 --> 00:32:23,180 that are just being passed a string, 901 00:32:23,340 --> 00:32:26,120 especially if the string somehow comes from user data. 902 00:32:26,620 --> 00:32:28,120 Type-get-type being called on 903 00:32:28,120 --> 00:32:29,160 a user-provided string 904 00:32:29,160 --> 00:32:31,660 almost always is either unsafe 905 00:32:32,080 --> 00:32:33,940 serialization or someone doing really 906 00:32:33,940 --> 00:32:35,440 sketchy with reflection invokes. 907 00:32:35,820 --> 00:32:37,880 And both of those are probably RCE. 908 00:32:38,260 --> 00:32:39,420 Does that explain it? 909 00:32:40,920 --> 00:32:41,740 Yes, it is. 910 00:32:41,920 --> 00:32:42,360 Thank you. 911 00:32:42,360 --> 00:32:44,000 Okay, in the middle here? 912 00:32:50,440 --> 00:32:51,440 Okay, the question was 913 00:32:51,440 --> 00:32:58,380 I did at least, okay, the question was 914 00:32:58,380 --> 00:33:00,020 did I look at DynamoDB NoSQL? 915 00:33:01,060 --> 00:33:02,120 I glanced at it. 916 00:33:02,200 --> 00:33:03,620 I did not do an in-depth test. 917 00:33:03,780 --> 00:33:06,340 It did not have as easy of an 918 00:33:06,340 --> 00:33:07,500 exploit as the other ones I looked at. 919 00:33:07,680 --> 00:33:08,820 I won't say it's safe. 920 00:33:10,100 --> 00:33:12,160 And then there was one over here. 921 00:33:16,300 --> 00:33:16,780 . 922 00:33:26,340 --> 00:33:27,860 Okay, the question here was 923 00:33:28,140 --> 00:33:29,300 the assembly 924 00:33:30,200 --> 00:33:32,300 installer exploit that I'm loading 925 00:33:32,300 --> 00:33:34,160 malicious DLL with, and 926 00:33:34,160 --> 00:33:36,140 how can I make sure the malicious DLL is there 927 00:33:36,140 --> 00:33:38,280 present on the system? In that case, 928 00:33:38,360 --> 00:33:40,120 the assumption is you've got some 929 00:33:40,120 --> 00:33:41,840 other exploit that lets you do a file drop, 930 00:33:42,580 --> 00:33:44,440 something I should explain is the cases 931 00:33:44,440 --> 00:33:46,260 where I was using assembly installer exploits, 932 00:33:46,320 --> 00:33:48,260 that's because the string is shorter than 933 00:33:48,260 --> 00:33:49,520 the object data provider ones. 934 00:33:49,680 --> 00:33:51,540 Object data provider works for all of these two. 935 00:33:51,660 --> 00:33:53,060 So do lots of other .NET gadgets. 936 00:33:54,080 --> 00:33:56,100 Assembly installer I feel like honestly is more 937 00:33:56,100 --> 00:33:58,340 useful for doing a ping back to an HTTP URL 938 00:33:58,340 --> 00:34:00,200 because that lets you do that blind 939 00:34:00,200 --> 00:34:01,020 scanning I mentioned. 940 00:34:04,440 --> 00:34:05,880 And one way in the back. 941 00:34:06,000 --> 00:34:07,620 You might have to come forward for me to hear you. 942 00:34:17,500 --> 00:34:18,220 . 943 00:34:36,460 --> 00:34:38,320 So the question was whether 944 00:34:38,320 --> 00:34:40,100 automapper and fastmapper that 945 00:34:40,100 --> 00:34:42,280 also use that sort of reflection under 946 00:34:42,360 --> 00:34:43,380 the covers are also vulnerable. 947 00:34:43,900 --> 00:34:45,440 I'll admit I haven't looked at those. 948 00:34:45,520 --> 00:34:48,080 I'm honestly not quite sure what you're referring to. 949 00:34:48,180 --> 00:34:50,160 So maybe we can talk a little bit more about it after this. 950 00:34:54,400 --> 00:34:54,800 And... 951 00:34:56,380 --> 00:34:58,040 Well, if there's no other questions, 952 00:34:58,160 --> 00:34:59,600 I'll finish there. Thank you.