PhoenixDAO Bridge Contract Initial Audit

Share on facebook
Share on twitter
Share on linkedin

Table of Contents

INTRODUCTION

Key Understandings

PROJECT DETAILS


Name: PheonixDAO Bride ETH2BNB and BNB2ETH (Initial Audit)
Auditor: Moazzam Arif | Shakeib Shaida
Platform: Ethereum/Solidity
Type of review: Bridge Implementation
Methods: Static Analysis and Manual Review
Git Repository: https://github.com/XORD-one/bsc-bridge-contracts/tree/5c67b4c60c1bed1008ad58bd750c8375ee83470c/contracts
Document log: Day1: 17th April 2021 (Initial Audit), Day2: (Final Audit pending)

SCOPE

The git-repository shared was checked for common code violations along with vulnerability-specific probing to detect major issues/vulnerabilities. Some specific checks are as follows:

Code reviewFunctional review
Reentrancy Unchecked external callBusiness Logics Review
Ownership TakeoverERC20 API violationFunctionality Checks
Timestamp DependenceUnchecked mathAccess Control & Authorization
Gas Limit and LoopsUnsafe type inferenceEscrow manipulation
DoS with (Unexpected) ThrowImplicit visibility levelToken Supply manipulation
DoS with Block Gas LimitDeployment ConsistencyAsset’s integrity
Transaction-Ordering DependenceRepository ConsistencyUser Balances manipulation
Style guide violationData ConsistencyKill-Switch Mechanism
Costly LoopOperation Trails & Event Generation

AUDIT REPORT

Executive Summary

The analysis indicates that the contracts audited are secure. However, one issue that can be exploited is the case of frontrunning.

Our team performed a technique called “Filtered Audit”, where the contract was separately audited by two individuals. After their thorough and rigorous process of manual testing, an automated review was carried out using Mythril and Slither. All the flags raised were manually reviewed and re-tested.

Our team found: 

# of issues Severity of the risk
0Critical Risk issue
1High Risk issue
2Medium Risk issue
2Low Risk issue

FINDINGS

Critical-risk issues

No critical issues were found

High-risk issues

  1. Frontrunning:
    function withdrawToken() in ETH2BNBBridge.sol and function mintToken() in BNB2ETH.sol can be exploited by frontrunners. As the functions are public and anyone can invoke them.

Remedy:

Check that function is invoked by the signer by adding a modifier or by adding msg.sender in bytes32 encodeData = keccak256(abi.encode(v1,r1,s1,_nonce, msg.sender))

Medium-risk issues

  1. Signer can mint without burning on the other chain. Maybe due to race conditions on a centralized relayer server.
  2. Reentrancy in function depositToken() at line IERC20(phnxAddress).transferFrom(msg.sender,address(this),amount); if phnxAddress is malicious.

Suggestion: Team ensured that PhoenixAddress won’t be malicious and is also never be set again once deployed

Low-risk issues

  1. Variable shadowing in _nonce  at function withdrawToken(uint256 amount ,uint256 _nonce ,uint8 v1, bytes32 r1, bytes32 s1,uint8 v2, bytes32 r2, bytes32 s2).

Suggestions: use any other name for _nonce

  1. Unchecked zero-address while transferring token in function depositToken() and also in function withdrawToken()

Suggestion: require address(0)

DISCLAIMER

The smart contracts provided by the client for audit purposes have been thoroughly analyzed in compliance with the global best practices till date w.r.t cybersecurity vulnerabilities and issues in smart contract code, the details of which are enclosed in this report. 

This report is not an endorsement or indictment of the project or team, and they do not in any way guarantee the security of the particular object in context. This report is not considered, and should not be interpreted as an influence, on the potential economics of the token, its sale or any other aspect of the project. 

Crypto assets/tokens are results of the emerging blockchain technology in the domain of decentralized finance and they carry with them high levels of technical risk and uncertainty. No report provides any warranty or representation to any third-Party in any respect, including regarding the bug-free nature of code, the business model or proprietors of any such business model, and the legal compliance of any such business. No third-party should rely on the reports in any way, including for the purpose of making any decisions to buy or sell any token, product, service or other asset. Specifically, for the avoidance of doubt, this report does not constitute investment advice, is not intended to be relied upon as investment advice, is not an endorsement of this project or team, and it is not a guarantee as to the absolute security of the project.

Smart contracts are deployed and executed on a blockchain. The platform, its programming language, and other software related to the smart contract can have its vulnerabilities that can lead to hacks. The scope of our review is limited to a review of the Solidity code and only the Solidity code we note as being within the scope of our review within this report. The Solidity language itself remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond Solidity that could present security risks.

This audit cannot be considered as a sufficient assessment regarding the utility and safety of the code, bug-free status or any other statements of the contract. While we have done our best in conducting the analysis and producing this report, it is important to note that you should not rely on this report only – we recommend proceeding with several independent audits and a public bug bounty program to ensure security of smart contracts. 


Read More

Powered By