All Projects → Rhydon1337 → linux-kernel-so-injector

Rhydon1337 / linux-kernel-so-injector

Licence: other
Kernel mode to user mode so injection

Programming Languages

c
50402 projects - #5 most used programming language
assembly
5116 projects
C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to linux-kernel-so-injector

natick
natickOS - A minimal, lightweight, research Linux Distribution
Stars: ✭ 33 (-26.67%)
Mutual labels:  linux-kernel
wingkalabs
Wingkalabs (Linux) Wingkalabs es una máquina Virtual Linux intencionalmente vulnerable. Esta máquina virtual se puede utilizar para realizar entrenamientos de seguridad, probar herramientas de seguridad y practicar técnicas comunes de pruebas de penetración.
Stars: ✭ 16 (-64.44%)
Mutual labels:  linux-kernel
android kernel xiaomi whyred
🐧 Linux kernel sources for Redmi Note 5 Pro/AI (whyred) • https://telegra.ph/Rad-Kernel-Sources-whyred-09-04
Stars: ✭ 31 (-31.11%)
Mutual labels:  linux-kernel
ebpfkit
ebpfkit is a rootkit powered by eBPF
Stars: ✭ 472 (+948.89%)
Mutual labels:  linux-kernel
rtw88-usb
rtw88 family usb driver for linux rtl8723du rtl8822bu rtl8821cu rtl8822cu
Stars: ✭ 40 (-11.11%)
Mutual labels:  linux-kernel
lkm-sandbox
Collection of Linux Kernel Modules and PoC to discover, learn and practice Linux Kernel Development
Stars: ✭ 36 (-20%)
Mutual labels:  linux-kernel
dell-xps-15-kernel-config
A minimalist Linux .config for Dell XPS 9560 (2017 edition).
Stars: ✭ 14 (-68.89%)
Mutual labels:  linux-kernel
iomemory-vsl4
Updated Fusion-io iomemory VSL4 Linux (version 4.3.7) driver for recent kernels.
Stars: ✭ 42 (-6.67%)
Mutual labels:  linux-kernel
Linux-Kernel-Driver-Programming
Implementation of PCI drivers, kprobe, sysfs, devfs, sensor driver, miscdevices, synchronization
Stars: ✭ 43 (-4.44%)
Mutual labels:  linux-kernel
linux-4.8.0-netfilter icmp
Anatomy of a linux kernel development
Stars: ✭ 26 (-42.22%)
Mutual labels:  linux-kernel
LinuxKernelLearn
Learn Linux Kernel Step by Step, including the Modules, FS, Device Driver etc. --- Linux内核学习,包括Linux各模块,文件系统,设备驱动文件等。
Stars: ✭ 37 (-17.78%)
Mutual labels:  linux-kernel
awesome-gnu-linux-gaming
A curated list of awesome GNU/Linux tips & tricks, games, tools, and resources - Mirrored from: https://gitlab.com/linuxcafefederation/awesome-gnu-linux-gaming.git
Stars: ✭ 135 (+200%)
Mutual labels:  linux-kernel
linux-insides Turkish
Turkish version of linux-insides book @0xAX
Stars: ✭ 65 (+44.44%)
Mutual labels:  linux-kernel
mbp-fedora-kernel
No description or website provided.
Stars: ✭ 57 (+26.67%)
Mutual labels:  linux-kernel
protecc
Linux kernel module to fight against police terror
Stars: ✭ 25 (-44.44%)
Mutual labels:  linux-kernel
kernel pendulum sdm845
Pendulum Kernel (old Rebirth) based on LE.UM.3.2.2.r1.1 CAF with google-common merged in for Xiaomi Poco F1 and Mi 8 with LTO, CFI and SCS enabled.
Stars: ✭ 9 (-80%)
Mutual labels:  linux-kernel
linux-insides-ja
Japanese version of linux-insides book
Stars: ✭ 99 (+120%)
Mutual labels:  linux-kernel
rpi3-xenomai
Xenomai 3 for Raspberry Pi 3
Stars: ✭ 23 (-48.89%)
Mutual labels:  linux-kernel
kbdysch
A collection of user-space Linux kernel specific guided fuzzers based on LKL
Stars: ✭ 62 (+37.78%)
Mutual labels:  linux-kernel
portablebpf
You came here so you could have a base code to serve you as an example on how to develop a BPF application, compatible to BCC and/or LIBBPF, specially LIBBPF, having the userland part made in C or PYTHON.
Stars: ✭ 32 (-28.89%)
Mutual labels:  linux-kernel

linux-kernel-so-injector

TL;DR

Linux kernel mode to user mode so injection

Tested on linux kernel version: 4.19.91. Current version depends on libc, but it's easy to change it.

Inject shared library to target process from the kernel

How it works

The injection process is divided into several stages:

  1. Send SIGSTOP to target process
  2. Find free space for our shellcode (any R^X pages) using /proc/PID/maps
  3. Find libc address using /proc/PID/maps
  4. Parse libc elf at runtime to find __libc_dlopen_mode
  5. Get the target process rip register
  6. Build our shellcode (get_shellcode function) with the correct address of:
    • So file path
    • Previous rip register address (in order to reconsturct the running of the process after loading the so from our shellcode)
    • __libc_dlopen_mode address (using this function in libc, we will load our so)
  7. Write to target process memory the so file path
  8. Write the shellcode to target process memory
  9. Set target process rip register to the shellcode address
  10. Send SIGCONT to target process

The whole process described above happens at the kernel module. The only things that the kernel module needs are: target pid, so file path.

Limitations

  • Currently there is no support for syscalls from the type that need EINTR or restart_syscall when stopped by signal.
  • Currently implemented only for x86_64.
  • This code isn't robust or fully tested. Therefore, you should expect bugs to occur under certain conditions when process getting non-stop signals or other edge cases.
  • The shellcode and so path won't cleaned because I didn't have enough time to implement it from different kernel thread, but there is a commit which all the cleanup code available. However, the kernel thread isn't and without the creation of new kernel thread it will stick the injection.
  • The reconstruction isn't fully (r15 isn't restored).

All of the limitations which mentioned above could be solved.

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].