riboseinc / retrace

retrace is a versatile security vulnerability / bug discovery tool through monitoring and modifying the behavior of compiled binaries on Linux, OpenBSD/FreeBSD/NetBSD (shared object) and macOS (dynamic library).
Other
60 stars 19 forks source link

Added wrapper tool #337

Closed jjr840430 closed 6 years ago

jjr840430 commented 6 years ago

Added simple utility to convert a shell script retrace to executable binary.(issue #331 )

jjr840430 commented 6 years ago

@drystone Here is the simple wrapper utility for retrace. Do you think this implementation may be used for making an executable binary for retrace?

jjr840430 commented 6 years ago

@drystone It's just simple utility to show the ability to build retrace as executable binary. So I didn't care the details of full implementation. If it's enough to build execution binary of retrace, then I will remove it from tools and build new binary in src directory.

Do you think that it's the right way to implement executable binary of retrace?

erikbor commented 6 years ago

@jjr840430 great, can you implement the following please:

  1. Check if getuid() != 0 && stat() the target executable for setuid bit because if it is setuid then we can't LD_PRELOAD/DYLD
  2. Check if the target executable is ELF or MACH
  3. Replace prog_name with extern char *__progname; so usage() won't need an argument
ronaldtse commented 6 years ago

@jjr840430 if you have time please feel free to complete this. Thanks!

jjr840430 commented 6 years ago

@ronaldtse seems ready to be merged.

ronaldtse commented 6 years ago

@erikbor ready to merge this?

erikbor commented 6 years ago

@jjr840430 can you please fix the following in retrace.c:

"\t--lib <library path>     The path of libretrace.so library\n"

The .so message is now hardcoded but you did implement a #ifndef __APPLE__, so maybe it would be nice to reflect that back in the message. Thanks.

erikbor commented 6 years ago

@jjr840430 I'm fine with merging! Looks good. Thanks a lot.

jjr840430 commented 6 years ago

@erikbor Thanks! :)

jjr840430 commented 6 years ago

@erikbor Fixed

ronaldtse commented 6 years ago

Thanks @jjr840430 @erikbor !