Top8StepsForMobile AppAssessmentFocus Orlando

Presented by: Christopher Crowley

Presentation
Resource Thumbnail

The "Top 8 Steps for Mobile App Assessment" presentation focuses on eight core technical concepts for ensuring the security and compliance of mobile devices and applications. These concepts include enforcing strong passcodes for device authentication, monitoring mobile device usage, regularly updating and patching devices to prevent vulnerabilities, controlling physical access, and implementing incident response plans for lost or stolen devices. Additionally, the presentation highlights the importance of a structured approach to mobile app assessment, emphasizing the need for planning, execution, methodology, code review, IPC assessment, filesystem content review, and tool usage.

Full Transcript / Content

--- Page 1 --- Top 8 Steps for Mobile - Application Assessment Christopher Crowley @CCrowMontance All Rights Reserved All Wrongs Reversed --- Page 2 --- Top 8 Steps --- Page 3 --- Top 8 Mobile Device Security Steps 1. Enforce Device Passcode Authentication 2. Monitoring Mobile Device Access and Use 3. Patching Mobile Devices 4. Prohibit Unapproved Third-Party Application Stores 5. Control Physical Access 6. Evaluate Application Security Compliance 7. Prepare an Incident Response Plan for Lost or Stolen Mobile Devices 8. Implement Management and Operational Support --- Page 4 --- Each of These 8 Steps Are Important - Each step needs to be: - Considered - Planned - Executed - Maintained - We’ll focus on Application Assessment today - But there are plenty of other items for your mobile deployment --- Page 5 --- Application Assessment --- Page 6 --- Application Assessment Considerations --- Page 7 --- Consideration for Application Assessment - Consider what your objectives are: - Maintain access to organization data - Detect / Prevent loss of data - Detect / Prevent unauthorized modification to data - Leverage employee assets for work purposes? - Protect organizationally owned assets? - Assist employees to protect personal devices? --- Page 8 --- Application Assessment Planning --- Page 9 --- Planning – What is (Un)Acceptable - Two methods for app assessments - Thorough inspection of all app capabilities - Predetermined “red flags” which would prohibit use of application - Example: accesses contacts and copies them off device - Example: tracks location and sends off device - Example: access to photos / photo stream - Example: User login credentials sent in plain text (or logged) --- Page 10 --- Application Assessment Execution --- Page 11 --- Execution of Application Assessment - Technically involved - Even Apple and Google miss code included in applications - XCode Ghost is an example - Malicious library (with C2) included at compile time due to malicious XCode image from: https://www.fireeye.com/blog/threat-research/2015/11/xcodeghost_s_a_new.html --- Page 12 --- Methodology Helps Overcome Limitations - Having a repeatable methodology is helpful to minimize the effort, as well as help the assessor to be sure that important facets aren’t overlooked - It also helps to train the assessor --- Page 13 --- SANS SEC575 - Application Report Cards - https://github.com/joswr1ght/MobileAppReportCard.git --- Page 14 --- Application Report Cards - Report Cards address: - Permissions - Executable deficiencies - Local data storage and protection: - Confidentiality - Integrity - Protection of network communication - Inter-process communication --- Page 15 --- Assessment Legal Preface - Consult your legal counsel - However, the notion is that assessing an application (which was legally obtained) for suitability of interoperation within your network is legal - Do so for networks only where you have written permission to perform this type of analysis --- Page 16 --- Permission to Assess --- Page 17 --- Methodology – Network - Easiest to perform without specialized tools - Put the mobile device on a network, and monitor the communication through a laptop - Challenge – TLS protected communication - Challenge – interpreting hidden or obfuscated data - Challenge – application has a trigger condition which isn’t met in your testing, obscuring some undesirable but present behavior --- Page 18 --- Methodology – Network - Transparent firewall rules can direct traffic into a proxy - Or device can be configured to use a proxy --- Page 19 --- Methodology – Network - Proxy is transparently viewing (and can modify) the content --- Page 20 --- Methodology – Network - How to deal with TLS? - Easiest way is to include proxy’s certificate - Burp serves up a .der format file, so convert it openssl x509 –inform der –outform pem –in cacert.der –out cacert.pem python –m SimpleHTTPServer 9090 - Browse to system, collect cert (http://172.16.42.42:9090/) - Install Cert: Settings – Security – “Install from Storage” - Select “cacert.pem” --- Page 21 --- Methodology – Network - Get “man in the middle” - Here the cert issuer for www.google.com is my Burp Suite CA – “PortSwigger CA” - Apps vary on how they deal with this depending on how they’re programmed --- Page 22 --- Methodology – Network - Additionally, full packet capture (PCAP) via tcpdump, dumpcap, wireshark, etc. during assessment --- Page 23 --- Methodology – Network - You have the benefit of control of the application while you’re doing this work - Don’t rush, provide ample time between actions to help to isolate what you’re reviewing - Record the time of every action you take, use this to correlate to network activity - Search traffic for all (unique) data that you input, also potentially hashes, we’ll talk about code review next --- Page 24 --- Methodology – Network - Wireshark conversations view --- Page 25 --- Methodology – Code Assessment - By reviewing the code, there is an opportunity to see more than the behavior of the app during your observation - You can see all of the things the application is programmed to do - This is more complex than evaluation of network - Requires tools to assist with the code assessment --- Page 26 --- Acquire Application to Assess - Android – a couple of options - Install app, use ES FileExplorer to backup apk - Tool like RealAPK Leecher to pull from Play store - iOS - Must have a jailbroken phone to extract application, but network/behavioral assessment can be done without jailbroken phone - Jailbroken phone: collect executable from within the install directory - Decrypt with gdb or dump_decrypted --- Page 27 --- Acquire Application to Assess - Using ES File Explorer, go to “App” Section - Long press the app of interest. Once selected, choose “backup” - Get the file from the device (I used adb with a USB connection) adb pull /sdcard/backups/GuitarTuna_4.0.2.apk - We now have the application to assess - APK files are just zip files --- Page 28 --- Unzip and View Manifest - Since the Android app is just a zip file, we can unzip it. - Make a copy in a sub directory (just in case something goes wrong) - Unzip file using 7-zip, or any zip utility - Start with AndroidManifest.xml to see permissions declared java –jar AXMLPrinter2.jar AndroidManifest.txt | more - AndroidManifest also declares Activities (windows / interfaces) and intents --- Page 29 --- Unzip and View Manifest - We see the permissions declared, and have an idea of what the app can do - The Manifest is long, and declares several things - In this app, we see a lot of Facebook integration (not pictured) --- Page 30 --- Look at Decompiled Code - With some understanding of the behavior and the permissions, we might want to see in detail what the program does - There are multiple decompilation tools (dex2jar, Procyon) - Jad-X is an easy and free one – providing decompiled Java that is readable directly from the .apk - In this app, I reviewed the facebook integration, as well as the billing information --- Page 31 --- Methodology – Inter-process Communication - Android – use of “intents” - Android components: - Activities - Services - Content Providers - Broadcast Receiver - iOS – chroot (sandbox) with minor exceptions for data sharing between apps - Document provider (shares with other apps) - Document picker (can import) - Action extension - Custom keyboard - Also, URL handlers such as “twitter://” --- Page 32 --- Methodology – Inter-process Communication - Assessing the IPC is involved in both platforms - Drozer is very helpful for this on Android - iOS no automated tool yet to help with exploration of IPC - Concern of action extension for exposure of app to active content returned into application context - Challenge is time, and exploring potential content provided --- Page 33 --- IPC - Drozer - Install Drozer application on Android - In this case, I’m using adb based connection: adb forward tcp:31415 tcp:31415 drozer console connect - See the attack surface: run app.package.attacksurface com.ovelin.guitartuna - See the Activities: run app.activity.info com.ovelin.guitartuna --- Page 34 --- IPC - Drozer - See the attack surface: run app.package.attacksurface com.ovelin.guitartuna - See the Activities: run app.activity.info com.ovelin.guitartuna --- Page 35 --- IPC - Drozer - See the Activities (a user interface screen): run app.activity.info com.ovelin.guitartuna --- Page 36 --- IPC – “Extras” - Can now go look in the code (probably easiest with dex2-jar) to see if any of the Activities that accept “extras” – with the inter process communication - If so, there is an opportunity for an external application to communicate with this app, there’s an opportunity for abuse --- Page 37 --- Methodology – Filesystem Content - If you have rooted or jailbroken phone, pull full filesystem contents - tar, dd, etc. - If you don’t, you can make a backup of the phone (or specific app) - Android Example: adb backup -f myfile.ab com.company.package Note: in my experience, adb backup crashes without filename for single packages --- Page 38 --- Methodology – Filesystem Content - If you get an encrypted backup, you’ll need to decrypt the content - backupdecrypt.pl - Only through version 1 - android-backup-extractor - abe.jar - Need to add Java crypto library support (see abe.jar README) --- Page 39 --- Methodology – Filesystem Content - java -jar abe.jar unpack myfile.ab decrypted.ab - tar -xvf decrypted.ab - Enjoy the volume of data to inspect! - Sqlite databases frequently encountered --- Page 40 --- Android – items to inspect - As you’re seeing, there’s a lot of work involved in assessing the app - The report cards provide a checklist of items to review --- Page 41 --- Methodology – Tools - Tools to be able to do this work; still extensive manual work - https://bit.ly/crow-gmob has a tool list - https://github.com/tanprathan/MobileApp-Pentest- Cheatsheet --- Page 42 --- Methodology – Distributions - There are some pre-built distributions which give you an environment to work from - MobiSec (SecureIdeas) - Androlab (androl4b) - Santoku Linux (from NowSecure) - Kali Linux - Give you the benefit of the tools already set up - Probably doesn’t have everything you need, but a good start --- Page 43 --- Maintenance - For app assessment, maintain the program through updates to approved applications - Improve analytical capability - Keep up to date on attacker trends - Enhance organizational security posture - Develop exercises --- Page 44 --- Summary - Brief walk through of the idea of application assessment - Develop a program - Develop methodology - Test on an ongoing basis - Twitter: @CCrowMontance - This and other presentations: https://bit.ly/crow-cell-eaves

Related Q&A

  • Q: What is Step 1 of the Top 8 Steps for Mobile Security?
    A: Enforce Device Passcode Authentication.
  • Q: What is Step 2?
    A: Monitoring Mobile Device Access and Use.
  • Q: What is Step 3?
    A: Patching Mobile Devices.