SlideShare a Scribd company logo
Software Attacks on
Hardware Wallets
Introduction
• Security Analyst at Riscure, Netherlands
• Focused on SW and HW device security
• Smart cards
• TEE
• Secure devices
• etc.
What is hardware wallet?
A device:
• Connects to smartphone, PC
• Stores and operates private keys
• Mainly used for cryptocurrency private keys
• Totally secure
https://www.ledgerwallet.com/products/ledger-nano-s https://www.keepkey.com/wp-
content/uploads/2014/08/12121301/shapeshift-large.jpg
https://trezor.io/start/
What is hardware wallet?
• Connects to smartphone, PC
• Stores and operates private keys
• Mostly used for cryptocurrency private keys
• Totally secure?
https://www.ledgerwallet.com/products/ledger-nano-s https://www.keepkey.com/wp-
content/uploads/2014/08/12121301/shapeshift-large.jpg
https://trezor.io/start/
Why Ledger?
• New on the market
• Based on a certified Secure Element
• Proprietary TEE
• Multi-app support (Btc, Eth, …)
• Support for custom applications in TEE
What is TEE?
Why TEE?
Why TEE?
Who is the attacker?
• Malware wallet (TA – TA, TA - TEE)
• Attacker with physical access to initialized device
• Attacker with access to the device before user initialization
• Tampering before delivery
• Second-hand devices*
Why anti-tampering?
(Manufacturer’s blog)
What is the hardware?
• STM32 MCU
• Screen, buttons, USB…
• Communication with the SE
• ST32 SE
• BOLOS TEE
• Wallets (Trusted Apps)
• Secure Flash Memory
https://www.ledger.fr/2016/06/09/secure-hardware-and-open-source/
What is the BOLOS TEE?
• MPU ensures memory isolation
• Application has ~16 KB of Flash
and ~1 KB of RAM
• Over 100 syscalls
SYSCALL void nvm_write(
void WIDE *dst_adr PLENGTH(src_len),
void WIDE *src_adr PLENGTH(src_len),
unsigned int src_len);
User TA1
User TA2
User RAM
TEE RAM
0xFFFFFFFF
0x20000000
V1. Dereferencing the null pointer
• Dereferencing memory outside user region mutes the device
• Any pointer outside the user region in a syscall returns SW6404
• … except null pointer
• Calling sha256() syscall with any length returns a hash
• Repeat 8k times, get 8k hashes, compute 256*8000, dump 8kB data
PTR LEN OUTPUT – HASH SHA256
0x00000000 0x00000001 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d
0x00000000 0x00000002 2ee788372518190a6ab539cbb20331df1040f21846e3ba836c269aee907c894c
0x00000000 0x00000003 df236376becfe951a5a3dfa7c274ed26a75f1ccba7cf432772a9cc349017eaac
V3. Partial memory disclosure in cx_hash()
• cx_hash() syscall takes a pointer to the hash context
• Specs say the pointer must be to RAM
• Given different addresses there are different exceptions:
• SW6404 – Security condition not satisfied
• SW6402 – Condition of use not satisfied
SYSCALL int cx_hash(
cx_hash_t *hash PLENGTH(scc__cx_hash_ctx_size__hash),
int mode, unsigned char WIDE *in PLENGTH(len),
unsigned int len,
unsigned char *out PLENGTH(scc__cx_hash_size__hash));
V3. Partial memory disclosure in cx_hash()
• The hash context starts with header
• There are eight supported algorithms
• cx_md_t [0x00 … 0x08]
• Given any memory address:
struct cx_hash_header_s {
cx_md_t algo;
unsigned int counter;
};
Protected memory
?? ?? ?? ??
?? ?? ?? ??
Malicious
User App
syscall
cx_hash()
Is it in
[0x00 … 0x08]
V5. Debug app installation flag
• There are a number of installation parameters of an application
• Debug application can dump 0x4000 bytes of flash
• The memory region might include other applications
V5. Debug app installation flag
17
BTC
UserTA2
SystemApp
dbgApp
SystemApp
dbgApp
DEMO
V6. Flash is not cleared upon device reset
• The user application are not removed after device wipe
• … how about private keys?
• The wallet keys are meant to be derived from the seed at
runtime
V6. Flash is not cleared upon device reset
V6. Flash is not cleared upon device reset
Success!
uid counter init_flag hmacKeypadding
0000000000000000000000000000000000000000000000000000000000000000
ffb18dac0100000001 8b1fa7e86f6b9a3683b521fa71aa64b427471c5d295ebe
89995bd1e198b6d6a655dcdc64289b8b537fe351cf41898992a108928c370f4d
294add1edd696fe8418f12000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
ffb18dac0200000001 8b1fa7e86f6b9a3683b521fa71aa64b427471c5d295ebe
89995bd1e198b6d6a655dcdc64289b8b537fe351cf41898992a108928c370f4d
294add1edd696fe8418f12000000000000000000000000000000000000000000
V6. Flash is not cleared upon device reset
Conclusions?
• There are 7 exploitable vulnerabilities identified in the wallet
• An attacker with physical access could compromise the
isolation
• The private keys stored in any app were vulnerable
• Defense in depth helped runtime generated keys to be
protected
What do we learn?
• To be secure devices require both protected HW and SW
• TEE should not expect any assumptions are met
• All the syscall parameters need to be restricted and checked
• Large API is a big attack surface
• Lifecycle state of HW wallets is prone to issues by design
• Third party evaluation is a must for a secure solution
Q&A
Sergei Volokitin
volokitin@riscure.com

More Related Content

Similar to Software Attacks on Hardware Wallets

Top 10 secure boot mistakes
Top 10 secure boot mistakesTop 10 secure boot mistakes
Top 10 secure boot mistakes
Justin Black
 
Design and implementation of real time security guard robot using GSM/CDMA ne...
Design and implementation of real time security guard robot using GSM/CDMA ne...Design and implementation of real time security guard robot using GSM/CDMA ne...
Design and implementation of real time security guard robot using GSM/CDMA ne...
Claude Ndayisenga
 
Country domination - Causing chaos and wrecking havoc
Country domination - Causing chaos and wrecking havocCountry domination - Causing chaos and wrecking havoc
Country domination - Causing chaos and wrecking havoc
Tiago Henriques
 
Software Attacks on Hardware Wallets
Software Attacks on Hardware WalletsSoftware Attacks on Hardware Wallets
Software Attacks on Hardware Wallets
Riscure
 
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
Technogroovy
 
16f84a datasheet
16f84a   datasheet16f84a   datasheet
16f84a datasheet
Cesar Figueroa
 
RING 0/-2 ROOKITS : COMPROMISING DEFENSES
 RING 0/-2 ROOKITS : COMPROMISING DEFENSES RING 0/-2 ROOKITS : COMPROMISING DEFENSES
RING 0/-2 ROOKITS : COMPROMISING DEFENSES
Priyanka Aash
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated Disassembly
Priyanka Aash
 
14k50 auto
14k50 auto14k50 auto
14k50 auto
Alfredo Santillan
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
Lex Yu
 
BSides London 2015 - Proprietary network protocols - risky business on the wire.
BSides London 2015 - Proprietary network protocols - risky business on the wire.BSides London 2015 - Proprietary network protocols - risky business on the wire.
BSides London 2015 - Proprietary network protocols - risky business on the wire.
Jakub Kałużny
 
Ring 0/-2 Rootkits: bypassing defenses -- DEF CON 2018 USA
Ring 0/-2 Rootkits: bypassing defenses  -- DEF CON 2018 USARing 0/-2 Rootkits: bypassing defenses  -- DEF CON 2018 USA
Ring 0/-2 Rootkits: bypassing defenses -- DEF CON 2018 USA
Alexandre Borges
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Tzung-Bi Shih
 
SANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry AnalysisSANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry Analysis
mooyix
 
embedded-systems-for-beginners
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginners
mohamed gaber
 
Bsides Puerto Rico-2017
Bsides Puerto Rico-2017Bsides Puerto Rico-2017
Bsides Puerto Rico-2017
Price McDonald
 
datasheet-micro.pdf
datasheet-micro.pdfdatasheet-micro.pdf
datasheet-micro.pdf
XCristiianX
 
Datasheet PIC16f887
Datasheet PIC16f887Datasheet PIC16f887
Datasheet PIC16f887
whendygarcia
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
Cyber Security Alliance
 
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
Lyon Yang
 

Similar to Software Attacks on Hardware Wallets (20)

Top 10 secure boot mistakes
Top 10 secure boot mistakesTop 10 secure boot mistakes
Top 10 secure boot mistakes
 
Design and implementation of real time security guard robot using GSM/CDMA ne...
Design and implementation of real time security guard robot using GSM/CDMA ne...Design and implementation of real time security guard robot using GSM/CDMA ne...
Design and implementation of real time security guard robot using GSM/CDMA ne...
 
Country domination - Causing chaos and wrecking havoc
Country domination - Causing chaos and wrecking havocCountry domination - Causing chaos and wrecking havoc
Country domination - Causing chaos and wrecking havoc
 
Software Attacks on Hardware Wallets
Software Attacks on Hardware WalletsSoftware Attacks on Hardware Wallets
Software Attacks on Hardware Wallets
 
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
Industrial Training|Summer Training|Embedded Systems|Final Year Project|B tec...
 
16f84a datasheet
16f84a   datasheet16f84a   datasheet
16f84a datasheet
 
RING 0/-2 ROOKITS : COMPROMISING DEFENSES
 RING 0/-2 ROOKITS : COMPROMISING DEFENSES RING 0/-2 ROOKITS : COMPROMISING DEFENSES
RING 0/-2 ROOKITS : COMPROMISING DEFENSES
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated Disassembly
 
14k50 auto
14k50 auto14k50 auto
14k50 auto
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
 
BSides London 2015 - Proprietary network protocols - risky business on the wire.
BSides London 2015 - Proprietary network protocols - risky business on the wire.BSides London 2015 - Proprietary network protocols - risky business on the wire.
BSides London 2015 - Proprietary network protocols - risky business on the wire.
 
Ring 0/-2 Rootkits: bypassing defenses -- DEF CON 2018 USA
Ring 0/-2 Rootkits: bypassing defenses  -- DEF CON 2018 USARing 0/-2 Rootkits: bypassing defenses  -- DEF CON 2018 USA
Ring 0/-2 Rootkits: bypassing defenses -- DEF CON 2018 USA
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
 
SANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry AnalysisSANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry Analysis
 
embedded-systems-for-beginners
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginners
 
Bsides Puerto Rico-2017
Bsides Puerto Rico-2017Bsides Puerto Rico-2017
Bsides Puerto Rico-2017
 
datasheet-micro.pdf
datasheet-micro.pdfdatasheet-micro.pdf
datasheet-micro.pdf
 
Datasheet PIC16f887
Datasheet PIC16f887Datasheet PIC16f887
Datasheet PIC16f887
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
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
 

More from Priyanka Aash

Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash
 
Verizon Breach Investigation Report (VBIR).pdf
Verizon Breach Investigation Report (VBIR).pdfVerizon Breach Investigation Report (VBIR).pdf
Verizon Breach Investigation Report (VBIR).pdf
Priyanka Aash
 
Top 10 Security Risks .pptx.pdf
Top 10 Security Risks .pptx.pdfTop 10 Security Risks .pptx.pdf
Top 10 Security Risks .pptx.pdf
Priyanka Aash
 
Simplifying data privacy and protection.pdf
Simplifying data privacy and protection.pdfSimplifying data privacy and protection.pdf
Simplifying data privacy and protection.pdf
Priyanka Aash
 
Generative AI and Security (1).pptx.pdf
Generative AI and Security (1).pptx.pdfGenerative AI and Security (1).pptx.pdf
Generative AI and Security (1).pptx.pdf
Priyanka Aash
 
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdfEVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
Priyanka Aash
 
DPDP Act 2023.pdf
DPDP Act 2023.pdfDPDP Act 2023.pdf
DPDP Act 2023.pdf
Priyanka Aash
 
Cyber Truths_Are you Prepared version 1.1.pptx.pdf
Cyber Truths_Are you Prepared version 1.1.pptx.pdfCyber Truths_Are you Prepared version 1.1.pptx.pdf
Cyber Truths_Are you Prepared version 1.1.pptx.pdf
Priyanka Aash
 
Cyber Crisis Management.pdf
Cyber Crisis Management.pdfCyber Crisis Management.pdf
Cyber Crisis Management.pdf
Priyanka Aash
 
CISOPlatform journey.pptx.pdf
CISOPlatform journey.pptx.pdfCISOPlatform journey.pptx.pdf
CISOPlatform journey.pptx.pdf
Priyanka Aash
 
Chennai Chapter.pptx.pdf
Chennai Chapter.pptx.pdfChennai Chapter.pptx.pdf
Chennai Chapter.pptx.pdf
Priyanka Aash
 
Cloud attack vectors_Moshe.pdf
Cloud attack vectors_Moshe.pdfCloud attack vectors_Moshe.pdf
Cloud attack vectors_Moshe.pdf
Priyanka Aash
 
Stories From The Web 3 Battlefield
Stories From The Web 3 BattlefieldStories From The Web 3 Battlefield
Stories From The Web 3 Battlefield
Priyanka Aash
 
Lessons Learned From Ransomware Attacks
Lessons Learned From Ransomware AttacksLessons Learned From Ransomware Attacks
Lessons Learned From Ransomware Attacks
Priyanka Aash
 
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
Priyanka Aash
 
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
Priyanka Aash
 
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
Priyanka Aash
 
Cloud Security: Limitations of Cloud Security Groups and Flow Logs
Cloud Security: Limitations of Cloud Security Groups and Flow LogsCloud Security: Limitations of Cloud Security Groups and Flow Logs
Cloud Security: Limitations of Cloud Security Groups and Flow Logs
Priyanka Aash
 
Cyber Security Governance
Cyber Security GovernanceCyber Security Governance
Cyber Security Governance
Priyanka Aash
 
Ethical Hacking
Ethical HackingEthical Hacking
Ethical Hacking
Priyanka Aash
 

More from Priyanka Aash (20)

Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
 
Verizon Breach Investigation Report (VBIR).pdf
Verizon Breach Investigation Report (VBIR).pdfVerizon Breach Investigation Report (VBIR).pdf
Verizon Breach Investigation Report (VBIR).pdf
 
Top 10 Security Risks .pptx.pdf
Top 10 Security Risks .pptx.pdfTop 10 Security Risks .pptx.pdf
Top 10 Security Risks .pptx.pdf
 
Simplifying data privacy and protection.pdf
Simplifying data privacy and protection.pdfSimplifying data privacy and protection.pdf
Simplifying data privacy and protection.pdf
 
Generative AI and Security (1).pptx.pdf
Generative AI and Security (1).pptx.pdfGenerative AI and Security (1).pptx.pdf
Generative AI and Security (1).pptx.pdf
 
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdfEVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
EVERY ATTACK INVOLVES EXPLOITATION OF A WEAKNESS.pdf
 
DPDP Act 2023.pdf
DPDP Act 2023.pdfDPDP Act 2023.pdf
DPDP Act 2023.pdf
 
Cyber Truths_Are you Prepared version 1.1.pptx.pdf
Cyber Truths_Are you Prepared version 1.1.pptx.pdfCyber Truths_Are you Prepared version 1.1.pptx.pdf
Cyber Truths_Are you Prepared version 1.1.pptx.pdf
 
Cyber Crisis Management.pdf
Cyber Crisis Management.pdfCyber Crisis Management.pdf
Cyber Crisis Management.pdf
 
CISOPlatform journey.pptx.pdf
CISOPlatform journey.pptx.pdfCISOPlatform journey.pptx.pdf
CISOPlatform journey.pptx.pdf
 
Chennai Chapter.pptx.pdf
Chennai Chapter.pptx.pdfChennai Chapter.pptx.pdf
Chennai Chapter.pptx.pdf
 
Cloud attack vectors_Moshe.pdf
Cloud attack vectors_Moshe.pdfCloud attack vectors_Moshe.pdf
Cloud attack vectors_Moshe.pdf
 
Stories From The Web 3 Battlefield
Stories From The Web 3 BattlefieldStories From The Web 3 Battlefield
Stories From The Web 3 Battlefield
 
Lessons Learned From Ransomware Attacks
Lessons Learned From Ransomware AttacksLessons Learned From Ransomware Attacks
Lessons Learned From Ransomware Attacks
 
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
Emerging New Threats And Top CISO Priorities In 2022 (Chennai)
 
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
Emerging New Threats And Top CISO Priorities In 2022 (Mumbai)
 
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
Emerging New Threats And Top CISO Priorities in 2022 (Bangalore)
 
Cloud Security: Limitations of Cloud Security Groups and Flow Logs
Cloud Security: Limitations of Cloud Security Groups and Flow LogsCloud Security: Limitations of Cloud Security Groups and Flow Logs
Cloud Security: Limitations of Cloud Security Groups and Flow Logs
 
Cyber Security Governance
Cyber Security GovernanceCyber Security Governance
Cyber Security Governance
 
Ethical Hacking
Ethical HackingEthical Hacking
Ethical Hacking
 

Recently uploaded

GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
Sease
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 

Recently uploaded (20)

GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 

Software Attacks on Hardware Wallets

  • 2. Introduction • Security Analyst at Riscure, Netherlands • Focused on SW and HW device security • Smart cards • TEE • Secure devices • etc.
  • 3. What is hardware wallet? A device: • Connects to smartphone, PC • Stores and operates private keys • Mainly used for cryptocurrency private keys • Totally secure https://www.ledgerwallet.com/products/ledger-nano-s https://www.keepkey.com/wp- content/uploads/2014/08/12121301/shapeshift-large.jpg https://trezor.io/start/
  • 4. What is hardware wallet? • Connects to smartphone, PC • Stores and operates private keys • Mostly used for cryptocurrency private keys • Totally secure? https://www.ledgerwallet.com/products/ledger-nano-s https://www.keepkey.com/wp- content/uploads/2014/08/12121301/shapeshift-large.jpg https://trezor.io/start/
  • 5. Why Ledger? • New on the market • Based on a certified Secure Element • Proprietary TEE • Multi-app support (Btc, Eth, …) • Support for custom applications in TEE
  • 9. Who is the attacker? • Malware wallet (TA – TA, TA - TEE) • Attacker with physical access to initialized device • Attacker with access to the device before user initialization • Tampering before delivery • Second-hand devices*
  • 11. What is the hardware? • STM32 MCU • Screen, buttons, USB… • Communication with the SE • ST32 SE • BOLOS TEE • Wallets (Trusted Apps) • Secure Flash Memory https://www.ledger.fr/2016/06/09/secure-hardware-and-open-source/
  • 12. What is the BOLOS TEE? • MPU ensures memory isolation • Application has ~16 KB of Flash and ~1 KB of RAM • Over 100 syscalls SYSCALL void nvm_write( void WIDE *dst_adr PLENGTH(src_len), void WIDE *src_adr PLENGTH(src_len), unsigned int src_len); User TA1 User TA2 User RAM TEE RAM 0xFFFFFFFF 0x20000000
  • 13. V1. Dereferencing the null pointer • Dereferencing memory outside user region mutes the device • Any pointer outside the user region in a syscall returns SW6404 • … except null pointer • Calling sha256() syscall with any length returns a hash • Repeat 8k times, get 8k hashes, compute 256*8000, dump 8kB data PTR LEN OUTPUT – HASH SHA256 0x00000000 0x00000001 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 0x00000000 0x00000002 2ee788372518190a6ab539cbb20331df1040f21846e3ba836c269aee907c894c 0x00000000 0x00000003 df236376becfe951a5a3dfa7c274ed26a75f1ccba7cf432772a9cc349017eaac
  • 14. V3. Partial memory disclosure in cx_hash() • cx_hash() syscall takes a pointer to the hash context • Specs say the pointer must be to RAM • Given different addresses there are different exceptions: • SW6404 – Security condition not satisfied • SW6402 – Condition of use not satisfied SYSCALL int cx_hash( cx_hash_t *hash PLENGTH(scc__cx_hash_ctx_size__hash), int mode, unsigned char WIDE *in PLENGTH(len), unsigned int len, unsigned char *out PLENGTH(scc__cx_hash_size__hash));
  • 15. V3. Partial memory disclosure in cx_hash() • The hash context starts with header • There are eight supported algorithms • cx_md_t [0x00 … 0x08] • Given any memory address: struct cx_hash_header_s { cx_md_t algo; unsigned int counter; }; Protected memory ?? ?? ?? ?? ?? ?? ?? ?? Malicious User App syscall cx_hash() Is it in [0x00 … 0x08]
  • 16. V5. Debug app installation flag • There are a number of installation parameters of an application • Debug application can dump 0x4000 bytes of flash • The memory region might include other applications
  • 17. V5. Debug app installation flag 17 BTC UserTA2 SystemApp dbgApp SystemApp dbgApp
  • 18. DEMO
  • 19. V6. Flash is not cleared upon device reset • The user application are not removed after device wipe • … how about private keys? • The wallet keys are meant to be derived from the seed at runtime
  • 20. V6. Flash is not cleared upon device reset
  • 21. V6. Flash is not cleared upon device reset Success!
  • 22. uid counter init_flag hmacKeypadding 0000000000000000000000000000000000000000000000000000000000000000 ffb18dac0100000001 8b1fa7e86f6b9a3683b521fa71aa64b427471c5d295ebe 89995bd1e198b6d6a655dcdc64289b8b537fe351cf41898992a108928c370f4d 294add1edd696fe8418f12000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 ffb18dac0200000001 8b1fa7e86f6b9a3683b521fa71aa64b427471c5d295ebe 89995bd1e198b6d6a655dcdc64289b8b537fe351cf41898992a108928c370f4d 294add1edd696fe8418f12000000000000000000000000000000000000000000 V6. Flash is not cleared upon device reset
  • 23. Conclusions? • There are 7 exploitable vulnerabilities identified in the wallet • An attacker with physical access could compromise the isolation • The private keys stored in any app were vulnerable • Defense in depth helped runtime generated keys to be protected
  • 24. What do we learn? • To be secure devices require both protected HW and SW • TEE should not expect any assumptions are met • All the syscall parameters need to be restricted and checked • Large API is a big attack surface • Lifecycle state of HW wallets is prone to issues by design • Third party evaluation is a must for a secure solution