wsl ubuntu 에서나 kali linux 에서도 다 해봤는데
c 파일을만들고
gcc -o example1 example1.c -fno-stack-protector -z execstack -mpreferred-stack-boundary=2 -m32
이렇게 치고
gdb ./example1 을 하면 run 이 안됩니다.
다음과 같은 오류가 뜨는데 어떻게 해결해야할까요ㅠ
(gdb) b * 0x0000126b
Breakpoint 1 at 0x126b
(gdb) r
똑같이 치고
Starting program: /mnt/c/Users/infosec/workspace/example1
/bin/bash: /mnt/c/Users/infosec/workspace/example1: cannot execute binary file: Exec format error
/bin/bash: /mnt/c/Users/infosec/workspace/example1: Success
During startup program exited with code 126.
감사합니다ㅠㅠ! 혹시 gcc -o example1 example1.c -fno-stack-protector -z execstack -mpreferred-stack-boundary=2 이렇게 치니
다음과 같은 에러가 뜯는데 어떻게 해결하시는지 아시나요??
일단 3을 넣어서 돌리기는 했습니다 .
cc1: error: ‘-mpreferred-stack-boundary=2’ is not between 3 and 12
gcc -o example1 example1.c -fno-stack-protector -z execstack -mpreferred-stack-boundary=2 여기서 2를 4로 변경해주시면 됩니다. 아마 64bit여서 2가 아니라 4인거라고 알고있어요