backback
back
backback
backback
backback

Checking the Security of a Crypto Wallet - Taking KryptoGO Wallet as an example

2022-01-24
image-cover

In the last article, we explained the importance of mnemonics for Web3, and our mnemonics will definitely need to be placed in the wallet. At this time, the security of the wallet is very critical. 

Financial Security in the Web 3 Era: Tokens/Private Keys/Wallets (Accounts) - KryptoGO

Unlike banks, there is no anti-fraud detection system like banks in the blockchain, and there is no customer support to immediately cancel or restore transactions when problems occur. Compared to the same banking APP on the mobile phone, the security of encryption wallets is more vulnerable to quick theft and transfer if a problem occurs. 

Encrypted wallet security is tricky, and all the hard-to-discover vulnerabilities and potential problems usually exist at the intersection of multiple flaws: cryptography, access to local storage, lack of application authentication, and lack of input validation. Each problem point is relatively small in real time, but when combined, they can expose more unexpected attackable surfaces.

Check the security of encrypted wallet APP

If we differentiate by software and hardware wallets, the choice of hardware wallets is relatively simple, basically choosing the first market share is usually no problem, but the development of software wallets is quite fast, especially in this era of multiple chains, there are all kinds of software wallets for us to choose from.

Software wallets include browser wallets and cell phone wallets, browser wallets are usually open source and are audited by multiple people, and most are currently monopolized by a few wallets manufacturers.

1. Ownership of Assets

There are two main types of wallets: custodial and non-custodial – Without a private key, you don't really own a crypto asset - KryptoGO

The first and most important step in using a wallet is to check if it is really a custodial wallet or not. The way to check is simple: when you send any transaction, go directly to the blockchain browser by Tx ID to see if the address of your wallet is unique or shared like the entire exchange.

If it is a custodial wallet, it means that the assets are not available for your own use. All you can do is to trust the company and do due diligence on the company and the team behind it: whether the team members have a bad track record, past industry experience, company credit, team technical capabilities, whether they have obtained relevant certification standards, etc.

Because custodial wallets are more about the company and the team's credit. Of course, the basic technical skills must still be there, if not, the following common low-level errors may occur.

1 Poor key management: storing encryption key and data together in plaintext; lack of key rotation, revocation, expiration; using encryption key for different purposes.

Poor memory management: Tampering with sensitive data in application code instead of limiting its lifecycle on memory, hard disk, and UI.

3 Even storing sensitive data in plaintext that will be used by wallets.

KryptoGO Wallet is a non-custodial encrypted wallet

Founded in 2019, KryptoGO was recognized by Etherscan as a recommended vendor for smart contract auditing and information security back in 2019. The team has many years of blockchain experience and has been recognized by governments, banks, and international authority accreditation for its technical capabilities.

Ethereum Directory for Smart Contracts — Smart Contracts Audit And Security | Etherscan

2. The security mechanism of the encrypted wallet application

Encrypted wallets need to be protected in many ways, such as: checking if the device is trusted, if it is Rooted or jailbroken, if potentially harmful applications are installed, or reverse engineering tools. (Now there are malicious APPs that can be used to steal user's credentials, mnemonic phrase or private keys). This part can be protected by reverse engineering and tampering as recommended by OWASP MASVS L2.

Mobile platforms (iOS, Android) provide many hardware-level security controls, and requiring users to set passwords is a relatively easy feature to implement. This kind of protection creates an additional layer of the obstruction for the attacker. If a password is not installed, anyone can unlock the phone and steal the wallet data, or even access the keychain/keystore.

It's also a good idea to encrypt sensitive data before putting it into the Keychain/Keystore, so that even if the phone is attacked and an attacker can access the Keychain/Keystore, all he or she will get is the encrypted data.

KryptoGO Wallet protects all aspects

1 No old devices or legacy versions with security risks are supported. The operating system's native secure storage is being adopted to limit the lifecycle of sensitive data, thus reducing the risk of successful attacks and data leakage.

2 Keep all sensitive data in the secure storage provided by the native system.

3 Do a complete code review during the development phase, with each person submitting a merge request to be reviewed by at least a second person.

4 Protect the developer's equipment and work environment from social attacks.

5 Do a thorough penetration test before submitting for review to ensure there are no vulnerabilities caused by code logic.

6 We consider various scenarios in the Wallet App usage process, including losing your phone, changing your number, or temporarily lending your phone to someone else, and we make sure that every aspect of usage is accounted for.

3. Local Storage for Non-Custodial Wallets

Since non-custodial wallets require local storage of mnemonic phrase, seeds and private keys, it is important to understand how local storage works and the common attacks against it.

Here are some things developers can check.

  • What kind of storage should be used to provide the best security?
  • Can the storage be accessed as a file? Can it be accessed by other applications?
  • Can you verify the authenticity of this storage? Is it possible to "steal" storage space from one wallet and put it in another wallet without problems?
  • Are there any integrity checks? Or can anyone change the data in the storage and the encrypted wallet won't notice anything.
  • Does the storage provide other encryption (e.g., hardware-supported encryption), or is the data stored in plaintext?
  • Should application-level encryption be used to encrypt data before it is placed in storage? If so, where will the encryption key be stored and how will the private key be derived?

KryptoGO uses the native operating system security zone to protect the helpers

We use iOS Keychain and Android Keystore to encrypt and store AES encrypted data.

The AES encryption algorithm is an advanced encryption standard in cryptography that uses a symmetric grouping cipher system with a minimum key length of 128, 192, 256 and a group length of 128 bits. This encryption algorithm is the block encryption standard adopted by the U.S. federal government, and the AES standard is used to replace the original DES, which has been analyzed by many parties and is widely used worldwide.

1*KmosuUNt6h6ZLQ7UGbGMag.gif

How AES works

The following is the way we encrypt the mnemonic phrase. From this formula you can see how we encrypt the mnemonic phrase (not all of them are public, so as to avoid exposing unnecessary attack surfaces), all transmission links are ciphertext instead of plaintext:

1*3iiKwvOOij_R5MhjLpXc9w.png

KryptoGO Wallet's encryption protection for mnemonics

Frequently Asked Questions

Q1: Why do we need to fill in our phone number if it is a non-custodial wallet?

The phone number is to simplify the process of creating wallets.

We've observed that most wallets today are not intuitive and friendly to the average person, and that logging in with a Google or Facebook account password is one way to do this, but it doesn't fit in with Web3. It's like using Clubhouse, you don't need to register for an account password, you can retrieve all your blockchain wallets each time with a verification code and a password that only you know for your wallet.

1_sEU9lSdNnMUUrwY1qoF_1g.png

The KryptoGO Wallet is designed with various aspects in mind and can be used without our escrow key.

Using our custodial mnemonic phrase is an option, and if you are unsure about using it for the first time, you may not choose to import it and create a brand new wallet. The same is true for other wallets. The power of the Wallet App is very large, so you must be very careful when using it to avoid phishing attacks. You can create a wallet first or use watch mode to observe the logic of that wallet and the protection mechanism of the APP, and then put in the mnemonic phrase if the wallet is trustworthy.

Q2: Will our wallets be open source?

Open source is a double-edged sword. From an attacker's point of view, if the encrypted wallet code is open source, it is not difficult to combine 3-4 vulnerabilities and hackers can read the implementation details and try to find the program vulnerability and use it to attack.

Therefore, we prefer not to open source for the time being, but we will do black-box and gray-box penetration testing. At the same time, we will prevent security vulnerabilities by proper security design, improving the security level of developers, writing programs in the best suitable cryptographic primitives, using proven modules and libraries and integrating them properly.

In addition, we have invested heavily in following the Secure Software Development Life Cycle (SSDLC) and are one of the few blockchain companies in the world to have achieved dual ISO certification (Information Security & Personal Privacy). (See: Information Security and Personal Privacy Certification - ISO 27001 and ISO 27701 Introduction - KryptoGO)

Extended Reading

Crypto wallets security as seen by security engineers — Cossack Labs

Application Level Encryption for Software Architects