Kevin Stadmeyer Garrett Held COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Hacking (and Defending) iPhone Applications.

Slides:



Advertisements
Similar presentations
Module XIV SQL Injection
Advertisements

SEC835 OWASP Top Ten Project.
Topic 8: Secure communication in mobile devices. Choice of secure communication protocols, leveraging SSL for remote authentication and using HTTPS for.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
It’s always better live. MSDN Events Security Best Practices Part 2 of 2 Reducing Vulnerabilities using Visual Studio 2008.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
Information Networking Security and Assurance Lab National Chung Cheng University 1 Top Vulnerabilities in Web Applications (I) Unvalidated Input:  Information.
Demonstrating HTTP Session Hijacking through ARP Cache Poisoning and Man-in-the-Middle Attack and exploring HTTPS and VOIP session vulnerabilities Mainuddin.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 14 Implementation Flaws Part 2: Malicious Input and Data Validation Issues.
Jonas Thomsen, Ph.d. student Computer Science University of Aarhus Best Practices and Techniques for Building Secure Microsoft.
Lecture 16 Page 1 CS 236 Online Cross-Site Scripting XSS Many sites allow users to upload information –Blogs, photo sharing, Facebook, etc. –Which gets.
Designing Security In Web Applications Andrew Tomkowiak 10/8/2013 UW-Platteville Software Engineering Department
Web Application Vulnerabilities Checklist. EC-Council Parameter Checklist  URL request  URL encoding  Query string  Header  Cookie  Form field 
Lecture 12 Overview.
OWASP Mobile Top 10 Why They Matter and What We Can Do
Security and Risk Management. Who Am I Matthew Strahan from Content Security Principal Security Consultant I look young, but I’ve been doing this for.
CRYPTOGRAPHY PROGRAMMING ON ANDROID Jinsheng Xu Associate Professor North Carolina A&T State University.
Web Security Demystified Justin C. Klein Keane Sr. InfoSec Specialist University of Pennsylvania School of Arts and Sciences Information Security and Unix.
Introduction to Application Penetration Testing
OWASP Zed Attack Proxy Project Lead
Malicious Code Brian E. Brzezicki. Malicious Code (from Chapter 13 and 11)
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Prevent Cross-Site Scripting (XSS) attack
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
Is Your Mobile App Secure. DEF CON 23 Wall of Sheep Sat
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Session and cookie management in.Net Justin Brunelle CS795 6/18/2009.
Lecture 16 Page 1 CS 236 Online SQL Injection Attacks Many web servers have backing databases –Much of their information stored in a database Web pages.
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
An Inside Look at Mobile Security Android & iOS Zachary Hance & Andrew Phifer Dr Harold Grossman.
| nectar.org.au NECTAR TRAINING Module 5 The Research Cloud Lifecycle.
Security Scanners Mark Shtern. Popular attack targets Web – Web platform – Web application Windows OS Mac OS Linux OS Smartphone.
OWASP Top Ten #1 Unvalidated Input. Agenda What is the OWASP Top 10? Where can I find it? What is Unvalidated Input? What environments are effected? How.
SEC835 Runtime authentication Secure session management Secure use of cryptomaterials.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
Web Applications Testing By Jamie Rougvie Supported by.
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
THE DEVIL IS IN THE (IMPLEMENTATION) DETAILS: AN EMPIRICAL ANALYSIS OF OAUTH SSO SYSTEMS SAN-TSAI SUN & KONSTANTIN BEZNOSOV PRESENTED BY: NAZISH KHAN COMPSCI.
Protecting Browsers from Extension Vulnerabilities Paper by: Adam Barth, Adrienne Porter Felt, Prateek Saxena at University of California, Berkeley and.
Slides and projects at samsclass.info. Adding Trojans to Apps Slides and projects at samsclass.info.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
MobileSecurity Vulnerability Assessment Tools for the Enterprise Mobile Security Vulnerability Assessment Tools for the Enterprise Integrating Mobile/BYOD.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
Computer Security By Duncan Hall.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Web Login, Cookies Web Login | Old way HTML
Do not try any of the techniques discussed in this presentation on a system you do not own. It is illegal and you will get caught.
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
Carrie Estes Collin Donaldson.  Zero day attacks  “zero day”  Web application attacks  Signing up for a class  Hardening the web server  Enhancing.
Android and IOS Permissions Why are they here and what do they want from me?
 Computer Network Attack  “… actions taken through the use of computer networks to disrupt, deny, degrade, or destroy information resident in computers.
James F. Fox MENA Cyber Security Practice Lead Presenters Cyber Security in a Mobile and “Always-on” World Booz | Allen | Hamilton.
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
World Wide Web policy.
SQL Injection Attacks Many web servers have backing databases
E-commerce Application Security
Cross-Site Forgery
Lecture 2 - SQL Injection
Web Hacking: Beginners
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
Leo McCavana, OWASP Belfast, October 1st, 2015
Presentation transcript:

Kevin Stadmeyer Garrett Held COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Hacking (and Defending) iPhone Applications

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Garrett Held and Kevin Stadmeyer ›Managing Consultants with Trustwave SpiderLabs ›Have performed hundreds of application tests from mainframe to web to mobile Who Are We?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL ›The Basics ›Setup For Testing ›Secure Storage of Data And Credentials ›Inadvertent Local Storage and Caching ›Client Side Sanitization ›Secure Coding ›Push Notifications ›Secure Communications Agenda What we’ll cover – secure coding and beyond, what to look for when assessing an iPhone application

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL The Basics

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Why are people attacking mobile apps? ›Stealing Money ›Embarrassing People (“Hactivists”) ›Get Famous Just the Facts, Ma’am

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Just the Facts, Ma’am iPhone Apps in the Press

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How are people attacking mobile apps? ›New and unsafe operating systems? ›Terrible developers who don’t care? ›Clueless users who don’t know they should care? Just the Facts, Ma’am

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Security Model We’re Not Talking About? ›Layer 1: Apple Store ›Layer 2: Sandboxing via “Seatbelt” Just the Facts, Ma’am

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Just the Facts, Ma’am

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Setting Up The Testing Environment

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Don’t you mean setting up the decompiler? ›No Setting Up The Testing Environment

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 1: get your proxy right We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 2: Get ya certs heard! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 3: Roll It Up We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 4: Mail it! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 5: Install It We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 6: Install It (Errrr….) We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 7: Proxy It! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On das metal – Step 8: Victory! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On The Computer Machine – Step 6: Install It! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On The Computer Machine – Step 7: Install It! We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL On The Computer Machine We Built This City ›The format is X’ ’

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Now What? We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Now What? We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Now What? We Built This City

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Secure Storage Of Data

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL The Keychain ›Indefinite Storage ›Can you store credentials securely without the keychain? – Don’t let the feature make you lazy – Don’t store credentials in the keychain unless you don’t care about certain things Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Keychain Compromise via Jailbreaking ›Through a series of steps, retrieves passwords stored in the keychain [1] ›Researchers compromised keychain passwords only, not other protected classes such as passwords for websites – Jailbreak stolen iPhone (requires physical access), gain SSH access – Copy scripts that will compromise the keychain – Scripts output the victims passwords Storing Credentials [1]

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Where Should You Store Them? ›Not on the device? – At least not in plaintext! Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Securely Storing Data At Rest – things to look for ›Database calls? – Injection Possible? ›Using Core Data? – Does the application trust the integrity of the data? – Remember trust boundaries! Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Recommendations for non-credential data ›Do not store data on the phone if at all possible – Never has it been so easy to lose so much data so fast! ›Require user to enter a passcode – Can still be brute-forced with time once the encrypted text is found – Poor user-experience on mobile devices Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Recommendations for non-credential data ›Store decryption key on a server and require credentials (non-stored) to access key – Only works for applications that do not require offline access – Increases data usage – Revocable though – Data not “stored” in the cloud Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL B-b-b-but kSecAttrAccessibleWhenUnlocked! ›By default iOS writes information to the keychain with this attribute ›By default most user’s passwords suck Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Look Familiar? Storing Credentials

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Most Users Storing Credentials Pick Simple PINS 10,000 possibilities ~.1 second to crack (100k a second is pretty standard)

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Protect Stupid Users Storing Credentials  Require Strong Passwords (8+ alpha-numeric chars)  Use REAL and GOOD encryption  Don’t rely on an inherently insecure PIN to protect users.  If they knew what they were doing we wouldn’t be here today.

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Inadvertent Local Storage and Caching

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Screenshots ›Where are they stored? ›When are they taken? ›Who can access them! I Accidently Your Data…

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Screenshots I Accidently Your Data…

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Screenshot Protection I Accidently Your Data…

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Other Storage Of Information ›Autocomplete, etc. I Accidently Your Data…

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Autocomplete ›Override autocomplete ›textfield.autocorrectionType = UITextAutocorrectionNone I Accidently Your Data…

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Client Side Sanitization

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL It’s bad… ›Less burden on server ›Critical bypasses (yay!) Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL It’s bad… ›Some classic Web Application faults translate well into the iPhone. ›Web developers relied on: – JavaScript controls – Hidden fields – JSON responses – Information stored in Flash objects Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Rogue Clients ›Attackers can write apps (Some testers, too) ›Client side secrets can be decompiled – We don’t care if it’s obfuscated for now, that’s a point in time. ›Distributed through trusted App store? – Already happened to Android Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How To Do It Right ›Server Side Controls ›Assume everything coming in came from a rouge or compromised client ›Enforce secure communications Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Applies in the iOS world? Client Side? More like Bad side, amirite? AppliesDoes Not Apply SQL InjectionCSRF* XML InjectionXSS* Other Injection Privilege Escalation Session Hijacking Overflows (Buffer, Integer) Format String Problems Insecure use of SSL

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL CSRF and XSS In Apps? ›Calls to browser – Recent Android Issue [1] – Loads javascript:alert(document.cookie) ›Embedded browser shares web app issues ›Rogue applications and rogue users Client Side? More like Bad side, amirite? ]1]

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Break That Down Into Attackers View Client Side? More like Bad side, amirite? Attacker Targets ServerAttacker Targets Device SQL InjectionOverflows (Buffer, Integer) XML InjectionFormat String Problems Other Injection Privilege Escalation Session Hijacking Insecure use of SSL

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Does This Mean to a Developer? ›Time to throw out any assumptions that the device will protect you by obfuscating anything ›A new set of security practices need to be developed and followed when creating App’s Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Shifting Paradigms – we hate ourselves ›Local Storage Review – What is stored and why? ›Educating QA – Proxy testing ›Review Local and Remote Inputs ›Information Leakage Client Side? More like Bad side, amirite?

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Local Storage Review ›Review what’s stored on the device by the application ›Review what’s stored on the device by iOS ›Keep it simple, review to remove A New Methodology

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Educating QA ›Develop test cases for new and old vulnerabilities ›Formal process for testing communications and settings A New Methodology

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Local And Remote Inputs ›User input from Apps is always a concern ›Don’t forget about responses that could be intercepted or hijacked. ›Maintain the integrity of the device. A New Methodology

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Information Leakage ›Examine all traffic to / from the application, like should be done with web applications ›Additional examination of what sensitive data may be in the binary. – Is it necessary? Keep it simple. Review to Remove. A New Methodology

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Secure Coding

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Can Go Wrong? ›Arbitrary executable code could be loaded and executed on the device ›Bypass “seatbelt” Buffer Overflow

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How To Do It Right ›Same concerns as in C ›Use appropriate functions [1] – Example: strlcpy NOT strncpy ›Properly calculate buffer size (constants) ›Includes integer bounds checking Buffer Overflow [1]

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Can Go Wrong? ›Application displays user input (as applications are known to do) ›Uses the [NSString stringWithFormat] method ›Uses the printf function ›Attacker sends “%s%s%s%s” instead of “Hello” Format String Attack

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How To Do It Right ›Enforce Secure Coding Standard – Just like web applications – No vulnerable function should accept untrusted user input that could be used to determine the format of the output Format String Attack

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Can Go Wrong? ›Application manages state using the deviceID NOT the session ID. ›Sessions not terminated properly on the server side ›Following Conditions – User logged into the application at some point in the last day and subsequently logged out. – Attacker supplies wrong credentials through the mobile app. Race Conditions

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Can Go Wrong? ›Following Conditions – Application request “session refresh” while waiting for the incorrect login response to be sent. – Server “refreshes” the session based on the device ID. – Application receives a response indicating the login was successful, followed by a login denied error. – Application subsequently ignores the login denied, continues using the previous session now tied to the Device ID. Race Conditions

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How To Do It Right ›Strong server side controls over access – Policy enforcement on concurrent logins – Do not maintain session via Device ID – Properly Logout Users ›Make sure any mobile applications have the same, proper logic enforcement as web applications. Race Conditions

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL What Can Go Wrong? ›Just about everything – Logic vulnerabilities – Weak session controls – Classic web application vulnerabilities – Too much trust in the client-side controls Server Side

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL How To Do It Right ›Harden the server – Every client is treated like it might be malicious ›Use same guidelines as Web Apps – OWASP Secure Development Server Side

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Push Notifications

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Real Fast Push Notifications

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Secure Communications

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL SSL Whaaaa? ›NSURL method – iOS is secure by default in regards to SSL certs when using this method to retrieve HTTPS content Secure Communications Source:

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Well, that’s true now… ›SSLizzard – Exploit developed by SpiderLabs to take advantage of weakness in certificate validation. [1] – Allowed SSL MITM attacks without errors. – Apple patched this, “This vulnerability has been corrected in versions 5.0b4, 4.3.5, and ” Secure Communications [1] TWSL : iOS SSL Implementation Does Not Validate Certificate Chain,

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL SSL Whaaaa? Secure Communications Source:

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL This Is It

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL ›The Basics ›Setup For Testing ›Secure Storage of Data And Credentials ›Inadvertent Local Storage and Caching ›Client Side Sanitization ›Secure Coding ›Push Notifications ›Secure Communications This Is It Review

COPYRIGHT TRUSTWAVE 2011 CONFIDENTIAL Summary ›Testing is easy – For you and for “them” ›Security is hard – Really just for you ›So test everything! This Is It