To bring up doctor and doctor who are going to talk about the the the job rocket Yeah, let's give these gentlemen a big round of applause All right, thank you Welcome everyone as mentioned we're gonna be introducing and talking about the job rocket And so in a few minutes, you'll learn about the supremely wicked tool for job gadget discovery With me is dr. Bramwell Brizendine. He is the creator of the job rocket You'll find more information about the job rocket at job rocket comm as well as the github and I don't see it here But it's a link later on in the slide. So we'll get to it in a moment Bramwell's an assistant professor at Dakota State University and You can see his contact information at the bottom. My name is Josh Stroshine I'm also an assistant professor at Dakota State and was the chair for Bramwell's dissertation Which is where this work was done It was really focused and conducted under my contact information is also at the bottom of the slide a Couple of quick acknowledgments Austin Babcock undergraduate research assistant at DSU as well He's studying cyber operations and he put together the job exploit that you'll see here towards the end of our presentation He is looking for any opportunities for internship and work So if you're looking for a very talented student Please feel free to contact him or reach out to Bramwell myself and we'll be happy to put you in contact We also would like to thank dr. Jared DeMott of EDA labs He is a part of the dissertation committee as well as a well-renowned security researcher. So a big thanks to him So what are we going to talk about today quick in 20 minutes? We're going to spend a few moments on ROP ROP is important to understand in order to understand job We're going to get into job jump oriented programming more importantly You'll get to know the job rocket a little bit better some of the finer points of job exploit development And then it'll be time to take a ride on the job rocket itself and I'm gonna leave that up to Bramwell So this begs the question how did this work invent job? It did not there is some references in the literature that goes back about a decade. However, it was sparse there aren't a lot of tools or Other frameworks that are available to help further learn explore or utilize job in your daily exploit endeavors So this work really endeavors to fill that gap to provide more literature and as in addition It also will do this in the Windows environment. So again not a lot of information there for doing job on Windows What is job? Well simply put it creates a side door if you're having trouble with your exploit chains with ROP and the ROP heuristics being Detected then job may allow you to bypass those mitigations and ultimately get shellcode to execute We're not trying to oversell the job rocket though because job is just another category of code reuse attack It is not another category of exploit a Little background you can go back to the late 90s With the return to lib C right to lib C that opened the door for ROP return oriented programming ROP borrows little chunks of code that end in reps and there's a couple of important concepts that come along with this We have gadgets which are instructions or a series of instructions that end in a red and then we have our chains and those chains Simply are then a series of gadgets that do something practical like call a function in the Windows API important thing to note here is that these with ROP Were really dependent upon the stack in order to control the flow the execution of our ROP chain that changes a little bit with with job Come some prevalent tools ones that likely you have all used before Would be Mona by the core land team and Peter van Eck out as well as the ROP gadget Here's an example of a ROP chain generated by Mona as you can see the addresses that are going to be placed on the stack as part of the payload Those are the addresses that are going to be fetched after the the Gadget itself is executed and ends in a red so again going back to the stack in order to control the execution the flow of that entire chain So jump oriented programming or job differs and that we are using jump and call instructions in order to control the flow So job is really just ROP without the reps While the stack is not available for the control flow It is still it is still necessary to use the stack in order to set up and make calls to the Windows API Remember we're focused on the Windows API here a couple of different paradigms We have the dispatcher gadget the dispatch table. We're going to more details here in just a few minutes The job rocket does use both of those. That's the approach that it's taken There's also some different techniques available with job that you can use in your everyday Rob so a pop jump and where you pop into a register and then jump to that register in order to Go back to the stack. For example, if you're having trouble finding You know your ROP gadgets so you can job and then go back? to Rob So about those two paradigms that we just scared that I mentioned just previously The dispatcher gadget and the dispatch table the dispatcher gadget is the instrument of change it moves things forward and backwards in that dispatch table it ideally should be short and sweet and It should also be predictable. It should predictably modify the register holding the address to that dispatch table The dispatch table then has entries that lead to the addresses of the functional gadgets and the functional gadgets are what really Allow us to modify registers and set up the stack in order to make our Windows API API calls Here is a maybe somewhat oversimplified control flow diagram You have the dispatcher gadget which controls flow into the dispatch table Which then dereferences and calls those different dispatch gadgets or functional gadgets, excuse me from there instructions are executed That'll feel a bit like ROP and then you'll jump or call back to the dispatcher gadget And the cycle will continue to repeat until if you've accomplished whatever functionality that you're out to get That's my part was brief. So I'm gonna let Bramwell take it from there Thank You Josh, so all this kind of begs the question of why is job not much used in fact in 2015 one person even claimed that job had never been used in the wild in the wild. Of course that was wrong It has been but only very very rarely So some of the reasons for that Lack of proper tooling we just don't have tools to find job And if you're trying to do job that that's a serious problem job is also much trickier It's less well understood whereas with ROP. It's very well documented Great literature that exists great tools that are available to facilitate that there's difficulty in finding job gadgets from a couple different perspectives first Just the number of job gadgets relative to ROP gadgets is much much fewer So that makes it much more challenging to to find the right gadgets Secondly, if you don't have a dedicated tool then it can make it Difficult or even impossible to find enough Gadgets and the reasons for that is opcode splitting So our ROP of tools or mona so on and so forth will do the opcode splitting But if you try to just use general purpose reverse engineering But if you try to just use general purpose reverse engineering tools that's not going to very easily or readily, readily allow you to, to do that. And so then it would be a kind of a manual process that could be tedious and time consuming. Just like it would, the same would be if you tried to do it with, with ROP, if you didn't have a tool such as, as MONA. So we've got to be very grateful for, for those different tools. So JOP, yes, it is a little bit more complex. Folks don't really know too much about it, don't know how to use it. And that's, that's understandable because there's not much that's written about it. There's some that's written in the academic literature. And additionally there, I mean if you try to search for articles on how to use it in Windows you just won't find anything for the most part. So that's perfectly understandable. With JOP you also have to pay attention to registers that are being used for the dispatcher gadget, for the dispatch table. And those, if you tie those registers up then you can't use them for, you know, the for other purposes. So that just adds to the complexity, adds to the chaos. We need the dispatcher gadget too. It's a very rare, very scarce gadget. If we can't find it then we can't do the dispatcher gadget paradigm. So that can be problematic. Of course you can still try the PopX, JumpX paradigm. And you can even temporarily do ROP and then do a little bit of JOP. That's entirely possible. So many of you are probably familiar with ROP. You may be masters of ROP. The good news is a lot of that can carry over. So some of those ROP techniques will also apply to JOP as well. So at this point we want to introduce the JOP rocket, honor the sacrifice that ancient rocket cats made so many centuries ago to deliver their malicious payload. So a little bit of history lesson. I guess in the 1300s there were so-called rocket cats that would have explosives strapped to them and they would be able to subvert the defenses of a well defended castle to deliver their payload. JOP rocket tries to do the same thing. We can get past ROP heuristics. So very sophisticated tools. A Python script has dependencies that are required. Can run in a Windows environment. Can run in Linux. It is static analysis. And the only reason I did that is simply from a programming standpoint. It made it more challenging, more difficult. It was a very, very complex tool. It was a complex system and it took some time to write it. Rather than something that would integrate with an active process. You can take an executable or a PE. You can scan it as well as all of its associated modules and DLL's. The JOP rocket features a command line user interface. It accepts brief keyboard shortcuts. Very easy to memorize. Very easy to quickly utilize them. It also has a convenient get everything option which we'll talk about in a little bit. So as we go along in the video here. So some of the features of the JopRocket, tremendous flexibility in terms of how we can discover the different gadgets, both functional and dispatcher gadgets. So there are reasonable defaults, but if you're not finding what you want, you can enlarge or you can narrow the scope. As it goes through and acquires the gadget, it performs classification into dozens of categories based on the operation. For instance, is it adding, is it doing sub, and also on the registers that are affected, so that you as the user can be very specific about, you know, what you want to acquire. Also has an option to get everything printed as a CSV. So that can be incredibly useful if you want to gain insights into whether or not a specific binary would have enough gadgets to perhaps support Jop. It does feature opcode splitting. The challenge with opcode splitting is if you do it from a return-oriented program and you go for the C3 or the red or one of the variations, it disassembles backwards, enumerate everything. With ROP you're looking for the opcodes for many different indirect calls or indirect jumps. So there's a lot more to consider there. Contributions of the JopRocket, just from a standpoint of how it's built and how it's put together, it does a lot of things in kind of an original unique fashion and the reason for that is it's not wanting to ape or mimic the contributions of others, but it's just to try to do something in my own fashion, but maybe not particularly interesting in terms of how to perform Jop. So how do we utilize the JopRocket? It is again a static analysis tool. We do run it from the command line. It can support any platform that has the necessary dependencies. Since it is targeted towards Windows, if you are doing it in a Linux environment, you're going to miss out on the ability to scan the modules because some of them simply won't be present. Now how do we do it from the command line? We can do Python, Pro and then the file name. If it's a local file, if we do it that way, it's just going to get the image executable. Otherwise, we want to provide the absolute path which we can supply in an input text file and it needs that to enumerate the different modules. So we have an action So, a number of different options, uh, associated keyboard shortcuts, I won't spend too much time on that, um, and there is more as well. So, how do we use the JopRocket? Uh, again, lots of, many, many different features, but by design, a very minimalist user interface, just to make it a little easier to use, a little bit more friendly. So, the first step, we want to establish the registers of interest. Are we looking at EAX? Are we looking at EBX? That's the first step. And then we establish scope. Do we want call, or do we want jump? Keep in mind, if you do call, then you're adding to, to the stack, and so if you're trying to load Windows APIs, then that can be problematic. But you can compensate for that, of course. Uh, additionally, are you looking for mod, uh, modules and DLLs, which you probably are, or are you just looking at the, uh, image, uh, executable? Once these selections have been made, then we just hit G for go, and it'll get those gadgets. Uh, and then we go to the print in submenu, and we can print the, uh, what it's found to, to files. Uh, many, many different opt, options based on classification, based on the operation, based on the registers that have been, uh, affected. So, you can be very specific, very granular. Um, and of course, if you need to, you can, uh, enlarge, uh, the scope, or, or narrow it. And there, there are many, uh, specialized, uh, options that we won't discuss that can allow you to, uh, uh, uh, uh, uh, kind of finagle, uh, some of that. Uh, again, the option to do, uh, uh, everything as a, uh, CSV, just to get a broad overview of whether or not, uh, binary may support that. So, how do we get the, uh, dispatcher gadgets? First step is to select the registers of interest. Uh, and then D for dispatcher gadgets. We go on acquire those, and then we go to the print submenu. We can print those out. Uh, if you want to use call on the dispatcher gadget, that can be problematic, because it's constantly, uh, interfering with the steps. Uh, and then we can go back, but, you know, it's an option. So, a couple screenshots here. Uh, very minimalist, uh, UI. Uh, now we're going to discuss a JOP exploit. Uh, to try to get, gain a, kind of an understanding of, uh, how all this comes into play. So, this is a, uh, a WAV reader. Uh, prints out, or gets some information on a WAV file. We provide it with a malformed, uh, WAV file. Uh, initially we have, uh, an overflow just to set things in motion. And then we set up our, uh, JOP gadgets. Uh, we set up the dispatcher gadget. We set up the dispatch table. Uh, and then we do our JOP change. So, we're going to bypass DEP data execution prevention. We call virtual protect. We call write press, process memory. The second one is not necessary, but we do it anyway. And then we do our NOP sled, and then our shellcode, and then profit. So, some basics here. Uh, the register for, uh, dispatcher address is EDX. And then EDI will contain the address of the dispatch table. And then we start our dispatcher gadget instructions. There we're adding C, or 12, at base 10 to the, uh, dereferenced, uh, EDI. So, uh, we can see a nice little diagram of our exploit that we're about to, to do momentarily. We have the dispatcher gadget, which allows us to advance forward by 12, taking us to the dispatch table. Uh, and then we have the dispatcher gadget, and then we have padding in between. Um, and then the functional gadgets, which are similar to ROP. And then it swings right on back to the dispatcher gadget that then advances, uh, to the next entry in the dispatch table. So, setting things up here, uh, we have the initial overflow. We want to set up the dispatcher gadget. Uh, we're doing call EDX. Um, we do a little bit of exclusive OR action, and we provide the two different, uh, values for EDX and EDI, or a dispatcher gadget and dispatch table. And then we call EDX, the dispatch, uh, gadget. Uh, after that, we can then start crafting the function calls. To do that, we move ESP to a known location. It just makes things a little bit easier. Uh, then we're call it, we're calling, uh, the API functions. We're setting up virtual protect. We, we provide the necessary parameters. That's good. And then we do write process memory. We provide those, uh, parameters. Uh, so, with virtual protect, we can then make it so that, uh, memory is rewritable, uh, and then we can, uh, write executable rather than just simply, uh, rewrite. So, supplying values for those functions, we get ECX to a known value. It doesn't really matter what it is, but what we're gonna do is we're gonna modify it with exclusive OR. Then we pop a value into EAX. We do the exclusive OR on it, and then we pop another value into EAX. And now we have two values that we can push onto the, the stack, uh, and then so we do that. Um, and then we need to compensate for, uh, ESP. Uh, we do dereference virtual, uh, protect pointer. Um, so we go ahead and, and do that. And we will utilize that a little bit later on. Now, the goal here is to do purely JOP with the dispatcher gadget paradigm. And since we're doing two Windows API calls, well, uh, an API call is a function. A function ends in a ret. So that takes us out of JOP. So we do insert one ret to get us right back into JOP. Again, we have the option to call. We just need to do provide compensation by, uh, adjusting the stack. So it's not that big of a deal. Uh, getting right process memory, uh, that one is a little bit more, uh, challenging. There's not a direct pointer to it in the binary, unlike with, um, virtual protect. But since we've dereferenced it, we can do a little bit of finagling with, uh, by analyzing the DLL and do some hex math. And, uh, then we can, uh, thereby reach that, reach that. Uh, we can also jump to other registers if we want to shuffle around the, uh, address of the dispatch, dispatcher gadget. That's not a problem. So let's go ahead and take a look at a demo. So first we want to establish the registers of entry. Uh, we go ahead and do that by typing R. And then we're doing all. So let's get in all registers. Other options, but we're gonna bypass those. It goes and acquires those. We go to the print menu. Uh, then we select the registers to print. The register is affected. Uh, G for all. Uh, we're looking at all operations. And then Z. It then goes and acquires those. Uh, we go to the print menu. Uh, then we select the registers. Uh, then we see some gadgets that it's found. Just one random, uh, example here. We see our initial, uh, overflow. Uh, we set that up. And then we set, uh, our dispatcher gadget to EDX. And then our dispatch table to EDI. Uh, and then we go ahead and get, uh, get it going there. Now we have our, uh, the wave fi- wave file that we've read into memory. We have some shell code there. Then we have the, the header. Just a, just a, just a, just a, just a, just a, just a traditional wa- wave header. Uh, and then we're going to go ahead and make our virtual, virtual protect call. And this is all purely JOP. So what we want to do is we want to provide it with the necessary, uh, JOP parameters. So we go ahead and do that. Let's see that in, in motion there. Okay, nice. And then after, after that, then it takes us to the dispatcher gadget. We see that add EDI, uh, C. And that'll follow, uh, every single, um, uh, functional gadget. We get ECEA X to a known location just so we can do exclusive OR action on it. Then we go ahead and, um, so we get the first couple of parameters for virtual protect. Uh, we do some, uh, stack adjustments there. Um, then we go ahead and dereference virtual protect. Keep in mind we will be utilizing that a little bit later on. Uh, and then we go ahead and do a JOP ESP, which now contains virtual, uh, protect. Uh, and then we have, uh, values for the POP instructions, uh, and then we need to do a little bit more here, uh, that will follow, uh, subsequently. And this part may be a little bit tricky to understand here, just, uh, utilizing, uh, uh, the stack. And so, um, there we go. And then we go to, uh, fix, we need to fix the registers after the call. We do our right process memory. Much of this is, uh, more or less the same. We're providing parameters, uh, making stack adjustments, uh, nothing too earth, shatteringly, uh, difficult. You can do a little, uh, bit of semi-tricky things like if you, well I guess it's not really that tricky, but if you want to use a call EDX that's fine, just got to do a little bit of extra uh stack adjustment which you see right there uh in the next line. Uh then we want to get to our write process memory, remember we dereferenced virtual protect because virtual protect is in kernel 3 to which you know ASLR that can make it um you know unpredictable. Um and so we get the, get that we add the offset for write process memory so that we can then make a call to write process memory. Uh and then we're all set to go, we just need to provide the necessary uh parameters for that. Uh and then once we provide those parameters uh make sure that we get the stack values then we're ready to go. We can then execute write process memory which we're right going to do and we got a notepad. We didn't do a calc but we got a notepad. So um that's it. Uh if anybody has any questions or questions please feel free to put them in the chat box below. Uh we'll be down there you can go ahead and reach out to us. Thank you.