System Security: Checking ASLR

Verify whether ASLR is enabled on a Linux host.

cat /proc/sys/kernel/randomize_va_space
# 0 = disabled, 1 = conservative, 2 = full

Simple C snippet to print an address and observe randomness:

#include <stdio.h>
int main(){
  int x = 42;
  printf("&x = %p\n", (void*)&x);
  return 0;
}