Hacker News new | past | comments | ask | show | jobs | submit login

a much simpler way to execute an executable on linux without writing it to disk is to use fexecve, though i'm not sure if that existed in 02014



fexecve is just a wrapper of execve using "/proc/self/fd/3" as binary location. (with fd=3 pointing to a mmapped binary) In 2014 you could still use a tmpfs location exec from it and unlink binary, but it generate a lot of artifacts. With linux kernel > 3.16 you can use memfd_* syscalls to achieve same thing in cleaner way. You can look at this rootkit https://github.com/io-tl/degu-lib that uses theses tricks for stealth executions of binaries


apparently since glibc 2.27 fexecve() uses execveat() instead of /proc if possible, but otherwise i agree


It is actually from 2004. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: