IOS Application Security Testing Cheat Sheet
IOS Application Security Testing Cheat Sheet
DRAFT CHEAT SHEET - WORK IN PROGRESS
Introduction
This cheat sheet provides a checklist of tasks to be performed when testing an iOS application.
When assessing a mobile application several areas should be taken into account: client software, the communication channel and the server side infrastructure.
Testing an iOS application usually requires a jailbroken device. (A device that not pose any restrictions on the software that can be installed on it.)

Information gathering
- Observe application behavior
- Determine the application’s data states (at rest, in transit or on display) and sensitivity
- Identify access methods
- Identify what frameworks are in use
- Identify server side APIs that are in use
- Identify what protocols are in use
- Identify other applications or services with which the application interacts
- Decrypt Appstore binaries: the .ipa will be decrypted at runtime by the kernel’s mach loader. Cydia has several applications available: Crackulous, AppCrack and Clutch. Also, you can use GDB. The “cryptid” field of the LC_ENCRYPTION_INFO identifies if the application is encrypted or not. Use otool –l <app name> | grep –A 4 LC_ENCRYPTION_INFO
- Determine the architecture the application was compiled for: otool –f <app name> or lipo -info <app>.
- Get information about what functions, classes and methods are referenced in the application and in the dynamically loaded libraries. Use nm <app name>
- List the dynamic dependencies. Use otool –L <app name>
- Dump the load commands for the application. Use otool –l <app name>
- Dump the runtime information from the compiled application. Identify each class compiled into the program and its associated methods, instance variables and properties. Use class-dump-z <app name>. That can be put that into a .h file which can be used later to create hooks for method swizzling or to simply make the methods of the app easier to read.
- Dump the keychain using dump_keychain to reveal application specific credentials and passwords if stored in the keychain.
Determine the security features in place:
- Locate the PIE (Position Independent Executable) - an app compiled without PIE (using the “–fPIE –pie” flag) will load the executable at a fixed address. Check this using the command: otool –hv <app name>
- Stack smashing protection - specify the –fstack-protector-all compiler flag. A “canary” is placed on the stack to protect the saved base pointer, saved instruction pointer and function arguments. It will be verified upon the function return to see if it has been overwritten. Check this using: otool –I –v <app name> | grep stack . If the application was compiled with the stack smashing protection two undefined symbols will be present: “___stack_chk_fail” and “___stack_chk_guard”.
Application traffic analysis
- Analyze error messages
- Analyze cacheable information
- Transport layer security (TLS version; NSURLRequest object )
- Attack XML processors
- SQL injection
- Privacy issues (sensitive information disclosure)
- Improper session handling
- Decisions via untrusted inputs
- Broken cryptography
- Unmanaged code
- URL Schemes
- Push notifications
- Authentication
- Authorization
- Session management
- Data storage
- Data validation (input, output)
- Transport Layer protection – are the certificates validated, does the application implement Certificate Pinning
- Denial of service
- Business logic
- UDID or MAC ID usage (privacy concerns)
Runtime analysis
- Disassemble the application (gdb)
- Analyze file system interaction
- Use the .h file generated with class-dump-z to create a method swizzling hook of some interesting methods to either examine the data as it flow through or create a "stealer" app.
- Analyze the application with a debugger (gdb): inspecting objects in memory and calling functions and methods; replacing variables and methods at runtime.
- Investigate CFStream and NSStream
- Investigate protocol handlers (application: openURL - validates the source application that instantiated the URL request) for example: try to reconfigure the default landing page for the application using a malicious iframe.
- Buffer overflows and memory corruption
- Client side injection
- Runtime injections
- Having access to sources, test the memory by using Xcode Schemes
Insecure data storage
- Investigate log files(plugging the device in and pulling down logs with Xcode Organizer)
- Insecure data storage in application folder (var/mobile/Applications), caches, in backups (iTunes)
- Investigate custom created files
- Analyze SQLlite database
- Investigate property list files
- Investigate file caching
- Insecure data storage in keyboard cache
- Investigate Cookies.binarycookies
- Analyze iOS keychain (/private/var/Keychains/keychain-2.db) – when it is accessible and what information it contains; data stored in the keychain can only be accessible if the attacker has physical access to the device.
- Check for sensitive information in snapshots
- Audit data protection of files and keychain entries (To determine when a keychain item should be readable by an application check the data protection accessibility constants)
Tools
| Tool | Link | Description |
|---|---|---|
| Mallory proxy | http://intrepidusgroup.com/insight/mallory/ | Proxy for Binary protocols |
| Charles/Burp proxy | http://www.charlesproxy.com/ ; | Proxy for HTTP and HTTPS |
| OpenSSH | http://www.openssh.com/ | Connect to the iPhone remotely over SSH |
| Sqlite3 | http://www.sqlite.org/ | Sqlite database client |
| GNU Debugger | http://www.gnu.org/software/gdb/ | For run time analysis & reverse engineering |
| Syslogd | https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/syslogd.8.html | View iPhone logs |
| Tcpdump | http://www.tcpdump.org/ | Capture network traffic on phone |
| Otool | http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/otool.1.html | Odcctools: otool – object file displaying tool |
| Cycript | http://www.cycript.org/ | A language designed to interact with Objective-C classes |
| SSL Kill switch | https://github.com/iSECPartners/ios-ssl-kill-switch | Blackbox tool to disable SSL certificate validation - including certificate pinning in NSURL |
| Plutil | http://scw.us/iPhone/plutil/ | To view Plist files |
| nm | Analysis tool to display the symbol table, which includes names of functions and methods, as well as their load addresses. | |
| sysctl | https://developer.apple.com/library/mac/#documentation/Darwin/Reference /ManPages/man8/sysctl.8.html | A utility to read and change kernel state variables |
| dump_keychain | https://github.com/emonti/iOS_app_re_tools | A utility to dump the keychain |
| Filemon | http://www.newosxbook.com/files/filemon.iOS | Monitor realtime iOS file system |
| FileDP | http://www.securitylearn.net/2012/10/18/extracting-data-protection-class-from-files-on-ios/ | Audits data protection of files |
| BinaryCookieReader | http://securitylearn.net/wp-content/uploads/tools/iOS/BinaryCookieReader.py | Read cookies.binarycookies files |
| lsof ARM Binary | https://github.com/u35tpus/iosrep/tree/master/lsof | list of all open files and the processes that opened them |
| lsock ARM Binary | http://www.newosxbook.com/index.php?page=downloads | monitor socket connections |
| PonyDebugger Injected | https://github.com/dtrukr/PonyDebuggerInjected | Injected via Cycript to enable remote debugging |
| Weak Class Dump | https://raw.github.com/limneos/weak_classdump/master/weak_classdump.cy | Injected via Cycript to do class-dump (for when you cant un-encrypt the binary) |
| TrustME | https://github.com/intrepidusgroup/trustme | Lower level tool to disable SSL certificate validation - including certificate pinning (for everything else but NSURL) |
| Mac Robber | http://www.sleuthkit.org/mac-robber/download.php | C code, forensic tool for imaging filesystems and producing a timeline |
| USBMux Proxy | https://github.com/st3fan/usbmux-proxy | command line tool to connect local TCP port sto ports on an iPhone or iPod Touch device over USB. |
| iFunBox | http://www.i-funbox.com/ | Filesystem access (no jailbreak needed), USBMux Tunneler, .ipa installer |
| iNalyzer | https://appsec-labs.com/iNalyzer/ | iOS Penetration testing framework |
| removePIE | https://github.com/peterfillmore/removePIE | Disables ASLR of an application |
| snoop-it | https://code.google.com/p/snoop-it/ | A tool to assist security assessments and dynamic analysis of iOS Apps, includes runtime views of obj-c classes and methods, and options to modify those values |
| idb | https://github.com/dmayer/idb | A GUI (and cmdline) tool to simplify some common tasks for iOS pentesting and research. |
| Damn Vulnerable iOS Application | http://damnvulnerableiosapp.com/ | A purposefully vulnerable iOS application for learning iOS application assessment skills. |
| introspy | https://github.com/iSECPartners/Introspy-iOS | A security profiling tool revolved around hooking security based iOS APIs and logging their output for security analysis |
IOS Application Security Testing Cheat Sheet的更多相关文章
- iOS Application Security
文章分A,B,C,D 4个部分. A) iOS Application Security 下面介绍iOS应用安全,如何分析和动态修改app. 1)iOS Application security Pa ...
- XSS (Cross Site Scripting) Prevention Cheat Sheet(XSS防护检查单)
本文是 XSS防御检查单的翻译版本 https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sh ...
- The iOS Design Cheat Sheet 界面设计速参
http://ivomynttinen.com/blog/the-ios-7-design-cheat-sheet/ With the release of iOS 7, app designers ...
- Racket Cheat Sheet
Racket Cheat Sheet 来源 http://docs.racket-lang.org/racket-cheat/index.html?q=Racket%20Cheat%20Sheet ...
- Penetration Testing、Security Testing、Automation Testing
相关学习资料 http://www.cnblogs.com/LittleHann/p/3823513.html http://www.cnblogs.com/LittleHann/p/3828927. ...
- [转]Swift Cheat Sheet
原文:http://kpbp.github.io/swiftcheatsheet/ A quick cheat sheet and reference guide for Apple's Swift ...
- Security Testing Basics
Security Testing BasicsSoftware security testing is the process of assessing and testing a system to ...
- [Chromium文档转载,第006章]Chrome IPC To Mojo IPC Cheat Sheet
For Developers > Design Documents > Mojo > Chrome IPC To Mojo IPC Cheat Sheet 目录 1 O ...
- XSS Cheat Sheet(basics and advanced)
XSS Cheat Sheet BASICS HTML注入 当输入位于HTML标记的属性值内或标记的外部(下一种情况中描述的标记除外)时使用.如果输入在HTML注释中,则在payload前加上&quo ...
随机推荐
- fgets函数执行完成后,文件指针如何移动?
用fgets执行之后,读取了文件中的一行,这时文件位置指针是自动指向文件的下一行的开头吗,还是指向当前行的结尾?如果一行的字符串没读取完会怎样? 实例结果: 如果一行的字符串没读取完会,下一次会接着上 ...
- paip.java 多线程参数以及返回值Future FutureTask 的使用.
paip.java 多线程参数以及返回值Future FutureTask 的使用. 在并发编程时,一般使用runnable,然后扔给线程池完事,这种情况下不需要线程的结果. 所以run的返回值是vo ...
- atitit.提升备份文件复制速度(3) ----建立同步删除脚本
atitit.提升备份文件复制速度(3) ----建立同步删除脚本 1. 建立同步删除脚本两个方法.. 1 2. 1从回收站info2文件... 1 3. 清理结束在后snap比较 1 4. Npp ...
- VS2013编译经常卡在正在从以下位置加载xxx.dll的符号
换了系统后,重新下载了一个vs2013 with update2安装,编译的时候总是卡在 正在从以下位置加载xxx.dll的符号 如图: 解决方法: 进入VS---工具---选项----调试----符 ...
- Python类
在类的变量前面加 _ _ 是私有变量,外部不可访问. 需要注意的是,在Python中,变量名类似__xxx__的,也就是以双下划线开头,并且以双下划线结尾的,是特殊变量,特殊变量是可以直接访问的,不是 ...
- 通过rinetd实现端口转发来访问内网的服务
通过rinetd实现端口转发来访问内网的服务 一. 问题描述 通过外网来访问内网的服务 二. 环境要求 需要有一台能够外网访问的机器做端口映射,通过数据包转发来实现外部访问阿里云的内网服务 三 ...
- ftp 命令
- 通过修改host文件来允许和禁止主机的访问
通过修改host文件来允许和禁止主机的访问 修改/etc/hosts.deny,加入"sshd:ALL" 修改/etc/hosts.allow,加入"sshd:192.1 ...
- 一个purge参数引发的惨案——从线上hbase数据被删事故说起
在写这篇blog前,我的心情久久不能平静,虽然明白运维工作如履薄冰,但没有料到这么一个细小的疏漏会带来如此严重的灾难.这是一起其他公司误用puppet参数引发的事故,而且这个参数我也曾被“坑过”. ...
- XMPP系列2:如何掌握XMPP协议
michaely 回答于 2012-08-07 08:34 举报我要说的是:1.任何一个协议想学习并熟练掌握,都不是一天两天的事情.2.XMPP协议现在已经有很多成熟的架构和客户端,无需重新造轮子.3 ...