Tuesday, 20 September 2016

HOW TO DISABLE ASLR USING COMMAND LINE

     ASLR - Address space layout randomization
  
ASLR is used as  memory protection method to protect the program from being exploited using the buffer overflow attacks. It functions by randomizing the locations of executional objects in the memory. 

 You can get the value of the ASLR randomizer by using 
       ->     $ cat /proc/sys/kernel/randomize_va_space

The value will most probably be 2. Which means the Last two digits of a memory will be randomized. 
 eg :- suppose a certain object is in 0xdeadbeef . The next time the last two digits "ef"  will be different.

Hence to make the address randomization null you need to put zero in place of two.
       ->     $ echo 0 | sudo tee /proc /sys/kernel/randomize_va_space
Here sudo tee is used because sudo as certain restrictions while piping standard output to a certain file .


         HOW TO DISABLE CANARY AND RELRO WHILE COMPILING

There are certain flags which will help in disabling are
 -fno-stack-protector , -z,norelro

These can be used while compiling a program like 
  gcc -fno-stack-protector file.c -o a.out

No comments:

Post a Comment