Ire any solutions available to inject in process own C/C++ dll and start from entrypoint, i need hook process socket send functions and paste my own code there. Is it available on linux?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The typical way to do it is to set the
LD_PRELOADenvironment variable before launching the program. See for example tsocks. Note though that some programs will disable this due to security reasons (it can snoop a passwords etc), e.g. gnupg preventsLD_PRELOADfrom working.If you want to inject into a running program it’s much more difficult. It can be done with
ptrace(e.g. attach with gdb and call dlopen). But it’s unreliable because you don’t know what state the program is when you attach.