DISABLING ASLR (LINUX)

temporarily disable ASLR during debugging

root@oco:~$ setarch `uname -m` -R ./27_stack_overflow.out

 * this cmd will run the program in the absence of ASLR

 * can provide the /bin/bash if not providing the program name
    - setarch `uname -m` -R /bin/bash

temporarily disable ASLR during debugging sessions

root@oco:~$ cat /proc/sys/kernel/randomize_va_space
 2
 
 * this means the ASLR is active
 
root@oco:~$ sudo bash -c "echo 0 > /proc/sys/kernel/randomize_va_space"

 * some OS doesn't treat the redirection with super user privileges
    - sudo echo 0 > /proc/sys/kernel/randomize_va_space
    - when this issue is encountered, simply run bash as a super user then proceed w/ the cmd
    
 * the "bash -c" cmd will execute the string inside as a command in a new Bash shell.

root@oco:~$ cat /proc/sys/kernel/randomize_va_space
 0

Last updated