00:00:00.500 --> 00:00:06.907 >> I have a question. >> What's the question? >> Is this your 00:00:06.907 --> 00:00:12.913 first time speaking at DEF CON? >> It is. >> Oh, excellent! [ 00:00:15.415 --> 00:00:16.383 APPLAUSE ] >> So, actually, I wanted to say that we were 00:00:16.383 --> 00:00:20.587 experimenting with something new this year at DEF CON. Can you 00:00:20.587 --> 00:00:24.892 set us up, please? We were looking for a drone delivery 00:00:24.892 --> 00:00:30.898 system. >> What is this? [ LAUGHTER ] >> What do you think? 00:00:45.913 --> 00:00:51.351 >> Yeah. >> You all know how this works. You've been here 00:00:51.351 --> 00:00:57.357 long enough. >> Okay. >> Whoa. Hi! [ APPLAUSE ] >> Here. Thank 00:01:00.494 --> 00:01:06.500 you. >> Cheers. >> And now, back to our regularly scheduled talk. 00:01:10.470 --> 00:01:16.476 >> So... [ LAUGHTER ] It is a bit warmer. Let's see how the 00:01:20.480 --> 00:01:27.421 exploitation process takes place. If you are trying to 00:01:27.421 --> 00:01:30.824 exploit something, you have to first of all find a 00:01:30.824 --> 00:01:34.361 vulnerability and this vulnerability has to be useful. 00:01:34.361 --> 00:01:38.598 By useful, I mean that you have to have a flow of the program 00:01:38.598 --> 00:01:44.604 that you want. Once you are able to do this, then, you can 00:01:46.974 --> 00:01:52.980 perform your desired actions. I don't know, copying wallets and 00:01:57.851 --> 00:02:02.556 doing your actual final aim. Our thought process is on this last 00:02:02.556 --> 00:02:07.160 part. We are assuming that we are able to divert the 00:02:07.160 --> 00:02:12.332 (Indiscernible) and we are going to see what we do afterwards and 00:02:12.332 --> 00:02:16.503 how do we do the last part of the exploitation process with 00:02:16.503 --> 00:02:22.275 the counter measures that I present. Just being able to 00:02:22.275 --> 00:02:29.583 divert it is not enough. The question is where do I point it 00:02:29.583 --> 00:02:34.888 to? That's the important thing. Since it is 2015, we can up load 00:02:34.888 --> 00:02:38.825 a shell target and the operating system prevents this kind of 00:02:38.825 --> 00:02:42.262 stuff. The hackers and the exploiters came out with the 00:02:42.262 --> 00:02:48.268 concept of the code attacks. We cannot inject new code. So, we 00:02:52.606 --> 00:02:57.477 use existing code. So, we came up with all of the return 00:02:57.477 --> 00:03:01.548 orientated programming, which you are a bit familiar with. The 00:03:01.548 --> 00:03:08.555 problem is that we are able to still perform our attack if we 00:03:08.555 --> 00:03:14.561 are not able to enter a new code, a shell code. This is an 00:03:17.164 --> 00:03:22.702 ASLR, which is layout presentation and the code that 00:03:22.702 --> 00:03:28.842 you want to use, for instance, the system library functions, 00:03:28.842 --> 00:03:36.249 and those kind of functions are not in the same position. Their 00:03:36.249 --> 00:03:40.487 position is not deterministic. The code that I want to use is 00:03:40.487 --> 00:03:46.126 there, but where is it? The typical situation to get around 00:03:46.126 --> 00:03:52.432 ASLR is use the functions that are already imported. The main 00:03:52.432 --> 00:03:54.434 executable and let's suppose that the main executable uses 00:03:54.434 --> 00:03:56.436 the print function, which is very common. It keeps in memory, 00:03:56.436 --> 00:03:58.438 the memory area, which is dedicated to the main binary, 00:03:58.438 --> 00:04:00.373 which is a reference to this object and holds a reference to 00:04:00.373 --> 00:04:02.375 the print function. The typical way to bypass is the ASLR is try 00:04:02.375 --> 00:04:04.377 and read the address of this printer function, which is 00:04:04.377 --> 00:04:06.379 important by the binary and if you are targeting the system of 00:04:06.379 --> 00:04:08.381 the library and let's compute the distance between the printer 00:04:08.381 --> 00:04:10.383 function and the function that we are want to inject to perform 00:04:10.383 --> 00:04:12.385 our malicious operations and you can add the distance to reach 00:04:12.385 --> 00:04:14.387 exactly and we know the address of exactly and we can code 00:04:14.387 --> 00:04:16.389 exactly from our tech. This works, but the problem is that 00:04:16.389 --> 00:04:18.391 first of all, it requires, you don't just have to be able to 00:04:18.391 --> 00:04:20.393 divert the code, but you have to be able to leak this piece of 00:04:20.393 --> 00:04:22.395 information. You need at least, two vulnerabilities. You need 00:04:22.395 --> 00:04:24.397 knowledge about the layout of the library that you are 00:04:24.397 --> 00:04:26.399 targeting. You need the exact copy, meaning the exact copy of 00:04:26.399 --> 00:04:28.401 the library and that's not always the case. There are 00:04:28.401 --> 00:04:30.403 instances where you don't have access to it. And there is 00:04:30.403 --> 00:04:32.405 another point; you need to interact with the attacker. It 00:04:32.405 --> 00:04:34.407 is not just that you launch your attack and it works and you do 00:04:34.407 --> 00:04:36.409 your exploitation and you have to read on the attacker side and 00:04:36.409 --> 00:04:38.411 then another page of the exploits. So, it is two-stage. 00:04:38.411 --> 00:04:40.413 This is a problem because your target (Indiscernible) and 00:04:40.413 --> 00:04:42.415 maybe, you have a JPG or a P cap file, which is open and you 00:04:42.415 --> 00:04:44.417 cannot really communicate, so this is a problem. How can we 00:04:44.417 --> 00:04:46.419 solve this problem? Let's try and zoom out a bit. Actually, 00:04:46.419 --> 00:04:48.421 our idea when we came up with this technique. Let's try and 00:04:48.421 --> 00:04:50.423 zoom out a bit. What are we trying to do? I have a name and 00:04:50.423 --> 00:04:52.425 I want its address and so I'm able to code it. If the 00:04:52.425 --> 00:04:54.427 operating system is doing its job, the coder. The dynamic 00:04:54.427 --> 00:04:56.429 coder is to take the main library or the library and see 00:04:56.429 --> 00:04:58.431 what the important functions, for instance, printer are and 00:04:58.431 --> 00:05:00.367 retain its address where the printer function actually 00:05:00.367 --> 00:05:02.369 resides in memory. Let's try and get to know this guy, the 00:05:02.369 --> 00:05:04.371 dynamic coder. First of all, I'm going to talk about dynamic 00:05:04.371 --> 00:05:06.373 coding and everything else on the context of ELF-based codecs. 00:05:06.373 --> 00:05:08.375 If we consider an ELF file executable, there are sections 00:05:08.375 --> 00:05:14.381 and the most important sections that you usually deal with and 00:05:14.381 --> 00:05:16.383 maybe, you have been doing reverse engine nearing and they 00:05:16.383 --> 00:05:22.389 are all dot text. All of the sections start with a dot. The 00:05:28.295 --> 00:05:30.797 actually binary code of the application and we have dot data 00:05:30.797 --> 00:05:35.001 and it holds all of the global data and they are not reliable 00:05:35.001 --> 00:05:38.572 and (Indiscernible) and it stands for we don't make it up. 00:05:38.572 --> 00:05:43.076 BSS, which is a section and it, is a global variable that is not 00:05:43.076 --> 00:05:47.314 initialized. And you would write a global array and if it is not 00:05:47.314 --> 00:05:51.184 initialized and when we see this piece of code, like a very 00:05:51.184 --> 00:05:55.388 simple program. It just prints out. It is not a code to the 00:05:55.388 --> 00:05:58.625 printer in the systematic library and like I said, the 00:05:58.625 --> 00:06:02.128 position is bungled and you cannot know prior to the time 00:06:02.128 --> 00:06:06.333 where the printer is going to end up. It codes the printer at 00:06:06.333 --> 00:06:10.537 PFT and it is a piece of assembly code that we are going 00:06:10.537 --> 00:06:13.473 to see. More importantly, it is establishing another section, 00:06:13.473 --> 00:06:16.710 which is a table. And one for each important function. 00:06:16.710 --> 00:06:19.646 Basically, let's see how it looks like. So, this front 00:06:19.646 --> 00:06:22.916 loading is used to support lazy loading and it allows you, when 00:06:22.916 --> 00:06:25.886 you start the program, instead of solving all of the important 00:06:25.886 --> 00:06:28.855 functions and getting the real address of the startup of the 00:06:28.855 --> 00:06:31.791 program, you retain the address the first time you code them. 00:06:31.791 --> 00:06:35.562 So, if there is a function, it is not going to be called and 00:06:35.562 --> 00:06:39.065 you are saving time. And it is faster for the end user. It 00:06:39.065 --> 00:06:42.302 works like this. The first time it is being coded, the main 00:06:42.302 --> 00:06:45.405 binary is going to pass the code to the main loader and have this 00:06:45.405 --> 00:06:47.407 function, which we will explore in a little bit. Otherwise, it 00:06:47.407 --> 00:06:49.409 is going to jump to the cache version and if this the print F, 00:06:49.409 --> 00:06:51.411 somewhere in memory, we are going to see where the place 00:06:51.411 --> 00:06:53.413 where the others of print F is kept. The run timers going to 00:06:53.413 --> 00:06:55.415 take care of finding where print F is and storing the address and 00:06:55.415 --> 00:06:57.417 the cache of the print F address and also, call the function. It 00:06:57.417 --> 00:06:59.352 takes two parameters. What is a relocation? A relocation is 00:06:59.352 --> 00:07:01.354 basically, a directive for the dynamic loader telling him, so 00:07:01.354 --> 00:07:03.356 this symbol, it is a concept that represents like a function. 00:07:03.356 --> 00:07:05.358 For instance, in a library or a global variable in an external 00:07:05.358 --> 00:07:07.360 library, so the symbol. Take the symbol, so for instance, print F 00:07:07.360 --> 00:07:09.362 in this case, and write its address at this specific address 00:07:09.362 --> 00:07:11.364 and it represents where the address symbol has to be written 00:07:11.364 --> 00:07:13.366 and it is basically, the identifier of the symbol. The 00:07:13.366 --> 00:07:15.368 second parameter of the runtime and it is the index in a table 00:07:15.368 --> 00:07:17.370 of this relocation. This is relative of the P section and it 00:07:17.370 --> 00:07:19.372 is relocation of the data infraction. It is an identifier 00:07:19.372 --> 00:07:21.374 in another table, which is an array of symbols. A lot of 00:07:21.374 --> 00:07:27.380 details we are not interested in. Some of the things that we 00:07:57.043 --> 00:07:58.978 are interested in is the field code and then, there is another 00:07:58.978 --> 00:08:00.980 table. This is the last one, I promise. It is called 00:08:00.980 --> 00:08:02.982 (Indiscernible) and it has the definition or the name of all of 00:08:02.982 --> 00:08:04.984 the symbols that are imported in a certain binary and this is an 00:08:04.984 --> 00:08:06.986 index in the table, from the relocation we pass from the 00:08:06.986 --> 00:08:08.989 symbol table, and from the symbol table, we pass to the 00:08:08.989 --> 00:08:10.990 name. In this case, it is print F. We are going to get back on 00:08:10.990 --> 00:08:12.992 these things. To recap, it finds the symbol and its location and 00:08:12.992 --> 00:08:14.994 finds its address. From the location to the symbol and from 00:08:14.994 --> 00:08:16.996 the name to the address. It is right that the address and the 00:08:16.996 --> 00:08:18.998 others specified in the location and then, it transferred the 00:08:18.998 --> 00:08:21.000 execution to the debt function and it also calls it. It -- as 00:08:21.000 --> 00:08:23.002 you might understand at this point and it is going to point 00:08:23.002 --> 00:08:25.004 to the address of the print cache address and right there, 00:08:25.004 --> 00:08:27.006 it tells us the address of this function. Next time, I'm going 00:08:27.006 --> 00:08:33.012 to code the trampoline and just jump right there. It is sort of 00:09:48.455 --> 00:09:54.461 organization. Okay, where does this print address actually 00:10:21.120 --> 00:10:28.127 stay? It is in another section which is called dot MLP. It is 00:10:28.127 --> 00:10:33.533 an entry point of where these cached addresses are. Initially, 00:10:33.533 --> 00:10:39.472 they are all initialized and they are initially, they are -- 00:10:39.472 --> 00:10:45.945 let's try and come up with an attack to this system. First, 00:10:45.945 --> 00:10:50.116 with assumptions and our assumption is that we are able 00:10:50.116 --> 00:10:56.122 to write a binary location and let's say that we have a small 00:11:19.145 --> 00:11:25.151 gadget and I have this value and the address. Very simple stuff. 00:11:28.488 --> 00:11:31.758 What can we do? If you look at this setting, the idea is what 00:11:31.758 --> 00:11:35.728 if I'm able to replace the print F string for instance -- if I'm 00:11:35.728 --> 00:11:38.898 able to solve and replace that string and evoke the function 00:11:38.898 --> 00:11:42.869 with the print index, what the loader is going to do is be go 00:11:42.869 --> 00:11:46.573 through the relocation and in the end, it is going to end in 00:11:46.573 --> 00:11:50.376 the dynamic string table, but it won't find the print F. So, it 00:11:50.376 --> 00:11:56.382 will solve the address of the IP and evoke that function. In this 00:12:01.554 --> 00:12:07.560 case, we can evoke any function that we want if we are able to 00:12:48.801 --> 00:12:54.807 write out this memory arbitration. This approach does 00:13:06.953 --> 00:13:09.656 not work. There is no reason why the dynamic string table is 00:13:09.656 --> 00:13:11.658 writable. It is a string of information that you just write 00:13:11.658 --> 00:13:13.660 once and never change. This attack will not work. Even if 00:13:13.660 --> 00:13:15.662 you have this gadget and trying to load a known memory location 00:13:15.662 --> 00:13:17.664 and get an executable. Let's try around write around this. We 00:13:17.664 --> 00:13:19.666 have been talking about a lot of different sections, but the 00:13:19.666 --> 00:13:21.668 dynamic loader doesn't consider the sections by its name. It 00:13:21.668 --> 00:13:23.670 doesn't look up the POT section by name. It uses another section 00:13:23.670 --> 00:13:25.672 and it holds (Indiscernible) where the key represents one of 00:13:25.672 --> 00:13:27.674 the sections and the value is its actual address. For 00:13:27.674 --> 00:13:29.676 instance, the SIM table and a pointer to the dynamic SIM tab 00:13:29.676 --> 00:13:31.678 and etc. The nice thing is that the dot binary section is 00:13:31.678 --> 00:13:33.680 executable. We can trick it into thinking that the dynamic string 00:13:33.680 --> 00:13:35.682 table is somewhere else. We can build a fake string table in the 00:13:35.682 --> 00:13:37.684 DSS or any memory or any other memory that is bribable by us. 00:13:37.684 --> 00:13:39.686 It is always bribable. For instance, we go do the dynamic 00:13:39.686 --> 00:13:41.688 section and what the dynamic loader is going to do is going 00:13:41.688 --> 00:13:43.690 to the strings and instead of get to the dynamic string table, 00:13:43.690 --> 00:13:49.696 go to DSS. As the hacker, I form a string table and basically, we 00:14:04.844 --> 00:14:10.850 are able to form the attack in the sense of any library 00:14:30.837 --> 00:14:36.843 function. Okay, this approach is quite -- (Indiscernible) and 00:14:50.323 --> 00:14:56.329 actually, we were not the first thinking about this. So, the 00:15:07.206 --> 00:15:13.212 developers of the linked-inners is the link that we described. 00:15:33.433 --> 00:15:37.003 Why is the dynamic section loadable? It has to be writable 00:15:37.003 --> 00:15:43.009 when you start your binary, but after you initialize, you can 00:15:46.979 --> 00:15:48.981 write it as a section. Basically, our dynamic attack 00:15:48.981 --> 00:15:50.983 doesn't work anymore. Maybe, we can do something else? So far, 00:15:50.983 --> 00:15:52.985 we have played with the dot dynamic section. What happens if 00:15:52.985 --> 00:15:54.987 instead of making a point in the entry of the existing 00:15:54.987 --> 00:15:56.989 relocation, we put an index that is big enough to load after the 00:15:56.989 --> 00:15:58.991 relative section and maybe, we can trick the loader to going 00:15:58.991 --> 00:16:00.927 somewhere more interesting? Let's take a look. Maybe not in 00:16:00.927 --> 00:16:02.929 memory relocation, but in DSS, let's suppose that the index is 00:16:02.929 --> 00:16:04.931 the start from the beginning of the real PLT section and if we 00:16:04.931 --> 00:16:06.933 put a section big enough, we can go through the dot dynamic and 00:16:06.933 --> 00:16:08.935 end up with dot data in dot DSS and if you are able to trick the 00:16:08.935 --> 00:16:10.937 loader in going there and able to forge a fake relocation there 00:16:10.937 --> 00:16:12.939 and we can basically build our own relocation and solve any 00:16:12.939 --> 00:16:14.941 library function without touching the dynamic section, 00:16:14.941 --> 00:16:16.943 which is not writable. This is an example of the thing. We put 00:16:16.943 --> 00:16:18.945 an index, which is big enough to get into the DSS, where we forge 00:16:18.945 --> 00:16:20.947 the relocation and it forges the fake symbol. It is the same 00:16:20.947 --> 00:16:22.949 frequency and then, the same trick again. The off string in 00:16:22.949 --> 00:16:24.951 the dynamic table and we are basically loading all of the 00:16:24.951 --> 00:16:26.953 data structure, which is needed to solve the binary function 00:16:26.953 --> 00:16:28.955 (Indiscernible). We have to put our info in the SD field to be 00:16:28.955 --> 00:16:31.090 able to form our attack. The binary is round and like other 00:16:31.090 --> 00:16:37.096 several distributions and it is a symbol version which basically 00:16:37.096 --> 00:16:44.337 allows you to depend on any print F function, but a specific 00:16:44.337 --> 00:16:50.943 function of print F. For instance, I want the print F 00:16:50.943 --> 00:16:57.583 from the point, I don't know, .22. This is actually an 00:16:57.583 --> 00:17:04.156 extension and since it is popular, we have to deal with 00:17:04.156 --> 00:17:11.998 it. If the symbol versioning is enabled, it is not used just as 00:17:11.998 --> 00:17:18.638 an index in the symbol table, but another table, which is 00:17:18.638 --> 00:17:23.409 called a new version table, which I will talk about. The 00:17:23.409 --> 00:17:26.412 fact is that the index is used for two different things and we 00:17:26.412 --> 00:17:28.714 have additional constraint and we have to do two different 00:17:28.714 --> 00:17:31.684 things and it is related to the version that is not looked into. 00:17:31.684 --> 00:17:37.790 We can make the point and make the thing going to zero, zero. 00:17:37.790 --> 00:17:43.796 You have basically, disabled the version. Is it doable? Yes. And 00:17:57.543 --> 00:17:59.478 it can also be automated. The problem is that there are some 00:17:59.478 --> 00:18:01.480 situations where this is very, very hard. The 46-bit minor and 00:18:01.480 --> 00:18:03.482 huge pages and you have memory page that are large, up to a 00:18:03.482 --> 00:18:05.484 megabyte and the only part of the binary and we have the text, 00:18:05.484 --> 00:18:07.486 the relocation table, the dynamic string table and all of 00:18:07.486 --> 00:18:09.488 these things and it is very far away and like one minute away 00:18:09.488 --> 00:18:11.490 from the writable page. It makes it really hard to satisfy the 00:18:11.490 --> 00:18:13.492 constraint that we just solved. The problem is that 64-bit 00:18:13.492 --> 00:18:15.494 binaries are pretty popular. We found another solution for this. 00:18:15.494 --> 00:18:17.496 The idea in this case is not to play around the relocation but 00:18:17.496 --> 00:18:19.498 the current object info. Let's look at the current object info. 00:18:19.498 --> 00:18:21.500 This pointer, it is always stored in our point of entry in 00:18:21.500 --> 00:18:23.502 the GOT table. The second entry of the GOT table. It has a field 00:18:23.502 --> 00:18:25.504 called L info and it actually keeps a cache of pointer in the 00:18:25.504 --> 00:18:27.506 dot dynamic section. We can go basically back to the first 00:18:27.506 --> 00:18:29.508 attack when we were tampering with the dot dynamic section. 00:18:29.508 --> 00:18:31.510 This is what happens. We go to the STR tab, which is the 00:18:31.510 --> 00:18:33.512 pointer. The dynamic entry itself a pointer to the dynamic 00:18:33.512 --> 00:18:35.514 string table and we can change its value and make it point DSS 00:18:35.514 --> 00:18:41.354 and build it a fake dynamic entry and tricks the dynamic 00:18:41.354 --> 00:18:47.360 pointer to thinking that the string table is in this area. We 00:18:57.103 --> 00:19:00.740 are forming back to the first attack that we solved. We are 00:19:00.740 --> 00:19:06.746 still tampering with the dot dynamic table, but indirectly, 00:19:18.958 --> 00:19:24.964 like corrupting the section of the dot dynamic loader and it is 00:19:28.834 --> 00:19:30.836 always in a GOT, in the first, second entry of the GOT. Still, 00:19:30.836 --> 00:19:32.838 there is initial unprotection to this. The railroad comes in two 00:19:32.838 --> 00:19:34.840 flavors. Partial, which we just saw. Full railroad has all of 00:19:34.840 --> 00:19:36.842 the features of partial railroad, but it disables the 00:19:36.842 --> 00:19:38.844 binary loading. The GOT is initialized and we cannot write 00:19:38.844 --> 00:19:40.846 in the GOT anymore. Also, since they are not used any longer, 00:19:40.846 --> 00:19:44.283 the point of entry is no longer initialized and we lost the 00:19:44.283 --> 00:19:47.753 pointer to this critical infrastructure to bypass the 00:19:47.753 --> 00:19:52.558 railroad. We were getting its address from the GOT two entry. 00:19:52.558 --> 00:19:57.563 With these three things, we don't have a pointer to the link 00:19:57.563 --> 00:20:03.569 map; we don't have a pointer to the (Indiscernible) and a 00:20:10.342 --> 00:20:16.348 pointer to the (Indiscernible). It seems like we are pretty far. 00:20:34.033 --> 00:20:36.602 This is the feature like the typical feature and it is 00:20:36.602 --> 00:20:38.737 staying there and waiting for someone to abuse it. And here 00:20:38.737 --> 00:20:40.806 are. This is an entry of the dynamic table and certain events 00:20:40.806 --> 00:20:42.808 related to dynamic loading and we have a new library being 00:20:42.808 --> 00:20:44.944 loaded and you can execute it and the new symbols and that we 00:20:44.944 --> 00:20:46.946 don't really care about. The nice thing is that the dynamic 00:20:46.946 --> 00:20:48.948 entry doesn't point to a section, but the early bag 00:20:48.948 --> 00:20:50.950 structure and that's a pointer to link map. We are able to go 00:20:50.950 --> 00:20:53.018 through these and back to the previous attack. It is not that 00:20:53.018 --> 00:20:57.189 simple. As we said, we also -- sorry -- this is the last 00:20:57.189 --> 00:21:02.761 drawing I'm showing you. I promise. [ LAUGHTER ] This is 00:21:02.761 --> 00:21:07.099 really interesting because we don't have a pointer and we 00:21:07.099 --> 00:21:10.236 found a pointer (Indiscernible) and dynamic entry. Let's see how 00:21:10.236 --> 00:21:16.242 this goes. In the dot dynamic section, we follow its value and 00:21:18.577 --> 00:21:22.181 we get (Indiscernible) bag and then, we have this field and 00:21:22.181 --> 00:21:25.651 which points are the link structure that we saw before. 00:21:25.651 --> 00:21:31.657 First thing that we do is corrupt the DTRS entry and 00:21:46.972 --> 00:21:48.974 that's the dynamic strain. We do what we did before. We build a 00:21:48.974 --> 00:21:50.976 fake dynamic entry and a table. What will the dynamic loader do? 00:21:50.976 --> 00:21:52.978 It is going to through all of this stuff and solve it at the 00:21:52.978 --> 00:21:54.980 end. Nice. But then, one of the features, you saw, it is storing 00:21:54.980 --> 00:21:56.982 the address exactly in the GOT. The GOT is being completely 00:21:56.982 --> 00:21:58.984 initialized because of the full railroad. So, we get a sec load. 00:21:58.984 --> 00:22:00.920 So, we have to fake another entry of the link map data 00:22:00.920 --> 00:22:02.922 structure and that's the rail and that's a pointer holding a 00:22:02.922 --> 00:22:04.924 pointer to the relocation table. We create a fake relocation 00:22:04.924 --> 00:22:06.926 table and pointing to the GOT and pointing to like in this 00:22:06.926 --> 00:22:08.928 case, a memory area just after it. We solve also this problem. 00:22:08.928 --> 00:22:10.930 We have one last problem. The trick is here, usually, not 00:22:10.930 --> 00:22:12.932 usually, always, it is protected with the full railroad. The 00:22:12.932 --> 00:22:14.934 libraries are not protected with full railroad. If we are able to 00:22:14.934 --> 00:22:16.936 get the full GOT of the libraries, we are able to get it 00:22:16.936 --> 00:22:18.938 resolved. The structure is not just a structure per se; it is 00:22:18.938 --> 00:22:20.940 part of a list of all data structures representing all of 00:22:20.940 --> 00:22:22.942 the loaded F objects. We can dereference the exit that is 00:22:22.942 --> 00:22:24.944 entering the dynamic in the linked-in list and the data 00:22:24.944 --> 00:22:29.181 structure of any library and we get the others of the GOT and we 00:22:29.181 --> 00:22:33.285 go to the third entry and get the address and problem solved. 00:22:33.285 --> 00:22:37.389 We are building this up all together and able to bypass the 00:22:37.389 --> 00:22:41.493 full railroad, which is a pretty cool thing. Okay, so this is 00:22:41.493 --> 00:22:46.699 very interesting, but how can we do that? We implemented 00:22:46.699 --> 00:22:52.705 Leakless, which is the name of our tool and it is full binary 00:23:09.088 --> 00:23:15.094 and tells us the approach that is most treatable based on the 00:23:25.504 --> 00:23:29.541 protection that is enabled and the 64-bit pages and those kind 00:23:29.541 --> 00:23:36.115 of things and produce two different kinds of output. It 00:23:36.115 --> 00:23:42.321 can tell you to the this thing. And adjacent on five, which 00:23:42.321 --> 00:23:44.323 basically exploits you and write this thing here and write this 00:23:44.323 --> 00:23:46.325 thing there and runtime is resolved. If you provide 00:23:46.325 --> 00:23:48.327 Leakless with the gadgets that it needs and we are going to see 00:23:48.327 --> 00:23:50.329 the kind of gadgets that it needs, it is going to produce 00:23:50.329 --> 00:23:52.331 the exploit to resolve one or more functions one after the 00:23:52.331 --> 00:23:54.333 other and call them with the appropriate parameter. You can 00:23:54.333 --> 00:23:56.335 see the code there on the day that we just published a you can 00:23:56.335 --> 00:23:58.337 play around. Gadgets, we talked about gadgets and depending on 00:23:58.337 --> 00:24:00.272 the four attacks that I presented and the first one was 00:24:00.272 --> 00:24:07.346 not working. The first, naive approach. Depending on the 00:24:07.346 --> 00:24:13.352 attack that we are dealing with, we need different things. The 00:24:22.628 --> 00:24:26.365 first one, basically, overwriting the dot dynamic 00:24:26.365 --> 00:24:31.804 section and you need a gadget and giving an address and it 00:24:31.804 --> 00:24:37.643 writes there. Basically, all (Indiscernible) all of the 00:24:37.643 --> 00:24:39.812 technique need these kind of gadgets. O stands for partial 00:24:39.812 --> 00:24:41.981 railroad and then all of this other kind of stuff, and then, 00:24:41.981 --> 00:24:44.183 full railroad. The one that we use to tamper with the data 00:24:44.183 --> 00:24:46.518 structure and you have a pointer and you have an offset and you 00:24:46.518 --> 00:24:48.721 reference it and you have a value there. This is used for 00:24:48.721 --> 00:24:50.723 the huge pages and the full railroad. This one is basically, 00:24:50.723 --> 00:24:53.058 a gadget that we need to store somewhere some data that we took 00:24:53.058 --> 00:24:55.060 from those and all of those data structures and basically, you 00:24:55.060 --> 00:24:57.229 choose a memory where you want this address and you take it 00:24:57.229 --> 00:24:59.465 from this data structure and this offset and in this case, I 00:24:59.465 --> 00:25:03.135 initially skipped over this. For the first three attacks and to 00:25:03.135 --> 00:25:11.043 call the other runtime, we consider using a part of the DLP 00:25:11.043 --> 00:25:17.649 and that's tampering. So, we need four gadgets and depending 00:25:17.649 --> 00:25:22.921 on the exploitation. What loaders are actually vulnerable 00:25:22.921 --> 00:25:30.162 to this? We tested our linked-in to the GOT and (Indiscernible) 00:25:30.162 --> 00:25:36.735 and embedded. They are assisting the libraries for the embedded 00:25:36.735 --> 00:25:44.009 systems and open the DST and they basically, all behave like 00:25:44.009 --> 00:25:49.915 the same if you think about the standard L features except for 00:25:49.915 --> 00:25:55.487 the minor modifications and they all cache the dynamic entry, 00:25:55.487 --> 00:26:01.059 some difference, but not a real big deal. We say that it is not 00:26:01.059 --> 00:26:03.662 bionic, as far as I know it supports the binaries and 00:26:03.662 --> 00:26:05.664 embedded system library. Basically, our attack is 00:26:05.664 --> 00:26:07.733 worthless. It is a feature. And the previous free loader, not 00:26:07.733 --> 00:26:09.968 the first, the second attack, I presented you; basically, the 00:26:09.968 --> 00:26:12.204 one which was overflowing the relocation table and the symbol 00:26:12.204 --> 00:26:14.673 table and those kind of things does not work. These are 00:26:14.673 --> 00:26:16.942 actually checking the boundaries and they are the basic two 00:26:16.942 --> 00:26:19.845 things to do, but they are not the only ones. The other one 00:26:19.845 --> 00:26:22.548 does work. Vulnerable and not vulnerable. Let's recap. What 00:26:22.548 --> 00:26:27.152 are the advantages of Leakless? It is single stabling. You don't 00:26:27.152 --> 00:26:30.489 require interaction with the victim. We are not sending back 00:26:30.489 --> 00:26:32.491 attack on anything. We are doing a single exploit. Offline 00:26:32.491 --> 00:26:37.930 attacks, which before were not feasible, it is reliable and it 00:26:37.930 --> 00:26:44.203 is deterministic and there is nothing left to randomness and 00:26:44.203 --> 00:26:51.743 it is very deterministic and then, you don't need a copy of 00:26:51.743 --> 00:26:59.218 the target library. If you think about that in the beginning, I 00:26:59.218 --> 00:27:05.491 told you that you need to compute in a particular 00:27:05.491 --> 00:27:11.763 situation and you have to compute the distance from print 00:27:11.763 --> 00:27:17.769 F. You need the library. In this case, we do not care about the 00:27:20.539 --> 00:27:27.446 layout of the library. We just abuse the dynamic loader, which 00:27:27.446 --> 00:27:33.452 does it in the proper way. In most cases, it is very portable 00:27:35.587 --> 00:27:41.593 and open to DSP and so forth. As I told you, there are minor 00:27:44.363 --> 00:27:50.636 exploitations to the network. You need to implement what the 00:27:50.636 --> 00:27:58.176 loader is doing and if you go through all of the relocation 00:27:58.176 --> 00:28:05.617 symbols and all of those things is very complex and it takes 00:28:05.617 --> 00:28:10.789 very long. And also the advantage of the Leakless, once 00:28:10.789 --> 00:28:16.795 you set-up the data structure and if you want to make multiple 00:28:18.997 --> 00:28:24.803 calls to different library functions and you just need to 00:28:24.803 --> 00:28:30.809 change the name of the function that you want to call and just 00:28:33.612 --> 00:28:40.385 call again (Indiscernible) and instead of with the loader, you 00:28:40.385 --> 00:28:47.159 have to do all of the processes. Shorter means higher 00:28:47.159 --> 00:28:53.932 feasibility. If you don't want to interact again, you cannot 00:28:53.932 --> 00:28:58.503 read. If you want to do it single stage, being short is 00:28:58.503 --> 00:29:02.274 important. (Indiscernible) criticism that one is going to 00:29:02.274 --> 00:29:07.479 make such an attack is why don't you just do this with Cisco? 00:29:07.479 --> 00:29:12.351 Because it may not be available. If you can do Cisco, you can do 00:29:12.351 --> 00:29:16.688 everybody that you want. But with the new process and for 00:29:16.688 --> 00:29:22.561 instance, if you want do exactly, it is kind of invasive 00:29:22.561 --> 00:29:28.567 and here is an example that we came up with. It is a single 00:29:33.572 --> 00:29:39.578 code for using the functions with the client. What we are 00:29:49.354 --> 00:29:57.129 doing here, we are taking the pointer to the proxy object and 00:29:57.129 --> 00:29:59.131 if the attack that we want to carry on is set a proxy, so I 00:29:59.131 --> 00:30:01.133 can intercept the Instant Messenger traffic for the user. 00:30:01.133 --> 00:30:03.135 We connect and disconnect the user. Supposed to with Cisco 00:30:03.135 --> 00:30:05.137 somehow, but we are losing system functionality and it is 00:30:05.137 --> 00:30:07.139 less intrusive. It is doing everything, except finding the 00:30:07.139 --> 00:30:09.141 gadgets. Maybe, in the future, we can have some gadget finding. 00:30:09.141 --> 00:30:11.143 The counterattack and this is an actual solution and with the 00:30:11.143 --> 00:30:13.145 survey, the PIP is not being deployed a lot. The solution is 00:30:13.145 --> 00:30:15.147 used on the binaries they deem critical. Why they deploy on all 00:30:15.147 --> 00:30:17.149 of the binaries doesn't make sense to me. Just remove it or 00:30:17.149 --> 00:30:19.151 use it if you want an environment variable. And then, 00:30:19.151 --> 00:30:21.153 with the data loader, you get a crash and it is also very good 00:30:21.153 --> 00:30:23.155 conformation and the key point is a that this point of core 00:30:23.155 --> 00:30:25.157 confidence of the operating system should be recoded with 00:30:25.157 --> 00:30:27.159 security in mind. The ones that we have inspected are just using 00:30:27.159 --> 00:30:29.161 user input. And since they are all over the place, it is very 00:30:29.161 --> 00:30:31.163 dangerous. If you are able to attack them, you are able to 00:30:31.163 --> 00:30:33.165 obtain something that is portable and all over the place. 00:30:33.165 --> 00:30:35.167 The last thing, I want to thank all of the people who are 00:30:35.167 --> 00:30:37.169 working with me. Yan is not here. And that's basically all. 00:30:37.169 --> 00:30:39.171 Maybe, I have a second to do a very short -- just to show you 00:30:39.171 --> 00:30:41.173 some code. So, this is where -- we are just trying to implement 00:30:41.173 --> 00:30:43.175 and attack a real binary. We wanted to do something real. We 00:30:43.175 --> 00:30:45.177 took a very basic step and the step buffer overflow and we 00:30:45.177 --> 00:30:47.179 tried to generate an exploit an attack with Leakless and just 00:30:47.179 --> 00:30:49.181 providing the gadgets. And testing the pickup, which I 00:30:49.181 --> 00:30:51.183 generated and I got a shell. [ APPLAUSE ] It is very easy. 00:30:51.183 --> 00:30:53.185 Shell is always good. And the same experience for you, just 00:30:53.185 --> 00:30:55.187 trust me. The last thing and this is the part, Leakless has 00:30:55.187 --> 00:30:57.189 been implemented in Python and this is the code that you need 00:30:57.189 --> 00:30:59.124 to write if you want to provide info to them, to Leakless. It is 00:30:59.124 --> 00:31:01.126 order code that could be factorized out and it is 00:31:01.126 --> 00:31:03.128 basically, tape the gadgets and mix them together and the part 00:31:03.128 --> 00:31:05.130 of Leakless, which is just from the binary. I wanted to show you 00:31:05.130 --> 00:31:07.132 the adjacent output and this is the Leakless, and we asked him 00:31:07.132 --> 00:31:09.134 to produce (Indiscernible) the adjacent format, which is the 00:31:09.134 --> 00:31:11.136 second one I presented. What he does, he basically gives off 00:31:11.136 --> 00:31:17.142 some instructions like write this thing at this address. If 00:31:55.046 --> 00:31:57.149 you don't want it to be generated automatically because 00:31:57.149 --> 00:32:03.088 maybe it is a complicated setting, it can give you the 00:32:27.245 --> 00:32:33.251 instruction to perform the attack. And with this, thank you 00:32:44.830 --> 00:32:47.399 for attention. [ APPLAUSE ]