netelf icon indicating copy to clipboard operation
netelf copied to clipboard

Execute local system program using LD_PRELOAD injected from memfd

Open HarryR opened this issue 6 years ago • 1 comments

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?

HarryR avatar Dec 20 '17 12:12 HarryR

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:

  1. Create memfd, put hook.so data into it
  2. Get current process ID and FD number of memfd
  3. system("LD_PRELOAD=/proc/current_pid/fd/memfd_num some_program") (or similar)
  4. Profit.

0x27 avatar Mar 19 '18 21:03 0x27