dll-injection

elegant method to inject a dll to processes BEFORE they start

こ雲淡風輕ζ 提交于 2019-12-05 16:01:40
I am making a 'mod' dll that modifies behaviour of the target process. I succeeded to inject my dll and hook some functions of target. But it requires more work to do when I need to hook some APIs BEFORE main module starts(more clearly, before the entry-point). I need to start the target program manually with CREATE_SUSPENDED attribute, inject, then resume. But some applications start with its own launcher program, some often start from x64 processes... such various environment make it hard to automate it. Seems like the best way's inject hooking dll to all process and handle CreateProcess.

How do I strongly name an Unmanaged C++ Dll?

梦想与她 提交于 2019-12-05 11:02:02
I'm working on a C# application which uses the EasyHook library for DLL Injection. EasyHook requires that any application using it be strongly named. In order to strongly name the application I need to make sure that all the libraries I use are strongly named as well. This is easy to do for all of my managed libraries, but I also have an unmanaged c++ library which I need to strongly name. After some searching I can't seem to find a way to sign my unmanaged dll, even with the source code. Can this be done, and if so what do I need to do? Thanks for any suggestions or assistance! I assume that

Why Control.FromHandle(IntPtr) returns null in one hooked process and returns valid object of “Form”? in another hooked process?

旧城冷巷雨未停 提交于 2019-12-05 10:46:26
I am facing a problem related to get out all the controls from some hooked process. My SpyDll launched into hooked process sucessfully, But when I check the statement Control control = Control.FromHandle(MainWindowHandle), it returns null into control object where "MainWindowhandle"is just a native main window handle of that hooked process, which you always take from .NET "Process" class after launching that process. But STRANGLY it happens that in some other hooked process which is the same C# .NET application, it returns valid object of Main "WinForm". So why it will not work in above case?

.so injection under linux: how to locate address of dlopen()?

送分小仙女□ 提交于 2019-12-05 03:57:21
问题 Recently I have become interested in Linux, and am trying to create a program which is capable of injecting a shared object (i.e. .so file, 'dynamically loadable library', "DLL" under Windows.) I know this can be done by setting an environmental variable, but I want to do it on a process which is already running. I already know how to do this under Windows. There are several ways, but generally speaking you can just call LoadLibrary() by creating a remote thread using CreateRemoteThread(). Of

SetWindowsHookEx functioning returning NULL

前提是你 提交于 2019-12-05 03:18:45
问题 I am working on DLL Injection but getting the error as failed to hook process: 87 The parameter is incorrect. The target process as well as the dll are both 64 bit. The Injection code is: BOOL HookInjection(TCHAR target[], TCHAR *dll_name) { // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx // SetWindowsHookEx can be used to inject a DLL into another process. A 32 - bit DLL cannot be injected into a 64 - bit process, // and a 64 - bit DLL cannot be injected

How to call specific function in dll injection?

蓝咒 提交于 2019-12-04 10:04:02
Following code will inject dll and DllMain will be called. How I call specific function from DLL, not just DllMain? DWORD pid; HANDLE hd; LPVOID gp, rs, proc; gp = (LPVOID)GetProcAddress(GetModuleHandle(L"Kernel32.dll"), "LoadLibraryA"); pid = 6096; hd = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); rs = (LPVOID)VirtualAllocEx(hd, 0, sizeof(DLL_NAME), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); if (!WriteProcessMemory(hd, (LPVOID)rs, DLL_NAME, strlen(DLL_NAME), 0)) { printf("WriteProcessMemory %d", GetLastError()); } if (!CreateRemoteThread(hd, 0, 0, (LPTHREAD_START_ROUTINE)gp, rs, 0, 0)) { printf(

.so injection under linux: how to locate address of dlopen()?

自闭症网瘾萝莉.ら 提交于 2019-12-03 20:26:35
Recently I have become interested in Linux, and am trying to create a program which is capable of injecting a shared object (i.e. .so file, 'dynamically loadable library', "DLL" under Windows.) I know this can be done by setting an environmental variable, but I want to do it on a process which is already running. I already know how to do this under Windows. There are several ways, but generally speaking you can just call LoadLibrary() by creating a remote thread using CreateRemoteThread(). Of course you need the address of LoadLibrary in the remote process, but (in my experience) it is always

SetWindowsHookEx functioning returning NULL

前提是你 提交于 2019-12-03 18:02:02
I am working on DLL Injection but getting the error as failed to hook process: 87 The parameter is incorrect. The target process as well as the dll are both 64 bit. The Injection code is: BOOL HookInjection(TCHAR target[], TCHAR *dll_name) { // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx // SetWindowsHookEx can be used to inject a DLL into another process. A 32 - bit DLL cannot be injected into a 64 - bit process, // and a 64 - bit DLL cannot be injected into a 32 - bit process.If an application requires the use of hooks in other processes, // it is required

How can I inject a file into an EXE at runtime and reference the file during program operation?

纵然是瞬间 提交于 2019-12-03 13:26:53
问题 I'd like a user to download an exe from my website, where (synchronously upon download) an XML file is injected into this application. This XML file contains a public key, and a signature. How do I inject the file prior to downloading and reference it later during execution? Ideally I won't be using a shell to inject the file, rather a native .NET api. 回答1: You could that easily with Mono.Cecil, you'd just have to write something like: var module = ModuleDefinition.ReadModule ("Application

Dll Injection - What is possible with it?

旧时模样 提交于 2019-12-03 03:51:37
问题 I was browsing the internet lately, when I stumbled upon Dll Injection. I think its an interesting subject but, I have no clue what the purpose of it is? I have read that it can be used for cracking/hacking games and software but is it also possible to do something positive with it? if so, what can it be used for? And what languages support this? For the record, I am not going to try and Crack/hack any game with knowledge gained, no intention to do someting illegal! Thanks for the time,