Finding Third - party Risks Fourteenforty Research Institute, Inc. - - PowerPoint PPT Presentation

finding third party risks
SMART_READER_LITE
LIVE PREVIEW

Finding Third - party Risks Fourteenforty Research Institute, Inc. - - PowerPoint PPT Presentation

Fourteenforty Research Institute, Inc. Kyoto, 2012 FIRST Technical Colloquium Sma martphone tphone Securi ecurity ty and Finding Third - party Risks Fourteenforty Research Institute, Inc. http://www.fourteenforty.jp Tsukasa Oi


slide-1
SLIDE 1

Fourteenforty Research Institute, Inc.

1

Kyoto, 2012 – FIRST Technical Colloquium

Sma martphone tphone Securi ecurity ty and Finding “Third-party” Risks

Fourteenforty Research Institute, Inc.

http://www.fourteenforty.jp

Tsukasa Oi – Research Engineer

slide-2
SLIDE 2

Fourteenforty Research Institute, Inc.

  • Fourteenforty Research Institute, Inc. (FFRI)

– Tokyo, Japan – R&D in the field of computer security

  • Tsukasa Oi : Research Engineer at FFRI

– Currently focusing on mobile security – Recent Talks at:

  • PacSec 2011

“How Security Broken?”

  • Black Hat Abu Dhabi 2011

“Yet Another Android Rootkit /protecting/system/is/not/enough/”

  • Black Hat USA 2012

“Windows Phone 7 Internals and Exploitability”

Self lf Introdu duct ction ion

2

slide-3
SLIDE 3

Fourteenforty Research Institute, Inc.

  • Modern mobile operating systems

– Sandbox to protect system and applications – Some kind of MAC (Mandatory Access Control) – Integrated application distribution (App Stores)

  • Modifications by Third-party Vendors

– Android – Windows Phone (7.x)

Back ckgr ground nd

3

slide-4
SLIDE 4

Fourteenforty Research Institute, Inc.

  • Security Design

– Android – Windows Phone 7

  • Risks and Vulnerabilities

– What we find

  • Third-Party Risks and Vulnerabilities

– Remote DoS – Privilege Escalation – Access Control Vulnerability

  • Finding Vulnerabilities

Age genda da

4

slide-5
SLIDE 5

Fourteenforty Research Institute, Inc.

We cannot disclose many of vulnerabilities we’ve found

Caution ion!

5

slide-6
SLIDE 6

Fourteenforty Research Institute, Inc.

SECUR URIT ITY Y DE DESIG IGN

It looks pretty good. But is it enough then?

6

slide-7
SLIDE 7

Fourteenforty Research Institute, Inc.

  • Restrict access to specific resources

– Need declaration to use specific features

  • Sensor data / Camera
  • Location
  • Access to system resources

– Special GID or software checks – Some permissions are restricted for system apps (like INSTALL_PACKAGE; allows unattended installation)

  • Checks by package location / signature

Andr droid

  • id : Permissio

mission

7

slide-8
SLIDE 8

Fourteenforty Research Institute, Inc.

  • Service Manager (or important method) checks callers permission

– Achieve good isolation (IPC glue is automatically-generated)

Andr droid

  • id : Permissio

mission n Check cks s (1)

8

IPC (through Binder)

Caller Application System Service Activity Manager Package Manager Application Metadata

slide-9
SLIDE 9

Fourteenforty Research Institute, Inc.

  • Some permissions are associated with specific GIDs

– Use POSIX permission checks except “Internet” permission

Andr droid

  • id : Permissio

mission n Check cks s (2)

9

GID: 1007 (log) GID: 3003 (inet)

Kernel Application Application POSIX permissions Specific checks for Android*

android.permission.INTERNET android.permission.READ_LOGS Normal Case “Internet” Case

* Linux kernel for Android is modified to restrict Internet sockets to processes which have GID 3003 (inet).

slide-10
SLIDE 10

Fourteenforty Research Institute, Inc.

  • One UID for One App

– Unless apps by same developer declare to share UID – No apps can access other apps data unless its permission is world-accessible

  • Vulnerability in Skype for Android (CVE-2011-1717)
  • Read-only access to some system resources

– e.g. Data in SD card (will require READ_EXTERNAL_STORAGE permission in the future) – e.g. /data/system/packages.list (which enables to access package list without permission)

Andr droid

  • id : Iso

solati ation

  • n

10

slide-11
SLIDE 11

Fourteenforty Research Institute, Inc.

  • Some vendors add security layer to avoid issues

– NAND protection protect system partition of flash will not be overwritten – LSM (Linux Security Modules); except SEAndroid prohibit dangerous operations from being performed – Better security controls (e.g. 3LM Security)

  • Some of them can be effectively broken

– “Yet Another Android Rootkit /protecting/system/is/not/enough/” Black Hat Abu Dhabi 2011

Andr droid

  • id : Add

dditiona

  • nal

l Secu curity rity by by Vendo dor

11

slide-12
SLIDE 12

Fourteenforty Research Institute, Inc.

  • Restrict access like Android’s permission system

– Fewer (and simple) capabilities

  • Specific SID for capability
  • Special Capabilities for limited apps

– Some capabilities are not allowed for distribution (without explicit permission by Microsoft) – Use OEM’s interop service (ID_CAP_INTEROPSERVICES)

Windo dows ws Phone ne 7 : Capa pabi bilit lity

12

slide-13
SLIDE 13

Fourteenforty Research Institute, Inc.

  • One Chamber for One App

– Windows Phone 7 creates “chamber” to isolate application data and program

  • Almost no access to system resources

– Normal developers can run only managed (.NET) code

  • Only few developers are allowed to run native code

(with WPInteropManifest.xml in the package) – Almost no apps can access other apps data

Windo dows ws Phone ne 7 : Iso solati ation

  • n

13

slide-14
SLIDE 14

Fourteenforty Research Institute, Inc.

  • Executable modules and resources are restricted

Windo dows ws Phone ne 7 : Iso solati ation

  • n Detaile

iled

14

Kernel

Policy Engine (PolicyEngine.dll) Package Manager (pacman*.dll) Security Loader (lvmod.dll) Shell (telshell.exe)

Query Apps Check if App Allowed

Apps (TaskHost.exe)

Launch App Access Control (sandbox) Prevent untrusted files to be loaded

Running applications (related components)

slide-15
SLIDE 15

Fourteenforty Research Institute, Inc.

  • Although there are some small “flaws”,

these OS protect system from being compromised

Concl clus usion ion

15

slide-16
SLIDE 16

Fourteenforty Research Institute, Inc.

RIS ISKS KS AN AND V D VULNE NERABI RABILI LITI TIES ES

In other words : what we always find

16

slide-17
SLIDE 17

Fourteenforty Research Institute, Inc.

  • Access to resources which is not allowed (normally)

– The risk of vulnerability will vary on the resource we can access using exploits – Critical one may lead to privilege escalation

What we fi find d : Acc ccess ss Contro trol l Vulner nerabil abilit ity

17

slide-18
SLIDE 18

Fourteenforty Research Institute, Inc.

  • Make malicious program to run on higher privileges

– Normal users to System user

  • “system” user in Android is allowed to

use almost all system privileges and resources

  • This may lead to complete compromise

– System user to Administrative user

  • Gaining “root” privilege

– Keep admin privileges

  • Modify and infect the system permanently
  • This is complete compromise

What we fi find d : Privil vileg ege e Esc scalation ion

18

slide-19
SLIDE 19

Fourteenforty Research Institute, Inc.

TH THIR IRD-PA PARTY TY RIS ISKS KS

What kind of vulnerability third-party made?

19

slide-20
SLIDE 20

Fourteenforty Research Institute, Inc.

  • “Data Wipe” vulnerability in Samsung and HTC devices

– Clicking “tel:…” URL triggers “data wipe” feature – Special phone numbers (which trigger specific event) are not handled correctly

  • Demonstrated by IMEI display (“*#06#” from remote)
  • Denial of Service (force-to-reboot) vulnerability in

various Android devices (Sharp, Fujitsu-Toshiba, NEC-Casio…) – Similar example on a Japanese smartphone we’ve found – Clicking specific URL (more specifically, calling read system call for special location) triggers kernel panic and forces device to reboot

Andr droid

  • id : Re

Remo mote te DoS Vulner nerabil abilit ity

20

Reference: http://www.guardian.co.uk/technology/2012/sep/27/samsung-htc-phones-remote-wipe

slide-21
SLIDE 21

Fourteenforty Research Institute, Inc.

  • ACER Iconia Tab / Motorola Xoom OS Command Injection

– “/system/bin/cmdclient” setuid (and world-executable) program – Ability to run any command in root privilege

Andr droid

  • id : Privil

vileg ege e Esc scalation ion Vulner nerabil abilit ity

21

Reference: http://forum.xda-developers.com/showthread.php?t=1138228 (ACER Iconia Tab A500) http://www.xoomforums.com/forum/motorola-xoom-development/12997-rooting-family- edition.html (Motorola Xoom FE)

slide-22
SLIDE 22

Fourteenforty Research Institute, Inc.

  • ZTE Root Shell Vulnerability

– “/system/bin/sync_agent” setuid (and world-executable) program – Ability to run a root shell with a hard coded password

Andr droid

  • id : Acc

ccess ss Contro trol l Vulnerab nerabili ility

22

Reference: http://blog.mobiledefense.com/2012/05/zte-root-shell-vulnerability/

slide-23
SLIDE 23

Fourteenforty Research Institute, Inc.

  • Heap overflow vulnerability in [not disclosed yet]

– CVE-2005-2096 (vulnerability in zlib -1.2.2) – This showed us Windows Phone 7 apps are not vuln-free (such native vulnerabilities can be found)

  • Risks of Exploitation

– If a vulnerable native app has “Interop Services” capability, it can cause disaster (ID_CAP_INTEROPSERVICES) – Otherwise it’s not much help for bypassing sandbox

  • Just taking control may be not enough for

system compromise (because of strong isolation)

  • Fortunately, [not disclosed] didn’t have one

Windo dows ws Phone ne 7 : Vulne lnera rabi bilit lity

23

slide-24
SLIDE 24

Fourteenforty Research Institute, Inc.

  • Some Windows Phone 7 devices have “backdoor”

interop services which enables access resources in many regions – Files – Registry – Physical RAM (?!)

  • These services can be accessed from apps with

ID_CAP_INTEROPSERVICES capability – There are some non-OEM native apps (which can access all interop services)

  • Microsoft should have been separated such services

– If an application need an interop service, all interop services will be permitted

Windo dows ws Phone ne 7 : Desi sign gn Fl Flaw

24

Reference: http://labs.mwrinfosecurity.com/assets/128/mwri_wp7-bluehat-technical_2011-11-08.pdf

slide-25
SLIDE 25

Fourteenforty Research Institute, Inc.

FIN INDI DING NG VU VULNE NERABI RABILI LITI TIES ES

It was not so difficult.

25

slide-26
SLIDE 26

Fourteenforty Research Institute, Inc.

  • If device A have been hacked by others, device B

(which has similar configuration) may have similar vulnerability – Same/Similar chipset – Same/Similar vendor

General eral : Fi Find d Simi milar lar Hack cks

26

slide-27
SLIDE 27

Fourteenforty Research Institute, Inc.

  • Original system interface may be disaster

– Buffer overflow – Directory traversal – Improper access to file system

  • Using…

– IDA Pro to figure out what interface the device has – Custom tools to exploit (or try to exploit)

General : Focus on “System” interface

27

slide-28
SLIDE 28

Fourteenforty Research Institute, Inc.

  • Applicable for GPL/LGPL portions

– Diffing between original source code and vendor one – AOSP and some vendors (like Qualcomm) serves git repository and makes diffing easier

  • Download every history by cloning git repository and

compare each commits to find neighborhood

  • Take a complete diff and investigate “vendor” parts
  • 1.3GB total for “Android” Linux kernel trees and

thousands of appropriate commits – It may require optimization for diffing (if you don’t know which chipset the device uses)

Andr droid

  • id : Diff

ffing ing so source ce tree

28

slide-29
SLIDE 29

Fourteenforty Research Institute, Inc.

  • Access all the files and directories which we can access

– Just doing this can reveal vulnerability

  • Find “third-party” daemons

– This will help efficient reverse engineering

  • Disassemble/Decompile important programs and extract

path information (to figure out) – Some locations which have “improper access” are difficult to find without reverse engineering

Andr droid

  • id : Diff

ffing ing fi files es and di d direct ctories

  • ries

29

slide-30
SLIDE 30

Fourteenforty Research Institute, Inc.

  • Check which module is loaded

and make sure the way to load module is secure – If the module is loaded insecurely, we could “insert” module to be loaded – Symbolic link may help (many programs cannot handle symbolic links correctly)

Andr droid

  • id : Modu

dules es to load

30

slide-31
SLIDE 31

Fourteenforty Research Institute, Inc.

  • Windows Phone 7 updates are completely separated between

Microsoft updates and OEM updates – Downloading OEM updates will make reverse engineering very easy (no need to “jailbreak” real device!) – *.cab.pkg (CAB files) : Separate update package

  • Package file is a gold mine of reverse engineering

– *.rgu : Registry file (driver information, configurations…) – *.policy.xml : Policy XML (used for access control) – *.dll, *.exe : Drivers / PE files (to disassemble)

Windo dows ws Phone ne 7 : Upd pdates

31

slide-32
SLIDE 32

Fourteenforty Research Institute, Inc.

  • System symbols for Windows Phone 7

– If you can retrieve WP7 system binaries (e.g. extract ROM), you can download the symbols from well-known URL <http://msdl.microsoft.com/download/symbols> – Loading symbols may break IDA Pro but can be fixed:

  • Start analyzing module without loading symbols
  • Save “Thumb” functions
  • Load symbols
  • For each “Thumb” functions, restore register “T”.

(to make functions really “Thumb” again)

  • Reanalyze module from options menu

Windo dows ws Phone ne 7 : Symb mbols ls

32

slide-33
SLIDE 33

Fourteenforty Research Institute, Inc.

CON ONCLUSI SION ON

So, what is the problem?

33

slide-34
SLIDE 34

Fourteenforty Research Institute, Inc.

  • May not be easy to know

– Many zero-days

  • May not be fixed so fast

– Varying on vendors – May be same on “common” Android vulnerabilities

  • May be easy to exploit

– If the third-party vendor didn’t properly design security

  • Definitely easy to find

– Find vulnerability from 1 million lines or 1 thousand lines

Probl blem ems s of th f third rd-pa part rty y vulner nerabil abilit ities ies

34

slide-35
SLIDE 35

Fourteenforty Research Institute, Inc.

  • Vulnerability made by third-party modification may be disaster
  • There are some points to find such vulnerabilities
  • Vendors must consider security design

Concl clus usion ion

35

slide-36
SLIDE 36

Fourteenforty Research Institute, Inc.

36

Th Thanks! nks!

Fourteenforty Research Institute, Inc.

http://www.fourteenforty.jp

Tsukasa Oi – Research Engineer <oi@fourteenforty.jp>