Skip to content

Commit

Permalink
Merge pull request #332 from keepkey/feature-auth
Browse files Browse the repository at this point in the history
Feature auth
  • Loading branch information
markrypt0 authored Jan 12, 2023
2 parents a452358 + a89eb65 commit efc7e72
Show file tree
Hide file tree
Showing 27 changed files with 1,339 additions and 395 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.7.2)

project(KeepKeyFirmware

VERSION 7.5.2
VERSION 7.6.0

LANGUAGES C CXX ASM)

Expand Down
184 changes: 57 additions & 127 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,132 +1,62 @@
# Security Policy

At ShapeShift, we take security seriously. We encourage independent security
researchers to contact us in order to privately report security vulnerabilities
or issues. The information on this page is intended for those security
researchers that are interested in reporting security vulnerabilities directly
to the ShapeShift security team.
Please visit https://www.keepkey.com/security to view the KeepKey security policy and vulnerability
reporting program. The website includes a GPG key to encrypt vulnerability reports, and is also included
below:

<summary>GPG Key</summary>
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGO4eXYBEAC3uXhD/3vkkMm+sLBeVFipCRCnY+nOgwcmiQ9juAoLJl7/y3jS
gOlJZXpnIlVeV/Aca0v4EkVITxdiBHQWtuOmpD/nToDkzJnAd4WBLRTYwd8WCcTo
vLX0MZBx5f8JV0RqTpII5qVfmEVal7bIHbeHp8r5kYDw+3PbY10GbEYZlosXwWw2
eg2SVpZ7qG79Ak+6rHghzyVsPvvj3RSQlg4g9fs+i+K2omf6HgOXX+1+ExXARpvI
PNe5GtPiwdzpnlUAqT+1rTS1m8JZ6f/8bOtVdJkTGgChu0fePkY24xiCW3VcOuVJ
H1+ILjPU9sP0qUkWhUUZM4K54x/2S9hvH79I3rjoRQir2p71S02IG8ethIY4uoJU
1sJHSXxN49S2BbEYZgJHW+ZhRkqXLDdteJqOGezjy2n0aY9CiS4v5+IrO2slxPlO
69g4iQMWMVrw7FQsvWWvYgGrTtdoc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Nf8a2MrckEhNqlfYwEvqP6T3mFdcr7
jkBXyRHWKt2X2gyfgd8Yz/0vO2kzSfwZj/Pm2sHKUAZXr8OLVyhlN/cWzjFQqR9b
l3twcMdl3LuoaQWyjU1jqIvClpD7wjvpXg0RwVwtYX0Ma9RqacwdjMrIj5uSLQUS
DyA6wwyMEXsHf55dNUX8jy/i0gN8mta5Ofc11B+Jtr+b5E7l8QgnOsbKxTgJOi9z
salPPYoPvIQ5LNi8vfLrs2ou9LVYoElw4TNqDIT7OnN/7yaWpXjfmvrLsN4sn+Oy
goi+0Shty6zGJPTsk9g1PrjGNt9+QpDHm7Dm4jYMvGM4co/tdmhxK+d5KEA5TJAT
vFLvoJ8hXCfYOOfkKdo77biOs5Mf4hamdUY+Xyvtfns5mbuuIfP+DTLEXXCXypMP
wemd
=XEEu
-----END PGP PUBLIC KEY BLOCK-----
## Reporting a Vulnerability
If you would like to disclose a vulnerability to ShapeShift, we encourage you
to send a new email to [email protected] with the word **[VULNERABILITY]** in
the subject line.
Please include the following information in your email:

- Your name, nickname, handle, or what you’d like to be called while we
communicate with you.
- The date/time you first identified the vulnerability.
- How you identified the vulnerability.
- As much detail about the vulnerability as you can.
- How many times you leveraged the vulnerability during your testing (and if
applicable, a list of each test you performed).
- Any additional information you feel may be pertinent.

If you would like to encrypt your vulnerability report, you can use the
following GPG key:

<details><summary>GPG Key</summary>

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBFqzSDABEAC8+iDfkjzoCiELiP4XQ5mc+UvEyYmkawy3iVJA36lXUgAXepM2
CqFRdcEamwukzP9XnpHlrTZIgYYkBCXPqy19bnvBiZ3LXwnPvvWG/skWQcoI9n6g
bgbYQ/DME/U7G8UjUXknKLfURYyAt2DE3VJP4qilJRQRIF0a3bMF1w6mSCOHwFUS
I+0EURF9wnTwq7QX3bKiPzj9D/8MTUN0vfLcN0oTeJz9F8oM/9d4/n0xhD2D+hgm
xUFa82COYuB93G3Wltiwg8+tEtqQ0hbsoWCGqgLiD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bxEwoY
LNMCK9L4xaEFETyV+CU+3VWs26ov6sVnI7+dlNplXPko2JVC8n2HnxKe2N8ZlqBH
36FFRA16skbgwS4vAKMgNwhld+XMKfN61t2igzShik1YaF3JRtGgoMY9+w1rOsNs
Qy+ArXXsZ6tkw7ZUiOl400hE4exGk2CjXqXBTxXhYi9jMl+8Ho8VgyQoc2JPBB6/
tB2+UO/Nwpiskw2328CHPNCb1YYsAuNRyRkGbJi/hY2Qu6D8AwUZtffXiVR/eg+k
t4qqiXfKrL/z520LYos2PmDloEj/z1ezItCfpEtUv6UASpeRnwFIgHndYy2M5y3B
ELz4oMjKb0M8ooSv26UusBMS63vqCy1oN3RDzgOkt0N3rcltJ6Q87X1h/cVo+tOd
vdS+QrWAKcrcUEg=
=G0QG
-----END PGP PUBLIC KEY BLOCK-----

</details>

https://corp.shapeshift.io/responsible-disclosure-program
80 changes: 78 additions & 2 deletions docs/Storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ it easier to extend for new features later on.
| root_seed_cache_status | u8 | 1 | 370 |
| root_seed_cache | char[64] | 64 | 371 |
| root_ecdsa_curve_type | char[10] | 10 | 435 |
| reserved | char[63] | 63 | 445 |
| reserved | char[67] | 67 | 445 |


STORAGE_VERSION 16 layout
Expand Down Expand Up @@ -181,4 +181,80 @@ STORAGE_VERSION 16 layout
| root_seed_cache_status | u8 | 1 | 370 |
| root_seed_cache | char[64] | 64 | 371 |
| root_ecdsa_curve_type | char[10] | 10 | 435 |
| reserved | char[63] | 63 | 445 |
| reserved | char[67] | 67 | 445 |

STORAGE_VERSION 17 layout
-------------------------
This version increased the size of the secret storage to accomodate the authenticator feature secrets
#### Public(ish) Storage

| Field | Type | Size (bytes) | Offset (bytes) |
| ------------------------- | -------------- | ------------ | -------------- |
| version | u32 | 4 | 0 |
| flags | u32 | 4 | 4 |
| has_pin | bit 0 | | |
| has_language | bit 1 | | |
| has_label | bit 2 | | |
| has_auto_lock_delay_ms | bit 3 | | |
| imported | bit 4 | | |
| passphrase_protection | bit 5 | | |
| formerly: ShapeShift | bit 6 | | |
| formerly: Pin Caching | bit 7 | | |
| has_node | bit 8 | | |
| has_mnemonic | bit 9 | | |
| has_u2froot | bit 10 | | |
| Experimental policy | bit 11 | | |
| AdvancedMode policy | bit 12 | | |
| no backup (seedless) | bit 13 | | |
| has_sec_fingerprint | bit 14 | | |
| sca_hardened | bit 15 | | |
| has_wipe_code | bit 16 | | |
| v15_16_trans | bit 17 | | |
| authdata_initialized | bit 18 | | |
| authdata_encrypted | bit 19 | | |
| reserved | bits 20 - 31 | | |
| pin_failed_attempts | u32 | 4 | 8 |
| auto_lock_delay_ms | u32 | 4 | 12 |
| language | char[16] | 16 | 16 |
| label | char[48] | 48 | 32 |
| wrapped_storage_key | char[64] | 64 | 80 |
| storage_key_fingerprint | char[64] | 32 | 144 |
| wrapped_wipe_code_key | char[64] | 64 | 176 |
| wipe_code_key_fingerprint | char[64] | 32 | 240 |
| u2froot | StorageHDNode | 129 | 272 |
| u2f_counter | u32 | 4 | 401 |
| sec_fingerprint | char[32] | 32 | 405 |
| random_salt | char[32] | 32 | 437 |
| authdata_fingerprint | char[32] | 32 | 469 |
| reserved | char[996] | 1028 | 501 |
| encrypted_secrets_version | u32 | 4 | 1497 |
| encrypted_secrets | char[1024] | 512 | 1501 |


#### Secret Storage

| Field | section | Type | Size (bytes) | Offset (bytes) |
| ------------------------- | -------------- |--------------- | ------------ | -------------- |
| node | crypto |StorageHDNode | 129 | 0 |
| mnemonic | crypto | char[241] | 241 | 129 |
| cache->
| root_seed_cache_status | crypto | u8 | 1 | 370 |
| root_seed_cache | crypto | char[64] | 64 | 371 |
| root_ecdsa_curve_type | crypto | char[10] | 10 | 435 |
| sec_reserved | crypto | char[67] | 67 | 445 |
| Block boundary - N*256 bytes above, M*256 bytes below
| authenticator_accounts | authenticator | 10 * char[45] | 450 | 512 |
| authenticator_reserved | authenticator | char[62] | 62 | 962 |

Secret storage is split into two sections block-multiple size sections, crypto secrets and authenticator secrets.
Because the authenticator data is encrypted independently with the bip39 passphrase,
sizeof(authenticator_accounts) + sizeof(authenticator_reserved) % 256 == 0.

Cache specifics:

typedef struct _Cache {
/* Root node cache */
uint8_t root_seed_cache_status;
uint8_t root_seed_cache[64];
char root_ecdsa_curve_type[10];
} Cache;
31 changes: 22 additions & 9 deletions include/keepkey/board/confirm_sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@

/* implement a means to display debug information */
#ifdef DEBUG_ON
#define DEBUG_DISPLAY(TITLE) \
// Examples
// DEBUG_DISPLAY("here");
// DEBUG_DISPLAY("%d %s", slot, account);
#define DEBUG_DISPLAY(...)\
{\
(void)review(ButtonRequestType_ButtonRequest_Other, TITLE, " ");\
char _str[61]={0};\
snprintf(_str, 60, __VA_ARGS__);\
(void)review(ButtonRequestType_ButtonRequest_Other, _str, " ");\
}
// Example
// DEBUG_DISPLAY_VAL("sig", "sig %s", 65, resp->signature.bytes[ctr]);
// DEBUG_DISPLAY_VAL("sig", "sig %s", 65, resp->signature.bytes[_ctr]);
#define DEBUG_DISPLAY_VAL(TITLE,VALNAME,SIZE,BYTES) \
{\
char str[SIZE+1];\
int ctr;\
for (ctr=0; ctr<SIZE/2; ctr++) {\
snprintf(&str[2*ctr], 3, "%02x", BYTES);\
char _str[SIZE+1];\
int _ctr;\
for (_ctr=0; _ctr<SIZE/2; _ctr++) {\
snprintf(&_str[2*_ctr], 3, "%02x", BYTES);\
}\
(void)review(ButtonRequestType_ButtonRequest_Other, TITLE,\
VALNAME, str);\
VALNAME, _str);\
}
#endif

Expand All @@ -58,7 +63,7 @@ typedef enum {
LAYOUT_CONFIRMED,
LAYOUT_FINISHED,
LAYOUT_NUM_LAYOUTS,
LAYOUT_INVALID
LAYOUT_INVALID,
} ActiveLayout;

/* Define the given layout dialog texts for each screen */
Expand All @@ -74,6 +79,7 @@ typedef struct {
DialogLines lines;
DisplayState display_state;
ActiveLayout active_layout;
bool immediate;
} StateInfo;

#define isprint(c) ((c) >= 0x20 && (c) < 0x7f)
Expand Down Expand Up @@ -143,4 +149,11 @@ bool review_with_icon(ButtonRequestType type, IconType iconNum, const char *requ
const char *request_body, ...)
__attribute__((format(printf, 4, 5)));

/// Like confirm, but always \returns true and immediately.
/// \param request_title Title of confirm message.
/// \param request_body Body of confirm message.
bool review_immediate(ButtonRequestType type, const char *request_title,
const char *request_body, ...)
__attribute__((format(printf, 3, 4)));

#endif
1 change: 1 addition & 0 deletions include/keepkey/board/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ bool is_animating(void);
void force_animation_start(void);
void animating_progress_handler(const char *desc, int permil);
void layoutProgress(const char *desc, int permil);
void layoutProgressForAuth(const char *otp, const char *desc, int permil);
void layoutProgressSwipe(const char *desc, int permil);
void layout_add_animation(AnimateCallback callback, void *data,
uint32_t duration);
Expand Down
Loading

0 comments on commit efc7e72

Please sign in to comment.