The contract TempleTeleporter.sol inconsistently handles address encoding and decoding across its cross-chain messaging functions, which could potentially lead to transaction failures, possible loss of funds, and complete system breakdown.
In the teleport function, the recipient address is encoded using addressToBytes32():
However, the _lzReceive function attempts to decode the address directly
Additionally, in the quote function, the address is not encoded using addressToBytes32().
This mismatch causes the _lzReceive function to incorrectly interpret the incoming data, as it's expecting a 20-byte address but receiving a 32-byte value.
This vulnerability will cause all incoming cross-chain transfers to fail, rendering the core functionality of the contract inoperable.
this will lead to token burn but not minted to other chain and user will loss fund
The quote function also calculates the fee incorrectly.
Manual code review
Update the _lzReceive function to correctly decode the bytes32 address:
Update the quote function to correctly encode the bytes32 address:
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.