root access - How to use Dirty COW exploit? - Android Enthusiasts Stack Exchange
Root tool DirtyCow Apk && adb
Dirty cow exploit - Allows root access on any version of linux and even android. All about the exploit, how it works.
Now android phones are being rooted via Linux "Dirty Cow" exploit - what does this mean for Linux?
For linux: nothing. For android: a lot.
It was already patched in linux but not in android. And since android updates are hard to come...
Videos
Factsheet
Exploit code: Phil Oester
Exploit code: Phil Oester
The reason the command isn't working for you is because "su" is a binary that gets installed by rooting your device. Without a proper root, you have no "su" command.
In order to use the Dirty COW exploit, you have to compile the binary for your device's architecture.
Head over to https://github.com/timwr/CVE-2016-5195 and download or git clone the files.
(Optional) If you do not know your device architecture, then on the phone, install the "Droid Hardware Info" app from Play Store, open it, and swipe left to get to the System tab. Next to the label "Instruction Sets" will be your supported architecture.
On your computer, open a terminal and navigate to where the Dirty COW files are (extract if needed). Then simply type
make (insert architecture here). This will create two binaries inside the folder atlibs/(your_architecture)/calleddirtycow&run-as. Alternatively, if you have USB Debugging enabled, then simply attach the device and typemake rootand it will push the binaries into your device at/data/local/tmp, then automate a few ADB commands to exploit and grant you a limited root shell.If you don't see the terminal user icon as
#and instead see a$, then the exploit didn't work at some point. Since the files are still on the device, I would suggest to then try and manually patchrun-asby usingadb shelland typing the following...chmod 777 /data/local/tmp/* dirtycow /data/local/tmp/run-as /system/bin/run-as /system/bin/run-asIf this doesn't prompt you as root user (#), then the exploit won't work for your device in this fashion and you'll need to do some digging into why not. If this happens, try opening an Issue on the Github repo, it's still pretty active so you should have an answer before long.
To supplement therealjayvi's answer, note that compiling and using CVE-2016-5195 from timwr requires both ADB and NDK to be installed as well, prior to make [architecture] and make root, and that this must be done from a Linux environment.
All were either assumed that the prerequisites were obtained before doing this, prerequisites may have been added after comment, or little to nothing was known about exploit CVE-2016-5195 from the person who made the comment.
Anyways, this can all be done through: first, being in Linux (Ubuntu, Debian, Mint, ext.) and assuming that adb is in your list of repositories for apt as it usually is by default but not all the time. If sudo isn't present, use su.
sudo apt-get install android-tools-adb
Get latest Linux download from here, then extract and run:
export PATH=$PATH:/root/directory/of/ndk/
You may need to re-run export if you close the current terminal, as I cannot find a solution that stays.
Once all that is done, then you can follow @therealjayvi's way of going about this.