The TempleGold.sol
and TempleTeleporter.sol
contracts contain send()
and teleport()
functions, respectively, that are marked as payable
. These functions allow users to send Ether to cover cross-chain transfer fees. However, both functions lack a mechanism to refund excess Ether, leading to potential funds being stuck in the contracts.
Both the send function in the TempleGold.sol
contract and the teleport function in the TempleTeleporter.sol
contract are marked as payable
, allowing them to receive Ether. However, neither function implements any mechanism to handle or refund excess Ether sent by users. This creates a vulnerability where surplus Ether can become permanently inaccessible, stuck in the contract.
In the send()
function, users need to send Ether to cover the fees for cross-chain transfers using the LayerZero protocol. In the teleport()
function, users send Ether to cover the costs associated with the cross-chain teleportation of Temple tokens. Users of the teleport function are expected to use the quote()
function to estimate the required fee before executing the transaction. However, due to fluctuations in gas prices and potential inaccuracies in the estimation process, users may end up sending more Ether than needed.
When excess Ether is sent to these functions, it remains in the contract as there are no checks or mechanisms to refund the surplus. This not only leads to users losing their Ether but also results in unnecessary accumulation of Ether within the contract, which cannot be accessed or used.
The vulnerability lies in the lack of refund logic for handling excess Ether, which should be returned to the sender if the actual fee is lower than the amount sent. Without this, the contract effectively traps any extra Ether sent by users, leading to potential financial loss for users and inefficiency in the contract's Ether management.
The excess Ether sent to the contracts can accumulate over time, leading to significant funds being stuck and inaccessible. This issue can result in a loss of funds for users who accidentally send more Ether than required.
Manual Review
VS code
To prevent Ether from getting stuck in the contracts, implement a refund mechanism for any excess Ether sent to the send()
and teleport()
functions.
send()
function in TempleGold.sol
contract:teleport()
function in TempleTeleporter.sol
contract:By implementing these changes, the contracts will ensure that any excess Ether sent by users is promptly refunded, preventing the accumulation of inaccessible funds.
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.