This is an old revision of the document!
Table of Contents
Android
~~META: status = active ~~
People involved in this project are interested in better understanding of android platform, learning ways how to improve android security or customize android platform for their specific needs.
Research Wishlist
- Understand application compatibility mechanism in Android Market. How to fake compatibility, what it is based on.
- USB HID keyboard support, how to enable.
- Find really secure app lock application, try to circumvent its security mechanism, find application we can trust or research why it is not possible to trust any of currently aviable app locks.
- Do some radio research/review, post results on wiki.
Equipment
- Various tools needed for disassembly/reassembly and basic diagnostic of android mobile / tablet (heatgun, various screwdrivers, osciloscope ..) in HW lab
- CM build enviroment ready for use (thx. 2 da3m0n22)
Knowledge base
Building Android from source
If you want to apply more deeply implemented features into android you need to implement them to the source code and then sucesfully build that code. If you need a feature which is implemented in another ROM in majority of cases the best solution is cherry-picking.
Many ROMs' source code is aviable on github .
A lot has been written about buidling roms, good starting point is to build AOSP or CM ROM from source (guide is on their webpages).
Unlocking
Before you install custom rom you need to unlock your device first. Fastboot. In case of Samsung you will need Heimdall which was written by “some guys from MIT.”
Editing your build
Here are located source-code editing guides/hints
Building for specific roms & devices links
There is wiki entry related to specific rom & devices building, but tips and tricks could be applied globally.
Android Security
Android have many security features. Some of them are implemented better, some of them not (f.e. ALSR ). Our goal in brmlab is to improve usage of those features. Security features implemented in Android are:
- SELinux - permissive from 4.3, partial enforcement in 4.4, enforcing from 5.0
- application sandbox - sometimes could be escaped due to poorly written apps which store sensitive data in shared memory - check for example “android class hijacking” in exploit list below.
- Privacy Guard/App Ops - “Sandboxing customization.” Introduced in 4.3, not supported in new AOSP, CM supports some features but they dont care about privacy (permissions like “network acess” and similar is missing). MIUI Permission Manager looks very good, but guys from MIUI have some problems with understanding meaning of words “open source.” Maybe XPrivacy will do the trick. further research needed.
- Disc encryption - from 2.3.4
Android devices attack vectors
- Attack android OS through internet - Java exploits etc.
- Attacks through radio (baseband, modem) - even with very well implemented safety features on Android OS you need to “take care” of another processor, which is in every mobile phone.
Security - Radio (baseband) related
RADIO (BASEBAND, MODEM) is another processor inside every mobile phone which is resposible for communication between BTS and your OS. It is closed source and not well documented playground (it is not easy to get nice and easily understandable articles related to this problematic). Source codes are from 80's and 90's with security mindset from that age.
- Samsung (unofficial) RADIO-WIRESHARK bridging: https://github.com/2b-as/xgoldmon
- Samsung “troubles” w radio: https://www.fsf.org/blogs/community/replicant-developers-find-and-close-samsung-galaxy-backdoor
- Radio workaround (see part w HW selection), misc useful tips, interesting links inside: https://blog.torproject.org/blog/mission-impossible-hardening-android-security-and-privacy
Android exploits
If you want to improve android security it's good to know the problem from another point of view, so you could easily adopt policy and changes to the code to prevent attack. It is obvious that nobody can predict how exactly 0day exploit looks like, but if you learn how to minimize impact even after sucesfull exploitation, you're one step further to save device.
- Cvedetails - filter on android http://www.cvedetails.com/product/19997/Google-Android.html
- Cvedetails - listed android vulns. https://www.cvedetails.com/vulnerability-list/vendor_id-1224/product_id-19997/Google-Android.html
- Exploit-db - filter on android vuln. https://www.exploit-db.com/platform/?p=android
- Adding exploit from exploit-db to metasploit http://www.kalitutorials.net/2014/06/add-new-exploits-to-metasploit-from.html
- Nexus security bulletins - list of android security issues with according CVE - monthly - https://source.android.com/security/bulletin/index.html
- Collection of tools - https://github.com/android-rooting-tools
Exploit list
Here are some of exploits known today to android platform, it serves mainly as link database to get some interesting info on special cases, old one is left in database for educational and historical meanings. For full coverage of known android vulnerabilities use cvedetails or exploit-db instead.
- CVE-2015-8505,8506,8507 http://www.cvedetails.com/cve/CVE-2015-8506/ interesting is that in https://source.android.com/security/bulletin/2015-12-01.html where should be reference to this CVE there is nothing about this CVE number, bulletin only covers CVE 6616.
- Libstagefright + ALSR bypass (useful for androids >5.1.1. and some 5.1.1.): stagefright + ALSR bypass report on exploit-db: here and here
- Android class loading hijacking - not exactly a bug, only weaknes which could be used in ODEX handling, usefull for badly writed apps on dalvik machine, androids >5.0 have dalvik, newer one runs or Art so for them its history: symatec official report (if you dont have javascript and similar crap everywhere read here)
- One Class to Rule Them All (useful for unpatched androids to some M preview, patched >4.4) - CVE-2015-3825: woot pdf report from usenix
- Browser Cross-Application Scripting (usfel for androids 2.3.4. and 3.1) - CVE-2011-2357: disclosure report from IBM
- GingerBreak (historical root, useful for androids 2.2-3.0): source from google code link to vuln database
- Exploid udev (historical root, useful for androids 1.x/2.x) : https://www.exploit-db.com/exploits/16099/
- RageAgainstTheCage (historical root, useful for androids 1.x/2.x) : https://github.com/georgiaw/Smartphone-Pentest-Framework/blob/master/exploits/Android/source/rageagainstthecage.c
Studies / reports
- 7/2015 - Certifi-Gate report - how you can patch mRSTs to perform mRATs functionalities.
- 7/2012 - Android encryption Brute-Force - unlocked bootloader is needed, than via fastboot.
- 1/2011 - WebView Attacks - Attacks on Android web interaction component.
Security related links
Android application creating & building
- Android Development Series (thx. 2 da3m0n22)
- Introduction to Android development with Android Studio - Basic intro to Android Studio
Reverse engineering
links
Android rooting
In many cases if you want to modify your device first you need to root it. There are many ready to use toolkits online but usually many of those have uknown source.
One solution to this problem is to compile your own root toolikt from open-source - f.e. Android run root shell (thx. 2 da3m0n22 for link)
GPLv2 Android
From wiki: Replicant is a free and open source operating system based on the Android mobile platform, which aims to replace all proprietary Android components with their free software counterparts. This also makes it a security focused operating system as it closes discovered Android backdoors.
The problem is that it unfortunately cares only about radio implementation into android, but not radio itself.
Misc Links
Speeding up the android emulator
Cool appz
- Lucky patcher app manipulation on click
- ElectroDroid - Electronics work cheatsheet.
- Fing - Network Tools - Device discovery on wifi.
- AFWall+ - Front-end for iptables.
- ProxyDroid - Proxy for android. (better implementation)
- DocumentViewer - Document Viewer is a fork of the last GPL version of EBookDroid
- strongSwan - OpenSource IPsec-based VPN Solution
Cool soft
- Samsung Galaxy S3 tooolkit + Odin (formerly known as fastboot) (win)
Cool links
- http://lyt.no-ip.org/blog/Tag/dropad-a8/ (blog about Dropad A8 flashing, etc)
Misc Notes
Devices
/dev/mtd/
- mtd0 handles miscellaneous tasks
- mtd1 holds a recovery image
- mtd2 contains boot partition
- mtd3 contains system files
- mtd4 holds cache
- mtd5 holds user data
Blbinky
- /system/media/bootanimation.zip /system/bin/bootanimation
Jak se dostat do nastaveni i kdyz to UI neumoznuje
./adb shell am start -a android.intent.action.MAIN -n com.android.email/.Settings
Random MAC
echo 00:50:`expr $RANDOM % 89 + 10`:`expr $RANDOM % 89 + 10`:`expr $RANDOM % 89 + 10`:`expr $RANDOM % 89 + 10`
StrongSwan
CA certificate needs to be imported to verify server side of communication. Certificate can be in tis binary form with .pem filename suffix
Android Open Accessory Development Kit
Android Open Accessory Development Kit is available in brmlab
Hands-On with the Android Open Accessory Development Kit
Dropad A8/Heropad Related
29Btnas2He8
Root
Dropad A8 [NEKOMPLETNI]
- utv210_root.tgz. rozbalit na interni sd kartu.
- vypnout tablet
- vyndat externi sd kartu (ta co je ve slotu zvenku), jinak zustane flashovani viset na obrazku Tuxe
- stisknout Menu (M) a Power (C-)
Unbrick Android tablet
http://www.slatedroid.com/topic/19289-guide-revive-your-dead-tablet/page__view__findpost__p__221288
- Download HerotabC8_V2.2_2011_03_01.zip or Haipad_M7_0831_android2.3 Rooted.zip. (tested by ruza)
- Take out the internal 4GB microSD and wipe it clean: dd if=/dev/zero of=/dev/sdX bs=512KB count=4 No need to do anything further, i.e. create partition or format.
- Put the internal 4GB microSD back into the tablet.
- Extract the contents of the ZIP. With u-boot-sd.bin from the ZIP, use dd to dump it onto an external microSD. I used a 2GB card for this. dd if=/path_to_bin/u-boot-sd.bin of=/dev/sdX
- Copy the entire contents of the ZIP to the largest partition of the external microSD. It was the only automatically mounted partition when I replugged the card into Ubuntu.
- I had to do these steps as recommended in the first post: rm -R utscript_sd && cp utscript utscript_sd (I didn't do it initially and after the recovery flash, my tablet couldn't boot w/o the external microSD)
- Insert the external microSD into your tablet. Now, both microSDs are inside the tablet.
- Press power and “M” button simultaneously. It should boot up and begin recovery. After that is done, you may remove your external microSD and proceed as your wish.
Wi-Fi sudenly stopped working
- logcat show error mesage:
E/WifiHW ( ): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0":\\ No such file or directory will appear.
- recreate /system/etc/wifi/wpa_supplicant.conf:
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi update_config=1
more info about Android WPA supplicant