Introduction
We express our gratitude to the Gotbit team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
GotBit Labs is a provider of web3 development and consulting services. They perform in diverse areas within the web3 ecosystem, including blockchain technology, crafting decentralized applications (DApps), pioneering contract development, and other associated fields.
| title | content |
|---|---|
| Platform | Solana |
| Language | Rust |
| Tags | Bridge |
| Timeline | 11/05/2023 - 15/06/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/GotBit/bridge→ |
| Commit | b3a36262ddfd5c28a2da1e4ca175e7010f19babd |
Review Scope
- Repository
- https://github.com/GotBit/bridge→
- Commit
- b3a36262ddfd5c28a2da1e4ca175e7010f19babd
Audit Summary
10/10
95%
9/10
9/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Gotbit |
| Audited By | Hacken |
| Website | https://gotbit.io/→ |
| Changelog | 18/05/2023 - Initial Review |
| 07/06/2023 -Second Review | |
| 15/06/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Gotbit
- Audited By
- Hacken
- Website
- https://gotbit.io/→
- Changelog
- 18/05/2023 - Initial Review
- 07/06/2023 -Second Review
- 15/06/2023 - Third Review
System Overview
GotBit Bridge — is a system that allows cross-chain token transfers. The system contains the smart contract (bridge_solana), which was audited.
The smart contract's main purpose is processing incoming and outcoming transfer requests. The system allows creation of several bridge instances for bridging different tokens.
The smart contract has the following entrypoints:
initialize — creates a new bridge instance.
setparams_ — configures a given existing bridge instance.
setchaindata — allows whitelisting chains where the bridge instances are deployed.
fulfill — execute a transfer on this end of the bridge.
send — save transaction details to be processed later by the bridge authority.
withdraw — transfer all tokens from bridge associated account to a specified address.
The bridge fully relies on the owner, the authority for processing outcoming transfer requests (distributing funds to receivers on the chain). The system fully trusts the owner and does not require any additional confirmations except for the owner’s will to distribute funds to users.
The system does not allow to cancel transfer requests and does not provide any guarantees that the transfer request will be fulfilled.
Privileged roles
The bridge instance owner is able to:
update transfer fees up to 99.99%
fulfill or ignore transfer requests
withdraw all deposited funds
configure bridge destination chains.
Executive Summary
Documentation quality
The total Documentation quality score is 9 out of 10.
Functional requirements are provided.
Architecture in Solana implementation differs from Ethereum one making the requirements vague.
The technical description on how to build and test the project is provided.
Code quality
The total Code quality score is 9 out of 10.
Functions that process common parameters, accept them differently.
All the code is implemented in one file making navigation harder.
Development environment is consistent with the requirements.
Test coverage
Code coverage of the project is 95% (branch coverage).
Unit tests are not provided.
Integration test coverage is a manual approximation.
Security score
Upon auditing, the code was found to contain 0 critical, 1 high, 4 medium, and 2 low severity issues. Out of these, 3 issues have been addressed and resolved, leading to a Security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 9.5. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Unless the smart contract is deployed with the --final parameter, it could be upgraded and its functionality may be changed.
The owner is able to withdraw all the deposited funds to an arbitrary address.
The owner is able to set an unlimited fee for transactions.
There are no guarantees that a transfer request will be fulfilled.
Anyone is able to initialize a bridge instance. It is strongly recommended to check if the used bridge instance is initialized by a trusted account and the account is not compromised.
The owner cannot be changed. In an emergency situation, the only option for the owner is to:
Withdraw all the funds from the bridge.
Abandon the bridge and all the data associated with it (nonces, bridge parameters, chain data and transaction history details will be lost).
Create a fresh new bridge instance with a new account.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0694 | Denial of Service | mitigated | High | |
| F-2023-0698 | Undocumented Behavior | fixed | Medium | |
| F-2023-0697 | Highly Permissive Role | fixed | Medium | |
| F-2023-0696 | Immutable Ownership | mitigated | Medium | |
| F-2023-0695 | Eager Division | fixed | Medium | |
| F-2023-0700 | Leak of Authorization | mitigated | Low | |
| F-2023-0699 | Unlimited Fees | mitigated | Low | |
| I-2023-0165 | Used Variables Marked as Unused | fixed | Observation | |
| I-2023-0164 | Unformatted Code | fixed | Observation | |
| I-2023-0163 | Inconsistent Code | unfixed | Observation |
Appendix 1. Severity Definitions
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
|---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/GotBit/bridge→ |
| Commit | b3a36262ddfd5c28a2da1e4ca175e7010f19babd |
| Whitepaper | Not provided |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |
Scope Details
- Repository
- https://github.com/GotBit/bridge→
- Commit
- b3a36262ddfd5c28a2da1e4ca175e7010f19babd
- Whitepaper
- Not provided
- Requirements
- Provided→
- Technical Requirements
- Provided→