CVE-2021-31616

8.8 HIGH

📋 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

Products:
  • ShapeShift KeepKey hardware wallet
Versions: All firmware versions before 7.1.0
Operating Systems: All operating systems that support WebUSB
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability is in the firmware itself, not dependent on specific OS configurations.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH - The vulnerable interface is reachable remotely over WebUSB, allowing exploitation from malicious websites.
🏢 Internal Only: LOW - The primary attack vector is through WebUSB, which typically requires user interaction with malicious content.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

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

all

Prevent 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

all

Isolate 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

📤 Share & Export