Documentos de Académico
Documentos de Profesional
Documentos de Cultura
...
push string printf:
...
call printf ...
... ... KERNEL
int 80h
Enlazado:
ld:
ld -s --dynamic-linker /lib/ld-linux.so.2
-lc fichero.o -o fichero
gcc:
gcc fichero.o -o fichero
Pablo Garaizar Sagarminaga
Copyleft, all rights reversed
Demostración
if(close(3)==-1)
printf(“Hello shell...\n”);
else
printf(“Being traced...\n”);
argv[0] getenv(“_”)
shell ./test ./test
strace ./test /usr/bin/strace
ltrace ./test /usr/bin/ltrace
fenris ./test /usr/bin/fenris
gdb /home/user/test (NULL)
jmp antidebug + 2
antidebug:
db 0666h
call reloc
reloc:
pop esi
...
#include <signal.h>
int main(){
signal(handler, SIGTRAP);
__asm__("int3");
printf("Hello\n");
}
if (ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) {
printf("DEBUGGING... Bye\n");
return 1;
}