0

I have a Core i7 720QM processor and am running Slackware 13.37 (32-bit) as a virtual machine. As a class assignment, I have to write a vulnerable program and smash the stack. However, on most computers this does not work as there is some kind of stack execution prevention (NX bit?) this generates a 'segmentation fault' when the CPU detects an attempt to execute data on the stack.

Is there a way to signal the kernel via sysctl or something similar to ignore this?

Lord Loh.
  • 2,437
  • 7
  • 39
  • 64

2 Answers2

2
$ sudo apt-get install execstac

Should install execstack, a program that modifies ELF headers to enable/disable NX protection on the stack in target binaries.

$ execstack -s vuln

should make the stack executable for your example program.

Fabio Pozzi
  • 126
  • 5
1

compile your program like this

gcc -fno-stack-protector -z execstack <sourcefile> -o <outputfile>
Stephen
  • 2,613
  • 1
  • 24
  • 42