Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Can we hook some func in another process then change return address? (https://forum.exetools.com/showthread.php?t=5386)

Teerayoot 09-16-2004 06:46

Can we hook some func in another process then change return address?
 
I want to inject dll into another process then hook some function in order to change return adreess to our code or fill hex 0xEBFE byte so we can pause there and debug that process.

Can we do this tecnique? :(

Viasek 09-16-2004 07:51

For injecting you can use ForceLibrary, createprocess with the suspend flag, inject, resume process.

Hooking a function is just a matter of calling WriteProcessMemory and correctly modifying a call/jmp to the address of your code, and returning properly. Make SURE you take care of the stack correctly.

goldenegg 09-17-2004 17:18

no,micro$oft's detours is the best,using it's api
DetourCreateProcessWithDll or DetourContinueProcessWithDll
u can inject a dll into another process very easily.
it also provide some apis with which one can hook functions in a simple way.

Teerayoot 09-19-2004 02:59

GetProccAddress
 
Thank you,Viasek for infos.

Ok,anyway can we hook System api like

"NtQueryInformationProcess" that getprocaddressed in normal process?

Note : I using madcodehook :) very easy and painless.

thebobbby 09-19-2004 22:43

Injecting a DLL into another process can be done quite easily with the regular Windows API only:
-first allocate memory in the target process with CreateRemoteThread,
-then copy some loader code and the arguments using WriteProcessMemory,
-then use CreateRemoteThread to start the loader code, which in turn calls LoadLibrary

This technique is very generic, and allows to execute any code into any process... This is useful for hooking as well, as it allows to hook only a specific process instead of the whole system....

xzz 09-21-2004 11:12

E.g
 
in ntdll.dll
you can find return address and simple you can hook them,
the address from my ntdll.dll

;Native API
SYSTEM_CALL equ 7FFE0300h
NtAllocateVirtualMemory equ 77F5b54Eh


All times are GMT +8. The time now is 11:14.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX