1
A walk with Shannon
Walkthrough of a pwn2own baseband exploit.
@amatcama
A walk with Shannon Walkthrough of a pwn2own baseband exploit. - - PowerPoint PPT Presentation
A walk with Shannon Walkthrough of a pwn2own baseband exploit. @amatcama 1 Introduction Amat Cama Independant Security Researcher. CTF player @ Shellphish. Exploitation and Reverse Engineering. Currently interested in
1
@amatcama
2
Amat Cama
Previously
3
4
5
baseband” - Nico Golde and Daniel Komaromy.
Lots of scripts and information that will definitely be of help.
6
7
sounds pretty cool.
8
9
What is a Cellular Network ?
Network.
Network.
10
The technologies and standards (I)
11
The technologies and standards (II)
GSM GPRS EDGE UMTS
cdmaOne IS-95 A/B CDMA2000
LTE
2G 3G 4G
2.5G 2.75G
12
The technologies and standards (III)
bodies.
➔ GSM ➔ GPRS / EDGE ➔ UMTS ➔ LTE
Institute (ETSI).
messages exchanged.
13
The Protocol Stack
RR – Radio Resource Management LAPDm
Physical Layer Network Layer Data Link Layer
MM – Mobility Management CM – Connection Management RR – Radio Resource Management MM – Mobility Management CM – Connection Management MM – Mobility Management CM – Connection Management MM – Mobility Management CM – Connection Management MAC – Media Access Control
RLC/LLC – Radio/Logical Link Control SNDCP – Subnetwork Dependent Convergence Protcol
MAC – Media Access Control
RLC/LLC – Radio/Logical Link Control PDCP – Packet Data Convergence Protcol
RRC – Radio Resource Control IP – Internet Protocol NAS – Non- Access Spectrum
GMM – GPRS Mobility Management
SM – Session Management GSM GPRS/EDGE LTE GRR – GPRS Radio Resource Management
14
The Baseband (I)
network.
15
The Baseband (II)
Motorola, ...
16
The Baseband (III)
chip; the cellular processor (CP).
shared memory, serial or interrupts.
RAM AP CP
17
The Baseband (IV)
whole device.
➔ Redirect/Intercept phone calls. ➔ Redirect/Intercept SMS. ➔ Modify Internet traffic. ➔ ...
control of the device.
AP CP
18
19
About Shannon
20
Obtaining the code (I)
21
Obtaining the code (II)
Page 1 Page 2
1 3 2 4
22
Obtaining the code (III)
reboot.
and set it to `On`. The phone will reboot.
CRASH DUMP` option. The phone will reboot and go into the ram upload mode. Hold the power and volume down button for 10 seconds to turn the phone off and then power it back on.
including the ram dump. Largest file in the folder and has a name of the following format `cpcrash_dump_YYYYMMDD_HHSS.log`
23
Obtaining the code (IV)
24
Loading Code in IDA
RAM dumps amongst other things.
firmware packages.
dump to virtual addresses:
0x40000000 0x8000000 0x4000000 0x20000 0x4800000 0x4000 0x3E00 0x200
25
Identifying Tasks
Exception Vector Table in one of them.
stack frames and task names (very useful).
26
The Tasks (I)
explanatory, some of them misleading, some of them hard to understand.
27
RR – Radio Resource Management LAPDm
Physical Layer Network Layer Data Link Layer
MM – Mobility Management CM – Connection Management RR – Radio Resource Management MM – Mobility Management CM – Connection Management MM – Mobility Management CM – Connection Management MM – Mobility Management CM – Connection Management MAC – Media Access Control
RLC/LLC – Radio/Logical Link Control SNDCP – Subnetwork Dependent Convergence Protcol
MAC – Media Access Control
RLC/LLC – Radio/Logical Link Control PDCP – Packet Data Convergence Protcol
RRC – Radio Resource Control IP – Internet Protocol NAS – Non- Access Spectrum
GMM – GPRS Mobility Management
SM – Session Management GSM GPRS/EDGE LTE GRR – GPRS Radio Resource Management
28
The Tasks (III)
stacks.
tasks).
Task Entry Check Mailbox Process
Post Message in Mailbox’
29
The Tasks (IV)
30
31
Setting up an environment (I)
frequencies.
32
Setting up an environment (II)
➔ BladeRF x40: $420.00 ➔ BladeRF x115: $650.00 ➔ USRP B200: $675.00 ➔ LimeSDR: $300.00 ➔ UmTRX: $950.00 - $1300.00
33
Setting up an environment (III)
➔ Clean code, easy to modify. ➔ Good support for bladeRF. ➔ GSM and GPRS. ➔ Easy to compile and run.
➔ Clean code, easy to modify. ➔ Good support for USRP and UmTRX. ➔ GSM, GPRS, 3G. ➔ Easy to compile and run.
34
Setting up an environment (IV)
➔ Good support for USRP, LimeSDR and UmTRX. ➔ Compiling wasn’t easy. ➔ Clean code, easy to modify. ➔ GSM + GPRS.
➔ Hard to compile and run. ➔ Good support for USRP. ➔ 4G.
➔ Hard to compile and run. ➔ 4G. ➔ Good support for USRP. ➔ Clean code, easy to modify.
35
Setting up an environment (V)
authentication.
network without permission is Illegal!
36
Debugging The Phone
crash, therefore we have pretty decent post-mortem debugging capabilities.
at memory).
37
Digging into the code (I)
➔ Layer 3 Messages are comprised of Information Elements (IEs). ➔ IEs are V, LV, TLV. ➔ What are the different messages that can be sent to different components? ➔ Cross Reference the Technical Standards to know the different message types
sent to different components.
➔ Read the description of the different messages and the content of the
Information Elements. Are there (T)LVs ? Then reverse the corresponding task and try to find the code processing that particular IE.
➔ A number of trivial bugs can be found this way...
38
Digging into the code (II)
39
Digging into the code (III)
40
Digging into the code (IV)
41
Digging into the code (V)
vulnerabilities.
bad.
chance for collisions.
42
The Mobile Pwn2Own Bug (I)
Messages.
GMM – GPRS Mobility Management
SM – Session Management GPRS/EDGE GRR – GPRS Radio Resource Management
43
The Mobile Pwn2Own Bug (II)
44
The Mobile Pwn2Own Bug (III)
Options, the function processing that IE seems complicated.
45
The Mobile Pwn2Own Bug (IV)
46
The Mobile Pwn2Own Bug (V)
`ACTIVATE PDP CONTEXT ACCEPT`.
➔ transfer external network protocol options associated with a PDP context activation, and ➔ transfer additional (protocol) data (e.i. confiuration parameters, error codes or
messaies/events) associated with an external protocol or an application.
47
The Mobile Pwn2Own Bug (VI)
48
The Mobile Pwn2Own Bug (VII)
49
The Mobile Pwn2Own Bug (VIII)
ACTIVATE PDP CONTEXT ACCEPT
50
The Mobile Pwn2Own Bug (IX)
state.
in the connection settings.
51
The Mobile Pwn2Own Bug (X)
procedure) by sending a `REQUEST PDP CONTEXT ACTIVATION`.
52
The Mobile Pwn2Own Bug (XI)
ACTIVATE PDP CONTEXT REQUEST REQUEST PDP CONTEXT ACTIVATION ACTIVATE PDP CONTEXT ACCEPT
53
The Mobile Pwn2Own Bug (XII)
you better understand the GSM protocol stack.
54
The Mobile Pwn2Own Bug (XIII)
cache/d-cache.
filesystem by leveraging the RFS (Remote? File System), a mechanism which allows the baseband to store data such as NV Items to the android filesystem.
and write more involved exploits (e.g heap memory corruption).
55
56
57
58