NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Security and PAX



Hi,
   I have just tested your program and only the address of the stack seems
to be different. Do I have missed someting?

----------------------------------Log of my tests------------------------------
Script started on Sun Jun  7 18:06:49 2015
virtualisation# gcat testASLR.c
#include <stdio.h>                                                                                                               
#include <stdlib.h>                                                                                                              


int array[] = { 0, 1, 2 };

int
main(int argc, char *argv[])
{
        printf("main %p\n", main);
        printf("libc %p\n", printf);
        printf("stack %p\n", argv);
        printf("data %p\n", array);
        return 0;
}                                                                                                                                


virtualisation# gcc -fpie -o testASLR -static testASLR.c
virtualisation# paxctl +A /root/testASLR
virtualisation# pwd
/root
virtualisation# ./testASLR
main 0x40035c
libc 0x407330
stack 0x7f7ffff581f0
data 0x62947c
virtualisation# ./testASLR
main 0x40035c
libc 0x407330
stack 0x7f7fff9cb100
data 0x62947c
virtualisation# ./testASLR
main 0x40035c
libc 0x407330
stack 0x7f7fffa98998
data 0x62947c
virtualisation# exit

Script done on Sun Jun  7 18:09:22 2015
----------------------------------Log of my tests------------------------------

On Sun, Jun 07, 2015 at 11:45:38AM -0400, Christos Zoulas wrote:
> 
> | How is it possible to check if a program is running with ASLR? I suppose
> | that, by looking at the address space of the program,
> | it is possible to see  that the base address should change at each execution.
> | 
> | Is that possible and how to do it?
> 
> I posted a program that does prints addresses and it should print something
> different on each run. Here it is again:
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int array[] = { 0, 1, 2 };
> 
> int
> main(int argc, char *argv[])
> {
>         printf("main %p\n", main);
>         printf("libc %p\n", printf);
>         printf("stack %p\n", argv);
>         printf("data %p\n", array);
>         return 0;
> }
> 
> christos


Home | Main Index | Thread Index | Old Index