The Real Deal of Android Device Security: The Third Party Collin Mulliner and Jon Oberheide CanSecWest 2014
Introductions ● Collin Mulliner ● Jon Oberheide Mulliner and Oberheide, CSW 2014
#Cats4Fun Mulliner and Oberheide, CSW 2014
Thanks, Mudge! Mulliner and Oberheide, CSW 2014
Thanks, Mudge! Mulliner and Oberheide, CSW 2014
Android Mulliner and Oberheide, CSW 2014
Android Most popular smartphone platform about 1 billion devices today Mulliner and Oberheide, CSW 2014
This dude is in trouble Mulliner and Oberheide, CSW 2014
Lets patch him up! Mulliner and Oberheide, CSW 2014
WTF are we doing here people ● Anti-malware ○ 99.9%* of Android malware is bullshit toll fraud ● MDM ○ “Manage” your way out of an insecure platform ○ HEY I CAN SEE ALL MY VULNERABLE DEVICES, YAY! ● Other features of mobile “security” products ○ Find my phone (G does it), backup (G does it), …? * I just made this up, kinda Mulliner and Oberheide, CSW 2014
How about... ● Maybe we try to fix the underlying issues? ○ “Enumerating badness” always doomed to fail ○ Naw, that’s crazy talk! ● Underlying issues (in our not-so-humble opinion) ○ Lack of platform integrity ○ Privilege escalation vulns, large attack surface ○ Huge windows of vuln due to slow/non-existing patching practices Mulliner and Oberheide, CSW 2014
Our research ● Investigated Android vulns and solutions ○ Vulns in native and managed code ○ More than privesc! ● Let’s show what can be done ○ Mostly PoC, but deployed to 100k’s of real-world devices vs. ○ If we can do this on the cheap, maybe Big Corp can do it for reals ● “Defensive” talk, booooooooo Mulliner and Oberheide, CSW 2014
A tale of three projects ● Vulns exist ○ X-Ray ● How to get rid of them ○ PatchDroid ● How to brick a lot of people’s phones ;-) ○ ReKey Mulliner and Oberheide, CSW 2014
Ideal mobile ecosystem...HA! ● In a perfect world… ● AOSP : Google ships a secure base platform. ● OEM : Samsung and third-party suppliers don’t introduce vulns in their handsets and customizations. ● Carrier : T-Mobile rolls out rapid OTA updates to keep users up to date and patched. Mulliner and Oberheide, CSW 2014
Real-world mobile ecosystem ● In the real world… ● AOSP : Android improving mitigations, but slowly. ● OEM : Customizations by device OEMs are a primary source of vulnerabilities. ● Carrier : Updates are not made available for months and sometimes even years. Mulliner and Oberheide, CSW 2014
Real-world mobile ecosystem ● In the real world… ● AOSP : Android improving mitigations, but slowly. All software has vulns, mobile or otherwise. ● OEM : Customizations by device OEMs are a primary source of vulnerabilities. Failing to deliver patches is the real issue. ● Carrier : Updates are not made available for months and sometimes even years. Mulliner and Oberheide, CSW 2014
Disclosure & patching process Third-party providers weeks Google OEM Carrier months months days Researcher days days Public Attackers Mulliner and Oberheide, CSW 2014
Challenges in patching ● Why is mobile patching challenging? ● Complicated software supply chain ● Testing, testing, testing ● Risk of bricking devices ● Inverted economic incentives ● Want to patch your device's vulnerabilities? ● Loadset controlled by carrier ● Can't patch the device (unless rooted) Mulliner and Oberheide, CSW 2014
What the carriers say " Patches must be integrated and tested for different platforms to ensure the best possible user experience. Therefore, distribution varies by manufacturer and device. " - AT&T Mulliner and Oberheide, CSW 2014
What the carriers say " Patches must be integrated and tested for different platforms to ensure the best possible user experience. Therefore, distribution varies by manufacturer and device. " - AT&T Mulliner and Oberheide, CSW 2014
Privilege escalation vulnerabilities ● Android security model ● Permissions framework, “sandboxing” (Linux uid/gid) ● Compromise of browser (or other app) != full control of device ● Privilege escalation vulnerabilities ● Unprivileged code execution → Privileged code execution ● Publicly released to allow users to jailbreak their devices ● Public exploits reused by mobile malware to root victim's devices ● Ooooh, fancy mobile privesc, right??? Mulliner and Oberheide, CSW 2014
Quick trivia ● What's wrong with the following code? /* Code intended to run with elevated privileges */ do_stuff_as_privileged(); /* Drop privileges to unprivileged user */ setuid(uid); /* Code intended to run with lower privileges */ do_stuff_as_unprivileged(); ● Assuming a uid/euid=0 process dropping privileges... Mulliner and Oberheide, CSW 2014
Zimperlich vulnerability ● Return value not checked! setuid(2) can fail: EAGAIN The uid does not match the current uid and uid brings process over its RLIMIT_NPROC resource limit. ● Android's zygote does fail if setuid does: err = setuid(uid); if (err < 0) { LOGW("cannot setuid(%d): %s", uid, strerror(errno)); } ● Fork until limit, when setuid fails, app runs as uid 0! Mulliner and Oberheide, CSW 2014
A sampling of privesc vulns ● ASHMEM : Android kernel mods, no mprotect check ● Exploid : no netlink source check, inherited from udev ● Exynos : third-party device driver, kmem read/write ● Gingerbreak : no netlink source check, GOT overwrite ● Levitator : My_First_Kernel_Module.ko, kmem read/write ● Mempodroid : inherited from upstream Linux kernel ● RageAgainstTheCage : no setuid retval check ● Wunderbar : inherited from upstream Linux kernel ● Zimperlich : no setuid retval check ● ZergRush : UAF in libsysutils Mulliner and Oberheide, CSW 2014
X-Ray for Android ● How can we measure this problem? ● X-Ray for Android ● DARPA CFT funded ● Performing _actual_ vuln assessment on mobile ● Detects most common privescs ● Works without any special privileges or permissions http://xray.io Mulliner and Oberheide, CSW 2014
Static probes ● Static probes ● Can identify vulnerabilities using static analysis ● Send up vulnerable component (eg. binary, library) to service ● Disassemble and look for patched/vulnerable code paths libdvm.so X-Ray Analyze! Service result Mulliner and Oberheide, CSW 2014
Static probe example: Zimperlich Mulliner and Oberheide, CSW 2014
Ok, what does it _really_ look like? ● l33t static analysis...aka ghetto objdump/python/grep ● Do we need to be that smart or perfect? Thankfully, no. Mulliner and Oberheide, CSW 2014
Dynamic probes (aka psuedo-exploits) ● Dynamic probes ● Not all vulnerabilities are in software components we can access ● Example: kernel vulns, kernel image not accessible by X-Ray ● Probe locally for vulnerability presence! ● Basically sad, neutered, wacky half exploits :-( halp! X-Ray liblevitator_v1.so Service Execute! result Mulliner and Oberheide, CSW 2014
Dynamic probe example: Levitator Mulliner and Oberheide, CSW 2014
Dynamic probe example: Exploid Mulliner and Oberheide, CSW 2014
Probe manifests in JSON Static probe: { "id": "webkit", "type": "static", Dynamic probe: "name": "WebKit (inactive)", "query_url": "/xray/webkit/query", { "probe_url": "/xray/webkit/probe", "id": "exynos", "static_payload": "/system/lib/libwebcore.so" "type": "dynamic", } "name": "Exynos", "result_url": "/xray/exynos/result", "dynamic_slot": "06", "dynamic_payload_armeabi": "/xray/static/exynos/armeabi/libexynos_v1.so", "dynamic_signature_armeabi": "vrX...", "dynamic_payload_armeabi-v7a": "/xray/static/exynos/armeabi-v7a/libexynos_v1.so", "dynamic_signature_armeabi-v7a": "mbe...", "dynamic_payload_mips": "/xray/static/exynos/mips/libexynos_v1.so", "dynamic_signature_mips": "F33...", "dynamic_payload_x86": "/xray/static/exynos/x86/libexynos_v1.so", "dynamic_signature_x86": "Lu7..." }, Mulliner and Oberheide, CSW 2014
X-Ray distribution ● Not in Google Play*, but free for download at http://xray.io ● Results collected by us (and Five Eyes) from users who ran the X-Ray app on their Android device: 74,405 devices 4,312 models 190 countries * don’t ask Mulliner and Oberheide, CSW 2014
Aside: Android exploitation challenges ● Android fragmentation is _real_ ○ Not for app dev, but for exploit dev ● X-Ray’s binary dataset ○ 3,124 unique libsysutils.so ○ 5,936 unique libdvm.so ○ 5,303 unique vold ● If only there was a way to collect all those binaries... Mulliner and Oberheide, CSW 2014
Recommend
More recommend