Closed cireu closed 3 years ago
Sounds like you've figured it out already! You can either determine the address you want to load in advance, assemble to a VecAssembler
with that starting address, then use VirtualAllocEx
and friends to copy the buffer into executable memory in that process, or you can have VirtualAllocEx to allocate a large enough area, take its return address and use that for VecAssembler
to assemble to. For any address-dependent code you'll ofc have to work with where stuff will be in the process you're poking into.
The normal assemblers are built with the idea of running the code in the same process so those will indeed not help you very much.
Thanks for you answer ;)
I'm using dynasm-rs to generate shellcode and inject to another process, the memory block for code is in remote process allocated via
VirtualAllocEx
. if I use defaultAssembler
its memory is allocated by Rust, Should I useVecAssembler
and supply base address in remote process manually?