In the TempleTeleporter
contract's teleport
function and TempleGold
contract's send
function. The current implementation burns tokens on the source chain before ensuring they are minted on the destination chain, potentially leading to permanent loss of user funds if the cross-chain message fails to execute properly.
The teleport
function in TempleTeleporter.sol contains a flawed sequence of operations:
The vulnerability arises from the following sequence:
Tokens are burned on the source chain.
A cross-chain message is sent via LayerZero.
There is no mechanism to ensure the successful minting of tokens on the destination chain.
If the cross-chain message fails, the burned tokens are irretrievably lost.
The _lzSend
function does not provide guarantees of message delivery or execution on the destination chain. It only ensures that the message has been accepted by the local LayerZero endpoint.
The impact of this vulnerability is severe:
Users can permanently lose their tokens if the cross-chain message fails to execute properly on the destination chain.
There is no recovery mechanism for users in case of failed transfers.
This vulnerability undermines trust in the protocol and could lead to significant financial losses for users.
The issue could be exploited by malicious actors to intentionally cause token loss by manipulating network conditions or gas prices on the destination chain.
Given the potential for direct and irreversible loss of user funds, this vulnerability should be classified as HIGH.
This vulnerability was identified through manual code review and analysis of the cross-chain token transfer mechanism. No specific automated tools were required to identify this issue.
We recommend following the ABA chain patterns from layer zero, ABA pattern:
Implement a lock-and-mint pattern instead of the current burn-and-mint approach:
Implement a confirmation mechanism on the destination chain:
Add a function to finalize the transfer on the source chain:
The last function need extra implementation to handle the confirmation mechanism (e.g., confirmedTransfers
mapping).
Implement a timeout mechanism allowing users to reclaim locked tokens if the transfer doesn't complete within a specified timeframe.
Add comprehensive event emissions and status tracking for all stages of the cross-chain transfer process.
By implementing these recommendations, the protocol can significantly reduce the risk of permanent token loss and provide a more robust and trustworthy cross-chain transfer mechanism.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.