Welcome to Track 1 Noon Talk. This is uh Isaac Kotler and Amit Klein. So please give them a welcome to DEF CON. Thank you ladies and gentlemen and uh welcome to the presentation about uh process injection techniques. Uh some words about uh Isaac you can see on the screen there. And also a few words about myself. And let's, let's begin. So why do we do, why do we even care about uh process injections? Uh so. They don't see the slides actually. They don't see the slides? Yeah. You'll have to believe me on that. So when we started researching process injection back in uh late 2018 uh we obviously wanted to first understand what other people already did in this area. And to our surprise we couldn't find any comprehensive collection or catalog of process injection techniques. We found scattered all over the internet in write-ups, in proof of concept codes, and in uh blogs. Uh also we didn't, we didn't find any um we didn't find, okay. We did, we didn't, we didn't, we didn't find any where worse. Uh we didn't find any or candles for welcome energy. Um and of where we didn't find anyот how those veryino are called. So not a very well described jargon. We couldn't see either. Um so we couldn't find uh text that described the uh the solely true process injections as we like to call them. And uh the texste uh uh often uh took a bit of a liberal approach to what process injection is. And uh lumped into process injection some related, but not true process injection techniques like uh process hollowing and spawning. Uh also we couldn't find uh uh categorization around the the sub te sub techniques of process injection, namely pros- memory allocation, uh memory writing and uh code execution. And also we f- we there was a lack of analysis and comparison between uh process injection techniques. Um finally uh we couldn't find any update for the old uh uh techniques that sometimes were developed for in the Windows XP days to uh Windows 10 uh with its uh latest uh security uh mechanisms and the 64-bit architecture. Before we begin uh I want to uh extend kudos to Adam of Hexacorn, Ojan and the Insilo team and Xaba Fitzel of the uh also known as the Evilbit and uh many others that uh have no uh no space here to mention. Uh for their uh research uh the in their in uh invention in inventions in process uh in process injection uh techniques uh development documentation and proof of concepts uh of in many of many many techniques. And of course head tip to Endgame for providing the first compilation of injection techniques although that compilation uh did lump together some non true process injection techniques. So let us first define what true process injection is. Uh we're talking about injection from live user space process uh typically malware to another live user space process which is the the target for injection which is typically benign or legitimate process it can be a system process like explorer.exe or a Microsoft Office uh process your browser your messaging software your email software what have you. Uh this is in contrast to it which is out of scope for this uh project uh process spawning and hollowing uh and also some pre-execution techniques that require uh the uh malware to install or to configure things before the target process starts running like DLL hijacking, upsert, upinit, LSP providers and image file execution options. So what's what's important and interesting about Windows 10 and and about 64-bit architecture. First Windows 10 introduced several security mechanisms such as uh CFG the control flow guard uh which prevents uh indirect uh calls to non-approved addresses. And uh CIG the code integrity guard which only allows modules or as we call them DLLs to be loaded if they are signed by Microsoft uh Microsoft store or WHQHQL. Uh what's interesting about the 64-bit architecture as opposed to 32-bit architecture is that with 64-bit architecture the calling convention is different from the 64-bit architecture. The first four arguments of a function are passed through uh the uh four uh uh volatile registers uh that would be uh R6, RDX, R8 and R9. So that if so that in order to invoke uh successfully invoke a function in the target process you need to control at least one or in in depending on the number of arguments in the function up to four registers as opposed to on as opposed to only uh cooking up the stack which was the the uh uh which was the way to invoke functions in the 32-bit world. Also in the 64-bit world there's no uh pop all registers uh in opcode and that prevents us from uh uh elegantly populating all registers with uh desired values. The pro- there were there are a lot of proof good proof uh excellent proof of concepts out there for uh uh injection techniques. Uh but the problem is that that is that exact definition. There are excellent proof of concepts uh in in that what I mean is that they uh prove they handle they they have proper error handling and exception handling. Uh they are uh tailored for both 32-bit applications and 64-bit applications. And they also lump together uh in this case uh the in in the novel uh the novel uh memory writing technique with an execution technique in order to demonstrate a a full end to end uh process injection. Uh that makes the uh source code uh ex uh blow into 1500s line of code I don't know if you can see that. Uh and I and as a researcher I was I found it very difficult to focus on exactly what the novelty of the technique is. Whereas what I wanted to find or wanted to what I searched for uh is uh those those 3 lines that are that are wrapped into 5 lines at the right hand side of the screen where you can see the exact uh technique that is uh the exact technique that is used in this case it's atom bombing. So what I what uh what we could not find uh in in many cases uh uh is uh concise 3, 4, 10 lines of code that the that uh that uh uh describe exactly that technique and nothing more. So we set up to fix this uh situation and to fill this gap uh and to document all those uh process injection techniques and the scope of our project was uh true process injection running a sequence of logic or commands in the target process. So we're not talking about just uh forcing a system uh function call and and and spawning another process and the focus was on Windows 10 version 7 first leg where uh I 1803 and above, so we're talking about uh pretty recent versions of Windows 10, uh x64 injection- injecting process and x64 target process, both medium integrity, we only look at techniques that do not require admin rights and we evaluate all the techniques against uh recent Windows 10 protections, specifically CFG and CIG. Few words about CFG strategy, the attacker that wants to uh inject into a CFG protected target process has several options uh to choose from. The first one obviously is to disable CFG and this is possible through a standard Windows API set process valid call targets, um however if you think about it this is a pretty suspicious action in itself and can be flagged by security products. Also I uh speculate that it may be disabled or restricted in the future by Microsoft. So I'm going to go back to Microsoft. Another approach would be to allocate or set executable memory uh which uh as a side effect makes all the allocated uh memory CFG valid. Uh this can be done with a virtual alloc ex or virtual protect ex but then again if you think about it this is extremely suspicious, we all know what happens next, we just allocated a bunch of executable pages in the target process, obviously we know what's going to happen. So this is extremely suspe- suspicious. The third option and I think this is the future of process injection techniques is to play by the rules, that is writing a non executable data which is uh can be a ROP chain and then using a CFG agnostic execution method to run a stack pivot gadget and start running, start executing the ROP chain. Uh unfortunately or fortunately depending on your point of view only very few uh uh execution techniques are CFG agnostic and I will touch on this subject uh later in the presentation. With respect to CIG and other defenses, there used to be, there used to be a technique to eliminate those defenses using set process mitigation policy in the target process invoking that with NTQA APC thread because that function has only three arguments uh that an NTQA APC thread could cover them all, we'll see that in a later slide. However this technique no longer works as of 1809 uh and I want to say that uh this is a very uh uh uh uh uh uh uh uh uh uh painful technique, but I want to mention that CIG is most painful because it prevents us from loading uh arbitrary non-Microsoft signed DLLs. So what are the typical process injection building blocks? We have memory allocation and when we are when we are uh looking at uh such techniques we need to consider uh whether the allocation is implicit like a cave or a stack or explicit where we actually allocate the memory ourselves. What page permissions are there? What control do we and whether the target addresses will be CFG valid or not. Then we have memory writing populating that uh memory area with our desired values and the questions are whether the dat- whether a memory writing technique allows us to write arbitrary data or are there restrictions on size or character set and whether the writes are atomic or not. Finally there's the- there are the execution techniques and they need to be evaluated against whether the target has to be CFG valid or not, what controls do we have over the registers, and what limitations and prerequisites are there for the execution methods and there are a lot of restrictions and limitations for some techniques out there. Without much ado let's go over some process injection techniques. I'm going to go over very quickly the uh uh very known ones and focus a bit more on the lesser known ones so I'm going to uh go quickly now. Uh let's take a look at the first one. Uh there's the virtual alloc EX uh memory allocation technique that we're all familiar with. It can allocate executable pages so those pages become uh CFG valid automatically by Windows and of course we can only- we can allocate just read write and later uh add uh uh page executor uh privileges with virtual protect EX. Um then we have the classic memory uh writing technique of- of using uh write process memory. Again no prerequisites or limitations, the address is fully controlled uh with regard to CFG if the allocation is sets executable privileges then there are no problems. Uh CIG is of course not uh relevant because we are not handling DLLs here. And finally there's the create remote thread execution technique uh in which uh CIG has no impact because we're just- we're not talking about DLLs here. And with respect to CFG the target execution has to be CFG val- a valid target and this is enforced by uh the operating system. Uh we only have controls over RCX so we can only safely invoke functions with a single argument in this way. Then we have a classic DLL injection execution technique using again create remote thread but this time assuming we'll use the writing technique to write the DLL path into the uh target process already. We invoke create remote thread uh we invoke load library A with create remote thread and the argument of light library A is not executed. So we can only invoke functions with a single argument in this way. Load library A would be the t- the path to the DLL already written to the target process. Uh in this case uh the prerequisite is that the this DLL on disk and uh the please note that DLL main this is the what uh the loader executes in such case is restricted to the load with the loader lock. CIG however blocks this technique so it no longer works if CIG is turned on in the target process. And uh I just mentioned that uh a variant of this technique is called load this technique can use Q user APC or NTQ APC thread instead of create remote thread. Uh another well known uh classic execute DLL injection technique is uh using set window hook X in which case uh the DLL is loaded to the target process when the target process receives an event of a certain kind and uh after we we uh invoke set window hook X uh we uh artificially send such event to the target process. Again the prerequisite is that the DLL is on disk and again CIG blocks this technique. Uh one other classic uh execution technique is APC. You can use a Q user APC the standard Windows API or NTQ uh APC thread which is the internal function a more uh uh flexible function and more useful one. Now the prerequisite here starts be- starts getting interesting because the thread must be in an alertable state. I'll tell you about that in a minute. So uh let's look at the target- I'll talk about that in the next slide. CIG has no impact. We're not talking DLL's here. And their CIG uh is uh is uh- is relevant because the target execution should be valid CGU target again and forced by window uh Windows at the uh uh at the execution time. Um Q user APC grants as control over our R6. NTQ APC threads grants as control over 2 and a half registers. R6, RDX and the lower half of a rate. This will give you a lot of can be quite useful for f- functions that accept up to 3 arguments. Now what is an alertable state? It means that the uh- that the thread is executing or is hanging in 1 of 5 functions, leapEX, wait for single object EX, etc, etc. And uh- in- in all 5 cases it means that the actual uh- internal function exe- uh- uh- executed once the thread is hung is anti-delay execution, anti-wait for single object and so forth, they all follow the same pattern, they all follow the same template of code, in which case the RIP is in uh- uh- the entry point like anti-delay execution plus hex 14 so therefore very easy to uh- discover whether a thread is in an alertable state if you know it's RIP. So this is one handy uh- uh- handy uh- byproduct of our research. Moving on to another uh- another uh- uh- uh- uh- pretty known technique, it is suspend inject uh- resume thread execution, uh- as the name hints, we suspend the thread and then we set the RIP using set thread context to our desired execution location and then we resume the thread, the thread starts running in the new location. Now with respect to CFG, amazingly there is no impact, uh- there's no check in- in windows anywhere that this is a- a- a CFG valid uh- address because there's- it- it- it does not represent a callable function in the first place. Uh- there is a bit of a restriction on RRSP, it should be within the stack allocated region. Uh- as for control over registers, there's no guaranteed control over the volatile registers, uh- this is a bit of a puzzle. Uh- in some processes uh- we can control those volatile registers, in others we cannot, so we assume the one lost, we assume we cannot control the volatile registers. What if we can only write uh- read- write memory, no execution in the target process? Well, we can use the write primitive uh- to write uh- ROP chain uh- to the target process and then uh- set uh- RIP to a stack pivot and start executing the ROP chain through this mechanism. Now here is an exotic uh- technique that's uh- not too well known, it's called ghostwriting, I believe it dates back to 2000. Uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- 00007 and it's a monolithic technique in the sense that it carries out both, uh, memo writing and execution uh- together. So it's quite similar to thread hijacking but, uh- without the need for memory writing uh- uh- primitive. The idea here is that memo writing is achieved in steps using setthread context to set the register- to set registers and at the each at the end of each step, the thread is running an infinite loop, which will be our success marker, once the, uh, Trust Representative leaves escols for register, when RIP or 적, malware sees that the thread is in the in the in its infinite loop marker it knows that it's safe to move to the next step. So we need 3 ROP gadgets for this uh a sync gadget is simp- simply an infinite loop jmp-2 which will be the marker of a successful end of execution. I believe it's just 2 bytes of uh opcodes. And then we have a write gadget something like uh move into the uh set by RDI the value of rbx followed by a return and then a stack pivot or something equivalent. So the first step is to write on stack the uh address of the infinite loop and the br- and and using the write gadget and then finally the return from the write gadget will branch into the infinite loop and uh this will mark the successful end of this step. Moving to step 2 we write RBI. So the first step is to write on stack the address of the infinite loop. And the reason is because for all of our uh arbitrary keywords uh so we repeatedly execute step 2 until we have all the memory that we need written to the target process. And the idea here is to use the write to to s- to start the registers uh and to point at the write gadget so that the write gadget will write this keyword and then its return will branch right into uh the uh infinite loop. So marking the successful end of writing a single keyword and repeat this step. repeating this process as of- as many times as needed to write all the arbitrary memory we need. Finally we just set RIP and RSP uh to desired values to start uh uh um stack pivot or something similar and to start running over the ROP chain. One uh one lovely location for uh uh for the new stack is the unused part of the existing stack and here are some tips of how to do this right. Uh first you need to maintain some distance from the official top of stack, the RSP value in order to- to provide some space for stack- for natural stack growing as- as it- the stack is used by Windows API calls. But on the other hand you can't go too far because the stack is limited by 1 megabyte so something like 64 kilobytes is probably uh uh uh uh uh uh uh in the- in the- in the right neighborhood. Now you need to grow the stack uh uh one page at a time, one guard page at a time in order to get from the TOS to where you really want to start writing your own stack and you do that by touching the memory at page size interval so that the- the uh the guard page would- will keep uh uh- so the uh kernel will keep committing new pages uh as- as- as we follow this algorithm. Finally you need to mind the stack alignment which is set to 16 bytes and it's uh really uh uh observed by some functions. So the- the prerequisites from ghost writing is simply just a place where you can- we can write some- some data. There's no impact from CFG except uh what we already know about RSP. No- of course no impact uh by- from CIG because there's- there are no DLLs involved and we have control over some registers which is nice. Uh- uh- uh- uh- uh- uh- uh- uh- now moving to um shared memory writing technique uh in this case uh the prerequisite is that we know that the uh target process uh has a shared memory section, we know its name and we know its size and now it's pretty uh predictable if we know the exact software that we are targeting and- and its build we know whether there are uh uh sh- whether it uses shared memory and- and of what size. So this is uh we assume that this knowledge is available to the attack attacker. So the attacker first maps this uh shared memory to its own process, writes the payload at the end of this uh shared memory, hopefully it's an area not used by the legitimate software. And then uh opens the target process uh and starts looking for uh scanning its memory uh region by region, trying to find a region that matches the attributes of the shared memory uh uh section. And this- and so we are completely uh- uh- uh- uh- uh- uh- uh- uh- uh- uh- comparing- we're looking for a map- map memory uh ma- map uncommitted uh with page read write attributes and the exact uh size that we expect the shared memory to have. Once we find we'll also do a read memory to make sure that the payload is at the- at the end of the shared memory. And once we know that we can start using this as memory written to the pro- to the target process. Uh so the prerequisites obviously is that the target process has a read write shared memory and that the attacker knows the name and the size. Uh we should uh- uh- uh- uh- you uh- uh- uh- uh- with respect to CFG this is probably irrelevant because this memory is typically uh read and write only not executable and CIG of course is irrelevant. Now I move to the atom bombing writing technique. So naively speaking uh assuming the payload is small and it has contains no null bytes and except for terminating null byte uh what we have here is the uh the uh essence of this uh writing technique. We define a global uh uh an atom object in Windows that uh contains this payload for in this in the malware process in the injecting process and then we use NTQAPC thread uh to invoke the function get global get atom name A in the target uh process asking it to copy the value of the atom that we just created uh into the designated address. Now uh this is uh pretty uh pretty neat, the original paper uh doesn't write doesn't uh provide uh doesn't support writing null bytes. It simply assumes that the mem- target memory is zeroed out which is the case because they chose to use uh CodeCave. Uh we devised a technique to write null bytes and its it's in our paper. The prerequisites are again that the thread must be in an alertable state and that the target payload is a allocated and writable. As for CFG and CIG there's no impact of course um and then we have another uh interesting uh allocation and writing technique combined uh using anti-map view of section. Uh in this case the uh malware process forces uh a section to be mapped in the target process. It does so by first uh defining a section, populating it with the desired values and then uh opening the target process and uh doing running anti-map view of section of the target process uh of this uh section into the target process. It's uh uh and it we can also control the uh page attributes. You can uh ask for executable and read execute and read write. So this cannot be used for already allocated memory so for example we cannot write values on the stack using this technique. Uh and uh the the nice thing is the CFG wise is that Windows once because we requested the page executable Windows will will mark the whole region as uh CFG valid. Um this is a a quite fascinating execution technique the unmap plus rewrite and it works like this. We we can uh we can uh we can uh output key. So we look at a CDLL used heavily in the target process. Anti-DLL is of course a prime choice and then we first copy all the region of this DLL into our own process. Uh we suspend the target so first we suspend the process then we copy the existing anti DLL entire module space into our process. We make a copy of it. We patch it, this copy, locally. For example, we can, uh, patch NT, uh, NT close, which is heavily used function. And then, uh, we unmap the original, uh, NT DLL section from the target process, and use any, uh, writing allocation and writing technique to map and, and write the, uh, the, the patch, the patched, uh, NT DLL copy, uh, back to where the original NT DLL, uh, used to reside in the target process memory. And finally, we flash the instructions from the CPU so that it will not, it will forget everything it know, it thought it knew about those, uh, addresses, um, and we resume the process. Now, this is, uh, quite elegant. And, of course, with, with respect to CFG, it's a bit tricky because there are many, all the entry fa- and all the entry, uh, uh, uh, uh, addresses in NT DLL must be also, uh, be CFG valid, uh, now after this, uh, switch. Uh, however, fortunately, uh, when using NT map view of section, and, uh, this, this, this is, this is, uh, virtual AlloKeyX uh it is guaranteed-guaranteed that Windows sets the whole region in fact to be uh CFG valid so this is taken care of. Um and there are some uh tips regarding how not to destabilize the process uh first we need of course to do a process wise suspend because we can't know which thread will use the NTDLL and when. And then the whole thing about copying the complete NTDLL memory and then uh copying it back instead of just say uh uh copying parts of NTDLL is because we need to make sure that some uh variables inside the NTDLL space are consistent and if we just copy code and not uh uh some uh variables that are part of the static variables etcetera that part of NTDLL will bound to get uh uh uh uh uh uh uh uh uh uh set into inconsistency which will immediately crash the process. So if you do that copy the whole region. Uh there's a bunch of uh callback override execution techniques uh uh uh that operate under the same uh concept uh we have uh set things from set window long PTR to uh shutter like uh uh uh techniques through a LPC control injects etcetera. The idea is that uh the we write we write some code into the target using any writing technique then find or obtain a memory object with virtual table or callback uh table uh this may be tricky because uh uh it's not uh not all processes uh have all objects like uh LPC or co sometimes some objects only exists in console applications some objects only exists if the uh application has uh private clipboard. this finding or obtaining uh can be done via a standard API like get window long PTR or via memory search like as is the case with LPC then we replace this object or callback uh to point at our desired execution point which must be CFG valid target because Windows will check each and every of those uh uh execution techniques in each of every one of them CFG is is checked and it may also require some adjustments uh to the object and to the code. We trigger execution which may be tricky because some uh techniques are not uh um deterministic and we cannot really force uh the execution uh upon them. And finally we restore the original object and callback so the process can resume normally. Uh this is an example a control inject uh in which uh we encode a pointer to our desired address. And then we copy this pointer uh to where to the control C uh handler in the target process which is uh the the other sort kernel base uh single handler. And finally we trigger execution by uh first uh simulating uh pressing the control key using send input and then uh sending the C character to the target process. Now we move to a nice technique that we developed uh we uh nice writing technique we developed here based on memset on memmov in which uh the idea is that we write uh arbitrary data to the process uh uh by uh byte at a time. And we use NTQ APC thread uh with uh the target function invoked being memset. This is a classic uh NTDL function. So it's it's there's no there are no CFG problems here. And since memset takes three arguments the destination address, the bytes you write, and how this is too long. Uh um so we use the sort of a a uh by the time we use the target function invoked being memset it many copies, we simply use it with the address we desire, the byte we desire and the, uh, constant 1. And we can loop through our buffer and copy it to the destination address. Uh, by the way, Alon Weinberg, uh, we will be presenting here at, today at 4pm, I believe, uh, developed a similar, uh, technique. The prerequisites are that the thread must be in an alertable state, we already discussed that. And CFG is not affected because as I mentioned NTDLL memset is CFG valid. Finally, there's this, uh, the execution technique we developed, we call, uh, stack bombing. Uh, in this case, uh, the idea here is that we overwrite, uh, a sing, uh, the return address on stack to point at our desired, uh, destination address. Now, if the thread happens to be in an alertable state, it becomes pretty simple. The code for, uh, an alertable, uh, a classic alertable state is, uh, the, uh, the, uh, the, uh, the, uh, the internal function is this. As I said, uh, the, the code, the, the, the thread is hanging right after syscall at, uh, at entry point plus hex 14. And as you can see, what will happen next is an immediate return without touching the stack or the registers. So that if we modified the, the value pointed to, uh, the value on stack pointed to by RSP, we are bound to get execution. Of course, the implementation is much more, uh, sophisticated and complex. There is a, uh, nice proof of concept, uh, in our paper and in our, uh, uh, Git, uh, repository. Uh, and, uh, the beauty of this, uh, technique is that, uh, there is no impact on CFG. Uh, so we can use ROP chain and start executing even if CFG is enabled in the, uh, in the target process. There are two techniques that we could not, uh, make t- we, we could not implement, uh, successfully for Windows 10, the set win event hook and the desktop heap technique. If you manage to run them on Windows 10 x64 version 1903, please, please contact us. We will be delighted to know. To summarize, we looked at 6th, uh, sorry, 5 writing techniques. And you can see the compression here and now paper. We also looked at the uh, set win event hook and the, uh, over 20 execution techniques and uh you will see that uh tec- techniques that are CFG agnostics marked in the yellow uh at the uh right hand side column are pretty rare there are uh 1, 2, 3 and ours is the 4th and I we believe this is the future of process injection. Uh quick bonus if you need to load a DLL and a system DLL into an arbitrary process maybe and you don't have a writing technique to write its path uh into the process first maybe your whole ROP g- maybe your favorite ROP gadget is there uh we have good news for you kernel base dot DLL contains uh the names of uh more than a thousand system DLLs including some things like mshtml dot DLL, shell32 dot DLL and win-in-one. So if you need to load a system DLL into an net dot DLL and you can use that uh to load as uh the DLL using load library A. And with that I hand it over to you Itzik. Thank you Amit. So as Amit mentioned our research was not only theory there's also the practical implementation side of it and as we went through and scrapping different proof of concept trying to compile together we decided to take it to the next level and create Pinjectra. So in a nutshell Pinjectra is uh it's basically a framework that allows you to combine mix and match different elements as Amit presented writing and execution and obviously the payload in a mix and match style. And we gonna set in the next few slides, feel free to go to the github right now and download your copy. Ok so once you'll go to the github you will see that the Pinjectra solution is basically made from four major projects. As Amit mentioned some of the validate for you. So the first two projects here are DLLs that are implementing certain interfaces so they can be easily used for the purpose of the injection. The other two is the pinjectra itself which contains the library of the knowledge as well as the implementation and also for your convenience we also released a test process. This is a dummy program that puts itself into an alertable state as Amit mentioned it's a prerequisite for certain attacks techniques and so this will do the job for you. Now let's step a little bit outside and understand what's the philosophy. As I mentioned pinjectra is a mix and match, it's using object oriented so we leverage the C C++ static type system to create different classes from different types and so it's very easily kind of mixing together into a full attack. And how does it looks like? Pretty much like that. So what you can see right now is the implementation of our new technique the stack bombing in pinjectra. So let's go ahead and look at the pinjectra. It's very easy, it's very clean, it's very elegant. We're looking on three major classes here. The first one called via which provides the actual execution so that's a class of an execution technique. Then we can see the net queue APC thread that's the writing technique and then at the end we can see the rope chain that's class representing of the payload. The mix and match philosophy means that you can now play and try different techniques, different primitives and see how they can combine together. You can obviously create the new ones and then explore different avenues. And now all this wrapped up in a very nice model. At the end of it there's a method for this class called inject that expects the process ID and thread ID and there you have it. And now let's go into a demo. No. Some technical difficulties. So let's go ahead and see what we can do. So let's go ahead and see what we can do. Okay so what you can see here is two CMD consoles. There's a red one which will be the attacker and the green one which will be the attack key or the victim. So right now we're first going to run the test process. Again as I mentioned that the purpose of that was to be the victim of the process injection. As you can see running it will conveniently print the process ID, thread ID as well as we'll put it into an unroutable state. Going into the pinjectra we will run it once without any parameters. That will give us the usage of all the different attacks that are possible within the demo. Now finding the right combination of the two injection with the process ID and thread ID will invoke the actual injection. In our payload by default we're using a very nifty low boxword so that's that's the process that you will have if you have a successful injection using pinjectra right now. Okay and as a bonus uh which we've seen for the last second there the process itself continues to run as interruptibly. So again the process doesn't crash it keeps running. Moving on to the next thing which is the process a few other techniques that Amit has mentioned and how they get been, how can it be implemented within Pinjectra. Here's the ghostwriting technique. So as you can see we're using conceptually the suspend, inject, resume design pattern not to be confused with the set thread context technique that Amit has presented for the classical seer. Then we have the ghostwriting as the actual writing primitive and then that accepts the payload. So again a pretty fairly simple way to combine different techniques into one fusion process. So let's check this demo as well. Okay, so the same idea applies, we're creating a green process to be injected to and then we're going to inject the payload. And then we're going to inject the payload and then we're going into Pinjectra. Again running it without any parameters we will see the different usage that contains the different options. Giving it the process ID and thread ID and we pop the box. Thank you. Okay, uh again continuing with the series of demos that we have planned for you today. As Amit mentioned the uh very exotic and uh interesting technique of the unmap and map which includes many different steps in the way. Again with Pinjectra we've broken down into these three different classes. For the people here that were uh keeping notes on the actual class names you can see that the code via suspend inject and resume underscore complex was already actually used in our own implementation of the stackbombing. The stackbombing is basically the same as the previous one. This is just one of the features of using these libraries, the ability to reuse existing code and logic. And so we do not have to reimplement the uh conceptual execution technique. We can then just focus on the create file mapping, map file map view of file, NPN map and map of the of the section. This is the combination that essentially identifies this technique. And of course the payload that has been accepted as the payload comes on top of it. Okay. Oh yeah. Okay uh so the idea again is we're creating uh a green process and a red process. In this case as Amit mentioned our test process was not complicated enough to include all the different uh results and APIs and so basically we also provided this very small batch file to simply return the uh PID of the explorer. So in this case we're going to actually attack the explorer itself. So that gave us back the PID of the explorer process. And now going to pincheck trial we're going to use that as the destination of the process injection. Takes a little bit of a time. And here it is. Okay uh the set window long pointer is quite an interesting implementation. As Amit mentioned we need to retrieve the actual structure and then change the callback within it. So for here its actually a mixture of an execution technique which stands on its own. That's the code via set window long PTR. And then what we actually did is we did a the framework we refactor one of the most primitive techniques which is a combination of virtual allocation and write memory in conjunction with a payload and the connector that actually brings them together is a metadata that calls complex immutable advanced memory writer. As you will dive into the framework you will see there's different types of classes to accommodate different types of attacks. This is actually a converter that we created for the purpose of this attack. So let's jump into the demo. It's important to mention that since this attack requires retrieval of a specific structure it's much easier to find to implement the discovery or finding of explorer within the attack itself and that's what you're going to see right now. So there's not going to be any green screen right now, it will only be contained within pinjectra. So we'll pass 0 0 as an indication that again pinjectra method will come out. Not with the PID and TID of explorer while using the set- long window PTR API. And here it is. Okay and last but not the least let's talk about the atom bombing technique and how it's implemented again within pinjectra as you can see the Q user APC is used as the code execution technique and then the sequence of open thread, open process virtual virtual allocate and global add atom A are the actual writing sequence. And again you can see you can control the different parameters and you can control the function that retains the payload and having said that let's see how it looks on our platform. So here again we will be using the PID of the actual explorer to perform the actual uh testing. Again we need a much complex process providing the PID and TID of explorer. Takes uh a second there and boom. Excellent thank you and with that back to Amit. Thank you Yitzik. So what have we seen today? Uh we have we we have actually three deliverables you know through our project. One is a mapping of the vast territory of true process injection and together with that we provide an analysis and comparison. It's all in a single collection repository compendium however way you like to call it. Uh it's part of the DEFCON uh deliverables uh from our side which so it's a PDF uh document uh for your uh enjoyment. Uh and then we also have uh a single collection of uh based on your vision it's also uh enjoyirenment and pleasure. It's also uh on our website. We also provide this library that Yitzik uh demonstrated called PINJECTRA for uh mix and match generation of process injection attack. Now this is extremely important because a lot of the POC's out there will couple a single uh new say mime writing technique like in Atom Bombing with uh single execution technique just to demonstrate that and this becomes the Atom Bombing process injection uh technique. So if you're, if you want to test your environment against or your system against uh atom bombing you may as well test that with not just a single execution technique but uh uh the all the array of possible execution techniques that that can be coupled to to atom bombing and that's exactly what we provide with PINjector. The ability to couple or to match any almost any writing technique with almost any execution technique and thereby we allow uh red timers, blue timers, uh security researchers to cover almost all the possible all possible uh combinations in this uh in this uh universe. Finally we also describe a new CFG agnostic execution technique and I remind you that this I I believe that this is the future of process injections. The the ones that are based on uh uh CFG agnostic execution techniques. Which we call stack bombing and with that and coupled with that we also uh disca- we also uh uh described a new memory technique using a memset and memmove over APC. So that's our three deliverables. Thank you very much ladies and gentlemen.