All Projects → kubo → Injector

kubo / Injector

Licence: other
Library for injecting a shared library into a Linux or Windows process

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Injector

Poodinis
A dependency injection framework for D with support for autowiring.
Stars: ✭ 57 (-56.49%)
Mutual labels:  injection
Patchy
⚓️ Patch the inner source of python functions at runtime.
Stars: ✭ 84 (-35.88%)
Mutual labels:  injection
Swiftdi
SwiftDI the new way to use your dependency in Swift 5.1
Stars: ✭ 107 (-18.32%)
Mutual labels:  injection
Dyci Main
Dynamic Code Injection Tool for Objective-C
Stars: ✭ 1,103 (+741.98%)
Mutual labels:  injection
Query.apex
A dynamic SOQL and SOSL query builder on Salesforce.com platform
Stars: ✭ 78 (-40.46%)
Mutual labels:  injection
Container Ioc
Inversion of Control container & Dependency Injection for Javascript and Node.js apps powered by Typescript.
Stars: ✭ 89 (-32.06%)
Mutual labels:  injection
Minerinthemiddle
Stars: ✭ 46 (-64.89%)
Mutual labels:  injection
Gamemaniptutorial
A tutorial for manipulating the rendering of a game (generally to increase its quality) if you only have a binary available
Stars: ✭ 119 (-9.16%)
Mutual labels:  injection
Wheelchair
An introduction to the battle between JavaScript cheats and anti cheats.
Stars: ✭ 84 (-35.88%)
Mutual labels:  injection
Cromos
Cromos is a tool for downloading legitimate extensions of the Chrome Web Store and inject codes in the background of the application.
Stars: ✭ 103 (-21.37%)
Mutual labels:  injection
React In Patterns Cn
React in patterns 中文版
Stars: ✭ 1,107 (+745.04%)
Mutual labels:  injection
Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (-41.22%)
Mutual labels:  injection
Dotnettency
Mutlitenancy for dotnet applications
Stars: ✭ 100 (-23.66%)
Mutual labels:  injection
Escapefromtarkov Trainer
Escape from Tarkov Trainer
Stars: ✭ 59 (-54.96%)
Mutual labels:  injection
Cscore
cscore is a minimal-footprint library providing commonly used helpers & patterns for your C# projects. It can be used in both pure C# and Unity projects.
Stars: ✭ 115 (-12.21%)
Mutual labels:  injection
Pcsgolh
PCSGOLH - Pointless Counter-Strike: Global Offensive Lua Hooks. A open-source Lua API for CS:GO hacking written in modern C++
Stars: ✭ 56 (-57.25%)
Mutual labels:  injection
Hookso
linux动态链接库的注入修改查找工具 A tool for injection, modification and search of linux dynamic link library
Stars: ✭ 87 (-33.59%)
Mutual labels:  injection
Puresharp
Puresharp is a Framework that provides the essential APIs (AOP, IOC, etc...) to productively build high quality (.NET 4.5.2+ & .NET Core 2.1+) applications through reliability, scalability and performance without no compromise
Stars: ✭ 120 (-8.4%)
Mutual labels:  injection
Light My Request
Fake HTTP injection library
Stars: ✭ 114 (-12.98%)
Mutual labels:  injection
Vac Hooks
Hook WinAPI functions used by Valve Anti-Cheat. Log calls and intercept arguments & return values. DLL written in C.
Stars: ✭ 103 (-21.37%)
Mutual labels:  injection

Injector

Build Status

Library for injecting a shared library into a Linux or Windows process

Linux

I was inspired by linux-inject and the basic idea came from it. However the way to call __libc_dlopen_mode in libc.so.6 is thoroughly different.

  • linux-inject writes about 80 bytes of code to the target process on x86_64. This writes only four or eight bytes.
  • linux-inject writes code at the firstly found executable region of memory, which may be referred by other threads. This writes it at the entry point of libc.so.6, which will be referred by nobody unless the libc itself is executed as a program.

This was tested only on Ubuntu 16.04 x86_64 and Debian 8 arm64. It may not work on other distributions.

Windows

Windows version is also here. It uses well-known CreateRemoteThread+LoadLibrary technique to load a DLL into another process with some improvements.

  1. It gets Win32 error messages when LoadLibrary fails by copying assembly code into the target process.
  2. It can inject a 32-bit dll into a 32-bit process from x64 processes by checking the export entries in 32-bit kernel32.dll.

Note: It may work on Windows on ARM though I have not tested it because I have no ARM machines. Let me know if it really works.

Compilation

Linux

$ git clone https://github.com/kubo/injector.git
$ cd injector
$ make

The make command creates:

filename -
src/linux/libinjector.a a static library
src/linux/libinjector.so a shared library
cmd/injector a command line program linked with the static library

Windows

Open a Visual Studio command prompt and run the following commands:

$ git clone https://github.com/kubo/injector.git # Or use any other tool
$ cd injector
$ nmake -f Makefile.win32

The nmake command creates:

filename -
src/windows/injector-static.lib a static library (release build)
src/windows/injector.dll a shared library (release build)
src/windows/injector.lib an import library for injector.dll
src/windows/injectord-static.lib a static library (debug build)
src/windows/injectord.dll a shared library (debug build)
src/windows/injectord.lib an import library for injectord.dll
cmd/injector.exe a command line program linked the static library (release build)

Usage

C API

#include <injector.h>

...

    injector_t *injector;
    void *handle;

    /* attach to a process whose process id is 1234. */
    if (injector_attach(&injector, 1234) != 0) {
        printf("ATTACH ERROR: %s\n", injector_error());
        return;
    }
    /* inject a shared library into the process. */
    if (injector_inject(injector, "/path/to/shared/library", NULL) != 0) {
        printf("INJECT ERROR: %s\n", injector_error());
    }
    /* inject another shared library. */
    if (injector_inject(injector, "/path/to/another/shared/library", &handle) != 0) {
        printf("INJECT ERROR: %s\n", injector_error());
    }

...

    /* uninject the second shared library. */
    if (injector_uninject(injector, handle) != 0) {
        printf("UNINJECT ERROR: %s\n", injector_error());
    }

    /* cleanup */
    injector_detach(injector);

Command line program

See Usage section and Sample section in linux-inject and substitute inject with injector in the page.

Tested Architectures

Linux

injector process \ target process x86_64 i386 x32(*1)
x86_64 success(*4) success(*4) success(*4)
i386 failure(*2) success(*4) failure(*3)
x32(*1) failure(*2) success(*4) failure(*3)
injector process \ target process arm64 armhf armel
arm64 success(*4) success success
armhf failure(*2) success success
armel failure(*2) success success

*1: x32 ABI
*2: failure with 64-bit target process isn't supported by 32-bit process.
*3: failure with x32-ABI target process is supported only by x86_64.
*4: tested on travis-ci

Windows

injector process \ target process x64 x86 arm64
x64 success(*2) success(*2) -
x86 failure(*1) success(*2) -
arm64 - - not tested(*3)

*1: failure with x64 target process isn't supported by x86 process.
*2: tested on travis-ci
*3: It may work though I have not tested it. Let me know if it really works.

Caveats

Caveat about ptrace() is same with linux-inject.

__libc_dlopen_mode internally calls malloc() and free(). If the target process is allocating or freeing memory and malloc() or free() holds a lock, this may stop the process forever. Same caveat is in linux-inject also.

License

Files under include and src are licensed under LGPL 2.1 or later.
Files under cmd are licensed under GPL 2 or later.
Files under util are licensed under 2-clause BSD.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].