TrustNet Score
The TrustNet Score evaluates crypto projects based on audit results, security, KYC verification, and social media presence. This score offers a quick, transparent view of a project's credibility, helping users make informed decisions in the Web3 space.
Real-Time Threat Detection
Real-time threat detection, powered by Cyvers.io,
is currently not
activated
for this project.
This advanced feature provides continuous monitoring and instant alerts to safeguard your assets from potential security threats. Real-time detection enhances your project's security by proactively identifying and mitigating risks.
For more information, click here.
Security Assessments
Summary and Final Words
No crucial issues found
The contract does not contain issues of high or medium criticality. This means that no known vulnerabilities were found in the source code.
Contract owner cannot mint
It is not possible to mint new tokens.
Contract owner cannot blacklist addresses.
It is not possible to lock user funds by blacklisting addresses.
Contract owner cannot set high fees
The fees, if applicable, can be a maximum of 25% or lower. The contract can therefore not be locked. Please take a look in the comment section for more details.
Contract cannot be locked
Owner cannot lock any user funds.
Token cannot be burned
There is no burning within the contract without any allowances
Ownership is not renounced
The owner retains significant control, which could potentially be used to modify key contract parameters.
Contract is upgradeable
The contract uses a proxy pattern or similar mechanism, enabling future upgrades. This can introduce risks if the upgrade mechanism is not securely managed.
Scope of Work
This audit encompasses the evaluation of the files listed below, each verified with a SHA-1 Hash. The team referenced above has provided the necessary files for assessment.
The auditing process consists of the following systematic steps:
- Specification Review: Analyze the provided specifications, source code, and instructions to fully understand the smart contract's size, scope, and functionality.
- Manual Code Examination: Conduct a thorough line-by-line review of the source code to identify potential vulnerabilities and areas for improvement.
- Specification Alignment: Ensure that the code accurately implements the provided specifications and intended functionalities.
- Test Coverage Assessment: Evaluate the extent and effectiveness of test cases in covering the codebase, identifying any gaps in testing.
- Symbolic Execution: Analyze the smart contract to determine how various inputs affect execution paths, identifying potential edge cases and vulnerabilities.
- Best Practices Evaluation: Assess the smart contracts against established industry and academic best practices to enhance efficiency, maintainability, and security.
- Actionable Recommendations: Provide detailed, specific, and actionable steps to secure and optimize the smart contracts.
A file with a different Hash has been intentionally or otherwise modified after the security review. A different Hash may indicate a changed condition or potential vulnerability that was not within the scope of this review.
Final Words
The following provides a concise summary of the audit report, accompanied by insightful comments from the auditor. This overview captures the key findings and observations, offering valuable context and clarity.
Ownership Privileges
AllowTokens.sol
- The primary address can update the token transfer limits.
- The owner can add the token type.
- The owner can update the token type limits.
- The owner or primary address can add the token.
- The owner can add multiple tokens.
- The owner can remove the allowed tokens.
- The owner can add the confirmations to the contract.
Federation.sol
- The owner can set the bridge contract address.
- The members can vote in a transaction.
- The owner can add/remove members from the contract.
- The owner can change the minimum required vote count value.
- The member can emit the federation details.
Bridge.sol
- The owner can set the side token from the source token.
- The owner can set the original token by the side token.
- The federation contract can process the cross-chain token transfer process.
- The owner can create the side tokens.
- The owner can update the fee percentage to not more than 10%.
- The owner can update the federation contract address.
- The owner can change the allowed token.
- The owner can update the side token factory contract address.
- The owner can enable/disable the cross-token transfer functionality in the contract.
- The owner can update the wrapped currency address.
SideToken.sol
- The minter can mint new tokens.
SideTokenV1.sol
- The minter can mint new tokens.
SideTokenFactory.sol
- The primary address can create new side tokens.
SideTokenFactoryV1.sol
- The primary address can create new side tokens.
MultiSigWallet.sol
- The wallet can add/remove/replace the owners.
- The wallet can change the required confirmations.
- The owner can confirm, revoke, and execute the transactions.
Note - This Audit report consists of a security analysis of the Hathor Bridge smart contracts. This analysis did not include functional testing (or unit testing) of the contract’s logic. Moreover, we only audited one token contract for the Hathor Network team. Other contracts associated with the project were not audited by our team. We recommend investors do their own research before investing.
Files and details
Findings and Audit result
medium Issues | 6 findings
Resolved
#1 medium Issue
Missing 'isContract' check.
The contract lacks a validation check to ensure that specific parameters are contract addresses. Without this check, there is a risk that non-contract addresses (such as externally owned accounts, or EOAs) could be mistakenly set for parameters intended to reference other contracts. This could lead to failures in executing critical interactions within the contract, as EOAs do not support contract-specific functions. To mitigate this, Implement a validation check to ensure that parameters designated as contract addresses are verified as such. This can be done using Solidity’s Address library function isContract, which checks if an address has associated contract code.
Resolved
#2 medium Issue
Missing Non-reentrant check.
The voteTransaction function is vulnerable to reentrancy due to the external call to bridge.acceptTransfer occurring before marking the transaction as processed (processed[transactionId] = true). This allows malicious bridge implementations to re-enter the function, bypassing the processed check and executing the transaction multiple times. To fix this, update the processed[transactionId] flag before making the external call. Additionally, use a reentrancy guard modifier to prevent nested calls. It’s also essential to review the bridge contract for vulnerabilities. These fixes ensure the function is robust against double-execution and potential exploits caused by reentrant behavior.
Resolved
#3 medium Issue
Restrict initDomainSeparator to prevent reinitialization abuse.
The initDomainSeparator function is public and lacks restrictions to prevent it from being called multiple times. This allows unrestricted reinitialization, creating a risk of invalidating previously signed messages if called multiple times. This can disrupt contract functionality, especially if the block.chainid changes (e.g., due to a fork) or if a malicious owner intentionally reinitializes the separator. Invalidating the domainSeparator renders existing signatures unusable, blocking claims or transfers. To fix this, restrict reinitialization by using a flag to allow the function to be called only once. Additionally, emit an event to track initialization for transparency. These measures ensure the integrity of the domainSeparator and prevent misuse or unintended disruptions.
Resolved
#4 medium Issue
Invalid Decimals Conversion
The _claimCrossBackToToken function is vulnerable to invalid decimals conversion if decimals is not between 0 and 18. If decimals > 18, (18 - decimals) becomes negative, leading to a division by zero or underflow. Similarly, if decimals < 0 (unlikely but possible), the calculation of formattedAmount becomes invalid. This can cause reverts or incorrect behavior. To replicate, deploy a token with decimals > 18 and call _claimCrossBackToToken, observing the failure. To fix this, validate the decimals returned by LibUtils.getDecimals to ensure they are within the range of 0 to 18.
Resolved
#5 medium Issue
Missing 'isContract' check.
The contract lacks a validation check to ensure that specific parameters are contract addresses. Without this check, there is a risk that non-contract addresses (such as externally owned accounts, or EOAs) could be mistakenly set for parameters intended to reference other contracts. This could lead to failures in executing critical interactions within the contract, as EOAs do not support contract-specific functions. To mitigate this, Implement a validation check to ensure that parameters designated as contract addresses are verified as such. This can be done using Solidity’s Address library function isContract, which checks if an address has associated contract code.
Resolved
#6 medium Issue
Invalid Decimals Conversion
The _claimCrossBackToToken function is vulnerable to invalid decimals conversion if decimals is not between 0 and 18. If decimals > 18, (18 - decimals) becomes negative, leading to a division by zero or underflow. Similarly, if decimals < 0 (unlikely but possible), the calculation of formattedAmount becomes invalid. This can cause reverts or incorrect behavior. To replicate, deploy a token with decimals > 18 and call _claimCrossBackToToken, observing the failure. To fix this, validate the decimals returned by LibUtils.getDecimals to ensure they are within the range of 0 to 18.
low Issues | 8 findings
Resolved
#1 low Issue
Floating pragma solidity version
Adding the constant version of solidity is recommended, as this prevents the unintentional deployment of a contract with an outdated compiler that contains unresolved bugs.
Resolved
#2 low Issue
Missing limits for set confirmations
The setConfirmations function lacks validation to ensure that confirmation thresholds are within reasonable limits. Without such checks, the system is vulnerable to misuse, either by making the platform unusable or by compromising its security. Adding range validation and governance mechanisms would mitigate these risks.
Acknowledged
#3 low Issue
Local variable shadowing
Rename the local variables that shadow another component.
Acknowledged
#4 low Issue
Remove safemath library
The compiler version above 0.8.0 has the ability to control arithmetic overflow/underflow. It is recommended to remove the unwanted code in order to avoid high gas fees.
Resolved
#5 low Issue
Missing zero or dead address check.
It is recommended to check that the address cannot be zero or dead address.
Resolved
#6 low Issue
Missing events arithmetic
It is recommended to emit all the critical parameter changes.
Acknowledged
#7 low Issue
Missing Duplicate Transactions check.
The contract allows submitting identical transactions (same destination, value, and data) multiple times. this can lead to waste of gas and potential confusion among owners regarding which transaction to confirm. To mitigate this, Use a hash of the transaction parameters to prevent duplicates.
Acknowledged
#8 low Issue
Local variable shadowing
Rename the local variables that shadow another component.
informational Issues | 1 findings
Acknowledged
#1 informational Issue
Unused local variable
It is recommended to use the initialized or declared variable property inside the functions.