Introduction
We express our gratitude to the re.al team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
The RWA Ecosystem is a collection of smart contracts that encapsulate a collection of products built to bring a yield generating and governance protocol to active investors.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for re.al |
| Audited By | Olesia Bilenka |
| Approved By | Ataberk Yavuzer |
| Website | https://www.re.al/→ |
| Changelog | 05/09/2024 - Preliminary Report |
| 11/09/2024 - Final Report | |
| Platform | re.al |
| Language | Solidity |
| Tags | Yield Farming |
| Methodology | https://hackenio.cc/sc_methodology→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for re.al
- Audited By
- Olesia Bilenka
- Approved By
- Ataberk Yavuzer
- Website
- https://www.re.al/→
- Changelog
- 05/09/2024 - Preliminary Report
- 11/09/2024 - Final Report
- Platform
- re.al
- Language
- Solidity
- Tags
- Yield Farming
- Methodology
- https://hackenio.cc/sc_methodology→
Review Scope | |
|---|---|
| Repository | https://github.com/re-al-Foundation/rwa-contracts→ |
| Commit | 84f9a90 |
| Remediation commit | 5a8263c |
Review Scope
- Commit
- 84f9a90
- Remediation commit
- 5a8263c
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Technical description and functional requirements are provided.
Natspec is provided.
Code quality
The code follows best practices and official language style guides.
The contract contains redundant functionality that could be streamlined for improved efficiency and clarity.
The development environment is configured.
Test coverage
Code coverage of the project is 92%.
Deployment and basic user interactions are covered with tests.
Negative cases are covered with tests.
System Overview
RWA Ecosystem is a project with the following contracts:
Deployment and basic user interactions are covered with tests. Negative cases are covered with tests.
Privileged roles
The revenueDistributor is allowed to deposit ETH into the contract,
Tthe contract owner is allowed to claim all revenue, set expiration duration for revenue, and updgrade the contract.
Risks
Scope Definition and Security Guarantees: The audit does not cover all code in the repository. Contracts outside the audit scope may introduce vulnerabilities, potentially impacting the overall security due to the interconnected nature of smart contracts.
Dependency on External Logic for Implemented Logic: The implemented depositETH and votingEscrow logic highly depends on external contracts not covered by the audit. This reliance introduces risks if these external contracts are compromised or contain vulnerabilities, affecting the audited project's integrity.
Owner's Unrestricted State Modification: The absence of restrictions on state variable modifications by the owner leads to arbitrary changes, affecting contract integrity and user trust, especially during critical operations like minting phases.
Insufficient Multi-signature Controls for Critical Functions: The lack of multi-signature requirements for key operations centralizes decision-making power, increasing vulnerability to single points of failure or malicious insider actions, potentially leading to unauthorized transactions or configuration changes.
Single Points of Failure and Control: The project is fully or partially centralized, introducing single points of failure and control. This centralization can lead to vulnerabilities in decision-making and operational processes, making the system more susceptible to targeted attacks or manipulation
Missing Domain Separator in RevenueStreamETH: in the RevenueStreamETH contract, the claimWithSignature function allows users to claim ETH by providing a signature from the signer address. However, the data used for the signature does not include the chainId or other necessary fields required for domainSeparator according to EIP-712. This omission may result in the reuse of a signature created for a different chain, contract, or project version, potentially allowing users to withdraw ETH that was not intended for them when currentIndex matches.
Inconsistent ETH Balance Due to Unchecked Withdrawals Via Signatures: the claimWithSignature function allows users to withdraw ETH from the contract without checking if the amount to withdraw is correct, this value is checked off-chain, which may lead to the contract balance no longer accurately reflecting the contract's actual ETH balance, preventing users from withdrawing their ETH.Centralization Risk In Recycling The Expired Eth
Centralization Risk In Recycling The Expired Eth: the owner withdraws an amount of ETH based on the amount parameter, rather than calculating the exact cycle revenue as defined in depositETH. This potentially enables the owner to withdraw any amount of ETH, irrespective of the intended limits.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2024-5768 | Centralization Risk In Recycling The Expired Eth | mitigated | Low | |
| F-2024-5767 | Redundant Functionality In the RevenueStreamETH Contract | fixed | Observation | |
| F-2024-5766 | Floating Pragma | accepted | 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/re-al-Foundation/rwa-contracts→ |
| Commit | 84f9a90a699dd2fbf37e78a475248eabc5e02925 |
| Remediation commit | 5a8263c7b66d07df32f528ce4747ab2321e96acd |
| Whitepaper | https://docs.re.al/→ |
| Requirements | N/A |
| Technical Requirements | N/A |
Scope Details
- Commit
- 84f9a90a699dd2fbf37e78a475248eabc5e02925
- Remediation commit
- 5a8263c7b66d07df32f528ce4747ab2321e96acd
- Whitepaper
- https://docs.re.al/→
- Requirements
- N/A
- Technical Requirements
- N/A