Cross-compiling native executables
Before we can start smashing stacks and hijacking instruction pointers on Android devices, we need a way to prepare some sample vulnerable applications. To do this, we need to be able to compile native executables and to do that we need to use some of the awesome applications packaged into the Android native development kit.
How to do it...
To cross-compile your own native Android components, you need to do the following:
Prepare a directory to develop your code. All this requires is that you make a directory named whatever you'd like to name your "module"; for example, you could call the directory
buffer-overflow
, as I do in the example here. Once you've created that directory, you then need to make a subdirectory calledjni/
. It's imperative that you name it this because the compilation scripts in the NDK will specifically look for this directory.Once you have your directories, you can create an
Android.mk
file. Create this file inside yourjni
directory...