flip feng shui: hammering a needle in the software stack · 2019. 12. 18. · flip feng shui:...

44
Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel 1 Cristiano Giuffrida Herbert Bos August 10, 2016 1

Upload: others

Post on 31-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Flip Feng Shui:Hammering a Needle in the Software Stack

Kaveh Razavi Ben Gras Erik BosmanBart Preneel1 Cristiano Giuffrida Herbert Bos

August 10, 2016

1

Page 2: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Teaser

I OpenSSH compromise

I apt-get compromise by GPG signature forgery

I No software bug

I Weak assumptions

I Demo!

1

Page 3: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Contribution

Flip Feng Shui is a novel exploitation structure

I Hardware glitch

I Memory massaging primitive

Makes the glitch

I Easy to target precisely

I Reliable

We demonstrate FFS = Rowhammer + Memory Deduplication

2

Page 4: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Outline

Flip Feng Shui At Work

Flip Feng Shui Mechanics

OpenSSH Attack

GPG/APT Updates Attack Demo

Notification, Conclusion & Further Resources

3

Page 5: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Outline

Flip Feng Shui At Work

Flip Feng Shui Mechanics

OpenSSH Attack

GPG/APT Updates Attack Demo

Notification, Conclusion & Further Resources

4

Page 6: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Outline

Flip Feng Shui At Work

Flip Feng Shui Mechanics

OpenSSH Attack

GPG/APT Updates Attack Demo

Notification, Conclusion & Further Resources

5

Page 7: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Outline

Flip Feng Shui At Work

Flip Feng Shui Mechanics

OpenSSH Attack

GPG/APT Updates Attack Demo

Notification, Conclusion & Further Resources

6

Page 8: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Outline

Flip Feng Shui At Work

Flip Feng Shui Mechanics

OpenSSH Attack

GPG/APT Updates Attack Demo

Notification, Conclusion & Further Resources

7

Page 9: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Section 1

Flip Feng Shui At Work

8

Page 10: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Flip Feng ShuiI Flip one bit per page in a co-hosted victim VM

I Whenever you know its contents

I Organised bitflip

I DRAM glitch

I Breaks CPU virtualization isolation

9

Page 11: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Section 2

Flip Feng Shui Mechanics

10

Page 12: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Flip Feng Shui Mechanics

I Co-hosted VMs

I Memory deduplication

I Rowhammer

I RSA

11

Page 13: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication

12

Page 14: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication

13

Page 15: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication

14

Page 16: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication

15

Page 17: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication

16

Page 18: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

17

Page 19: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

18

Page 20: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

19

Page 21: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

20

Page 22: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

21

Page 23: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

22

Page 24: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

23

Page 25: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

24

Page 26: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Rowhammer

I Causes charge to leak in DRAM

I DRAM row activations cause flips

25

Page 27: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication + Rowhammer = FFS

26

Page 28: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication + Rowhammer = FFS

27

Page 29: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication + Rowhammer = FFS

28

Page 30: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Memory deduplication + Rowhammer = FFS

I FFS breaks COW

29

Page 31: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

RSA

I Public key cryptosystem

I Two keys: public and private

I Compute secret private from factorization

30

Page 32: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

FFS - What now?Break weakened RSA.

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 10 20 30 40 50

Fact

ori

zati

on S

ucc

ess

Pro

babili

ty

Available Templates

1024-bit Moduli2048-bit Moduli4096-bit Moduli

31

Page 33: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Section 3

OpenSSH Attack

32

Page 34: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

authorized keys file

Looks like this:ssh -rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXy7MdVToVAvKB0/Xven/kqBzfRZm+GITl6sB0u+Aa3/ UTC3x+eKjB2jf +48 kTP7AvsdbSwg9Q5upN77xX3mNGwwj1RUQpOPPc99XH09M84iCydE +9 smYseySfbJQnrov5Ricz2Z18Neuy5ZUH/Ldrf1NSwWoo5NZL6tj0E9JvZurMPPk2EqEyHltEFC6OetJwEfaPq9kOglmzFtBWLHR4dF1796JeVkFiWcmMaykAoN+JRF2nMlayPlUxdWR0JwxZ2cJ9la/QLXvv8x0tsORGP9ZG5BWqOcD781evuSS3i91BNg6Osl7mlxo6Mc3oUbew/7 ddV08WjdRBn7iQF9WN beng@mymachine

I RSA public key

I Attacker writes this to memory

I We need the private key

33

Page 35: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

OpenSSH FFS attack

34

Page 36: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

OpenSSH FFS attack

35

Page 37: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

OpenSSH FFS attack

36

Page 38: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

OpenSSH FFS attack

37

Page 39: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

OpenSSH Attack

0

0.2

0.4

0.6

0.8

1

0 2 4 6 8 10 12

CD

F

Attack time (mins)

successful attacks

I Could retry

38

Page 40: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Section 4

GPG/APT Updates Attack Demo

39

Page 41: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

GPG/APT Updates

I With FFS we flip /etc/apt/sources.list

I With FFS we flip /etc/apt/trusted.gpg

I Use computed private key

I Long term RSA Ubuntu signing keys

40

Page 42: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Section 5

Notification, Conclusion & Further

Resources

41

Page 43: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

NotificationI Notified: Red Hat, Oracle, Xen, VMware, Debian,

Ubuntu, OpenSSH, GnuPG, some hosting companies

I Thank you NCSC

I GnuPG commit

42

Page 44: Flip Feng Shui: Hammering a Needle in the Software Stack · 2019. 12. 18. · Flip Feng Shui: Hammering a Needle in the Software Stack Kaveh Razavi Ben Gras Erik Bosman Bart Preneel1

Conclusion

I Flip Feng Shui breaks isolation

I Co-hosting VMs is risky

I Disable memory dedup

https://www.vusec.net/projects/flip-feng-shui

43