background
logo

Security Audit Report for Bitget Wallet's ETH Rust SDK

DESCRIPTION

The target of this audit (hereinafter referred to as the "Target") is Bitget Wallet's ETH Rust SDK, provided as a ZIP archive.

The ETH Rust SDK is a Rust-based Ethereum wallet library exposed to Go applications through a unified FFI interface. It provides comprehensive wallet capabilities including address derivation, public key generation, message signing, and transaction signing. Developers interact with the SDK via a single entry point, tee_wallet_call, supplying function names and JSON-formatted parameters. The SDK supports multiple Ethereum standards such as EIP-55 addresses, EIP-712 typed data signing, EIP-1559 and EIP-2930 transactions, and advanced EIP-7702 authorization-based transactions. Designed for flexibility and security, it allows seamless integration of Ethereum wallet functionality into Go-based systems.

Please refer to the report for the detailed audit scope.

Our audit methodology employs automated vulnerability scans, manual verification, and business logic analysis to uncover potential security issues coupled with gas and code quality optimization recommendations.

In summary, we have found that the codebase contains 11 high-risk issues that require prompt attention. In addition, we have identified other non-critical issues as well as recommendations and notes that should be considered. The ETH Rust SDK team has addressed these issues promptly. It is important to note that our audit covers only the final reported versions of the codebase. Any subsequent updates would require a re-evaluation.

KEY FINDINGS

In total, we find 28 potential issues in the smart contract. We also have 5 recommendations and 3 notes, as follows:

High Risk: 11
Medium Risk: 7
Low Risk: 10
Recommendation: 5
Note: 3
ID Severity Description Status
1 High DoS due to panic in the function hash_eth_message() Fixed
2 High Incorrect value parsing for hexadecimal strings Fixed
3 High Incorrect unit scaling Fixed
4 High DoS due to integer overflow via unsafe type casting Fixed
5 High Potential DoS when signing TypedDataV1 or TypedDataV3 message Fixed
6 High Incorrect match logic when handling array types Fixed
7 High Incorrect removal logic in function sign_transaction() Fixed
8 High Incorrect condition checks in the function convert_to_tx_param() Fixed
9 High Signed integer types can not handle negative values Fixed
10 High Lack of support for numeric values in JSON Fixed
11 High Lack of support for fixed-size bytes types Fixed
12 Medium Default handling of null and invalid inputs for chain_id and nonce breaks authorization signature semantics Fixed
13 Medium Incorrect implementation in function hash_typed_data_v4() Fixed
14 Medium Precision loss or panic due to intermediate u128 type casting Fixed
15 Medium Unchecked unwraps in function sign_transaction() may panic Fixed
16 Medium Incorrect version of ethers-signers Fixed
17 Medium Incorrect handling of the field chain_id Fixed
18 Medium Potentialsignaturecollision in thefunction process_bit_sign_message() Confirmed
19 Low Empty access list prevents gas optimization Confirmed
20 Low Non-string JSON fields are silently dropped in the function process_bit_sign_message() Confirmed
21 Low Improper handling logic of __type field in function parse_message_format() Confirmed
22 Low Improper handling logic for message in function sign_personal_message() Confirmed
23 Low Potential encryption key generation failure due to inconsistent hexadecimal prefix handling Fixed
24 Low Lack of support for BIP39 passphrase Confirmed
25 Low Hardcoded default derivation path can derive incorrect private key Confirmed
26 Low Inappropriate use of signed integer parsing for transaction values Fixed
27 Low Default handling logic in the transaction parsing process alters signature semantics Fixed
28 Low Inconsistent naming conventions for JSON parsing fields Fixed
29 - Remove redundant code Fixed
30 - Unify mnemonic validation logic Fixed
31 - Ensure parameter naming consistency in logic Fixed
32 - Replace unsafe type casting in the function ecdsa_sign() to prevent potential overflow Fixed
33 - Unify chain_id parse logic Fixed
34 - Deprecated EIP1024 due to security concern -
35 - Blob transaction not supported -
36 - Input parameters from external callers must be verified and secure -

More details are provided in the audit report.

Take the first step towards a secure future

Reach out now for BlockSec's expert code audit services, elevate the security of your protocol before it goes live!