A friend standing next to me, this is his first time speaking at DEF CON. His name is Sheng-Ao Ma, and he wants to play with malware injection with exploitive thoughts. I don't know if I said that right, but let's hear him explain it. And before we get started, I'm going to give him a good congratulations. Oh, you already drank? I already drank. Okay, so hello everyone, my name is Ma Sheng-Ao, and I'm just a master's degree student from Taiwan, and I'm also a security researcher from C3Root and TDOH Hacker. This is my first speak on DEF CON, so I'm a little bit nervous. And I just drank that shot, and it's very spicy. So that's okay. So let's do it. So it's the agenda. First, I'm going to talk about what is malware injection. So vulnerability. Vulnerability inspired by PowerShell, uh, PowerLaunder, so, so let's quick, quick review what is malware injection. In the past, malware injection is used for some, bypassing some, uh, production, like bypassed wireless tracking, bypassed anti-virus, or privilege escalation, and, for example, with DL-Sylon. DL-Sylon being a digital signature, we can bypass the anti-virus, and with remote inject, and wireless process, and we can bypass the wireless, wireless, and with the ingest, inject the explorer, and DL-Sylon being, and self-elevated service, we can bypass the Windows USB production. So. And then, let, let us. Several well-known technique, like, um, we, we have known about low, low technology about inject, like share code, share code inject, DL-inject, process hollowing, and, uh, thread hijacking, atom bombing, and memory export. And in my presentation, I will focus on how to do malware injection in exploit way, how to do it. And if you want to do a malware injection. Actually, there, there's four challenges for you, you will meet. The first one is, what is target? You, you, you should choose a good target to, um, to injection. And it's, this, this target must be meaningful. Then, secondary, where to place? And a, a, a memory space for us to place our malware, malware code in remote process. Then, thirdly. We not, need to know how to write malware code from remote. This is, and finally, we, we need to find a way out to run the malware code from the remote. This is most difficult, difficult part for us. And you can create a new thread and hijack current thread or whatever. So, uh, this is an interesting case for us. We are talking about as power loader. And what is power loader? Uh, power loader is known as extra window vulnerability. So, what it is? And there is, uh, Windows data, Windows data, uh, window data in Explorer process memory. And those data decide, decide how your GUI, how your window is look like. And this is how it's going. First, a recent system will send message to your Explorer. Secondary, Explorer fetch the VTable from, from those data. Finally, Explorer invoke the Kobe functions and lay VTable. And you, you will say, what is the problem? It, it seem very normal. It's generally. So, what is the problem? The problem is how Explorer fetch lay VTable. Because we know, uh, you, Explorer will invoke the VTable. So, the problem is how Explorer fetch the VTable. Actually, it fetch the VTable by, uh, by a Windows API named getWindowLong. So, we can easily modify the result of getWindowLong API. Just use setWindowLong API to change the VTable address. So, let's put it all together. We can learn. We can know if we can inject a fake VTable. Then, then we can use setWindowLong API to point the VTable address to the fact, the, the fact VTable. And then, we can, if we send any message to Explorer, Explorer will invoke our malware code from lay fact VTable. So, if you, uh. Uh. I, I gave a payload here. And we just prepare our share code and prepare our memory layout on lay VTable. Then, use setWindowLong PTI API to modify the VTable address of target, AKA Explorer. Then, uh, just, just send a message to lay Explorer and we'll trigger our payload. So, let's see a quick, quick demo. Uh. Here. Here. Ah. Okay. So. And. Here. You can see. Um. Let, let, let's test on Windows 7. And. Uh. Here is my share code. Then. It's pretty hard to use. Big, big screen. And then, you can see. I prepare our memory layout and inject the fact VTable into target. Explorer. And send a message to Explorer. You can see if we compile and you can see, uh, Explorer is, is crashed and down. And, and run our share code on the remote. Okay. So. There are three more. Three more. Vulnerability from, we, we are talking about next. First one is OLE job enter event. And what it is. And if you do some reversing stuff, you, you will see, like, those, those code on, on the screen. And. Explorer use global add, add-on to keep, uh, string name OLE jobs target interface. List string in local. And, uh, by, just, just keep it by global add-on API. Then, you can see. When Explorer try to resist a drag and drop event. You can see Explorer stole the job target structure in OLE job target interface properties. So. And you, you ask about what is job target. This structure is used for what. And you can see. Job target is, actually, it is, uh, Vtable class. Keep every copy function address of drag and drop event. So. Explorer use. And when, when you try to drag a file, drag a file, any files to Explorer, or inside Explorer. You, you will trigger, uh, function. Name, privilege, drag and drop. And you can see in this function. Explorer will try to use get prop W API to fetch lay Vtable class. And invoke the function on the Vtable when you drag any files inside Explorer. And you, you, you ask about why is the problem. The problem is it's pretty easy for us to modify Vtable address by another API as set proper W. And if we use this API can modify the Vtable address. So. What we need to do is inject a fact Vtable and the pointer, the OLE job target interface, the properties to our fact Vtable. So, finally. So, let's, let's, let's see how you going. You, you can see drag files. If we drag files in, inside the Explorer. Then, operation system, operation system send message to our Explorer. Then, Explorer fetch our fact Vtable by get property W API. Because we, we just use set prop W API to change the Vtable address. Then, invoke, the Explorer will invoke the malware code from our fact Vtable. So. If we need to prepare. If, if, if we prepare the, our share code and the V, Vtable on the correct, correct memory address. Then, use set prop W API to modify the Vtable address of lay window data. And, whenever just, just Explorer send or receive any dragon jar, dragon jar event, the message. Then, Explorer will invoke the malware code. Of our, our, our, our share code. So. It's the first one. You, you can see how we inject the dragon jar event of Explorer. Uh. Here. And. First. You can see. It's our share code. And. And, here. What we need to do is, uh, prepare our Vtable address. And, the Vtable address prepare our share code address. The Explorer will call the function on. Memory. Memory. Plus. C. And. We write the process memory. List, list share code into. The Vtable and the share code into target process. Then, use, just use set prop A, API to modify the OLE job target interface properties. So. You can see. If. We compile. Uh. Oops. The. Oops. And. We compile. And. Inject. The. Share code. And. Vtable. Into. Target. And. That. There's nothing happen. But. If. We. Jack. Any. File. Into. Explorer. You can see. There's a. Message box. On. Text. Manager. And. You can see. It's. From. Explorer. List. List. Message box. Is. Confirm. Pop. Up. From. From. The. Explorer. So. Oh. So. Silent. And. The. Second. The. Second. Cast. Is. First. Explorer. Keep. U. X. Sub. Class. List. Property. String. By. Global. Add. Atom. A. P. I. Again. Explorer. Invoke. Master. Sub. Class. Plus. Function. If. It. Receive. Any. Window. Data. Then. Verify. Live. Window. Data. We. Just. Get. By. Another. Function. Is. Enter. Sub. Class. Frame. Function. Then. Finally. If. They. Wait. Let. The. Window. Data. Is. Correct. Function. And. In. Enter. Sub. Class. Frame. Function. We. Just. Said. About. Is. Use. For. Verify. Live. Window. Data. Is. Correct. Or. Not. So. Only. See. We. Need. To. Care. About. Is. Here. The. V. Table. Plus. A. The. Function. Adjust. Cannot. Be. New. It. Should. Be. New. Or. Bad. Memory. Adjust. And. Cost. Explored. Crash. So. We. Need. Prepare. Our. V. Table. We. Need. To. Keep. It. New. On. The. Window. Data. Plus. A. And. In. Enter. Sub. Class. Code. Way. Function. You. Can. See. The. V. Table. Address. So. Uh. We. Can. Use. This. Rule. To. To. Check. Which. Address. Is. Our. Circle. Address. Should. Be. Put. At. And. Finally. Explorer. Invoked. The. Address. We. Add. V. Table. And. Our. Circle. In. The. V. Table. Address. And. Put. It. All. All. Together. On. The. Correct. Memory. Adjust. Then. Just. Use. That. Prop. A. API. To. This. Another. More. Interesting. Case. Here. And. You. Can. See. Is. A. Meta. Explorer. I. Build. On. My. PC. And. Is. It's. Finished. And. Windows. Defender. Is. Open. And. You. See. There. Is. Nothing. Happen. For. User. Victim. Don't. Don't. See. Anything. There. But. Our. Meta. Exploring. Here. Is. Get. A. Reverse. Share. And. We. Can. Do. Anything. Like. LS. System. Info. And. Even. We. Can. Execute. A. CMD. You. Can. See. Windows. Defender. Is. Not. Happen. Any. All. Not. Not. Protect. Us. And. You. Can. See. See. Any. Can. Use. Something. And. We. Can. From. System. And. Every. Is. Created. On. Windows operating system by let API is create a process list API and kernel will create a new process and map each station into the new process memory then create a new thread then put then pointer the PC register to the program entry aka address of entry and first thread threader did didn't just jump into the address of entry first threader will call the LDR initialize thunk to repair the import adjust table export directory and relocation information and the interesting is you you you were seen you you you were seen you you you were seen now for now threaders you just jump into the address of entry right but no for windows 10 threader will check variables is before threader jump into the program entry every threader will jump into another another address is address of LDR delicated RTL user threader star this variables if it's not new. So if it's not new and just jump into it. So you can see it's pretty easy for us to abuse. So just put a share code to a target process and write a share code address into LDR delicated RTL user thread star this vulnerability. Its name is very long. Every thread must jump into the share code address if it's created on the new target process. So let's see the final demo here. You can see it's a cron and I open a new cron there and here I just... the only thing I need to do is to get the actually LDR delicated RTL user thread star is located at which address and when we get the address and we just write our share code address into the variables, then if cron... you can see I just inject the share code and the variable mosquitoes on the target process, and nothing happened there. But if we try to browse a new website like google.com, and you can see there's the CMD come from Chrome. Yeah, thank you. You can see it's the CMD come from Chrome. So, okay. So, thank you for listening. Thank you.