• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple ptrace-less shared library injector for x64 Linux

linux_injector

A simple ptrace-less shared library injector for x64 Linux.

Usage

linux_injector <mode> <pid> <file>

mode

  1. normal dlopen
  2. memfd + dlopen (for injecting into containers)
  3. raw shellcode

pid

Target process id. Must have ptrace rights to it (required for accessing /proc/$pid/mem). Not ptraced, so another process can freely ptrace it.

file

For mode 1: Module to inject, will be dlopened in the remote process. Should probably be a full path, because the remote LD_LIBRARY_PATH is used otherwise for resolution.

For mode 2: Module to inject, will be dlopened in the remote process from a memfd, where the content will be copied.

For mode 3: Raw shellcode to inject. You will be mapped at a 16-aligned address, and start execution on a random hijacked thread. Place hooks or create a thread, then return.

Modification

For control flow hijacking, this program needs a hijacking candidate. The code presented here uses malloc, this can be changed by editing FUN_NAME and recompiling. Make sure the hooked function can run under 100ms, so that it won't be overwritten while it executes. This means calls like sleep or wait are bad candidates for the initial shellcode. The function in question also needs to be more than 0x50 long for the shellcode not to overwrite other functions.

Supported platforms

Glibc and musl are supported for the both the target and the source process. The target process can be running in a container, and can use a different libc. Modes 2 and 3 will not require any paths accessible to the target process.

Mode 2 requires Linux 3.17.

Tested on Oracle Linux 7 (mode 2 not supported), Fedora 37, and Alpine Linux 3.17

License

MIT License

More Repositories

1

OpenHashTab

📝 File hashing and checking shell extension
C++
2,498
star
2

SecureUxTheme

🎨 A secure boot compatible in-memory UxTheme patcher
C++
1,915
star
3

MagicSigner

Signtool for expired certificates
C++
372
star
4

physmem_drivers

A collection of various vulnerable (mostly physical memory exposing) drivers.
PowerShell
265
star
5

nSkinz

Skin changer for CS:GO
C++
226
star
6

hdd_serial_spoofer

Windows driver for spoofing serial number of HDDs
C++
186
star
7

IDAShell

Shell extension for opening executables in IDA
C++
184
star
8

x86

Pretty x86 instruction reference site generator
PowerShell
56
star
9

ida_setup_password_cracker

A bruteforcer for IDA Pro setup passwords
C
26
star
10

WinDiskFlash

Disk image flasher for Windows
C++
25
star
11

VirusTotal-FPContacts

Contacts for VirusTotal scanners
21
star
12

PawnIO

Input-output driver
C++
20
star
13

PEDiffGen

Subtract one PE file from another!
C++
19
star
14

msvcrt.lib

.lib file for linking against the NT CRT
17
star
15

PawnPP

A Pawn p-code interpreter written in C++
C++
13
star
16

simplerw

a dumb rpm/wpm example driver
C++
12
star
17

SaferIO

A slightly safer io access library
C
10
star
18

simplerw_sym

a dumb rpm/wpm example driver 2
C++
9
star
19

siggrep

a grep-like utility for testing for binary patterns in a file
C++
9
star
20

7zip_source

A repo of 7-zip's source code with history
C++
8
star
21

namazso.eu

CSS
8
star
22

riseup-alias-generator

🐦 Generate email address aliases on riseup.net
PowerShell
8
star
23

ShittyUxTheme

A file patching UxTheme patcher using symbols
C++
7
star
24

dll-universal-patcher

A universal binary patching dll.
C++
7
star
25

MultiLatency

A simple program to check latency to multiple hosts.
C#
6
star
26

FNFBRServer

A server for FunkinBattleRoyale
C#
6
star
27

AzuKI

Azure Key Impersonator
C++
6
star
28

ProIntelliColor

Set taillight color on the Pro IntelliMouse, platform independently
C
5
star
29

QuickXorHash

A high performance QuickXorHash implementation
C
5
star
30

PawnIO_csharp_test

PawnIO C# test
C#
5
star
31

signserver

Authenticode signing server
Rust
4
star
32

PawnIOLib

Wrapper library and tooling for PawnIO
C++
4
star
33

tf2idb_itemserver

A php sqlite database generator for TF2's item schema txt
PHP
3
star
34

langcomp

Localization to resource file compiler
PowerShell
2
star
35

platypus_map_converter

A map converter for the 2002 game Platypus.
C++
2
star
36

PawnIO.Modules

Modules for use with PawnIO
Pawn
2
star
37

untchar

The opposite of tchar.h
PowerShell
2
star
38

services

Docker-composes for services on namazso.eu
Perl
1
star
39

atomix_clone

nAtomix, a simple C99 clone of the ATARI game Atomix
C++
1
star
40

blitzunlink

A Blitz blob to COFF converter.
C++
1
star
41

rcon_client

A C RCON client I wrote a long time ago
C
1
star