[00:01.560 --> 00:07.040] Welcome, welcome, welcome to DEF CON. My name is Dr. Bramall [00:07.040 --> 00:10.340] Brizendine. I am the director of the Verona Lab, which deals [00:10.340 --> 00:14.300] with vulnerability research. Creator of the Shell WOS, which [00:14.300 --> 00:18.200] allows us to utilize Windows syscalls in shellcode. I've [00:18.200 --> 00:20.920] created the JopRocket and RopRocket, both of which deal [00:20.920 --> 00:23.940] with return oriented programming and jump oriented programming. [00:23.940 --> 00:27.720] And I've also created an NSA funded research project called [00:27.720 --> 00:31.520] Sherem, which allows us to analyze, uh, shellcode. Uh, I've [00:31.520 --> 00:34.900] spoken at many different conferences in the past. Um, and [00:34.900 --> 00:39.880] I'm also an assistant professor of cyber security. I have a PhD [00:39.880 --> 00:45.120] in cyber operations, which is a highly technical degree. And all [00:45.120 --> 00:48.700] of those, uh, previous projects have, um, previously been [00:48.700 --> 00:54.120] presented at DEF CON, so check them out. My co-speaker is, uh, [00:54.120 --> 00:59.140] Shiva Shashank Kusuma. He is a research assistant and, uh, he [00:59.140 --> 01:02.000] has a master's in computer science and is pursuing a [01:02.000 --> 01:05.520] master's in cyber security. Uh, he's looking for internship [01:05.520 --> 01:10.420] opportunities for the summer as well. So, our agenda. What are [01:10.420 --> 01:14.300] we going to focus on? Well, firstly, we'll talk briefly [01:14.300 --> 01:18.900] about a general approach to shellcodeless ROP. How do we [01:18.900 --> 01:21.720] create unique patterns to facilitate process injection? [01:21.720 --> 01:25.320] Some generic ROP techniques for process injection. And then we [01:25.320 --> 01:30.240] will look at a sample process injection technique that has a, [01:30.240 --> 01:35.020] uh, highly novel solution to a rather significant problem. We'll [01:35.020 --> 01:40.360] have a demo and then we'll have another brief, uh, uh, process [01:40.360 --> 01:44.760] injection and then we'll, we will conclude. So, some, uh, [01:44.760 --> 01:48.360] preliminary words on our experiment. Now this, when we, [01:48.360 --> 01:51.380] we conducted this research, we did it on a contrived binary [01:51.380 --> 01:55.000] uh, one that is intentionally vulnerable and is filled with [01:55.000 --> 01:57.780] convenient gadgets because we want our work to be applicable [01:57.780 --> 02:02.160] not just to one particular vulnerable binary but to [02:02.160 --> 02:05.380] potentially, uh, any binary. So we want to discover everything [02:05.380 --> 02:08.420] that is possible. And this research is really focused on, [02:09.080 --> 02:13.280] uh, ROP from the standpoint of you compromise a binary. It's [02:13.280 --> 02:15.880] not something where we're trying to integrate ROP and some kind [02:15.880 --> 02:21.040] of custom malware or some kind of custom red team software. So [02:21.040 --> 02:24.300] let's introduce the idea of shellcode with ROP. What does [02:24.300 --> 02:28.020] it mean exactly? Well, it's this idea of instead of, uh, bypassing [02:28.020 --> 02:31.980] data execution prevention depth, we are instead going to invoke [02:31.980 --> 02:36.700] the, uh, functionality of a shellcode directly via ROP [02:36.700 --> 02:41.880] gadgets. And it's something that has very seldom been done in the [02:41.880 --> 02:48.240] Windows ecosystem. When you see it, it's almost always 2, 3 APIs [02:48.240 --> 02:51.340] chained together. But you'll see, uh, later today that we [02:51.340 --> 02:56.900] have, uh, vastly, uh, more APIs to achieve what we want to do. [02:57.300 --> 03:00.280] Some also, uh, some previous work on shellcode with ROP. [03:00.280 --> 03:03.300] There's a video link in the slides so I do encourage you to, [03:03.300 --> 03:07.500] uh, check it out if you're interested. So in terms of [03:07.500 --> 03:11.220] approaching shellcode with ROP, there are a couple approaches [03:11.220 --> 03:15.200] we could take. One is utilizing push add where we're going to [03:15.200 --> 03:19.680] populate values on, uh, certain registers, uh, with certain [03:19.680 --> 03:24.300] predefined values. Um, and then that causes them to be loaded [03:24.300 --> 03:27.800] onto the stack in a, a certain predefined order. And we'll also [03:27.800 --> 03:31.120] use move dereference or the sniper technique and this allows [03:31.120 --> 03:34.160] us to precisely write our values to the stack and we can then [03:34.160 --> 03:38.880] increment or decrement to the next, uh, slot that we want to [03:38.880 --> 03:43.280] provide values for. So those are both critically, uh, important [03:43.280 --> 03:46.640] for us. And I want to re-emphasize the importance of [03:46.640 --> 03:49.200] this idea of finding patterns because again, we're not really [03:49.200 --> 03:52.160] just approaching one process injection technique, but we want [03:52.160 --> 03:54.960] our work to be applicable broadly to many different [03:54.960 --> 03:58.380] techniques. How do we do this in terms of return oriented [03:58.380 --> 04:02.000] programming? So we really want to emphasize that, you know, we [04:02.000 --> 04:05.360] have these particular slots, uh, where we have, uh, registers [04:05.360 --> 04:09.900] going in a certain order. Uh, so we really, uh, weaponize this in [04:09.900 --> 04:14.160] terms of developing new patterns for different APIs, uh, both [04:14.160 --> 04:17.940] Windows APIs as well as native APIs to allow us to invoke those [04:17.940 --> 04:23.320] easily using return oriented programming. So, uh, and when [04:23.320 --> 04:27.080] using many different APIs, we want to be able to chain them [04:27.080 --> 04:30.640] together. Lar- kind of like the sense where you have a, uh, a [04:30.640 --> 04:32.800] ROP chain, you have different, uh, ROP gadgets chained [04:32.800 --> 04:35.260] together, we'll be chaining different APIs together. So you [04:35.260 --> 04:39.360] may get one, uh, return value, uh, in this case, uh, open [04:39.360 --> 04:43.040] process runtime address is provided to us in EAX. We can [04:43.040 --> 04:46.480] use that subsequently in a pattern for open process [04:46.480 --> 04:52.500] because, of course, we need to call open process. So a large [04:52.500 --> 04:55.500] part of our research is really focused on generating a lot of [04:55.500 --> 04:57.600] these different types of patterns. And actually we've [04:57.720 --> 05:02.820] de- developed more than 150 unique patterns to provide a lot [05:02.820 --> 05:06.740] of opportunities. Um, we'll talk more in depth about some of them [05:06.740 --> 05:09.740] and we'll give some examples. But historically, uh, some of [05:09.740 --> 05:12.200] the tools that have done this have been things like, uh, [05:12.200 --> 05:16.100] Mona, Mona, you know, Virtual Alloc, Virtual Protect, and you [05:16.100 --> 05:18.620] have a couple patterns. So it's not a significant number of [05:18.620 --> 05:23.300] patterns. So let's talk now briefly about some generic ROP [05:23.300 --> 05:27.100] techniques that we can use to help us with, uh, process [05:27.100 --> 05:32.920] injection. So one is the idea of using function output, using [05:32.920 --> 05:37.280] that function output as a way to, um, to be a parameter. So [05:37.280 --> 05:40.900] Gitproc address and little library often go hand in hand [05:40.900 --> 05:44.520] and they're very familiar and well known. Uh, so with a little [05:44.520 --> 05:49.960] library, we can get a handle to a module, which is the, the base [05:49.960 --> 05:53.780] address of a certain DLL, and that's required for Gitproc [05:53.780 --> 05:57.460] address. So we take the output from the one, which is going to [05:57.460 --> 06:02.460] be returned to us in EAX, and then we use that subsequently in, [06:02.460 --> 06:06.060] uh, Gitproc address. And we'll do this time and time again, so [06:06.060 --> 06:09.220] return values as well as other out parameters if you're dealing [06:09.220 --> 06:14.020] with native APIs. And then this gets a little bit more complex, [06:14.020 --> 06:17.840] so structures is parameters. Can we do that with return oriented [06:17.840 --> 06:21.580] programming? Yeah, we actually can. So with a structure, we [06:21.580 --> 06:24.460] need to look clearly at the, the definition of the structure, and [06:24.460 --> 06:27.200] then we need to build that byte by byte through return oriented [06:27.200 --> 06:30.140] programming. And we'll typically do that with a series of move [06:30.140 --> 06:33.420] dereferences, and we can just increment and decrement to the, [06:33.420 --> 06:38.280] to the next slot as we slowly build our, uh, structure. And in [06:38.280 --> 06:41.180] some cases we may actually have nested structures, so take a [06:41.180 --> 06:44.960] look at adjust token privileges. We have several nested [06:44.960 --> 06:48.940] structures, and it needs to be done exactly correctly, or else [06:48.940 --> 06:56.000] it simply will just not work. Um, one thing that is also, uh, [06:56.000 --> 06:59.440] immensely important is this idea of storing important values, [06:59.940 --> 07:06.340] um, addresses, handles, things which may be obtained by calling [07:06.480 --> 07:09.060] a Windows API. If we call a Windows API to obtain one of [07:09.060 --> 07:12.200] these values, well that takes a lot of effort. And if we needed [07:12.200 --> 07:14.880] it again, well of course we don't want to call it a second [07:14.880 --> 07:19.760] time, so we will make an effort to save that value somewhere in [07:19.760 --> 07:22.860] memory, and then we can retrieve it later. So we might have a [07:22.860 --> 07:26.680] common reference point, we move ESP to a location, maybe we [07:26.680 --> 07:29.760] advance forward 500 bytes, and we just start writing different [07:29.760 --> 07:33.260] values there. And that common, uh, reference point can, will [07:33.260 --> 07:36.260] change from gadget to gadget, but we can manually calculate [07:36.260 --> 07:40.080] that and make adjustments, uh, as need be. So, again, you'll [07:40.080 --> 07:42.940] have lots of important values and you can save them and then [07:42.940 --> 07:48.020] retrieve them subsequently, uh, later on. So another thing we [07:48.020 --> 07:51.200] did is, and this is actually, uh, completely novel, combining [07:51.200 --> 07:55.260] move dereference and push add in terms of building a pattern. So, [07:55.260 --> 07:59.460] we can use that to create a, a, a ROP chain pattern. Uh, push [07:59.460 --> 08:03.840] add, you can have a maximum of 4 parameters, 5 if you use ESP, [08:03.840 --> 08:08.120] but that can be rather, uh, challenging to do. Um, so we can [08:08.120 --> 08:10.620] do push add and then do the remainder, we can supply those [08:10.620 --> 08:15.680] via move dereference. Now, if you have the option to, uh, place [08:15.680 --> 08:18.720] your strings and data in the payload directly, then by all [08:18.720 --> 08:22.540] means do it, because it's going to save you effort. Again, if [08:22.540 --> 08:24.740] you have a common reference point, you can use these, you [08:24.740 --> 08:27.880] have a pointer to a string and you might be saying, well, what [08:27.880 --> 08:31.200] about EDR? Well, yes, EDR will be an issue at times and so this [08:31.200 --> 08:34.420] may not always be plausible. If you have no payload size [08:34.420 --> 08:38.200] restrictions, one option is to obfuscate some of this and then [08:38.200 --> 08:43.240] you could use a ROP to go and de-obfuscate it as need be. So, [08:43.240 --> 08:46.220] let's get into an actual, uh, process injection technique. Now [08:46.220 --> 08:48.980] this is based on something that I actually did at Hack in the [08:48.980 --> 08:53.100] Box Amsterdam 2023. That was all Windows sys calls and shell [08:53.100 --> 08:55.860] code. This obviously is not, it's return oriented [08:55.860 --> 08:58.680] programming. And so these are more, uh, these are Windows [08:58.680 --> 09:02.480] APIs and native APIs, it's not necessarily strikingly [09:02.480 --> 09:06.980] original. Um, but in any case, we have a new URL, we're going [09:06.980 --> 09:10.420] to create that, it's going to slither up inside of our victim [09:10.420 --> 09:13.160] target and external process and then we're going to write our [09:13.160 --> 09:17.320] shell code there and then cause it to launch. So, in terms of [09:17.320 --> 09:21.260] ROP, the actual complete chain of gadgets that we have, 29 [09:21.260 --> 09:25.740] gadgets. It's an extraordinary amount. Uh, I'm not familiar [09:25.740 --> 09:29.640] with any, uh, ROP chain in, in the Windows ecosystem that has [09:29.640 --> 09:32.980] anywhere near this level of gadgets. And so it's a lot of [09:32.980 --> 09:37.640] work to, to maintain these from, um, from API, API call to API [09:37.640 --> 09:40.800] call. And it would be a lot more actually if we did not use that [09:40.800 --> 09:43.960] technique of storing and retrieving certain values that [09:43.960 --> 09:48.100] we need. So, let's talk about load library. We can use that [09:48.100 --> 09:52.080] with, uh, push add in a pattern. So we load the particular values [09:52.080 --> 09:56.080] into, uh, registers and then we go and do push add. Then that [09:56.080 --> 10:00.820] causes it to go in a predefined, uh, location. And so let's see [10:00.820 --> 10:04.540] what happens exactly. So we, we have our stack values there and [10:04.540 --> 10:07.680] those correspond to our pattern. So we have red 8, that means [10:07.680 --> 10:10.660] we're going to do this ROP NOP. We're going to skip 8 bytes, so [10:10.660 --> 10:14.760] we skip that, we do a jump EDP dereference. We therefore invoke [10:14.760 --> 10:18.120] load library, we have a return address, we have a parameter, [10:18.120 --> 10:22.400] everything checks out. And then we get a result. Exact result [10:22.400 --> 10:28.240] that we want. So we get the base address of NTDLL. And then we can [10:28.240 --> 10:30.660] use that subsequently for git proc address, which, which is [10:30.660 --> 10:33.260] our next one. And we'll do the same thing, we'll populate [10:33.260 --> 10:35.920] different values into the registers that we can then call [10:35.920 --> 10:39.420] push add. And we get the runtime address, in this case we're [10:39.420 --> 10:44.600] doing create tool help 32 snapshot. An extremely important [10:44.600 --> 10:47.780] thing that we'll talk about momentarily. So these are the [10:47.780 --> 10:51.060] patterns for load library, we have a lot of them, 9. And git [10:51.060 --> 10:54.380] proc address, we have 11. So that gives us a lot of [10:54.380 --> 10:56.860] flexibilities because if you're trying to do something, you [10:56.860 --> 11:00.160] don't have a particular gadget, well you just give up. If you do [11:00.160 --> 11:03.920] then the chain is incomplete. But having multiple patterns, we [11:03.920 --> 11:07.120] can drill down deeper and maybe find something that actually [11:07.120 --> 11:12.300] works. In any case, our next API is create tool help 32 snapshot, [11:12.300 --> 11:14.380] which will allow us to take a snapshot of all the active [11:14.380 --> 11:17.820] processes that are out there. And it's immensely important, we [11:17.820 --> 11:21.220] need it to discover uh the different PIDs, we're gonna [11:21.220 --> 11:26.280] target one of those. So there are actually 11 patterns, so a [11:26.280 --> 11:28.520] lot of flexibility there in terms of how you can invoke it [11:28.520 --> 11:32.860] with the push add instruction. Um there's an example of the ROP [11:32.860 --> 11:36.280] and we got the push add at the bottom. Virtual alloc, um it's [11:36.280 --> 11:38.900] one way to allocate memory, yes some EDR can block it, there are [11:38.900 --> 11:42.620] other ways you could do it. Uh the pattern for that is very uh [11:42.620 --> 11:45.220] familiar, uh one of the most familiar goes back probably [11:45.220 --> 11:49.980] about 15 years. Um but with this we're gonna allocate a region of [11:49.980 --> 11:53.220] memory, we're gonna use that for a couple very uh important uh [11:53.220 --> 11:57.940] things. One of which is to build the process entry 32, the process [11:57.940 --> 12:02.820] entry 32 is where we're going to go in and check our PID, we're [12:02.820 --> 12:07.960] gonna check our uh string. So the first thing is we process 32 [12:07.960 --> 12:10.020] first, it's gonna kick everything off, it's gonna [12:10.020 --> 12:16.580] initiate the whole uh process. So how we're gonna do that, uh [12:16.580 --> 12:19.240] first we actually need to build the structure, so we can go ahead [12:19.240 --> 12:22.500] and build the structure via ROP and our move dereferences. Most [12:22.500 --> 12:24.880] of it are null bytes so it's relatively simple, we have a DW [12:24.880 --> 12:28.540] size, uh it's an arbitrary value so you can make it whatever you [12:28.540 --> 12:31.900] want. And then once we're done we get a pointer to that, we [12:31.900 --> 12:35.500] supply that pointer as the parameter. So all of that work [12:35.500 --> 12:38.720] and we just get a pointer to that. So again the idea of being [12:38.720 --> 12:42.140] able to uh dynamically locate something in memory and use that [12:42.140 --> 12:45.860] is kind of like a pointer, can be very useful. And then the [12:45.860 --> 12:49.280] patterns for process 32 first and process 32 next are actually [12:49.280 --> 12:53.660] interchangeable. So one of the biggest challenges is this idea [12:53.660 --> 12:55.920] of string comparison, how do we do that with ROP? Well the [12:55.920 --> 13:00.400] gadgets are not really very common so that can be very uh [13:00.400 --> 13:05.160] problematic. We need to identify a specific process otherwise you [13:05.160 --> 13:10.040] really can't proceed forward. So you're kind of at a, an uh, you [13:10.040 --> 13:12.380] can't really go forward without this. So we came up with a [13:12.380 --> 13:15.080] solution, we're going to build our own custom function in [13:15.080 --> 13:18.040] memory. It's an enumerate process function and we're [13:18.040 --> 13:22.100] actually writing the raw assembly. So remember we made a [13:22.100 --> 13:25.060] writable memory with virtual alloc, we can write our code [13:25.060 --> 13:27.740] there. You can do it other ways as well. And so this will cycle [13:27.740 --> 13:30.820] through process 32 next, it can do it hundreds of times in a [13:30.820 --> 13:36.560] loop until it finds the exact uh string, VU player. We can supply [13:36.560 --> 13:39.820] that and then once it does that it'll go ahead and exit out. So [13:39.820 --> 13:42.780] how do we write that? Well we simply just compile it, we can [13:42.780 --> 13:45.860] then write our bytes to memory using the move dereference [13:46.220 --> 13:49.020] technique one by one until they're all written. Make sure [13:49.020 --> 13:51.300] the code is executable and there are multiple ways in which you [13:51.300 --> 13:54.260] can do that. And then we need to supply the appropriate values so [13:54.260 --> 13:58.600] things like our HP snapshot, our VU player string, uh [13:58.600 --> 14:03.040] dereference process 32 address. And then how do we kick it off? [14:03.040 --> 14:05.920] Uh again multiple ways but in this case we're gonna do a [14:05.920 --> 14:08.480] simple push ret which will then push the address onto the stack [14:08.480 --> 14:11.840] and then return to that and then we can uh immediately start [14:11.840 --> 14:16.880] executing our custom code that we just wrote there. And so [14:16.880 --> 14:20.340] that'll invoke process 32 uh repeatedly until it finds our [14:20.340 --> 14:25.140] particular PID. In this case we have VU player. It's gonna look [14:25.140 --> 14:29.040] at offset 24 and once it finds offset 24 then again it's gonna [14:29.040 --> 14:32.980] break out of that loop. And um from there the base of the [14:32.980 --> 14:36.340] structure we can just go to simply offset 8. Offset 8 will [14:36.340 --> 14:41.020] then hold the PID. We can capture that PID. In this case [14:41.020 --> 14:45.400] it's 668. And how do we do that via return oriented programming? [14:45.400 --> 14:48.260] Well we just basically take exactly what I said, translate [14:48.260 --> 14:51.860] it to ROP. So some move dereferences, some POPs, uh [14:51.860 --> 14:55.940] sequence of 8 uh increments. And uh in this case we have a [14:55.940 --> 15:01.420] different PID B98 and uh we can supply that. Uh we can save that [15:01.420 --> 15:04.940] to memory so we can use that later. Remember the idea of save [15:04.940 --> 15:09.240] and then retrieve. And then that brings us to our next API and [15:09.240 --> 15:16.640] with that we're gonna have Shiva uh take the podium. [15:16.640 --> 15:19.700] Here we take this PID that we just obtained after all of that [15:19.700 --> 15:22.780] hard work and uh we are going to convert that into the handle [15:22.780 --> 15:26.440] to the process. We're gonna have this. It's impossible to move [15:26.440 --> 15:30.700] forward if you don't have a PID to your target process. And we [15:30.700 --> 15:33.260] don't want to just randomly inject into some other unknown [15:33.260 --> 15:36.780] process. Uh so this one we are going to use both push add as [15:36.780 --> 15:40.380] well as move dereference technique. So here we have [15:40.380 --> 15:44.020] multiple patterns for open process and then we'll follow [15:44.020 --> 15:47.900] that up after push add. And we also have a move dereference [15:47.900 --> 15:53.460] with the process ID. In this ROP chain the process ID has been [15:53.460 --> 15:56.900] provided by move dereference uh with everything else being done [15:56.900 --> 16:02.340] via push add. Next we'll open a handle to our current process [16:02.340 --> 16:06.580] with open process token. And then we'll use that so right [16:06.580 --> 16:10.160] here we have a handle and we are using ROP to create a pointer [16:10.580 --> 16:15.740] to hold the access token that we'll retrieve. With adjust [16:15.740 --> 16:19.700] token privileges uh we are going to take that token handle and we [16:19.700 --> 16:22.760] can then change the privileges as we need. We need to do this [16:22.760 --> 16:27.760] to avoid some problems that could happen otherwise. And this [16:27.760 --> 16:30.640] requires multiple complex structures such as token [16:30.640 --> 16:34.680] privileges. Such as uh where we can specify the AC privilege [16:34.680 --> 16:40.740] enabled and AC debug privilege. With adjust token privileges uh [16:40.740 --> 16:43.940] here we have a ROP. So we are setting disable all privileges [16:43.940 --> 16:48.120] to false. And what that means is that whatever we specify inside [16:48.120 --> 16:53.260] the new state structure will be then done. With adjust token [16:53.260 --> 16:56.200] privileges we can then go inspect where the debugger and [16:56.200 --> 17:01.120] see if it has all of our values. Like AC privilege enabled and AC [17:01.120 --> 17:04.540] debug privilege. And then everything is going according to [17:04.540 --> 17:10.320] the plan. Our goal with this is to take a common DLL URL mon, [17:10.320 --> 17:13.840] create a file for it and then go ahead and map that out. And [17:13.840 --> 17:17.220] then we can inject our payload into that. Then causing that to [17:17.220 --> 17:21.080] be executed. And we'll do this with these APIs which we'll be [17:21.080 --> 17:26.260] talking about. So create file A is the first. We get a handle to [17:26.260 --> 17:29.860] the URL mon which is our file. We are going to be using this [17:29.860 --> 17:33.280] later on. Uh but we are going to do this with sequence of moody [17:33.280 --> 17:38.020] references. And here we are providing the absolute address, [17:38.020 --> 17:42.060] the string pointer to that and also generic read. We are doing [17:42.060 --> 17:47.460] generic read to avoid some possible detections. And then [17:47.460 --> 17:51.780] NT create section, a lower level native API will allow us to then [17:51.780 --> 17:56.140] create a section object for URL mon DLL. And here we are doing [17:56.140 --> 18:00.840] page read only. And then with drop we are specifying the sec [18:00.840 --> 18:06.780] image. NT map your section. Now that we have the URL mon section [18:06.780 --> 18:10.500] handle, we can now map that view of the section into address [18:10.500 --> 18:13.880] space of view player. We'll do this purely through moody [18:13.880 --> 18:18.140] references because uh we have many nulls and also we have page [18:18.140 --> 18:22.820] read only. So it's a bit more limited. One more important [18:22.820 --> 18:25.380] thing is providing the base address or pointer to the base [18:25.380 --> 18:29.480] address. And that will receive a base address inside of view [18:29.480 --> 18:33.920] player. So that will be provided to us as you can see in this [18:33.920 --> 18:37.960] example which we'll be talking about later. So it is very [18:37.960 --> 18:43.980] important. Virtual protect EX will then allow us to change the [18:43.980 --> 18:48.820] target DLL URL mon to RWX. And so we are going to do this with [18:48.820 --> 18:52.440] sequence of moody references. Because remember we have limited [18:52.440 --> 18:56.740] permissions for it. And so we'll get the handle to the view [18:56.740 --> 18:59.860] player as well as the base address that we just retrieved. [18:59.940 --> 19:02.780] And then once it's done we'll have the page execute read [19:02.780 --> 19:07.240] right. Here is a route where we can provide the pointer to the [19:07.240 --> 19:10.360] base address. We then go and dereference that and we'll pull [19:10.360 --> 19:13.400] the base address out of that. And then we do the moody [19:13.400 --> 19:18.020] reference. Right process memory allows us to inject the cell [19:18.020 --> 19:21.900] code into the process memory of view player. We are doing this [19:21.900 --> 19:26.140] via push add as well as moody references. Which you can see [19:26.140 --> 19:29.360] right here so pointing to the cell code up there. And also [19:29.360 --> 19:34.100] providing the size. Same thing here we are, we have the cell [19:34.100 --> 19:36.620] code and the size and then the remaining parameters with push [19:36.620 --> 19:41.220] add. Right process memory at this point once it's done then [19:41.220 --> 19:45.260] our cell code will be injected into inside of urlmon which is [19:45.260 --> 19:49.060] an external process. So we have gone from one process to a [19:49.060 --> 19:51.740] completely different process. And the cell code is just [19:51.740 --> 19:56.240] sitting there waiting for us. So how do we cause it to execute? [19:56.240 --> 19:59.360] The answer is very simple. It's create remote thread. But the [19:59.360 --> 20:02.460] actual technique is not so simple. So we'll have a moody [20:02.460 --> 20:05.640] reference and also push add pattern. And then we'll have a [20:05.640 --> 20:10.160] sequence of moody references. We'll go inside the other space [20:10.160 --> 20:17.240] of view player and then we do the push add. So here is some of [20:17.240 --> 20:20.200] our ROP. We can provide the LP parameter as well as the [20:20.200 --> 20:23.920] address. And then we follow that up after push add. And finally [20:23.920 --> 20:28.040] with create remote thread our injected cell code will execute. [20:28.100 --> 20:34.700] We have achieved our goal. Let's do a demo. We start the things [20:34.700 --> 20:38.140] with create help 32 snapshot and we have been given a handle. [20:38.840 --> 20:43.420] Let's write the process function to memory byte by byte. We [20:43.420 --> 20:47.480] invoke the function using push thread. Now we are inside the [20:47.480 --> 20:51.440] function, special function that we created. And let's take the [20:51.440 --> 20:55.600] process entry. Let's see what we have as the first entry. We [20:55.600 --> 21:00.020] have system. Let's move forward until we find our desired PID. [21:00.020 --> 21:05.800] And we finally found the PID for view player. That's good. We'll [21:05.800 --> 21:11.460] keep moving forward. And we'll do the create file A. We'll get a [21:11.460 --> 21:15.300] handle from create file A. Let's verify what we have. We have the [21:15.300 --> 21:19.420] URL month. That's good. Let's map that out using NT map section [21:19.420 --> 21:21.800] and let's set the base address. Right now we don't have any base [21:21.800 --> 21:25.680] address. But right after the function execution we'll get the [21:25.680 --> 21:31.860] base address and base address has been provided. We'll change [21:31.860 --> 21:36.320] the permissions for the base address. And we'll see. We have [21:36.320 --> 21:42.970] the page execute read write permissions. We have the MZ. [21:42.970 --> 21:45.390] It's a PE file and let's inject the shellcode using write [21:45.390 --> 21:51.370] process memory. And let's see what we have. We have successfully [21:51.370 --> 21:55.750] injected the shellcode into external process. And finally [21:55.750 --> 21:59.690] create remote thread. We got it. [22:04.650 --> 22:08.190] Thank you Shiva. So we're going to wrap things up very briefly [22:08.190 --> 22:15.290] here. So I just want to say our goal is not to enumerate all [22:15.290 --> 22:18.110] process injection techniques. We've seen talks like that [22:18.110 --> 22:21.450] before. But we really want to provide a methodology in terms of [22:21.450 --> 22:24.370] how we can do that with ROP and focus on the practicalities. We [22:24.370 --> 22:28.390] want to provide a novel concept of building a enumerate [22:28.390 --> 22:31.970] processes function purely via ROP which can be extendable to [22:31.970 --> 22:35.290] other process injection techniques. And then create a [22:35.290 --> 22:38.290] rich set of patterns that we can utilize for that purpose. With [22:38.290 --> 22:41.170] that we'd like to thank you and invite you to check out the ROP [22:41.170 --> 22:41.850] rocket tool.