$ gcc a.c -i a -m32 # compile for 32 bits $ gcc a.c -i a -m64 # compile for 64 bits $ gcc a.c -fno-stack-protector # disables stack protection $ objdump -d bin # get the ASM of a binary $ gdb overflow core # examine core dump > info registers # examine EIP, etc
$ apt-get install mingw32; i586-mingw32msvc-gcc slmail-win-fixed.c -lws2_32 -o s.exe
$ gcc -static
char shellcode[] = "\x55" "\x48\x89\xe5" "\xbf\xe4\x65\x49\x00" "\xe8\xd2\x0e\x00\x00i" "\x5d" "\xc3"; int main() { int *ret; ret = (int *) &ret + 2; (*ret) = (int)shellcode; }
0000000000401110 <main>: 401110: 55 push %rbp 401111: 48 89 e5 mov %rsp,%rbp 401114: bf e4 65 49 00 mov $0x4965e4,%edi 401119: e8 d2 0e 00 00 callq 401ff0 <__libc_system> 40111e: 5d pop %rbp 40111f: c3 retq
$ binwalk -e file.bin # extract compress bin images
$ unyaffs file # extract .unyaffs2 filesystem mount points
$ dd if=image.zip of=firmware.zip bs=64 skip=1 # extract firmware images
$ fcrackzip file # cracks zip file