kubo / injector

Library for injecting a shared library into a Linux or Windows process
GNU General Public License v2.0
504 stars 97 forks source link

Could not find libc #15

Closed NinjaRacc closed 2 years ago

NinjaRacc commented 2 years ago

System info:

OS: Ubuntu 21.10 x86_64 Kernel: 5.13.0-28-generic Uptime: 3 hours, 1 min Packages: 2677 (dpkg), 17 (snap) Shell: bash 5.1.8 Resolution: 3840x2160 WM: Mutter WM Theme: Adwaita Theme: Adwaita [GTK3] Icons: Adwaita [GTK3] Terminal: gnome-terminal CPU: AMD Ryzen 5 1600 (12) @ 3.500GHz GPU: NVIDIA GeForce GTX 1060 6GB

Command:

$ ./injector -p [PID] [.DLL name here]

Error:

targeting process with pid [PID] Could not find libc

kubo commented 2 years ago

Thanks. I confirmed it by using Ubuntu 21.10 x86_64 on KVM. I'll fix it later.

$ git clone https://github.com/kubo/injector.git
Cloning into 'injector'...
remote: Enumerating objects: 323, done.
remote: Counting objects: 100% (178/178), done.
remote: Compressing objects: 100% (121/121), done.
remote: Total 323 (delta 86), reused 131 (delta 50), pack-reused 145
Receiving objects: 100% (323/323), 112.51 KiB | 415.00 KiB/s, done.
Resolving deltas: 100% (152/152), done.
$ cd injector/
$ make check
cd tests && make check
make[1]: Entering directory '/home/kubo/injector/tests'
=============== build: x86_64 ===============
make[2]: Entering directory '/home/kubo/injector/tests'
cd ../src/linux && make clean && make
make[3]: Entering directory '/home/kubo/injector/src/linux'
rm -f libinjector.so libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/kubo/injector/src/linux'
make[3]: Entering directory '/home/kubo/injector/src/linux'
cc -m64 -Wall -fPIC -I../../include   -c -o elf.o elf.c
cc -m64 -Wall -fPIC -I../../include   -c -o injector.o injector.c
cc -m64 -Wall -fPIC -I../../include   -c -o ptrace.o ptrace.c
cc -m64 -Wall -fPIC -I../../include   -c -o remote_call.o remote_call.c
cc -m64 -Wall -fPIC -I../../include   -c -o util.o util.c
cc -m64 -shared -o libinjector.so elf.o injector.o ptrace.o remote_call.o util.o
ar rcs libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/kubo/injector/src/linux'
cc -m64  -o test-prog-x86_64 test-prog.c ../src/linux/libinjector.a
cc -m64  -rdynamic -o test-target-x86_64 test-target.c
cc -m64  -shared -fPIC -o test-library-x86_64.so test-library.c
make[2]: Leaving directory '/home/kubo/injector/tests'
=============== injector: x86_64, target: x86_64 ===============
targe process started.
inject error:
  Could not find libc
make[1]: *** [Makefile:92: check] Error 1
make[1]: Leaving directory '/home/kubo/injector/tests'
make: *** [Makefile:6: check] Error 2
SomePineaple commented 2 years ago

I'm having the same issue on arch. System Info: Kernel: 5.16.9-arch1-1 DE: Plasma 5.24.1 compositor: KWin shell: zsh 5.8.1 themes: Breeze Dark, Ant-Dracula packages: 1218 (pacman), 11 (flatpak) uptime: 6 mins gpu drivers: amdgpu cpu: AMD Ryzen 5 3600 (12) @ 3.6GHz gpu: AMD ATI Radeon RX 580

> make check
cd tests && make check
make[1]: Entering directory '/home/somepineaple/dev/cpp/injector/tests'
SUFFIX= make build
make[2]: Entering directory '/home/somepineaple/dev/cpp/injector/tests'
cd ../src/linux && make clean && make
make[3]: Entering directory '/home/somepineaple/dev/cpp/injector/src/linux'
rm -f libinjector.so libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/somepineaple/dev/cpp/injector/src/linux'
make[3]: Entering directory '/home/somepineaple/dev/cpp/injector/src/linux'
cc -Wall -fPIC -I../../include   -c -o elf.o elf.c
cc -Wall -fPIC -I../../include   -c -o injector.o injector.c
cc -Wall -fPIC -I../../include   -c -o ptrace.o ptrace.c
cc -Wall -fPIC -I../../include   -c -o remote_call.o remote_call.c
cc -Wall -fPIC -I../../include   -c -o util.o util.c
cc -shared -o libinjector.so elf.o injector.o ptrace.o remote_call.o util.o
ar rcs libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/somepineaple/dev/cpp/injector/src/linux'
cc  -o test-prog test-prog.c ../src/linux/libinjector.a
cc  -rdynamic -o test-target test-target.c
cc  -shared -fPIC -o test-library.so test-library.c
make[2]: Leaving directory '/home/somepineaple/dev/cpp/injector/tests'
=============== injector: default, target: default ===============
targe process started.
inject error:
  Could not find libc
make[1]: *** [Makefile:91: check] Error 1
make[1]: Leaving directory '/home/somepineaple/dev/cpp/injector/tests'
make: *** [Makefile:6: check] Error 2
LucasRitossa commented 2 years ago

I'm having this issue on artix-openrc OS: Artix Linux x86_64 Kernel: 5.16.10-artix1-1 Uptime: 3 hours, 43 mins Packages: 1527 (pacman) Shell: zsh 5.8.1 Resolution: 1920x1080, 2560x1440 WM: dwm Terminal: st Terminal Font: Symbola Nerd Font CPU: Intel i5-9600K (6) @ 4.600GHz GPU: NVIDIA GeForce GTX 1650


> make check
cd tests && make check
make[1]: Entering directory '/home/luke/.local/share/injector/tests'
SUFFIX= make build
make[2]: Entering directory '/home/luke/.local/share/injector/tests'
cd ../src/linux && make clean && make
make[3]: Entering directory '/home/luke/.local/share/injector/src/linux'
rm -f libinjector.so libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/luke/.local/share/injector/src/linux'
make[3]: Entering directory '/home/luke/.local/share/injector/src/linux'
cc -Wall -fPIC -I../../include   -c -o elf.o elf.c
cc -Wall -fPIC -I../../include   -c -o injector.o injector.c
cc -Wall -fPIC -I../../include   -c -o ptrace.o ptrace.c
cc -Wall -fPIC -I../../include   -c -o remote_call.o remote_call.c
cc -Wall -fPIC -I../../include   -c -o util.o util.c
cc -shared -o libinjector.so elf.o injector.o ptrace.o remote_call.o util.o
ar rcs libinjector.a elf.o injector.o ptrace.o remote_call.o util.o
make[3]: Leaving directory '/home/luke/.local/share/injector/src/linux'
cc  -o test-prog test-prog.c ../src/linux/libinjector.a
cc  -rdynamic -o test-target test-target.c
cc  -shared -fPIC -o test-library.so test-library.c
make[2]: Leaving directory '/home/luke/.local/share/injector/tests'
=============== injector: default, target: default ===============
targe process started.
inject error:
  Could not find libc
make[1]: *** [Makefile:91: check] Error 1
make[1]: Leaving directory '/home/luke/.local/share/injector/tests'
make: *** [Makefile:6: check] Error 2```
kubo commented 2 years ago

@MrBigBoob The issue was fixed by 183b476a967f82b5e8b59f298d7122b67ebc1b58 and 5f77f114c9ce1482dbc73a1903faaa1db7d2eb24. I checked it on Ubuntu 21.10 on KVM.

@SomePineaple @LucasRitossa Could you try it again using the latest commit? If your system's glibc is 2.34 or later, it would be fixed.