Closed kickturn closed 3 years ago
Hmm... Interesting. This should be caused by an address referencing a memory page that is not allocated (i.e. the address/pointer is invalid). Are you able to provide a stack trace, and/or view the address in question using a debugger?
I checked about the pointer not being vaild and it seems like I found the problem. The new executable had ALSR enabled
So i had to make my addr from
let lua_pcall: u32 = 0x0080BE80
to
// in C++ it would be like
// (ADDR - 0x00400000) + (DWORD)GetModuleHandle(NULL)
let base_addr = unsafe { winapi::um::libloaderapi::GetModuleHandleA(0 as *const i8) } as u32;
let lua_pcall: u32 = (0x0080BE80 - 0x00400000) + base_addr;
After doing this, it works! So I'm closing this. Thanks for the clue on that.
I'm making a dll exploit with rust and detour-rs, I'm using it to manipulate lua vms and so far this library is great. I got it working on other version of the executable but this one i'm trying to do right now isn't working
Line 59 (causing the error) is this
The unwrap fails for something giving me the RegionFailure error, I don't know why. This same code works with a different exe with different addresses. Also, i checked and LUA_GETTOP is the right addresses.
Compiled for i686-pc-windows-msvc and release, is there something that could be relating to this problem?