Introduction
We express our gratitude to the OffBlocks team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
OffBlocks is a hybrid platform for digital assets spending, helps wallet and DeFi companies offer trustless crypto-to-fiat experiences as well as payments and card services.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | Escrow, Smart Wallet, Factory |
| Timeline | 22/03/2024 - 19/04/2024 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/OffBlocks/offblocks-contracts→ |
| Commit | fef94ee4963c49d53c7d217cd6e3e7d5860ec9c3 |
Review Scope
- Commit
- fef94ee4963c49d53c7d217cd6e3e7d5860ec9c3
Audit Summary
10/10
80.24%
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 OffBlocks |
| Audited By | Niccolò Pozzolini, Kornel Światłowski |
| Approved By | Przemyslaw Swiatowiec |
| Website | https://www.offblocks.xyz/→ |
| Changelog | 27/03/2024 - Preliminary Report |
| 19/04/2024 - Final Report |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for OffBlocks
- Audited By
- Niccolò Pozzolini, Kornel Światłowski
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://www.offblocks.xyz/→
- Changelog
- 27/03/2024 - Preliminary Report
- 19/04/2024 - Final Report
System Overview
OffBlocksEscrow - contract handles token deposits and withdrawals coming from smart wallets, specifically designed for the OffBlocks platform. It supports deposit operations, deposit status updates, withdrawals for rejected deposits, and settlement of approved deposits.
OffBlocksSmartWalletFactory - factory contract for OffBlocks smart wallets. Contract owner can also register and unregister third-party smart wallets that will be allowed to interact with the OffBlocksEscrow contract.
OffBlocksSmartWallet - smart wallet contract deployed within OffBlocksSmartWalletFactory.
PendingWithdrawal - helper contract linked deployed during the creation of each OffBlocksSmartWallet. It manages the withdrawal of tokens from OffBlocksSmartWallet after a declared delay.
Privileged roles
Owner of OffBlocksEscrow can:
Adds and removes a token to the list of supported tokens.
Updates the address of the OffBlocks smart wallet factory contract.
Reduces the amount of the given deposit.
Batch updates the statuses of the deposits.
Withdraws the rejected deposit from the escrow to the depositor.
Transfers the approved deposit from the escrow to the settlement wallet.
Pause and unpause contract.
Rescues ERC20 tokens sent to the contract by mistake.
Owner of OffBlocksSmartWallet can:
Initiates a token withdrawal.
Claims the token withdrawal.
Owner of OffBlocksSmartWalletFactory can:
Creates a new OffBlocks smart wallet.
Changes the withdrawal delay.
Registers and unregisters multiple third-party smart wallets.
Rescues ERC20 tokens sent to the contract by mistake.
Owner of PendingWithdrawal can:
Initiates a token withdrawal.
Claims the token withdrawal.
Cancels withdrawal of a token.
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are complete.
Technical description is provided.
Code quality
The total Code Quality score is 10 out of 10.
Test coverage
Code coverage of the project is 80.24% (branch coverage).
Negative cases coverage is missed.
Security score
Upon auditing, the code was found to contain 1 critical, 0 high, 3 medium, and 0 low severity issues. All issues have been fixed, 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.3. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
No additional risks were identified.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-1722 | The batchUpdateDepositStatuses function does not updates statuses | fixed | Critical | |
| F-2024-1743 | Unchecked transfers of ERC20 tokens | fixed | Medium | |
| F-2024-1736 | Lack of deposit status update in reject and settle functions | fixed | Medium | |
| F-2024-1695 | The rescueTokens functionn allows owner to drain all tokens from escrow | fixed | Medium | |
| F-2024-1779 | Unnecessary external call in the smartWalletOwner function | fixed | Observation | |
| F-2024-1750 | Missing two-step ownership transfer process | fixed | Observation | |
| F-2024-1744 | Gas usage of updating Deposit struct can be optimized | fixed | Observation | |
| F-2024-1741 | Redundant getters in OffBlocksSmartWalletFactory.sol | fixed | Observation | |
| F-2024-1740 | PendingWithdrawal only supports one withdrawal per token at a time | accepted | Observation | |
| F-2024-1737 | Unoptimized gas consumption in _checkForInvalidAddress function | fixed | 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/OffBlocks/offblocks-contracts→ |
| Commit | fef94ee4963c49d53c7d217cd6e3e7d5860ec9c3 |
| Whitepaper | https://docs.offblocks.xyz/overview/whitepaper→ |
| Requirements | https://docs.offblocks.xyz/developer-guides/smart-contracts→ |
| Technical Requirements | https://docs.offblocks.xyz/developer-guides/smart-contracts→ |
Scope Details
- Commit
- fef94ee4963c49d53c7d217cd6e3e7d5860ec9c3
- Technical Requirements
- https://docs.offblocks.xyz/developer-guides/smart-contracts→