Libhijack 0.6 Released!

Author: 

Shawn Webb

I'm very proud to announce libhijack 0.6 today. Version 0.6 contains no new features. However, I have ported libhijack to FreeBSD/amd64. I do not plan to support 32bit on FreeBSD. However, if someone wants to add 32bit support, I will gladly accept patches. When I first started this project a few months ago, I thought that FreeBSD's runtime linker (aka RTLD, the executable that loads your program into memory) would have been implemented similar to GNU's runtime linker. It turns out I was very wrong. FreeBSD's RTLD is much different--and, in my opinion, better--than GNU's.

Every single API call works fully on FreeBSD. No API function signatures have been changed. Meaning, the same exact calls you would make on Linux would be the same exact calls on FreeBSD. This is no easy feat on a project like libhijack. Please note that since we're still not a 1.0 release, the API is still subject to change.

Though the APIs haven't changed, you will need one new compile-time define: -DFreeBSD for FreeBSD or -DLinux for Linux (retrieved by uname -s). If you're compiling libhijack on FreeBSD, you will need a populated /usr/src and you will need to tack on at compile-time: -I/usr/src/libexec/rtld-elf -I/usr/src/libexec/rtld-elf/`uname -m`. Please refer to src/Makefile if you need extra help. On FreeBSD, you will need to use gmake instead of BSD's make.

I need to do a bit of code cleanup in libhijack. Porting to FreeBSD caused me to write a lot of dirty hacks in libhijack's code. I will be releasing minor releases soon with cleaned up code. The code, as usual, can be found on GitHub.

Tags: 

2 Comments

FreeBSD 9.0 does not compile

/usr/local/bin/clang
-I/usr/src/libexec/rtld-elf
-I/usr/src/libexec/rtld-elf/
-I/opt/libhijackdir/libhijack/include
-I/usr/src/libexec/rtld-elf/amd64/'
elf.c ...
/opt/libhijackdir/libhijack/src
In file included from elf.c:27:
/opt/libhijackdir/libhijack/include/hijack.h:107:3:
error: type name requires a specifier or qualifier
ElfW(Ehdr) *ehdr;
^
/opt/libhijackdir/libhijack/include/hijack.h:107:8:
error: a parameter list without types is only allowed in a function definition
ElfW(Ehdr) *ehdr;
...
1 warning and 20 errors generated.
*****troubleshoot
1.other basic anal with PE ELF not successful
2.)same reesults with clang and gcc47
3.)routine fuzzing with std=c99, -Wall, etc.
4.)google search for trouble keyword or "#define"

#define ElfW(type) Elf64_##type
#define ElfW(type) Elf64_##type
ElfW(Ehdr) *ehdr;
ElfW(Phdr) *phdr;
*google search similarity
musl - Re: PATCH: dl_iterate_phdr() - Openwall
www.openwall.com/lists/musl/2012/10/12/5#
Oct 12, 2012 - Solaris and FreeBSD, at least, have these appended to struct
libhijack/include/hijack.h

FreeBSD 9 does not compile

problem keyword??
using syntax as correlate not semantics or deep understanding of ELF code - NOT
#define ElfW(type) Elf64_##type
#define ElfW(type) Elf64_##type
ElfW(Ehdr) *ehdr;
ElfW(Phdr) *phdr;
*google search similarity
musl - Re: PATCH: dl_iterate_phdr() - Openwall
www.openwall.com/lists/musl/2012/10/12/5#
Oct 12, 2012 - Solaris and FreeBSD, at least, have these appended to struct
libhijack/include/hijack.h