GithubHelp home page GithubHelp logo

sondernextdoor / poseidon Goto Github PK

View Code? Open in Web Editor NEW
343.0 10.0 67.0 674 KB

Stealthy UM <-> KM communication system without creating any system threads, permanent hooks, driver objects, section objects or device objects.

C 16.55% C++ 83.45%
kernel mode communication anticheat bypass usermode read write

poseidon's Introduction

KM-UM-Communication

Stealthy UM <-> KM communication system without creating any system threads, permanent hooks, driver objects, section objects or device objects.

Process:

  • In our driver, we hook a function in ntoskrnl (.data pointer swap)
  • In usermode, we manually allocate memory and index it via custom data structures
  • We then create a thread in usermode and call the hooked function's corresponding usermode-accessible function
  • When the correct magic number is passed to the function, the driver will know it's us, and will then unhook and enter a shared memory loop, trapping our usermode thread in the kernel until we choose to break out of the loop

As long as this is set up prior to any anti-cheat being active on your system, you can communicate with the driver without being detected by most of the various security measures employed by invasive anti-cheat technologies such as BattlEye and EasyAntiCheat.

2023 Update: There are quite a few detection vectors that can be identified by BE and EAC, some of which are discussed in (now closed) issues. Most are easy to bypass, but others are a bit more tricky. Having said that, I still have never had any action taken against me for using this for relatively licit purposes (i.e. no aimbot, ESP, or any other blatant violative use), nor has anyone I know who's used it. Regardless, steps should be taken to mitigate any potential detection vectors. I will not be providing any updates or revisions, as this is nearly four years old and there are far superior options to accomplish stealthy communication. This is mainly meant to serve as an interesting, novel communication method that demostrates the potential creativity that can be employed to get around invasive security software, mainly anti-cheat software.

Limitations:

  • Dodgy synchronization
  • Not many kernel features, just basic remote-process operability
  • Not designed with safety as a priority (i.e. you may well BSOD)
  • Only tested on Windows 10 20H2
  • The client can only be used once. If you terminate it or call Client::Disconnect(), you'll need to remap the driver

The driver is intended to be manually mapped by exploiting Intel's vulnerable network adapter diagnostic driver, iqvw64e.sys (or any other suitable vulnerable driver).

This was created for fun, I do not condone the use of this code in any program that violates the integrity of any online game, nor do I condone the use of this in any malicious software. This should only be used for learning purposes or to prevent custom software from being falsely detected as an illicit program.

Usage:

  • Map the driver
  • Start the client
  • Start the target process
  • Do stuff

You have to modify the client to sleep until your target process is running (since it must be set up prior to any anti-cheat being active). Basic example of how main.cpp in the client should typically look:

int main() {
	Client::Connect();

	for (;;) {
		Sleep(100);

		if (YourTargetProcessIsRunning) {
			break;
		}
	}

	// Do stuff
  
        Client::Disconnect();
  }

You can either call the functions in memory.h and process.h manually, or you can just create a KProcess object for easier use. KProcess features are as follows:


	// Make a process object for your target process
	
	KProcess Notepad(L"notepad.exe");
	
	
        // Read Memory

	int Value = Notepad.Read<int>((PVOID)0xDEADBEEF);
	Notepad.Read((PVOID)0xDEADBEEF, &Value, sizeof(int)); // Overload


	// Write Memory

	Notepad.Write<int>((PVOID)0xDEADBEEF, 2);
	Notepad.Write((PVOID)0xDEADBEEF, &Value, sizeof(int)); // Overload


	// Allocate Virtual Memory

	Notepad.AllocateVirtualMemory(PVOID Base, SIZE_T Size, DWORD AllocType, DWORD Protect);


	// Free Virtual Memory

	Notepad.FreeVirtualMemory(PVOID Base, SIZE_T Size, DWORD FreeType);


	// Change Virtual Memory Protection

	Notepad.ProtectVirtualMemory(PVOID Base, SIZE_T Size, DWORD Protect, DWORD* OldProtect);


	// Query Virtual Memory. MEMORY_BASIC_INFORMATION only.

	MEMORY_BASIC_INFORMATION MBI{ 0 };

	bool bResult = Notepad.QueryVirtualMemory(PVOID Address, MEMORY_BASIC_INFORMATION& MemoryBasicInfo, SIZE_T Size);
	MBI = Notepad.QueryVirtualMemory(PVOID Address, SIZE_T Size); // Overload


	// Query Process Information

	Notepad.QueryInformationProcess();


	// Get module info by name

	Notepad.GetModuleInfo(const char* ModuleName, DWORD& ModuleSize);


	// Pattern finder

	Notepad.PatternFinder(BYTE* Start, DWORD Size, const char* Signature, const char* Mask);


	// Get absolute address within specified asm instruction

	Notepad.AbsoluteAddress(BYTE* Rip, DWORD InstructionLength);


	// Get relative address within specified asm instruction

	Notepad.RelativeAddress(BYTE* DestinationAddress, BYTE* SourceAddress, DWORD InstructionLength);


	Notepad.BaseAddress;     // Base Address
	Notepad.ImageName;	 // Name
	Notepad.ModuleCount;     // Number of modules
	Notepad.ModuleList;      // std::vector containing all modules' base address and size
	Notepad.Peb;		 // Process Environment Block
	Notepad.ProcessId;	 // Process Id
	Notepad.Size;		 // Main module size

poseidon's People

Contributors

raywave avatar sondernextdoor 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poseidon's Issues

Error Connecting

The client program exited with this message when it's running into Connect method, what could be the reason and how can i solve it?

Slow

Is it supposed to be very slow to read memory? Takes me about 3 seconds to read 64 addresses.

Make the client a library (such as a .dll)

Make the client a library so people who know other programming languages languages other than c++ such as c# can implement it easily. For example in c#, its possible to p/invoke the client if its a dll.

Performance Speed

Is there a known performance speed issue with this communication method?

where your driver unload dispatch?

  1. Cannot unload
  2. No signature
  3. Even if the driver is signed and loaded, Client.exe can only connect once, running Client.exe again cannot connect, and the driver cannot be uninstalled

how to read ++ adress

ok so i was tryna get some things going and im trying to figure out if im doing it right
KProcess Notepad(L"UnityPlayer.dll");
int ObjMgr = Notepad.Read((PVOID)0x17A6AD8);
now im hoping the above function is reading UnityPlayer.dll + 0x17A6AD8
now if the above function works then ObjMgr Will = UnityPlayer.dll + 0x17A6AD8
but i dont know how to then read ObjMgr 0x08
so the output will be UnityPlayer.dll + 0x17A6AD8 + 0x08

i tried this but it didnt seem to work
KProcess Notepad(L"UnityPlayer.dll");
int ObjMgr = Notepad.Read((PVOID)0x17A6AD8);
int Obj = Notepad.Read((int)0x08);
any help would be appreciated :D

KMode Exception BSOD

Probably utilizing this wrong:

Getting BSOD for KMode Exception Not Handled when calling ::Connect() in client code. Built both Driver.sys & Client and manually mapped Driver.sys using kdmapper. Output from KDMapper appears valid and that driver is mapped.

Any recommended mapping tool or method? Running Windows 10 19041

How do you setup KProcess across multiple .cpp files

If I want to initialize client in main.cpp and read memory in another .cpp file with KProcess I get multiply defined objects in main error. I have not been able to separate KProcess apart from the other headers like memory.h to where the headers are not being defined in both source files. Is there an easy way around this that I am just missing? Any help is appreciated.

I have temporarily subverted this issue by making the functions inline but I feel like that is such a ratchet fix.

question brother

could you add me on discord i just have a few questions about the functions

.e#0666

Violations

For test purpose i test on simple game with EAC.
Should work, but include that is a super low game.
With EAC. Include with a simple BaseAddress read from the process and all running correct, the EAC end at same.
Is detected or need another type of security to work on eac

EAC Game security violation

Hi , i have tried to use this on eac ( Fortnite and apex) , i mapped the driver and started Client::Connect(); before eac get loaded but i get security violation, what i can do?

For those wondering about detection (vectors)

This is detected both on EAC / BE as of right now.

Someone correct me if I'm wrong but I don't think this was ever undetected, at least not on BattlEye. They can simply stack-walk (query an APC) on your thread called in usermode (they have been doing so for a long time)
and see that it is executing in an illegal memory region (i.e not backed by a valid kernel module).

EAC uses (as of recently) NMI callbacks which will find the thread

for BE there is an obvious fix publicly available (disable APCs), for EAC not so much, at least not that I know of.

Note that mapping this using kdmapper without any other precautions is also detected. EAC scans all BigPools / walks PTEs.
Also the MMcopyMemory can be (maybe is) hooked by BE/EAC.

working only once?

everything in the driver only seems to work once..? i removed all the bools for "do once" type behavior, but it still doesnt work properly. for example, i can get the baseaddress of notepad lets say, but if i try to do anything else, the usermode just is blank and doesnt do anything. even after i restart the usermode, i cant do any more requests, its like ive used a one time token haha (i have to remap the driver for it to work again). im mapping with kdmapper (latest build), and ive tried everything but im not sure how to fix this.. i tried adding you on discord but you havent yet accepted my request (its been a few days now). this is a very interesting project btw, good work, just a bit stuck on this slight hiccup.

help

How to communicate like IOCTL?

GetModuleInfo

No examples included im not sure how to get a baseaddress of a .dll module running in the target process. Can you please either show a example or hit me up on discord EpicCode#2846

Thanks

do you have discord?

sorry to bother but i was wondering if it'd be okay for me to contact u on discord regarding this project

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.