Add dll to import table
See original GitHub issue Can use AsmResolver to inject a dll function into the import table. For example, a simple 64bit dll:
code
#include "pch.h"
extern "C" __declspec(dllexport) void puts()
{
MessageBoxA(0, "hi", "hello", 0);
return;
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
puts();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Can you give some hints or piece of code
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Add an entry to the import table of PE
My goal is to add a new imported function from an external DLL to my EXE, and then with ollydbg insert new code...
Read more >Add a hardcoded DLL dependency to any EXE
As mentioned in the previous post, a DLL entry in the IAT table needs to import at least one function. We will use...
Read more >Add imports to DLL import table
I have a 64-bit windows DLL file. I want to have it import some functions (from a DLL that its not already importing)....
Read more >Understanding the Import Address Table
It should be able to be used similar to iidKing in this respect to add new dlls to the import table. Note this...
Read more >PE Import Table hijacking as a way of achieving persistence
We could as well ADD an import table entry, but this is a bit more difficult, introduces more changes into the target DLL...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Like I mentioned in the previous post, make sure you add both the import lookup as well as the import address table to your PE, and that you update the data directories accordingly.
(Incomplete) example:
https://asmresolver.readthedocs.io/en/latest/peimage/pe-building.html
I use a new dll test the code in other pe, It doesn’t work.But it doesn’t matter, you can close this issue.