Introduction
We express our gratitude to the WhiteBIT team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
WhiteBIT is the largest European cryptocurrency exchange. WhiteBIT’s goal is to contribute to the mass adoption and popularization of blockchain technologies by implementing the most effective trading and staking tools on the most convenient terms.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | Vesting, Staking |
| Timeline | 22/05/2023 - 24/07/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/Whiteswap-exchange/farming-eth→ |
| Commit | dce4b97 |
Review Scope
- Commit
- dce4b97
Audit Summary
10/10
100%
10/10
10/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 WhiteBIT |
| Audited By | Hacken |
| Website | https://whitebit.com→ |
| Changelog | 29/05/2023 - Initial Review |
| 30/06/2023 - Second Review | |
| 18/07/2023 - Third Review | |
| 24/07/2023 - Fourth Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for WhiteBIT
- Audited By
- Hacken
- Website
- https://whitebit.com→
- Changelog
- 29/05/2023 - Initial Review
- 30/06/2023 - Second Review
- 18/07/2023 - Third Review
- 24/07/2023 - Fourth Review
System Overview
Whitebit is a suite of staking and vesting protocols with the following contracts:
FarmingRewards — a contract that rewards users for staking their tokens. APY depends on the tokens provided by the owner and could not be calculated before reward tokens are deposited.
FarmingRewardsFactory — a factory contract responsible for deploying new instances of FarmingRewards with some predefined values.
Treasure — a contract for locking ERC20 tokens for a specific amount of time.
CustomOwnable — custom implementation of OpenZeppelin’s Ownable without the ability to renounce ownership.
Privileged roles
The owner of the FarmingRewardsFactory contract can change the lock amount for new deployments and the unlock commission percent.
The owner of the Treasure contract can change the fee recipient address.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are provided.
Technical description is provided.
Code quality
The total Code quality score is 10 out of 10.
Development environment is configured.
Solidity Style Guide followed.
Efficient Gas model.
Updated Solidity version.
Best practices implemented.
Test coverage
Code coverage of the project is 100% (branch coverage).
Deployment and basic user interactions are covered with tests.
All possibilities are being tested.
Security score
Upon auditing, the code was found to contain 0 critical, 1 high, 9 medium, and 11 low severity issues. Out of these, 19 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 10. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Users can create their own pools, becoming the owners and introducing any token contracts as rewards and farming. A malicious contract can be used for such tokens.
The system uses the contracts timelock and WhiteSwapV2Factory, which are out of scope and thus its logic cannot be verified.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0902 | Data Consistency; Invalid Calculations | fixed | High | |
| F-2023-0911 | Tx.origin As a Proxy for Msg.sender | fixed | Medium | |
| F-2023-0910 | Integer Overflow | fixed | Medium | |
| F-2023-0909 | Access Control; Undocumented Functionality | mitigated | Medium | |
| F-2023-0908 | Insufficient Balance | fixed | Medium | |
| F-2023-0907 | Uncontrolled Loop of Storage Interactions | fixed | Medium | |
| F-2023-0906 | Best Practice Violation: Checks-Effects-Interactions | fixed | Medium | |
| F-2023-0905 | Floating Point Precision by Rounding Error | fixed | Medium | |
| F-2023-0904 | Undocumented Functionality | fixed | Medium | |
| F-2023-0903 | Best Practice Violation: Unchecked Transfer | fixed | Medium |
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/Whiteswap-exchange/farming-eth→ |
| Commit | dce4b97 |
| Whitepaper | Not provided |
| Requirements | Provided→ |
| Technical Requirements | Provided |
Scope Details
- Commit
- dce4b97
- Whitepaper
- Not provided
- Requirements
- Provided→
- Technical Requirements
- Provided