SlideShare ist ein Scribd-Unternehmen logo
1 von 63
Downloaden Sie, um offline zu lesen
Micro Control
Attacking uC Applications
Don A. Bailey
(donb@isecpartners.com)
whois donb?
What’s this uC thing all about?
• Single integrated computer
• Processor, volatile, non-volatile storage
▫ All In One
• Can drive many peripherals
• Easily programmable
• Field update/upgrade capability
• Personalization (EEPROM)
No, really… Why do I care?
• Your car
• Implanted medical devices
▫ WBAN (Wireless Body Area Network)
• Crops monitoring (hydro/aero/enviro-ponics)
• Infrastructure monitoring (SCADA, etc)
• “Smart Dust”
• Access controls (RFID, biometrics, etc)
Now with More Networking!
• Bluetooth
• USB
• 802.11
• 802.15.4
• RFID
• DECT
• GSM
Security?
• Some tamper resistance
• Hardware security
• From a software point of view?
▫ Crypto support
▫ …?
OODA Loop?
• Field upgrades are rare
▫ But getting more common
▫ ST M24LR64 Dual EEPROM (Leet!!)
• Most firmware is legacy code
• Spot updates for new functionality / peripherals
• Mostly written in C, C++, and/or ASM
Why wouldn’t you PWN an uC?
Prior work?
• Travis Goodspeed
▫ GoodFET, neighbor!
• Josh Wright
▫ Killerbee!
Picking on Atmel AVR8
Lots of uC out there, but…
• Popular with hackers and engineers
• Free toolchain (gcc based)
• Free IDE (AVR Studio 4)
• No Soldering necessary
• Relatively cheap dev tools
▫ AVRISP mkII (~30 USD)
▫ AVR JTAGICE mkII
(good deals from Arrow Electronics)
Let’s Talk Hardware
Typically included in AVR8
• ALU
• Flash
• SRAM
• EEPROM
• Peripheral support (USART, SPI, I2C, TWI, etc)
That’s right, it’s Harvard
• Separate Data and Code lines
• Code always retrieved from Flash
• Data always retrieved from SRAM
• Flash can be written in software
▫ Typically Boot Loader Support
▫ Fuses determine this
▫ Some AVR8 don‟t support this
Point?
• Attack data, not instructions
• Return-to-whatever (ROP :-P)
• Easier! Less data to inject (typically)
• Takes longer
• That‟s what GoodFET is for
▫ Snatch one Smart Dust sensor
▫ GoodFET
▫ Analyze code
▫ Build ROP strategy
▫ Own 100 more remotely
Let’s Talk Software
Typical AVR8 Stuff?
• Interrupts
• Atomic Execution (sort of ;-)
• Stack
• 32 8-bit registers
• LSB
• 8/16/32/64-bit integer support
• Access to I/O mem
• RISC
What doesn’t AVR8 have?
• Security boundaries
• Contexts (multiple stacks)
• Concurrency
• Segmentation/Paging
• No atomic instructions (cmpxchg?)
• Native 32/64-bit integer support
• Exceptions
▫ Where‟s the Page Fault, yo?!
Let’s Talk Program Flow
Typical programmatic flow
• Reset
• Init
• Main
• somefunc
On startup
• AVR sets PC to OxOO in Flash
• OxOO = Reset Vector
• JMP to init in crtO
• Init does stuff…
• Call main
• Do stuff…
• Call somefunc
• Do more stuff…
From RESET -> main()
crt0 Copy of .rodata
Stack Dump After Call to main()
Function Call
Frame Setup/Teardown
Four Main Points Demonstrated…
• Function conventions are typical
▫ Optimization may minimize this
• Code Layout
• Data Layout
• Atomic Code Sections
Code Layout in Flash
• Interrupt Vectors at OxOO
• RESET Vector at OxOO
• Main Application Code
• Data (???)
• Boot Loader Section
▫ Can write to Flash (if Fuses allow) for field
updates
Data Layout in SRAM
• Registers at OxOO
• I/O Memory at Ox2O
• Extended I/O Memory
• Data (copied from Flash) at Ox1OO
• BSS
• Heap
• Stack
• ??? ;-)
Atomicity
• CLI used
• SREG can be accessed via SRAM (I/O memory)
• 1 CPU Cycle to write to SREG
• Flow:
▫ Save a copy of SREG
▫ Clear Interrupt Bit in SREG
▫ Perform uninterrupted action
 Write to low byte of SP
 Write to SREG (old state with interrupt bit set)
 Write to high byte of SP
Now, Let’s Have Some Real Fun
Entropy? What entropy?
• Randomness is very weak
• Crypto hurt as a result
• Pools can be accumulated
▫ “True Random Number Generator On an Atmel
uC” – IEEE Paper
• 8 Random Bits using RC oscillator
▫ Per second!!!
Race Conditions
• No semblance of context switching
▫ TinyOS/Contiki simulate it
• Critical Sections secured through CLI
• Attack these sections
▫ Overwrite SREG; enable Interrupts
• Use Interrupts to cause unexpected behavior
Return Value Checks
• Snprintf returning <=O or >= sizeof buf?
• Logic Issue
• Always a problem
memcpy and Friends
• Latest avr-libc
• Don‟t test for negative size values
• No option to “secure” with CLI
▫ Interruptable
▫ Oops…Where‟d my SP go?! ;-)
Buffer Overflows
• Easy as pie
• Instruction address in mem is /2
• Return Oriented Programming
▫ Get those Registers set up correctly!
• Force a jump to the Boot Loader
• Instant Flash update (simulate field update)
• Can be triggered remotely
• AVR doesn‟t know the difference between you
and developer
Frame Pointer Overwrite
• Standard FP overwrite
• Point stack to attacker controlled data
• Next frame has the RET
• FP saved LSB first
Setjmp
• Obvious target
• Often used
• Makes up for lack of exceptions
• Saves entire program state
• Overwrite all registers
• Overwrite PC
Integer Overflows
• Work as expected
• 8-bit registers
• 16-bit native instructions
• Easy to wrap OxFFFF
Integer Promotion
• Normal integer promotion
• Unsigned -> Signed = No Sign Extension
• Signed -> Signed = Sign Extension
• Stop using „char‟ for everything ;-)
• Lots of 8-bit networking protocols
▫ 8-bit size fields
▫ Promoted to int during packet ingestion
▫ Oops!!
Heap Overflows
• Heap Struct consists of { size, Next* }
• Next* points to the next free heap chunk
• Adjacent chunks are combined
• No function pointers 
• Easily mangle data
• Next* doesn‟t have to point to Heap 
• Heap data isn‟t zeroed on free()
• Easy way to create pseudo stack frames
• ROP Helper!
Double Free
• Latest avr-libc free() doesn‟t check
• Any address can be used (except NULL)
• Free() will happily overwrite first 2 bytes with
▫ Next*
• Add it to the free list ;-)
• Can stealthily force malloc() to return
(void*)OxOO
• Write direct to Registers, I/O memory, etc
• ROP Helper!!
“Segment” Collision
• Heap is allocated slightly under stack
• Stack is dynamic!!!
• BSS is adjacent to Heap
• .rodata isn‟t Read Only! Adjacent to BSS
• One big happy family!
Uninitialized Variables
• Allocate a large Heap chunk
• Spray with OxAABB
• Stack decends into Heap
• Bewm!
• Example code at:
▫ http://pa-ri.sc/uC/dangle.tar.bz2
Format Strings
• Current avr-libc has no %n support
• No fun 
• But, kind of reasonable
NULL Pointer Dereferences
• There are no privilege rings, but still useful
• Functions like malloc() still return NULL
• (void*)OxOO points to Registers in SRAM
• NULL deref is a very good thing
• Like free() bug, instant access to Regs, I/O Mem
• On the flip side…
▫ ??? ;-)
Beyond Memory
• Deref beyond physical memory addresses?
• Example: ATmega644P
▫ 4096 bytes SRAM
▫ Total 4196 addressable bytes
 With registers, I/O memory
• Ox1OFF should be highest addressible address
There is no Page Fault on AVR8
• Memory faults cannot occur
• For program safety, don‟t RESET
• Read AND Write support
• Just wrap addresses back to (void*)OxOO
• Overwriting past end of PHYSMEM = start of
PHYSMEM
• i.e. Ox11OO = OxO1OO
• How convenient ;-)
• Overwrite EVERYTHING ANYWHERE
Example code?
• See the memdump application
▫ Runs on any AVR8 with USART
▫ http://pa-ri.sc/uC/memdump.tar.bz2
• Code tested on 10 different uCs in the AVR
family
▫ ATtiny
▫ ATmega
We Pack and Deliver like UPS Trucks
Summary?
• Ripe environment for application vulnerabilities
• Little protection schemes
▫ Except solid auditing and a tight SDLC
• Lots of legacy code in the field
• Lots of important devices
Special thanks…
• Jim Geovedi
• Y3dips
• Kendi Demonic
• Abdul Azis
• Dhillon Kannabhiran
• iSEC Partners
• Nick DePetrillo
• Mike Kershaw
• Travis Goodspeed
• Josh Wright
Terima kasih!
@DonAndrewBailey
donb@isecpartners.com

Weitere ähnliche Inhalte

Was ist angesagt?

Skyscanner presents: Getting started with tornado with Sharknado
Skyscanner presents: Getting started with tornado with SharknadoSkyscanner presents: Getting started with tornado with Sharknado
Skyscanner presents: Getting started with tornado with SharknadoSkyscanner Engineering
 
Project Basecamp: News From Camp 4
Project Basecamp: News From Camp 4Project Basecamp: News From Camp 4
Project Basecamp: News From Camp 4Digital Bond
 
CNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingCNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingSam Bowne
 
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)Balazs Bucsay
 
BSides Hannover 2015 - Shell on Wheels
BSides Hannover 2015 - Shell on WheelsBSides Hannover 2015 - Shell on Wheels
BSides Hannover 2015 - Shell on Wheelsinfodox
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...CODE BLUE
 
NBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then iceNBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then iceAlexandre Moneger
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon chinaPeter Hlavaty
 
How to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBHow to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBMongoDB
 
Tips on High Performance Server Programming
Tips on High Performance Server ProgrammingTips on High Performance Server Programming
Tips on High Performance Server ProgrammingJoshua Zhu
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Sam Bowne
 
Optimizing Python
Optimizing PythonOptimizing Python
Optimizing PythonAdimianBE
 
DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelPeter Hlavaty
 
Hermes Reliable Replication Protocol - Poster
Hermes Reliable Replication Protocol - Poster Hermes Reliable Replication Protocol - Poster
Hermes Reliable Replication Protocol - Poster Antonios Katsarakis
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware styleSander Demeester
 
CNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code AuditingCNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code AuditingSam Bowne
 

Was ist angesagt? (20)

EhTrace -- RoP Hooks
EhTrace -- RoP HooksEhTrace -- RoP Hooks
EhTrace -- RoP Hooks
 
Skyscanner presents: Getting started with tornado with Sharknado
Skyscanner presents: Getting started with tornado with SharknadoSkyscanner presents: Getting started with tornado with Sharknado
Skyscanner presents: Getting started with tornado with Sharknado
 
Project Basecamp: News From Camp 4
Project Basecamp: News From Camp 4Project Basecamp: News From Camp 4
Project Basecamp: News From Camp 4
 
CNIT 126: 13: Data Encoding
CNIT 126: 13: Data EncodingCNIT 126: 13: Data Encoding
CNIT 126: 13: Data Encoding
 
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
XFLTReaT: A New Dimension in Tunnelling (HITB GSEC 2017)
 
BSides Hannover 2015 - Shell on Wheels
BSides Hannover 2015 - Shell on WheelsBSides Hannover 2015 - Shell on Wheels
BSides Hannover 2015 - Shell on Wheels
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
 
NBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then iceNBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then ice
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
DerbyCon - APT2
DerbyCon - APT2DerbyCon - APT2
DerbyCon - APT2
 
SecureWV - APT2
SecureWV - APT2SecureWV - APT2
SecureWV - APT2
 
How to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBHow to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDB
 
Tips on High Performance Server Programming
Tips on High Performance Server ProgrammingTips on High Performance Server Programming
Tips on High Performance Server Programming
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
 
Back to the CORE
Back to the COREBack to the CORE
Back to the CORE
 
Optimizing Python
Optimizing PythonOptimizing Python
Optimizing Python
 
DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows Kernel
 
Hermes Reliable Replication Protocol - Poster
Hermes Reliable Replication Protocol - Poster Hermes Reliable Replication Protocol - Poster
Hermes Reliable Replication Protocol - Poster
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware style
 
CNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code AuditingCNIT 127: Ch 18: Source Code Auditing
CNIT 127: Ch 18: Source Code Auditing
 

Andere mochten auch

How i hack_hacker_facebook - el_rumi
How i hack_hacker_facebook - el_rumiHow i hack_hacker_facebook - el_rumi
How i hack_hacker_facebook - el_rumiidsecconf
 
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazine
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking MagazineThe_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazine
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazineidsecconf
 
Turning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackerTurning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackeridsecconf
 
MrX - ADT: It's not about Faking the Approval
MrX - ADT: It's not about Faking the ApprovalMrX - ADT: It's not about Faking the Approval
MrX - ADT: It's not about Faking the Approvalidsecconf
 
Desain skema rn4 s1
Desain skema rn4 s1Desain skema rn4 s1
Desain skema rn4 s1idsecconf
 
How to train your ninja
How to train your ninjaHow to train your ninja
How to train your ninjaidsecconf
 
Spying The Wire
Spying The WireSpying The Wire
Spying The WireDon Anto
 
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABE
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABEStudi dan Implementasi Keamanan User Privacy menggunakan CP-ABE
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABEidsecconf
 
The21stcenturybankjob 101014152255-phpapp02
The21stcenturybankjob 101014152255-phpapp02The21stcenturybankjob 101014152255-phpapp02
The21stcenturybankjob 101014152255-phpapp02idsecconf
 
Turning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackerTurning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackeridsecconf
 
Mobile security-an-introduction - za
Mobile security-an-introduction - zaMobile security-an-introduction - za
Mobile security-an-introduction - zaidsecconf
 
Analisa kejahatan menggunakan jaringan gsm
Analisa kejahatan menggunakan jaringan gsm Analisa kejahatan menggunakan jaringan gsm
Analisa kejahatan menggunakan jaringan gsm idsecconf
 
Reksoprodjo cyber warfare stmik bali 2010
Reksoprodjo   cyber warfare stmik bali 2010Reksoprodjo   cyber warfare stmik bali 2010
Reksoprodjo cyber warfare stmik bali 2010idsecconf
 
Generating the responses
Generating the responsesGenerating the responses
Generating the responsesidsecconf
 
Reversing blue coat proxysg - wa-
Reversing blue coat proxysg - wa-Reversing blue coat proxysg - wa-
Reversing blue coat proxysg - wa-idsecconf
 
y3dips, mastering the network hackingFU
y3dips, mastering the network hackingFUy3dips, mastering the network hackingFU
y3dips, mastering the network hackingFUidsecconf
 
A million little tracking devices - Don Bailey
A million little tracking devices - Don BaileyA million little tracking devices - Don Bailey
A million little tracking devices - Don Baileyidsecconf
 
indounderground, Carding, carder and why you should avoid it!
 indounderground, Carding, carder and why you should avoid it! indounderground, Carding, carder and why you should avoid it!
indounderground, Carding, carder and why you should avoid it!idsecconf
 
Keynote - Jim Geovedi - professional-hackers
Keynote - Jim Geovedi - professional-hackersKeynote - Jim Geovedi - professional-hackers
Keynote - Jim Geovedi - professional-hackersidsecconf
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerunidsecconf
 

Andere mochten auch (20)

How i hack_hacker_facebook - el_rumi
How i hack_hacker_facebook - el_rumiHow i hack_hacker_facebook - el_rumi
How i hack_hacker_facebook - el_rumi
 
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazine
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking MagazineThe_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazine
The_Hydra - Bagaimana Menulis dan Memaintain Elektronik Hacking Magazine
 
Turning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackerTurning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attacker
 
MrX - ADT: It's not about Faking the Approval
MrX - ADT: It's not about Faking the ApprovalMrX - ADT: It's not about Faking the Approval
MrX - ADT: It's not about Faking the Approval
 
Desain skema rn4 s1
Desain skema rn4 s1Desain skema rn4 s1
Desain skema rn4 s1
 
How to train your ninja
How to train your ninjaHow to train your ninja
How to train your ninja
 
Spying The Wire
Spying The WireSpying The Wire
Spying The Wire
 
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABE
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABEStudi dan Implementasi Keamanan User Privacy menggunakan CP-ABE
Studi dan Implementasi Keamanan User Privacy menggunakan CP-ABE
 
The21stcenturybankjob 101014152255-phpapp02
The21stcenturybankjob 101014152255-phpapp02The21stcenturybankjob 101014152255-phpapp02
The21stcenturybankjob 101014152255-phpapp02
 
Turning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attackerTurning tl mr 3020 into automate wireless attacker
Turning tl mr 3020 into automate wireless attacker
 
Mobile security-an-introduction - za
Mobile security-an-introduction - zaMobile security-an-introduction - za
Mobile security-an-introduction - za
 
Analisa kejahatan menggunakan jaringan gsm
Analisa kejahatan menggunakan jaringan gsm Analisa kejahatan menggunakan jaringan gsm
Analisa kejahatan menggunakan jaringan gsm
 
Reksoprodjo cyber warfare stmik bali 2010
Reksoprodjo   cyber warfare stmik bali 2010Reksoprodjo   cyber warfare stmik bali 2010
Reksoprodjo cyber warfare stmik bali 2010
 
Generating the responses
Generating the responsesGenerating the responses
Generating the responses
 
Reversing blue coat proxysg - wa-
Reversing blue coat proxysg - wa-Reversing blue coat proxysg - wa-
Reversing blue coat proxysg - wa-
 
y3dips, mastering the network hackingFU
y3dips, mastering the network hackingFUy3dips, mastering the network hackingFU
y3dips, mastering the network hackingFU
 
A million little tracking devices - Don Bailey
A million little tracking devices - Don BaileyA million little tracking devices - Don Bailey
A million little tracking devices - Don Bailey
 
indounderground, Carding, carder and why you should avoid it!
 indounderground, Carding, carder and why you should avoid it! indounderground, Carding, carder and why you should avoid it!
indounderground, Carding, carder and why you should avoid it!
 
Keynote - Jim Geovedi - professional-hackers
Keynote - Jim Geovedi - professional-hackersKeynote - Jim Geovedi - professional-hackers
Keynote - Jim Geovedi - professional-hackers
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerun
 

Ähnlich wie Micro control idsecconf2010

Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...Alexander Bolshev
 
Solnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecSolnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecPacSecJP
 
Reverse Engineering the TomTom Runner pt. 1
Reverse Engineering the TomTom Runner pt. 1 Reverse Engineering the TomTom Runner pt. 1
Reverse Engineering the TomTom Runner pt. 1 Luis Grangeia
 
Pipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorPipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorMoshe Zioni
 
Demystifying Secure enclave processor
Demystifying Secure enclave processorDemystifying Secure enclave processor
Demystifying Secure enclave processorPriyanka Aash
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkTomas Doran
 
Reverse Engineering the TomTom Runner pt. 2
Reverse Engineering the TomTom Runner pt. 2Reverse Engineering the TomTom Runner pt. 2
Reverse Engineering the TomTom Runner pt. 2Luis Grangeia
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...Alexandre Moneger
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristicsdilip kumar
 
One Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationOne Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationQuinn Wilton
 
Advanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONAdvanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONLyon Yang
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015curryon
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangLyon Yang
 
Automatic Operation Bot for Ceph - You Ji
Automatic Operation Bot for Ceph - You JiAutomatic Operation Bot for Ceph - You Ji
Automatic Operation Bot for Ceph - You JiCeph Community
 

Ähnlich wie Micro control idsecconf2010 (20)

Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...
 
Solnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecSolnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsec
 
Emulating With JavaScript
Emulating With JavaScriptEmulating With JavaScript
Emulating With JavaScript
 
Reverse Engineering the TomTom Runner pt. 1
Reverse Engineering the TomTom Runner pt. 1 Reverse Engineering the TomTom Runner pt. 1
Reverse Engineering the TomTom Runner pt. 1
 
Pipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorPipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructor
 
Demystifying Secure enclave processor
Demystifying Secure enclave processorDemystifying Secure enclave processor
Demystifying Secure enclave processor
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
Reverse Engineering the TomTom Runner pt. 2
Reverse Engineering the TomTom Runner pt. 2Reverse Engineering the TomTom Runner pt. 2
Reverse Engineering the TomTom Runner pt. 2
 
Lecture 03 basics of pic
Lecture 03 basics of picLecture 03 basics of pic
Lecture 03 basics of pic
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
 
CPU Caches
CPU CachesCPU Caches
CPU Caches
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
One Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationOne Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform Exploitation
 
Advanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONAdvanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCON
 
Performance
PerformancePerformance
Performance
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
 
Automatic Operation Bot for Ceph - You Ji
Automatic Operation Bot for Ceph - You JiAutomatic Operation Bot for Ceph - You Ji
Automatic Operation Bot for Ceph - You Ji
 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logs
 

Mehr von idsecconf

idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...
idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...
idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...idsecconf
 
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf
 
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...idsecconf
 
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdf
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdfidsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdf
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdfidsecconf
 
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...idsecconf
 
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...idsecconf
 
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf
 
Ali - The Journey-Hack Electron App Desktop (MacOS).pdf
Ali - The Journey-Hack Electron App Desktop (MacOS).pdfAli - The Journey-Hack Electron App Desktop (MacOS).pdf
Ali - The Journey-Hack Electron App Desktop (MacOS).pdfidsecconf
 
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...idsecconf
 
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdf
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdfRama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdf
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdfidsecconf
 
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...idsecconf
 
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdf
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdfNosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdf
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdfidsecconf
 
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...idsecconf
 
Utian Ayuba - Profiling The Cloud Crime.pdf
Utian Ayuba - Profiling The Cloud Crime.pdfUtian Ayuba - Profiling The Cloud Crime.pdf
Utian Ayuba - Profiling The Cloud Crime.pdfidsecconf
 
Proactive cyber defence through adversary emulation for improving your securi...
Proactive cyber defence through adversary emulation for improving your securi...Proactive cyber defence through adversary emulation for improving your securi...
Proactive cyber defence through adversary emulation for improving your securi...idsecconf
 
Perkembangan infrastruktur kunci publik di indonesia - Andika Triwidada
Perkembangan infrastruktur kunci publik di indonesia - Andika TriwidadaPerkembangan infrastruktur kunci publik di indonesia - Andika Triwidada
Perkembangan infrastruktur kunci publik di indonesia - Andika Triwidadaidsecconf
 
Pentesting react native application for fun and profit - Abdullah
Pentesting react native application for fun and profit - AbdullahPentesting react native application for fun and profit - Abdullah
Pentesting react native application for fun and profit - Abdullahidsecconf
 
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabella
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabellaHacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabella
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabellaidsecconf
 
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...idsecconf
 
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwianto
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi DwiantoDevsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwianto
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwiantoidsecconf
 

Mehr von idsecconf (20)

idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...
idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...
idsecconf2023 - Mochammad Riyan Firmansyah - Takeover Cloud Managed Router vi...
 
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
idsecconf2023 - Neil Armstrong - Leveraging IaC for Stealthy Infrastructure A...
 
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...
idsecconf2023 - Mangatas Tondang, Wahyu Nuryanto - Penerapan Model Detection ...
 
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdf
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdfidsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdf
idsecconf2023 - Rama Tri Nanda - Hacking Smart Doorbell.pdf
 
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...
idsecconf2023 - Akshantula Neha, Mohammad Febri Ramadlan - Cyber Harmony Auto...
 
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...
idsecconf2023 - Aan Wahyu - Hide n seek with android app protections and beat...
 
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
idsecconf2023 - Satria Ady Pradana - Launch into the Stratus-phere Adversary ...
 
Ali - The Journey-Hack Electron App Desktop (MacOS).pdf
Ali - The Journey-Hack Electron App Desktop (MacOS).pdfAli - The Journey-Hack Electron App Desktop (MacOS).pdf
Ali - The Journey-Hack Electron App Desktop (MacOS).pdf
 
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...
Muh. Fani Akbar - Infiltrate Into Your AWS Cloud Environment Through Public E...
 
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdf
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdfRama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdf
Rama Tri Nanda - NFC Hacking Hacking NFC Reverse Power Supply Padlock.pdf
 
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...
Arief Karfianto - Proposed Security Model for Protecting Patients Data in Ele...
 
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdf
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdfNosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdf
Nosa Shandy - Clickjacking That Worthy-Google Bug Hunting Story.pdf
 
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...
Baskoro Adi Pratomo - Evaluasi Perlindungan Privasi Pengguna pada Aplikasi-Ap...
 
Utian Ayuba - Profiling The Cloud Crime.pdf
Utian Ayuba - Profiling The Cloud Crime.pdfUtian Ayuba - Profiling The Cloud Crime.pdf
Utian Ayuba - Profiling The Cloud Crime.pdf
 
Proactive cyber defence through adversary emulation for improving your securi...
Proactive cyber defence through adversary emulation for improving your securi...Proactive cyber defence through adversary emulation for improving your securi...
Proactive cyber defence through adversary emulation for improving your securi...
 
Perkembangan infrastruktur kunci publik di indonesia - Andika Triwidada
Perkembangan infrastruktur kunci publik di indonesia - Andika TriwidadaPerkembangan infrastruktur kunci publik di indonesia - Andika Triwidada
Perkembangan infrastruktur kunci publik di indonesia - Andika Triwidada
 
Pentesting react native application for fun and profit - Abdullah
Pentesting react native application for fun and profit - AbdullahPentesting react native application for fun and profit - Abdullah
Pentesting react native application for fun and profit - Abdullah
 
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabella
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabellaHacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabella
Hacking oximeter untuk membantu pasien covid19 di indonesia - Ryan fabella
 
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...
Vm escape: case study virtualbox bug hunting and exploitation - Muhammad Alif...
 
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwianto
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi DwiantoDevsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwianto
Devsecops: membangun kemampuan soc di dalam devsecops pipeline - Dedi Dwianto
 

Micro control idsecconf2010

  • 1. Micro Control Attacking uC Applications Don A. Bailey (donb@isecpartners.com)
  • 3. What’s this uC thing all about? • Single integrated computer • Processor, volatile, non-volatile storage ▫ All In One • Can drive many peripherals • Easily programmable • Field update/upgrade capability • Personalization (EEPROM)
  • 4. No, really… Why do I care? • Your car • Implanted medical devices ▫ WBAN (Wireless Body Area Network) • Crops monitoring (hydro/aero/enviro-ponics) • Infrastructure monitoring (SCADA, etc) • “Smart Dust” • Access controls (RFID, biometrics, etc)
  • 5. Now with More Networking! • Bluetooth • USB • 802.11 • 802.15.4 • RFID • DECT • GSM
  • 6. Security? • Some tamper resistance • Hardware security • From a software point of view? ▫ Crypto support ▫ …?
  • 7. OODA Loop? • Field upgrades are rare ▫ But getting more common ▫ ST M24LR64 Dual EEPROM (Leet!!) • Most firmware is legacy code • Spot updates for new functionality / peripherals • Mostly written in C, C++, and/or ASM
  • 8. Why wouldn’t you PWN an uC?
  • 9. Prior work? • Travis Goodspeed ▫ GoodFET, neighbor! • Josh Wright ▫ Killerbee!
  • 11. Lots of uC out there, but… • Popular with hackers and engineers • Free toolchain (gcc based) • Free IDE (AVR Studio 4) • No Soldering necessary • Relatively cheap dev tools ▫ AVRISP mkII (~30 USD) ▫ AVR JTAGICE mkII (good deals from Arrow Electronics)
  • 12.
  • 14. Typically included in AVR8 • ALU • Flash • SRAM • EEPROM • Peripheral support (USART, SPI, I2C, TWI, etc)
  • 15.
  • 16. That’s right, it’s Harvard • Separate Data and Code lines • Code always retrieved from Flash • Data always retrieved from SRAM • Flash can be written in software ▫ Typically Boot Loader Support ▫ Fuses determine this ▫ Some AVR8 don‟t support this
  • 17. Point? • Attack data, not instructions • Return-to-whatever (ROP :-P) • Easier! Less data to inject (typically) • Takes longer • That‟s what GoodFET is for ▫ Snatch one Smart Dust sensor ▫ GoodFET ▫ Analyze code ▫ Build ROP strategy ▫ Own 100 more remotely
  • 19. Typical AVR8 Stuff? • Interrupts • Atomic Execution (sort of ;-) • Stack • 32 8-bit registers • LSB • 8/16/32/64-bit integer support • Access to I/O mem • RISC
  • 20. What doesn’t AVR8 have? • Security boundaries • Contexts (multiple stacks) • Concurrency • Segmentation/Paging • No atomic instructions (cmpxchg?) • Native 32/64-bit integer support • Exceptions ▫ Where‟s the Page Fault, yo?!
  • 22. Typical programmatic flow • Reset • Init • Main • somefunc
  • 23. On startup • AVR sets PC to OxOO in Flash • OxOO = Reset Vector • JMP to init in crtO • Init does stuff… • Call main • Do stuff… • Call somefunc • Do more stuff…
  • 24. From RESET -> main()
  • 25.
  • 26. crt0 Copy of .rodata
  • 27.
  • 28. Stack Dump After Call to main()
  • 29.
  • 31.
  • 33.
  • 34. Four Main Points Demonstrated… • Function conventions are typical ▫ Optimization may minimize this • Code Layout • Data Layout • Atomic Code Sections
  • 35. Code Layout in Flash • Interrupt Vectors at OxOO • RESET Vector at OxOO • Main Application Code • Data (???) • Boot Loader Section ▫ Can write to Flash (if Fuses allow) for field updates
  • 36. Data Layout in SRAM • Registers at OxOO • I/O Memory at Ox2O • Extended I/O Memory • Data (copied from Flash) at Ox1OO • BSS • Heap • Stack • ??? ;-)
  • 37. Atomicity • CLI used • SREG can be accessed via SRAM (I/O memory) • 1 CPU Cycle to write to SREG • Flow: ▫ Save a copy of SREG ▫ Clear Interrupt Bit in SREG ▫ Perform uninterrupted action  Write to low byte of SP  Write to SREG (old state with interrupt bit set)  Write to high byte of SP
  • 38. Now, Let’s Have Some Real Fun
  • 39. Entropy? What entropy? • Randomness is very weak • Crypto hurt as a result • Pools can be accumulated ▫ “True Random Number Generator On an Atmel uC” – IEEE Paper • 8 Random Bits using RC oscillator ▫ Per second!!!
  • 40. Race Conditions • No semblance of context switching ▫ TinyOS/Contiki simulate it • Critical Sections secured through CLI • Attack these sections ▫ Overwrite SREG; enable Interrupts • Use Interrupts to cause unexpected behavior
  • 41. Return Value Checks • Snprintf returning <=O or >= sizeof buf? • Logic Issue • Always a problem
  • 42. memcpy and Friends • Latest avr-libc • Don‟t test for negative size values • No option to “secure” with CLI ▫ Interruptable ▫ Oops…Where‟d my SP go?! ;-)
  • 43. Buffer Overflows • Easy as pie • Instruction address in mem is /2 • Return Oriented Programming ▫ Get those Registers set up correctly! • Force a jump to the Boot Loader • Instant Flash update (simulate field update) • Can be triggered remotely • AVR doesn‟t know the difference between you and developer
  • 44. Frame Pointer Overwrite • Standard FP overwrite • Point stack to attacker controlled data • Next frame has the RET • FP saved LSB first
  • 45. Setjmp • Obvious target • Often used • Makes up for lack of exceptions • Saves entire program state • Overwrite all registers • Overwrite PC
  • 46. Integer Overflows • Work as expected • 8-bit registers • 16-bit native instructions • Easy to wrap OxFFFF
  • 47. Integer Promotion • Normal integer promotion • Unsigned -> Signed = No Sign Extension • Signed -> Signed = Sign Extension • Stop using „char‟ for everything ;-) • Lots of 8-bit networking protocols ▫ 8-bit size fields ▫ Promoted to int during packet ingestion ▫ Oops!!
  • 48. Heap Overflows • Heap Struct consists of { size, Next* } • Next* points to the next free heap chunk • Adjacent chunks are combined • No function pointers  • Easily mangle data • Next* doesn‟t have to point to Heap  • Heap data isn‟t zeroed on free() • Easy way to create pseudo stack frames • ROP Helper!
  • 49. Double Free • Latest avr-libc free() doesn‟t check • Any address can be used (except NULL) • Free() will happily overwrite first 2 bytes with ▫ Next* • Add it to the free list ;-) • Can stealthily force malloc() to return (void*)OxOO • Write direct to Registers, I/O memory, etc • ROP Helper!!
  • 50. “Segment” Collision • Heap is allocated slightly under stack • Stack is dynamic!!! • BSS is adjacent to Heap • .rodata isn‟t Read Only! Adjacent to BSS • One big happy family!
  • 51. Uninitialized Variables • Allocate a large Heap chunk • Spray with OxAABB • Stack decends into Heap • Bewm! • Example code at: ▫ http://pa-ri.sc/uC/dangle.tar.bz2
  • 52. Format Strings • Current avr-libc has no %n support • No fun  • But, kind of reasonable
  • 53. NULL Pointer Dereferences • There are no privilege rings, but still useful • Functions like malloc() still return NULL • (void*)OxOO points to Registers in SRAM • NULL deref is a very good thing • Like free() bug, instant access to Regs, I/O Mem • On the flip side… ▫ ??? ;-)
  • 54. Beyond Memory • Deref beyond physical memory addresses? • Example: ATmega644P ▫ 4096 bytes SRAM ▫ Total 4196 addressable bytes  With registers, I/O memory • Ox1OFF should be highest addressible address
  • 55.
  • 56.
  • 57.
  • 58. There is no Page Fault on AVR8 • Memory faults cannot occur • For program safety, don‟t RESET • Read AND Write support • Just wrap addresses back to (void*)OxOO • Overwriting past end of PHYSMEM = start of PHYSMEM • i.e. Ox11OO = OxO1OO • How convenient ;-) • Overwrite EVERYTHING ANYWHERE
  • 59. Example code? • See the memdump application ▫ Runs on any AVR8 with USART ▫ http://pa-ri.sc/uC/memdump.tar.bz2 • Code tested on 10 different uCs in the AVR family ▫ ATtiny ▫ ATmega
  • 60. We Pack and Deliver like UPS Trucks
  • 61. Summary? • Ripe environment for application vulnerabilities • Little protection schemes ▫ Except solid auditing and a tight SDLC • Lots of legacy code in the field • Lots of important devices
  • 62. Special thanks… • Jim Geovedi • Y3dips • Kendi Demonic • Abdul Azis • Dhillon Kannabhiran • iSEC Partners • Nick DePetrillo • Mike Kershaw • Travis Goodspeed • Josh Wright