Is there a way to prevent peeps from injecting dlls into your application. We have this screen capture application that injects its dll into our application which is causing a crash in our application.
This is a 3rd party application so I have no idea how they are hooking into it ..but their dlls shows up in our processer loaded dlls when using process explorer and our application crashes if their application is running.
This is a 3rd party application so I have no idea how they are hooking into it ..but their dlls shows up in our processer loaded dlls when using process explorer and our application crashes if their application is running.
So you know that executable and the injected DLL, get dependancy walker to see what functions are used. You need to know the injection method in order to prevent/block it.
Well these are the function that are being imported/exported for the injected dll?
c:\program files\capture express\QCAPHK.DLL
c:\windows\system32\KERNEL32.DLL
c:\windows\system32\USER32.DLL
c:\windows\system32\OLEAUT32.DLL
c:\windows\system32\KERNEL32.DLL
c:\windows\system32\USER32.DLL
[i]CapUnHook
[i]CapHookKeyboard
[i]CapHookMouse
[e]CapUnHook
[e]CapHookKeyboard
[e]CapHookMouse
Internally which function it is calling is unknown. It must be using SetWindowsHook. So how can I prevent any application from hooking into our application is that even possible?
I think you should try to find the reason of crash, because if you block the hooks for this application then in future your application might crash with some other hooking application.
The reason for the crash is a memory leak in the third party dll injected into our application. The memory keeps incresing till 200 MB and our application just vanishes.
Yes we did. When this dll is injected our application crashes (only in release mode) the crash in side a simple if block.
The reason for ending up here is because the function table is messed up due to the DLL entering into our application reserved memory.
if( TRUE)
{
SetMemberVariableValue( dValue);
}
Ok what I mean was the application execution pointer is corrupt when this third party dll screws up. So the problem is the 3rd party dll is crashing and since it is sitting in our address space our application also crashes. Try a simple DLL inject program that hogs memory.
Ok what I mean was the application execution pointer is corrupt when this third party dll screws up. So the problem is the 3rd party dll is crashing and since it is sitting in our address space our application also crashes. Try a simple DLL inject program that hogs memory.
Normally you cannot prevent the dll injection, since it's done by regular OS mechanisms. The only way is to make the enemy unable to load itself.
Intercept CreateProcess (installing KMD) and make it crash for enemy load attempts.
Kill it on your app start along with all its files.
An alternative may be to refuse to run in system where it's present.
I belive, if your app is more valuable for customer, the latter will take care about cleaning the system up himself.
Last edited by Igor Vartanov; July 21st, 2006 at 08:25 AM.
Bookmarks