SlideShare a Scribd company logo
1 of 54
Download to read offline
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
1
Hacking apple accessories to pown iDevices
Wake up Neo! Your phone got pown!
GOTO: H[a]CK
Mathieu RENARD - @GOTOHACK
mathieu.renard[-at-]gotohack.org
2
Who am I ?
# @GotoHack
– DAY: Pentester & Team Leader
– NIGHT: Security Researcher
# Area of expertise
– Mobility / BYOD
– Web application
– Embedded systems
– Hardware Hacking
# Publications
– GreHack 2012
• Practical iOS Application Hacking
– HACK.lu 2012
• Hacking iOS Application
3
MFI Devices Invasion
4
iDevices Attack surface
BootROM LLB iBoot Kernel
Apps
Bootime Runtime
USB host / Apple Accessory
iDevices
DFU Mode
IMG3
X509
Fake DFU
IMG3
X509
Recovery mode
IMG3
X509
Hardware,
Driver: WiFi,
Baseband
MobileSafari
MobileMail
AppStore
Deamons
Accessory
Protocol
(Serial)
iTunes services:
Backup, AFC, …
(USBMux)
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
5
5
iTunes Services
GOTO: H[a]CK
6
USBmuxd and USBmux protocol
Client side communication
# USBmuxd
– Daemon is started at system launch (on user system).
– Creates a listening UNIX Domain Socket at /var/run/usbmuxd.
– Wait for iDevice connections via USB
– Allows multiplexing of TCP connection over one USB pipe
USBMuxd USBMux Client
Hello
Hello
Binary Data sent through UNIX Socket
device ID
TCP connect request
7
Lockdownd
# Lockdownd binary
– Responsible for several tasks
• Pairing,
• Activation,
• Unlocking FairPlay certificates,
• Delegating communications to other services
• …
– Listening on port 62078
• Accessed through the usbmux protocol.
• Packets
– Data length : 32bits big endian word
– Data : XML plist
– Only available after pairing.
• First pairing require the device to be unlocked
8
iTunes’ service communication overview
iDevices Host
lockdownd Can you start afc service ?
Pairing request
AFC Service
AFC Client
USBMuxd
libmobiledevicePairing OK
Plist files sent over USB pipe
AFC service is running on
port : XXXXX
AFC Commands
AFC Results
9
Lockdown protocol & Pairing
Lockdownd(Device)
LockdownClient
XML Plist sent through USBmux
{Request=QueryType}
{Request=QueryType, Result=Success, Type=com.apple.mobile.lockdown}
{PairRecord={DevicePublicKey=xxxxx, DeviceCertificate=xxxx,HostCertificate=xxxx,
HostID=xxxx,RootCertificate=xxxx, SystemBUID=xxxx}, Request=Pair}
{Request=GetValue, Label=xxxx}
{Request=GetValue, Label=xxxx, Value={ActivationPublicKey=xxxx,
DevicePublicKey=xxxx,UniqueDeviceID=xxxx, DieID=xxx,…}}
{Request=Pair, EscrowBag=xxxx}
{PairRecord={DevicePublicKey=xxxxx, DeviceCertificate=xxxx, HostCertificate=xxxx,
HostID=xxxx,RootCertificate=xxxx, SystemBUID=xxxx}, Request=ValidatePair}
{Request=ValidatePair}
{HostID=xxx, Request=StartSession}
{SessionID=xxx, Request=StartSession, EnableSessionSSL=True}
10
libImobiledevice / pymobiledevice
# Libimobiledevice
– Cross-platform software library
– Developed by Nikias Bassen
– Handles the protocols to support iDevices.
– Based on the open source implementation of usbmuxd
# Pymobiledevice
– Lite python implementation
– Handles only most important protocols to support iDevices
– Based on the open source implementation of usbmuxd
# Allows other software to easily interact with the services hosted
on the device.
11
com.apple.mobilebackup &
com.apple.mobilebackup2
# Mobilebackup services
– Used by iTunes to backup the device
# iDevice backup
– Permit a user to restore personal data and settings
– Abusing this service may allow an attacker
• Retrieving personal and confidential data
– SMS
– Call Logs
– application data
– default preferences
– data stored in the keychain (WiFi password, VPN Certificate Passwords).
• Inject data to the device.
– Can be password protected
12
com.apple.afc
# AFC (Apple File Connection)
– Service running on all iDevices
– Handled by /usr/libexec/afcd
– Used by iTunes to exchange files
– AFC clients can access certain
files only
• Files located in the Media folder
13
com.apple.mobile.house_arrest
# House_arrest
– allows accessing to AppStore applications folders and their content.
# Using an AFC client, a user/attacker can download the application
resources and data (documents, photos…).
– Including “default preferences”
• File where credentials are sometimes stored.
14
com.apple.mobile.installation_proxy
# Installation proxy
– Manages applications on a device
• List installed applications.
• Install an application on the device.
• Upgrade an application on the device.
• Uninstall an application from the device.
• List archived applications.
• Archive an application on the device
– Creating a ZIP archive in the “ApplicationArchives” directory and uninstalling the
application
• Removes a previously archived application from the device
– Used by the com.apple.mobile.house_arrest
• Enumerate and dump installed applications.
15
com.apple.mobile.diagnostics_relay
# Diagnostics relay
– Allows requesting iOS diagnostic information.
– Handles the following actions:
• Puts the device into deep sleep mode and disconnects from host.
• Restart the device and optionally show a user notification.
• Shutdown of the device and optionally show a user notification.
– Used by evasi0n to update some caches by rebooting the device.
16
com.apple.mobile.file_relay
# File_Relay
– Allow paired devices to launch the following commands
• AppleSupport,
• Network,
• WiFi,
• SystemConfiguration,
• VPN,
• UserDatabases,
• CrashReporter,
• Tmp,
• Caches
– All the files returned are stored in clear text in a CPIO archive
– Asking for UserDatabases allow retrieving
• SMS, Contacts, Calendar and Email from databases in clear text.
17
Summary
# Pairing is initiated on the USB Host side
– Unlocking the device is mandatory
– This implementation may allow malicious dock station to
• Retrieve & Inject
– SMS
– Call Logs
– application data
– default preferences and data stored in the keychain (using backup)
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
18
GOTO: H[a]CK
Reversing an
Apple MFI accessory
19
Anatomy of an Accessory
# MFI Alarm clock
– Apple dock connector
– Features :
• Compatible with all iPods
• Wake up to iPod
• Full-function remote control
• Charges iPod whilst connected
20
Opening the box…
Power supply &
Audio Amplifier
iDevice interface
Mother board
21
Mother board analysis
22
R5F2126
In-System Programming
On-chip data flash (1Kbytes)
Internal ROM (32 Kbytes)
23
iDevice interface
24
Reversing the circuit
GND
5V
Tx
Rx
ACDET
IPDET
IPODR
AGND
IPODL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2V
550K
2,6V
49.9K 43.2K
49.9K 75K
Audio
RS232
Charging
J1 iDevice connector
J2
25
What about the Lightning connector ?
# In October 2012 Apple released the Lightning
– Apple proprietary bus and power connector
– Replace its previous proprietary 30-pin dock connector.
– Using 8 pins instead of 30
– Significantly more compact than the 30-pin dock connector
– Can be inserted with either face up.
– Embeds an authentication chip inside the cable.
• Analyzing the Lightning connector will not be so easy.
# 30 pins adapters
– Allows to connect 30-pin accessories to devices
featuring the Lightning connector.
– Successfully tested on the dock station used for
our analysis
26
Sniffing the communications
# Standard 8N1 serial protocol.
# Data are sent @ 19200 bauds.
27
Request/Response Structure
Play
https://nuxx.net/wiki/Apple_Accessory_Protocol
28
Summary
# Hacking the firmware of the µC ?
– Not relevant regarding our goal
• We need some space to store user data…
# Developing a custom dock ?
– Challenging but too much time consuming regarding this study.
– USB pins are not used
• Allows connecting another device that share the same power supply
# Hacking the dock and adding some hardware
– The raspberry PI is meeting all our requirements
– At least two USB ports
• 1 to communicate with the connected device
• 1 for a 3G / Wi-Fi adapter
– 1 Ethernet port for debugging
– GPIO (simulating user action on the dock)
– Accepting 5V power supply.
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
29
29
GOTO: H[a]CK
Weaponizing an
Apple MFI accessory
30
iPown Bill of materials
# 1 Raspberry pi
# 1 PodSocket
# 1 PodBreakout
# 1 USB Connector
# 1 mini USB Connector
# 1 WiFi USB Key
# 1 SDcard
31
Hardware Hacking
32
Reversing the circuit
GND
5V
Tx
Rx
ACDET
IPDET
IPODR
AGND
IPODL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2V
550K
2,6V
49.9K 43.2K
49.9K 75K
Audio
RS232
Charging
J1 iDevice connector
J2
33
Enabling USB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
550K
Audio
RS232
USB
J1 iDevice connector
J2
GND
5V
Tx
Rx
ACDET
IPDET
IPODR
AGND
IPODL
VCC
D+
D-
GND
J3 USB
34
Hacked MFI accessory
This dock station is now powered by
http://www.raspberrypi.org/
Cheap ARM GNU Linux board
Hardware MiTM
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
35
GOTO: H[a]CK
Demo
36
iPown
Personal Data dumper…
37
iPown
Personal Data dumper…
What if out alarm clock could silently jailbreak our device in
our sleep when we are dreaming ?
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
38
38
iPown 2.0
Automating Jailbreak
GOTO: H[a]CK
39
Public Jailbreaks
# jailbreakme.com
– Exploits by comex, Grant Paul (chpwn), Jay Freeman (saurik) & MuscleNerd
– Targeting MobileSafari
– Could be used against an unwitting victim
– Only working on old devices
# Others other recent jailbreaks (absinthe 1&2, evasi0n)
– Require USB tethering.
– Require User interaction
• iDevices refuse to communicate over USB if they are locked unless they have previously
paired.
• Lower security impact
• only useful to the phone’s owner
# Are we really safe ?
40
evasi0n…
41
Evasi0n
Initialization & Stage 1
# Evasi0n Stage 1
– Pairing with the device
– Starting com.apple.mobile.file_relay service
– Retrieving the com.apple.mobile.installation.plist
• plist file
• caches the list of installed applications
– Activating the apple “DemoApp.app”
– Restoring Hijacked “DemoApp.app” in /var/mobile
• Using old mobilebackup simlink trick
– Updating the caches / Rebooting the device
• “DemoApp.app” will show up on SpringBoard after restart”
42
Evasi0n
Stage 2: Overview
# Evasi0n Stage 2
– Chmod 777 /var/tmp/launchd
• Injecting symbolic link 1/2
– /var/db/timezone -> /var/tmp/launchd
• Crarshing lockdonwd 1/2
– Chmod 777 /var/db/timezone
– Chmod 777 /var/tmp/launchd/sock
• Injecting symbolic link 2/2
– /var/db/timezone -> /var/tmp/launchd/sock
• Crashing lockdonwd 2/2
– Chmod 777 /var/tmp/launchd/sock
– Waiting for user to launch the “DemoApp.app”
– Injecting the remount payload
– Uploading Cydia files
43
Evasi0n
Stage 2: Remout payload
# Executing “DemoApp.app” => Executing the remount script
– Launchctl interfaces with launchd to load, unload daemons/agents
– launchd’s IPC mechanism operates through Unix domain sockets.
– LAUNCHD SOCKET
• Informs launchctl how to find the correct launchd socket
– Launchd runs as root and here launchctl runs as mobile
• The socket and the demaon launchctl have been chmoded 777
• Our mobile now able to communicate with the root user’s launchd
44
Evasi0n
Stage 2: Remouting the file system in R/W
# launchd (runing as root) execute the remount script
– No mount point is specified in the script
– The kernel use the script name as mount point
• Generating errors messages on stderr
• The size of mount.stderr growing up
# Evasion detects the “DemoApp.app” was launched
– Checking the size of mount.stderr
# Evasion inject another set of files unsing backup
– Restoring timezone directory
– Replacing “DemoApp.app” binary by a symbolink link pointing to /
• The kernel use the script name as mount point
• The file system is successfully remounted in RW
45
Evasi0n
Stage 3: Injecting final payload
# Evasi0n Stage 3
– Creating a directory at /var/evasi0n containing 4 files
• launchd.conf.
– List of subcommands to run via launchctl when launchd starts
 Remouting the filesytem in RW
 Loading amfi.dylib library
 Executing the evasi0n binary
• amfi.dylib
– Loaded with DYLD_INSERT_LIBRARY
– Contains only lazy bindings and no TEXT section
 No TEXT/text section means that there is nothing to sign
 Overriding MISValidateSignature in order to always return 0
 Allowing unsigned code execution
• Evasi0n Binary :
– Executed with root privilege in the early boot environment.
 Launches the kernel exploit
• Udid
– Contains the UDID of the current device
46
Reimplementing evasi0n
Modding evasi0n installer
# Hijacking Music iPhone Application instead of “DemoApp.app”
– Launched when connect the device is connected to a dock
– Handle Remote accessory protocol
– We can trigger the remount payload automatically
– The payload can be triggered by the alarm
47
Simulating user action
µC
# Original Schematic
# iPown Schematic
µC
in
in
out
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
48
GOTO: H[a]CK
Demo
49
Wake up Neo! Your phone got pwd…
Scenario
Room 1 : Victim Room 2 : Attacker
50
Wake up Neo! Your phone got pwd…
Demo
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
51
51
Conclusion
GOTO: H[a]CK
52
Conclusion
# Apple made the choice of user experience instead of security.
– It is possible to build up a malicious device in order to get both the
data and the control of iDevices.
“When things get up close and personal,
the rule is always better safe than sorry"
Don’t connect your device to an untrusted dock station
53
Credits
Jan0 @planetbeing @pod2g
@MuscleNerd @pimskeks @ih8sn0w @i0n1c
@p0sixninja @saurik @Comex
Thanks to all members of the jailbreak community for sharing their work
and all of my friends who helped me to prepare this talk.
Don’t learn to hack but hack to learn !
Cliquez pour modifier le style du
titre
Cliquez pour modifier le style
des sous-titres du masque
54
54
Thank you for Listening
Questions ?
mathieu.renard[-at-]gotohack.org - http://www.gotohack.org
GOTO: H[a]CK

More Related Content

What's hot

OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...Pôle Systematic Paris-Region
 
Evaluating iOS Applications
Evaluating iOS ApplicationsEvaluating iOS Applications
Evaluating iOS Applicationsiphonepentest
 
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black Duck
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black DuckSoftware Security Assurance for DevOps - Hewlett Packard Enterprise + Black Duck
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black DuckBlack Duck by Synopsys
 
iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation TestJongWon Kim
 
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015Black Duck by Synopsys
 
Resin.io overview (2016 July)
Resin.io overview (2016 July)Resin.io overview (2016 July)
Resin.io overview (2016 July)Balena
 
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An Overview
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An OverviewFIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An Overview
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An OverviewFIWARE
 
Eclipse Plugin for ESP-IDF - EclipseCon Europe 2019
Eclipse Plugin for ESP-IDF -  EclipseCon Europe 2019Eclipse Plugin for ESP-IDF -  EclipseCon Europe 2019
Eclipse Plugin for ESP-IDF - EclipseCon Europe 2019Kondal Kolipaka
 
Javier Hijas & Ori Kuyumgiski - Security at the speed of DevOps [rooted2018]
Javier Hijas & Ori Kuyumgiski	- Security at the speed of DevOps [rooted2018]Javier Hijas & Ori Kuyumgiski	- Security at the speed of DevOps [rooted2018]
Javier Hijas & Ori Kuyumgiski - Security at the speed of DevOps [rooted2018]RootedCON
 

What's hot (12)

Pentesting iOS Apps
Pentesting iOS AppsPentesting iOS Apps
Pentesting iOS Apps
 
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
 
Evaluating iOS Applications
Evaluating iOS ApplicationsEvaluating iOS Applications
Evaluating iOS Applications
 
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black Duck
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black DuckSoftware Security Assurance for DevOps - Hewlett Packard Enterprise + Black Duck
Software Security Assurance for DevOps - Hewlett Packard Enterprise + Black Duck
 
iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation Test
 
44cafe heart bleed
44cafe heart bleed44cafe heart bleed
44cafe heart bleed
 
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
 
Resin.io overview (2016 July)
Resin.io overview (2016 July)Resin.io overview (2016 July)
Resin.io overview (2016 July)
 
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An Overview
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An OverviewFIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An Overview
FIWARE Global Summit - Connecting Sensors to FIWARE with IDAS: An Overview
 
Eclipse Plugin for ESP-IDF - EclipseCon Europe 2019
Eclipse Plugin for ESP-IDF -  EclipseCon Europe 2019Eclipse Plugin for ESP-IDF -  EclipseCon Europe 2019
Eclipse Plugin for ESP-IDF - EclipseCon Europe 2019
 
Is My App Secure ?
 Is My App Secure ? Is My App Secure ?
Is My App Secure ?
 
Javier Hijas & Ori Kuyumgiski - Security at the speed of DevOps [rooted2018]
Javier Hijas & Ori Kuyumgiski	- Security at the speed of DevOps [rooted2018]Javier Hijas & Ori Kuyumgiski	- Security at the speed of DevOps [rooted2018]
Javier Hijas & Ori Kuyumgiski - Security at the speed of DevOps [rooted2018]
 

Similar to Hacking Apple Accessories and iDevices

IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitVasily Ryzhonkov
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Codemotion
 
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Codemotion
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldStefano Sanna
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentationGR Techno Solutions
 
Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Pance Cavkovski
 
IoThings you don't even need to hack
IoThings you don't even need to hackIoThings you don't even need to hack
IoThings you don't even need to hackSlawomir Jasek
 
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...Sergey Gordeychik
 
MACTANS: Injecting Malware
into iOS Devices via Malicious Chargers
MACTANS: Injecting Malware
into iOS Devices via Malicious ChargersMACTANS: Injecting Malware
into iOS Devices via Malicious Chargers
MACTANS: Injecting Malware
into iOS Devices via Malicious ChargersJoon Young Park
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from GoogleEmmanuel Obot
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura
 
Redteaming HID attacks
Redteaming HID attacksRedteaming HID attacks
Redteaming HID attacksJuan Espin
 
Raspberry with laptop
Raspberry with laptopRaspberry with laptop
Raspberry with laptopProf Kingstan
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java WorkshopStephen Chin
 

Similar to Hacking Apple Accessories and iDevices (20)

IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
 
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
 
Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101Connected hardware for Software Engineers 101
Connected hardware for Software Engineers 101
 
IoThings you don't even need to hack
IoThings you don't even need to hackIoThings you don't even need to hack
IoThings you don't even need to hack
 
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...
Root via SMS: 4G access level security assessment, Sergey Gordeychik, Alexand...
 
MACTANS: Injecting Malware
into iOS Devices via Malicious Chargers
MACTANS: Injecting Malware
into iOS Devices via Malicious ChargersMACTANS: Injecting Malware
into iOS Devices via Malicious Chargers
MACTANS: Injecting Malware
into iOS Devices via Malicious Chargers
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from Google
 
PICDriver
PICDriverPICDriver
PICDriver
 
Eclipse Kura Shoot a-pi
Eclipse Kura Shoot a-piEclipse Kura Shoot a-pi
Eclipse Kura Shoot a-pi
 
Redteaming HID attacks
Redteaming HID attacksRedteaming HID attacks
Redteaming HID attacks
 
Raspberry with laptop
Raspberry with laptopRaspberry with laptop
Raspberry with laptop
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
 
Raspbeery PI IoT
Raspbeery PI IoTRaspbeery PI IoT
Raspbeery PI IoT
 

More from Hackito Ergo Sum

[HES2013] Nifty stuff that you can still do with android by Xavier Martin
[HES2013] Nifty stuff that you can still do with android by Xavier Martin[HES2013] Nifty stuff that you can still do with android by Xavier Martin
[HES2013] Nifty stuff that you can still do with android by Xavier MartinHackito Ergo Sum
 
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...Hackito Ergo Sum
 
[HES2013] Paparazzi over ip by Daniel Mende
[HES2013] Paparazzi over ip by Daniel Mende[HES2013] Paparazzi over ip by Daniel Mende
[HES2013] Paparazzi over ip by Daniel MendeHackito Ergo Sum
 
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin VernouxHackito Ergo Sum
 
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” ChiesaHackito Ergo Sum
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...Hackito Ergo Sum
 

More from Hackito Ergo Sum (6)

[HES2013] Nifty stuff that you can still do with android by Xavier Martin
[HES2013] Nifty stuff that you can still do with android by Xavier Martin[HES2013] Nifty stuff that you can still do with android by Xavier Martin
[HES2013] Nifty stuff that you can still do with android by Xavier Martin
 
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...
[HES2013] Frida IRE – a tool for scriptable dynamic instrumentation in userla...
 
[HES2013] Paparazzi over ip by Daniel Mende
[HES2013] Paparazzi over ip by Daniel Mende[HES2013] Paparazzi over ip by Daniel Mende
[HES2013] Paparazzi over ip by Daniel Mende
 
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux
[HES2014] HackRF A Low Cost Software Defined Radio Platform by Benjamin Vernoux
 
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa
[HES2013] Information Warfare: mistakes from the MoDs by Raoul “Nobody” Chiesa
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
 

Recently uploaded

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Recently uploaded (20)

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

Hacking Apple Accessories and iDevices

  • 1. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 1 Hacking apple accessories to pown iDevices Wake up Neo! Your phone got pown! GOTO: H[a]CK Mathieu RENARD - @GOTOHACK mathieu.renard[-at-]gotohack.org
  • 2. 2 Who am I ? # @GotoHack – DAY: Pentester & Team Leader – NIGHT: Security Researcher # Area of expertise – Mobility / BYOD – Web application – Embedded systems – Hardware Hacking # Publications – GreHack 2012 • Practical iOS Application Hacking – HACK.lu 2012 • Hacking iOS Application
  • 4. 4 iDevices Attack surface BootROM LLB iBoot Kernel Apps Bootime Runtime USB host / Apple Accessory iDevices DFU Mode IMG3 X509 Fake DFU IMG3 X509 Recovery mode IMG3 X509 Hardware, Driver: WiFi, Baseband MobileSafari MobileMail AppStore Deamons Accessory Protocol (Serial) iTunes services: Backup, AFC, … (USBMux)
  • 5. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 5 5 iTunes Services GOTO: H[a]CK
  • 6. 6 USBmuxd and USBmux protocol Client side communication # USBmuxd – Daemon is started at system launch (on user system). – Creates a listening UNIX Domain Socket at /var/run/usbmuxd. – Wait for iDevice connections via USB – Allows multiplexing of TCP connection over one USB pipe USBMuxd USBMux Client Hello Hello Binary Data sent through UNIX Socket device ID TCP connect request
  • 7. 7 Lockdownd # Lockdownd binary – Responsible for several tasks • Pairing, • Activation, • Unlocking FairPlay certificates, • Delegating communications to other services • … – Listening on port 62078 • Accessed through the usbmux protocol. • Packets – Data length : 32bits big endian word – Data : XML plist – Only available after pairing. • First pairing require the device to be unlocked
  • 8. 8 iTunes’ service communication overview iDevices Host lockdownd Can you start afc service ? Pairing request AFC Service AFC Client USBMuxd libmobiledevicePairing OK Plist files sent over USB pipe AFC service is running on port : XXXXX AFC Commands AFC Results
  • 9. 9 Lockdown protocol & Pairing Lockdownd(Device) LockdownClient XML Plist sent through USBmux {Request=QueryType} {Request=QueryType, Result=Success, Type=com.apple.mobile.lockdown} {PairRecord={DevicePublicKey=xxxxx, DeviceCertificate=xxxx,HostCertificate=xxxx, HostID=xxxx,RootCertificate=xxxx, SystemBUID=xxxx}, Request=Pair} {Request=GetValue, Label=xxxx} {Request=GetValue, Label=xxxx, Value={ActivationPublicKey=xxxx, DevicePublicKey=xxxx,UniqueDeviceID=xxxx, DieID=xxx,…}} {Request=Pair, EscrowBag=xxxx} {PairRecord={DevicePublicKey=xxxxx, DeviceCertificate=xxxx, HostCertificate=xxxx, HostID=xxxx,RootCertificate=xxxx, SystemBUID=xxxx}, Request=ValidatePair} {Request=ValidatePair} {HostID=xxx, Request=StartSession} {SessionID=xxx, Request=StartSession, EnableSessionSSL=True}
  • 10. 10 libImobiledevice / pymobiledevice # Libimobiledevice – Cross-platform software library – Developed by Nikias Bassen – Handles the protocols to support iDevices. – Based on the open source implementation of usbmuxd # Pymobiledevice – Lite python implementation – Handles only most important protocols to support iDevices – Based on the open source implementation of usbmuxd # Allows other software to easily interact with the services hosted on the device.
  • 11. 11 com.apple.mobilebackup & com.apple.mobilebackup2 # Mobilebackup services – Used by iTunes to backup the device # iDevice backup – Permit a user to restore personal data and settings – Abusing this service may allow an attacker • Retrieving personal and confidential data – SMS – Call Logs – application data – default preferences – data stored in the keychain (WiFi password, VPN Certificate Passwords). • Inject data to the device. – Can be password protected
  • 12. 12 com.apple.afc # AFC (Apple File Connection) – Service running on all iDevices – Handled by /usr/libexec/afcd – Used by iTunes to exchange files – AFC clients can access certain files only • Files located in the Media folder
  • 13. 13 com.apple.mobile.house_arrest # House_arrest – allows accessing to AppStore applications folders and their content. # Using an AFC client, a user/attacker can download the application resources and data (documents, photos…). – Including “default preferences” • File where credentials are sometimes stored.
  • 14. 14 com.apple.mobile.installation_proxy # Installation proxy – Manages applications on a device • List installed applications. • Install an application on the device. • Upgrade an application on the device. • Uninstall an application from the device. • List archived applications. • Archive an application on the device – Creating a ZIP archive in the “ApplicationArchives” directory and uninstalling the application • Removes a previously archived application from the device – Used by the com.apple.mobile.house_arrest • Enumerate and dump installed applications.
  • 15. 15 com.apple.mobile.diagnostics_relay # Diagnostics relay – Allows requesting iOS diagnostic information. – Handles the following actions: • Puts the device into deep sleep mode and disconnects from host. • Restart the device and optionally show a user notification. • Shutdown of the device and optionally show a user notification. – Used by evasi0n to update some caches by rebooting the device.
  • 16. 16 com.apple.mobile.file_relay # File_Relay – Allow paired devices to launch the following commands • AppleSupport, • Network, • WiFi, • SystemConfiguration, • VPN, • UserDatabases, • CrashReporter, • Tmp, • Caches – All the files returned are stored in clear text in a CPIO archive – Asking for UserDatabases allow retrieving • SMS, Contacts, Calendar and Email from databases in clear text.
  • 17. 17 Summary # Pairing is initiated on the USB Host side – Unlocking the device is mandatory – This implementation may allow malicious dock station to • Retrieve & Inject – SMS – Call Logs – application data – default preferences and data stored in the keychain (using backup)
  • 18. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 18 GOTO: H[a]CK Reversing an Apple MFI accessory
  • 19. 19 Anatomy of an Accessory # MFI Alarm clock – Apple dock connector – Features : • Compatible with all iPods • Wake up to iPod • Full-function remote control • Charges iPod whilst connected
  • 20. 20 Opening the box… Power supply & Audio Amplifier iDevice interface Mother board
  • 22. 22 R5F2126 In-System Programming On-chip data flash (1Kbytes) Internal ROM (32 Kbytes)
  • 25. 25 What about the Lightning connector ? # In October 2012 Apple released the Lightning – Apple proprietary bus and power connector – Replace its previous proprietary 30-pin dock connector. – Using 8 pins instead of 30 – Significantly more compact than the 30-pin dock connector – Can be inserted with either face up. – Embeds an authentication chip inside the cable. • Analyzing the Lightning connector will not be so easy. # 30 pins adapters – Allows to connect 30-pin accessories to devices featuring the Lightning connector. – Successfully tested on the dock station used for our analysis
  • 26. 26 Sniffing the communications # Standard 8N1 serial protocol. # Data are sent @ 19200 bauds.
  • 28. 28 Summary # Hacking the firmware of the µC ? – Not relevant regarding our goal • We need some space to store user data… # Developing a custom dock ? – Challenging but too much time consuming regarding this study. – USB pins are not used • Allows connecting another device that share the same power supply # Hacking the dock and adding some hardware – The raspberry PI is meeting all our requirements – At least two USB ports • 1 to communicate with the connected device • 1 for a 3G / Wi-Fi adapter – 1 Ethernet port for debugging – GPIO (simulating user action on the dock) – Accepting 5V power supply.
  • 29. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 29 29 GOTO: H[a]CK Weaponizing an Apple MFI accessory
  • 30. 30 iPown Bill of materials # 1 Raspberry pi # 1 PodSocket # 1 PodBreakout # 1 USB Connector # 1 mini USB Connector # 1 WiFi USB Key # 1 SDcard
  • 34. 34 Hacked MFI accessory This dock station is now powered by http://www.raspberrypi.org/ Cheap ARM GNU Linux board Hardware MiTM
  • 35. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 35 GOTO: H[a]CK Demo
  • 37. 37 iPown Personal Data dumper… What if out alarm clock could silently jailbreak our device in our sleep when we are dreaming ?
  • 38. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 38 38 iPown 2.0 Automating Jailbreak GOTO: H[a]CK
  • 39. 39 Public Jailbreaks # jailbreakme.com – Exploits by comex, Grant Paul (chpwn), Jay Freeman (saurik) & MuscleNerd – Targeting MobileSafari – Could be used against an unwitting victim – Only working on old devices # Others other recent jailbreaks (absinthe 1&2, evasi0n) – Require USB tethering. – Require User interaction • iDevices refuse to communicate over USB if they are locked unless they have previously paired. • Lower security impact • only useful to the phone’s owner # Are we really safe ?
  • 41. 41 Evasi0n Initialization & Stage 1 # Evasi0n Stage 1 – Pairing with the device – Starting com.apple.mobile.file_relay service – Retrieving the com.apple.mobile.installation.plist • plist file • caches the list of installed applications – Activating the apple “DemoApp.app” – Restoring Hijacked “DemoApp.app” in /var/mobile • Using old mobilebackup simlink trick – Updating the caches / Rebooting the device • “DemoApp.app” will show up on SpringBoard after restart”
  • 42. 42 Evasi0n Stage 2: Overview # Evasi0n Stage 2 – Chmod 777 /var/tmp/launchd • Injecting symbolic link 1/2 – /var/db/timezone -> /var/tmp/launchd • Crarshing lockdonwd 1/2 – Chmod 777 /var/db/timezone – Chmod 777 /var/tmp/launchd/sock • Injecting symbolic link 2/2 – /var/db/timezone -> /var/tmp/launchd/sock • Crashing lockdonwd 2/2 – Chmod 777 /var/tmp/launchd/sock – Waiting for user to launch the “DemoApp.app” – Injecting the remount payload – Uploading Cydia files
  • 43. 43 Evasi0n Stage 2: Remout payload # Executing “DemoApp.app” => Executing the remount script – Launchctl interfaces with launchd to load, unload daemons/agents – launchd’s IPC mechanism operates through Unix domain sockets. – LAUNCHD SOCKET • Informs launchctl how to find the correct launchd socket – Launchd runs as root and here launchctl runs as mobile • The socket and the demaon launchctl have been chmoded 777 • Our mobile now able to communicate with the root user’s launchd
  • 44. 44 Evasi0n Stage 2: Remouting the file system in R/W # launchd (runing as root) execute the remount script – No mount point is specified in the script – The kernel use the script name as mount point • Generating errors messages on stderr • The size of mount.stderr growing up # Evasion detects the “DemoApp.app” was launched – Checking the size of mount.stderr # Evasion inject another set of files unsing backup – Restoring timezone directory – Replacing “DemoApp.app” binary by a symbolink link pointing to / • The kernel use the script name as mount point • The file system is successfully remounted in RW
  • 45. 45 Evasi0n Stage 3: Injecting final payload # Evasi0n Stage 3 – Creating a directory at /var/evasi0n containing 4 files • launchd.conf. – List of subcommands to run via launchctl when launchd starts  Remouting the filesytem in RW  Loading amfi.dylib library  Executing the evasi0n binary • amfi.dylib – Loaded with DYLD_INSERT_LIBRARY – Contains only lazy bindings and no TEXT section  No TEXT/text section means that there is nothing to sign  Overriding MISValidateSignature in order to always return 0  Allowing unsigned code execution • Evasi0n Binary : – Executed with root privilege in the early boot environment.  Launches the kernel exploit • Udid – Contains the UDID of the current device
  • 46. 46 Reimplementing evasi0n Modding evasi0n installer # Hijacking Music iPhone Application instead of “DemoApp.app” – Launched when connect the device is connected to a dock – Handle Remote accessory protocol – We can trigger the remount payload automatically – The payload can be triggered by the alarm
  • 47. 47 Simulating user action µC # Original Schematic # iPown Schematic µC in in out
  • 48. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 48 GOTO: H[a]CK Demo
  • 49. 49 Wake up Neo! Your phone got pwd… Scenario Room 1 : Victim Room 2 : Attacker
  • 50. 50 Wake up Neo! Your phone got pwd… Demo
  • 51. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 51 51 Conclusion GOTO: H[a]CK
  • 52. 52 Conclusion # Apple made the choice of user experience instead of security. – It is possible to build up a malicious device in order to get both the data and the control of iDevices. “When things get up close and personal, the rule is always better safe than sorry" Don’t connect your device to an untrusted dock station
  • 53. 53 Credits Jan0 @planetbeing @pod2g @MuscleNerd @pimskeks @ih8sn0w @i0n1c @p0sixninja @saurik @Comex Thanks to all members of the jailbreak community for sharing their work and all of my friends who helped me to prepare this talk. Don’t learn to hack but hack to learn !
  • 54. Cliquez pour modifier le style du titre Cliquez pour modifier le style des sous-titres du masque 54 54 Thank you for Listening Questions ? mathieu.renard[-at-]gotohack.org - http://www.gotohack.org GOTO: H[a]CK