CVE-2021-31616
📋 TL;DR
A stack buffer overflow vulnerability in ShapeShift KeepKey hardware wallet firmware allows remote code execution via crafted messages. Attackers can exploit insufficient length checks in the ethereum_extractThorchainSwapData() function to bypass stack protections. All KeepKey hardware wallet users with firmware before version 7.1.0 are affected.
💻 Affected Systems
- ShapeShift KeepKey hardware wallet
📦 What is this software?
Keepkey Firmware by Shapeshift
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of the hardware wallet, allowing attackers to steal cryptocurrency assets, manipulate transactions, or install persistent malware on the device.
Likely Case
Remote code execution leading to theft of private keys and cryptocurrency assets from the compromised wallet.
If Mitigated
No impact if firmware is updated to 7.1.0+ or if WebUSB access is restricted.
🎯 Exploit Status
Detailed technical analysis and proof-of-concept code are publicly available. Exploitation requires user to visit a malicious website with WebUSB access.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 7.1.0
Vendor Advisory: https://shapeshift.com/library/keepkey-important-update-issued-april-4-required
Restart Required: Yes
Instructions:
1. Connect KeepKey to computer via USB. 2. Open KeepKey client software. 3. Check for firmware updates. 4. Install firmware version 7.1.0 or later. 5. Restart the device after update completes.
🔧 Temporary Workarounds
Disable WebUSB access
allPrevent websites from accessing WebUSB interface to block remote exploitation vectors.
Browser-specific: In Chrome/Edge, go to chrome://settings/content/usb and block sites
Use dedicated computer for crypto transactions
allIsolate wallet usage to a secure machine without general web browsing.
🧯 If You Can't Patch
- Disconnect KeepKey from computers when not actively using for transactions
- Use browser extensions to block WebUSB access on all websites
🔍 How to Verify
Check if Vulnerable:
Check firmware version in KeepKey client software. If version is below 7.1.0, device is vulnerable.
Check Version:
Use KeepKey client software to view device information and firmware version.
Verify Fix Applied:
Confirm firmware version shows 7.1.0 or higher in KeepKey client software.
📡 Detection & Monitoring
Log Indicators:
- Unusual WebUSB connection attempts
- Multiple failed firmware validation attempts
Network Indicators:
- WebUSB API calls from unexpected domains
- Unusual USB device enumeration patterns
SIEM Query:
device.vendor:"KeepKey" AND event.action:"firmware_update" AND NOT firmware.version:"7.1.0"
🔗 References
- https://blog.inhq.net/posts/keepkey-CVE-2021-31616/
- https://github.com/keepkey/keepkey-firmware/commit/e49d45594002d4d3fbc1f03488e6dfc0a0a65836
- https://github.com/keepkey/keepkey-firmware/releases/tag/v7.1.0
- https://shapeshift.com/library/keepkey-important-update-issued-april-4-required
- https://blog.inhq.net/posts/keepkey-CVE-2021-31616/
- https://github.com/keepkey/keepkey-firmware/commit/e49d45594002d4d3fbc1f03488e6dfc0a0a65836
- https://github.com/keepkey/keepkey-firmware/releases/tag/v7.1.0
- https://shapeshift.com/library/keepkey-important-update-issued-april-4-required