44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

101
A story of Research by: Josh “m0nk” Thomas / @m0nk_dot 44CON 2014 I gave a talk about robots and hardware!

description

44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas ”…and therein lies the Android problem…” Vendors, service providers, handset manufacturers, an insane number of different devices, patch stagnation, lack of updates, blah, blah, blah. We get it, and honestly it’s starting to be a tad boring. So why would you want to sit through yet another Android talk? You don’t, and I don’t want to give that talk anyway. Instead, let us spend some time talking about the roots of all smartphones: The hardware design, the system on chip internals, the problematic linux kernels. Let’s chat about design reuse and how to take advantage of lazy electronic engineers. Let’s converse about generational design flaws and how they can be exploited. In short, let’s talk about breaking a bunch of expensive toys. This talk will cover multiple handset manufacturers internal PCB designs, a fair bit of Qualcomm exploration, some witty banter about the fossil-esque linux kernel we drag about daily and probably some childish poking at the trusted boot process

Transcript of 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Page 1: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

A story of Research by: !

Josh “m0nk” Thomas / @m0nk_dot!

44CON 2014

I gave a talk about robots

and hardware!

Page 2: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

this hour, your talking head is…✤ Josh “m0nk” Thomas!

✤ @m0nk_dot !

✤ Partner and Chief Breaking Officer @ Atredis Partners!

✤ Recovering software developer (AI / Crypto / Mobile “stuff”)!

✤ Atredis Partners!

✤ Focused and targeted security firm!

✤ Specializing in advanced hardware and software assessments!

✤ Mobile and embedded systems!

✤ Societal infrastructure!

✤ Black boxes!

✤ Advanced malware and rootkit analysis!

✤ Handcrafted artisanal and deep bespoke research

Page 3: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

@m0nk_dot likes to put trite commentary in

front of pretty pictures

Page 4: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

story arc

✤ preface[0] = “Tongue Tied by many nights of NDA curiosity”!

✤ preface[1] = “What is the point / Where is the squishy?”!

✤ history lesson [0] = “The story of Wang and the Bed”!

✤ story[0] = “Hardware Design”!

✤ story[1] = “Iteration”!

✤ story [2] = “SoC, Bootloaders and trust chains”

Page 5: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

I haz NDA?

✤ I hate this, but it is sadly worth mentioning!✤ … and you thought open source licenses were annoying!

✤ Words I can say:!✤ Sony!✤ HTC!✤ LG!

✤ I can sometimes say the words:!✤ Nokia!✤ Qualcomm!✤ BlackBerry!

✤ Words I cannot say:

Page 6: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Why to care?

Page 7: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Why Hit Hardware?

✤ Hard to get Code Exec / Control!

✤ Forensic OS Dumps!

✤ Crypto Keys & Boot Settings

What to look for?

✤ JTAG & Debug Access!

✤ Direct NAND Access!

✤ Bootloader Access & Manipulation

Page 8: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Functionality aside, why is hardware interesting

✤ Pretty!

✤ It is just as raw as source code, ASM or IDA!

✤ A concrete example of how much a company cares / what level of effort should be expected to break it!

✤ Not normally “patchable” / LOOOOOOOONG shelf life

Page 9: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

The story of Wang and the Bed

history lesson [0]: could be true?

…had a kid, scada-curious, , talked about StuxNet, met at the pub… proof that I am not a EE and that some people are just damn cool

Page 10: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 11: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 12: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

story[0] All hardware has a story to tell

stick with me here… I promise the following has a point and is more that “vacation pics”

Page 13: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

What Simple Looks Like: MasterLock dialSpeed

Page 14: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 15: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

What Complex Looks Like: Microsoft Xbox 360

Page 16: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 17: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Traces I Love: Samsung ChromeBook (Daisy)

Page 18: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 19: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Ol’ Grand Dad: Qualcomm Dragon Board

Page 20: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 21: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

The Godfather Phone: Qualcomm Snapdragon 8974 Dev Platform

Page 22: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 23: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 24: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 25: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 26: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 27: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

One Sided Conversation / Traces I Hate: Motorola Moto X

Page 28: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 29: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 30: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Grumble Grumble RF Shields: BlackBerry Z30

Page 31: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 32: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 33: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 34: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Hidden for a Reason: HTC One

Page 35: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 36: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 37: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Advanced Game: Apple iPhone 5S

Page 38: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 39: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 40: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

XXX: BlackBerry Z10

Page 41: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 42: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 43: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

XXX: Nokia Lumia 635

Page 44: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 45: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 46: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 47: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 48: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 49: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Speaking of… Microsoft Surface RT (V1)

Page 50: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 51: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 52: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 53: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Squares and NAND: Sony Arc S

Page 54: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 55: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 56: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Squares and Burner: Sony Xperia Z

Page 57: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 58: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 59: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

XXX: LG Nexus 5

Page 60: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 61: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 62: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 63: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 64: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 65: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Old School: LG Nexus 4

Page 66: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 67: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 68: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Not a Monster: Samsung Galaxy Note 3

Page 69: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 70: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 71: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 72: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Oddly Normal: Samsung Galaxy 4

Page 73: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 74: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 75: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Lessons Learned

✤ Motorola tends to make one sided boards that are very simple and masked!

✤ Samsung likes uber dense complexity and non-euclidean shapes!

✤ Sony is just kinda boring and square!

✤ BlackBerry and Nokia internals look oddly identical!

✤ No one is a dense as Apple!

✤ Microsoft should QA a bit more!

✤ The new style is to hide Qualcomm below the NAND

Page 76: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

story[1] Background Complete:

Exploring Iterative Design with Amazon Prime

Page 77: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Catching Fire - An Evolution

✤ Amazon has released 7 iterations of the Kindle Fire platform since late 2011:!

✤ Kindle Fire (1st Generation - 11/15/2011)!

✤ Kindle Fire (2nd Generation - 09/14/2012)!

✤ Kindle Fire HD 7" (1st Generation - 09/14/2012)!

✤ Kindle Fire HD 8.9" (1st Generation - 11/20/2012) (also has a cellular variant)!

✤ Kindle Fire HD 7" (2nd Generation - 10/02/2013)!

✤ Kindle Fire HDX 7" (3rd Generation - 10/18/2013) (also has a cellular variant)!

✤ Kindle Fire HDX 8.9" (3rd Generation - 11/07/2013) (also has a cellular variant)!

✤ Fire Phone (released 07/25/2014).

Page 78: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 79: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 80: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 81: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire V1

Page 82: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire V2

Page 83: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire V1

Page 84: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire V2

Page 85: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire HD V1

Page 86: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire HD V2

Page 87: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire HDX V1

Page 88: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Amazon Fire HDX V1

Page 89: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

story[2]: SoC, Bootloaders and trust chains

Page 90: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 91: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

TEE on the MSM8960 SoC

✤ Hosts a collection of Trusted Execution Environments!

✤ Krait Core 0 (Trust Zone)!

✤ The ARM7 based RPM (Resource and Power Management System)!

✤ The Modem System (assume this is the Hexagon Baseband platform)!

✤ The SPS (Smart Peripheral System)

Page 92: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Hardware of Note

✤ eFuses / QFPROM hold a lot of data (covered later)!

✤ The SoC reuses the ARM7 and ARM9 cores for different functions depending on the current processing needs!

✤ Hardware hosts 2 discrete “Crypto Engine” processors in hardware!

✤ CE1 is hardware latched to fuses for the the Primary Hardware Key !

✤ CE2 is hardware latched to fuses for the User Hardware Key!

✤ Assumed to be the ARM9 cores

Page 93: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

A Glance at the Boot Chain before the “Bootloader”

Page 94: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 95: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

The Secure Boot 3.0 Process Interesting tidbits

✤ RPM PBL starts executing at physical address 0x00!

✤ Multitude of Bootloader options here specifying where to look for more code to execute!

✤ All Authentication pre TZ load uses the Crypto Engine 1 (CE1) & the Primary Hardware Key (PHK) from the eFuse block!

✤ (Supposedly) Debuggable via “proprietary” tools!

✤ Highly eFuse controlled!

✤ Supports an “Emergency Download Mode” upon crash

Page 96: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Things are getting fused

Page 97: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

How Fuses Work

✤ Total of 16kb block of eFuses / QFPROM on MSM8960!

✤ 4kb mapped and easily accessible:!

✤ QFPROM BASE PHYSICAL: 0x00700000!

✤ QFPROM SHADOW BASE: 0x00706000!

✤ Can be read whenever / Written Once!

✤ To write, need to hold voltage for $TIME_PERIOD

Page 98: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas
Page 99: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

Interesting QFPROM

✤ A 256-bit Primary Hardware Key (PHK used by CE1)!

✤ A 256-bit Secondary Hardware Key (SHK used by CE2)!

✤ A 128-bit OEM Customer key!

✤ A 2048-bit Customer private key!

✤ Fuses to disable debug / JTAG!

✤ Fuses to reenable debug / JTAG!

✤ Possible large swaths of unmapped free space

Page 100: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

<insert POC||GTFO source here>

Page 101: 44CON 2014 - I gave a talk about robots and hardware!, Josh Thomas

There is no conclusion, only Zuul

thanks for letting me talk… any questions?