00:00:00.133-->00:00:03.136 >>They’re talking about Vulnerable out of the box, an evaluation of android carrier 00:00:03.136-->00:00:08.141 devices. I’m sure that’s going to be exciting right now, bu-but here they are, enjoy the con. 00:00:13.213-->00:00:17.985 >>Alright, first I’d like to thank everyone for coming, ah, my name’s Ryan Johnson, I’m from 00:00:17.985-->00:00:22.990 CryptoWire and I collaborated with Angelos Stavrou for this research So, why are we doing 00:00:25.626-->00:00:31.231 what we’re doing? Ah, the short answer is to be proactive, look for vulnerabilities, responsibly 00:00:31.231-->00:00:37.137 disclose them to minimise any impact to the end user. So, there’s some recent examples for 00:00:37.137-->00:00:42.142 android and on the right is, ah, from the New York Times when we found that the New York, or the 00:00:45.045-->00:00:50.384 number one selling unlock smartphone on Amazon was sending the users text messages and call 00:00:50.384-->00:00:54.488 log to a server in China every three days. And it also had a command and control channel, 00:00:54.488-->00:00:59.493 where it could execute commands, as the system user So, you can see the android software stack 00:01:02.362-->00:01:07.968 and mostly where we’re gonna focus is, on, up at the top of the pre-installed apps. Also, 00:01:07.968-->00:01:13.307 the android framework and some system libraries. So anytime you have an android device, there’s 00:01:13.307-->00:01:17.844 gonna be some pre-installed apps on there and they can run as soon as you turn the device on. 00:01:17.844-->00:01:23.183 Ah, some of these apps,ah like Platform apps and other pre-installed apps cannot be 00:01:23.183-->00:01:27.554 disabled, so if there’s a vulnerability in them, you're kinda flat to try and 00:01:27.554-->00:01:32.492 potentially root your device assuming there’s a root strategy available and remove it or wait 00:01:32.492-->00:01:37.297 for a firmware update, that fixes it. And some of the Platform apps they run as a 00:01:37.297-->00:01:41.735 system user, which is very privileged, so if there’s a vulnerability in there an 00:01:41.735-->00:01:47.040 attacker can get, ah, some pretty nice capabilities. So, some of these applications, you 00:01:47.040-->00:01:54.014 know, can be malicious or insecure and android vendors, when they take android AOSP 00:01:54.014-->00:01:59.453 code, sometimes they customise it a little bit just to differentiate themselves and in 00:01:59.453-->00:02:05.759 doing this they can introduce vulnerabilities. So here’s a little primer on android, ah, 00:02:05.759-->00:02:09.997 when you're building an android app, there’s certain, ah, functional blocks from which you 00:02:09.997-->00:02:15.335 can build your application. Ah, they’re provided there and each of these can provide, is a 00:02:15.335-->00:02:20.474 potential entry point into the application. Ah, when you create an android application you 00:02:20.474-->00:02:26.380 declare them in the android manifest dot xml file and you communicate with that components 00:02:26.380-->00:02:30.851 using intents, so that’s just a framework, ah, provided API class, which serves as a 00:02:30.851-->00:02:35.856 message, ah, to send to an app component. And you can also embed data in them. So, what 00:02:38.959-->00:02:45.032 makes a application component accessible or not, to other processes on the device, it’s 00:02:45.032-->00:02:50.637 regulated by two attributes that would be present in the application component 00:02:50.637-->00:02:55.642 declaration, in the manifest file. Ah, so, and there are some instances where android will, by 00:02:58.679-->00:03:03.650 default, export an application component so if it doesn’t use the android exported, ah, 00:03:03.650-->00:03:09.322 attribute, and it contains at least one intent filter, android will export this by default, 00:03:09.322-->00:03:15.062 even though you didn’t say, set android exported equals the true. So, at the bottom there’s 00:03:15.062-->00:03:20.067 a, ah a service that’s been declared and this service ah, is exported by default and using it 00:03:24.271-->00:03:29.276 you can actually download and install an application. So here’s the threat model, the 00:03:31.611-->00:03:36.817 low-privilege third-party app needs to be present on the device and this can reach the 00:03:36.817-->00:03:41.788 device, either by repackaging, so taking an application inserting code into it, putting 00:03:41.788-->00:03:47.027 it onto a third party market, phishing, sending it directly to the target or remote exploit. We 00:03:47.027-->00:03:52.032 saw with the ADUPS commanding and control channel that, that was over http and using that you 00:03:52.032-->00:03:56.303 could just man in the middle it and say dow-download this application, install it and run 00:03:56.303-->00:04:02.676 it, or it could be part of a second stage exploit. Ah, generaly, ah the attack, the 00:04:02.676-->00:04:07.614 permission requirements are potentially no permissions or read external storage. Because 00:04:07.614-->00:04:12.419 read external storage, we’ve noticed that pre-installed applications, ah, s-some of them 00:04:12.419-->00:04:18.892 will just dump data to the SD card. And, so the, the application is a malicious app 00:04:18.892-->00:04:25.298 without malicious permissions, that is leveraging, ah, a pre-installed app and open 00:04:25.298-->00:04:31.872 interface in the pre-installed app to get, ah some resources or capabilities that it cannot 00:04:31.872-->00:04:36.877 access directly. So here’s a list of, ah, some of the vulnerabilities we’ve found. 00:04:40.614-->00:04:46.953 We’ve processed more that 500 firmwares and it shows the device, the vulnerability is, 00:04:46.953-->00:04:53.360 well as, the carrier and we have a framework, ah, scanning for vulnerabilities and a pipeline 00:04:53.360-->00:04:58.031 with additional vulnerabilities that haven’t yet, ah been disclosed. And in this 00:04:58.031-->00:05:04.871 presentation, we’re gonna try and cover all of that. So starting off with ZTE, we looked 00:05:04.871-->00:05:11.178 at a bunch of ZTE devices on carriers. And each ZTE device we looked at contained this 00:05:11.178-->00:05:17.684 vulnerability, so you can see the device is at the bottom and essentially, ah, any 00:05:17.684-->00:05:22.689 application, ah, on the device can interact with the custom service that they have. And have 00:05:25.258-->00:05:31.598 this service start writing the modem log and the logcat log to the SD card. And the logcat log, 00:05:31.598-->00:05:36.069 the system wide one, is not directly accessible to third party applications, no matter 00:05:36.069-->00:05:41.074 what permissions. They request, ah, and when this logging is occuring there’s no vis-visual 00:05:43.243-->00:05:49.482 or audible cue to the user, that this is occurring. And it writes it to a base directory of just 00:05:49.482-->00:05:54.487 SD card, ah SD underscore logs. So, here’s some instances, ah, things that we’ve seen in the 00:05:58.225-->00:06:02.629 logcat logs; though any process on the device can write any arbitrary message to the log, 00:06:02.629-->00:06:07.834 it’s a shared resource, so if you leaked data there, it’s gonna show up in the log. Ah, 00:06:07.834-->00:06:12.839 example at the top right, that is from a fortune 500 android, ah, fortune 500 banks android 00:06:14.975-->00:06:21.314 app and the device, ah, earned their application rights to use their credentials to the log. 00:06:21.314-->00:06:26.586 Some devices we’ve seen have the messaging app in debug modes, though, at that point you’ll see 00:06:26.586-->00:06:31.725 the destination of the text messages as well as the body of the text message. And we’ve also 00:06:31.725-->00:06:36.730 seen things like unique device identifiers, ah, users email address and gps coordinates. So, 00:06:39.866-->00:06:45.005 due to the log being a shared resource and any application can write arbitrary data there. It 00:06:45.005-->00:06:50.010 was, ah, moved, from an applica-app, permission that a third party app could get to 00:06:50.010-->00:06:55.348 assist them or platform permission in android 4 point 1. Ah, here’s a list of some 00:06:55.348-->00:07:01.454 devices, ah, as well as the carrier and some unlock devices, where a third party application 00:07:01.454-->00:07:07.227 can have a pre-installed app on that device. Start writing the log to a location, the system 00:07:07.227-->00:07:12.232 wide log to a location that it can access. And I've got a question for the audience, ah, 00:07:15.168-->00:07:21.374 does anybody know how to interact with a bound service without the accompanying AIDL 00:07:21.374-->00:07:26.379 file? [laughter] O-Okay, so this is how it works on the ZTE device, there’s a pre-installed 00:07:31.985-->00:07:38.391 platform app, um this app, ah, right after boot registers itself as a custom service 00:07:38.391-->00:07:44.431 called Modem Service. The third party app says give me handle to this service, it gets the handle 00:07:44.431-->00:07:50.136 from the android OS service manager. And this service that it obtains, is like a mini 00:07:50.136-->00:07:56.343 service manager that offer-offers five services. So you get the, ah SD log service 00:07:56.343-->00:08:01.281 and at this point, then you just call three functions and it will start writing the logs, ah, the 00:08:04.951-->00:08:10.223 modem logs and for this it’s specifically the modem log, although the logcat log is done 00:08:10.223-->00:08:15.228 in a very similar way, except just with a different service. And we have ah, a video for that 00:08:25.071-->00:08:31.378 So here just going, ah terminal application going to the SD card, ah, going to the directory 00:08:31.378-->00:08:36.616 where it writes them, just showing that’s it’s not there. So for a third party application 00:08:36.616-->00:08:41.454 to actually access the modem log, which, you know, contains the users text messages, and ah, 00:08:41.454-->00:08:46.459 call data. They would need the read external, external storage permission, ah, to access it. So 00:08:48.995-->00:08:53.099 just installing some app, it’s gonna be done by an activity in the foreground, this could be 00:08:53.099-->00:08:58.104 done in the background by a service. Going back to, ah, ah, the terminal, that directory 00:09:01.374-->00:09:06.379 should be there now. And the, the modem logs are actually in a QMDL file, which is a binary 00:09:10.150-->00:09:15.955 file. There is a programme to access it, to parse it out. I don’t have that programme, but I 00:09:15.955-->00:09:20.960 can still, um, identify, ah, where the text messages are and show you on a slide soon. So 00:09:23.329-->00:09:28.334 here’s the, the logcat log, which, ah they should have a file for-for different log 00:09:32.172-->00:09:39.079 buffers And it’s just gonna continue writing to them any time the device is on, so just 00:09:39.079-->00:09:44.084 LSing, ah, to show that the size is increasing And then just catting it to show the contents 00:09:51.391-->00:09:57.931 of it. And then we’ll go back to, ah, the base directory to look at the QMDL file. Ah, we’re 00:09:57.931-->00:10:02.635 unsure if this actually contains, ah, voice data from the telephony, but it does 00:10:02.635-->00:10:07.640 contain the text messages and incoming and outgoing calls. So this just parsing the QMDL file, 00:10:16.583-->00:10:22.021 you can see the, ah, the text messages, ah, incoming and outgoing one. The phone number 00:10:22.021-->00:10:27.026 in reverse byte order and the actual body of the text message is in 7 bit pact format. And so 00:10:29.696-->00:10:34.534 it’s just a incoming and outgoing text message and then just the calls that you make, 00:10:34.534-->00:10:39.539 also show up in this QMDL file. And moving on, switching to LG, ah we, ah, have some 00:10:42.909-->00:10:47.947 vulnerabilities here. You can also obtain the system wide logcat log, accept this you can 00:10:47.947-->00:10:53.620 get it written to the attacking applications private directory. Ah, so you don’t need any 00:10:53.620-->00:10:58.625 permissions and you can see the device is affected, it’s generally written to the SD 00:10:58.625-->00:11:04.797 card, but th-you can use pact reversal and you can also inject a parameter, ah, argument, um to 00:11:04.797-->00:11:09.802 the command that’s exe-being executed to get all of the logs. You can also lock the user out 00:11:11.905-->00:11:18.211 of their device, so as your permission app can just send a single,a broadcasting tent and 00:11:18.211-->00:11:23.950 the screen lock will not let the user in. I’ll show a video of that soon. There’s another 00:11:23.950-->00:11:29.489 pre-installed app where you send it a broadcasting tent in it, it’s gonna write a database 00:11:29.489-->00:11:34.427 full, that contains, ah, snippets of the logcat log and the kernel log to external 00:11:34.427-->00:11:41.267 storage. So to get the system wide, um, logcat log, there’s a pre-installed app it will 00:11:41.267-->00:11:46.272 execute the command that’s shown in the first bullet. Ah, this when you activate it by sending 00:11:49.175-->00:11:54.380 in-in-intent you can actually provide the path. Ah, there’s the default path in the second 00:11:54.380-->00:11:58.151 bullet, so if you just do double that slash four times it takes you back down to the root 00:11:58.151-->00:12:03.690 directory and then you just add on slash data, slash data package name. Ah, and then a 00:12:03.690-->00:12:07.794 file in your private directory, and at that point that does require some file permission 00:12:07.794-->00:12:12.532 changes, which any app can do. You need to have the apps private directory globally 00:12:12.532-->00:12:17.637 executable and you need to create that file or create the file that your gonna write to, 00:12:17.637-->00:12:22.408 and then make it globally writable. So, this system process ah, can append to it, 00:12:22.408-->00:12:27.847 but you’ll still own the file. And in the intent you can provide an arrayList of strings 00:12:27.847-->00:12:32.919 and in these strings it’s, essentially just a log tag, um, to add to the commands.But and 00:12:32.919-->00:12:39.592 it a-a and it depends on a cole and v to it just to give log message any log level for that 00:12:39.592-->00:12:45.064 log tag. But in red if you just do the wild card cole and v, this will give you every single 00:12:45.064-->00:12:50.937 log message, ah, in the log and then space and then any arbitrary word. And then that 00:12:50.937-->00:12:56.109 gets added to the command and then it’s gonna start writing the system wide logcat log, ah, 00:12:56.109-->00:13:02.448 to the attacking applications private directory. Ah, so you can also lock the user out of 00:13:02.448-->00:13:07.920 their device, so this makes the, the screen lock essentially unresponsive, except for making 00:13:07.920-->00:13:14.260 emergency phone calls. And the-this is done, this system ui app has a supported interface 00:13:14.260-->00:13:18.598 where you can send it a broadcast intent and at this point it’s going to lock the 00:13:18.598-->00:13:23.202 screen. And this screen lock is active in safe mode, so in safe mode, third party apps are 00:13:23.202-->00:13:29.542 running, the pre-installed applications are running, ah, but it reads from system ui app 00:13:29.542-->00:13:33.446 will read from systems settings and keep the lock in place. This sort of thing could be used for 00:13:33.446-->00:13:38.017 a cryptoless ransomware, where you could provide messages at the bottom, ah they’re called 00:13:38.017-->00:13:44.090 toast messages informing the user, you know, where to pay, ah, to unlock it. And the user, 00:13:44.090-->00:13:49.962 if they have been able to adb, ah, prior to the screen lock attack ,they can unlock it. If 00:13:49.962-->00:13:54.967 they are crafty and look around cha-manually change the, ah settings and, ah, or send a, a 00:13:59.205-->00:14:04.143 different broadcast intent to unlock it. So, I have a video So this just showing we have a 00:14:10.650-->00:14:15.655 screen lock on and also LG patch all these vulnerabilities. So just as your permission app 00:14:21.360-->00:14:26.365 installing it, it should run, for a second and then the screen lock you can’t really do much 00:14:29.802-->00:14:36.209 with it. So, unless, you know, you can fig-you have have adb enabled prior to that and you 00:14:36.209-->00:14:40.113 can figure out how to do it. You’re gonna have to boot it in recovery mode and factory reset 00:14:40.113-->00:14:45.118 the device, potentially lose data to actually recover it. So there, speaking of factory 00:14:58.397-->00:15:03.336 resets, we also found that a number of devices, some of them carriers, some of them unlocked, 00:15:03.336-->00:15:08.775 expose the capability to perform a factory reset. If you have an android phone, you’ve 00:15:08.775-->00:15:13.546 potentially gone into the settings app and seen erased data. This, it will perform a 00:15:13.546-->00:15:18.951 factory reset, um, this is generally done just by an exposed interface in a platform 00:15:18.951-->00:15:24.357 app, where zero permission app sends it a specific intent message and then it will 00:15:24.357-->00:15:29.929 programmatically go and wipe the device and any user data, ah, that is not backed up somewhere, 00:15:29.929-->00:15:34.934 will be lost. So, if you’ve been playing, ah a video game, ah, for a long time, made a lot of 00:15:34.934-->00:15:39.939 progress, that’s potentially gone. As well as, ah text messages and um, pictures. So, 00:15:44.010-->00:15:49.015 we have a video for that So this is ah, a teamable rebel device and we’re going to just install 00:16:02.428-->00:16:07.433 an application. It shows it doesn’t have any permissions there So then, then it-it boots 00:16:19.846-->00:16:24.851 into recovery mode and then wipes the data in cache partitions. [background noise] 00:16:37.163-->00:16:42.168 So this is kind of ah, the workflow to do it on, ah the essential phone, so just any ah, 00:16:44.837-->00:16:49.909 application on the device, it can have no permissions. It starts an activity RT-RTN reset 00:16:49.909-->00:16:55.481 activity, ah that’s in a pre-installed platform app, which is very privileged. Ah, 00:16:55.481-->00:17:00.353 that activity then starts a-another activity, which is gonna send the master clear 00:17:00.353-->00:17:05.658 broadcast intent. And this will b-be received by the system server process. The system 00:17:05.658-->00:17:11.430 server process provides, ah, applications with all sorts of services. So the master clear 00:17:11.430-->00:17:17.837 receiver receives this, it calls in an internal API class, ah recovery system in a method 00:17:17.837-->00:17:22.675 called Reba-Reboot wipe user data. And at this point it writes minus minus wipe 00:17:22.675-->00:17:28.514 underscore data, as well as a few things to, ah, a file on the cache partition, cache recovery 00:17:28.514-->00:17:33.286 command then re-reboots into recovery mode and then just wipes the data and cache 00:17:33.286-->00:17:38.291 partitions. So also, ah we did find, ah, arbitrary command execution as the system user 00:17:42.461-->00:17:49.402 through a vulnerable platform app on the Asus ZenFone V Live device. So, we talked about the 00:17:49.402-->00:17:54.574 androidmanifest xml file earlier. Here’s the entire, ah manifest file for the 00:17:54.574-->00:17:59.345 application, so in red just showing that it’s a platform app running a system. Blue is the 00:17:59.345-->00:18:05.151 package name, red is exported, meaning any application can interact with it and orange is 00:18:05.151-->00:18:10.156 the name of it and the service declaration is provided in bold. Um, so this is a bound service, 00:18:13.225-->00:18:18.230 we don’t have the AIDL file, but this can be found out by looking at the, the, ah, stub class and 00:18:22.268-->00:18:28.174 the stub proxy class, ah for the service. So, you know, usually if you had the AIDL file, you 00:18:28.174-->00:18:33.279 could use some RPC, which would make it easy. But since you don’t, you have to go one level 00:18:33.279-->00:18:39.685 down, actually get the, ah, IBinder reference called the correct, ah function number for 00:18:39.685-->00:18:45.157 it and populate any parameters in the parsel. So here’s just writing a string to the parsel, 00:18:45.157-->00:18:50.162 ah also using one f-ah,flag one way, so it’s in synchronous and doesn’t block. And here some of 00:18:54.266-->00:18:59.605 the capabilities, once you have arbitrary command execution a system user, ah, which you can 00:18:59.605-->00:19:04.543 do. And we have a video for that. So here just going to the applications that are installed, 00:19:17.223-->00:19:22.228 it’s called Defcon 26, you’ll see that it doesn’t have any permissions. I click around on 00:19:22.228-->00:19:27.233 it for a little bit. So there’s a nice little menu, ah, if you wanna obtain the users text 00:19:31.904-->00:19:36.909 messages, ah-ah, you can. Ah, the way it’s been done takes a little bit and I’ll explain why. 00:19:45.117-->00:19:50.122 So, just getting the users contacts Ah, looking at the call log, also this application, ah, 00:19:56.095-->00:20:00.266 has the code to be a notification listener embedded in it, so it can obtain the 00:20:00.266-->00:20:04.804 user's notif-active notifications receive them when they come in. It can go, ah, 00:20:04.804-->00:20:09.809 take a screenshot, so, um, that shows up in the applications, ah, directory. You can also, 00:20:13.512-->00:20:18.150 this application has the code from the spelling checking framework, it implements a spell 00:20:18.150-->00:20:23.823 checking service. So at this point when the users typing something, ah, and it doesn’t 00:20:23.823-->00:20:29.361 work in all applications, ah, only when the spell checker kicks in. But you can kind of 00:20:29.361-->00:20:34.366 see, ah, what they type and also record a video of kind of what the users doing. So here just 00:20:40.072-->00:20:45.077 playing some game and trying not to die. Also this application, ah, if you wanna implement a 00:20:57.289-->00:21:02.027 keyboard on android, it’s called the input method editor. So the previous keyboard was actually 00:21:02.027-->00:21:06.699 the standard looking keyboard, it has the code to be a input method editor, so it’s gonna 00:21:06.699-->00:21:11.804 change the settings to set itself, as the keyboard. So, the keyboard’s gonna look different, 00:21:11.804-->00:21:15.040 I mean if you wanted to be malicious, you would wanna try have it match the default 00:21:15.040-->00:21:20.045 keyboard. Ah, but the, the keyboard you’ll see soon will be blue, so it’s gonna swap the 00:21:22.948-->00:21:29.421 keyboard, it’s, this, it just writes and changes settings that have the keyboard, ah, be the 00:21:29.421-->00:21:34.627 one that’s it’s implemented in its code. And then any key codes that are pressed or going to be 00:21:34.627-->00:21:38.798 transferred to the malicious app, via a dynamically registered broadcasting 00:21:38.798-->00:21:44.837 receiver. And this will get something, you know, everything that you type, so you're gonna 00:21:44.837-->00:21:49.842 type something, delete it, um and then type something else. And then just keeping a log of 00:21:53.812-->00:21:58.817 what the user typed. And then calling 911. Which if you can do, I talk to a nice gentlemen 00:22:12.598-->00:22:17.603 who is kinda understanding about it, once I explained why I was doing it. So we also, once we 00:22:22.675-->00:22:28.581 saw that on, ah, Asus devices, we, ah they provide actually the firmware on their website and 00:22:28.581-->00:22:34.954 also historical firmwares. So we downloaded a bunch just to see what was vulnerable. And also 00:22:34.954-->00:22:41.760 the, we also found that tablets had this vulnerable platform app. Ah, then we also wanted to 00:22:41.760-->00:22:47.633 find out when it was introduced, so we focused on one device, which was the Asus Zenfone 3 and 00:22:47.633-->00:22:52.638 saw that it was introduced around March 2017. And then it further got introduced into all 00:22:56.675-->00:23:01.614 other markets, ah, except for China, which was, ah, just stated android 6 point 01, which 00:23:05.584-->00:23:10.589 is a non-vulnerable version. And this is a non, ah, US carrier device, but it’s a device 00:23:12.591-->00:23:18.797 that’s, ah, popular in Asia, it’s called the Oppo F5 and this vulnerability has been patched 00:23:18.797-->00:23:23.802 and they also went in after this became a CNA, ah, which we thought was a very good thing. 00:23:26.071-->00:23:32.811 So there’s, ah, an application, ah, on here, which is a very simple application. Ah, we took 00:23:32.811-->00:23:39.752 the odex file and then provided, ah, the source code for it, so essentially it just has a thread 00:23:39.752-->00:23:44.757 and it will take a strain and then execute it as the system user. And on the lower right is 00:23:47.359-->00:23:52.364 actually just the code to, um, execute it. So, um, another question for the audience. So, 00:23:58.237-->00:24:04.143 does anybody have a good way if you just have access to Runtime exec to make the vulnerable app 00:24:04.143-->00:24:09.148 write a script and then execute it? Okay, so what we did, one of the devices we looked at 00:24:13.519-->00:24:19.558 actually, the platform app, the SELinux rules prevented the platform app from reading and 00:24:19.558-->00:24:24.897 writing from an untrusted third party or third party apps private directory. Although, all 00:24:24.897-->00:24:30.803 the other devices allowed that, but this device, ah, prevented that. So, ah, just using Runtime 00:24:30.803-->00:24:34.840 exec is kind of limiting, we would, you know, wanna have some logic in there as well, some 00:24:34.840-->00:24:40.379 output redirection. So the approach that we came up with to do that, is just to select a 00:24:40.379-->00:24:45.884 string with high entropy. And then in the attacking app create a, a dynamically registered 00:24:45.884-->00:24:51.757 broadcastreceiver that has an action string of that, ah high entropy string. And then from 00:24:51.757-->00:24:56.729 there start writing to the log using a log tag of that high entropy string. And then each 00:24:56.729-->00:25:01.667 log message contains one line of the shell script to execute. You can see it, um, eh, it numbered 00:25:05.003-->00:25:11.510 2, from there since you have command execution, you make it execute the command in bold. So, 00:25:11.510-->00:25:17.082 this makes it, ah there’s a bunch of parameters to it, so it’s just a logcat command minus 00:25:17.082-->00:25:22.321 v raw just gets you the actual log messages. As opposed to the log tags and any time stamp 00:25:22.321-->00:25:28.193 stuff, minus s, silences every other tag except the one that you want, which is that high 00:25:28.193-->00:25:33.198 entropy string at any log level, minus f, writes the log messages to a shell script in the 00:25:36.235-->00:25:40.672 vulnerable apps private directory and then minus v, makes it dump the log. As 00:25:40.672-->00:25:44.676 opposed to keep reading from it, so it just dumps the log buffer, so that’s gonna write your 00:25:44.676-->00:25:49.448 script to the vulnerable apps private directory and then you just change the file permissions 00:25:49.448-->00:25:56.155 on it and then execute it. And the example here, is just to get the text messages, write it to a 00:25:56.155-->00:26:01.093 file in its private directory and then send, ah that file using, ah, a broadcast intent 00:26:05.464-->00:26:10.469 and embedding it in there to the, the attacking apps, ah, to the attacking app. And then if 00:26:12.604-->00:26:17.943 you relax some of the conditions, if they can write, um, to the vul-the vulnerable 00:26:17.943-->00:26:22.481 platform app, if it can write to the third party apps private directory, then you can just 00:26:22.481-->00:26:28.854 have it, ah, write directly in there with the text messages, shown here. And that it 00:26:28.854-->00:26:34.326 req-requires the file permission changes that I mentioned earlier, making the attacking 00:26:34.326-->00:26:39.431 apps, ah private directory globally executable. And creating an empty file making it 00:26:39.431-->00:26:44.436 globally writable. Ah, so Oppo does provide the firmwares, on its website, at least the most 00:26:46.705-->00:26:50.809 recent ones, so we downloaded some of those just to see, um, what's vulnerable. It’s 00:26:50.809-->00:26:55.814 segmented by country market and we downloaded more, except they use an ozip format, which, ah, 00:26:58.917-->00:27:05.157 is, you know, encrypted. Ah, we were able to get some of them, ah, but not all of them and this 00:27:05.157-->00:27:10.162 table is ordered, ah, chronologically with most recent first. And if, if you do have 00:27:14.266-->00:27:20.272 command execution as a system user, it, if the, if the attacking app implements an IME 00:27:20.272-->00:27:25.644 or a spell checker. Those are just the commands to actually change it in settings. Ah, the 00:27:25.644-->00:27:30.649 platform app has the privileges to change system settings. Ah, so we have, ah, an-analysis 00:27:33.318-->00:27:38.190 framework, ah, we have something called Force-Path Execution, which will, you know, take a 00:27:38.190-->00:27:44.463 firmware, unpack it and then process all of the apps in parallel. And the forced path 00:27:44.463-->00:27:48.901 execution, it can actually force into certain branch constraints just in case there’s any 00:27:48.901-->00:27:54.373 triggered functionality to try and make the application, ah, show all of its behaviour under, 00:27:54.373-->00:27:59.945 you know, any circumstances. We also do some static analysis and obtain-n-n an analysis, to see 00:27:59.945-->00:28:05.350 if there’s any vulnerable flows. To see if there’s, ah, you know, say-the, obtaining the users 00:28:05.350-->00:28:11.390 text messages to see if that flows to a network socket. And then also, using a custom 00:28:11.390-->00:28:17.663 android build where we control the, the framework key. We can, ah, perform some hooking, Ah, 00:28:17.663-->00:28:24.369 Ah, framework level and also hook some of the library calls, ah, see how the application is 00:28:24.369-->00:28:29.374 interacting with the system and man in the middle traffic. And we have a video So we, there’s 00:28:46.825-->00:28:53.398 a, three vulnerable plat formats that have command execution as a system user. So, just, ah 00:28:53.398-->00:28:58.770 performing some taint analysis, ah, building the control flow graphs, also the data flow 00:28:58.770-->00:29:05.043 graphs and then looking to see if there’s any paths in data that actually flow from the 00:29:05.043-->00:29:12.017 application entry point, ah, to Runtime exec or process builder. To see if there’s, you know, any 00:29:12.017-->00:29:18.490 vulnerable, ah, or any paths as well as the path conditions, or what it would actually take to, 00:29:18.490-->00:29:23.495 ah, reach that path. Ah, we also found that, ah, certain devices have the capability, um, where a 00:29:31.436-->00:29:36.441 third party app can initiate the taking of a screenshot. So this, ah, is generally from system 00:29:39.678-->00:29:44.549 server, ah, being modified. There will be a-a broadcast receiver where if you send it a 00:29:44.549-->00:29:49.554 specific intent message. Um, it will, ah-ah, take a screenshot and if an application has read 00:29:52.290-->00:29:56.662 external storage, it can read from the SD card. Also expand the status bar to see what the 00:29:56.662-->00:30:02.100 users current notifications are. And this sort of thing isn’t transparent, ah, to the user, so 00:30:02.100-->00:30:08.073 they can see it. But an application, ah, if-if it knows the user hasn’t been using the 00:30:08.073-->00:30:13.311 device for awhile, it can, even though there’s a screen lock, come into the foreground, bring 00:30:13.311-->00:30:18.550 down the notification bar, take a screenshot and then use a generic attack to software boot 00:30:18.550-->00:30:23.555 the device, ah, to get rid of the notifications. We have a video, ah,showing that. So, 00:30:29.494-->00:30:34.499 there’s an active screen lock on the device Ah, the application runs, takes a screenshot shows 00:30:41.840-->00:30:46.845 up in the applications, ah, image view And then it, it’s going to ah, cause a system 00:30:53.251-->00:30:58.957 crash, because that screenshot does leave a notification, so it wants to remove that, not to 00:30:58.957-->00:31:03.895 alert the user. Ah, we also, ah, found, ah, an application on, ah, certain devices, which 00:31:14.106-->00:31:17.909 allows any third party application without any permissions to send text 00:31:17.909-->00:31:24.282 messages, read text messages, modify them and also obtain the phone numbers of the users 00:31:24.282-->00:31:30.522 contacts. Ah, the package names are provided there. One of the, package, ah, package names is 00:31:30.522-->00:31:35.994 actually just a refactored version of the others, so the name spaces are a little 00:31:35.994-->00:31:40.132 different, but the functionalities the same. And, ah, this is a platform app that 00:31:40.132-->00:31:45.137 can’t be disabled, so, ah. looking at the manifest file for the application, the receiver up 00:31:50.008-->00:31:55.814 at top in red, ah, it’s exported and if you send an intent message with the correct fields 00:31:55.814-->00:32:01.753 that its looking for, such as a message to send and the phone number to send to, it will go on 00:32:01.753-->00:32:08.660 and send a text message for you. And there’s also seven content providers, which are exported 00:32:08.660-->00:32:13.064 and that’s usually kind of strange behaviour, ah, a little bit, because they tend to 00:32:13.064-->00:32:19.104 contain, ah, they're, ah, repository for data. So, that opens it up to any process on 00:32:19.104-->00:32:24.342 the device and they actually act as a wrapper, so you cont-query this content provider, it’s 00:32:24.342-->00:32:30.148 going to query the text message content provider, get the results, pass that back to you. 00:32:30.148-->00:32:35.153 So, moving on to the ZTE Zmax Champ device, so there’s a pre-installed platform app here, 00:32:41.326-->00:32:45.530 which will just allow any application on the device to cause a factory reset, resulting 00:32:45.530-->00:32:51.736 in potential data loss for the user. There’s also a way to get the logcat logs and modem logs 00:32:51.736-->00:32:57.509 that were described previously and you can also, if you have just a standard, ah, zero 00:32:57.509-->00:33:02.314 p-permission third party app. Ah, just with a standard template with the call backs, 00:33:02.314-->00:33:07.853 you can make this device non-functional with essentially one line of code, by sending a 00:33:07.853-->00:33:12.858 broadcast intent to a specific app and we have video showing that. So this is the ZTE Zmax 00:33:24.302-->00:33:29.307 Champ device, we’re gonna install an application on it I got to allow, ah, third party 00:33:34.546-->00:33:39.551 sources so it doesn’t have any permissions, that’s what that screen shows. We’re gonna cancel 00:33:51.029-->00:33:56.034 that. So this applications just gonna send a single broadcast intent message with a particular 00:34:04.609-->00:34:09.614 action string. It’s going, I’ll explain the workflow in the next slide, but essentially what’s 00:34:13.418-->00:34:19.291 gonna happen is it writes a certain,ah, value to a file that's gonna be processed in 00:34:19.291-->00:34:25.730 recovery mode. And as far as we can tell, it’s going to encounter a fault, boot back 00:34:25.730-->00:34:32.203 into recovery mode, encounter the same faults, um, while trying to erase it. And it 00:34:32.203-->00:34:37.208 appears this is due to them using a non-AOSP, um, command and recovery, which I’m not sure 00:34:40.111-->00:34:44.916 i-is just not handled. But essentially that device will just keep doing that until it 00:34:44.916-->00:34:49.587 runs out of battery and we weren't able to find a way to boot into an alternate mode, ah, 00:34:49.587-->00:34:54.592 at that point. So here’s a workflow for it, it's just,ah, you know, zero permission, ah, 00:35:02.467-->00:35:07.405 third party app on the device. It sends a broadcast intent message, there’s, ah, an 00:35:07.405-->00:35:12.777 application, ah, that has hidden menu in the package name and usually those are apps you want 00:35:12.777-->00:35:18.650 to look at. So, it sends that broadcast intent, it receives it, and then it’s gonna go on 00:35:18.650-->00:35:24.956 and send a different broadcast intent and it’s called Master Clear Data Carrier. This again, 00:35:24.956-->00:35:29.961 is gonna be received by the Master Clear Receiver, its in system server. At this point it 00:35:32.197-->00:35:38.970 calls a non- AOSPAPI method, ah, called inner recovery system, called Reboot, wipe user data 00:35:38.970-->00:35:44.709 and carrier. It writes that file, ah, shown in step five, there’s minus, minus wipe 00:35:44.709-->00:35:51.383 carrier,which ah, is not part of AOSP and then it’s gonna write it to that file, reboot into 00:35:51.383-->00:35:56.454 recovery and then it’s going to go into recovery and just perpetually crash, in recovery 00:35:56.454-->00:36:01.393 mode. So here’s, ah, moving to, ah, Alcatel, this is an unlocked device, this, ah, was sold a 00:36:06.131-->00:36:10.735 while ago as an Amazon Prime Exclusive, so it would have some of the Amazon apps on there and 00:36:10.735-->00:36:15.740 be at a discounted price. And this device allows read only properties to be modified at 00:36:17.842-->00:36:24.149 runtime, which is not the standard behaviour. So, if you have ah, adb enabled, you can 00:36:24.149-->00:36:29.154 execute those commands below. Just setting our debuggable to 1 and then ro secure to 0 and adb 00:36:31.289-->00:36:36.961 root, that’s gonna restart adb daemon running as root as opposed to adb shell and then 00:36:36.961-->00:36:41.966 disabling SELinux and then at that point you have a root shell. Ah, one thing we noticed 00:36:44.302-->00:36:49.040 on this device, we looked at the unit in our C-file, which contains commands for, ah, the 00:36:49.040-->00:36:54.045 inet process to execute. And there’s a directive, so if our debuggable gets sent to 1 to 00:36:56.081-->00:37:01.019 start a process, this process BTW Lan daemon and, ah it will go on and start, ah, binary 00:37:05.657-->00:37:12.397 called Factory test, that’s running as root. So once that property gets changed, that ah, 00:37:12.397-->00:37:19.003 that process starts executing as root and it, essentially its function is to listen to commit, 00:37:19.003-->00:37:23.508 listen, ah creates a socket. You know, you can send to the socket commands and it will execute 00:37:23.508-->00:37:28.780 them as root. We weren’t able to do that from a third party application, um, but we did 00:37:28.780-->00:37:34.886 notice that app, ah, platform apps actually can modify that permission, it run per-that 00:37:34.886-->00:37:40.291 property at run time to make that, ah, socket show up. We're unsure if assisted platform user 00:37:40.291-->00:37:44.662 can actually write to it, but, um, the vendor contain-controls the SE Linux rules, so if they 00:37:44.662-->00:37:46.664 wanted to, they would be pretty close to, ah, getting, ah, command execution as root. And, 00:37:46.664-->00:37:48.666 ah, just kind of, ah, to conclude, ah, many of these vulnerabilities were just, ah, 00:37:48.666-->00:37:53.671 done by insecure access controls. So, there were a lot of exported components, which, 00:37:58.309-->00:38:03.248 um, you know, don’t necessarily need to be open to every, ah, third party application on the 00:38:15.460-->00:38:21.366 device. Also, if you're an app developer you don’t wanna assume that, you know, just because an 00:38:21.366-->00:38:26.771 application doesn’t have the AIDL file for the bound service that they can’t interact with 00:38:26.771-->00:38:32.410 it. Ah, somebody will be able to figure that out and, ah, you know, access it. If you are 00:38:32.410-->00:38:37.549 executing commands as a system user, um, and somehow that gets exported, you would at least 00:38:37.549-->00:38:42.453 want to filter commands just so it's not any arbitrary commands or only actually what’s needed. 00:38:42.453-->00:38:47.458 And, ah, just, ah, from the responsible disclosure process all of these vulnerabilities 00:38:50.695-->00:38:54.699 were responsibly disclosed. Although sometimes it’s difficult to find, you know, who 00:38:54.699-->00:38:59.938 exactly to talk to, who’s gonna escalate it quickly. Ah, so if there was a common email address 00:38:59.938-->00:39:06.778 to send to, ah, that would facilitate things. And also also, um, we have a report if 00:39:06.778-->00:39:11.783 you're interested, ah, send us an email. And does anybody have any questions? Great. >> 00:39:32.570-->00:39:37.642 [Inaudible off mic question] >> I didn’t look at any OnePlus devices >> Yes >> Oh, sorry, ah, 00:39:37.642-->00:39:43.781 so the question was, if we looked at any OnePlus phones because they-they actually have 00:39:43.781-->00:39:50.388 the parent company, ah, is I think BBK Electronics, which owns Oppo, Vivo and OnePlus. Ah, 00:39:50.388-->00:39:55.393 but, and, ah, like we haven’t, ah, looked at OnePlus devices. >> One of the things that I want 00:39:58.696-->00:40:02.533 to point out, is that the device that you showed today are a small sample of the devices that 00:40:02.533-->00:40:06.304 has been identified as been vulnerable. Clearly the, the length of the talk does not 00:40:06.304-->00:40:10.842 allow us to talk about all the devices that we have found, but there were more than 26 devices 00:40:10.842-->00:40:14.646 that we have currently identified as disclosed as part of the report and we have an 00:40:14.646-->00:40:19.250 ongoing by-plan of devices that we have identified. Ah, that are vulnerable and we’re in the 00:40:19.250-->00:40:24.856 process of disclosing it to the vendors. The, the key here is that, ah, a lot of the devices 00:40:24.856-->00:40:30.762 come with a lot of the, a lot of the old ORMs ,ah, have vulnerabilities that the devices 00:40:30.762-->00:40:35.733 come from the factory directly to the user. And, th-these, these vulnerabilities cannot be 00:40:35.733-->00:40:39.937 disabled by the user, even if they identify that their phone is vulnerable. And I think 00:40:39.937-->00:40:44.942 that’s the important part here. >> [Inaudible off mic question] >> Ah, the question is if the, 00:40:56.254-->00:41:01.192 the essential phone is specific to Sprint, no it’s not specific. >> [Inaudible off mic question] 00:41:02.694-->00:41:06.831 >> No, No and, ah, again the reason that we have some of the phones are tied to 00:41:06.831-->00:41:11.736 carrier-carriers, is because we want it to show that basically that’s not a, not a specific 00:41:11.736-->00:41:16.441 carrier problem or specific ORM problem, but this is pervasive problem across multiple carriers 00:41:16.441-->00:41:20.778 and the industry needs to be looking at that as a whole rather than, you know, specific 00:41:20.778-->00:41:35.693 carriers. >> [Inaudible off mic question] >> So, this is, ah, the answer to that’s, no and the 00:41:35.693-->00:41:39.997 reason is because this type of, we-we looked at over 500 firmware. We didn’t have, this 00:41:39.997-->00:41:45.703 is the first, ah, initial preliminary, I would say presentation for the study we do 00:41:45.703-->00:41:49.807 believe that uh that other vulnerabilities so if you don’t see a phone here doesn’t mean 00:41:49.807-->00:41:53.945 that we looked at it and it’s not vulnerable we had limited amount of time and uh you 00:41:53.945-->00:41:59.083 remember that all of these devices were disclosed sixty days so between the sixty days 00:41:59.083-->00:42:03.588 prior and now we have more devices identified which we cannot disclose here but they’re 00:42:03.588-->00:42:18.903 still vulnerable. [off mic question] I I didn’t hear a question go ahead >>Yeah we 00:42:18.903-->00:42:25.042 weren’t aware of that at the time but uh thanks for letting us know >>So so I want to point 00:42:25.042-->00:42:29.247 out that the disclosure happened not only to the OEM guys the disclosure happened to 00:42:29.247-->00:42:33.985 [indiscernible] and to the carriers themselves so it’s not that we tried very hard to reach 00:42:33.985-->00:42:39.123 out to the disclosable parties and have this this firmware spots ahead of our presentation 00:42:39.123-->00:42:46.531 so basically don’t put people in harm's way and most of the vulnerabilities somehow being 00:42:46.531-->00:42:51.536 either addressed or there’s a fix uh prepared some of them are not but it’s completely up to 00:42:51.536-->00:43:08.386 the OEMs and the carriers to that process to proceed yes >>yeah [off mic question] >>Uh I 00:43:08.386-->00:43:14.258 mean I’ve got a kind of a history with Samsung I mean they’ve given me you know a bug 00:43:14.258-->00:43:21.799 bounty a free phone I presented at BlackHat uh Asia in 2015 for them uh >>So so so the answer is 00:43:21.799-->00:43:26.704 that we are in the process of looking into more devices some of them might be vulnerable some 00:43:26.704-->00:43:32.477 others are not we cannot disclose anything to date more than what we disclosed because 00:43:32.477-->00:43:39.417 we are in the uh sixty to ninety days disclosure that we have established with OEMs [off mic 00:43:39.417-->00:43:47.725 question] >>I don’t know if we can we can’t speak for Google >>Yeah I think I think uh you 00:43:47.725-->00:43:53.130 can uh you can directly uh address the question directly to I think uh I think they’re 00:43:53.130-->00:44:08.613 trying hard to help with the ecosystem security but I mean we cannot answer for them. If there 00:44:08.613-->00:00:00.000 are no more questions thank you very much. [Applause]