GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dumitory-dev/DLL-Injector: This simple injector is for injecting DLL into processes.

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
Injector
Injector
 
 
.clang-format
.clang-format
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
Injector.sln
Injector.sln
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Simple DLL Injector

Appointment

This simple injector is for injecting DLL into processes.

Functionality

  1. Checking administrator rights. (If the process has administrator rights, then the rights are set. It is also possible to use an injector without administrator rights (then DLL injection will be possible only in the processes of the current session)).
  2. X64 injector can inject DLL into X64 and X86 processes.
  3. X86 injector can inject DLL into X86 processes.

Implementation details

The injector uses the offset of the virtual address to find the Wow64 address of the LoadLibrary function.

  • Approximate order of actions:
    • 64 bit Injector retrieves address of kernel32.dll loaded by 32 bit target using EnumProcessModulesEx().
    • Get filename of that kernel32.dll, parse the PE header and get the RVA of LoadLibraryA.
    • At this point, we know where kernel32.dll is loaded in the 32 bit target and the address of the function from this DLL.
    • 64 bit Injector starts remote thread in 32 bit target with ImageBase + Function RVA.

Supported OS: Win7 - Win10 x86 x64

Using

#include <iostream>
#include <memory>

#include <Windows.h>

using inject_func = BOOL(__cdecl*)(char const* dllPath, DWORD pid);
using error_func = DWORD(__cdecl*)();

int main() {
	
	try
	{
		std::unique_ptr<HINSTANCE__, decltype(&::FreeLibrary)> const p_library
		{
			::LoadLibrary(TEXT("Injector.dll")),
			::FreeLibrary
		};

		if (!p_library)
		{
			return EXIT_FAILURE;
		}

		auto const inject = reinterpret_cast<inject_func>(::GetProcAddress(p_library.get(), "inject"));
		auto const get_error = reinterpret_cast<error_func>(::GetProcAddress(p_library.get(), "getError"));

		if(!inject || !get_error)
		{
			return EXIT_FAILURE;
		}

		if (!inject("path_to_dll", 0))
		{
			std::cerr << get_error() << std::endl;
			return EXIT_FAILURE;
		}
	}
	catch (std::exception const& error)
	{
		std::cerr << error.what() << std::endl;
	}
	
}

License

Injector is licensed under the MIT License. Dependencies are under their respective licenses.

About

This simple injector is for injecting DLL into processes.

Topics

cdll-injectioninjection

Resources

Readme
MIT license
Activity

Stars

5 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.