netelf
netelf copied to clipboard
Execute local system program using LD_PRELOAD injected from memfd
Is it possible to send a shared object to netelf, then have it execute a local program with arguments and an LD_PRELOAD environment variable pointing to an fd created with memfd?
TL;DR: yes, it is. Got this working with a Python/ctypes implementation, just need to port it over at some point. You do the following:
- Create memfd, put hook.so data into it
- Get current process ID and FD number of memfd
-
system("LD_PRELOAD=/proc/current_pid/fd/memfd_num some_program")
(or similar) - Profit.