• Stars
    star
    256
  • Rank 159,219 (Top 4 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

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

Repository Details

Utility for injecting executable code into a running process on x86/x64 Linux

linux-injector

Utility for injecting executable code into a running process on x86/x64 Linux. It uses ptrace() to attach to a process, then mmap()'s memory regions for the injected code, a new stack, and space for trampoline shellcode. Finally, the trampoline in the target process is used to create a new thread and execute the chosen shellcode, so the main thread is allowed to continue. This project borrows from a number of other projects and research, see References below.

Requirements

  • fasm, the flat assembler

Building

With fasm installed in your PATH, simply run:

make

Included programs and files

  • print: Test program for executing shellcode using a variety of techniques: fork(), clone(), clone syscall with inline assembly.

  • dummy: A trivial program for injecting into. Prints a message every second, then sleeps.

  • injector: The main program for injecting executable code into a running process. Simply provide it with the PID of the process to inject into, and the shellcode to execute:

    ./injector 1234 print64.bin

  • clone64.asm, clone32.asm, mmap64.asm, mmap32.asm: Shellcode stubs used by the injector.

  • print64.asm, print32.asm: Sample shellcode for printing a single line to stdout. Useful for testing the injector.

References

Further work

I plan on expanding this project to be a full ELF shared library injector. While this tool could theoretically be used as-is to inject a statically-compiled, position-independent ELF library, I want to be able to parse libraries with dynamically-loaded dependencies and load those dependencies as part of the injection process. The following resources are a useful starting point:

Copyright (c) 2015, Dan Staples. This code is available under the GNU General Public License, version 3.

More Repositories

1

ImprovedReflectiveDLLInjection

An improvement of the original reflective DLL injection technique by Stephen Fewer of Harmony Security
C
317
star
2

CaseHarvester

AWS-based application for scraping the Maryland Judiciary Case Search
Python
50
star
3

MediaGrid

MediaGrid is a takedown-resistant, distributed wireless infrastructure allowing citizens to communicate and share real-time photo and video documentation at public demonstrations, without the need for internet access.
JavaScript
32
star
4

onetimesecret-docker

Dockerized version of One-Time Secret
Shell
24
star
5

NOISE

NOISE creates "real-looking" text based upon a collection of reference texts, which can then be used in emails, tweets, web searches, IRC chats, or any other medium you can think of that makes it a bit too easy to profile an individual's communication habits.
Python
16
star
6

CaseExplorer

Web application and APIs for exploring MD court case data
Python
6
star
7

twitter-purge

Deletes your tweets and unfaves your favorites older than X days
Python
5
star
8

lunchbox

Physical drop box for penetration testing
Shell
3
star
9

squeeler

MSSQL enumeration and exploitation toolkit
Go
3
star
10

commotion-apps

Commotion luci application portal
Lua
2
star
11

Invoke-ReflectivePEInjection

PowerSploit script updated to work on Windows 10 1803+
PowerShell
2
star
12

case-search-forever

Bypass that goddamn CAPTCHA on the Maryland Judiciary Case Search
JavaScript
2
star
13

namecheap-dyndns

Dynamic DNS script for Namecheap
Python
1
star
14

commotion-splash

LuCI interface for configuring nodogsplash
Lua
1
star
15

CaseExplorerAPIPortal

API developer portal for Maryland court case data
JavaScript
1
star
16

skylight-scraper

Sync photos from a Skylight frame to a local directory
Python
1
star