Introduction
We express our gratitude to the Vechain Foundation team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
VeChain is an enterprise grade, white-label marketplace-as-a-Service solution where enterprises will be able to launch and customise a marketplace for their NFT collections on the vechain blockchain.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Marketplace |
Timeline | 09/11/2023 - 28/11/2023 |
Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
---|---|
Repository | https://github.com/vechainfoundation/nft-maas-sc→ |
Commit | ab09639829a |
Review Scope
- Commit
- ab09639829a
Audit Summary
10/10
90.2%
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 Vechain Foundation |
Audited By | Hacken |
Website | https://www.vechain.org/→ |
Changelog | 16/09/2023 - Initial Review |
28/11/2023 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Vechain Foundation
- Audited By
- Hacken
- Website
- https://www.vechain.org/→
- Changelog
- 16/09/2023 - Initial Review
- 28/11/2023 - Second Review
System Overview
The audit scope is composed by three implementations of marketplaces for ERC721 tokens (VIP181 since the project is going to be deployed on VeChain):
OfferContractVIP180 - a contract which allows to set offers for specific NFTs or NFT collections, the purchase offer might be made with ERC-20/VIP-180 tokens.
WorldOfVBidAuction - a contract for NFT auctions, which allows to set up auctions for the NFT and specify the token which should be used for purchase. Purchase might be made via an ERC-20/VIP-180 token or native token.
WorldOfVFixedPriceNonCustodial - non custodial marketplace where the seller creates a listing and anyone as a buyer may execute the sale by providing the price requested by the seller.
Privileged roles
The role DEFAULTADMINROLE can set “rotate” code to change the operator, and modify the foundation fee.
The role OPERATOR_ROLE can:
Cancel any listing on WorldOfVFixedPriceNonCustodial contract.
Cancel any auction on WorldOfVBidAuction contract.
Pause the contract to block such functionality:
OfferContrctVIP180
WorldOfBidAuction
WorldOfVFixedPriceNonCustodial
Whitelist/de-whitelist VIP-180 and VIP-181 tokens which might be used.
Modify enterprise fees.
Withdraw VTHO tokens from the contracts.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are provided.
Technical description is provided.
NatSpec is complete.
Code quality
The total Code quality score is 10 out of 10.
The development environment is configured.
Test coverage
Code coverage of the project is 90.2% (branch coverage).
Deployment and basic user interactions are covered with tests.
Security score
Upon auditing, the code was found to contain 0 critical, 2 high, 1 medium, and 7 low severity issues. Out of these, 10 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.6. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Fee-on-transfer tokens should not be whitelisted as they are not compatible with the marketplaces.
The marketplaces allow for enterprise and foundation fees, each one is capped to 20%. There is thus the possibility for the marketplace fees to be 40% of the paid price.
The fees amount specified by NFT contracts following the ERC2981 standard, is overridden to be \<= 50%.
The contracts allow OPERATOR_ROLE to perform actions on behalf of the users. Such functionality should be carefully implemented through backend checks to prevent misuse from malicious users.
The contract WorldOfVBidAuction allows to create an auction with a start date in the past, while checking that the end date is in the future.
Auctions on WorldOfVBidAuction are not enforced: the seller can cancel them even when they are expired.
Operators can cancel any auction on WorldOfVBidAuction and any listing on WorldOfVFixedPriceNonCustodial.
Fees in WorldOfVFixedPriceNonCustodial are retroactive: when changed by the administrators, also open listings are affected.
VTHO tokens might be withdrawn from the contract by the Operator.
The contracts are upgradable, the logic and implementation might be changed by the admin.
The proxy implementation is out of scope.
When the OfferContractVIP180 contract is paused any existing offer might still be accepted.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2023-0733 | Requirements Violation, Admin Cannot Cancel Users’ Auctions | fixed | High | |
F-2023-0732 | Denial of Service - Broken Functionality of the Auction | fixed | High | |
F-2023-0734 | Redundant receive() functionality | fixed | Medium | |
F-2023-0741 | Unfinalized Code | fixed | Low | |
F-2023-0740 | Missing Event Emitting | fixed | Low | |
F-2023-0739 | Unvalidated Parameters | fixed | Low | |
F-2023-0738 | Unclear Require Statement Error Strings | fixed | Low | |
F-2023-0737 | Redundant SafeMath Library | fixed | Low | |
F-2023-0736 | Funds Collected By Operators Instead Of By Admins | fixed | Low | |
F-2023-0735 | Check-Effect-Interaction Pattern Violation | fixed | Low |
Identify vulnerabilities in your smart contracts.
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/vechainfoundation/nft-maas-sc→ |
Commit | ab09639829a |
Whitepaper | Not provided |
Requirements | Provided |
Technical Requirements | Provided |
Scope Details
- Commit
- ab09639829a
- Whitepaper
- Not provided
- Requirements
- Provided
- Technical Requirements
- Provided
Contracts in Scope
BaseMarketplaceContract.sol
OfferContractVIP180.sol
WorldOfVBidAuction.sol
WorldOfVFixedPriceNonCustodial.sol
contracts/Governance/Timelock.sol