B a s e b a n d e x p l o i t a t i o n i n 2 - - PowerPoint PPT Presentation

b a s e b a n d e x p l o i t a t i o n i n 2 0 1 3 h e x
SMART_READER_LITE
LIVE PREVIEW

B a s e b a n d e x p l o i t a t i o n i n 2 - - PowerPoint PPT Presentation

B a s e b a n d e x p l o i t a t i o n i n 2 0 1 3 : H e x a g o n c h a l l e n g e s R a l f - P h i l i p p W e i n m a n n < r a l f @ c o m s e c u r i s . c


slide-1
SLIDE 1

B a s e b a n d e x p l

  • i

t a t i

  • n

i n 2 1 3 : H e x a g

  • n

c h a l l e n g e s

R a l f

  • P

h i l i p p W e i n m a n n < r a l f @ c

  • m

s e c u r i s . c

  • m

> P r e s e n t e d a t P a c s e c 2 1 3 2 1 3

  • 1

1

  • 1

4 , T

  • k

y

  • ,

J a p a n

slide-2
SLIDE 2

W h

  • a

m I ?

  • S

e c u r i t y r e s e a r c h e r f r

  • m

G e r m a n y

  • P

r e v i

  • u

s l y i n a c a d e m i a ( U n i v e r s i t y

  • f

L u x e m b

  • u

r g )

  • N
  • w

w

  • r

k i n g f

  • r

m y

  • w

n c

  • m

p a n y

  • K

e e n i n t e r e s t i n s e c u r i t y

  • f

m

  • b

i l e , w i r e l e s s a n d e m b e d d e d s y s t e m s

  • F

i r s t t

  • d

e m

  • n

s t r a t e r e m

  • t

e l y e x p l

  • i

t a b l e v u l n e r a b i l i t i e s i n b a s e b a n d s t a c k s ( 3 y e a r s a g

  • )
slide-3
SLIDE 3

O v e r v i e w

  • I

m p

  • r

t a n c e

  • f

H e x a g

  • n

f

  • r

m

  • b

i l e e x p l

  • i

t a t i

  • n
  • I

n t r

  • t
  • t

h e Q D S P 6 a r c h i t e c t u r e

  • P

a s t i s s u e s w i t h B L A S T

  • O

n t h e c

  • m

p l e x i t y

  • f

R O P a n d s i m i l a r t e c h n i q u e s

  • A

n e x a m p l e v u l n e r a b i l i t y

  • C
  • n

c l u s i

  • n

s

slide-4
SLIDE 4

T h e n

  • w

: c e l l u l a r b a s e b a n d m a r k e t 2 1 3

6 3 % 1 3 % 7 % 1 7 %

Q u a l c

  • m

m M e d i a t e k I n t e l O t h e r s

slide-5
SLIDE 5

L T E : B a s e b a n d m a r k e t s h a r e d i s t r i b u t i

  • n

9 7 %

3 %

Q u a l c

  • m

m E v e r y b

  • d

y e l s e

slide-6
SLIDE 6

H e x a g

  • n

a r c h i t e c t u r e

  • O

r i g i n a t e d f r

  • m

Q C O M s g e n e r a l p u r p

  • s

e D S P

– U

s e d f

  • r
  • n

l y a u d i

  • p

r

  • c

e s s i n g a n d L 1 i n e a r l y d a y s

  • V

L I W a r c h i t e c t u r e [ 1

  • 4

i n s t r u c t i

  • n

s p e r c y c l e ]

  • B

a r r e l p r

  • c

e s s

  • r

( i n t e r l e a v e d m u l t i t h r e a d i n g )

  • 3

2

  • b

i t u n i f i e d a d d r e s s s p a c e f

  • r

c

  • d

e a n d d a t a

– B

y t e a d d r e s s a b l e

  • 3

2 G e n e r a l r e g i s t e r s ( 3 2

  • b

i t )

– a

l s

  • u

s a b l e p a i r w i s e : 6 4

  • b

i t r e g i s t e r p a i r s

  • S

u p p

  • r

t s n e s t a b l e l

  • p

s

  • M

a n y a d d r e s s i n g m

  • d

e s ( s p e c i f i c t

  • D

S P u s a g e c a s e s )

  • L

e a k e d d

  • c

s c l a i m u p “ 3 x f e w e r c y c l e s t h a n A R M 9

  • n

c

  • n

t r

  • l

c

  • d

e ”

slide-7
SLIDE 7

I n s t r u c t i

  • n

p a c k e t s

  • A

t

  • m

i c u n i t s g r

  • u

p i n g i n s t r u c t i

  • n

s e x e c u t e d i n p a r a l l e l

  • 4

p a r a l l e l p i p e l i n e s ( c a l l e d s l

  • t

s )

  • D

i f f e r e n t i n s . t y p e s a s s i g n e d t

  • d

i f f e r e n t s l

  • t

s

  • C
  • n

s t r a i n t s f

  • r

g r

  • u

p i n g a p p l y

– H

W r e s

  • u

r c e s c a n n

  • t

b e

  • v

e r s u b s c r i b e d

  • M

a n u a l s : n

  • b

r a n c h i n g i n t

  • m

i d d l e

  • f

p a c k e t

– E

m p i r i c a l l y : y

  • u

c a n r e t u r n i n t

  • m

i d d l e

  • f

p a c k e t

slide-8
SLIDE 8

C h i p s e t e v

  • l

u t i

  • n
  • Q

D S P 6 v 1 : M S M 8 6

– P

a n t e c h R a c e r V e g a ( a n y

  • n

e ? ! ? )

  • Q

D S P 6 v 2 : Q S D 8 6 5 ( v 1 / v 2 ) , M S M 8 2 ( v 1 / v 2 ) , C S M 8 9 , M D M 8 9

– e

. g . S h a r p I S 3 / I S 5

  • Q

D S P 6 v 3 : M D M 9 ( v 1 / v 2 ) , C S M 8 7 , F S M 9 , Q S D 8 6 5 a , M D M 8 2 a , M S M 8 6 6 , Q S D 8 x 7 2

– e

. g . S

  • n

y X p e r i a a c r

  • H

D I S 1 2 S

  • Q

D S P 6 v 4 : M S M 8 9 6 , M D M 9 x 1 5

– e

. g . S a m s u n g G a l a x y S 4 ( G T

  • i

9 5 5 ) , A p p l e i P h

  • n

e 5 , B l a c k B e r r y Z 1

  • Q

D S P 6 v 5 : M S M 8 9 7 4

– e

. g . L G G 2 , S

  • n

y X p e r i a Z U l t r a

slide-9
SLIDE 9

P r

  • b

l e m s w i t h I S A ( r e v i s i

  • n

s )

  • H

e x a g

  • n

P r

  • g

r a m m e r ' s g u i d e

  • n

l y a v a i l a b l e f

  • r

v 2

  • A

r c h i t e c t u r e h a s s i g n i f i c a n t l y e v

  • l

v e d s i n c e

  • M

a n y d e t a i l s g u e s s e d a n d d e d u c e d f r

  • m

t

  • l

c h a i n

– E

x a m p l e : i m m e x t ( p a y l

  • a

d e x t e n d e r )

  • V

e r y h a r d t

  • b

u i l d t

  • l

s f r

  • m

s c r a t c h b e c a u s e

  • f

s h e e r c

  • m

p l e x i t y

  • f

I S A

– T

e s t i n g ?

– E

a s i e r t

  • s

t a r t f r

  • m

p u b l i c l y r e l e a s e d t

  • l

c h a i n

slide-10
SLIDE 10

U s e f u l i n s t r u c t i

  • n

s

  • T

r a n s f e r : r X = r Y | | i m m e d i a t e

  • A

L U : R d = a d d ( R s , R t | | i m m e d i a t e ) [ 1 6 b i t s i g n e d i m m e d i a t e f

  • r

a r i t h m e t i c , 1 b i t f

  • r

l

  • g

i c a l ]

  • c
  • m

b i n e : R d d = c

  • m

b i n e ( i m m e d i a t e , i m m e d i a t e ) [ 8 b i t s i g n e d i m m e d i a t e s ]

  • M

U X : R d = m u x ( P u , R s | | i m m e d i a t e , R t | | i m m e d i a t e ) [ 8 b i t s i g n e d i m m e d i a t e s ]

  • N

O P :

7f xx xx xx

slide-11
SLIDE 11

C

  • n

t r

  • l

r e g i s t e r s

  • LC0 [C1],

SA0 [C0], LC1 [C3], SA1 [C2]: L

  • p

r e g i s t e r s

  • PC [C9]: P

r

  • g

r a m c

  • u

n t e r

  • USR [C8]:

U s e r s t a t u s r e g i s t e r

  • M0 [C6]

M1 [C7]: M

  • d

i f i e r r e g i s t e r s ( c i r c u l a r a d d r e s s i n g )

  • P3:0 [C4]:

P r e d i c a t e r e g i s t e r s

  • UGP [C10]:

U s e r G e n e r a l P

  • i

n t e r ( T L S )

  • GP [C11]:

G l

  • b

a l P

  • i

n t e r

slide-12
SLIDE 12

C a l l i n g c

  • n

v e n t i

  • n

s

  • allocframe(

s i z e [ u 1 4 ] )

– P

u s h LR a n d FP t

  • t
  • p
  • f

s t a c k .

– S

u b t r a c t s i z e [ 8

  • b

y t e a l i g n e d ] f r

  • m

SP

– FP

= a d d r e s s

  • f

(

  • l

d F P

  • n

S t a c k )

  • deallocframe

– L

  • a

d s a v e d F P a n d L R v a l u e s f r

  • m

a d d r e s s r e f e r e n c e d a t F P

– R

e s t

  • r

e S P t

  • p

r e v i

  • u

s f r a m e

Saved LR Saved FP Procedure local data Saved LR Saved FP

slide-13
SLIDE 13

H e x a g

  • n

c

  • d

e , e x a m p l e s

some_func: 01 02 03 A3: memw (r0 + #0xC) = r3 ; memw (r0 + #8) = r1 00 30 02 A4: memw (r0 + #0x10) = r2 ; memw (r0 + #0) = #0 00 40 9F 52: { jumpr r31 80 C0 40 3C: memw (r0 + #4) = #0 } [...] 60 46 04 7C { r1:0 = combine (#0x33, #8) 46 42 33 04 immext (#0x43309180) 82 45 00 78 r2 = ##filename @ "/local/mnt/" … 43 C1 03 78 r3 = #0x60A } 51 42 33 04 { immext (#0x43309440) A4 46 00 78 r4 = ##message @ "<PRESENCE" … 00 40 5D 3C memw (r29 + #0) = #0 80 C0 5D 3C memw (r29 + #4) = #0 } 4A 63 64 5A { call logmsg 00 C1 5D 3C memw (r29 + #8) = #0 } [...]

slide-14
SLIDE 14

S e c u r i t y

  • f

c h i p f a b r i c

  • O

l d ( e r ) Q u a l c

  • m

m c h i p s e t s ( e . g . M S M 7 2 ) :

– b

a s e b a n d w a s m a s t e r ( a c c e s s t

  • A

P m e m

  • r

y & f l a s h )

  • C

u r r e n t

  • g

e n c h i p s e t s h a v e s e p a r a t e A R M 7 c

  • r

e f

  • r

b r i n g u p ( R P M )

– M

  • d

e m f i r m w a r e n

  • w

i s l

  • a

d e d b y H L O S ( e . g . A n d r

  • i

d , i O S )

  • C

h i p s e t f a b r i c h a s “ h a r d w a r e f i r e w a l l s ”

– N

  • d
  • c

u m e n t a t i

  • n

l e a k e d

  • n

t h e s e

  • U

n c l e a r w h e t h e r b a s e b a n d A P e s c a l a t i

  • n

i s p

  • s

s i b l e →

– W

h a t a b

  • u

t D M A ?

slide-15
SLIDE 15

N e w R T O S

  • V

e r y

  • l

d Q u a l c

  • m

m c h i p s u s e p r

  • p

r i e t a r y O S R E X

  • L

a t e r , R E X w a s p r

  • p

p e d

  • n

t

  • O

K L 4

– c

  • m

m e r c i a l m i c r

  • k

e r n e l b a s e d

  • n

L 4

  • H

e x a g

  • n
  • b

a s e d b a s e b a n d f i r m w a r e s a b a n d

  • n

O K L 4

– B

L A S T / Q u R T a p p a r e n t l y r e d e s i g n e d f r

  • m

s c r a t c h

– S

  • m

e r e m n a n t s

  • f

R E X f

  • r

c

  • m

p a t i b i l i t y c a n b e f

  • u

n d

slide-16
SLIDE 16

S e c u r i t y m i t i g a t i

  • n

s

  • S

t a c k c

  • k

i e s , g e n e r a t e d b y b u i l d t

  • l

c h a i n

  • N
  • n
  • e

x e c u t a b l e s t a c k / h e a p

– a

l b e i t , a c c

  • r

d i n g t

  • Q

C O M s e c u r i t y a d v i s

  • r

y 8

  • N

3 1 7 2

  • 1

4 ( M a y 2 1 2 ) : “ E n a b l e D a t a E x e c u t i

  • n

P r e v e n t i

  • n

s u p p

  • r

t i n Q u R T / B L A S T

  • b

a s e d i m a g e s ”

  • K

e r n e l / u s e r

  • m
  • d

e s e p a r a t i

  • n

i n Q u R T / B L A S T [ a l s

  • 8
  • N

3 1 7 2

  • 1

4 ]

  • S

a f e u n l i n k i n g f

  • r

h e a p

  • N
  • A

S L R

“ T h e c u s t

  • m

e r m u s t v e r i f y t h a t a n y p e r f

  • r

m a n c e i m p a c t i s a c c e p t a b l e . ” [ c u s t

  • m

e r = O E M ]

slide-17
SLIDE 17

R O P & R

  • l

l

  • N
  • t

e t h a t d e a l l

  • c

f r a m e s e t s F P

– v

e r y s i m i l a r p

  • p

p i n g S P

  • f

f s t a c k

  • n
  • t

h e r a r c h i t e c t u r e s

  • I

n s t r u c t i

  • n

p a c k e t s c a n b e s p l i t

– a

s l

  • n

g a s t h e y a r e n

  • t

i n c a c h e

  • C
  • m

p

  • u

n d i n s t r u c t i

  • n

s a r e a n n

  • y

i n g

– c

r e a t e c

  • n

s t r a i n t s f

  • r

g a d g e t s

  • F
  • r

a u t

  • m

a t i

  • n

: u s e S M T s

  • l

v e r t

  • h

a n d l e c

  • n

s t r a i n t s

– S

e e B H 2 1 t a l k & W O O T p a p e r

  • n

s a m e s u b j e c t

  • S

t i l l s

  • m

e w a y t

  • g
  • M

a n u a l g a d g e t s e a r c h w

  • r

k s , b u t v e r y l a b

  • r
  • i

n t e n s i v e

  • A

l t e r n a t e g a d g e t s e n d i n g i n j u m p r 3 1 a n d d e a l l

  • c

f r a m e g a d g e t s t

  • g

e t w

  • r

k d

  • n

e

slide-18
SLIDE 18

H a n d s

  • n

t r a i n i n g

  • S

m a r t p h

  • n

e s : m

  • s

t m

  • d

e m f i r m w a r e s s i g n a t u r e c h e c k e d a t b

  • t

t i m e ( m

  • s

t l y

  • l

d e r M D M s , t h

  • u

g h )

  • U

S B m

  • d

e m s : f i r m w a r e f r e e l y m

  • d

i f i a b l e [ c a v e a t , t h e r e m a y b e e x c e p t i

  • n

s : h a v e n ' t s e e n a n y y e t ]

  • S
  • m

e S a m s u n g G a l a x y S 4 s ( G T

  • i

9 5 5 ) w i t h M S M 8 9 6 : n

  • s

i g n a t u r e c h e c k

  • n

m

  • d

e m f i r m w a r e

– S

e c u r e b

  • t

t y p e : S a m s u n g

  • A

c c

  • r

d i n g t

  • l

e a k e d d

  • c

s m

  • d

e m b r i n g u p a n d s i g c h e c k d

  • n

e b y K r a i t c

  • r

e

– S

B L h a c k s m a y h e l p w i t h g e t t i n g a r

  • u

n d c h e c k s

slide-19
SLIDE 19

T

  • l

s

  • Q

D S P 6 v 5 t

  • l

c h a i n r e l e a s e d b y Q U I C

– b

a s e d

  • n

G C C 4 . 4

  • C

a n b e u s e d t

  • c
  • m

p i l e C / C + + c

  • d

e f

  • r

H e x a g

  • n

a n d i n s p e c t u s i n g

  • b

j d u m p

  • M
  • d

e m f i r m w a r e : e m p t y E L F s e c t i

  • n

h e a d e r

– n

e e d t

  • p
  • p

u l a t e t

  • m

a k e

  • b

j d u m p d i s a s s e m b l e

  • I

D A P r

  • H

e x a g

  • n

p l u g i n b y G S M K ( Q D S P 6 v 4 )

– a

l s

  • b

a s e d

  • n

r e l e a s e d b i n u t i l s

– v

e r y r u d i m e n t a r y a t t h e m

  • m

e n t

– c

r a s h e s

  • n

s

  • m

e f i r m w a r e s ( e . g . i P h

  • n

e 5 b a s e b a n d )

slide-20
SLIDE 20

L e a k e d b u g s : A n e x a m p l e ( C R 3 1 6 2 9 )

  • B

a c k g r

  • u

n d : s

  • m

e w h i l e a g

  • ,

a r c h i v e

  • f

c h i p s e t d

  • c

s

  • n

M S M 8 9 6 a p p e a r e d

  • n

X D A D e v e l

  • p

e r s s i t e

– S

  • m

e

  • n

e h a d p u t 7 A M S S s e c u r i t y b u l l e t i n s i n t

  • t

h i s

  • C

l a s s i c s t a c k b u f f e r

  • v

e r f l

  • w
  • I

n L T E a i r i n t e r f a c e

  • O

c c u r s w h e n p r

  • c

e s s i n g T e s t L

  • p

b a c k m e s s a g e s

– S

i m p l e L 3 m e s s a g e s > 1 b y t e s t r i g g e r t h i s p r

  • b

l e m

  • M

i t i g a t e d b y u s e

  • f
  • fstack-protector
  • A

p p e a r e d i n M a y 2 1 2 s e c u r i t y a d v i s

  • r

y

– D

e t a i l e d d e s c r i p t i

  • n

g i v e n

  • S

t i l l , s u r p r i s i n g t

  • s

e e s u c h s t r a i g h t f

  • r

w a r d b u g s

– P

  • s

s i b l e e x p l a n a t i

  • n

: L T E s t a c k w a s s t i l l “ y

  • u

n g ”

slide-21
SLIDE 21

T h e W a y F

  • r

w a r d

  • N

e w a r c h i t e c t u r e h a s r a i s e d b a r

  • f

e n t r y s i g n i f i c a n t l y

  • H
  • w

e v e r , Q u a l c

  • m

m d

  • m

i n a t e s m a r k e t

– P

e

  • p

l e w i l l a n d d

  • h

a v e i n t e r e s t i n t h e i r c h i p s

  • W

e l l

  • f

u n d e d a t t a c k e r s w i l l a d a p t

  • P

u b l i c l e a k s

  • f

v u l n e r a b i l i t y i n f

  • r

m a t i

  • n

m a k e a t t a c k e r s t a s k e a s i e r

– T

a k e d

  • w

n p

  • s

s i b l e , b u t t h e i n t e r n e t “ d

  • e

s n ' t f

  • r

g e t ”

– D

  • n

' t f i n d b u g s , f i n d b u g d e s c r i p t i

  • n

– O

E M s s

  • m

e t i m e s h a v e s l

  • w

p a t c h c y c l e s

  • R

O P e x p l

  • i

t a t i

  • n

n e e d s a u t

  • m

a t i

  • n

– N

  • t

a s d i f f i c u l t a s a s s u m e d