User Tools

Site Tools


project:android:start

This is an old revision of the document!


Android

Android
founder:
depends on:
interested: ruza
biiter
Yan
software license:
hardware license:

~~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

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

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:

  • iptables - implemented probably from version 1 till current, but without GUI. I use AFWall+ but maybe something better is out there.
  • SELinux - permissive from 4.3, partial enforcement in 4.4, enforcing from 5.0
  • ALSR - introduced in 4.0, PIE support from 4.1, non-PIE support dropped 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.

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.

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.

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.

  • 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)

Studies / reports

Android application creating & building

Reverse engineering

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.

Official project website

TODO: link database outdated - update, improve
Speeding up the android emulator
Cool appz
Cool soft

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

http://www.anddev.org/novice-tutorials-f8/using-the-am-tool-start-activities-intens-from-a-shell-t368.html

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

Vyzaduje Platform 2.3.3, API Level 10, na Android telefonu

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-)

http://www.youtube.com/user/MrTasselhof

Unbrick Android tablet

http://www.slatedroid.com/topic/19289-guide-revive-your-dead-tablet/page__view__findpost__p__221288

  1. Download HerotabC8_V2.2_2011_03_01.zip or Haipad_M7_0831_android2.3 Rooted.zip. (tested by ruza)
  2. 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.
  3. Put the internal 4GB microSD back into the tablet.
  4. 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
  5. 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.
  6. 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)
  7. Insert the external microSD into your tablet. Now, both microSDs are inside the tablet.
  8. 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.
what we've learned: Power On switch functionality is dependent on internal SD content. (even if device seems to be bricked)

zdroj

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

project/android/start.1480225406.txt.gz · Last modified: 2016/11/27 05:43 by ruza