Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute local system program using LD_PRELOAD injected from memfd #7

Open
HarryR opened this issue Dec 20, 2017 · 1 comment
Open

Comments

@HarryR
Copy link
Collaborator

HarryR commented Dec 20, 2017

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?

@0x27
Copy link
Collaborator

0x27 commented Mar 19, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants