Recently, several experiments have just been done csapp, in the Bufbomb experiment Level2 and LEVEL3, need to embed the attack code into the buffer and modify the program return address as the beginning address of the buffer, but encountered the problem of the stack is not executable. Because the Ubuntu default stack is not executable. Two ways to modify the executable properties of the program stack are summarized here.
Method One: (There is a. C source file)
- Gcc-g-Z execstack-fno-stack-protector stack.c-o Stack
- ./stack
Method Two: (only compiled executable programs, such as Bufbomb in the experiment)
- Install execstack locally, command: sudo apt-get install Execstack
- Modify the executable properties of the program stack, command: Execstack-s bufbomb
To close the ASLR command:
- su root
- sysctl -w kernel.randomize_va_space=0(赋值为2,即可打开ASLR)
Modifying the executable properties of the program stack