00:00:00.033 --> 00:00:03.504 I'm Tony Trummer. This is my colleague, Tusher Dalvi. Were 00:00:03.504 --> 00:00:07.040 both penetration testers at LinkedIn. First of all we want 00:00:07.040 --> 00:00:11.845 to thank everyone at DefCon for inviting us to speak here and 00:00:11.845 --> 00:00:18.519 putting on this event every year that all of us love. So to keep 00:00:18.519 --> 00:00:21.522 our suits happy at our company, obviously our opinions are our 00:00:21.522 --> 00:00:24.558 own and don't reflect those of our employer. Jumping right in, 00:00:24.558 --> 00:00:29.363 the reason we're here today is to introduce a tool we've 00:00:29.363 --> 00:00:32.065 developed called QARK. It stands for the quick Android review 00:00:32.065 --> 00:00:37.037 kit. We decided to build QARK after surveying all the open 00:00:37.037 --> 00:00:40.741 source tools available for Android application security, 00:00:40.741 --> 00:00:44.478 and feeling more could be done. So we took ideas from the best 00:00:44.478 --> 00:00:48.448 of them, added some things we think are innovative and duct 00:00:48.448 --> 00:00:51.351 taped it all together with some poorly written Python, at least 00:00:51.351 --> 00:00:56.456 the parts I wrote anyway. The results are in automatic -- 00:00:56.456 --> 00:01:01.795 excuse me, an automated static code analysis tool, and attack 00:01:01.795 --> 00:01:04.998 framework for auditing and exploiting Android applications. 00:01:07.200 --> 00:01:10.203 The reason for building the tool was obviously to secure our own 00:01:10.203 --> 00:01:13.640 applications, first and foremost. But we wanted to share 00:01:13.640 --> 00:01:16.643 what we built in order to help raise the bar for Android 00:01:16.643 --> 00:01:20.347 application security overall. After all, the less vulnerable 00:01:20.347 --> 00:01:23.483 apps there are in the world, the less we have to worry about in 00:01:23.483 --> 00:01:27.988 our apps from them attacking us and obviously the safer all of 00:01:27.988 --> 00:01:32.359 us Android users will be in general. One of QARK's key 00:01:32.359 --> 00:01:36.463 objectives is to provide users with informative, authoritative 00:01:36.463 --> 00:01:40.300 sources of information, so if they're not familiar with 00:01:40.300 --> 00:01:43.670 Android apps, they can learn and then subsequently teach others 00:01:43.670 --> 00:01:47.741 around them about potential security issues. Again, we're 00:01:47.741 --> 00:01:50.410 trying to increase the collective knowledge around 00:01:50.410 --> 00:01:54.815 Android application security. We wanted to make QARK available to 00:01:54.815 --> 00:01:58.919 every one. If you're one of those one person shops, you can 00:01:58.919 --> 00:02:02.389 assure your apps are secure, even if you have no security 00:02:02.389 --> 00:02:05.726 budget, no security team whatsoever. We're sure there are 00:02:05.726 --> 00:02:12.065 some big names code analysis could buy, as good or not -- 00:02:12.065 --> 00:02:16.803 maybe better job than we do. But QARK is free and you can always 00:02:16.803 --> 00:02:19.406 use that first and see where you stand and move on if you need 00:02:19.406 --> 00:02:23.844 to. We don't require any complex setup. There's no consultants 00:02:23.844 --> 00:02:29.249 have to come to integrate SCLC. As you'll see, we've got some 00:02:29.249 --> 00:02:31.718 features that aren't available in other tools that we know of, 00:02:31.718 --> 00:02:37.457 and using QARK is simple as could be. So obviously we're not 00:02:37.457 --> 00:02:40.360 the only people interested in protecting Android applications, 00:02:40.360 --> 00:02:44.631 so we figured by open sourcing QARK, not only would other 00:02:44.631 --> 00:02:47.567 people get to benefit from it, but all of you could help 00:02:47.567 --> 00:02:51.805 contribute back to it to make it even better. So if we fail to 00:02:51.805 --> 00:02:54.608 look for a bug that you know of, maybe we didn't write the check 00:02:54.608 --> 00:02:59.579 right or maybe idiots in some other fashion, let us know, and 00:02:59.579 --> 00:03:04.217 we'll fix it, add it, modify, whatever. If you're a developer 00:03:04.217 --> 00:03:07.487 who isn't scared to look at my sacrilegious python code, we 00:03:07.487 --> 00:03:12.726 encourage you to go ahead and directly improve it and lastly 00:03:12.726 --> 00:03:15.862 we hope that some people might look and say, hey, if these two 00:03:15.862 --> 00:03:18.198 guys can build in a couple of months, maybe we can do 00:03:18.198 --> 00:03:21.034 something on our side. We think it would be awesome if the app 00:03:21.034 --> 00:03:25.205 store owners across the world would possibly scan applications 00:03:25.205 --> 00:03:28.742 before allowing them into the stores, notifying the 00:03:28.742 --> 00:03:31.411 developers, possibly the security teams and ideally the 00:03:31.411 --> 00:03:35.148 consumers about potential security risks associated with 00:03:35.148 --> 00:03:38.018 that application. Although the latter is probably a bit of a 00:03:38.018 --> 00:03:43.957 fantasy. So what are the top issues in Android Ecosystem? 00:03:43.957 --> 00:03:48.061 Primarily, unfortunately, the number one issue is completely 00:03:48.061 --> 00:03:52.499 out of our hands and that's the fragmentation. Due to a finger 00:03:52.499 --> 00:03:56.136 pointing and failure to act on the parts of the OEMs, the 00:03:56.136 --> 00:04:00.273 carriers, the Googles, et cetera, we're left with a world, 00:04:00.273 --> 00:04:03.076 somebody go out and buy a device today that's vulnerable to 00:04:03.076 --> 00:04:06.379 Stagefright and other vulnerabilities and may remain 00:04:06.379 --> 00:04:09.749 that way for years and may be no way for them to get a timely 00:04:09.749 --> 00:04:14.688 update if even one exists. So bad customers have actually 00:04:14.688 --> 00:04:17.257 resorted to class action lawsuits to these different 00:04:17.257 --> 00:04:21.394 entities just to try to get updates. I'm not going to pine 00:04:21.394 --> 00:04:23.697 on that, you can ask yourself, what does it say about the 00:04:23.697 --> 00:04:26.600 prioritization of security when those are the links the 00:04:26.600 --> 00:04:32.606 customers have to go to just to get a fucking update. [Laughter] 00:04:32.606 --> 00:04:34.774 Flipside of this is of course, you can't rely on the users to 00:04:34.774 --> 00:04:39.513 necessarily update the OS or the apps themselves. So as a 00:04:39.513 --> 00:04:42.115 producer of mobile applications, may inadvertently shift a 00:04:42.115 --> 00:04:46.787 vulnerable app, only to cross your fingers or pray for some 00:04:46.787 --> 00:04:51.658 sort of mitigation on the server side for months or even possibly 00:04:51.658 --> 00:04:55.529 years after you've already fixed it, just because you have users 00:04:55.529 --> 00:04:59.232 who are slow to update. So all this really puts a premium on 00:04:59.232 --> 00:05:04.971 getting it right the first time every time. Another very common 00:05:04.971 --> 00:05:08.275 issue with Android apps, researchers are constantly 00:05:08.275 --> 00:05:11.645 finding that they're failing to validate X509 certificates, when 00:05:11.645 --> 00:05:13.647 theyre doing TOS handshaking. Countless apps vulnerable to man 00:05:13.647 --> 00:05:20.620 in the middle attacks and plenty that say screw it and don't use 00:05:20.620 --> 00:05:25.692 TLS at all. Frequent use of web use, which are those mini 00:05:25.692 --> 00:05:30.096 browsers inside of your apps, still vulnerable to most, if not 00:05:30.096 --> 00:05:33.266 all of the OS top ten legacy bugs, you know cross side 00:05:33.266 --> 00:05:35.268 scripting, cross side [indiscernible] et cetera. But 00:05:35.268 --> 00:05:40.974 there are some unique twists and thankfully there are some 00:05:40.974 --> 00:05:44.444 limitations. But in this world, we have to assume that all the 00:05:44.444 --> 00:05:46.680 apps on the device could potentially be malicious as 00:05:46.680 --> 00:05:49.850 well, so we're operating in an environment where they may pass 00:05:49.850 --> 00:05:53.653 tainted data into our applications, via these various 00:05:53.653 --> 00:05:59.426 IPC mechanisms to attack our applications. So if we care 00:05:59.426 --> 00:06:02.762 about our users, we additionally have to put in mitigation 00:06:02.762 --> 00:06:05.899 sometimes to protect them from bugs in underlying operating 00:06:05.899 --> 00:06:10.437 system again due to the fragmentation of the ecosystem 00:06:10.437 --> 00:06:14.574 as we mentioned earlier. So when I grew up in IT, we had a 00:06:14.574 --> 00:06:17.344 saying, which was -- if you lose physical control of your 00:06:17.344 --> 00:06:21.615 computer, it's no longer your computer, right? The reality is, 00:06:21.615 --> 00:06:24.351 that that expectation no longer holds for mobile devices due to 00:06:24.351 --> 00:06:28.555 the increased likelihood they might be lost, stolen or subject 00:06:28.555 --> 00:06:32.826 to law enforcement snooping. Despite strides towards 00:06:32.826 --> 00:06:37.330 improving physical security on Android devices, again, mostly 00:06:37.330 --> 00:06:40.667 due to fragmentation, we're not currently at a point where we 00:06:40.667 --> 00:06:44.004 can say that all devices require strong authenticators or make 00:06:44.004 --> 00:06:48.808 use of full disk encryption. Unfortunately many applications 00:06:48.808 --> 00:06:53.680 continue to store PIA -- excuse me, PII, other data, 00:06:53.680 --> 00:06:58.084 unnecessarily, within the client even after you log out, simply 00:06:58.084 --> 00:07:01.421 because they don't make another network request. Which is often 00:07:01.421 --> 00:07:06.259 not a worth while trade out from a security perspective. Finally 00:07:06.259 --> 00:07:08.862 we have special developers who can't seem to get their head 00:07:08.862 --> 00:07:12.332 around the fact that these apps are all reversable, anything you 00:07:12.332 --> 00:07:19.172 put in will eventually be found by an attacker. Keys, et cetera. 00:07:19.172 --> 00:07:23.777 So numerous countless -- excuse me, countless publicly reported 00:07:23.777 --> 00:07:27.080 bugs with people hard coding secrets and stuff into mobile 00:07:27.080 --> 00:07:32.018 applications, and while QARK does look for some of these as 00:07:32.018 --> 00:07:35.555 our -- one of our -- colleagues stated, these bugs are kind of 00:07:35.555 --> 00:07:40.827 lame, so not really the primary focus of what QARK is. Why do we 00:07:40.827 --> 00:07:43.963 go through all the work of creating and open sourcing a 00:07:43.963 --> 00:07:48.168 security tool for Android? Fundamentally most pentesters 00:07:48.168 --> 00:07:51.237 are lazy and once we know something, we don't want to have 00:07:51.237 --> 00:07:53.606 to keep redoing the same thing over and over again, right? So 00:07:53.606 --> 00:07:56.176 we want to automate it. We want to get back to doing other more 00:07:56.176 --> 00:08:02.182 important stuff, right? Much of QARK is based around the manual 00:08:02.182 --> 00:08:06.319 security process we used to do, but with some added features 00:08:06.319 --> 00:08:08.421 that make validation of vulnerabilities a lot easier. 00:08:10.857 --> 00:08:13.760 Apparently our crazy boss expects that every time we ship 00:08:13.760 --> 00:08:15.762 an app it's free of vulnerabilities before it 00:08:15.762 --> 00:08:21.334 reaches our members devices. Pretty crazy, right? Many of the 00:08:21.334 --> 00:08:26.106 apps we publish are -- sorry, with as many apps as we publish, 00:08:26.106 --> 00:08:29.342 associated updates, stream of work for reviews would be quite 00:08:29.342 --> 00:08:31.644 heavy if we were actually try to do this manually for every 00:08:31.644 --> 00:08:34.381 integration right? So if we're going to review every line of 00:08:34.381 --> 00:08:40.086 code for each release, we'd be swamped with doing nothing but 00:08:40.086 --> 00:08:43.289 that. So we wanted to be more agile and mirror the case of 00:08:43.289 --> 00:08:49.262 development in our company. Everybody knows developers are 00:08:49.262 --> 00:08:52.432 some of the laziest creatures on the planet and normally this is 00:08:52.432 --> 00:08:56.603 just annoying, right? But when faced with those nagging 00:08:56.603 --> 00:08:59.305 warnings from IDEs or compilers about something they're doing 00:08:59.305 --> 00:09:03.042 wrong from security perspective, what do they do? They turn it 00:09:03.042 --> 00:09:07.914 off, right, and drive on. What I've read, the go to -- go to 00:09:07.914 --> 00:09:12.185 fail bug never would have happened if developer hadn't 00:09:12.185 --> 00:09:16.322 done exactly that. Point being we can't rely solely on 00:09:16.322 --> 00:09:19.959 potentially false assumption that these checks are in place 00:09:19.959 --> 00:09:22.829 and being acted upon accordingly during the development process. 00:09:26.766 --> 00:09:29.803 As I mentioned earlier, once we understand a bug and get it 00:09:29.803 --> 00:09:33.573 fixed, we want to automate it out of existence, right? If 00:09:33.573 --> 00:09:36.309 there's one thing we can't stand is a repeating bug or a bug that 00:09:36.309 --> 00:09:41.781 gets reintroduced as a regression. Lastly, many widely 00:09:41.781 --> 00:09:44.284 installed apps are developed by these very small companies, 00:09:44.284 --> 00:09:47.120 Flappy Birds or something like that, that just goes viral and 00:09:47.120 --> 00:09:50.290 catches on and ends up on millions of devices, with no 00:09:50.290 --> 00:09:53.293 consideration for security whatsoever. Not saying anything 00:09:53.293 --> 00:09:57.430 about Flappy Birds specifically, just an example. Potential 00:09:57.430 --> 00:10:01.201 vulnerable applications however somewhere down the road may 00:10:01.201 --> 00:10:05.305 integrate with an application like yours or mine, right, it 00:10:05.305 --> 00:10:09.209 might be important for us those are secure. Ultimately they 00:10:09.209 --> 00:10:12.879 could put our member data at risk, either because they're a 00:10:12.879 --> 00:10:16.649 platform for attack or because a [indiscernible] to us or 00:10:16.649 --> 00:10:22.655 something like that. So under the hood of QARK -- sorry. To 00:10:25.725 --> 00:10:28.862 deal with all these issues that we talked about, we decided to 00:10:28.862 --> 00:10:33.566 create QARK and it grew very organically using the very 00:10:33.566 --> 00:10:36.202 rigorous but less known, oh yeah we should add that too, 00:10:36.202 --> 00:10:40.039 development model. We didn't necessarily reinvent the wheel 00:10:40.039 --> 00:10:43.243 for basic functionalities but chose instead to leverage what 00:10:43.243 --> 00:10:46.346 already was available. We happened to luck out and find a 00:10:46.346 --> 00:10:51.017 Java token library, called POLIJ, we used to process the 00:10:51.017 --> 00:10:55.021 Java files which make up the QARK component of most Android 00:10:55.021 --> 00:11:01.027 applications. It has certain problems with Android constructs 00:11:01.027 --> 00:11:04.764 but for the most part it was functioning very well and best 00:11:04.764 --> 00:11:08.601 thing we could find at the time. So we also used common things 00:11:08.601 --> 00:11:12.038 like Beautiful Soup, and many dominant XLR files and again all 00:11:12.038 --> 00:11:14.741 glued together, with some poorly written python. And you'll 00:11:14.741 --> 00:11:18.177 notice that we used several different decompilers, I'll let 00:11:18.177 --> 00:11:22.382 Tusher explain this to you, which is one of the interesting 00:11:22.382 --> 00:11:26.619 parts about QARK, and lastly, we do implement the -- or 00:11:26.619 --> 00:11:30.690 instrument the Android SDK in exploitation phase, which Tusher 00:11:30.690 --> 00:11:35.528 will demonstrate for you shortly. If you have no idea 00:11:35.528 --> 00:11:38.264 what an Android application is built of, this is it in a 00:11:38.264 --> 00:11:45.471 nutshell. Essentially APK files, just a compressed archive 00:11:45.471 --> 00:11:47.507 consisting of the directories and resources listed here. 00:11:47.507 --> 00:11:52.545 Slightly abbreviated, prettier slides. Many have actual 00:11:52.545 --> 00:11:55.782 relevance to security one way or another but QARK mainly focuses 00:11:55.782 --> 00:12:00.253 at the two top center, Android manifest XML eventually the 00:12:00.253 --> 00:12:05.692 classes text file. Heart of the Android application. For those 00:12:05.692 --> 00:12:08.962 that don't know, the Android manifest XML it defines all the 00:12:08.962 --> 00:12:11.831 app's capabilities and components, we'll discuss 00:12:11.831 --> 00:12:14.934 shortly. Whether app can be debugged, whether a person with 00:12:14.934 --> 00:12:19.973 physical access can create a backup of it, of the data, which 00:12:19.973 --> 00:12:25.211 permissions it uses or declares and the versions of Android that 00:12:25.211 --> 00:12:31.217 the app was built to run on, which you'll see is important to 00:12:31.217 --> 00:12:35.722 how the app needs to be protected. So to begin testing 00:12:35.722 --> 00:12:38.625 an already built Android app, the normal process is you'd have 00:12:38.625 --> 00:12:42.095 to reverse it, right? We used to have to use APK tool to extract 00:12:42.095 --> 00:12:45.832 the manifest and decompress the archive. Once we decompressed, 00:12:45.832 --> 00:12:48.668 wed have access to the classes text file, but we -- 00:12:48.668 --> 00:12:53.172 which is downloaded by code, not human readable. And then we used 00:12:53.172 --> 00:12:57.543 to have to convert that to .jar file containing Java by code and 00:12:57.543 --> 00:13:01.381 use GUI, to retrieve the underlying Java classes and 00:13:01.381 --> 00:13:03.383 wed finally get back to something very similar to what 00:13:03.383 --> 00:13:06.519 the developer had originally wrote. That is assuming 00:13:06.519 --> 00:13:10.790 decompiler did an adequate job. Don't worry if you didn't take 00:13:10.790 --> 00:13:13.993 notes on anything, because now that we've covered all of it, 00:13:13.993 --> 00:13:19.532 you never have to do any again. So the days of manually 00:13:19.532 --> 00:13:22.201 reversing Android apps are officially over as far as we're 00:13:22.201 --> 00:13:25.805 concerned. QARK handles that for you, and can pull the APK off 00:13:25.805 --> 00:13:30.443 the device for you, you don't have to know how to use ADB. And 00:13:30.443 --> 00:13:32.812 if you don't know how to use ADB don't worry because QARK also 00:13:32.812 --> 00:13:36.516 helps teach you that along the way as well. Yes, we Googled it 00:13:36.516 --> 00:13:42.555 all for you. So these features alone are reason enough to find 00:13:42.555 --> 00:13:45.892 QARK useful but once it's acquired and decompressed the 00:13:45.892 --> 00:13:49.762 APK, it quickly parses the manifest looking for 00:13:49.762 --> 00:13:52.532 vulnerability or potential vulnerabilities and immediately 00:13:52.532 --> 00:13:55.134 reports any findings but I'll let Tusher show you all that 00:13:55.134 --> 00:13:59.872 cool stuff. Functionality is similar to but we feel 00:13:59.872 --> 00:14:04.277 improvement upon the attack service functionality offered 00:14:04.277 --> 00:14:09.582 some other Android tools. QARK does factor in the permissions 00:14:09.582 --> 00:14:13.219 for specific vulnerabilities, et cetera, let you know how your 00:14:13.219 --> 00:14:16.155 app will be vulnerability on the specific API levels you choose 00:14:16.155 --> 00:14:21.861 to support. Of course, before you can properly audit an 00:14:21.861 --> 00:14:25.198 application, you have to know what the potential sources of 00:14:25.198 --> 00:14:27.200 tainted data are, right? We have tainted data in every 00:14:27.200 --> 00:14:34.574 applications that come from malicious site, web view content 00:14:34.574 --> 00:14:39.412 or URLs, and also the potential for IPC base attacks originating 00:14:39.412 --> 00:14:43.883 from malicious apps on the same device. These primarily come in 00:14:43.883 --> 00:14:45.885 the form of intents, but possible [indiscernible] 00:14:45.885 --> 00:14:50.656 messages or possibly in AIL. Each of these along with 00:14:50.656 --> 00:14:53.726 insecure network requests I mentioned earlier can carry 00:14:53.726 --> 00:14:58.531 potentially harmful data, cause data leakage from your 00:14:58.531 --> 00:15:03.035 application, or invoke unwanted application of actions in your 00:15:03.035 --> 00:15:08.608 application. Quickly going over the components. After reversing 00:15:08.608 --> 00:15:12.178 the app and inspecting the manifest, review would usually 00:15:12.178 --> 00:15:15.782 start by looking at these, specifically the exported 00:15:15.782 --> 00:15:18.417 components, exported means they're available for other apps 00:15:18.417 --> 00:15:24.490 to talk to on the device. Via these vary mechanisms we just 00:15:24.490 --> 00:15:27.226 spoke about. Reviewing the different component types, we 00:15:27.226 --> 00:15:30.163 have activities, services, providers and receivers. 00:15:30.163 --> 00:15:32.365 Quickly, activities are all the visual screens that you see, 00:15:32.365 --> 00:15:36.335 little things you tap on. Services, long lived, run in the 00:15:36.335 --> 00:15:40.206 background, do backgroundy, servicey, things. Providers, 00:15:40.206 --> 00:15:43.309 facilitate access to files or databases and receivers 00:15:43.309 --> 00:15:47.513 basically just hang around and wait for something to pop open. 00:15:47.513 --> 00:15:50.516 Each of these have listed lifecycle methods, which we 00:15:50.516 --> 00:15:55.087 refer to as entry points, that execute various times during the 00:15:55.087 --> 00:15:58.257 application lifecycle, depending on what the app is doing in -- 00:15:58.257 --> 00:16:02.395 what it's -- what you're doing in the app, what the app is 00:16:02.395 --> 00:16:06.299 doing in the background or what data it may be receiving, system 00:16:06.299 --> 00:16:09.202 or other applications. In particular, each has a primary 00:16:09.202 --> 00:16:12.572 method or methods, such as on create, where another 00:16:12.572 --> 00:16:16.609 application can pass data in usually be an intent and since 00:16:16.609 --> 00:16:18.878 this data can be malicious, it can cause undesired 00:16:18.878 --> 00:16:22.448 consequences, so we begin our examination of flows there. 00:16:22.448 --> 00:16:24.684 Basics, go what makes QARK unique. Unlike some Android 00:16:24.684 --> 00:16:27.320 security tools we've seen, QARK doesn't stop at the manifest. 00:16:27.320 --> 00:16:30.089 Once we've defined the attack surface, QARK begins trying to 00:16:30.089 --> 00:16:34.193 tie it all together. It takes the information from the 00:16:34.193 --> 00:16:39.699 manifest and then finds the classes which MAP to the 00:16:39.699 --> 00:16:46.038 vulnerable components. For those that dont know, theres a 00:16:46.038 --> 00:16:49.575 direct relationship between the components named in the Android 00:16:49.575 --> 00:16:53.913 manifest XML, and the underlying class files. So for example, if 00:16:53.913 --> 00:16:56.949 you were to have a food activity declared in the manifest, you 00:16:56.949 --> 00:17:02.255 would find a food activity.Java file in the project. From here, 00:17:02.255 --> 00:17:04.790 begins parsing all the classes and locating all those entry 00:17:04.790 --> 00:17:08.394 point methods that we covered, and as again, these are the 00:17:08.394 --> 00:17:11.264 places potentially tainted data can get into your application. 00:17:13.966 --> 00:17:16.736 Once we've identified the sources of tainted data, we 00:17:16.736 --> 00:17:19.372 attempt to follow them through the code, looking for wherever 00:17:19.372 --> 00:17:22.575 it passes through, what we would consider to be a sensitive sync. 00:17:22.575 --> 00:17:24.844 Essentially we're looking for anything that performs an action 00:17:24.844 --> 00:17:28.514 that could have negative results for the application or user, 00:17:28.514 --> 00:17:30.883 such as retrieving, modifying, or accessing -- or excuse me. 00:17:30.883 --> 00:17:32.885 Retrieving, modifying, or writing data, or accessing 00:17:32.885 --> 00:17:39.926 sensitive device functionality, which would normally require 00:17:39.926 --> 00:17:47.600 permission. Since not all the vulnerabilities are evident from 00:17:47.600 --> 00:17:51.938 the outside in, QARK continues examination process by looking 00:17:51.938 --> 00:17:55.741 for issues which originate from the app itself such as a web 00:17:55.741 --> 00:17:59.779 view configurations, data sent from the app, such as broadcast 00:17:59.779 --> 00:18:02.248 intents, which gets sent out to all the apps on the device, 00:18:02.248 --> 00:18:07.019 anybody who wants to listen. Sticky broadcasts, which are 00:18:07.019 --> 00:18:14.093 basically the same, except they remain persistent for some time. 00:18:14.093 --> 00:18:19.465 And pending -- possibly insecure pending intents, which can allow 00:18:19.465 --> 00:18:24.971 another app to use your UID and permissions. For web view 00:18:24.971 --> 00:18:28.874 issues, QARK also includes HTML files to demonstrate 00:18:28.874 --> 00:18:31.744 vulnerabilities or configuration issues, to allow you to load 00:18:31.744 --> 00:18:33.746 them locally or load them yourselves, if you don't trust 00:18:33.746 --> 00:18:35.748 us. Include links to our site, if you do trust us. Where we 00:18:35.748 --> 00:18:37.950 host them, in case you can't host them to yourselves for some 00:18:37.950 --> 00:18:43.956 reason. With that, Tusher, will show you what QARK does. >> 00:18:46.826 --> 00:18:52.832 Thanks, Tony. [ Applause ] Can you guys read on the screen, or 00:19:13.486 --> 00:19:19.492 do you want a bigger font? Good? >> You're going to get lots of 00:19:22.561 --> 00:19:28.534 colors. >> Okay, so before we begin the demo, let me talk a 00:19:28.534 --> 00:19:32.338 little bit about the insulation process. We tried to keep it 00:19:32.338 --> 00:19:35.941 fairly self contained in the sense that all of the 00:19:35.941 --> 00:19:38.878 [indiscernible] are included by default when you download the 00:19:38.878 --> 00:19:41.714 source. So that being said, the only thing that you need to 00:19:41.714 --> 00:19:44.917 provide as part of the setup is the location to the Android. So 00:19:44.917 --> 00:19:48.954 if you are an Android developer, you already have [indiscernible] 00:19:48.954 --> 00:19:53.025 on the system, so you can just run the front location of the 00:19:53.025 --> 00:19:56.996 tool, and you're ready to go. And if you do not know what 00:19:56.996 --> 00:19:59.698 specific Android components are needed in order to use QARK, 00:19:59.698 --> 00:20:04.470 don't worry, QARK will actually download the file for you and 00:20:04.470 --> 00:20:08.107 it's also going to see -- configuration file, so that you 00:20:08.107 --> 00:20:10.209 don't have to repeat this process every time you run the 00:20:10.209 --> 00:20:16.348 tool. So that brings -- we only support MAC and Linux right now, 00:20:16.348 --> 00:20:19.351 so if you are on Windows, we recommend running a 00:20:19.351 --> 00:20:23.289 [indiscernible] and if you want to compute the patch to run on 00:20:23.289 --> 00:20:28.360 Windows, we are more than happy to include it. So just run QARK, 00:20:28.360 --> 00:20:35.167 and as QARK starts, you notice quite simple. So at the starting 00:20:35.167 --> 00:20:41.040 point, give you two options. We can either start from an APK or 00:20:41.040 --> 00:20:45.511 a raw source code so in both cases, the QARK does the same. 00:20:45.511 --> 00:20:49.715 The owner, two different options, so that, let's say, if 00:20:49.715 --> 00:20:52.218 you are a developer and you want to run checks on your Android 00:20:52.218 --> 00:20:55.654 application, as you keep adding more checks to the application, 00:20:55.654 --> 00:21:00.459 then youll probably start scanning the source code. If you 00:21:00.459 --> 00:21:05.898 are an auditor or let's say a penetration tester for company, 00:21:05.898 --> 00:21:09.735 or maybe you want o get a list of the attacks you can start 00:21:09.735 --> 00:21:16.175 with the APK. So a demo, let's take this APK for now. So at 00:21:16.175 --> 00:21:20.012 this point, QARK will ask you for the location to the APK. So 00:21:20.012 --> 00:21:23.415 this would be either off the device system or you can also 00:21:23.415 --> 00:21:28.420 pull it off of the device. And it actually comes very handy, 00:21:28.420 --> 00:21:32.324 and you do not have the app listed on the app store. For 00:21:32.324 --> 00:21:38.764 example, applications, come installed on your devices. So 00:21:38.764 --> 00:21:44.537 let's go ahead and pull the APK off the device. So QARK going to 00:21:44.537 --> 00:21:49.542 do, connect device to computer, which I have. It's going to take 00:21:49.542 --> 00:21:54.213 a list of all the applications that are there on the device. 00:21:54.213 --> 00:22:00.286 And you can select the APK that you want. So since we don't want 00:22:00.286 --> 00:22:03.656 to get sued, and we don't want to draw up on anybody's Android 00:22:03.656 --> 00:22:08.794 application, we're going to choose the [indiscernible] 00:22:08.794 --> 00:22:13.098 application. So for those of you who do not know what this is, 00:22:13.098 --> 00:22:15.968 it's essentially an Android application [indiscernible] when 00:22:15.968 --> 00:22:22.808 the link isnt there or educational purposes. So once we 00:22:22.808 --> 00:22:28.113 do that, it's going to deflate the APK, and read the manifest, 00:22:28.113 --> 00:22:32.284 so if you guys have ever decomposed an APK, youll 00:22:32.284 --> 00:22:35.054 realize that the Android manifest, does not directly use 00:22:35.054 --> 00:22:38.123 a readable format so we give easy option to inspect the 00:22:38.123 --> 00:22:43.329 manifest and it's just going to display the contents of the 00:22:43.329 --> 00:22:50.002 manifest. So Android manifest is the most important part of the 00:22:50.002 --> 00:22:53.572 APK or most interesting part because it kind of gives you an 00:22:53.572 --> 00:22:56.675 idea what's within the application, right? So you can 00:22:56.675 --> 00:23:01.080 see what kind of associates, activities, receivers, you know, 00:23:01.080 --> 00:23:03.582 everything that's there, what kind of permissions are required 00:23:03.582 --> 00:23:07.586 by the application to run correctly, or what permissions 00:23:07.586 --> 00:23:09.588 required by the other applications to invoke some 00:23:09.588 --> 00:23:15.194 components from within your application. You have things 00:23:15.194 --> 00:23:17.196 like [indiscernible] diversion, target [indiscernible] 00:23:17.196 --> 00:23:20.299 diversion, a bunch of other things. For example, one 00:23:20.299 --> 00:23:26.805 versions of Android OS on which application may eventually land, 00:23:26.805 --> 00:23:30.409 right? So if you do not know what to make sense, don't worry. 00:23:30.409 --> 00:23:33.045 QARK will find the attack service, the potential attack 00:23:33.045 --> 00:23:39.051 service, and load it for you. So most of inquiries are pretty 00:23:42.655 --> 00:23:46.492 much self-explanatory, and whenever possible will give you 00:23:46.492 --> 00:23:50.496 credible sources of information, which you can, you know, reach 00:23:50.496 --> 00:23:54.233 out to learn more about those kind of issues, so for example, 00:23:54.233 --> 00:23:58.871 you know debugger [indiscernible] which of course, 00:23:58.871 --> 00:24:02.241 you wouldn't want to do on your list of applications, you can 00:24:02.241 --> 00:24:07.146 also see a bunch of activities that are -- are not predicted by 00:24:07.146 --> 00:24:10.816 any functions and are marked exported. So we'll save this 00:24:10.816 --> 00:24:12.818 information for the [indiscernible]. Again, you can 00:24:12.818 --> 00:24:17.690 see a bunch of other services, and receivers that are not 00:24:17.690 --> 00:24:21.593 protected by permissions, so one of the other things as Tony 00:24:21.593 --> 00:24:26.098 mentioned QARK does, it's going to look for the minimum SDK 00:24:26.098 --> 00:24:30.803 version and based off of that, it's also going to recommend or 00:24:30.803 --> 00:24:33.305 show you a few other vulnerabilities that could exist 00:24:33.305 --> 00:24:37.376 outside your ecosystem. That may affect the integrity of the 00:24:37.376 --> 00:24:40.579 application. So, so far, so good, right? So in order to go 00:24:40.579 --> 00:24:43.949 in depth, we actually need access to the raw file 00:24:43.949 --> 00:24:47.319 ecosystem. If you started off with the .jar source code as the 00:24:47.319 --> 00:24:50.622 starting point, you are good to go, and in case of an APK 00:24:50.622 --> 00:24:56.562 [indiscernible] we actually need to reverse the text file to 00:24:56.562 --> 00:25:01.467 class and then class to .jar source code so automates this 00:25:01.467 --> 00:25:06.238 for you, and you see that we are running multiple decompilers on 00:25:06.238 --> 00:25:09.975 the same .jar file, and the reason for that is, you know, 00:25:09.975 --> 00:25:13.779 transfer particular decompiler may not be able to decompile all 00:25:13.779 --> 00:25:17.616 the files directly, where some decompiler may be able to 00:25:17.616 --> 00:25:23.055 decompile some of those files. So the idea here is because each 00:25:23.055 --> 00:25:26.291 compiler behaves in a predictable way, fact to 00:25:26.291 --> 00:25:30.429 identify which [indiscernible] and to see if some other 00:25:30.429 --> 00:25:33.432 decompiler was able to decompile those parts successfully. So 00:25:33.432 --> 00:25:41.440 it's going to take -- >>Sure. All right. >>So as can see, 00:25:41.440 --> 00:25:47.446 because of this technique, we were able to restore about 11 or 00:25:49.681 --> 00:25:55.687 13 files, and that's almost 85% in terms of recovery so we have 00:25:58.924 --> 00:26:03.061 list of potential attack, and now we have also stored to begin 00:26:03.061 --> 00:26:10.402 static code analysis. So all of the checks you see here are 00:26:10.402 --> 00:26:14.239 actual checks on the raw java source code to find those type 00:26:14.239 --> 00:26:18.610 of vulnerabilities, and you will see in a moment, going to be 00:26:18.610 --> 00:26:21.814 color coded to kind of give you a sense of what permissions we 00:26:21.814 --> 00:26:26.785 have in those [indiscernible]. So included in the checks are 00:26:26.785 --> 00:26:30.589 the standard Android security link checks, some research done 00:26:30.589 --> 00:26:35.427 by security researchers in the industry. And also some research 00:26:35.427 --> 00:26:40.866 that did on our own. Again, this list is not exhaustive and we 00:26:40.866 --> 00:26:44.603 are still adding more and more checks. We are more than happy 00:26:44.603 --> 00:26:48.907 to receive a patch and include it, and even if you guys have an 00:26:48.907 --> 00:26:52.644 APK, you can say, hey, guys, here's an APK this is the type 00:26:52.644 --> 00:26:56.582 of bug that we think QARK should be able to find, we'll write a 00:26:56.582 --> 00:27:02.521 patch for it. So all of the entries you see here, are 00:27:09.428 --> 00:27:11.864 actually the entry points we found from the manifest 00:27:11.864 --> 00:27:15.367 declaration and we are going to look for vulnerabilities in 00:27:15.367 --> 00:27:18.937 those files, or the other way around, which is, hey, we scan 00:27:18.937 --> 00:27:22.341 for these files, and we are sure there are no problems here, 00:27:22.341 --> 00:27:26.478 because sometimes essential to realize but if something was not 00:27:26.478 --> 00:27:29.181 acting as a vulnerability, because the file couldn't be -- 00:27:29.181 --> 00:27:34.520 properly or if -- but couldn't find any vulnerabilities in 00:27:34.520 --> 00:27:38.190 there. Right? So -- and we actually wanted to show you 00:27:38.190 --> 00:27:40.392 that, you know, this file is part of the attack surfers, 00:27:40.392 --> 00:27:44.696 because this is something that is accessible through other 00:27:44.696 --> 00:27:48.467 applications. So for example, you can see that theres an 00:27:48.467 --> 00:27:55.974 activity that's not predicted by permissions, method. So in 00:27:55.974 --> 00:27:58.744 short, we are [indiscernible] data to this similar 00:27:58.744 --> 00:28:01.313 application, speak with [indiscernible] again, we'll 00:28:01.313 --> 00:28:06.785 save this information for the exploration phase, and because 00:28:06.785 --> 00:28:09.855 we are not trying to sell you anything, we will not give you a 00:28:09.855 --> 00:28:11.857 false sense of security by hiding [indiscernible] in the 00:28:11.857 --> 00:28:16.495 application. So whenever there's a error, it will actually 00:28:16.495 --> 00:28:20.399 display on the terminal, so you can verify those files manually 00:28:20.399 --> 00:28:24.770 for any type of vulnerabilities, and these errors occur because 00:28:24.770 --> 00:28:28.307 of, you know, maybe there's an Android specific response, 00:28:28.307 --> 00:28:32.377 couldn't understand, or simply because the decompilation, if 00:28:32.377 --> 00:28:37.049 you started off with a raw java file as the starting point, then 00:28:37.049 --> 00:28:42.588 probably you wouldn't get these kind of pictures. So moving 00:28:42.588 --> 00:28:47.125 down, you can see that QARK has found potential vulnerability, 00:28:47.125 --> 00:28:50.662 and more than just saying what is wrong with the exploited 00:28:50.662 --> 00:28:54.700 component, we actually do a source specific mapping of the 00:28:54.700 --> 00:28:56.868 entire .java file, if you dont recognize and see if 00:28:56.868 --> 00:29:01.306 there's source mapping, and if it exists, you know, we turn it 00:29:01.306 --> 00:29:05.544 as a potential vulnerability. We also give you the details of 00:29:05.544 --> 00:29:10.082 what exactly do you need in order to explore this potential 00:29:10.082 --> 00:29:12.084 vulnerability? So for example, you would need to send 00:29:12.084 --> 00:29:14.086 [indiscernible] specific key of the type string, message, and 00:29:16.888 --> 00:29:24.630 [indiscernible] string, so keep saving this information for the 00:29:24.630 --> 00:29:28.700 exploration phase. Some of the other kind of issues that we can 00:29:28.700 --> 00:29:32.838 detect with QARK, certificate validation issues, give you 00:29:32.838 --> 00:29:38.076 credible source of information, whenever possible. There are few 00:29:38.076 --> 00:29:43.015 pending issues that we can see. The other type of issues that we 00:29:43.015 --> 00:29:47.019 can detect with QARK are insecure, deport configurations 00:29:47.019 --> 00:29:50.522 [indiscernible] issues for use, or if there are any security 00:29:50.522 --> 00:29:56.261 impacting configurations that were embedded in the first. So 00:29:56.261 --> 00:30:00.666 we break it down by file names, and we start all the 00:30:00.666 --> 00:30:04.603 configurations for that particular, so we'll see how we 00:30:04.603 --> 00:30:12.577 can use that in exploration phase. So at this point, this is 00:30:12.577 --> 00:30:16.248 something you can see with a bunch of other tools as well. 00:30:16.248 --> 00:30:20.686 The real question is, can a real world application actually 00:30:20.686 --> 00:30:24.556 exploit these abilities, so for this, we actually going to give 00:30:24.556 --> 00:30:28.326 you a couple of options. The first one is to use ADB 00:30:28.326 --> 00:30:32.064 commands. Whenever possible, give you specific Android ADB 00:30:32.064 --> 00:30:36.435 commands that it can run on your computer while your device is 00:30:36.435 --> 00:30:39.671 connected to it in order to see if you can exploit those 00:30:39.671 --> 00:30:43.542 vulnerabilities, so as you can see here, QARK has listed out a 00:30:43.542 --> 00:30:50.348 bunch of ADB commands that it can actually run. And wherever 00:30:50.348 --> 00:30:53.118 possible, for example, here, we are going to -- going to give 00:30:53.118 --> 00:30:57.456 you possible extras that you need to [indiscernible] in the 00:30:57.456 --> 00:31:00.525 intent in order to see you know, if you can do anything 00:31:00.525 --> 00:31:06.531 meaningful with that. At this point, all of this information 00:31:09.501 --> 00:31:15.507 can be seen here -- we create an HTML import, its probably too 00:31:21.480 --> 00:31:26.218 small to track it down, but on a regular screen you'll see, 00:31:26.218 --> 00:31:32.924 vulnerabilities, any warnings, debugs. Again, everything that 00:31:32.924 --> 00:31:39.231 you saw on the terminal can be found in the HTML artwork and 00:31:39.231 --> 00:31:43.034 its pretty self-explanatory. For example [indiscernible] 00:31:43.034 --> 00:31:45.971 vulnerabilities, and what exactly do you need in order to 00:31:45.971 --> 00:31:50.642 exploit it? And you notice that we actually turn everything else 00:31:50.642 --> 00:31:54.279 a [indiscernible] vulnerability and not a vulnerability, because 00:31:54.279 --> 00:31:56.281 we don't want [indiscernible] to be understood in the 00:31:56.281 --> 00:31:59.818 application, you know, to saying, hey, this is a 00:31:59.818 --> 00:32:02.921 vulnerability, go fix it. Actually give you the 00:32:02.921 --> 00:32:07.692 [indiscernible] to say whether it's vulnerable or not. So 00:32:07.692 --> 00:32:11.696 conveniently they speak everything as warnings, unless 00:32:11.696 --> 00:32:16.268 we deem it as potential vulnerability. So you have web 00:32:16.268 --> 00:32:21.039 issues, certificate web issues, all the ADB commands listed out 00:32:21.039 --> 00:32:24.876 here. I promise this looks better on a regular screen. 00:32:24.876 --> 00:32:32.384 Again, specific bugs, or processing errors, if any, so 00:32:32.384 --> 00:32:39.191 you can look for these -- but now for the fun part. So we are 00:32:39.191 --> 00:32:41.526 going to attempt what [indiscernible] has done until 00:32:41.526 --> 00:32:44.996 now, so we'll give you the option to create a custom APK 00:32:44.996 --> 00:32:49.401 exploitation, so we do that, and what it's going to do is we 00:32:49.401 --> 00:32:54.806 gathered all information from the manifest attack survers and 00:32:54.806 --> 00:32:58.810 we have the source to sync mapping from the raw java source 00:32:58.810 --> 00:33:02.347 script static analysis, so we are going to save this 00:33:02.347 --> 00:33:08.320 information and do a templated APK, and try to create an APK, 00:33:08.320 --> 00:33:12.390 deploy on the form in order to exploit the application that 00:33:12.390 --> 00:33:18.063 just about to test. So think of this as an evil twin for the 00:33:18.063 --> 00:33:23.501 application you're testing, and hopefully this should pair 00:33:23.501 --> 00:33:30.242 successfully. All right. So they said yes, want to install this 00:33:30.242 --> 00:33:36.248 device. And success. So Tony is now going to demonstrate the 00:33:42.187 --> 00:33:48.193 actual attack. >> Just so you don't think we're pulling 00:34:06.745 --> 00:34:10.181 shenanigans. We do have a live demo, we do have a recorded, if 00:34:10.181 --> 00:34:16.354 its either not visible or in case doesn't work for some 00:34:16.354 --> 00:34:22.360 reason. >>Can you guys >>So let it auto focus. Does it help? 00:34:39.177 --> 00:34:45.183 Is it better? Yay, demo win. [ Laughter ] You know what? I 00:34:56.928 --> 00:35:01.866 think it probably left the auto adjust on and readjusted once I 00:35:01.866 --> 00:35:07.672 took my finger off of it. So let's give it one more shot. Oh, 00:35:07.672 --> 00:35:11.376 you know what -- we actually had this blinder. >> Let's do this. 00:35:11.376 --> 00:35:16.047 >> We meant to do this. You're going to hold it? Feel so 00:35:16.047 --> 00:35:23.455 special. Okay. Better? Yeah. >> Start application 00:35:23.455 --> 00:35:30.428 [indiscernible] >> Okay. Okay. All you critics. Okay. So when 00:35:30.428 --> 00:35:32.897 you start up QARK, nothing interesting to see here, right? 00:35:32.897 --> 00:35:35.867 We have this drop down menu that shows you all of the different 00:35:35.867 --> 00:35:41.673 features. Sucks. Sucks. >> Let's -- >> We're going to go to the 00:35:41.673 --> 00:35:47.679 recorded demo and then we'll come back just to demo the 00:35:50.281 --> 00:35:56.221 actual exploitation thing. Okay. So this is much better right? 00:35:58.656 --> 00:36:01.793 Sorry, we luckily this was recorded like midnight last 00:36:01.793 --> 00:36:07.532 night. So good to go. [Laughter] Very well prepared. So anyway, 00:36:07.532 --> 00:36:12.971 okay. Again, blank screen, drop down menu. So first thing was 00:36:12.971 --> 00:36:19.377 the bottom, I'll have to wait around here. Pause. Ah! You 00:36:19.377 --> 00:36:24.749 bastard. [ Laughter ] Really come on. You can't be that 00:36:24.749 --> 00:36:30.755 difficult. Okay. So the very bottom menu item, one the play 00:36:34.392 --> 00:36:37.495 bar okay. So is -- I'm going to start in sort of like a 00:36:37.495 --> 00:36:42.267 reverse order, save the cool stuff last. The bottom thing is 00:36:42.267 --> 00:36:46.004 a send custom intend. Basically this is a tool anybody who is 00:36:46.004 --> 00:36:48.273 testing Android applications would need, right? You need to 00:36:48.273 --> 00:36:51.543 be able to modify things and maybe we just didn't pick it up 00:36:51.543 --> 00:36:53.912 quite right and you want to tweak some things and play 00:36:53.912 --> 00:36:58.817 around with different extras that we recorded and see -- do 00:36:58.817 --> 00:37:02.687 some other things other than what our automated test 00:37:02.687 --> 00:37:05.256 provides. Also, it makes it flexible so you don't 00:37:05.256 --> 00:37:09.494 necessarily have to uninstall it every time you test a new app, 00:37:09.494 --> 00:37:13.298 but obviously to get the full value of it, you want to do 00:37:13.298 --> 00:37:17.869 that. So in here, we have several fields that are required 00:37:17.869 --> 00:37:22.440 for most intents that you need to fill out. You know, there's 00:37:22.440 --> 00:37:26.978 the component name, the package, the intent action, and everybody 00:37:26.978 --> 00:37:30.081 knows typing on these things sucks, right? If you don't know, 00:37:30.081 --> 00:37:34.119 you can use ADB to actually push type keyboard commands into the 00:37:34.119 --> 00:37:37.388 phone so you don't have to actually manually type them, but 00:37:37.388 --> 00:37:41.593 if you must, we try to make it as easy as possible for you, so 00:37:41.593 --> 00:37:44.395 whenever possible, we have these fields that activate and 00:37:44.395 --> 00:37:47.499 prepopulated with the most common things you need to put in 00:37:47.499 --> 00:37:52.704 there, in the first place, just to save your thumbs. So you can 00:37:52.704 --> 00:37:55.840 see each of the categories are already there. Flags are already 00:37:55.840 --> 00:37:59.377 there. And the bottom we have this -- this intent extra 00:37:59.377 --> 00:38:02.480 section, so we will list out any intents that -- any intent 00:38:02.480 --> 00:38:05.216 extras that we're able to scrape out of the application in the 00:38:05.216 --> 00:38:08.052 report, so that you can play around with them, and then you 00:38:08.052 --> 00:38:10.455 can go ahead and put them in here and then try different 00:38:10.455 --> 00:38:14.259 values and whatever to go with them. If you need more, you 00:38:14.259 --> 00:38:18.029 press little plus sign there, and it will create another key 00:38:18.029 --> 00:38:21.533 value pair set that you can add to the extra. Once you're all 00:38:21.533 --> 00:38:26.905 done, you click the next button at the bottom there. And you get 00:38:26.905 --> 00:38:32.911 to this screen. So -- let's try this magic again. Come on just a 00:38:36.748 --> 00:38:42.754 little bit more. Play and Even recorded demos can have 00:38:45.723 --> 00:38:49.360 problems, right? And menu. All right. So different intents can 00:38:49.360 --> 00:38:54.465 invoke different actions in the application, give you this -- 00:38:54.465 --> 00:38:58.970 this drop down list to choose what exactly it is you're trying 00:38:58.970 --> 00:39:03.174 to do with the intent you're sending. For example, starting 00:39:03.174 --> 00:39:06.644 activity, will just open up the UI element if you start activity 00:39:06.644 --> 00:39:09.714 for result it will listen to see if anything was returned, which 00:39:09.714 --> 00:39:14.152 can be an information leakage bug or something like that. So 00:39:14.152 --> 00:39:18.857 anyway, once you're done filling out the fields and selecting the 00:39:18.857 --> 00:39:24.662 proper settings you go ahead and press send and of course, the 00:39:24.662 --> 00:39:27.966 out crashes. That's because we didn't put anything in there. 00:39:27.966 --> 00:39:31.269 It's not a bug. There's nothing -- that's the way Android 00:39:31.269 --> 00:39:35.607 handles when you send something that doesn't make any sense. So 00:39:35.607 --> 00:39:38.042 the next thing is, obviously, a file browser. You obviously need 00:39:38.042 --> 00:39:41.880 this to know if you want to look around, recorded some readable 00:39:41.880 --> 00:39:46.351 file or something on SD card you want to look at, basic that any 00:39:46.351 --> 00:39:53.157 Android tester would need. Glad I spent so much time 00:39:53.157 --> 00:39:59.897 demonstrating the files the next thing is web view tests. So 00:39:59.897 --> 00:40:03.468 these are not exploits, these are demonstrations of the 00:40:03.468 --> 00:40:09.240 configuration options for web view. Oh, thank you. What 00:40:09.240 --> 00:40:12.176 they're doing is just showing you what different features look 00:40:12.176 --> 00:40:15.513 like when they're turned on or turned off. Also, because it is 00:40:15.513 --> 00:40:18.249 version aware, you'll notice if you click into some, you'll 00:40:18.249 --> 00:40:20.652 actually see the application says, this is not the right 00:40:20.652 --> 00:40:27.158 version for this test. So these things include, like, whether or 00:40:27.158 --> 00:40:31.162 not JavaScript is enabled, umm -- >> Its going to take 00:40:31.162 --> 00:40:33.331 awhile. >>Okay. So this one tells you whether or not 00:40:33.331 --> 00:40:36.701 JavaScript is enabled, and then it demonstrates the difference, 00:40:36.701 --> 00:40:39.203 in the bottom left-hand corner, I don't know if you can see, 00:40:39.203 --> 00:40:43.341 click here, and I'm clicking it, nothing happening. Trying to run 00:40:43.341 --> 00:40:47.378 an alert box, in certain web views, the alert box doesn't 00:40:47.378 --> 00:40:51.649 work. It depends on what web view client you're using, right? 00:40:51.649 --> 00:40:54.919 If you're doing cross side scripting tests, you need to be 00:40:54.919 --> 00:40:58.690 aware of that. Where as if I go into the web Chrome client, same 00:40:58.690 --> 00:41:00.792 test, I click on it, it will show you the alerts enabled, 00:41:00.792 --> 00:41:07.265 right. It also -- that's a no script block, so if it were 00:41:07.265 --> 00:41:10.201 JavaScript or not enabled, you would see a different view, so 00:41:10.201 --> 00:41:16.708 it's just letting you know what it would look like. If you click 00:41:16.708 --> 00:41:19.010 on any of the ones that aren't applicable for the device -- 00:41:19.010 --> 00:41:23.715 yeah, the device you're on, it will tell you, this is not the 00:41:23.715 --> 00:41:25.883 right version for this test, because obviously you've been 00:41:25.883 --> 00:41:29.020 doing API version specific testing, you have to be on a 00:41:29.020 --> 00:41:31.689 device that matches the version you're trying to test the bug 00:41:31.689 --> 00:41:36.494 for, right. People will tell you tapjacking is not an issue in 00:41:36.494 --> 00:41:39.864 Android, but clearly it is. We stole this code from Invisium so 00:41:39.864 --> 00:41:43.935 thanks for publishing it so we can steal it. Basically you put 00:41:43.935 --> 00:41:48.773 a transparent overlay over things so you can see that. In 00:41:48.773 --> 00:41:51.376 fact we are overlaying over it and we can pass the touches 00:41:51.376 --> 00:41:55.046 through the application behind it. This is just very similar to 00:41:55.046 --> 00:41:58.750 click jacking on a website, right? You -- you put some sort 00:41:58.750 --> 00:42:02.553 of opaque overlay on an app and play a game and it's, you know, 00:42:02.553 --> 00:42:04.889 sending all their bank account information to you, or whatever, 00:42:04.889 --> 00:42:09.360 you want to do via tapjacking. So this is the most boring demo 00:42:09.360 --> 00:42:12.296 ever, and this is the intents server so background service 00:42:12.296 --> 00:42:15.833 that sits and listens for broadcasts from applications, so 00:42:15.833 --> 00:42:18.436 if it sends broadcast out, it's going to sit there and listen 00:42:18.436 --> 00:42:22.340 and unfortunately those are lifecycle events that don't 00:42:22.340 --> 00:42:25.943 always happen, so you have to just wait, so this -- there's 00:42:25.943 --> 00:42:29.981 nothing to show here. The cooler parts are the exported 00:42:29.981 --> 00:42:34.318 activities here, the exported components, so in this one, just 00:42:34.318 --> 00:42:39.190 pops open a UIL element nothing to see here, unless it's 00:42:39.190 --> 00:42:41.192 bypassing an off screen or something like that, probably 00:42:41.192 --> 00:42:44.195 not important. This is a log in one, but its a little bit 00:42:44.195 --> 00:42:46.597 different because there's actually a result from this one, 00:42:46.597 --> 00:42:50.568 and as you can see here, our application grabbed the session 00:42:50.568 --> 00:42:52.970 could be that was returned as part of the log in process 00:42:52.970 --> 00:42:56.541 because it was, as using the set result method to return that to 00:42:56.541 --> 00:43:02.480 the caller. Here there's a username that it asks for, and 00:43:04.715 --> 00:43:08.386 if you don't put anything in, nothing happens. So that's why 00:43:08.386 --> 00:43:10.388 it's important to know that there's these extras supposed to 00:43:10.388 --> 00:43:15.693 be there, so if you do submit the right extra, with a value, 00:43:15.693 --> 00:43:19.964 you'll see it returns the GPS location. So it's just showing 00:43:19.964 --> 00:43:24.769 you that context awareness is important, right? Finally we 00:43:24.769 --> 00:43:29.640 have a broadcast receiver. And this is where we would We 00:43:29.640 --> 00:43:32.910 dont actually have to put a phone number in here do we? >> 00:43:32.910 --> 00:43:35.046 Uhh Not necessary. >>Okay, so this is where we want to do the 00:43:35.046 --> 00:43:38.116 real demo part real quick. The only thing is, we know what you 00:43:38.116 --> 00:43:40.318 guys are going to do if we show you the phone number. [Laughter] 00:43:40.318 --> 00:43:45.423 So we don't want you guys texting us for like the next six 00:43:45.423 --> 00:43:49.227 months or something like that what -- what we did is, during 00:43:49.227 --> 00:43:55.299 the analysis phase, we derived the -- you want to put it in? We 00:43:55.299 --> 00:43:59.403 derived the fact that there is a -- an intent -- or a broadcast 00:43:59.403 --> 00:44:01.839 receiver that was listening for something that had a phone 00:44:01.839 --> 00:44:08.179 number and SMS message, as the parameters it was expecting. 00:44:08.179 --> 00:44:11.149 Provided that to you to fill in with whatever value you wanted 00:44:11.149 --> 00:44:13.751 to, and here Tusher trying to hide his phone number. [Phone 00:44:13.751 --> 00:44:19.790 Vibrate Alert Sound] And there you go. We were able to send a 00:44:19.790 --> 00:44:23.995 text message, the thing you might not be aware of, our app 00:44:23.995 --> 00:44:26.597 doesn't have the ability to send text messages. What its doing 00:44:26.597 --> 00:44:29.967 is its proxying through the other applications vulnerability 00:44:29.967 --> 00:44:37.608 to send the text message through it using its permissions, so -- 00:44:37.608 --> 00:44:42.647 I know we got to wrap up quick here. All right. Let's go back 00:44:42.647 --> 00:44:50.621 to this because I dont think we have time for anything else. 00:44:50.621 --> 00:44:55.660 Okay. So I think I got two minutes left. To recap some of 00:44:55.660 --> 00:44:58.229 the unique aspects of QARK, unlike any tools were aware 00:44:58.229 --> 00:45:02.199 of anyway, we do improve the chances of decompiling on the 00:45:02.199 --> 00:45:06.571 APK successfully using multiple decompilers, it builds an APK 00:45:06.571 --> 00:45:09.440 for manual testing, which includes some prebuilt 00:45:09.440 --> 00:45:13.210 functionalities that you'll need for any Android tests. Creates 00:45:13.210 --> 00:45:16.013 ADB commands so that you can demonstrate common 00:45:16.013 --> 00:45:20.918 vulnerabilities via SLI, and finally creates a custom built 00:45:20.918 --> 00:45:25.189 APK built to attack the one you're testing. We really wanted 00:45:25.189 --> 00:45:27.692 to stay away from the forensics analysis types things, this is 00:45:27.692 --> 00:45:31.329 kind of where we're headed. What I mean, this is where we're 00:45:31.329 --> 00:45:33.331 headed and we wanted to stay away from the forensics 00:45:33.331 --> 00:45:36.968 analysis, those bugs are kind of lame and usually a simple grep 00:45:36.968 --> 00:45:39.870 away. But if theres something you think we should include in 00:45:39.870 --> 00:45:44.542 that venue, just let us know, as long as it's not grep minus, 00:45:44.542 --> 00:45:50.915 password, we'd be happy to add it. QARK isn't yet a dynamic 00:45:50.915 --> 00:45:54.652 analysis tool. But that's simply due to time constraints, the 00:45:54.652 --> 00:45:57.788 entire thing was built in about three months, mostly in spare 00:45:57.788 --> 00:45:59.957 time, but with some gracious amounts of time from our 00:45:59.957 --> 00:46:03.294 employer. So forgive us if its not as perfect as should 00:46:03.294 --> 00:46:06.430 be. QARK has plenty of things to add in the future. Running out 00:46:06.430 --> 00:46:10.134 of time, so we do plan on planning dynamic analysis, small 00:46:10.134 --> 00:46:13.170 inspections for improved results, nonandroid specific 00:46:13.170 --> 00:46:17.174 Java vulnerabilities, ODEX support. We only want to make it 00:46:17.174 --> 00:46:20.111 more extensive for you all and were asking for your help, if 00:46:20.111 --> 00:46:23.514 you know of bugs, developer, whatever. Just if you know of a 00:46:23.514 --> 00:46:25.783 vulnerability, maybe an old app that you guys patched a long 00:46:25.783 --> 00:46:28.319 time ago and make sure we can check for it, let us know and 00:46:28.319 --> 00:46:32.823 well be more apt to. Thanks to NPWRA Labs for making Drozer, 00:46:32.823 --> 00:46:34.959 which is kind of the inspiration for this. Rocket Play Lab for 00:46:34.959 --> 00:46:38.062 the web exploits and Vizio for the time tracking code All the 00:46:38.062 --> 00:46:41.032 open source community for helping us. Jason Haddicks and 00:46:41.032 --> 00:46:44.168 other people for donating some vulnerability APKs for us to 00:46:44.168 --> 00:46:49.707 test on. Here's our contact information. And if you want, 00:46:49.707 --> 00:46:54.912 this will be on LinkedIn is GitHub Repo later on this week. 00:46:54.912 --> 00:47:00.851 So thanks a lot. [ Applause ]