payatu / diva-android

DIVA Android - Damn Insecure and vulnerable App for Android
GNU General Public License v3.0
959 stars 284 forks source link

ndk-build: command not found #6

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello,

I am having this ndk issue when running the command "make" ndk-buildmake: ndk-build: command not foundmakefile:35: recipe for target 'all' failedmake: *** [all] error 127

sudhackar commented 7 years ago

You need NDK (Native Develop Toolkit) in your $PATH so that ndk-build is available. Look up how to setup ndk for your machine and then build the jni challenge.

ghost commented 7 years ago

I've done setting up the PATH and now i have this screenshot from 2017-08-15 17-51-01

sudhackar commented 7 years ago

Challenge 13 has been made such to get code execution with the strcpy buffer overflow. To make it easy we did

LOCAL_DISABLE_NO_EXECUTE := true

in app/src/main/jni/Android.mk. I think in default setting clang is the compiler for ndk and its broken probably for this flag. So if you're not hell bent on getting RCE from shellcode, you can turn this flag to false and it'll compile.

sudhackar commented 7 years ago

Other option is to switch to GCC altogether. From /toolchains in your ndk path find out your GCC version and add the following in app/src/main/jni/Application.mk

NDK_TOOLCHAIN_VERSION=<gcc-version>

This will disable NX in jni libs.

z3dc0ps commented 2 years ago

watch this video to clear all doubts: https://www.youtube.com/watch?v=PXvEh_QhGt8