-
Notifications
You must be signed in to change notification settings - Fork 465
Open
Description
Hi hasherezade!
I have found a weird problem adding some std headers.
for example if you add < string > nothing happens and the dll is loaded 10/10 times, but if you add < thread > < mutex > or < condition_variable > the dll mostly crash before injection is complited. (works 1 of 10 times).
I have tested the dll compiled on VS 2013,2015 both /MT.
works just fine without < mutex >
basic dll code taked from ShellCodeRDI for testing.
#include <Windows.h>
#include <stdio.h>
#include <string>
#include <mutex>
DWORD threadID;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
MessageBoxA(NULL, "DLLMain :D!", "We've started.", 0);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
//extern "C" to prevent C++ name mangling
extern "C" __declspec(dllexport) BOOL SayGoodbye(LPVOID lpUserdata, DWORD nUserdataLen)
{
std::mutex testMutex;
try {
int i = 0, j = 1;
j /= i; // This will throw a SE (divide by zero).
}
catch (...) {
MessageBoxA(NULL, "C++ Exception Thrown!", "Caught it", 0);
}
MessageBoxA(NULL, "I'm Leaving!", "Goodbye", 0);
return TRUE;
}
can you share some light about this.
thank you!
edit: forgot to add my test steps.
- pe2shc.exe TestDLL_x64.dll
- runshc64.exe TestDLL_x64.shc.dll
Metadata
Metadata
Assignees
Labels
No labels