October 27, 2017

How to enable and disable ASLR on Linux, GDB



❑ (Temporary) $ ulimit -s unlimited : It is fixed because it uses the entire memory.
* Only x86 software is possible.

❑ (Temporary) $ setarch $(uname -m) -R /bin/bash : more info(Link)

❑ (Temporary) $ echo 1 > /proc/sys/kernel/randomize_va_space

❑ (Permanent) $ echo "kernel.randomize_va_space=2" >> /etc/sysctl.conf
* administrator permission is required.
* randomize_va_space=0 : Disable ASLR.
* randomize_va_space=1 : Enable random stack & random library.
* randomize_va_space=2 : Enable random stack & random library & random heap.

❑ GDB : set disable-randomization on/off
* Enable random stack & random library.


※ ASLR : Address space layout randomization. This prevents memory corruption vulnerabilities(Link).